[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190801210929.GE15795@localhost.localdomain>
Date: Thu, 1 Aug 2019 15:09:29 -0600
From: Keith Busch <kbusch@...nel.org>
To: sathyanarayanan.kuppuswamy@...ux.intel.com
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()
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.
Powered by blists - more mailing lists