[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/20] pcie: add power indicator blink check
From: |
Michael S. Tsirkin |
Subject: |
[PULL 17/20] pcie: add power indicator blink check |
Date: |
Mon, 15 Nov 2021 11:38:56 -0500 |
From: Gerd Hoffmann <kraxel@redhat.com>
Refuse to push the attention button in case the guest is busy with some
hotplug operation (as indicated by the power indicator blinking).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20211111130859.1171890-4-kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci/pcie.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 13d11a57c7..b92dbff118 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -506,6 +506,7 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler
*hotplug_dev,
PCIDevice *hotplug_pdev = PCI_DEVICE(hotplug_dev);
uint8_t *exp_cap = hotplug_pdev->config + hotplug_pdev->exp.exp_cap;
uint32_t sltcap = pci_get_word(exp_cap + PCI_EXP_SLTCAP);
+ uint16_t sltctl = pci_get_word(exp_cap + PCI_EXP_SLTCTL);
/* Check if hot-unplug is disabled on the slot */
if ((sltcap & PCI_EXP_SLTCAP_HPC) == 0) {
@@ -521,6 +522,12 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler
*hotplug_dev,
return;
}
+ if ((sltctl & PCI_EXP_SLTCTL_PIC) == PCI_EXP_SLTCTL_PWR_IND_BLINK) {
+ error_setg(errp, "Hot-unplug failed: "
+ "guest is busy (power indicator blinking)");
+ return;
+ }
+
dev->pending_deleted_event = true;
/* In case user cancel the operation of multi-function hot-add,
--
MST
- [PULL 07/20] hw/acpi/ich9: Add compat prop to keep HPC bit set for 6.1 machine type, (continued)
- [PULL 07/20] hw/acpi/ich9: Add compat prop to keep HPC bit set for 6.1 machine type, Michael S. Tsirkin, 2021/11/15
- [PULL 08/20] bios-tables-test: Allow changes in DSDT ACPI tables, Michael S. Tsirkin, 2021/11/15
- [PULL 09/20] hw/i386/acpi-build: Deny control on PCIe Native Hot-plug in _OSC, Michael S. Tsirkin, 2021/11/15
- [PULL 10/20] tests: bios-tables-test update expected blobs, Michael S. Tsirkin, 2021/11/15
- [PULL 11/20] virtio: use virtio accessor to access packed descriptor flags, Michael S. Tsirkin, 2021/11/15
- [PULL 12/20] virtio: use virtio accessor to access packed event, Michael S. Tsirkin, 2021/11/15
- [PULL 13/20] vdpa: Replace qemu_open_old by qemu_open at, Michael S. Tsirkin, 2021/11/15
- [PULL 14/20] vdpa: Check for existence of opts.vhostdev, Michael S. Tsirkin, 2021/11/15
- [PULL 15/20] pci: implement power state, Michael S. Tsirkin, 2021/11/15
- [PULL 16/20] pcie: implement slot power control for pcie root ports, Michael S. Tsirkin, 2021/11/15
- [PULL 17/20] pcie: add power indicator blink check,
Michael S. Tsirkin <=
- [PULL 18/20] pcie: factor out pcie_cap_slot_unplug(), Michael S. Tsirkin, 2021/11/15
- [PULL 19/20] pcie: fast unplug when slot power is off, Michael S. Tsirkin, 2021/11/15
- [PULL 20/20] pcie: expire pending delete, Michael S. Tsirkin, 2021/11/15
- [PULL 03/20] vhost: Rename last_index to vq_index_end, Michael S. Tsirkin, 2021/11/15
- Re: [PULL 00/20] pci,pc,virtio: bugfixes, Philippe Mathieu-Daudé, 2021/11/15
- Re: [PULL 00/20] pci,pc,virtio: bugfixes, Richard Henderson, 2021/11/16