Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: Fix pci_enable_acs() support for the ACS quirks

There are ACS quirks that hijack the normal ACS processing and deliver to
to special quirk code. The enable path needs to call
pci_dev_specific_enable_acs() and then pci_dev_specific_acs_enabled() will
report the hidden ACS state controlled by the quirk.

The recent rework got this out of order and we should try to call
pci_dev_specific_enable_acs() regardless of any actual ACS support in the
device.

As before command line parameters that effect standard PCI ACS don't
interact with the quirk versions, including the new config_acs= option.

Link: https://lore.kernel.org/r/0-v1-f96b686c625b+124-pci_acs_quirk_fix_jgg@nvidia.com
Fixes: 47c8846a49ba ("PCI: Extend ACS configurability")
Reported-by: Jiri Slaby <jirislaby@kernel.org>
Closes: https://lore.kernel.org/all/e89107da-ac99-4d3a-9527-a4df9986e120@kernel.org
Closes: https://bugzilla.suse.com/show_bug.cgi?id=1229019
Tested-by: Steffen Dirkwinkel <me@steffen.cc>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Jason Gunthorpe and committed by
Bjorn Helgaas
f3c3ccc4 9852d85e

+9 -5
+9 -5
drivers/pci/pci.c
··· 1067 1067 static void pci_enable_acs(struct pci_dev *dev) 1068 1068 { 1069 1069 struct pci_acs caps; 1070 + bool enable_acs = false; 1070 1071 int pos; 1072 + 1073 + /* If an iommu is present we start with kernel default caps */ 1074 + if (pci_acs_enable) { 1075 + if (pci_dev_specific_enable_acs(dev)) 1076 + enable_acs = true; 1077 + } 1071 1078 1072 1079 pos = dev->acs_cap; 1073 1080 if (!pos) ··· 1084 1077 pci_read_config_word(dev, pos + PCI_ACS_CTRL, &caps.ctrl); 1085 1078 caps.fw_ctrl = caps.ctrl; 1086 1079 1087 - /* If an iommu is present we start with kernel default caps */ 1088 - if (pci_acs_enable) { 1089 - if (pci_dev_specific_enable_acs(dev)) 1090 - pci_std_enable_acs(dev, &caps); 1091 - } 1080 + if (enable_acs) 1081 + pci_std_enable_acs(dev, &caps); 1092 1082 1093 1083 /* 1094 1084 * Always apply caps from the command line, even if there is no iommu.