[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <323krpkmg4zmswo567ccah2g7ymprs66nfei3eo6saobl2azda@35jdfloq5g3g>
Date: Wed, 28 Jan 2026 20:06:21 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Mukesh R <mrathor@...ux.microsoft.com>
Cc: Stanislav Kinsburskii <skinsburskii@...ux.microsoft.com>,
linux-kernel@...r.kernel.org, linux-hyperv@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev, linux-pci@...r.kernel.org,
linux-arch@...r.kernel.org, kys@...rosoft.com, haiyangz@...rosoft.com, wei.liu@...nel.org,
decui@...rosoft.com, longli@...rosoft.com, catalin.marinas@....com, will@...nel.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
hpa@...or.com, joro@...tes.org, lpieralisi@...nel.org, kwilczynski@...nel.org,
robh@...nel.org, bhelgaas@...gle.com, arnd@...db.de,
nunodasneves@...ux.microsoft.com, mhklinux@...look.com, romank@...ux.microsoft.com
Subject: Re: [PATCH v0 10/15] PCI: hv: Build device id for a VMBus device
On Fri, Jan 23, 2026 at 04:42:54PM -0800, Mukesh R wrote:
> On 1/20/26 14:22, Stanislav Kinsburskii wrote:
> > On Mon, Jan 19, 2026 at 10:42:25PM -0800, Mukesh R wrote:
> > > From: Mukesh Rathor <mrathor@...ux.microsoft.com>
> > >
> > > 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.
> > >
> > > An L1VH VM only contains VMBus based devices. A device id for a VMBus
> > > device is slightly different in that it uses the hv_pcibus_device info
> > > for building it to make sure it matches exactly what the hypervisor
> > > expects. This VMBus based device id is needed when attaching devices in
> > > an L1VH based guest VM. Before building it, a check is done to make sure
> > > the device is a valid VMBus device.
> > >
> > > Signed-off-by: Mukesh Rathor <mrathor@...ux.microsoft.com>
> > > ---
> > > arch/x86/include/asm/mshyperv.h | 2 ++
> > > drivers/pci/controller/pci-hyperv.c | 29 +++++++++++++++++++++++++++++
> > > 2 files changed, 31 insertions(+)
> > >
> > > diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> > > index eef4c3a5ba28..0d7fdfb25e76 100644
> > > --- a/arch/x86/include/asm/mshyperv.h
> > > +++ b/arch/x86/include/asm/mshyperv.h
> > > @@ -188,6 +188,8 @@ bool hv_vcpu_is_preempted(int vcpu);
> > > static inline void hv_apic_init(void) {}
> > > #endif
> > > +u64 hv_pci_vmbus_device_id(struct pci_dev *pdev);
> > > +
> > > struct irq_domain *hv_create_pci_msi_domain(void);
> > > int hv_map_msi_interrupt(struct irq_data *data,
> > > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> > > index 8bc6a38c9b5a..40f0b06bb966 100644
> > > --- a/drivers/pci/controller/pci-hyperv.c
> > > +++ b/drivers/pci/controller/pci-hyperv.c
> > > @@ -579,6 +579,8 @@ static void hv_pci_onchannelcallback(void *context);
> > > #define DELIVERY_MODE APIC_DELIVERY_MODE_FIXED
> > > #define HV_MSI_CHIP_FLAGS MSI_CHIP_FLAG_SET_ACK
> > > +static bool hv_vmbus_pci_device(struct pci_bus *pbus);
> > > +
> >
> > Why not moving this static function definition above the called instead of
> > defining the prototype?
>
> Did you see the function implementation? It has other dependencies that
> are later, it would need code reorg.
>
> Thanks,
> -Mukesh
>
>
> > > static int hv_pci_irqchip_init(void)
> > > {
> > > return 0;
> > > @@ -598,6 +600,26 @@ static unsigned int hv_msi_get_int_vector(struct irq_data *data)
> > > #define hv_msi_prepare pci_msi_prepare
> > > +u64 hv_pci_vmbus_device_id(struct pci_dev *pdev)
> > > +{
> > > + u64 u64val;
> >
> > This variable is redundant.
>
> Not really. It helps with debug by putting a quick print, and is
> harmless.
>
Such debug print do not exist now. So there is no need of a variable, drop it.
- Mani
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists