diff options
author | Gerd Hoffmann | 2021-11-11 14:08:54 +0100 |
---|---|---|
committer | Michael S. Tsirkin | 2021-11-15 17:10:11 +0100 |
commit | 23786d13441d36e0efcfee94ba8ff218746bed6c (patch) | |
tree | 7e218be335b04fe0cf0f9b4e8bb726431ae0dc4f /include/hw/pci | |
parent | vdpa: Check for existence of opts.vhostdev (diff) | |
download | qemu-23786d13441d36e0efcfee94ba8ff218746bed6c.tar.gz qemu-23786d13441d36e0efcfee94ba8ff218746bed6c.tar.xz qemu-23786d13441d36e0efcfee94ba8ff218746bed6c.zip |
pci: implement power state
This allows to power off pci devices. In "off" state the devices will
not be visible. No pci config space access, no pci bar access, no dma.
Default state is "on", so this patch (alone) should not change behavior.
Use case: Allows hotplug controllers implement slot power. Hotplug
controllers doing so should set the inital power state for devices in
the ->plug callback.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20211111130859.1171890-2-kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/pci')
-rw-r--r-- | include/hw/pci/pci.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 5c4016b995..e7cdf2d5ec 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -268,6 +268,7 @@ typedef struct PCIReqIDCache PCIReqIDCache; struct PCIDevice { DeviceState qdev; bool partially_hotplugged; + bool has_power; /* PCI config space */ uint8_t *config; @@ -908,5 +909,6 @@ extern const VMStateDescription vmstate_pci_device; } MSIMessage pci_get_msi_message(PCIDevice *dev, int vector); +void pci_set_power(PCIDevice *pci_dev, bool state); #endif |