qemu/hw/pci
Alex Williamson 9461afd200 hw/pci: Basic support for PCI power management
The memory and IO BARs for devices are only accessible in the D0 power
state.  In other power states the PCI spec defines that the device
responds to TLPs and messages with an Unsupported Request response.

To approximate this behavior, consider the BARs as unmapped when the
device is not in the D0 power state.  This makes the BARs inaccessible
and has the additional bonus for vfio-pci that we don't attempt to DMA
map BARs for devices in a non-D0 power state.

To support this, an interface is added for devices to register the PM
capability, which allows central tracking to enforce valid transitions
and unmap BARs in non-D0 states.

NB. We currently have device models (eepro100 and pcie_pci_bridge)
that register a PM capability but do not set wmask to enable writes to
the power state field.  In order to maintain migration compatibility,
this new helper does not manage the wmask to enable guest writes to
initiate a power state change.  The contents and write access of the
PM capability are still managed by the caller.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250225215237.3314011-2-alex.williamson@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2025-03-06 06:47:33 +01:00
..
Kconfig kconfig: Add PCIe devices to s390x machines 2023-07-14 11:10:57 +02:00
meson.build meson: remove CONFIG_ALL 2023-12-31 09:11:28 +01:00
msi.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
msix.c hw/pci/msix: Warn on PBA writes 2025-02-21 07:18:03 -05:00
pci-hmp-cmds.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
pci-internal.h hw/pci/aer: Make PCIE AER error injection facility available for other emulation to use. 2023-03-07 12:39:00 -05:00
pci-qmp-cmds.c pci: Move QMP commands to new hw/pci/pci-qmp-cmds.c 2022-12-19 16:15:17 +01:00
pci-stub.c hw/pci: remove return after g_assert_not_reached() 2024-09-24 13:53:35 +02:00
pci.c hw/pci: Basic support for PCI power management 2025-03-06 06:47:33 +01:00
pci_bridge.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
pci_host.c hw/pci: Rename has_power to enabled 2025-01-13 17:16:04 +01:00
pcie.c pci: ensure valid link status bits for downstream ports 2025-01-15 13:05:33 -05:00
pcie_aer.c hw/pci: Constify VMState 2023-12-30 07:38:06 +11:00
pcie_doe.c hw/pci: PCIe Data Object Exchange emulation 2022-11-07 13:12:19 -05:00
pcie_host.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
pcie_port.c include/hw/qdev-properties: Remove DEFINE_PROP_END_OF_LIST 2024-12-19 19:36:37 +01:00
pcie_sriov.c pcie_sriov: Register VFs after migration 2025-02-20 18:23:19 -05:00
shpc.c hw/pci: add some convenient trace-events for pcie and shpc hotplug 2024-03-11 22:09:42 +01:00
slotid_cap.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
trace-events hw/pci: Basic support for PCI power management 2025-03-06 06:47:33 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00