[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] pcie: add power indicator blink check
From: |
Gerd Hoffmann |
Subject: |
[PATCH 3/6] pcie: add power indicator blink check |
Date: |
Mon, 11 Oct 2021 14:05:01 +0200 |
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>
---
hw/pci/pcie.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 4a52c250615e..c455f92e16bf 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,
--
2.31.1
- [PATCH 0/6] RfC: try improve native hotplug for pcie root ports, Gerd Hoffmann, 2021/10/11
- [PATCH 1/6] pci: implement power state, Gerd Hoffmann, 2021/10/11
- [PATCH 2/6] pcie: implement slow power control for pcie root ports, Gerd Hoffmann, 2021/10/11
- [PATCH 3/6] pcie: add power indicator blink check,
Gerd Hoffmann <=
- [PATCH 5/6] pcie: fast unplug when slot power is off, Gerd Hoffmann, 2021/10/11
- [PATCH 4/6] pcie: factor out pcie_cap_slot_unplug(), Gerd Hoffmann, 2021/10/11
- [PATCH 6/6] pcie: expire pending delete, Gerd Hoffmann, 2021/10/11