qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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 3/6] pcie: add power indicator blink check
Date: Mon, 11 Oct 2021 14:05:01 +0200	[thread overview]
Message-ID: <20211011120504.254053-4-kraxel@redhat.com> (raw)
In-Reply-To: <20211011120504.254053-1-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>
---
 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



  parent reply	other threads:[~2021-10-11 12:08 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 12:04 [PATCH 0/6] RfC: try improve native hotplug for pcie root ports Gerd Hoffmann
2021-10-11 12:04 ` [PATCH 1/6] pci: implement power state Gerd Hoffmann
2021-10-11 12:05 ` [PATCH 2/6] pcie: implement slow power control for pcie root ports Gerd Hoffmann
2021-10-11 12:05 ` Gerd Hoffmann [this message]
2021-11-15 11:29   ` [PATCH 3/6] pcie: add power indicator blink check Michael S. Tsirkin
2021-11-15 14:52     ` Gerd Hoffmann
2021-10-11 12:05 ` [PATCH 4/6] pcie: factor out pcie_cap_slot_unplug() Gerd Hoffmann
2021-10-11 12:05 ` [PATCH 5/6] pcie: fast unplug when slot power is off Gerd Hoffmann
2021-10-12  5:56   ` Michael S. Tsirkin
2021-10-12  6:46     ` Gerd Hoffmann
2021-10-11 12:05 ` [PATCH 6/6] pcie: expire pending delete Gerd Hoffmann
2021-10-11 12:49   ` Michael S. Tsirkin
2021-10-12  5:30     ` Gerd Hoffmann
2021-10-12  5:46       ` Michael S. Tsirkin
2021-10-12  6:44         ` Gerd Hoffmann
2021-10-12  7:01           ` Michael S. Tsirkin
2021-10-18 15:36 ` [PATCH 0/6] RfC: try improve native hotplug for pcie root ports Michael S. Tsirkin
2021-10-19  5:21   ` Gerd Hoffmann
2021-10-19  5:46     ` Michael S. Tsirkin
2021-10-19  6:29       ` Gerd Hoffmann
2021-11-01 21:47         ` Michael S. Tsirkin
2021-11-02 12:09           ` Gerd Hoffmann
2021-11-10 12:02 ` Michael S. Tsirkin
2021-11-11  7:53   ` Gerd Hoffmann
2021-11-11  8:20     ` Michael S. Tsirkin
2021-11-11  9:34       ` Gerd Hoffmann
2021-11-11 12:09         ` Gerd Hoffmann
2021-11-11 15:39           ` Michael S. Tsirkin
2021-11-12 11:15             ` Gerd Hoffmann
2021-11-12 12:17               ` Igor Mammedov
2021-11-15 11:13               ` Michael S. Tsirkin
2021-11-11  9:35       ` Daniel P. Berrangé
2021-11-11 17:11         ` Michael S. Tsirkin
2021-11-11 18:08           ` Daniel P. Berrangé
2021-11-11 18:43             ` Michael S. Tsirkin
2021-11-12 10:16               ` 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=20211011120504.254053-4-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).