[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PH0PR12MB5417A9E79D51D2D21AB695178F472@PH0PR12MB5417.namprd12.prod.outlook.com>
Date: Mon, 5 Feb 2024 03:47:02 +0000
From: "Deng, Emily" <Emily.Deng@....com>
To: Leon Romanovsky <leon@...nel.org>
CC: "bhelgaas@...gle.com" <bhelgaas@...gle.com>, "alex.williamson@...hat.com"
<alex.williamson@...hat.com>, "linux-pci@...r.kernel.org"
<linux-pci@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: RE: [PATCH] PCI: Add vf reset notification for pf
[AMD Official Use Only - General]
The use case is the vfio-pci driver, which is used to support a user mode PF driver. Will also sent out the vfio-pci driver patch. And add more comments in the patch. Thanks.
Emily Deng
Best Wishes
>-----Original Message-----
>From: Leon Romanovsky <leon@...nel.org>
>Sent: Sunday, February 4, 2024 7:21 PM
>To: Deng, Emily <Emily.Deng@....com>
>Cc: amd-gfx@...ts.freedesktop.org; bhelgaas@...gle.com;
>alex.williamson@...hat.com; linux-pci@...r.kernel.org; linux-
>kernel@...r.kernel.org; kvm@...r.kernel.org
>Subject: Re: [PATCH] PCI: Add vf reset notification for pf
>
>On Sun, Feb 04, 2024 at 02:12:57PM +0800, Emily Deng wrote:
>> When a vf has been reset, the pf wants to get notification to remove
>> the vf out of schedule.
>
>It is very questionable if this is right thing to do. The idea of SR-IOV is that
>VFs represent a physical device and they should be treated separately from
>the PF.
>
>In addition to that Keith said, this patch needs better justification.
>
>Thanks
>
>>
>> Solution:
>> Add the callback function in pci_driver sriov_vf_reset_notification.
>> When vf reset happens, then call this callback function.
>>
>> Signed-off-by: Emily Deng <Emily.Deng@....com>
>> ---
>> drivers/pci/pci.c | 8 ++++++++
>> include/linux/pci.h | 1 +
>> 2 files changed, 9 insertions(+)
>>
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index
>> 60230da957e0..aca937b05531 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -4780,6 +4780,14 @@ EXPORT_SYMBOL_GPL(pcie_flr);
>> */
>> int pcie_reset_flr(struct pci_dev *dev, bool probe) {
>> + struct pci_dev *pf_dev;
>> +
>> + if (dev->is_virtfn) {
>> + pf_dev = dev->physfn;
>> + if (pf_dev->driver->sriov_vf_reset_notification)
>> + pf_dev->driver->sriov_vf_reset_notification(pf_dev,
>dev);
>> + }
>> +
>> if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET)
>> return -ENOTTY;
>>
>> diff --git a/include/linux/pci.h b/include/linux/pci.h index
>> c69a2cc1f412..4fa31d9b0aa7 100644
>> --- a/include/linux/pci.h
>> +++ b/include/linux/pci.h
>> @@ -926,6 +926,7 @@ struct pci_driver {
>> int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */
>> int (*sriov_set_msix_vec_count)(struct pci_dev *vf, int
>msix_vec_count); /* On PF */
>> u32 (*sriov_get_vf_total_msix)(struct pci_dev *pf);
>> + void (*sriov_vf_reset_notification)(struct pci_dev *pf, struct
>> +pci_dev *vf);
>> const struct pci_error_handlers *err_handler;
>> const struct attribute_group **groups;
>> const struct attribute_group **dev_groups;
>> --
>> 2.36.1
>>
>>
Powered by blists - more mailing lists