[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 39/40] pcihp: generate populated non-hotpluggble slot description
From: |
Igor Mammedov |
Subject: |
[PATCH 39/40] pcihp: generate populated non-hotpluggble slot descriptions on non-hotplug path |
Date: |
Thu, 12 Jan 2023 15:03:11 +0100 |
Generating slots descriptions populated by non-hotpluggable devices
is akward at best and complicates hotplug path (build_append_pcihp_slots)
needlessly, and builds only dynamic _DSM for such slots which is overlkill.
Clean it up and let non-hotplug path (build_append_pci_bus_devices)
to handle that task.
Such clean up effectively drops dynamic _DSM methods on non-hotpluggable
slots (even though bus itself is hotpluggable), but in practice it
affects only built-in devices (ide controllers/various bridges) that don't
use acpi-index anyways so effectively it doesn't matter (NICs are hotpluggble).
Follow up series will add static _DSM for non-hotpluggble devices/buses
that will not depend on ACPI PCI hotplug at all, and potentially would
allows us to reuse non-hotplug path elsewhere (PBX/microvm/arm-virt),
including new support for acpi-index for non-hotpluggable devices.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
hw/i386/acpi-build.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 50504578b9..c085bf7812 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -414,6 +414,7 @@ static bool is_devfn_ignored_hotplug(const int devfn, const
PCIBus *bus)
PCIDevice *pdev = bus->devices[devfn];
if (pdev) {
return is_devfn_ignored_generic(devfn, bus) ||
+ !DEVICE_GET_CLASS(pdev)->hotpluggable ||
/* Cold plugged bridges aren't themselves hot-pluggable */
(IS_PCI_BRIDGE(pdev) && !DEVICE(pdev)->hotplugged);
} else { /* non populated slots */
@@ -440,17 +441,14 @@ static void build_append_pcihp_slots(Aml *parent_scope,
PCIBus *bus,
notify_method = aml_method("DVNT", 2, AML_NOTSERIALIZED);
for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) {
- PCIDevice *pdev = bus->devices[devfn];
int slot = PCI_SLOT(devfn);
int adr = slot << 16 | PCI_FUNC(devfn);
- bool hotpluggbale_slot = true;
if (is_devfn_ignored_hotplug(devfn, bus)) {
continue;
}
- if (pdev) {
- hotpluggbale_slot = DEVICE_GET_CLASS(pdev)->hotpluggable;
+ if (bus->devices[devfn]) {
dev = aml_scope("S%.02X", devfn);
} else {
dev = aml_device("S%.02X", devfn);
@@ -464,17 +462,15 @@ static void build_append_pcihp_slots(Aml *parent_scope,
PCIBus *bus,
aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
aml_append(dev, aml_pci_device_dsm());
- if (hotpluggbale_slot) {
- aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
- /* add _EJ0 to make slot hotpluggable */
- method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
- aml_append(method,
- aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
- );
- aml_append(dev, method);
+ aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
+ /* add _EJ0 to make slot hotpluggable */
+ method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
+ aml_append(method,
+ aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
+ );
+ aml_append(dev, method);
- build_append_pcihp_notify_entry(notify_method, slot);
- }
+ build_append_pcihp_notify_entry(notify_method, slot);
/* device descriptor has been composed, add it into parent context */
aml_append(parent_scope, dev);
@@ -493,8 +489,9 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus
*bus)
for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) {
/* ACPI spec: 1.0b: Table 6-2 _ADR Object Bus Types, PCI type */
int adr = PCI_SLOT(devfn) << 16 | PCI_FUNC(devfn);
+ PCIDevice *pdev = bus->devices[devfn];
- if (!bus->devices[devfn] || is_devfn_ignored_generic(devfn, bus)) {
+ if (!pdev || is_devfn_ignored_generic(devfn, bus)) {
continue;
}
--
2.31.1
- [PATCH 10/40] pcihp: piix4: do not call acpi_pcihp_reset() when ACPI PCI hotplug is disabled, (continued)
- [PATCH 10/40] pcihp: piix4: do not call acpi_pcihp_reset() when ACPI PCI hotplug is disabled, Igor Mammedov, 2023/01/12
- [PATCH 29/40] pcihp: make bridge describe itself using AcpiDevAmlIfClass:build_dev_aml, Igor Mammedov, 2023/01/12
- [PATCH 01/40] tests: qtest: print device_add error before failing test, Igor Mammedov, 2023/01/12
- [PATCH 20/40] tests: acpi: whitelist DSDT before refactoring acpi based PCI hotplug machinery, Igor Mammedov, 2023/01/12
- [PATCH 25/40] tests: acpi: add endpoint devices to bridges, Igor Mammedov, 2023/01/12
- [PATCH 30/40] pci: make sure pci_bus_is_express() won't error out with "discards ‘const’ qualifier", Igor Mammedov, 2023/01/12
- [PATCH 36/40] pcihp: acpi: ignore coldplugged bridges when composing hotpluggable slots, Igor Mammedov, 2023/01/12
- [PATCH 26/40] tests: acpi: update expected blobs, Igor Mammedov, 2023/01/12
- [PATCH 32/40] tests: acpi: whitelist DSDT before decoupling PCI hotplug code from basic slots description, Igor Mammedov, 2023/01/12
- [PATCH 37/40] tests: acpi: update expected blobs, Igor Mammedov, 2023/01/12
- [PATCH 39/40] pcihp: generate populated non-hotpluggble slot descriptions on non-hotplug path,
Igor Mammedov <=
- [PATCH 16/40] tests: acpi: add reboot cycle to bridge test, Igor Mammedov, 2023/01/12
- [PATCH 23/40] tests: acpi: update expected blobs, Igor Mammedov, 2023/01/12
- [PATCH 13/40] tests: boot_sector_test: avoid crashing if status is not available yet, Igor Mammedov, 2023/01/12
- [PATCH 28/40] pci: acpi: wire up AcpiDevAmlIf interface to generic bridge, Igor Mammedov, 2023/01/12
- [PATCH 21/40] pcihp: compose PCNT callchain right before its user _GPE._E01, Igor Mammedov, 2023/01/12
- [PATCH 07/40] pci_bridge: remove whitespace, Igor Mammedov, 2023/01/12
- [PATCH 04/40] tests: acpi: extend pcihp with nested bridges, Igor Mammedov, 2023/01/12
- [PATCH 31/40] pcihp: isolate rule whether slot should be described in DSDT, Igor Mammedov, 2023/01/12
- [PATCH 24/40] whitelist DSDT before adding endpoint devices to bridge testcases, Igor Mammedov, 2023/01/12
- [PATCH 35/40] tests: acpi: whitelist DSDT blobs before removing dynamic _DSM on coldplugged bridges, Igor Mammedov, 2023/01/12