From: Maxim Levitsky <mlevitsk@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 1/1] pci/pcie: refuse another hotplug/unplug event if attention button is pending
Date: Wed, 22 Jul 2020 19:19:01 +0300 [thread overview]
Message-ID: <3c4a37263eaceffec01fb00bc9b3549a3c9df90e.camel@redhat.com> (raw)
In-Reply-To: <20200722161722.51416-2-mlevitsk@redhat.com>
On Wed, 2020-07-22 at 19:17 +0300, Maxim Levitsky wrote:
> Curently it is possible to hotplug a device and then immediatly
> hotunplug it before the OS notices, and that will result
> in missed unplug event since we can only send one attention button event.
>
> Moreover the device will stuck in unplugging state forever.
>
> Error out in such cases and rely on the caller (e.g libvirt) to retry
> the unplug a bit later
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
> hw/pci/pcie.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
> index 5b48bae0f6..9e836cf2f4 100644
> --- a/hw/pci/pcie.c
> +++ b/hw/pci/pcie.c
> @@ -402,6 +402,17 @@ static void pcie_cap_slot_plug_common(PCIDevice *hotplug_dev, DeviceState *dev,
> */
> error_setg_errno(errp, EBUSY, "slot is electromechanically locked");
> }
> +
> + if (sltsta & PCI_EXP_SLTSTA_ABP) {
> + /*
> + * Attention button is pressed, thus we can't send another
> + * hotpplug event
Typo here, forgot to refresh the commit.
> + */
> + error_setg_errno(errp, EBUSY,
> + "attention button is already pressed, can't "
> + "send another hotplug event");
> + }
> +
> }
>
> void pcie_cap_slot_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
next prev parent reply other threads:[~2020-07-22 16:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 16:17 [PATCH 0/1] RFC: pcie: parital fix for missing unplug events Maxim Levitsky
2020-07-22 16:17 ` [PATCH 1/1] pci/pcie: refuse another hotplug/unplug event if attention button is pending Maxim Levitsky
2020-07-22 16:19 ` Maxim Levitsky [this message]
2020-07-29 5:09 ` Maxim Levitsky
2020-07-30 11:38 ` Igor Mammedov
2020-07-30 16:04 ` Michael S. Tsirkin
2020-07-30 16:05 ` [PATCH 0/1] RFC: pcie: parital fix for missing unplug events Michael S. Tsirkin
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=3c4a37263eaceffec01fb00bc9b3549a3c9df90e.camel@redhat.com \
--to=mlevitsk@redhat.com \
--cc=mst@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).