Re: [PATCH V2 08/11] PCI: hv: Build device id for a VMBus device, export PCI devid function

Bjorn Helgaas
2026-05-01T16:33:46Z

s/id/ID/ in subject.

I don't know if the "export PCI devid function" part is essential in
the subject. If it is, I don't know whether that refers to
hv_build_devid_type_pci() of hv_pci_vmbus_device_id(). Both are
exported by this patch. Could just mention the actual name instead of
"PCI devid function" or could make the exports a separate patch.

On Thu, Apr 30, 2026 at 05:41:54PM -0700, Mukesh R wrote:
> On Hyper-V, most hypercalls related to PCI passthru to map/unmap regions,
> interrupts, etc need a device ID as a parameter. This device ID refers
> to that specific device during the lifetime of passthru.

> +++ b/include/asm-generic/mshyperv.h
> @@ -23,6 +23,7 @@
> #include <acpi/acpi_numa.h>
> #include <linux/cpumask.h>
> #include <linux/nmi.h>
> +#include <linux/pci.h>

It doesn't look like mshyperv.h actually needs the definition, so you
probably don't need to include pci.h. A "struct pci_dev;" declaration
should be sufficient.

> #include <asm/ptrace.h>
> #include <hyperv/hvhdk.h>
>
> @@ -329,6 +330,13 @@ static inline enum hv_isolation_type hv_get_isolation_type(void)
> }
> #endif /* CONFIG_HYPERV */
>
> +#if IS_ENABLED(CONFIG_PCI_HYPERV)
> +u64 hv_pci_vmbus_device_id(struct pci_dev *pdev);
> +#else
> +static inline u64 hv_pci_vmbus_device_id(struct pci_dev *pdev)
> +{ return 0; }
> +#endif /* IS_ENABLED(CONFIG_PCI_HYPERV) */
> +
> #if IS_ENABLED(CONFIG_MSHV_ROOT)
> static inline bool hv_root_partition(void)
> {
> --
> 2.51.2.vfs.0.1
>