Use ACPI PCI hot-plug for Q35
v6 cover Use ACPI PCI hot-plug for Q35
The patch set consists of two parts:
patches 1-3: introduce new feature
'acpi-pci-hotplug-with-bridge-support' on Q35
patches 4-6: make the feature default along with changes in ACPI tables
With the feature disabled Q35 falls back to the native hot-plug.
Pros
* no racy behavior during boot (see 110c477c2ed)
* eject is possible - according to PCIe spec, attention button press should lead to power off, and then the adapter should be removed manually. As there is no power down state exists in QEMU, we cannot distinguish between an eject and a power down request.
* no delay during deleting - after the actual power off software must wait at least 1 second before indicating about it. This case is quite important for users, it even has its own bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1594168
* no timer-based behavior - in addition to the previous example, the attention button has a 5-second waiting period, during which the operation can be canceled with a second press. While this looks fine for manual button control, automation will result in the need to queue or drop events, and the software receiving events in all sort of unspecified combinations of attention/power indicator states, which is racy and uppredictable.
* fixes or reduces the likelihood of the bugs:
* https://bugzilla.redhat.com/show_bug.cgi?id=1833187
* https://bugzilla.redhat.com/show_bug.cgi?id=1657077
* https://bugzilla.redhat.com/show_bug.cgi?id=1669931
* https://bugzilla.redhat.com/show_bug.cgi?id=1678290
Cons:
* no access to possible features presented in slot capabilities (this is only surprise removal AFAIK)
v6:
* move acpi_pcihp_disable_root_bus() changes into "Enable ACPI PCI hot-plug" patch
* fix mips compilation [Michael, Marcel]
* additional check in pm_reset() [David]
* rename property to "native-hotplug" [Igor]
v5:
* make sugar property on TYPE_PCIE_SLOT
instead of old TYPE_MACHINE property [Igor]
* minor style changes
v4:
* regain per-port control over hot-plug
* rebased over acpi-index changes
* set property on machine type to
make pci code more generic [Igor, Michael]
v3:
* drop change of _OSC to allow SHPC on hotplugged bridges
* use 'acpi-root-pci-hotplug'
* add migration states [Igor]
* minor style changes
v2:
* new ioport range for acpiphp [Gerd]
* drop find_pci_host() [Igor]
* explain magic numbers in _OSC [Igor]
* drop build_q35_pci_hotplug() wrapper [Igor]
Julia Suvorova (6):
hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35 hw/acpi/ich9: Enable ACPI PCI hot-plug hw/pci/pcie: Do not set HPC flag if acpihp is used
bios-tables-test: Allow changes in DSDT ACPI tables hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35
bios-tables-test: Update golden binaries
hw/i386/acpi-build.h | 5 +++ include/hw/acpi/ich9.h | 5 +++ include/hw/acpi/pcihp.h | 3 +- include/hw/pci/pcie_port.h | 5 ++- hw/acpi/acpi-x86-stub.c | 6 +++ hw/acpi/ich9.c | 70 ++++++++++++++++++++++++++++++ hw/acpi/pcihp.c | 26 ++++++++--- hw/acpi/piix4.c | 4 +- hw/core/machine.c | 1 - hw/i386/acpi-build.c | 44 ++++++++++++------- hw/i386/pc.c | 1 + hw/i386/pc_q35.c | 11 +++++ hw/pci/pcie.c | 8 +++- hw/pci/pcie_port.c | 1 + tests/data/acpi/q35/DSDT | Bin 7859 -> 8289 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9184 -> 9614 bytes tests/data/acpi/q35/DSDT.bridge | Bin 7877 -> 11003 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8323 -> 8753 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9513 -> 9943 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 7934 -> 8364 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9218 -> 9648 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 8990 -> 9419 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 7717 -> 8147 bytes tests/data/acpi/q35/DSDT.numamem | Bin 7865 -> 8295 bytes tests/data/acpi/q35/DSDT.tis | Bin 8465 -> 8894 bytes 25 files changed, 165 insertions(+), 25 deletions(-)
Signature · 1 line
2.30.2
PATCH v6 1/6 hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35
Implement notifications and gpe to support q35 ACPI PCI hot-plug. Use 0xcc4 - 0xcd7 range for 'acpi-pci-hotplug' io ports.
--- hw/i386/acpi-build.h | 4 ++++ include/hw/acpi/ich9.h | 2 ++ include/hw/acpi/pcihp.h | 3 ++- hw/acpi/pcihp.c | 6 +++--- hw/acpi/piix4.c | 4 +++- hw/i386/acpi-build.c | 30 +++++++++++++++++++----------- 6 files changed, 33 insertions(+), 16 deletions(-)
hw/i386/acpi-build.h +4 -0
@@ -5,6 +5,10 @@extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsmio; +/* PCI Hot-plug registers bases. See docs/spec/acpi_pci_hotplug.txt */ +#define ACPI_PCIHP_SEJ_BASE 0x8 +#define ACPI_PCIHP_BNMR_BASE 0x10 +void acpi_setup (void );#endif
include/hw/acpi/ich9.h +2 -0
@@ -28,6 +28,8 @@#include "hw/acpi/acpi_dev_interface.h" #include "hw/acpi/tco.h" +#define ACPI_PCIHP_ADDR_ICH9 0x0cc4 + typedef struct ICH9LPCPMRegs { /* * In ich9 spec says that pm1_cnt register is 32bit width and
include/hw/acpi/pcihp.h +2 -1
@@ -55,7 +55,8 @@ typedef struct AcpiPciHpState { } AcpiPciHpState;void acpi_pcihp_init (Object *owner,AcpiPciHpState *,PCIBus *root, -MemoryRegion *address_space_io,bool bridges_enabled); +MemoryRegion *address_space_io,bool bridges_enabled, +uint16_t io_base);void acpi_pcihp_device_pre_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp);
hw/acpi/pcihp.c +3 -3
@@ -37,7 +37,6 @@#include "qom/qom-qobject.h" #include "trace.h" -#define ACPI_PCIHP_ADDR 0xae00#define ACPI_PCIHP_SIZE 0x0018#define PCI_UP_BASE 0x0000#define PCI_DOWN_BASE 0x0004
@@ -488,10 +487,11 @@ static const MemoryRegionOps acpi_pcihp_io_ops = { };void acpi_pcihp_init (Object *owner,AcpiPciHpState *s,PCIBus *root_bus, -MemoryRegion *address_space_io,bool bridges_enabled) +MemoryRegion *address_space_io,bool bridges_enabled, +uint16_t io_base) { s->io_len =ACPI_PCIHP_SIZE ; - s->io_base =ACPI_PCIHP_ADDR ; + s->io_base = io_base; s->root = root_bus; s->legacy_piix = !bridges_enabled;
hw/acpi/piix4.c +3 -1
@@ -49,6 +49,8 @@#define GPE_BASE 0xafe0#define GPE_LEN 4 +#define ACPI_PCIHP_ADDR_PIIX4 0xae00 +struct pci_status {uint32_t up;/* deprecated, maintained for migration compatibility */ uint32_t down;
@@ -607,7 +609,7 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) {acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, - s->use_acpi_hotplug_bridge); + s->use_acpi_hotplug_bridge,ACPI_PCIHP_ADDR_PIIX4 ); } s->cpu_hotplug_legacy = true;
hw/i386/acpi-build.c +19 -11
@@ -219,10 +219,6 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ pm->fadt.rev =1 ; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; - pm->pcihp_io_base = -object_property_get_uint (obj,ACPI_PCIHP_IO_BASE_PROP ,NULL ); - pm->pcihp_io_len = -object_property_get_uint (obj,ACPI_PCIHP_IO_LEN_PROP ,NULL ); }if (lpc) { uint64_t smi_features = object_property_get_uint(lpc,
@@ -238,6 +234,10 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm) pm->smi_on_cpu_unplug = !!(smi_features &BIT_ULL (ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT )); } + pm->pcihp_io_base = +object_property_get_uint (obj,ACPI_PCIHP_IO_BASE_PROP ,NULL ); + pm->pcihp_io_len = +object_property_get_uint (obj,ACPI_PCIHP_IO_LEN_PROP ,NULL );/* The above need not be conditional on machine type because the reset port * happens to be the same on PIIX (pc) and ICH9 (q35). */
@@ -392,6 +392,9 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,if (!pdev) {if (bsel) {/* add hotplug slots for non present devices */ +if (pci_bus_is_express (bus) && slot >0 ) { +break ; + } dev =aml_device ("S%.02X" ,PCI_DEVFN (slot,0 ));aml_append (dev,aml_name_decl ("_SUN" ,aml_int (slot)));aml_append (dev,aml_name_decl ("_ADR" ,aml_int (slot <<16 )));
@@ -521,7 +524,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, QLIST_FOREACH(sec, &bus->child, sibling) {int32_t devfn = sec->parent_dev->devfn; -if (pci_bus_is_root (sec) ||pci_bus_is_express (sec)) { +if (pci_bus_is_root (sec)) {continue ; }
@@ -1251,7 +1254,7 @@ static void build_piix4_isa_bridge(Aml *table)aml_append (table, scope); } -static void build_piix4_pci_hotplug (Aml *table) +static void build_x86_acpi_pci_hotplug (Aml *table,uint64_t pcihp_addr) {Aml *scope;Aml *field;
@@ -1260,20 +1263,22 @@ static void build_piix4_pci_hotplug(Aml *table) scope =aml_scope ("_SB.PCI0" );aml_append (scope, -aml_operation_region ("PCST" ,AML_SYSTEM_IO ,aml_int (0xae00 ),0x08 )); +aml_operation_region ("PCST" ,AML_SYSTEM_IO ,aml_int (pcihp_addr),0x08 )); field =aml_field ("PCST" ,AML_DWORD_ACC ,AML_NOLOCK ,AML_WRITE_AS_ZEROS );aml_append (field,aml_named_field ("PCIU" ,32 ));aml_append (field,aml_named_field ("PCID" ,32 ));aml_append (scope, field);aml_append (scope, -aml_operation_region ("SEJ" ,AML_SYSTEM_IO ,aml_int (0xae08 ),0x04 )); +aml_operation_region ("SEJ" ,AML_SYSTEM_IO , +aml_int (pcihp_addr +ACPI_PCIHP_SEJ_BASE ),0x04 )); field =aml_field ("SEJ" ,AML_DWORD_ACC ,AML_NOLOCK ,AML_WRITE_AS_ZEROS );aml_append (field,aml_named_field ("B0EJ" ,32 ));aml_append (scope, field);aml_append (scope, -aml_operation_region ("BNMR" ,AML_SYSTEM_IO ,aml_int (0xae10 ),0x08 )); +aml_operation_region ("BNMR" ,AML_SYSTEM_IO , +aml_int (pcihp_addr +ACPI_PCIHP_BNMR_BASE ),0x08 )); field =aml_field ("BNMR" ,AML_DWORD_ACC ,AML_NOLOCK ,AML_WRITE_AS_ZEROS );aml_append (field,aml_named_field ("BNUM" ,32 ));aml_append (field,aml_named_field ("PIDX" ,32 ));
@@ -1407,7 +1412,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,build_piix4_isa_bridge (dsdt);build_isa_devices_aml (dsdt);if (pm->pcihp_bridge_en || pm->pcihp_root_en) { -build_piix4_pci_hotplug (dsdt); +build_x86_acpi_pci_hotplug (dsdt, pm->pcihp_io_base); }build_piix4_pci0_int (dsdt); }else {
@@ -1455,6 +1460,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, }build_q35_isa_bridge (dsdt);build_isa_devices_aml (dsdt); +if (pm->pcihp_bridge_en) { +build_x86_acpi_pci_hotplug (dsdt, pm->pcihp_io_base); + }build_q35_pci0_int (dsdt);if (pcms->smbus && !pcmc->do_not_add_smb_acpi) {build_smb0 (dsdt, pcms->smbus,ICH9_SMB_DEV ,ICH9_SMB_FUNC );
@@ -1489,7 +1497,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, {aml_append (scope,aml_name_decl ("_HID" ,aml_string ("ACPI0006" ))); -if (misc->is_piix4 && (pm->pcihp_bridge_en || pm->pcihp_root_en)) { +if (pm->pcihp_bridge_en || pm->pcihp_root_en) { method =aml_method ("_E01" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_acquire (aml_name ("\\_SB.PCI0.BLCK" ),0xFFFF ));
Signature · 1 line
2.30.2
Re: [PATCH v6 1/6] hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35
Quoted 6 lines · Julia Suvorova
Implement notifications and gpe to support q35 ACPI PCI hot-plug. Use
0xcc4-0xcd7range for 'acpi-pci-hotplug' io ports.Signed-off-by Julia Suvorova <[email protected]>Reviewed-by Igor Mammedov <[email protected]>Reviewed-by Marcel Apfelbaum <[email protected]>
I'm not especially familiar with either x86 or ACPI code, so my review's depth is according.
Quoted 207 lines
--- hw/i386/acpi-build.h | 4 ++++ include/hw/acpi/ich9.h | 2 ++ include/hw/acpi/pcihp.h | 3 ++- hw/acpi/pcihp.c | 6 +++--- hw/acpi/piix4.c | 4 +++- hw/i386/acpi-build.c | 30 +++++++++++++++++++----------- 6 files changed, 33 insertions(+), 16 deletions(-)hw/i386/acpi-build.h +4
-0@@ -5,6 +5,10 @@extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsmio; +/* PCI Hot-plug registers bases. See docs/spec/acpi_pci_hotplug.txt */ +#define ACPI_PCIHP_SEJ_BASE 0x8 +#define ACPI_PCIHP_BNMR_BASE 0x10 +void acpi_setup (void );#endif include/hw/acpi/ich9.h +2
-0@@ -28,6 +28,8 @@#include "hw/acpi/acpi_dev_interface.h" #include "hw/acpi/tco.h" +#define ACPI_PCIHP_ADDR_ICH9 0x0cc4 + typedef struct ICH9LPCPMRegs { /* * In ich9 spec says that pm1_cnt register is 32bit width andinclude/hw/acpi/pcihp.h +2
-1@@ -55,7 +55,8 @@ typedef struct AcpiPciHpState { } AcpiPciHpState;void acpi_pcihp_init (Object *owner,AcpiPciHpState *,PCIBus *root, -MemoryRegion *address_space_io,bool bridges_enabled); +MemoryRegion *address_space_io,bool bridges_enabled, +uint16_t io_base);void acpi_pcihp_device_pre_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev,Error **errp);hw/acpi/pcihp.c +3
-3@@ -37,7 +37,6 @@#include "qom/qom-qobject.h" #include "trace.h" -#define ACPI_PCIHP_ADDR 0xae00#define ACPI_PCIHP_SIZE 0x0018#define PCI_UP_BASE 0x0000#define PCI_DOWN_BASE 0x0004@@ -488,10 +487,11 @@ static const MemoryRegionOps acpi_pcihp_io_ops = { };void acpi_pcihp_init (Object *owner,AcpiPciHpState *s,PCIBus *root_bus, -MemoryRegion *address_space_io,bool bridges_enabled) +MemoryRegion *address_space_io,bool bridges_enabled, +uint16_t io_base) { s->io_len =ACPI_PCIHP_SIZE ; - s->io_base =ACPI_PCIHP_ADDR ; + s->io_base = io_base; s->root = root_bus; s->legacy_piix = !bridges_enabled;hw/acpi/piix4.c +3
-1@@ -49,6 +49,8 @@#define GPE_BASE 0xafe0#define GPE_LEN 4 +#define ACPI_PCIHP_ADDR_PIIX4 0xae00 +struct pci_status {uint32_t up;/* deprecated, maintained for migration compatibility */ uint32_t down;@@ -607,7 +609,7 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) {acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, - s->use_acpi_hotplug_bridge); + s->use_acpi_hotplug_bridge,ACPI_PCIHP_ADDR_PIIX4 ); } s->cpu_hotplug_legacy = true;hw/i386/acpi-build.c +19
-11@@ -219,10 +219,6 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ pm->fadt.rev =1 ; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; - pm->pcihp_io_base = -object_property_get_uint (obj,ACPI_PCIHP_IO_BASE_PROP ,NULL ); - pm->pcihp_io_len = -object_property_get_uint (obj,ACPI_PCIHP_IO_LEN_PROP ,NULL ); }if (lpc) { uint64_t smi_features = object_property_get_uint(lpc,@@ -238,6 +234,10 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm) pm->smi_on_cpu_unplug = !!(smi_features &BIT_ULL (ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT )); } + pm->pcihp_io_base = +object_property_get_uint (obj,ACPI_PCIHP_IO_BASE_PROP ,NULL ); + pm->pcihp_io_len = +object_property_get_uint (obj,ACPI_PCIHP_IO_LEN_PROP ,NULL );/* The above need not be conditional on machine type because the reset port * happens to be the same on PIIX (pc) and ICH9 (q35). */ @@ -392,6 +392,9 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,if (!pdev) {if (bsel) {/* add hotplug slots for non present devices */ +if (pci_bus_is_express (bus) && slot >0 ) { +break ; + } dev =aml_device ("S%.02X" ,PCI_DEVFN (slot,0 ));aml_append (dev,aml_name_decl ("_SUN" ,aml_int (slot)));aml_append (dev,aml_name_decl ("_ADR" ,aml_int (slot <<16 )));@@ -521,7 +524,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, QLIST_FOREACH(sec, &bus->child, sibling) {int32_t devfn = sec->parent_dev->devfn; -if (pci_bus_is_root (sec) ||pci_bus_is_express (sec)) { +if (pci_bus_is_root (sec)) {continue ; }@@ -1251,7 +1254,7 @@ static void build_piix4_isa_bridge(Aml *table)aml_append (table, scope); } -static void build_piix4_pci_hotplug (Aml *table) +static void build_x86_acpi_pci_hotplug (Aml *table,uint64_t pcihp_addr) {Aml *scope;Aml *field;@@ -1260,20 +1263,22 @@ static void build_piix4_pci_hotplug(Aml *table) scope =aml_scope ("_SB.PCI0" );aml_append (scope, -aml_operation_region ("PCST" ,AML_SYSTEM_IO ,aml_int (0xae00 ),0x08 )); +aml_operation_region ("PCST" ,AML_SYSTEM_IO ,aml_int (pcihp_addr),0x08 )); field =aml_field ("PCST" ,AML_DWORD_ACC ,AML_NOLOCK ,AML_WRITE_AS_ZEROS );aml_append (field,aml_named_field ("PCIU" ,32 ));aml_append (field,aml_named_field ("PCID" ,32 ));aml_append (scope, field);aml_append (scope, -aml_operation_region ("SEJ" ,AML_SYSTEM_IO ,aml_int (0xae08 ),0x04 )); +aml_operation_region ("SEJ" ,AML_SYSTEM_IO , +aml_int (pcihp_addr +ACPI_PCIHP_SEJ_BASE ),0x04 )); field =aml_field ("SEJ" ,AML_DWORD_ACC ,AML_NOLOCK ,AML_WRITE_AS_ZEROS );aml_append (field,aml_named_field ("B0EJ" ,32 ));aml_append (scope, field);aml_append (scope, -aml_operation_region ("BNMR" ,AML_SYSTEM_IO ,aml_int (0xae10 ),0x08 )); +aml_operation_region ("BNMR" ,AML_SYSTEM_IO , +aml_int (pcihp_addr +ACPI_PCIHP_BNMR_BASE ),0x08 )); field =aml_field ("BNMR" ,AML_DWORD_ACC ,AML_NOLOCK ,AML_WRITE_AS_ZEROS );aml_append (field,aml_named_field ("BNUM" ,32 ));aml_append (field,aml_named_field ("PIDX" ,32 ));@@ -1407,7 +1412,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,build_piix4_isa_bridge (dsdt);build_isa_devices_aml (dsdt);if (pm->pcihp_bridge_en || pm->pcihp_root_en) { -build_piix4_pci_hotplug (dsdt); +build_x86_acpi_pci_hotplug (dsdt, pm->pcihp_io_base); }build_piix4_pci0_int (dsdt); }else {@@ -1455,6 +1460,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, }build_q35_isa_bridge (dsdt);build_isa_devices_aml (dsdt); +if (pm->pcihp_bridge_en) { +build_x86_acpi_pci_hotplug (dsdt, pm->pcihp_io_base); + }build_q35_pci0_int (dsdt);if (pcms->smbus && !pcmc->do_not_add_smb_acpi) {build_smb0 (dsdt, pcms->smbus,ICH9_SMB_DEV ,ICH9_SMB_FUNC );@@ -1489,7 +1497,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, {aml_append (scope,aml_name_decl ("_HID" ,aml_string ("ACPI0006" ))); -if (misc->is_piix4 && (pm->pcihp_bridge_en || pm->pcihp_root_en)) { +if (pm->pcihp_bridge_en || pm->pcihp_root_en) { method =aml_method ("_E01" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_acquire (aml_name ("\\_SB.PCI0.BLCK" ),0xFFFF ));
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH v6 2/6 hw/acpi/ich9: Enable ACPI PCI hot-plug
In reply to Julia SuvorovaAdd acpi_pcihp to ich9_pm as part of 'acpi-pci-hotplug-with-bridge-support' option. Set default to false.
--- hw/i386/acpi-build.h | 1 + include/hw/acpi/ich9.h | 3 ++ hw/acpi/acpi-x86-stub.c | 6 ++++ hw/acpi/ich9.c | 70 +++++++++++++++++++++++++++++++++++++++++ hw/acpi/pcihp.c | 12 +++++-- hw/i386/acpi-build.c | 14 ++++++--- 6 files changed, 100 insertions(+), 6 deletions(-)
hw/i386/acpi-build.h +1 -0
@@ -10,5 +10,6 @@ extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsmio;#define ACPI_PCIHP_BNMR_BASE 0x10void acpi_setup (void ); +Object *acpi_get_i386_pci_host (void );#endif
include/hw/acpi/ich9.h +3 -0
@@ -24,6 +24,7 @@#include "hw/acpi/acpi.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/acpi/cpu.h" +#include "hw/acpi/pcihp.h" #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/acpi_dev_interface.h" #include "hw/acpi/tco.h"
@@ -55,6 +56,8 @@ typedef struct ICH9LPCPMRegs {AcpiCpuHotplug gpe_cpu;CPUHotplugState cpuhp_state; +bool use_acpi_hotplug_bridge; +AcpiPciHpState acpi_pci_hotplug;MemHotplugState acpi_memory_hotplug;uint8_t disable_s3;
hw/acpi/acpi-x86-stub.c +6 -0
@@ -1,7 +1,13 @@#include "qemu/osdep.h" #include "hw/i386/pc.h" +#include "hw/i386/acpi-build.h" void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid,const CPUArchIdList *apic_ids,GArray *entry) { } + +Object *acpi_get_i386_pci_host (void ) +{ +return NULL ; +}
hw/acpi/ich9.c +70 -0
136 lines not on this page · raw message
hw/acpi/pcihp.c +10 -2
@@ -30,6 +30,8 @@#include "hw/pci-host/i440fx.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bridge.h" +#include "hw/pci/pci_host.h" +#include "hw/i386/acpi-build.h" #include "hw/acpi/acpi.h" #include "hw/pci/pci_bus.h" #include "migration/vmstate.h"
@@ -103,6 +105,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque)static void acpi_set_pci_info (void ) {static bool bsel_is_set; +Object *host =acpi_get_i386_pci_host ();PCIBus *bus;unsigned bsel_alloc =ACPI_PCIHP_BSEL_DEFAULT ;
@@ -111,7 +114,11 @@ static void acpi_set_pci_info(void) } bsel_is_set = true; - bus =find_i440fx ();/* TODO: Q35 support */ +if (!host) { +return ; + } + + bus =PCI_HOST_BRIDGE (host)->bus;if (bus) {/* Scan all PCI buses. Set property to enable acpi based hotplug. */ pci_for_each_bus_depth_first (bus, acpi_set_bsel,NULL , &bsel_alloc);
@@ -121,13 +128,14 @@ static void acpi_set_pci_info(void)static void acpi_pcihp_disable_root_bus (void ) {static bool root_hp_disabled; +Object *host =acpi_get_i386_pci_host ();PCIBus *bus;if (root_hp_disabled) {return ; } - bus =find_i440fx (); + bus =PCI_HOST_BRIDGE (host)->bus;if (bus) {/* setting the hotplug handler to NULL makes the bus non-hotpluggable */ qbus_set_hotplug_handler (BUS (bus),NULL );
hw/i386/acpi-build.c +10 -4
@@ -299,7 +299,7 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)* Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE. * On i386 arch we only have two pci hosts, so we can look only for them. */ -static Object *acpi_get_i386_pci_host (void ) +Object *acpi_get_i386_pci_host (void ) {PCIHostState *host;
@@ -320,7 +320,10 @@ static void acpi_get_pci_holes(Range *hole, Range *hole64)Object *pci_host; pci_host =acpi_get_i386_pci_host (); -g_assert (pci_host); + +if (!pci_host) { +return ; + } range_set_bounds1(hole, object_property_get_uint(pci_host,
@@ -1765,6 +1768,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,PCIBus *bus =NULL ; pci_host =acpi_get_i386_pci_host (); +if (pci_host) { bus =PCI_HOST_BRIDGE (pci_host)->bus; }
@@ -2321,7 +2325,9 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)QObject *o; pci_host =acpi_get_i386_pci_host (); -g_assert (pci_host); +if (!pci_host) { +return false; + } o =object_property_get_qobject (pci_host,PCIE_HOST_MCFG_BASE ,NULL );if (!o) {
@@ -2351,7 +2357,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)AcpiPmInfo pm;AcpiMiscInfo misc;AcpiMcfgInfo mcfg; -Range pci_hole, pci_hole64; +Range pci_hole = {}, pci_hole64 = {};uint8_t *u;size_t aml_len =0 ;GArray *tables_blob = tables->table_data;
Signature · 1 line
2.30.2
Re: [PATCH v6 2/6] hw/acpi/ich9: Enable ACPI PCI hot-plug
Quoted 6 lines · Julia Suvorova
Add
acpi_pcihptoich9_pmas part of 'acpi-pci-hotplug-with-bridge-support' option. Set default to false.Signed-off-by Julia Suvorova <[email protected]>Signed-off-by Marcel Apfelbaum <[email protected]>Reviewed-by Igor Mammedov <[email protected]>
Since it looks safe, however I think there are a couple of unnecessary changes here:
[snip]
Quoted 9 lines
hw/acpi/pcihp.c +1
-0@@ -103,6 +105,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque)static void acpi_set_pci_info (void ) {static bool bsel_is_set; +Object *host =acpi_get_i386_pci_host ();PCIBus *bus;unsigned bsel_alloc =ACPI_PCIHP_BSEL_DEFAULT ;
hw/acpi/pcihp.c static void acpi_set_pci_info(void) · line 117
Quoted 5 lines
hw/acpi/pcihp.c +1
-1@@ -111,7 +114,11 @@ static void acpi_set_pci_info(void) } bsel_is_set = true; - bus =find_i440fx ();/* TODO: Q35 support */ +if (!host) {
AFAICT acpi_get_i386_pci_host() still can't return NULL, so I'm not sure this test is necessary.
[snip]
Quoted 6 lines
hw/i386/acpi-build.c +1
-1-static Object *acpi_get_i386_pci_host (void ) +Object *acpi_get_i386_pci_host (void ) {PCIHostState *host;
hw/i386/acpi-build.c static void acpi_get_pci_holes(Range *hole, Range *hole64) · line 326
Quoted 8 lines
hw/i386/acpi-build.c +4
-1@@ -320,7 +320,10 @@ static void acpi_get_pci_holes(Range *hole, Range *hole64)Object *pci_host; pci_host =acpi_get_i386_pci_host (); -g_assert (pci_host); + +if (!pci_host) { +return ; + }
Likewise this change.
Quoted 12 lines
hw/i386/acpi-build.c +1
-0range_set_bounds1(hole, object_property_get_uint(pci_host,@@ -1765,6 +1768,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,PCIBus *bus =NULL ; pci_host =acpi_get_i386_pci_host (); +if (pci_host) { bus =PCI_HOST_BRIDGE (pci_host)->bus; }
hw/i386/acpi-build.c static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) · line 2330
Quoted 7 lines
hw/i386/acpi-build.c +3
-1@@ -2321,7 +2325,9 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)QObject *o; pci_host =acpi_get_i386_pci_host (); -g_assert (pci_host); +if (!pci_host) { +return false; + }
And this one.
Quoted 12 lines
hw/i386/acpi-build.c +1
-1o =object_property_get_qobject (pci_host,PCIE_HOST_MCFG_BASE ,NULL );if (!o) {@@ -2351,7 +2357,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)AcpiPmInfo pm;AcpiMiscInfo misc;AcpiMcfgInfo mcfg; -Range pci_hole, pci_hole64; +Range pci_hole = {}, pci_hole64 = {};uint8_t *u;size_t aml_len =0 ;GArray *tables_blob = tables->table_data;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [PATCH v6 2/6] hw/acpi/ich9: Enable ACPI PCI hot-plug
Hi David,
Quoted 27 lines · David Gibson
Quoted 6 lines · Julia Suvorova
Add
acpi_pcihptoich9_pmas part of 'acpi-pci-hotplug-with-bridge-support' option. Set default to false.Signed-off-by Julia Suvorova <[email protected]>Signed-off-by Marcel Apfelbaum <[email protected]>Reviewed-by Igor Mammedov <[email protected]>Reviewed-by David Gibson <[email protected]>Since it looks safe, however I think there are a couple of unnecessary changes here:
[snip]
Quoted 12 lines
hw/acpi/pcihp.c +1
-0@@ -103,6 +105,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque)static void acpi_set_pci_info (void ) {static bool bsel_is_set; +Object *host =acpi_get_i386_pci_host ();PCIBus *bus;unsigned bsel_alloc =ACPI_PCIHP_BSEL_DEFAULT ;@@ -111,7 +114,11 @@ static void acpi_set_pci_info(void) } bsel_is_set = true;
Quoted 6 lines
hw/acpi/pcihp.c static void acpi_set_pci_info(void) · line 117
Quoted 2 lines
hw/acpi/pcihp.c +1
-1- bus =find_i440fx ();/* TODO: Q35 support */ +if (!host) {AFAICT
acpi_get_i386_pci_host()still can't return NULL, so I'm not sure this test is necessary.
It can, please see the new stub in hw/acpi/acpi-x86-stub.c
Object *acpi_get_i386_pci_host(void)
{
return NULL;
}Thanks,
Marcel
[...]
PATCH v6 3/6 hw/pci/pcie: Do not set HPC flag if acpihp is used
In reply to Julia SuvorovaInstead of changing the hot-plug type in _OSC register, do not set the 'Hot-Plug Capable' flag. This way guest will choose ACPI hot-plug if it is preferred and leave the option to use SHPC with pcie-pci-bridge.
The ability to control hot-plug for each downstream port is retained, while 'hotplug=off' on the port means all hot-plug types are disabled.
--- include/hw/pci/pcie_port.h | 5 ++++- hw/acpi/pcihp.c | 8 ++++++++ hw/core/machine.c | 1 - hw/i386/pc_q35.c | 11 +++++++++++ hw/pci/pcie.c | 8 +++++++- hw/pci/pcie_port.c | 1 + 6 files changed, 31 insertions(+), 3 deletions(-)
include/hw/pci/pcie_port.h +4 -1
@@ -57,8 +57,11 @@ struct PCIESlot {/* Disable ACS (really for a pcie_root_port) */ bool disable_acs; -/* Indicates whether hot-plug is enabled on the slot */ +/* Indicates whether any type of hot-plug is allowed on the slot */ bool hotplug; + +bool native_hotplug; +QLIST_ENTRY (PCIESlot) next; };
hw/acpi/pcihp.c +8 -0
@@ -31,6 +31,7 @@#include "hw/pci/pci.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_host.h" +#include "hw/pci/pcie_port.h" #include "hw/i386/acpi-build.h" #include "hw/acpi/acpi.h" #include "hw/pci/pci_bus.h"
@@ -336,6 +337,13 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) {PCIBus *sec =pci_bridge_get_sec_bus (PCI_BRIDGE (pdev)); +/* Remove all hot-plug handlers if hot-plug is disabled on slot */ +if (object_dynamic_cast (OBJECT (dev),TYPE_PCIE_SLOT ) && + !PCIE_SLOT (pdev)->hotplug) { +qbus_set_hotplug_handler (BUS (sec),NULL ); +return ; + } +qbus_set_hotplug_handler (BUS (sec),OBJECT (hotplug_dev));/* We don't have to overwrite any other hotplug handler yet */ assert (QLIST_EMPTY (&sec->child));
hw/core/machine.c +0 -1
@@ -583,7 +583,6 @@ static void machine_set_memdev(Object *obj, const char *value, Error **errp) ms->ram_memdev_id =g_strdup (value); } -static void machine_init_notify (Notifier *notifier,void *data) {MachineState *machine =MACHINE (qdev_get_machine ());
hw/i386/pc_q35.c +11 -0
@@ -37,6 +37,7 @@#include "sysemu/kvm.h" #include "hw/kvm/clock.h" #include "hw/pci-host/q35.h" +#include "hw/pci/pcie_port.h" #include "hw/qdev-properties.h" #include "hw/i386/x86.h" #include "hw/i386/pc.h"
@@ -136,6 +137,7 @@ static void pc_q35_init(MachineState *machine)ram_addr_t lowmem;DriveInfo *hd[MAX_SATA_PORTS ];MachineClass *mc =MACHINE_GET_CLASS (machine); +bool acpi_pcihp;/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
@@ -236,6 +238,15 @@ static void pc_q35_init(MachineState *machine)object_property_set_link (OBJECT (machine),PC_MACHINE_ACPI_DEVICE_PROP ,OBJECT (lpc), &error_abort); + acpi_pcihp =object_property_get_bool (OBJECT (lpc), +"acpi-pci-hotplug-with-bridge-support" , +NULL ); + +if (acpi_pcihp) { +object_register_sugar_prop (TYPE_PCIE_SLOT ,"native-hotplug" , +"false" , true); + } +/* irq lines */ gsi_state =pc_gsi_create (&x86ms->gsi, pcmc->pci_enabled);
hw/pci/pcie.c +7 -1
@@ -529,7 +529,13 @@ void pcie_cap_slot_init(PCIDevice *dev, PCIESlot *s)PCI_EXP_SLTCAP_PIP |PCI_EXP_SLTCAP_AIP | PCI_EXP_SLTCAP_ABP); -if (s->hotplug) { + +/* +* Enable native hot-plug on all hot-plugged bridges unless +* hot-plug is disabled on the slot. +*/ +if (s->hotplug && + (s->native_hotplug ||DEVICE (dev)->hotplugged)) {pci_long_test_and_set_mask (dev->config + pos +PCI_EXP_SLTCAP ,PCI_EXP_SLTCAP_HPS |PCI_EXP_SLTCAP_HPC );
hw/pci/pcie_port.c +1 -0
@@ -148,6 +148,7 @@ static Property pcie_slot_props[] = {DEFINE_PROP_UINT8 ("chassis" , PCIESlot, chassis,0 ),DEFINE_PROP_UINT16 ("slot" , PCIESlot, slot,0 ),DEFINE_PROP_BOOL ("hotplug" , PCIESlot, hotplug, true), +DEFINE_PROP_BOOL ("native-hotplug" , PCIESlot, native_hotplug, true), DEFINE_PROP_END_OF_LIST() };
Signature · 1 line
2.30.2
PATCH v6 4/6 bios-tables-test: Allow changes in DSDT ACPI tables
In reply to Julia SuvorovaAll DSDT Q35 tables will be modified because ACPI hot-plug is enabled by default.
--- tests/qtest/bios-tables-test-allowed-diff.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +11 -0
@@ -1 +1,12 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT" , +"tests/data/acpi/q35/DSDT.tis" , +"tests/data/acpi/q35/DSDT.bridge" , +"tests/data/acpi/q35/DSDT.mmio64" , +"tests/data/acpi/q35/DSDT.ipmibt" , +"tests/data/acpi/q35/DSDT.cphp" , +"tests/data/acpi/q35/DSDT.memhp" , +"tests/data/acpi/q35/DSDT.acpihmat" , +"tests/data/acpi/q35/DSDT.numamem" , +"tests/data/acpi/q35/DSDT.dimmpxm" , +"tests/data/acpi/q35/DSDT.nohpet",
Signature · 1 line
2.30.2
PATCH v6 5/6 hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35
In reply to Julia SuvorovaQ35 has three different types of PCI devices hot-plug: PCIe Native, SHPC Native and ACPI hot-plug. This patch changes the default choice for cold-plugged bridges from PCIe Native to ACPI Hot-plug with ability to use SHPC and PCIe Native for hot-plugged bridges.
This is a list of the PCIe Native hot-plug issues that led to this change:
* no racy behavior during boot (see 110c477c2ed)
* no delay during deleting - after the actual power off software must wait at least 1 second before indicating about it. This case is quite important for users, it even has its own bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1594168
* no timer-based behavior - in addition to the previous example, the attention button has a 5-second waiting period, during which the operation can be canceled with a second press. While this looks fine for manual button control, automation will result in the need to queue or drop events, and the software receiving events in all sort of unspecified combinations of attention/power indicator states, which is racy and uppredictable.
* fixes:
* https://bugzilla.redhat.com/show_bug.cgi?id=1752465
* https://bugzilla.redhat.com/show_bug.cgi?id=1690256
To return to PCIe Native hot-plug:
-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off
--- hw/acpi/ich9.c | 2 +- hw/i386/pc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
hw/acpi/ich9.c +1 -1
@@ -427,7 +427,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) pm->disable_s3 =0 ; pm->disable_s4 =0 ; pm->s4_val =2 ; - pm->use_acpi_hotplug_bridge = false; + pm->use_acpi_hotplug_bridge = true;object_property_add_uint32_ptr (obj,ACPI_PM_PROP_PM_IO_BASE , &pm->pm_io_base,OBJ_PROP_FLAG_READ );
hw/i386/pc.c +1 -0
@@ -98,6 +98,7 @@ GlobalProperty pc_compat_6_0[] = { { "qemu64" "-" TYPE_X86_CPU, "family", "6" }, { "qemu64" "-" TYPE_X86_CPU, "model", "6" }, { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" }, + { "ICH9-LPC", "acpi-pci-hotplug-with-bridge-support", "off" }, };const size_t pc_compat_6_0_len =G_N_ELEMENTS (pc_compat_6_0);
Signature · 1 line
2.30.2
Re: [PATCH v6 5/6] hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35
Quoted 23 lines · Julia Suvorova
Q35 has three different types of PCI devices hot-plug: PCIe Native, SHPC Native and ACPI hot-plug. This patch changes the default choice for cold-plugged bridges from PCIe Native to ACPI Hot-plug with ability to use SHPC and PCIe Native for hot-plugged bridges.
This is a list of the PCIe Native hot-plug issues that led to this change:
* no racy behavior during boot (see110c477c2ed)
* no delay during deleting - after the actual power off software must wait at least 1 second before indicating about it. This case is quite important for users, it even has its own bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1594168
* no timer-based behavior - in addition to the previous example, the attention button has a 5-second waiting period, during which the operation can be canceled with a second press. While this looks fine for manual button control, automation will result in the need to queue or drop events, and the software receiving events in all sort of unspecified combinations of attention/power indicator states, which is racy and uppredictable.
* fixes:
* https://bugzilla.redhat.com/show_bug.cgi?id=1752465
* https://bugzilla.redhat.com/show_bug.cgi?id=1690256
Quoted 5 lines
To return to PCIe Native hot-plug:
-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=offSigned-off-by Julia Suvorova <[email protected]>Reviewed-by Igor Mammedov <[email protected]>
Quoted 30 lines
--- hw/acpi/ich9.c | 2 +- hw/i386/pc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)hw/acpi/ich9.c +1
-1@@ -427,7 +427,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) pm->disable_s3 =0 ; pm->disable_s4 =0 ; pm->s4_val =2 ; - pm->use_acpi_hotplug_bridge = false; + pm->use_acpi_hotplug_bridge = true;object_property_add_uint32_ptr (obj,ACPI_PM_PROP_PM_IO_BASE , &pm->pm_io_base,OBJ_PROP_FLAG_READ );hw/i386/pc.c +1
-0@@ -98,6 +98,7 @@ GlobalProperty pc_compat_6_0[] = { { "qemu64" "-" TYPE_X86_CPU, "family", "6" }, { "qemu64" "-" TYPE_X86_CPU, "model", "6" }, { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" }, + { "ICH9-LPC", "acpi-pci-hotplug-with-bridge-support", "off" }, };const size_t pc_compat_6_0_len =G_N_ELEMENTS (pc_compat_6_0);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [PATCH v6 5/6] hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35
In reply to Julia SuvorovaQuoted 4 lines · On Tue, 13 Jul 2021 02:42:04 +0200 Julia Suvorova <[email protected]> wrote:
Q35 has three different types of PCI devices hot-plug: PCIe Native, SHPC Native and ACPI hot-plug. This patch changes the default choice for cold-plugged bridges from PCIe Native to ACPI Hot-plug with ability to use SHPC and PCIe Native for hot-plugged bridges.
Before we flip the switch,
has the issue about not hotplug ports not getting IO (Michael) been addressed, if not are there any plans to fix it?
Quoted 53 lines
This is a list of the PCIe Native hot-plug issues that led to this change:
* no racy behavior during boot (see110c477c2ed)
* no delay during deleting - after the actual power off software must wait at least 1 second before indicating about it. This case is quite important for users, it even has its own bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1594168
* no timer-based behavior - in addition to the previous example, the attention button has a 5-second waiting period, during which the operation can be canceled with a second press. While this looks fine for manual button control, automation will result in the need to queue or drop events, and the software receiving events in all sort of unspecified combinations of attention/power indicator states, which is racy and uppredictable.
* fixes:
* https://bugzilla.redhat.com/show_bug.cgi?id=1752465
* https://bugzilla.redhat.com/show_bug.cgi?id=1690256To return to PCIe Native hot-plug:
-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=offSigned-off-by Julia Suvorova <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- hw/acpi/ich9.c | 2 +- hw/i386/pc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)hw/acpi/ich9.c +1
-1@@ -427,7 +427,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) pm->disable_s3 =0 ; pm->disable_s4 =0 ; pm->s4_val =2 ; - pm->use_acpi_hotplug_bridge = false; + pm->use_acpi_hotplug_bridge = true;object_property_add_uint32_ptr (obj,ACPI_PM_PROP_PM_IO_BASE , &pm->pm_io_base,OBJ_PROP_FLAG_READ );hw/i386/pc.c +1
-0@@ -98,6 +98,7 @@ GlobalProperty pc_compat_6_0[] = { { "qemu64" "-" TYPE_X86_CPU, "family", "6" }, { "qemu64" "-" TYPE_X86_CPU, "model", "6" }, { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" }, + { "ICH9-LPC", "acpi-pci-hotplug-with-bridge-support", "off" }, };const size_t pc_compat_6_0_len =G_N_ELEMENTS (pc_compat_6_0);
Re: [PATCH v6 5/6] hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35
Hi Igor,
Quoted 13 lines · Igor Mammedov
Quoted 4 lines · On Tue, 13 Jul 2021 02:42:04 +0200 Julia Suvorova <[email protected]> wrote:
Q35 has three different types of PCI devices hot-plug: PCIe Native, SHPC Native and ACPI hot-plug. This patch changes the default choice for cold-plugged bridges from PCIe Native to ACPI Hot-plug with ability to use SHPC and PCIe Native for hot-plugged bridges.
Before we flip the switch,
has the issue about not hotplug ports not getting IO (Michael) been addressed, if not are there any plans to fix it?
Following an offline discussion with Michael the understanding is PCIe devices should work correctly without IO, so it only affects PCI devices hot-plugged into PCIe ports, but those devices should be plugged into pcie-pci bridges.
Another alternative is to drop this patch and let ACPI hotplug be an option and not the default until we find a solution, meaning delaying the flip until 6.2 since today is the soft-freeze.
I will let Michael decide, I am fine one way or the other.
Thanks,
Marcel
Quoted 57 lines
hw/acpi/ich9.c void ich9_pm_add_properties(Object *obj,
Quoted 34 lines
This is a list of the PCIe Native hot-plug issues that led to this change:
* no racy behavior during boot (see110c477c2ed)
* no delay during deleting - after the actual power off software must wait at least 1 second before indicating about it. This case is quite important for users, it even has its own bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1594168
* no timer-based behavior - in addition to the previous example, the attention button has a 5-second waiting period, during which the operation can be canceled with a second press. While this looks fine for manual button control, automation will result in the need to queue or drop events, and the software receiving events in all sort of unspecified combinations of attention/power indicator states, which is racy and uppredictable.
* fixes:
* https://bugzilla.redhat.com/show_bug.cgi?id=1752465
* https://bugzilla.redhat.com/show_bug.cgi?id=1690256To return to PCIe Native hot-plug:
-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=offSigned-off-by Julia Suvorova <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- hw/acpi/ich9.c | 2 +- hw/i386/pc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)hw/acpi/ich9.c +0
-0@@ -427,7 +427,7 @@ void ich9_pm_add_properties(Object *obj,ICH9LPCPMRegs *pm)
Quoted 20 lines
hw/acpi/ich9.c +1
-1pm->disable_s3 =0 ; pm->disable_s4 =0 ; pm->s4_val =2 ; - pm->use_acpi_hotplug_bridge = false; + pm->use_acpi_hotplug_bridge = true;object_property_add_uint32_ptr (obj,ACPI_PM_PROP_PM_IO_BASE , &pm->pm_io_base,OBJ_PROP_FLAG_READ );hw/i386/pc.c +1
-0@@ -98,6 +98,7 @@ GlobalProperty pc_compat_6_0[] = { { "qemu64" "-" TYPE_X86_CPU, "family", "6" }, { "qemu64" "-" TYPE_X86_CPU, "model", "6" }, { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" }, + { "ICH9-LPC", "acpi-pci-hotplug-with-bridge-support", "off" }, };const size_t pc_compat_6_0_len =G_N_ELEMENTS (pc_compat_6_0);
Re: [PATCH v6 5/6] hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35
In reply to Igor MammedovQuoted 12 lines · Igor Mammedov
Quoted 4 lines · On Tue, 13 Jul 2021 02:42:04 +0200 Julia Suvorova <[email protected]> wrote:
Q35 has three different types of PCI devices hot-plug: PCIe Native, SHPC Native and ACPI hot-plug. This patch changes the default choice for cold-plugged bridges from PCIe Native to ACPI Hot-plug with ability to use SHPC and PCIe Native for hot-plugged bridges.
Before we flip the switch,
has the issue about not hotplug ports not getting IO (Michael) been addressed, if not are there any plans to fix it?
I think it's a guest bug frankly. We'll workaround it by setting io-reserve to 4k for hotplugged bridges, I think this is minor enough that it's better to just merge now and fix on top.
I've added this note to the commit log though.
Quoted 53 lines
Quoted 53 lines
This is a list of the PCIe Native hot-plug issues that led to this change:
* no racy behavior during boot (see110c477c2ed)
* no delay during deleting - after the actual power off software must wait at least 1 second before indicating about it. This case is quite important for users, it even has its own bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1594168
* no timer-based behavior - in addition to the previous example, the attention button has a 5-second waiting period, during which the operation can be canceled with a second press. While this looks fine for manual button control, automation will result in the need to queue or drop events, and the software receiving events in all sort of unspecified combinations of attention/power indicator states, which is racy and uppredictable.
* fixes:
* https://bugzilla.redhat.com/show_bug.cgi?id=1752465
* https://bugzilla.redhat.com/show_bug.cgi?id=1690256To return to PCIe Native hot-plug:
-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=offSigned-off-by Julia Suvorova <[email protected]>Reviewed-by Igor Mammedov <[email protected]>--- hw/acpi/ich9.c | 2 +- hw/i386/pc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)hw/acpi/ich9.c +1
-1@@ -427,7 +427,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) pm->disable_s3 =0 ; pm->disable_s4 =0 ; pm->s4_val =2 ; - pm->use_acpi_hotplug_bridge = false; + pm->use_acpi_hotplug_bridge = true;object_property_add_uint32_ptr (obj,ACPI_PM_PROP_PM_IO_BASE , &pm->pm_io_base,OBJ_PROP_FLAG_READ );hw/i386/pc.c +1
-0@@ -98,6 +98,7 @@ GlobalProperty pc_compat_6_0[] = { { "qemu64" "-" TYPE_X86_CPU, "family", "6" }, { "qemu64" "-" TYPE_X86_CPU, "model", "6" }, { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" }, + { "ICH9-LPC", "acpi-pci-hotplug-with-bridge-support", "off" }, };const size_t pc_compat_6_0_len =G_N_ELEMENTS (pc_compat_6_0);
PATCH v6 6/6 bios-tables-test: Update golden binaries
In reply to Julia SuvorovaAdd ACPI hot-plug registers to DSDT Q35 tables.
Changes in the tables:
+ Scope (_SB.PCI0)
+ {
+ OperationRegion (PCST, SystemIO, 0x0CC4, 0x08)
+ Field (PCST, DWordAcc, NoLock, WriteAsZeros)
+ {
+ PCIU, 32,
+ PCID, 32
+ }
+
+ OperationRegion (SEJ, SystemIO, 0x0CCC, 0x04)
+ Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
+ {
+ B0EJ, 32
+ }
+
+ OperationRegion (BNMR, SystemIO, 0x0CD4, 0x08)
+ Field (BNMR, DWordAcc, NoLock, WriteAsZeros)
+ {
+ BNUM, 32,
+ PIDX, 32
+ }
+
+ Mutex (BLCK, 0x00)
+ Method (PCEJ, 2, NotSerialized)
+ {
+ Acquire (BLCK, 0xFFFF)
+ BNUM = Arg0
+ B0EJ = (One << Arg1)
+ Release (BLCK)
+ Return (Zero)+ }
+
+ Method (AIDX, 2, NotSerialized)
+ {
+ Acquire (BLCK, 0xFFFF) + BNUM = Arg0 + PIDX = (One << Arg1) + Local0 = PIDX /* \_SB_.PCI0.PIDX */ + Release (BLCK) + Return (Local0)
+ }
+
+ Method (PDSM, 6, Serialized)
+ {
+ If ((Arg0 == ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d") /* Device Labeling Interface */))
+ {
+ Local0 = AIDX (Arg4, Arg5)
+ If ((Arg2 == Zero))
+ {+ If ((Arg1 == 0x02))
+ {
+ If (!((Local0 == Zero) | (Local0 == 0xFFFFFFFF)))
+ {
+ Return (Buffer (One)
+ {
+ 0x81 // .
+ })
+ }
+ }
+
+ Return (Buffer (One)
+ {
+ 0x00 // .
+ })
+ }
+ ElseIf ((Arg2 == 0x07))
+ {+ Local1 = Package (0x02)
+ {
+ Zero,
+ ""
+ }
+ Local1 [Zero] = Local0
+ Return (Local1)
+ }
+ }
+ }
+ }
+
...
Scope (_GPE)
{
Name (_HID, "ACPI0006" /* GPE Block Device */) // _HID: Hardware ID
+ Method (_E01, 0, NotSerialized) // _Exx: Edge-Triggered GPE, xx=0x00-0xFF
+ {
+ Acquire (\_SB.PCI0.BLCK, 0xFFFF)
+ \_SB.PCI0.PCNT ()
+ Release (\_SB.PCI0.BLCK)+ }
...
+
+ Device (PHPR)
+ {
+ Name (_HID, "PNP0A06" /* Generic Container Device */) // _HID: Hardware ID
+ Name (_UID, "PCI Hotplug resources") // _UID: Unique ID
+ Name (_STA, 0x0B) // _STA: Status
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
+ {
+ IO (Decode16,
+ 0x0CC4, // Range Minimum
+ 0x0CC4, // Range Maximum
+ 0x01, // Alignment
+ 0x18, // Length
+ )
+ })
+ }
}...
And if there is a port in configuration:
Device (S10)
{
Name (_ADR, 0x00020000) // _ADR: Address
+ Name (BSEL, Zero)
+ Device (S00)
+ {
+ Name (_SUN, Zero) // _SUN: Slot User Number
+ Name (_ADR, Zero) // _ADR: Address
+ Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9
+ {+ PCEJ (BSEL, _SUN)
+ }
+
+ Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
+ {
+ Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
+ }
+ }
+
...
+ Method (DVNT, 2, NotSerialized)
+ {
+ If ((Arg0 & One))
+ {
+ Notify (S00, Arg1)
+ }
...
--- tests/qtest/bios-tables-test-allowed-diff.h | 11 ----------- tests/data/acpi/q35/DSDT | Bin 7859 -> 8289 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9184 -> 9614 bytes tests/data/acpi/q35/DSDT.bridge | Bin 7877 -> 11003 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8323 -> 8753 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9513 -> 9943 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 7934 -> 8364 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9218 -> 9648 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 8990 -> 9419 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 7717 -> 8147 bytes tests/data/acpi/q35/DSDT.numamem | Bin 7865 -> 8295 bytes tests/data/acpi/q35/DSDT.tis | Bin 8465 -> 8894 bytes 12 files changed, 11 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -11
@@ -1,12 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT" , -"tests/data/acpi/q35/DSDT.tis" , -"tests/data/acpi/q35/DSDT.bridge" , -"tests/data/acpi/q35/DSDT.mmio64" , -"tests/data/acpi/q35/DSDT.ipmibt" , -"tests/data/acpi/q35/DSDT.cphp" , -"tests/data/acpi/q35/DSDT.memhp" , -"tests/data/acpi/q35/DSDT.acpihmat" , -"tests/data/acpi/q35/DSDT.numamem" , -"tests/data/acpi/q35/DSDT.dimmpxm" , -"tests/data/acpi/q35/DSDT.nohpet",
tests/data/acpi/q35/DSDT binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat binary +0 -0
tests/data/acpi/q35/DSDT.bridge binary +0 -0
tests/data/acpi/q35/DSDT.cphp binary +0 -0
tests/data/acpi/q35/DSDT.dimmpxm binary +0 -0
tests/data/acpi/q35/DSDT.ipmibt binary +0 -0
tests/data/acpi/q35/DSDT.memhp binary +0 -0
tests/data/acpi/q35/DSDT.mmio64 binary +0 -0
tests/data/acpi/q35/DSDT.nohpet binary +0 -0
tests/data/acpi/q35/DSDT.numamem binary +0 -0
tests/data/acpi/q35/DSDT.tis binary +0 -0
Signature · 1 line
2.30.2