From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH v2 5/6] pcie: fast unplug when slot power is off
Date: Thu, 11 Nov 2021 14:08:58 +0100 [thread overview]
Message-ID: <20211111130859.1171890-6-kraxel@redhat.com> (raw)
In-Reply-To: <20211111130859.1171890-1-kraxel@redhat.com>
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
next prev parent reply other threads:[~2021-11-11 13:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 13:08 [PATCH v2 0/6] try improve native hotplug for pcie root ports Gerd Hoffmann
2021-11-11 13:08 ` [PATCH v2 1/6] pci: implement power state Gerd Hoffmann
2021-11-15 14:46 ` Michael S. Tsirkin
2021-11-16 7:16 ` Gerd Hoffmann
2021-11-15 14:52 ` Michael S. Tsirkin
2021-11-11 13:08 ` [PATCH v2 2/6] pcie: implement slot power control for pcie root ports Gerd Hoffmann
2021-11-11 13:08 ` [PATCH v2 3/6] pcie: add power indicator blink check Gerd Hoffmann
2021-11-11 13:08 ` [PATCH v2 4/6] pcie: factor out pcie_cap_slot_unplug() Gerd Hoffmann
2021-11-11 13:08 ` Gerd Hoffmann [this message]
2021-11-11 13:08 ` [PATCH v2 6/6] pcie: expire pending delete Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211111130859.1171890-6-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).