[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d825feec-f6ca-30b8-3c7f-fb94e2e13499@linux.intel.com>
Date: Thu, 1 Aug 2019 14:21:07 -0700
From: sathyanarayanan kuppuswamy
<sathyanarayanan.kuppuswamy@...ux.intel.com>
To: Keith Busch <kbusch@...nel.org>
Cc: bhelgaas@...gle.com, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, ashok.raj@...el.com,
keith.busch@...el.com
Subject: Re: [PATCH v4 2/7] PCI/ATS: Initialize PRI in pci_ats_init()
Hi Keith,
Thanks for the review.
On 8/1/19 2:09 PM, Keith Busch wrote:
> On Wed, Jul 03, 2019 at 01:46:19PM -0700, sathyanarayanan.kuppuswamy@...ux.intel.com wrote:
>> +#ifdef CONFIG_PCI_PRI
>> +static void pci_pri_init(struct pci_dev *pdev)
>> +{
>> + u32 max_requests;
>> + int pos;
>> +
>> + /*
>> + * As per PCIe r4.0, sec 9.3.7.11, only PF is permitted to
>> + * implement PRI and all associated VFs can only use it.
>> + * Since PF already initialized the PRI parameters there is
>> + * no need to proceed further.
>> + */
>> + if (pdev->is_virtfn)
>> + return;
>> +
>> + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
>> + if (!pos)
>> + return;
>> +
>> + pci_read_config_dword(pdev, pos + PCI_PRI_MAX_REQ, &max_requests);
>> +
>> + /*
>> + * Since PRI is a shared resource between PF and VF, we must not
>> + * configure Outstanding Page Allocation Quota as a per device
>> + * resource in pci_enable_pri(). So use maximum value possible
>> + * as default value.
>> + */
>> + pci_write_config_dword(pdev, pos + PCI_PRI_ALLOC_REQ, max_requests);
>> +
>> + pdev->pri_reqs_alloc = max_requests;
>> + pdev->pri_cap = pos;
>> +}
>> +#endif
>> +
>> void pci_ats_init(struct pci_dev *dev)
>> {
>> int pos;
>> @@ -28,6 +62,10 @@ void pci_ats_init(struct pci_dev *dev)
>> return;
>>
>> dev->ats_cap = pos;
>> +
>> +#ifdef CONFIG_PCI_PRI
>> + pci_pri_init(dev);
>> +#endif
>> }
> Rather than surround the call to pci_pri_init() with the #ifdef, you
> should provide an empty function implementation when CONFIG_PCI_PRI is
> not defined. Same thing for the next patch adding PASID.
This function is defined and used in the same file (ats.c). Is there any
advantage in defining an empty function ? But if this is the recommended
approach, I can make the necessary changes. Please confirm.
>
--
Sathyanarayanan Kuppuswamy
Linux kernel developer
Powered by blists - more mailing lists