acpi,pc,pci,virtio,memory bug fixes
Gabriel, could you please confirm this works fine for you now? Thanks!
The following changes since commit 417c45ab2f847c0a47b1232f611aa886df6a97d5:
ACPI: Remove commented-out code from HPET._CRS (2014-02-10 11:09:33 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to b367d01e7e5829c773aac252da2c9219e2677dac:
Add a 'name' parameter to qemu_thread_create (2014-02-26 16:50:21 +0200)
----------------------------------------------------------------
acpi,pc,pci,virtio,memory bug fixes
This collects several small fixes from all over the place.
----------------------------------------------------------------
Dr. David Alan Gilbert (3):
Rework --name to use QemuOpts
Add 'debug-threads' suboption to --name
Add a 'name' parameter to qemu_thread_createIgor Mammedov (2):
memory_region_present: return false if address is not found in child MemoryRegion
PCIE: fix regression with coldplugged multifunction device
Joel Stanley (1):
virtio-net: remove function calls from assert
Michael S. Tsirkin (2):
acpi-build: append description for non-hotplug
acpi-test-data: update expected files
include/exec/memory.h | 6 +- include/qemu/thread.h | 3 +- cpus.c | 25 +++++-- hw/block/dataplane/virtio-blk.c | 2 +- hw/i386/acpi-build.c | 143 +++++++++++++++++++++++++++++++++------- hw/net/virtio-net.c | 7 +- hw/pci/pcie.c | 16 ++--- hw/usb/ccid-card-emulated.c | 8 +-- libcacard/vscclient.c | 2 +- memory.c | 2 +- migration.c | 2 +- tests/acpi-test.c | 2 +- thread-pool.c | 2 +- ui/vnc-jobs.c | 3 +- util/compatfd.c | 3 +- util/qemu-thread-posix.c | 16 ++++- util/qemu-thread-win32.c | 10 ++- vl.c | 61 +++++++++++++---- hw/i386/acpi-dsdt.dsl | 33 ++-------- hw/i386/q35-acpi-dsdt.dsl | 25 +------ hw/i386/ssdt-pcihp.dsl | 50 ++++++++++++++ qemu-options.hx | 7 +- tests/acpi-test-data/pc/DSDT | Bin 4582 -> 4485 bytes tests/acpi-test-data/pc/SSDT | Bin 2200 -> 2275 bytes tests/acpi-test-data/q35/DSDT | Bin 7438 -> 7383 bytes tests/acpi-test-data/q35/SSDT | Bin 475 -> 564 bytes 26 files changed, 305 insertions(+), 123 deletions(-)
[Qemu-devel] [PULL 1/8] acpi-build: append description for non-hotplug
As reported in
http://article.gmane.org/gmane.comp.emulators.qemu/253987
Mac OSX actually requires describing all occupied slots in ACPI - even if hotplug isn't enabled.
I didn't expect this so I dropped description of all
non hotpluggable slots from ACPI.
As a result: before
commit 99fd437dee468609de8218f0eb3b16621fb6a9c9 (enable hotplug for pci bridges), PCI cards show up in the "device tree" of OS X (System Information). E.g., on MountainLion users have:
Hardware -> PCI Cards:
Card Type Driver Installed Slot *ethernet Ethernet Controller Yes PCI Slot 2 pci8086,2934 USB UHC Yes PCI Slot 29
ethernet:
Type: Ethernet Controller
Driver Installed: Yes
MSI: No
Bus: PCI
Slot PCI Slot 2
Vendor ID: 0x8086
Device ID: 0x100e
Subsystem Vendor ID: 0x1af4
Subsystem ID: 0x1100
Revision ID: 0x0003Hardware -> Ethernet Cards
ethernet:
Type: Ethernet Controller
Bus: PCI
Slot PCI Slot 2
Vendor ID: 0x8086
Device ID: 0x100e
Subsystem Vendor ID: 0x1af4
Subsystem ID: 0x1100
Revision ID: 0x0003
BSD name: en0
Kext name: AppleIntel8254XEthernet.kext
Location: /System/Library/Extensions/...
Version: 3.1.1b1After commit 99fd437dee468609de8218f0eb3b16621fb6a9c9, users get:
Hardware -> PCI Cards:
This computer doesn't contain any PCI cards. If you installed PCI cards, make sure they're properly installed.
Hardware -> Ethernet Cards
ethernet:
Type: Ethernet Controller
Bus: PCI
Vendor ID: 0x8086
Device ID: 0x100e
Subsystem Vendor ID: 0x1af4
Subsystem ID: 0x1100
Revision ID: 0x0003
BSD name: en0
Kext name: AppleIntel8254XEthernet.kext
Location: /System/Library/Extensions/...
Version: 3.1.1b1Ethernet still works, but it's not showing up on the PCI bus, and it no longer thinks it's plugged in to slot #2, as it used to before the change.
To fix, append description for all occupied non hotpluggable PCI slots.
One need to be careful when doing this: VGA devices
are now described in SSDT, so we need to drop description from DSDT. And ISA devices are used in DSDT so drop them from SSDT.
--- hw/i386/acpi-build.c | 143 ++++++++++++++++++++++++++++++++++++++-------- tests/acpi-test.c | 2 +- hw/i386/acpi-dsdt.dsl | 33 ++--------- hw/i386/q35-acpi-dsdt.dsl | 25 +------- hw/i386/ssdt-pcihp.dsl | 50 ++++++++++++++++ 5 files changed, 178 insertions(+), 75 deletions(-)
hw/i386/acpi-build.c +119 -24
@@ -643,6 +643,21 @@ static inline char acpi_get_hex(uint32_t val)#define ACPI_PCIHP_SIZEOF (*ssdt_pcihp_end - *ssdt_pcihp_start)#define ACPI_PCIHP_AML (ssdp_pcihp_aml + *ssdt_pcihp_start) +#define ACPI_PCINOHP_OFFSET_HEX (*ssdt_pcinohp_name - *ssdt_pcinohp_start + 1) +#define ACPI_PCINOHP_OFFSET_ADR (*ssdt_pcinohp_adr - *ssdt_pcinohp_start) +#define ACPI_PCINOHP_SIZEOF (*ssdt_pcinohp_end - *ssdt_pcinohp_start) +#define ACPI_PCINOHP_AML (ssdp_pcihp_aml + *ssdt_pcinohp_start) + +#define ACPI_PCIVGA_OFFSET_HEX (*ssdt_pcivga_name - *ssdt_pcivga_start + 1) +#define ACPI_PCIVGA_OFFSET_ADR (*ssdt_pcivga_adr - *ssdt_pcivga_start) +#define ACPI_PCIVGA_SIZEOF (*ssdt_pcivga_end - *ssdt_pcivga_start) +#define ACPI_PCIVGA_AML (ssdp_pcihp_aml + *ssdt_pcivga_start) + +#define ACPI_PCIQXL_OFFSET_HEX (*ssdt_pciqxl_name - *ssdt_pciqxl_start + 1) +#define ACPI_PCIQXL_OFFSET_ADR (*ssdt_pciqxl_adr - *ssdt_pciqxl_start) +#define ACPI_PCIQXL_SIZEOF (*ssdt_pciqxl_end - *ssdt_pciqxl_start) +#define ACPI_PCIQXL_AML (ssdp_pcihp_aml + *ssdt_pciqxl_start) +#define ACPI_SSDT_SIGNATURE 0x54445353/* SSDT */ #define ACPI_SSDT_HEADER_LENGTH 36
@@ -677,6 +692,33 @@ static void patch_pcihp(int slot, uint8_t *ssdt_ptr) ssdt_ptr[ACPI_PCIHP_OFFSET_ADR +2 ] = slot; } +static void patch_pcinohp (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCINOHP_OFFSET_ADR +2 ] = slot; +} + +static void patch_pcivga (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCIVGA_OFFSET_ADR +2 ] = slot; +} + +static void patch_pciqxl (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCIQXL_OFFSET_ADR +2 ] = slot; +} +/* Assign BSEL property to all buses. In the future, this can be changed * to only assign to buses that support hotplug. */
@@ -737,6 +779,10 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)AcpiBuildPciBusHotplugState *parent = child->parent;GArray *bus_table =build_alloc_array ();DECLARE_BITMAP (slot_hotplug_enable,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_present,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_system,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_vga,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_qxl,PCI_SLOT_MAX );uint8_t op;int i;QObject *bsel;
@@ -764,40 +810,82 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)build_append_byte (bus_table,0x08 );/* NameOp */ build_append_nameseg (bus_table,"BSEL" );build_append_int (bus_table,qint_get_int (qobject_to_qint (bsel))); -memset (slot_hotplug_enable,0xff ,sizeof slot_hotplug_enable); + }else { +/* No bsel - no slots are hot-pluggable */ +memset (slot_hotplug_enable,0x00 ,sizeof slot_hotplug_enable); + } -for (i =0 ; i <ARRAY_SIZE (bus->devices); ++i) { -DeviceClass *dc; -PCIDeviceClass *pc; -PCIDevice *pdev = bus->devices[i]; +memset (slot_device_present,0x00 ,sizeof slot_device_present); +memset (slot_device_system,0x00 ,sizeof slot_device_present); +memset (slot_device_vga,0x00 ,sizeof slot_device_vga); +memset (slot_device_qxl,0x00 ,sizeof slot_device_qxl); -if (!pdev) { -continue ; - } +for (i =0 ; i <ARRAY_SIZE (bus->devices); i +=PCI_FUNC_MAX ) { +DeviceClass *dc; +PCIDeviceClass *pc; +PCIDevice *pdev = bus->devices[i]; +int slot =PCI_SLOT (i); - pc =PCI_DEVICE_GET_CLASS (pdev); - dc =DEVICE_GET_CLASS (pdev); +if (!pdev) { +continue ; + } -if (!dc->hotpluggable || pc->is_bridge) { -int slot =PCI_SLOT (i); +set_bit (slot, slot_device_present); + pc =PCI_DEVICE_GET_CLASS (pdev); + dc =DEVICE_GET_CLASS (pdev); -clear_bit (slot, slot_hotplug_enable); - } +if (pc->class_id ==PCI_CLASS_BRIDGE_ISA ) { +set_bit (slot, slot_device_system); } -/* Append Device object for each slot which supports eject */ -for (i =0 ; i <PCI_SLOT_MAX ; i++) { -bool can_eject =test_bit (i, slot_hotplug_enable); -if (can_eject) { -void *pcihp =acpi_data_push (bus_table, -ACPI_PCIHP_SIZEOF ); -memcpy (pcihp,ACPI_PCIHP_AML ,ACPI_PCIHP_SIZEOF ); -patch_pcihp (i, pcihp); - bus_hotplug_support = true; +if (pc->class_id ==PCI_CLASS_DISPLAY_VGA ) { +set_bit (slot, slot_device_vga); + +if (object_dynamic_cast (OBJECT (pdev),"qxl-vga" )) { +set_bit (slot, slot_device_qxl); } } +if (!dc->hotpluggable || pc->is_bridge) { +clear_bit (slot, slot_hotplug_enable); + } + } + +/* Append Device object for each slot */ +for (i =0 ; i <PCI_SLOT_MAX ; i++) { +bool can_eject =test_bit (i, slot_hotplug_enable); +bool present =test_bit (i, slot_device_present); +bool vga =test_bit (i, slot_device_vga); +bool qxl =test_bit (i, slot_device_qxl); +bool system =test_bit (i, slot_device_system); +if (can_eject) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIHP_SIZEOF ); +memcpy (pcihp,ACPI_PCIHP_AML ,ACPI_PCIHP_SIZEOF ); +patch_pcihp (i, pcihp); + bus_hotplug_support = true; + }else if (qxl) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIQXL_SIZEOF ); +memcpy (pcihp,ACPI_PCIQXL_AML ,ACPI_PCIQXL_SIZEOF ); +patch_pciqxl (i, pcihp); + }else if (vga) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIVGA_SIZEOF ); +memcpy (pcihp,ACPI_PCIVGA_AML ,ACPI_PCIVGA_SIZEOF ); +patch_pcivga (i, pcihp); + }else if (system) { +/* Nothing to do: system devices are in DSDT. */ + }else if (present) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCINOHP_SIZEOF ); +memcpy (pcihp,ACPI_PCINOHP_AML ,ACPI_PCINOHP_SIZEOF ); +patch_pcinohp (i, pcihp); + } + } + +if (bsel) { method =build_alloc_method ("DVNT" ,2 );for (i =0 ; i <PCI_SLOT_MAX ; i++) {
@@ -976,7 +1064,14 @@ build_ssdt(GArray *table_data, GArray *linker, {AcpiBuildPciBusHotplugState hotplug_state; -PCIBus *bus =find_i440fx ();/* TODO: Q35 support */ +Object *pci_host; +PCIBus *bus =NULL ; +bool ambiguous; + + pci_host =object_resolve_path_type ("" ,TYPE_PCI_HOST_BRIDGE , &ambiguous); +if (!ambiguous && pci_host) { + bus =PCI_HOST_BRIDGE (pci_host)->bus; + }build_pci_bus_state_init (&hotplug_state,NULL );
tests/acpi-test.c +1 -1
@@ -153,7 +153,7 @@ static void free_test_data(test_data *data)g_free (temp->aml); }if (temp->aml_file) { -if (g_strstr_len (temp->aml_file,-1 ,"aml-" )) { +if (!temp->asl_file_retain &&g_strstr_len (temp->aml_file,-1 ,"aml-" )) {unlink (temp->aml_file); }g_free (temp->aml_file);
hw/i386/acpi-dsdt.dsl +5 -28
@@ -80,6 +80,8 @@ DefinitionBlock ( Name(_HID, EisaId("PNP0A03")) Name(_ADR, 0x00) Name(_UID, 1) +//#define PX13 S0B_ +// External(PX13, DeviceObj) } }
@@ -88,34 +90,6 @@ DefinitionBlock ( /**************************************************************** - * VGA - ****************************************************************/ - - Scope(\_SB.PCI0) { - Device(VGA) { - Name(_ADR, 0x00020000) - OperationRegion(PCIC, PCI_Config, Zero, 0x4) - Field(PCIC, DWordAcc, NoLock, Preserve) { - VEND, 32 - } - Method(_S1D, 0, NotSerialized) { - Return (0x00) - } - Method(_S2D, 0, NotSerialized) { - Return (0x00) - } - Method(_S3D, 0, NotSerialized) { - If (LEqual(VEND, 0x1001b36)) { - Return (0x03) // QXL - } Else { - Return (0x00) - } - } - } - } - - -/**************************************************************** * PIIX4 PM ****************************************************************/
@@ -132,6 +106,9 @@ DefinitionBlock ( ****************************************************************/ Scope(\_SB.PCI0) { + + External(ISA, DeviceObj) + Device(ISA) { Name(_ADR, 0x00010000)
hw/i386/q35-acpi-dsdt.dsl +3 -22
@@ -72,6 +72,8 @@ DefinitionBlock ( Name(_ADR, 0x00) Name(_UID, 1) + External(ISA, DeviceObj) + // _OSC: based on sample of ACPI3.0b spec Name(SUPP, 0) // PCI _OSC Support Field value Name(CTRL, 0) // PCI _OSC Control Field value
@@ -134,34 +136,13 @@ DefinitionBlock ( /**************************************************************** - * VGA - ****************************************************************/ - - Scope(\_SB.PCI0) { - Device(VGA) { - Name(_ADR, 0x00010000) - Method(_S1D, 0, NotSerialized) { - Return (0x00) - } - Method(_S2D, 0, NotSerialized) { - Return (0x00) - } - Method(_S3D, 0, NotSerialized) { - Return (0x00) - } - } - } - - -/**************************************************************** * LPC ISA bridge ****************************************************************/ Scope(\_SB.PCI0) { /* PCI D31:f0 LPC ISA bridge */ Device(ISA) { - /* PCI D31:f0 */ - Name(_ADR, 0x001f0000) + Name (_ADR, 0x001F0000) // _ADR: Address /* ICH9 PCI to ISA irq remapping */ OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)
hw/i386/ssdt-pcihp.dsl +50 -0
55 lines not on this page · raw message
Signature · 1 line
MST
Re: [Qemu-devel] [PULL 1/8] acpi-build: append description for non-hotplug
Michael,
This seems to work great, on top of current master
(git://git.qemu-project.org/qemu.git).
Did you want me to test how this interacts with any other stuff (i.e. pull from your own git tree), or is this confirmation good enough ?
Thanks again,
--Gabriel
Quoted 464 lines · Michael S. Tsirkin
As reported in
http://article.gmane.org/gmane.comp.emulators.qemu/253987
Mac OSX actually requires describing all occupied slots in ACPI - even if hotplug isn't enabled.I didn't expect this so I dropped description of all
non hotpluggable slots from ACPI.
As a result: before
commit99fd437dee468609de8218f0eb3b16621fb6a9c9(enable hotplug for pci bridges), PCI cards show up in the "device tree" of OS X (System Information). E.g., on MountainLion users have:Hardware -> PCI Cards:
Card Type Driver Installed Slot *ethernet Ethernet Controller Yes PCI Slot 2 pci8086,2934 USB UHC Yes PCI Slot 29ethernet:
Type: Ethernet Controller Driver Installed: Yes MSI: No Bus: PCI Slot PCI Slot 2 Vendor ID: 0x8086 Device ID: 0x100e Subsystem Vendor ID: 0x1af4 Subsystem ID: 0x1100 Revision ID: 0x0003Hardware -> Ethernet Cards
ethernet:
Type: Ethernet Controller Bus: PCI Slot PCI Slot 2 Vendor ID: 0x8086 Device ID: 0x100e Subsystem Vendor ID: 0x1af4 Subsystem ID: 0x1100 Revision ID: 0x0003 BSD name: en0 Kext name: AppleIntel8254XEthernet.kext Location: /System/Library/Extensions/... Version: 3.1.1b1After commit
99fd437dee468609de8218f0eb3b16621fb6a9c9, users get:Hardware -> PCI Cards:
This computer doesn't contain any PCI cards. If you installed PCI cards, make sure they're properly installed.
Hardware -> Ethernet Cards
ethernet:
Type: Ethernet Controller Bus: PCI Vendor ID: 0x8086 Device ID: 0x100e Subsystem Vendor ID: 0x1af4 Subsystem ID: 0x1100 Revision ID: 0x0003 BSD name: en0 Kext name: AppleIntel8254XEthernet.kext Location: /System/Library/Extensions/... Version: 3.1.1b1Ethernet still works, but it's not showing up on the PCI bus, and it no longer thinks it's plugged in to slot #2, as it used to before the change.
To fix, append description for all occupied non hotpluggable PCI slots.
One need to be careful when doing this: VGA devices
are now described in SSDT, so we need to drop description from DSDT. And ISA devices are used in DSDT so drop them from SSDT.Reported-by Gabriel L. Somlo <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/i386/acpi-build.c | 143 ++++++++++++++++++++++++++++++++++++++-------- tests/acpi-test.c | 2 +- hw/i386/acpi-dsdt.dsl | 33 ++--------- hw/i386/q35-acpi-dsdt.dsl | 25 +------- hw/i386/ssdt-pcihp.dsl | 50 ++++++++++++++++ 5 files changed, 178 insertions(+), 75 deletions(-)hw/i386/acpi-build.c +119
-24@@ -643,6 +643,21 @@ static inline char acpi_get_hex(uint32_t val)#define ACPI_PCIHP_SIZEOF (*ssdt_pcihp_end - *ssdt_pcihp_start)#define ACPI_PCIHP_AML (ssdp_pcihp_aml + *ssdt_pcihp_start) +#define ACPI_PCINOHP_OFFSET_HEX (*ssdt_pcinohp_name - *ssdt_pcinohp_start + 1) +#define ACPI_PCINOHP_OFFSET_ADR (*ssdt_pcinohp_adr - *ssdt_pcinohp_start) +#define ACPI_PCINOHP_SIZEOF (*ssdt_pcinohp_end - *ssdt_pcinohp_start) +#define ACPI_PCINOHP_AML (ssdp_pcihp_aml + *ssdt_pcinohp_start) + +#define ACPI_PCIVGA_OFFSET_HEX (*ssdt_pcivga_name - *ssdt_pcivga_start + 1) +#define ACPI_PCIVGA_OFFSET_ADR (*ssdt_pcivga_adr - *ssdt_pcivga_start) +#define ACPI_PCIVGA_SIZEOF (*ssdt_pcivga_end - *ssdt_pcivga_start) +#define ACPI_PCIVGA_AML (ssdp_pcihp_aml + *ssdt_pcivga_start) + +#define ACPI_PCIQXL_OFFSET_HEX (*ssdt_pciqxl_name - *ssdt_pciqxl_start + 1) +#define ACPI_PCIQXL_OFFSET_ADR (*ssdt_pciqxl_adr - *ssdt_pciqxl_start) +#define ACPI_PCIQXL_SIZEOF (*ssdt_pciqxl_end - *ssdt_pciqxl_start) +#define ACPI_PCIQXL_AML (ssdp_pcihp_aml + *ssdt_pciqxl_start) +#define ACPI_SSDT_SIGNATURE 0x54445353/* SSDT */ #define ACPI_SSDT_HEADER_LENGTH 36@@ -677,6 +692,33 @@ static void patch_pcihp(int slot, uint8_t *ssdt_ptr) ssdt_ptr[ACPI_PCIHP_OFFSET_ADR +2 ] = slot; } +static void patch_pcinohp (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCINOHP_OFFSET_ADR +2 ] = slot; +} + +static void patch_pcivga (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCIVGA_OFFSET_ADR +2 ] = slot; +} + +static void patch_pciqxl (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCIQXL_OFFSET_ADR +2 ] = slot; +} +/* Assign BSEL property to all buses. In the future, this can be changed * to only assign to buses that support hotplug. */ @@ -737,6 +779,10 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)AcpiBuildPciBusHotplugState *parent = child->parent;GArray *bus_table =build_alloc_array ();DECLARE_BITMAP (slot_hotplug_enable,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_present,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_system,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_vga,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_qxl,PCI_SLOT_MAX );uint8_t op;int i;QObject *bsel;@@ -764,40 +810,82 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)build_append_byte (bus_table,0x08 );/* NameOp */ build_append_nameseg (bus_table,"BSEL" );build_append_int (bus_table,qint_get_int (qobject_to_qint (bsel))); -memset (slot_hotplug_enable,0xff ,sizeof slot_hotplug_enable); + }else { +/* No bsel - no slots are hot-pluggable */ +memset (slot_hotplug_enable,0x00 ,sizeof slot_hotplug_enable); + } -for (i =0 ; i <ARRAY_SIZE (bus->devices); ++i) { -DeviceClass *dc; -PCIDeviceClass *pc; -PCIDevice *pdev = bus->devices[i]; +memset (slot_device_present,0x00 ,sizeof slot_device_present); +memset (slot_device_system,0x00 ,sizeof slot_device_present); +memset (slot_device_vga,0x00 ,sizeof slot_device_vga); +memset (slot_device_qxl,0x00 ,sizeof slot_device_qxl); -if (!pdev) { -continue ; - } +for (i =0 ; i <ARRAY_SIZE (bus->devices); i +=PCI_FUNC_MAX ) { +DeviceClass *dc; +PCIDeviceClass *pc; +PCIDevice *pdev = bus->devices[i]; +int slot =PCI_SLOT (i); - pc =PCI_DEVICE_GET_CLASS (pdev); - dc =DEVICE_GET_CLASS (pdev); +if (!pdev) { +continue ; + } -if (!dc->hotpluggable || pc->is_bridge) { -int slot =PCI_SLOT (i); +set_bit (slot, slot_device_present); + pc =PCI_DEVICE_GET_CLASS (pdev); + dc =DEVICE_GET_CLASS (pdev); -clear_bit (slot, slot_hotplug_enable); - } +if (pc->class_id ==PCI_CLASS_BRIDGE_ISA ) { +set_bit (slot, slot_device_system); } -/* Append Device object for each slot which supports eject */ -for (i =0 ; i <PCI_SLOT_MAX ; i++) { -bool can_eject =test_bit (i, slot_hotplug_enable); -if (can_eject) { -void *pcihp =acpi_data_push (bus_table, -ACPI_PCIHP_SIZEOF ); -memcpy (pcihp,ACPI_PCIHP_AML ,ACPI_PCIHP_SIZEOF ); -patch_pcihp (i, pcihp); - bus_hotplug_support = true; +if (pc->class_id ==PCI_CLASS_DISPLAY_VGA ) { +set_bit (slot, slot_device_vga); + +if (object_dynamic_cast (OBJECT (pdev),"qxl-vga" )) { +set_bit (slot, slot_device_qxl); } } +if (!dc->hotpluggable || pc->is_bridge) { +clear_bit (slot, slot_hotplug_enable); + } + } + +/* Append Device object for each slot */ +for (i =0 ; i <PCI_SLOT_MAX ; i++) { +bool can_eject =test_bit (i, slot_hotplug_enable); +bool present =test_bit (i, slot_device_present); +bool vga =test_bit (i, slot_device_vga); +bool qxl =test_bit (i, slot_device_qxl); +bool system =test_bit (i, slot_device_system); +if (can_eject) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIHP_SIZEOF ); +memcpy (pcihp,ACPI_PCIHP_AML ,ACPI_PCIHP_SIZEOF ); +patch_pcihp (i, pcihp); + bus_hotplug_support = true; + }else if (qxl) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIQXL_SIZEOF ); +memcpy (pcihp,ACPI_PCIQXL_AML ,ACPI_PCIQXL_SIZEOF ); +patch_pciqxl (i, pcihp); + }else if (vga) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIVGA_SIZEOF ); +memcpy (pcihp,ACPI_PCIVGA_AML ,ACPI_PCIVGA_SIZEOF ); +patch_pcivga (i, pcihp); + }else if (system) { +/* Nothing to do: system devices are in DSDT. */ + }else if (present) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCINOHP_SIZEOF ); +memcpy (pcihp,ACPI_PCINOHP_AML ,ACPI_PCINOHP_SIZEOF ); +patch_pcinohp (i, pcihp); + } + } + +if (bsel) { method =build_alloc_method ("DVNT" ,2 );for (i =0 ; i <PCI_SLOT_MAX ; i++) {@@ -976,7 +1064,14 @@ build_ssdt(GArray *table_data, GArray *linker, {AcpiBuildPciBusHotplugState hotplug_state; -PCIBus *bus =find_i440fx ();/* TODO: Q35 support */ +Object *pci_host; +PCIBus *bus =NULL ; +bool ambiguous; + + pci_host =object_resolve_path_type ("" ,TYPE_PCI_HOST_BRIDGE , &ambiguous); +if (!ambiguous && pci_host) { + bus =PCI_HOST_BRIDGE (pci_host)->bus; + }build_pci_bus_state_init (&hotplug_state,NULL );tests/acpi-test.c +1
-1@@ -153,7 +153,7 @@ static void free_test_data(test_data *data)g_free (temp->aml); }if (temp->aml_file) { -if (g_strstr_len (temp->aml_file,-1 ,"aml-" )) { +if (!temp->asl_file_retain &&g_strstr_len (temp->aml_file,-1 ,"aml-" )) {unlink (temp->aml_file); }g_free (temp->aml_file);hw/i386/acpi-dsdt.dsl +5
-28@@ -80,6 +80,8 @@ DefinitionBlock ( Name(_HID, EisaId("PNP0A03")) Name(_ADR, 0x00) Name(_UID, 1) +//#define PX13 S0B_ +// External(PX13, DeviceObj) } }@@ -88,34 +90,6 @@ DefinitionBlock ( /**************************************************************** - * VGA - ****************************************************************/ - - Scope(\_SB.PCI0) { - Device(VGA) { - Name(_ADR, 0x00020000) - OperationRegion(PCIC, PCI_Config, Zero, 0x4) - Field(PCIC, DWordAcc, NoLock, Preserve) { - VEND, 32 - } - Method(_S1D, 0, NotSerialized) { - Return (0x00) - } - Method(_S2D, 0, NotSerialized) { - Return (0x00) - } - Method(_S3D, 0, NotSerialized) { - If (LEqual(VEND, 0x1001b36)) { - Return (0x03) // QXL - } Else { - Return (0x00) - } - } - } - } - - -/**************************************************************** * PIIX4 PM ****************************************************************/@@ -132,6 +106,9 @@ DefinitionBlock ( ****************************************************************/ Scope(\_SB.PCI0) { + + External(ISA, DeviceObj) + Device(ISA) { Name(_ADR, 0x00010000)hw/i386/q35-acpi-dsdt.dsl +3
-22@@ -72,6 +72,8 @@ DefinitionBlock ( Name(_ADR, 0x00) Name(_UID, 1) + External(ISA, DeviceObj) + // _OSC: based on sample of ACPI3.0b spec Name(SUPP, 0) // PCI _OSC Support Field value Name(CTRL, 0) // PCI _OSC Control Field value@@ -134,34 +136,13 @@ DefinitionBlock ( /**************************************************************** - * VGA - ****************************************************************/ - - Scope(\_SB.PCI0) { - Device(VGA) { - Name(_ADR, 0x00010000) - Method(_S1D, 0, NotSerialized) { - Return (0x00) - } - Method(_S2D, 0, NotSerialized) { - Return (0x00) - } - Method(_S3D, 0, NotSerialized) { - Return (0x00) - } - } - } - - -/**************************************************************** * LPC ISA bridge ****************************************************************/ Scope(\_SB.PCI0) { /* PCI D31:f0 LPC ISA bridge */ Device(ISA) { - /* PCI D31:f0 */ - Name(_ADR, 0x001f0000) + Name (_ADR, 0x001F0000) // _ADR: Address /* ICH9 PCI to ISA irq remapping */ OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)hw/i386/ssdt-pcihp.dsl +50
-0@@ -46,5 +46,55 @@ DefinitionBlock ("ssdt-pcihp.aml", "SSDT", 0x01, "BXPC", "BXSSDTPCIHP", 0x1) } } + ACPI_EXTRACT_DEVICE_START ssdt_pcinohp_start + ACPI_EXTRACT_DEVICE_END ssdt_pcinohp_end + ACPI_EXTRACT_DEVICE_STRING ssdt_pcinohp_name + + // Extract the offsets of the device name, address dword and the slot + // name byte - we fill them in for each device. + Device(SBB) { + ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pcinohp_adr + Name(_ADR, 0xAA0000) + } + + ACPI_EXTRACT_DEVICE_START ssdt_pcivga_start + ACPI_EXTRACT_DEVICE_END ssdt_pcivga_end + ACPI_EXTRACT_DEVICE_STRING ssdt_pcivga_name + + // Extract the offsets of the device name, address dword and the slot + // name byte - we fill them in for each device. + Device(SCC) { + ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pcivga_adr + Name(_ADR, 0xAA0000) + Method(_S1D, 0, NotSerialized) { + Return (0x00) + } + Method(_S2D, 0, NotSerialized) { + Return (0x00) + } + Method(_S3D, 0, NotSerialized) { + Return (0x00) + } + } + + ACPI_EXTRACT_DEVICE_START ssdt_pciqxl_start + ACPI_EXTRACT_DEVICE_END ssdt_pciqxl_end + ACPI_EXTRACT_DEVICE_STRING ssdt_pciqxl_name + + // Extract the offsets of the device name, address dword and the slot + // name byte - we fill them in for each device. + Device(SDD) { + ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pciqxl_adr + Name(_ADR, 0xAA0000) + Method(_S1D, 0, NotSerialized) { + Return (0x00) + } + Method(_S2D, 0, NotSerialized) { + Return (0x00) + } + Method(_S3D, 0, NotSerialized) { + Return (0x03) // QXL + } + } } }Signature · 1 line
MST
Re: [Qemu-devel] [PULL 1/8] acpi-build: append description for non-hotplug
Quoted 10 lines · Gabriel L. Somlo
Michael,
This seems to work great, on top of current master
(git://git.qemu-project.org/qemu.git).Did you want me to test how this interacts with any other stuff (i.e. pull from your own git tree), or is this confirmation good enough ?
Thanks again,
--Gabriel
I think that's good enough, thanks a lot!
Quoted 465 lines · Michael S. Tsirkin
Quoted 464 lines
As reported in
http://article.gmane.org/gmane.comp.emulators.qemu/253987
Mac OSX actually requires describing all occupied slots in ACPI - even if hotplug isn't enabled.I didn't expect this so I dropped description of all
non hotpluggable slots from ACPI.
As a result: before
commit99fd437dee468609de8218f0eb3b16621fb6a9c9(enable hotplug for pci bridges), PCI cards show up in the "device tree" of OS X (System Information). E.g., on MountainLion users have:Hardware -> PCI Cards:
Card Type Driver Installed Slot *ethernet Ethernet Controller Yes PCI Slot 2 pci8086,2934 USB UHC Yes PCI Slot 29ethernet:
Type: Ethernet Controller Driver Installed: Yes MSI: No Bus: PCI Slot PCI Slot 2 Vendor ID: 0x8086 Device ID: 0x100e Subsystem Vendor ID: 0x1af4 Subsystem ID: 0x1100 Revision ID: 0x0003Hardware -> Ethernet Cards
ethernet:
Type: Ethernet Controller Bus: PCI Slot PCI Slot 2 Vendor ID: 0x8086 Device ID: 0x100e Subsystem Vendor ID: 0x1af4 Subsystem ID: 0x1100 Revision ID: 0x0003 BSD name: en0 Kext name: AppleIntel8254XEthernet.kext Location: /System/Library/Extensions/... Version: 3.1.1b1After commit
99fd437dee468609de8218f0eb3b16621fb6a9c9, users get:Hardware -> PCI Cards:
This computer doesn't contain any PCI cards. If you installed PCI cards, make sure they're properly installed.
Hardware -> Ethernet Cards
ethernet:
Type: Ethernet Controller Bus: PCI Vendor ID: 0x8086 Device ID: 0x100e Subsystem Vendor ID: 0x1af4 Subsystem ID: 0x1100 Revision ID: 0x0003 BSD name: en0 Kext name: AppleIntel8254XEthernet.kext Location: /System/Library/Extensions/... Version: 3.1.1b1Ethernet still works, but it's not showing up on the PCI bus, and it no longer thinks it's plugged in to slot #2, as it used to before the change.
To fix, append description for all occupied non hotpluggable PCI slots.
One need to be careful when doing this: VGA devices
are now described in SSDT, so we need to drop description from DSDT. And ISA devices are used in DSDT so drop them from SSDT.Reported-by Gabriel L. Somlo <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/i386/acpi-build.c | 143 ++++++++++++++++++++++++++++++++++++++-------- tests/acpi-test.c | 2 +- hw/i386/acpi-dsdt.dsl | 33 ++--------- hw/i386/q35-acpi-dsdt.dsl | 25 +------- hw/i386/ssdt-pcihp.dsl | 50 ++++++++++++++++ 5 files changed, 178 insertions(+), 75 deletions(-)hw/i386/acpi-build.c +119
-24@@ -643,6 +643,21 @@ static inline char acpi_get_hex(uint32_t val)#define ACPI_PCIHP_SIZEOF (*ssdt_pcihp_end - *ssdt_pcihp_start)#define ACPI_PCIHP_AML (ssdp_pcihp_aml + *ssdt_pcihp_start) +#define ACPI_PCINOHP_OFFSET_HEX (*ssdt_pcinohp_name - *ssdt_pcinohp_start + 1) +#define ACPI_PCINOHP_OFFSET_ADR (*ssdt_pcinohp_adr - *ssdt_pcinohp_start) +#define ACPI_PCINOHP_SIZEOF (*ssdt_pcinohp_end - *ssdt_pcinohp_start) +#define ACPI_PCINOHP_AML (ssdp_pcihp_aml + *ssdt_pcinohp_start) + +#define ACPI_PCIVGA_OFFSET_HEX (*ssdt_pcivga_name - *ssdt_pcivga_start + 1) +#define ACPI_PCIVGA_OFFSET_ADR (*ssdt_pcivga_adr - *ssdt_pcivga_start) +#define ACPI_PCIVGA_SIZEOF (*ssdt_pcivga_end - *ssdt_pcivga_start) +#define ACPI_PCIVGA_AML (ssdp_pcihp_aml + *ssdt_pcivga_start) + +#define ACPI_PCIQXL_OFFSET_HEX (*ssdt_pciqxl_name - *ssdt_pciqxl_start + 1) +#define ACPI_PCIQXL_OFFSET_ADR (*ssdt_pciqxl_adr - *ssdt_pciqxl_start) +#define ACPI_PCIQXL_SIZEOF (*ssdt_pciqxl_end - *ssdt_pciqxl_start) +#define ACPI_PCIQXL_AML (ssdp_pcihp_aml + *ssdt_pciqxl_start) +#define ACPI_SSDT_SIGNATURE 0x54445353/* SSDT */ #define ACPI_SSDT_HEADER_LENGTH 36@@ -677,6 +692,33 @@ static void patch_pcihp(int slot, uint8_t *ssdt_ptr) ssdt_ptr[ACPI_PCIHP_OFFSET_ADR +2 ] = slot; } +static void patch_pcinohp (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCINOHP_OFFSET_ADR +2 ] = slot; +} + +static void patch_pcivga (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCIVGA_OFFSET_ADR +2 ] = slot; +} + +static void patch_pciqxl (int slot,uint8_t *ssdt_ptr) +{ +unsigned devfn =PCI_DEVFN (slot,0 ); + + ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX ] =acpi_get_hex (devfn >>4 ); + ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX +1 ] =acpi_get_hex (devfn); + ssdt_ptr[ACPI_PCIQXL_OFFSET_ADR +2 ] = slot; +} +/* Assign BSEL property to all buses. In the future, this can be changed * to only assign to buses that support hotplug. */ @@ -737,6 +779,10 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)AcpiBuildPciBusHotplugState *parent = child->parent;GArray *bus_table =build_alloc_array ();DECLARE_BITMAP (slot_hotplug_enable,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_present,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_system,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_vga,PCI_SLOT_MAX ); +DECLARE_BITMAP (slot_device_qxl,PCI_SLOT_MAX );uint8_t op;int i;QObject *bsel;@@ -764,40 +810,82 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)build_append_byte (bus_table,0x08 );/* NameOp */ build_append_nameseg (bus_table,"BSEL" );build_append_int (bus_table,qint_get_int (qobject_to_qint (bsel))); -memset (slot_hotplug_enable,0xff ,sizeof slot_hotplug_enable); + }else { +/* No bsel - no slots are hot-pluggable */ +memset (slot_hotplug_enable,0x00 ,sizeof slot_hotplug_enable); + } -for (i =0 ; i <ARRAY_SIZE (bus->devices); ++i) { -DeviceClass *dc; -PCIDeviceClass *pc; -PCIDevice *pdev = bus->devices[i]; +memset (slot_device_present,0x00 ,sizeof slot_device_present); +memset (slot_device_system,0x00 ,sizeof slot_device_present); +memset (slot_device_vga,0x00 ,sizeof slot_device_vga); +memset (slot_device_qxl,0x00 ,sizeof slot_device_qxl); -if (!pdev) { -continue ; - } +for (i =0 ; i <ARRAY_SIZE (bus->devices); i +=PCI_FUNC_MAX ) { +DeviceClass *dc; +PCIDeviceClass *pc; +PCIDevice *pdev = bus->devices[i]; +int slot =PCI_SLOT (i); - pc =PCI_DEVICE_GET_CLASS (pdev); - dc =DEVICE_GET_CLASS (pdev); +if (!pdev) { +continue ; + } -if (!dc->hotpluggable || pc->is_bridge) { -int slot =PCI_SLOT (i); +set_bit (slot, slot_device_present); + pc =PCI_DEVICE_GET_CLASS (pdev); + dc =DEVICE_GET_CLASS (pdev); -clear_bit (slot, slot_hotplug_enable); - } +if (pc->class_id ==PCI_CLASS_BRIDGE_ISA ) { +set_bit (slot, slot_device_system); } -/* Append Device object for each slot which supports eject */ -for (i =0 ; i <PCI_SLOT_MAX ; i++) { -bool can_eject =test_bit (i, slot_hotplug_enable); -if (can_eject) { -void *pcihp =acpi_data_push (bus_table, -ACPI_PCIHP_SIZEOF ); -memcpy (pcihp,ACPI_PCIHP_AML ,ACPI_PCIHP_SIZEOF ); -patch_pcihp (i, pcihp); - bus_hotplug_support = true; +if (pc->class_id ==PCI_CLASS_DISPLAY_VGA ) { +set_bit (slot, slot_device_vga); + +if (object_dynamic_cast (OBJECT (pdev),"qxl-vga" )) { +set_bit (slot, slot_device_qxl); } } +if (!dc->hotpluggable || pc->is_bridge) { +clear_bit (slot, slot_hotplug_enable); + } + } + +/* Append Device object for each slot */ +for (i =0 ; i <PCI_SLOT_MAX ; i++) { +bool can_eject =test_bit (i, slot_hotplug_enable); +bool present =test_bit (i, slot_device_present); +bool vga =test_bit (i, slot_device_vga); +bool qxl =test_bit (i, slot_device_qxl); +bool system =test_bit (i, slot_device_system); +if (can_eject) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIHP_SIZEOF ); +memcpy (pcihp,ACPI_PCIHP_AML ,ACPI_PCIHP_SIZEOF ); +patch_pcihp (i, pcihp); + bus_hotplug_support = true; + }else if (qxl) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIQXL_SIZEOF ); +memcpy (pcihp,ACPI_PCIQXL_AML ,ACPI_PCIQXL_SIZEOF ); +patch_pciqxl (i, pcihp); + }else if (vga) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCIVGA_SIZEOF ); +memcpy (pcihp,ACPI_PCIVGA_AML ,ACPI_PCIVGA_SIZEOF ); +patch_pcivga (i, pcihp); + }else if (system) { +/* Nothing to do: system devices are in DSDT. */ + }else if (present) { +void *pcihp =acpi_data_push (bus_table, +ACPI_PCINOHP_SIZEOF ); +memcpy (pcihp,ACPI_PCINOHP_AML ,ACPI_PCINOHP_SIZEOF ); +patch_pcinohp (i, pcihp); + } + } + +if (bsel) { method =build_alloc_method ("DVNT" ,2 );for (i =0 ; i <PCI_SLOT_MAX ; i++) {@@ -976,7 +1064,14 @@ build_ssdt(GArray *table_data, GArray *linker, {AcpiBuildPciBusHotplugState hotplug_state; -PCIBus *bus =find_i440fx ();/* TODO: Q35 support */ +Object *pci_host; +PCIBus *bus =NULL ; +bool ambiguous; + + pci_host =object_resolve_path_type ("" ,TYPE_PCI_HOST_BRIDGE , &ambiguous); +if (!ambiguous && pci_host) { + bus =PCI_HOST_BRIDGE (pci_host)->bus; + }build_pci_bus_state_init (&hotplug_state,NULL );tests/acpi-test.c +1
-1@@ -153,7 +153,7 @@ static void free_test_data(test_data *data)g_free (temp->aml); }if (temp->aml_file) { -if (g_strstr_len (temp->aml_file,-1 ,"aml-" )) { +if (!temp->asl_file_retain &&g_strstr_len (temp->aml_file,-1 ,"aml-" )) {unlink (temp->aml_file); }g_free (temp->aml_file);hw/i386/acpi-dsdt.dsl +5
-28@@ -80,6 +80,8 @@ DefinitionBlock ( Name(_HID, EisaId("PNP0A03")) Name(_ADR, 0x00) Name(_UID, 1) +//#define PX13 S0B_ +// External(PX13, DeviceObj) } }@@ -88,34 +90,6 @@ DefinitionBlock ( /**************************************************************** - * VGA - ****************************************************************/ - - Scope(\_SB.PCI0) { - Device(VGA) { - Name(_ADR, 0x00020000) - OperationRegion(PCIC, PCI_Config, Zero, 0x4) - Field(PCIC, DWordAcc, NoLock, Preserve) { - VEND, 32 - } - Method(_S1D, 0, NotSerialized) { - Return (0x00) - } - Method(_S2D, 0, NotSerialized) { - Return (0x00) - } - Method(_S3D, 0, NotSerialized) { - If (LEqual(VEND, 0x1001b36)) { - Return (0x03) // QXL - } Else { - Return (0x00) - } - } - } - } - - -/**************************************************************** * PIIX4 PM ****************************************************************/@@ -132,6 +106,9 @@ DefinitionBlock ( ****************************************************************/ Scope(\_SB.PCI0) { + + External(ISA, DeviceObj) + Device(ISA) { Name(_ADR, 0x00010000)hw/i386/q35-acpi-dsdt.dsl +3
-22@@ -72,6 +72,8 @@ DefinitionBlock ( Name(_ADR, 0x00) Name(_UID, 1) + External(ISA, DeviceObj) + // _OSC: based on sample of ACPI3.0b spec Name(SUPP, 0) // PCI _OSC Support Field value Name(CTRL, 0) // PCI _OSC Control Field value@@ -134,34 +136,13 @@ DefinitionBlock ( /**************************************************************** - * VGA - ****************************************************************/ - - Scope(\_SB.PCI0) { - Device(VGA) { - Name(_ADR, 0x00010000) - Method(_S1D, 0, NotSerialized) { - Return (0x00) - } - Method(_S2D, 0, NotSerialized) { - Return (0x00) - } - Method(_S3D, 0, NotSerialized) { - Return (0x00) - } - } - } - - -/**************************************************************** * LPC ISA bridge ****************************************************************/ Scope(\_SB.PCI0) { /* PCI D31:f0 LPC ISA bridge */ Device(ISA) { - /* PCI D31:f0 */ - Name(_ADR, 0x001f0000) + Name (_ADR, 0x001F0000) // _ADR: Address /* ICH9 PCI to ISA irq remapping */ OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)hw/i386/ssdt-pcihp.dsl +50
-0@@ -46,5 +46,55 @@ DefinitionBlock ("ssdt-pcihp.aml", "SSDT", 0x01, "BXPC", "BXSSDTPCIHP", 0x1) } } + ACPI_EXTRACT_DEVICE_START ssdt_pcinohp_start + ACPI_EXTRACT_DEVICE_END ssdt_pcinohp_end + ACPI_EXTRACT_DEVICE_STRING ssdt_pcinohp_name + + // Extract the offsets of the device name, address dword and the slot + // name byte - we fill them in for each device. + Device(SBB) { + ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pcinohp_adr + Name(_ADR, 0xAA0000) + } + + ACPI_EXTRACT_DEVICE_START ssdt_pcivga_start + ACPI_EXTRACT_DEVICE_END ssdt_pcivga_end + ACPI_EXTRACT_DEVICE_STRING ssdt_pcivga_name + + // Extract the offsets of the device name, address dword and the slot + // name byte - we fill them in for each device. + Device(SCC) { + ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pcivga_adr + Name(_ADR, 0xAA0000) + Method(_S1D, 0, NotSerialized) { + Return (0x00) + } + Method(_S2D, 0, NotSerialized) { + Return (0x00) + } + Method(_S3D, 0, NotSerialized) { + Return (0x00) + } + } + + ACPI_EXTRACT_DEVICE_START ssdt_pciqxl_start + ACPI_EXTRACT_DEVICE_END ssdt_pciqxl_end + ACPI_EXTRACT_DEVICE_STRING ssdt_pciqxl_name + + // Extract the offsets of the device name, address dword and the slot + // name byte - we fill them in for each device. + Device(SDD) { + ACPI_EXTRACT_NAME_DWORD_CONST ssdt_pciqxl_adr + Name(_ADR, 0xAA0000) + Method(_S1D, 0, NotSerialized) { + Return (0x00) + } + Method(_S2D, 0, NotSerialized) { + Return (0x00) + } + Method(_S3D, 0, NotSerialized) { + Return (0x03) // QXL + } + } } }Signature · 1 line
MST
[Qemu-devel] [PULL 3/8] virtio-net: remove function calls from assert
In reply to Michael S. TsirkinFrom: Joel Stanley <[email protected]>
peer_{de,at}tach were called from inside assert(). We don't support building without NDEBUG but it's not tidy. Rearrange to attach peer outside assert calls.
--- hw/net/virtio-net.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
hw/net/virtio-net.c +5 -2
@@ -401,12 +401,15 @@ static int peer_detach(VirtIONet *n, int index)static void virtio_net_set_queues (VirtIONet *n) {int i; +int r;for (i =0 ; i < n->max_queues; i++) {if (i < n->curr_queues) { -assert (!peer_attach (n, i)); + r =peer_attach (n, i); +assert (!r); }else { -assert (!peer_detach (n, i)); + r =peer_detach (n, i); +assert (!r); } } }
Signature · 1 line
MST
[Qemu-devel] [PULL 4/8] memory_region_present: return false if address is not found in child MemoryRegion
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
Windows XP shows COM2 port as non functional in "Device Manager" although no COM2 port backing device is present in QEMU.
This regression is really due to 3bb28b7208b349e7a1b326e3c6ef9efac1d462bf?
memory: Provide separate handling of unassigned io ports accesses
That is caused by the fact that QEMU reports to
OSPM that device is present by setting 5th bit in
PII4XPM.pci_conf[0x67] register when COM2 doesn't
exist.
It happens due to memory_region_present(io_as, 0x2f8) returning false positive since 0x2f8 address eventually translates into catchall io_as address space.
Fix memory_region_present(parent, addr) by returning true only if addr maps into a MemoryRegion within parent (excluding parent itself), to match its doc comment.
While at it fix copy/paste error inmemory_region_present() doc comment.
Note: this is a temporary hack: we really need better handling for unassigned regions, we should avoid fallback regions since they are bad for performance (breaking radix tree assumption that the data structure is sparsely populated); for memory we need to fix this to implement PCI master abort properly, anyway.
--- include/exec/memory.h | 6 +++--- memory.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
include/exec/memory.h +3 -3
@@ -838,13 +838,13 @@ void memory_region_set_alias_offset(MemoryRegion *mr, hwaddr offset);/** -* memory_region_present: translate an address/size relative to a -* MemoryRegion into a #MemoryRegionSection. +* memory_region_present: checks if an address relative to a @parent +* translates into #MemoryRegion within @parent * * Answer whether a #MemoryRegion within @parent covers the address * @addr. * -* @parent: a MemoryRegion within which @addr is a relative address +* @parent: a #MemoryRegion within which @addr is a relative address * @addr: the area within @parent to be searched */ bool memory_region_present (MemoryRegion *parent,hwaddr addr);
memory.c +1 -1
@@ -1562,7 +1562,7 @@ static FlatRange *flatview_lookup(FlatView *view, AddrRange addr)bool memory_region_present (MemoryRegion *parent,hwaddr addr) {MemoryRegion *mr =memory_region_find (parent, addr,1 ).mr; -if (!mr) { +if (!mr || (mr == parent)) {return false; }memory_region_unref (mr);
Signature · 1 line
MST
[Qemu-devel] [PULL 7/8] Add 'debug-threads' suboption to --name
In reply to Michael S. TsirkinFrom: "Dr. David Alan Gilbert" <[email protected]>
Add flag storage to qemu-thread-* to store the namethreads flag
--- include/qemu/thread.h | 1 + util/qemu-thread-posix.c | 7 +++++++ util/qemu-thread-win32.c | 8 ++++++++ vl.c | 9 +++++++++ qemu-options.hx | 7 +++++-- 5 files changed, 30 insertions(+), 2 deletions(-)
include/qemu/thread.h +1 -0
@@ -59,5 +59,6 @@ void *qemu_thread_join(QemuThread *thread);void qemu_thread_get_self (QemuThread *thread);bool qemu_thread_is_self (QemuThread *thread);void qemu_thread_exit (void *retval); +void qemu_thread_naming (bool enable);#endif
util/qemu-thread-posix.c +7 -0
@@ -27,6 +27,13 @@#include "qemu/thread.h" #include "qemu/atomic.h" +static bool name_threads; + +void qemu_thread_naming (bool enable) +{ + name_threads = enable; +} +static void error_exit (int err,const char *msg) {fprintf (stderr,"qemu: %s: %s\n" , msg,strerror (err));
util/qemu-thread-win32.c +8 -0
@@ -16,6 +16,14 @@#include <assert.h> #include <limits.h> +static bool name_threads; + +void qemu_thread_naming (bool enable) +{ +/* But note we don't actually name them on Windows yet */ + name_threads = enable; +} +static void error_exit (int err,const char *msg) {char *pstr;
vl.c +9 -0
@@ -548,6 +548,12 @@ static QemuOptsList qemu_name_opts = { .name = "process", .type = QEMU_OPT_STRING, .help = "Sets the name of the QEMU process, as shown in top etc", + }, { + .name = "debug-threads", + .type = QEMU_OPT_BOOL, + .help = "When enabled, name the individual threads; defaults off.\n" + "NOTE: The thread names are for debugging and not a\n" + "stable API.", }, {/* End of list */ } },
@@ -1007,6 +1013,9 @@ static void parse_name(QemuOpts *opts) {const char *proc_name; +if (qemu_opt_get (opts,"debug-threads" )) { +qemu_thread_naming (qemu_opt_get_bool (opts,"debug-threads" , false)); + } qemu_name =qemu_opt_get (opts,"guest" ); proc_name =qemu_opt_get (opts,"process" );
qemu-options.hx +5 -2
@@ -328,9 +328,11 @@ possible drivers and properties, use @code{-device help} and ETEXI DEF("name", HAS_ARG, QEMU_OPTION_name, - "-name string1[,process=string2]\n" + "-name string1[,process=string2][,debug-threads=on|off]\n" " set the name of the guest\n" - " string1 sets the window title and string2 the process name (on Linux)\n", + " string1 sets the window title and string2 the process name (on Linux)\n" + " When debug-threads is enabled, individual threads are given a separate name (on Linux)\n" + " NOTE: The thread names are for debugging and not a stable API.\n", QEMU_ARCH_ALL) STEXI @item -name @var{name}
@@ -339,6 +341,7 @@ Sets the @var{name} of the guest. This name will be displayed in the SDL window caption. The @var{name} will also be used for the VNC server. Also optionally set the top visible process name in Linux. +Naming of individual threads can also be enabled on Linux to aid debugging. ETEXI DEF("uuid", HAS_ARG, QEMU_OPTION_uuid,
Signature · 1 line
MST
[Qemu-devel] [PULL 5/8] PCIE: fix regression with coldplugged multifunction device
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
PCIE is causing asserts each time a multifunction device is added on command line (coldplug).
This is caused by
commit a66e657e18cd9b70e9f57ae5512c07faf2bc508f
pci/pcie: convert PCIE hotplug to use hotplug-handler API
QEMU abort is caused by misplaced assertion, which should be checked only when device is hotplugged.
Reference to regression report:
http://www.mail-archive.com/[email protected]/msg216226.html
--- hw/pci/pcie.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
hw/pci/pcie.c +8 -8
@@ -221,29 +221,23 @@ static void pcie_cap_slot_hotplug_common(PCIDevice *hotplug_dev, DeviceState *dev, uint8_t **exp_cap, Error **errp) { -PCIDevice *pci_dev =PCI_DEVICE (dev); *exp_cap = hotplug_dev->config + hotplug_dev->exp.exp_cap;uint16_t sltsta =pci_get_word (*exp_cap +PCI_EXP_SLTSTA ); -PCIE_DEV_PRINTF (pci_dev,"hotplug state: %d\n" , state); +PCIE_DEV_PRINTF (PCI_DEVICE (dev),"hotplug state: %d\n" , state);if (sltsta &PCI_EXP_SLTSTA_EIS ) {/* the slot is electromechanically locked. * This error is propagated up to qdev and then to HMP/QMP. */ error_setg_errno (errp, -EBUSY ,"slot is electromechanically locked" ); } - -/* TODO: multifunction hot-plug. -* Right now, only a device of function = 0 is allowed to be -* hot plugged/unplugged. -*/ -assert (PCI_FUNC (pci_dev->devfn) ==0 ); }void pcie_cap_slot_hotplug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp) {uint8_t *exp_cap; +PCIDevice *pci_dev =PCI_DEVICE (dev);pcie_cap_slot_hotplug_common (PCI_DEVICE (hotplug_dev), dev, &exp_cap, errp);
@@ -256,6 +250,12 @@ void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,return ; } +/* TODO: multifunction hot-plug. +* Right now, only a device of function = 0 is allowed to be +* hot plugged/unplugged. +*/ +assert (PCI_FUNC (pci_dev->devfn) ==0 ); +pci_word_test_and_set_mask (exp_cap +PCI_EXP_SLTSTA ,PCI_EXP_SLTSTA_PDS );pcie_cap_slot_event (PCI_DEVICE (hotplug_dev),PCI_EXP_HP_EV_PDC );
Signature · 1 line
MST
[Qemu-devel] [PULL 2/8] acpi-test-data: update expected files
In reply to Michael S. Tsirkin--- tests/acpi-test-data/pc/DSDT | Bin 4582 -> 4485 bytes tests/acpi-test-data/pc/SSDT | Bin 2200 -> 2275 bytes tests/acpi-test-data/q35/DSDT | Bin 7438 -> 7383 bytes tests/acpi-test-data/q35/SSDT | Bin 475 -> 564 bytes 4 files changed, 0 insertions(+), 0 deletions(-)
tests/acpi-test-data/pc/DSDT binary +0 -0
tests/acpi-test-data/pc/SSDT binary +0 -0
tests/acpi-test-data/q35/DSDT binary +0 -0
tests/acpi-test-data/q35/SSDT binary +0 -0
Signature · 1 line
MST
[Qemu-devel] [PULL 6/8] Rework --name to use QemuOpts
In reply to Michael S. TsirkinFrom: "Dr. David Alan Gilbert" <[email protected]>
--- vl.c | 52 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 13 deletions(-)
vl.c +39 -13
@@ -532,6 +532,27 @@ static QemuOptsList qemu_msg_opts = { }, }; +static QemuOptsList qemu_name_opts = { + .name ="name" , + .implied_opt_name ="guest" , + .merge_lists = true, + .head =QTAILQ_HEAD_INITIALIZER (qemu_name_opts.head), + .desc = { + { + .name ="guest" , + .type =QEMU_OPT_STRING , + .help ="Sets the name of the guest.\n" +"This name will be displayed in the SDL window caption.\n" +"The name will also be used for the VNC server" , + }, { + .name ="process" , + .type =QEMU_OPT_STRING , + .help ="Sets the name of the QEMU process, as shown in top etc" , + }, + {/* End of list */ } + }, +}; +/** * Get machine options *
@@ -982,6 +1003,18 @@ static int parse_sandbox(QemuOpts *opts, void *opaque)return 0 ; } +static void parse_name (QemuOpts *opts) +{ +const char *proc_name; + + qemu_name =qemu_opt_get (opts,"guest" ); + + proc_name =qemu_opt_get (opts,"process" ); +if (proc_name) { +os_set_proc_name (proc_name); + } +} +bool usb_enabled (bool default_usb) {return qemu_opt_get_bool (qemu_get_machine_opts (),"usb" , default_usb);
@@ -2915,6 +2948,7 @@ int main(int argc, char **argv, char **envp)qemu_add_opts (&qemu_tpmdev_opts);qemu_add_opts (&qemu_realtime_opts);qemu_add_opts (&qemu_msg_opts); +qemu_add_opts (&qemu_name_opts);runstate_init ();
@@ -3650,19 +3684,11 @@ int main(int argc, char **argv, char **envp) "is no longer supported.\n");break ;case QEMU_OPTION_name: - qemu_name =g_strdup (optarg); - { -char *p =strchr (qemu_name,',' ); -if (p !=NULL ) { - *p++ =0 ; -if (strncmp (p,"process=" ,8 )) { -fprintf (stderr,"Unknown subargument %s to -name\n" , p); -exit (1 ); - } - p +=8 ; -os_set_proc_name (p); - } - } + opts =qemu_opts_parse (qemu_find_opts ("name" ), optarg,1 ); +if (!opts) { +exit (1 ); + } +parse_name (opts);break ;case QEMU_OPTION_prom_env:if (nb_prom_envs >=MAX_PROM_ENVS ) {
Signature · 1 line
MST
[Qemu-devel] [PULL 8/8] Add a 'name' parameter to qemu_thread_create
In reply to Michael S. TsirkinFrom: "Dr. David Alan Gilbert" <[email protected]>
If enabled, set the thread name at creation (on GNU systems with
pthread_set_np)
Fix up all the callers with a thread name
--- include/qemu/thread.h | 2 +- cpus.c | 25 ++++++++++++++++++++----- hw/block/dataplane/virtio-blk.c | 2 +- hw/usb/ccid-card-emulated.c | 8 ++++---- libcacard/vscclient.c | 2 +- migration.c | 2 +- thread-pool.c | 2 +- ui/vnc-jobs.c | 3 ++- util/compatfd.c | 3 ++- util/qemu-thread-posix.c | 9 +++++++-- util/qemu-thread-win32.c | 2 +- 11 files changed, 41 insertions(+), 19 deletions(-)
include/qemu/thread.h +1 -1
@@ -52,7 +52,7 @@ void qemu_event_reset(QemuEvent *ev);void qemu_event_wait (QemuEvent *ev);void qemu_event_destroy (QemuEvent *ev); -void qemu_thread_create (QemuThread *thread, +void qemu_thread_create (QemuThread *thread,const char *name,void *(*start_routine)(void *),void *arg,int mode);void *qemu_thread_join (QemuThread *thread);
cpus.c +20 -5
@@ -1117,16 +1117,23 @@ void resume_all_vcpus(void) } } +/* For temporary buffers for forming a name */ +#define VCPU_THREAD_NAME_SIZE 16 +static void qemu_tcg_init_vcpu (CPUState *cpu) { +char thread_name[VCPU_THREAD_NAME_SIZE ]; +/* share a single thread for all cpus with TCG */ if (!tcg_cpu_thread) { cpu->thread =g_malloc0 (sizeof (QemuThread)); cpu->halt_cond =g_malloc0 (sizeof (QemuCond));qemu_cond_init (cpu->halt_cond); tcg_halt_cond = cpu->halt_cond; -qemu_thread_create (cpu->thread, qemu_tcg_cpu_thread_fn, cpu, -QEMU_THREAD_JOINABLE ); +snprintf (thread_name,VCPU_THREAD_NAME_SIZE ,"CPU %d/TCG" , + cpu->cpu_index); +qemu_thread_create (cpu->thread, thread_name, qemu_tcg_cpu_thread_fn, + cpu,QEMU_THREAD_JOINABLE );#ifdef _WIN32 cpu->hThread =qemu_thread_get_handle (cpu->thread);#endif
@@ -1142,11 +1149,15 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)static void qemu_kvm_start_vcpu (CPUState *cpu) { +char thread_name[VCPU_THREAD_NAME_SIZE ]; + cpu->thread =g_malloc0 (sizeof (QemuThread)); cpu->halt_cond =g_malloc0 (sizeof (QemuCond));qemu_cond_init (cpu->halt_cond); -qemu_thread_create (cpu->thread, qemu_kvm_cpu_thread_fn, cpu, -QEMU_THREAD_JOINABLE ); +snprintf (thread_name,VCPU_THREAD_NAME_SIZE ,"CPU %d/KVM" , + cpu->cpu_index); +qemu_thread_create (cpu->thread, thread_name, qemu_kvm_cpu_thread_fn, + cpu,QEMU_THREAD_JOINABLE );while (!cpu->created) {qemu_cond_wait (&qemu_cpu_cond, &qemu_global_mutex); }
@@ -1154,10 +1165,14 @@ static void qemu_kvm_start_vcpu(CPUState *cpu)static void qemu_dummy_start_vcpu (CPUState *cpu) { +char thread_name[VCPU_THREAD_NAME_SIZE ]; + cpu->thread =g_malloc0 (sizeof (QemuThread)); cpu->halt_cond =g_malloc0 (sizeof (QemuCond));qemu_cond_init (cpu->halt_cond); -qemu_thread_create (cpu->thread, qemu_dummy_cpu_thread_fn, cpu, +snprintf (thread_name,VCPU_THREAD_NAME_SIZE ,"CPU %d/DUMMY" , + cpu->cpu_index); +qemu_thread_create (cpu->thread, thread_name, qemu_dummy_cpu_thread_fn, cpu,QEMU_THREAD_JOINABLE );while (!cpu->created) {qemu_cond_wait (&qemu_cpu_cond, &qemu_global_mutex);
hw/block/dataplane/virtio-blk.c +1 -1
@@ -358,7 +358,7 @@ static void start_data_plane_bh(void *opaque)qemu_bh_delete (s->start_bh); s->start_bh =NULL ; -qemu_thread_create (&s->thread, data_plane_thread, +qemu_thread_create (&s->thread,"data_plane" , data_plane_thread, s,QEMU_THREAD_JOINABLE ); }
hw/usb/ccid-card-emulated.c +4 -4
@@ -546,10 +546,10 @@ static int emulated_initfn(CCIDCardState *base)printf ("%s: failed to initialize vcard\n" ,EMULATED_DEV_NAME );return -1 ; } -qemu_thread_create (&card->event_thread_id, event_thread, card, -QEMU_THREAD_JOINABLE ); -qemu_thread_create (&card->apdu_thread_id, handle_apdu_thread, card, -QEMU_THREAD_JOINABLE ); +qemu_thread_create (&card->event_thread_id,"ccid/event" , event_thread, + card,QEMU_THREAD_JOINABLE ); +qemu_thread_create (&card->apdu_thread_id,"ccid/apdu" , handle_apdu_thread, + card,QEMU_THREAD_JOINABLE );return 0 ; }
libcacard/vscclient.c +1 -1
@@ -269,7 +269,7 @@ on_host_init(VSCMsgHeader *mhHeader, VSCMsgInit *incoming)send_msg (VSC_ReaderRemove,VSCARD_MINIMAL_READER_ID ,NULL ,0 );/* launch the event_thread. This will trigger reader adds for all the * existing readers */ -qemu_thread_create (&thread_id, event_thread,NULL ,0 ); +qemu_thread_create (&thread_id,"vsc/event" , event_thread,NULL ,0 );return 0 ; }
migration.c +1 -1
@@ -679,6 +679,6 @@ void migrate_fd_connect(MigrationState *s)/* Notify before starting migration thread */ notifier_list_notify (&migration_state_notifiers, s); -qemu_thread_create (&s->thread, migration_thread, s, +qemu_thread_create (&s->thread,"migration" , migration_thread, s,QEMU_THREAD_JOINABLE ); }
thread-pool.c +1 -1
@@ -140,7 +140,7 @@ static void do_spawn_thread(ThreadPool *pool) pool->new_threads--; pool->pending_threads++; -qemu_thread_create (&t, worker_thread, pool,QEMU_THREAD_DETACHED ); +qemu_thread_create (&t,"worker" , worker_thread, pool,QEMU_THREAD_DETACHED ); }static void spawn_thread_bh_fn (void *opaque)
ui/vnc-jobs.c +2 -1
@@ -333,7 +333,8 @@ void vnc_start_worker_thread(void)return ; q =vnc_queue_init (); -qemu_thread_create (&q->thread, vnc_worker_thread, q,QEMU_THREAD_DETACHED ); +qemu_thread_create (&q->thread,"vnc_worker" , vnc_worker_thread, q, +QEMU_THREAD_DETACHED ); queue = q;/* Set global queue */ }
util/compatfd.c +2 -1
@@ -88,7 +88,8 @@ static int qemu_signalfd_compat(const sigset_t *mask)memcpy (&info->mask, mask,sizeof (*mask)); info->fd = fds[1 ]; -qemu_thread_create (&thread, sigwait_compat, info,QEMU_THREAD_DETACHED ); +qemu_thread_create (&thread,"signalfd_compat" , sigwait_compat, info, +QEMU_THREAD_DETACHED );return fds[0 ]; }
util/qemu-thread-posix.c +7 -2
@@ -394,8 +394,7 @@ void qemu_event_wait(QemuEvent *ev) } } - -void qemu_thread_create (QemuThread *thread, +void qemu_thread_create (QemuThread *thread,const char *name,void *(*start_routine)(void *),void *arg,int mode) {
@@ -421,6 +420,12 @@ void qemu_thread_create(QemuThread *thread,if (err)error_exit (err, __func__); +#ifdef _GNU_SOURCE +if (name_threads) { +pthread_setname_np (thread->thread, name); + } +#endif +pthread_sigmask (SIG_SETMASK , &oldset,NULL );pthread_attr_destroy (&attr);
util/qemu-thread-win32.c +1 -1
@@ -333,7 +333,7 @@ void *qemu_thread_join(QemuThread *thread)return ret; } -void qemu_thread_create (QemuThread *thread, +void qemu_thread_create (QemuThread *thread,const char *name,void *(*start_routine)(void *),void *arg,int mode) {
Signature · 1 line
MST