Message ID | 20200707045418.3517076-4-rajatja@google.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | [v3,1/4] PCI: Move pci_enable_acs() and its dependencies up in pci.c | expand |
Hi Rajat, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on pci/next] [also build test WARNING on iommu/next pm/linux-next v5.8-rc4 next-20200707] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Rajat-Jain/PCI-Move-pci_enable_acs-and-its-dependencies-up-in-pci-c/20200707-125604 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next config: arm-randconfig-r012-20200707 (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 02946de3802d3bc65bc9f2eb9b8d4969b5a7add8) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> drivers/pci/pci.c:883:3: warning: add explicit braces to avoid dangling else [-Wdangling-else] else ^ 1 warning generated. -- >> drivers/pci/quirks.c:4987:3: warning: add explicit braces to avoid dangling else [-Wdangling-else] else ^ 1 warning generated. vim +883 drivers/pci/pci.c 849 850 /** 851 * pci_std_enable_acs - enable ACS on devices using standard ACS capabilities 852 * @dev: the PCI device 853 */ 854 static void pci_std_enable_acs(struct pci_dev *dev) 855 { 856 int pos; 857 u16 cap; 858 u16 ctrl; 859 860 pos = dev->acs_cap; 861 if (!pos) 862 return; 863 864 pci_read_config_word(dev, pos + PCI_ACS_CAP, &cap); 865 pci_read_config_word(dev, pos + PCI_ACS_CTRL, &ctrl); 866 867 /* Source Validation */ 868 ctrl |= (cap & PCI_ACS_SV); 869 870 /* P2P Request Redirect */ 871 ctrl |= (cap & PCI_ACS_RR); 872 873 /* P2P Completion Redirect */ 874 ctrl |= (cap & PCI_ACS_CR); 875 876 /* Upstream Forwarding */ 877 ctrl |= (cap & PCI_ACS_UF); 878 879 /* Enable Translation Blocking for external devices */ 880 if (dev->external_facing || dev->untrusted) 881 if (cap & PCI_ACS_TB) 882 ctrl |= PCI_ACS_TB; > 883 else 884 pci_warn(dev, "ACS: No Trans Blocking on ext dev\n"); 885 886 pci_write_config_word(dev, pos + PCI_ACS_CTRL, ctrl); 887 } 888 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 73a8627822140..497ac05bf36e8 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -876,6 +876,13 @@ static void pci_std_enable_acs(struct pci_dev *dev) /* Upstream Forwarding */ ctrl |= (cap & PCI_ACS_UF); + /* Enable Translation Blocking for external devices */ + if (dev->external_facing || dev->untrusted) + if (cap & PCI_ACS_TB) + ctrl |= PCI_ACS_TB; + else + pci_warn(dev, "ACS: No Trans Blocking on ext dev\n"); + pci_write_config_word(dev, pos + PCI_ACS_CTRL, ctrl); } diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b341628e47527..9cc8c1dc215ee 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4934,6 +4934,13 @@ static void pci_quirk_enable_intel_rp_mpc_acs(struct pci_dev *dev) } } +/* + * Currently this quirk does the equivalent of + * PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF + * + * TODO: This quirk also needs to do equivalent of PCI_ACS_TB, + * if dev->external_facing || dev->untrusted + */ static int pci_quirk_enable_intel_pch_acs(struct pci_dev *dev) { if (!pci_quirk_intel_pch_acs_match(dev)) @@ -4973,6 +4980,13 @@ static int pci_quirk_enable_intel_spt_pch_acs(struct pci_dev *dev) ctrl |= (cap & PCI_ACS_CR); ctrl |= (cap & PCI_ACS_UF); + /* Enable Translation Blocking for external devices */ + if (dev->external_facing || dev->untrusted) + if (cap & PCI_ACS_TB) + ctrl |= PCI_ACS_TB; + else + pci_warn(dev, "ACS: No Trans Blocking on ext dev\n"); + pci_write_config_dword(dev, pos + INTEL_SPT_ACS_CTRL, ctrl); pci_info(dev, "Intel SPT PCH root port ACS workaround enabled\n");
When enabling ACS, enable translation blocking for external facing ports and untrusted devices. Signed-off-by: Rajat Jain <rajatja@google.com> --- v3: print warning if ACS_TB not supported on external-facing/untrusted ports. Minor code comments fixes. v2: Commit log change drivers/pci/pci.c | 7 +++++++ drivers/pci/quirks.c | 14 ++++++++++++++ 2 files changed, 21 insertions(+)