[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 36/40] pcihp: acpi: ignore coldplugged bridges when composing hot
From: |
Igor Mammedov |
Subject: |
[PATCH 36/40] pcihp: acpi: ignore coldplugged bridges when composing hotpluggable slots |
Date: |
Thu, 12 Jan 2023 15:03:08 +0100 |
coldplugged bridges are not unpluggable, so there is no need
to describe slots where they are plugged as hotpluggable. To
that effect we have a condition that marks slot as non-hotpluggable
if it's populated by coldplugged bridge and prevents generation
_SUN/_EJ0 objects for it. That leaves dynamic _DSM method on
such slot (which also depends on BSEL and pcihp hardware).
This _DSM method provides only dynamic acpi-index support so far,
which is not actually used/supported by linux kernel for bridges
and it's doubtful there will be need for it at all.
So it's rather pointless to generate acpi-index related AML
for bridges and we can simplify hotplug slots generator a bit
more by completely ignoring coldplugged bridges on hotplug path.
Another point in favor of dropping dynamic _DSM support, is
that we can replace it with static _DSM if necessary since
a slot with bridge can't change during VM runtime and without
any dependency on ACPI PCI hotplug at that.
Later I plan to implement bridge specific static _DSM
PCI Firmware Specification 3.2
4.6.5. _DSM for Ignoring PCI Boot Configurations
part of spec, to fix longstanding issue with fixed IO/MEM
resource assignment that often leads to hotplugged device
being in-operational within the guest due limited IO/MEM
windows programmed on bridge at boot time.
Expected change when coldplugged bridge is ignored by hotplug
code, should look like:
- Scope (S18)
- {
- Name (ASUN, 0x03)
- Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
- {
- Local0 = Package (0x02)
- {
- BSEL,
- ASUN
- }
- Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0))
- }
- }
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
hw/i386/acpi-build.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a4f882dc72..50504578b9 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -411,8 +411,11 @@ static bool is_devfn_ignored_generic(const int devfn,
const PCIBus *bus)
static bool is_devfn_ignored_hotplug(const int devfn, const PCIBus *bus)
{
- if (bus->devices[devfn]) {
- return is_devfn_ignored_generic(devfn, bus);
+ PCIDevice *pdev = bus->devices[devfn];
+ if (pdev) {
+ return is_devfn_ignored_generic(devfn, bus) ||
+ /* Cold plugged bridges aren't themselves hot-pluggable */
+ (IS_PCI_BRIDGE(pdev) && !DEVICE(pdev)->hotplugged);
} else { /* non populated slots */
/*
* hotplug is supported only for non-multifunction device
@@ -447,14 +450,7 @@ static void build_append_pcihp_slots(Aml *parent_scope,
PCIBus *bus,
}
if (pdev) {
- /*
- * Cold plugged bridges aren't themselves hot-pluggable.
- * Hotplugged bridges *are* hot-pluggable.
- */
- bool cold_plugged_bridge = IS_PCI_BRIDGE(pdev) &&
- !DEVICE(pdev)->hotplugged;
- hotpluggbale_slot = DEVICE_GET_CLASS(pdev)->hotpluggable &&
- !cold_plugged_bridge;
+ hotpluggbale_slot = DEVICE_GET_CLASS(pdev)->hotpluggable;
dev = aml_scope("S%.02X", devfn);
} else {
dev = aml_device("S%.02X", devfn);
--
2.31.1
- [PATCH 22/40] pcihp: do not put empty PCNT in DSDT, (continued)
- [PATCH 22/40] pcihp: do not put empty PCNT in DSDT, Igor Mammedov, 2023/01/12
- [PATCH 06/40] tests: acpi: cleanup use_uefi argument usage, Igor Mammedov, 2023/01/12
- [PATCH 17/40] tests: acpi: whitelist DSDT before refactoring acpi based PCI hotplug machinery, Igor Mammedov, 2023/01/12
- [PATCH 19/40] tests: acpi: update expected blobs, Igor Mammedov, 2023/01/12
- [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 <=
- [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, 2023/01/12
- [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