qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] pcie: fix device unplug timeout


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH v2] pcie: fix device unplug timeout
Date: Tue, 23 Jul 2019 06:10:53 -0400

On Tue, Jul 23, 2019 at 09:33:43AM +0000, Zhangbo (Oscar) wrote:
> If the linux kernel only receives an ABP event during pcie unplug, it will 
> sleep 5s 
> to expect a PDC event, which will cause device unplug timeout.
> 
> In the meanwhile, if the kernel only receives a PDC event during the unplug, 
> it
> will wait for at least 1 second before checking card present as data link 
> layer
> state changed (link down) event reported prior to presence detect changed
> (card is not present).
> 
> Therefore we can send both ABP and PDC events to the kernel in unplug process
> to avoid unplug timeout.
> 
> Signed-off-by: Li Mingwang <address@hidden>
> Signed-off-by: Fang Ying <address@hidden>
> Signed-off-by: Zhang Bo <address@hidden>

I responded on v1 before seeing v2. As there's no change to patch
or commit log, same comments apply.

> ---
>  hw/pci/pcie.c         | 8 ++------
>  include/hw/pci/pcie.h | 1 -
>  2 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
> index 174f392..a800f23 100644
> --- a/hw/pci/pcie.c
> +++ b/hw/pci/pcie.c
> @@ -485,7 +485,8 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler 
> *hotplug_dev,
>                                       PCI_EXP_LNKSTA_DLLLA);
>      }
>  
> -    pcie_cap_slot_push_attention_button(PCI_DEVICE(hotplug_dev));
> +    pcie_cap_slot_event(PCI_DEVICE(hotplug_dev),
> +                        PCI_EXP_HP_EV_PDC | PCI_EXP_HP_EV_ABP);
>  }
>  
>  /* pci express slot for pci express root/downstream port
> @@ -701,11 +702,6 @@ int pcie_cap_slot_post_load(void *opaque, int version_id)
>      return 0;
>  }
>  
> -void pcie_cap_slot_push_attention_button(PCIDevice *dev)
> -{
> -    pcie_cap_slot_event(dev, PCI_EXP_HP_EV_ABP);
> -}
> -
>  /* root control/capabilities/status. PME isn't emulated for now */
>  void pcie_cap_root_init(PCIDevice *dev)
>  {
> diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
> index 8cf3361..0975a54 100644
> --- a/include/hw/pci/pcie.h
> +++ b/include/hw/pci/pcie.h
> @@ -112,7 +112,6 @@ void pcie_cap_slot_write_config(PCIDevice *dev,
>                                  uint16_t old_slt_ctl, uint16_t old_slt_sta,
>                                  uint32_t addr, uint32_t val, int len);
>  int pcie_cap_slot_post_load(void *opaque, int version_id);
> -void pcie_cap_slot_push_attention_button(PCIDevice *dev);
>  
>  void pcie_cap_root_init(PCIDevice *dev);
>  void pcie_cap_root_reset(PCIDevice *dev);
> -- 
> 1.8.3.1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]