[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1c79cda0-2645-4f88-a05f-9082e305fad4@oss.qualcomm.com>
Date: Thu, 7 Aug 2025 12:39:26 +0530
From: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
To: Manivannan Sadhasivam <mani@...nel.org>, Vivek.Pernamitta@...cinc.com
Cc: 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 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.
- Krishna Chaitanya.
> - Mani
>
Powered by blists - more mailing lists