[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 5/6] pcie: fast unplug when slot power is off
From: |
Gerd Hoffmann |
Subject: |
[PATCH v2 5/6] pcie: fast unplug when slot power is off |
Date: |
Thu, 11 Nov 2021 14:08:58 +0100 |
In case the slot is powered off (and the power indicator turned off too)
we can unplug right away, without round-trip to the guest.
Also clear pending attention button press, there is nothing to care
about any more.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pci/pcie.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 959bf074b205..a930ac738a15 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -560,6 +560,16 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler
*hotplug_dev,
return;
}
+ if (((sltctl & PCI_EXP_SLTCTL_PIC) == PCI_EXP_SLTCTL_PWR_IND_OFF) &&
+ ((sltctl & PCI_EXP_SLTCTL_PCC) == PCI_EXP_SLTCTL_PWR_OFF)) {
+ /* slot is powered off -> unplug without round-trip to the guest */
+ pcie_cap_slot_do_unplug(hotplug_pdev);
+ hotplug_event_notify(hotplug_pdev);
+ pci_word_test_and_clear_mask(exp_cap + PCI_EXP_SLTSTA,
+ PCI_EXP_SLTSTA_ABP);
+ return;
+ }
+
pcie_cap_slot_push_attention_button(hotplug_pdev);
}
--
2.33.1
- [PATCH v2 0/6] try improve native hotplug for pcie root ports, Gerd Hoffmann, 2021/11/11
- [PATCH v2 2/6] pcie: implement slot power control for pcie root ports, Gerd Hoffmann, 2021/11/11
- [PATCH v2 3/6] pcie: add power indicator blink check, Gerd Hoffmann, 2021/11/11
- [PATCH v2 6/6] pcie: expire pending delete, Gerd Hoffmann, 2021/11/11
- [PATCH v2 4/6] pcie: factor out pcie_cap_slot_unplug(), Gerd Hoffmann, 2021/11/11
- [PATCH v2 5/6] pcie: fast unplug when slot power is off,
Gerd Hoffmann <=
- [PATCH v2 1/6] pci: implement power state, Gerd Hoffmann, 2021/11/11