[PATCH] PCI: hv: fix wslot_to_devfn()

Haiyang Zhang haiyangz at microsoft.com
Tue Feb 7 16:17:34 UTC 2017



> -----Original Message-----
> From: Dexuan Cui
> Sent: Tuesday, February 7, 2017 4:00 AM
> To: Bjorn Helgaas <bhelgaas at google.com>; linux-pci at vger.kernel.org;
> devel at linuxdriverproject.org; Jake Oshins <jakeo at microsoft.com>
> Cc: KY Srinivasan <kys at microsoft.com>; Stephen Hemminger
> <sthemmin at microsoft.com>; Haiyang Zhang <haiyangz at microsoft.com>;
> olaf at aepfle.de; gregkh at linuxfoundation.org; linux-kernel at vger.kernel.org;
> apw at canonical.com; jasowang at redhat.com; Vitaly Kuznetsov
> <vkuznets at redhat.com>
> Subject: [PATCH] PCI: hv: fix wslot_to_devfn()
> 
> The devfn of 00:02.0 is 0x10.
> devfn_to_wslot(0x10) == 0x2, and wslot_to_devfn(0x2) should be 0x10,
> while it's 0x2 in the current code.
> 
> Due to this, hv_eject_device_work() -> pci_get_domain_bus_and_slot()
> returns NULL and pci_stop_and_remove_bus_device() is not called.
> 
> Later when the real device driver's .remove() is invoked by
> hv_pci_remove() -> pci_stop_root_bus(), some warnings can be noticed
> because the VM has lost the access to the underlying device at that time.
> 
> Signed-off-by: Jake Oshins <jakeo at microsoft.com>
> Signed-off-by: Dexuan Cui <decui at microsoft.com>
> Cc: stable at vger.kernel.org
> Cc: K. Y. Srinivasan <kys at microsoft.com>
> CC: Haiyang Zhang <haiyangz at microsoft.com>
> Cc: Stephen Hemminger <sthemmin at microsoft.com>
> ---
>  drivers/pci/host/pci-hyperv.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> The patch is co-made by Jake and me.

I think this line should be put together with other comments.

Thanks.
Acked-by: Haiyang Zhang <haiyangz at microsoft.com>



More information about the devel mailing list