Re: [PATCH v8 3/4] PCI: Introduce disable_acs_redir quirk

From: Bjorn Helgaas
Date: Thu Aug 09 2018 - 17:17:20 EST


On Mon, Jul 30, 2018 at 10:18:39AM -0600, Logan Gunthorpe wrote:
> Intel SPT PCH hardware has an implementation of the ACS bits that
> does not comply with the PCI express standard. To deal with this
> the existing code has an enable_acs() quirk for the hardware.
>
> In order to be able to correctly disable the ACS redirect bits for
> all hardware we need an analagous quirk to disable those bits.
>
> This adds the function pci_dev_specific_disable_acs_redir() which
> behaves similarly to pci_dev_specific_enable_acs() but uses a new
> function pointer for quirks which disables the ACS redirect bits.
>
> Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
> Reviewed-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
> ---
> ...

> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index abd5d5e17aee..0a436ec4fef5 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1880,6 +1880,7 @@ enum pci_fixup_pass {
> void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
> int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
> int pci_dev_specific_enable_acs(struct pci_dev *dev);
> +int pci_dev_specific_disable_acs_redir(struct pci_dev *dev);
> #else
> static inline void pci_fixup_device(enum pci_fixup_pass pass,
> struct pci_dev *dev) { }
> @@ -1892,6 +1893,10 @@ static inline int pci_dev_specific_enable_acs(struct pci_dev *dev)
> {
> return -ENOTTY;
> }
> +static inline int pci_dev_specific_disable_acs_redir(struct pci_dev *dev)
> +{
> + return -ENOTTY;
> +}

I assume these could go in drivers/pci/pci.h instead of
include/linux/pci.h?

I can do that (and add another patch to move the
pci_dev_specific_acs_enabled() and pci_dev_specific_enable_acs()
declarations, which also are only used inside drivers/pci) if you agree.

> #endif
>
> void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
> --
> 2.11.0
>