[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tynmkh4isrbi473zh6t4kd5bswrthxy3garhgpzafq6n2wrmqk@rfanfjgciyqv>
Date: Thu, 7 Aug 2025 13:43:33 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
Cc: Vivek.Pernamitta@...cinc.com, mhi@...ts.linux.dev,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
Vivek Pernamitta <quic_vpernami@...cinc.com>
Subject: Re: [PATCH v2 2/5] bus: mhi: host: pci_generic: Read
SUBSYSTEM_VENDOR_ID for VF's to check status
On Thu, Aug 07, 2025 at 12:39:26PM GMT, Krishna Chaitanya Chundru wrote:
>
>
> On 8/6/2025 10:29 PM, Manivannan Sadhasivam wrote:
> > On Thu, Jul 10, 2025 at 02:28:33PM GMT, Vivek.Pernamitta@...cinc.com wrote:
> > > From: Vivek Pernamitta <quic_vpernami@...cinc.com>
> > >
> > > In SRIOV enabled devices, the VF DEVICE/VENDOR ID register returns FFFFh
> > > when read (PCIe SRIOV spec-3.4.1.1). Therefore, read the PCIe
> > > SUBSYSTEM_VENDOR_ID to check if the device is active.
> > >
> > > Signed-off-by: Vivek Pernamitta <quic_vpernami@...cinc.com>
> > > Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
> > > ---
> > > drivers/bus/mhi/host/pci_generic.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> > > index 7d0ac1c34ddf95ace2a85e5f08884f51604d9b0f..4bafe93b56c54e2b091786e7fcd68a36c8247b8e 100644
> > > --- a/drivers/bus/mhi/host/pci_generic.c
> > > +++ b/drivers/bus/mhi/host/pci_generic.c
> > > @@ -1025,8 +1025,10 @@ static bool mhi_pci_is_alive(struct mhi_controller *mhi_cntrl)
> > > struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev);
> > > u16 vendor = 0;
> > > - if (pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor))
> > > - return false;
> > > + if (pdev->is_virtfn)
> > > + pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &vendor);
> > > + else
> > > + pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor);
> >
> > You should not read the sub Vendor ID for VF. PCIe spec suggests reading the PF
> > Vendor ID for VF. So you should just use pci_physfn() API as below:
> >
> > pci_read_config_word(pci_physfn(pdev), PCI_VENDOR_ID, &vendor);
> >
> > This will work for both PF and VF.
> >
> This will defeat the purpose of having health check monitor for VF,
> as we are always reading PF vendor ID and will not know VF status at all.
Do we really have a usecase to perform health check for VFs? Health check is
supposed to happen for devices that can fail abruptly.
- Mani
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists