[PATCH 0/1] RFC: pcie: parital fix for missing unplug events

Maxim Levitsky posted 1 patch 5 years, 3 months ago
Test docker-quick@centos7 failed
Test docker-mingw@fedora failed
Test checkpatch failed
Test FreeBSD failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200722161722.51416-1-mlevitsk@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
hw/pci/pcie.c | 11 +++++++++++
1 file changed, 11 insertions(+)
[PATCH 0/1] RFC: pcie: parital fix for missing unplug events
Posted by Maxim Levitsky 5 years, 3 months ago
As described in bugzilla #1854264 it is possible to plug
a pcie device and then unplug it before the guest notices
(has time to process the attention button press)

To partially fix this issue, detect and refuse the hotunplug event.

There are other ways to fix this, which is why I am sending this as RFC:

1. Queue/remember the unplug event and fire it (press the attention button again),
when the guest clears its pending status.
According to the spec this should cancel the hotplug event in the guest
if done within 5 seconds (and I think that guest actually should wait 5 seconds
after attention button is pressed before plugging in the device too to be strictly
up to the spec)

2. Detect that device isn't yet powered on by the guest (for example
checking the bus master bit) or check that attention button is still
pressed and in this case just unplug the device immediately.

Best regards,
	Maxim Levitsky

Maxim Levitsky (1):
  pci/pcie: refuse another hotplug/unplug event if attention button is
    pending

 hw/pci/pcie.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
2.26.2



Re: [PATCH 0/1] RFC: pcie: parital fix for missing unplug events
Posted by Michael S. Tsirkin 5 years, 3 months ago
On Wed, Jul 22, 2020 at 07:17:21PM +0300, Maxim Levitsky wrote:
> As described in bugzilla #1854264 it is possible to plug
> a pcie device and then unplug it before the guest notices
> (has time to process the attention button press)
> 
> To partially fix this issue, detect and refuse the hotunplug event.
> 
> There are other ways to fix this, which is why I am sending this as RFC:
> 
> 1. Queue/remember the unplug event and fire it (press the attention button again),
> when the guest clears its pending status.
> According to the spec this should cancel the hotplug event in the guest
> if done within 5 seconds (and I think that guest actually should wait 5 seconds
> after attention button is pressed before plugging in the device too to be strictly
> up to the spec)
> 
> 2. Detect that device isn't yet powered on by the guest (for example
> checking the bus master bit) or check that attention button is still
> pressed and in this case just unplug the device immediately.

I think 2 or failing that 1 would be preferable.


> Best regards,
> 	Maxim Levitsky
> 
> Maxim Levitsky (1):
>   pci/pcie: refuse another hotplug/unplug event if attention button is
>     pending
> 
>  hw/pci/pcie.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> -- 
> 2.26.2
>