ACPI: APEI: Filter the PCI MCFG address with an arch-agnostic method
PATCH 2/2 ACPI: APEI: Filter the PCI MCFG address with an arch-agnostic method
The commit d91525eb8ee6 ("ACPI, EINJ: Enhance error injection tolerance level") fixes the issue that the ACPI/APEI can not access the PCI MCFG address on x86 platform, but this issue can also happen on other architectures, for instance, we got below error message on arm64 platform:
...
APEI: Can not request [mem 0x50100000-0x50100003] for APEI EINJ Trigger registers
...
This patch will try to handle this case in a more common way instead of the original 'arch' specific solution, which will be beneficial to all the APEI-dependent platforms after that.
--- arch/x86/pci/mmconfig-shared.c | 28 ---------------------------- drivers/acpi/apei/apei-base.c | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 44 deletions(-)
arch/x86/pci/mmconfig-shared.c +0 -28
@@ -605,32 +605,6 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)return 0 ; } -#ifdef CONFIG_ACPI_APEI -extern int (*arch_apei_filter_addr)(int (*func)(__u64 start,__u64 size, -void *data),void *data); - -static int pci_mmcfg_for_each_region (int (*func)(__u64 start,__u64 size, -void *data),void *data) -{ -struct pci_mmcfg_region *cfg; -int rc; - -if (list_empty (&pci_mmcfg_list)) -return 0 ; - -list_for_each_entry (cfg, &pci_mmcfg_list, list) { - rc =func (cfg->res.start,resource_size (&cfg->res), data); -if (rc) -return rc; - } - -return 0 ; -} -#define set_apei_filter () (arch_apei_filter_addr = pci_mmcfg_for_each_region) -#else -#define set_apei_filter () -#endif -static void __init __pci_mmcfg_init (int early) {pci_mmcfg_reject_broken (early);
@@ -665,8 +639,6 @@ void __init pci_mmcfg_early_init(void)else acpi_table_parse (ACPI_SIG_MCFG , pci_parse_mcfg);__pci_mmcfg_init (1 ); - -set_apei_filter (); } }
drivers/acpi/apei/apei-base.c +26 -16
73 lines not on this page · raw message
Signature · 1 line
1.8.3.1
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Xuesong,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on helgaas-pci/next]
[also build test ERROR on arm64/for-next/core tip/x86/core rafael-pm/linux-next v5.15-rc3 next-20210922] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Xuesong-Chen/PCI-MCFG-consolidation-and-APEI-resource-filtering/20211006-104914 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next config: arm64-randconfig-r016-20211004 (attached as .config) compiler: aarch64-linux-gcc (GCC) 11.2.0
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
# https://github.com/0day-ci/linux/commit/5b078b52f2babaacc9958d44f22c47f5ddc8e803
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xuesong-Chen/PCI-MCFG-consolidation-and-APEI-resource-filtering/20211006-104914 git checkout 5b078b52f2babaacc9958d44f22c47f5ddc8e803
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
aarch64-linux-ld: drivers/acpi/apei/apei-base.o: in function `apei_resources_request.part.0':
>> apei-base.c:(.text+0x1470): undefined reference to `pci_mmcfg_list' aarch64-linux-ld: drivers/acpi/apei/apei-base.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `pci_mmcfg_list' which may bind externally can not be used when making a shared object; recompile with -fPIC apei-base.c:(.text+0x1470): dangerous relocation: unsupported relocation >> aarch64-linux-ld: apei-base.c:(.text+0x1478): undefined reference to `pci_mmcfg_list'
aarch64-linux-ld: apei-base.c:(.text+0x147c): undefined reference to `pci_mmcfg_list'
aarch64-linux-ld: apei-base.c:(.text+0x1488): undefined reference to `pci_mmcfg_list'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Hello All:
Refer to the below CONFIG_PCI dependency chain:
---> PCI_MMCONFIG(n) (x86)
/PCI(n) ----> ACPI_MCFG(n) (arm64)
IOW, if CONFIG_PCI is not defined, then neither MMCONFIG nor MCFG will be defined, we only need a static empty pci_mmcfg_list in APEI (which is independent of CONFIG_PCI) to avoid the 'undefined reference to `pci_mmcfg_list' build error, with the code logic untached.
If CONFIG_PCI is defined, then no matter PCI_MMCONFIG/ACPI_MCFG is defined or not, the original patch can hanle it well.
So I plan to mitigate this build issue with below diff:
drivers/acpi/apei/apei-base.c +4 -0
@@ -35,7 +35,11 @@#define APEI_PFX "APEI: " +#ifdef CONFIG_PCI extern struct list_head pci_mmcfg_list; +#else +static LIST_HEAD (pci_mmcfg_list); +#endif
I will re-send the patch set to fix this if nobody objects...
Xuesong
Quoted 42 lines · kernel test robot
Hi Xuesong,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on helgaas-pci/next]
[also build test ERROR on arm64/for-next/core tip/x86/core rafael-pm/linux-next v5.15-rc3 next-20210922] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Xuesong-Chen/PCI-MCFG-consolidation-and-APEI-resource-filtering/20211006-104914 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next config: arm64-randconfig-r016-20211004 (attached as .config) compiler: aarch64-linux-gcc (GCC) 11.2.0reproduce (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
# https://github.com/0day-ci/linux/commit/5b078b52f2babaacc9958d44f22c47f5ddc8e803
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xuesong-Chen/PCI-MCFG-consolidation-and-APEI-resource-filtering/20211006-104914 git checkout5b078b52f2babaacc9958d44f22c47f5ddc8e803
# save the attached .config to linux build tree
mkdirbuild_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bashIf you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
aarch64-linux-ld:
drivers/acpi/apei/apei-base.o: in function `apei_resources_request.part.0':Quoted 1 line
Quoted 1 line
apei-base.c:(.text+0x1470): undefined reference to `pci_mmcfg_list'
aarch64-linux-ld:
drivers/acpi/apei/apei-base.o: relocationR_AARCH64_ADR_PREL_PG_HI21against symbol `pci_mmcfg_list' which may bind externally can not be used when making a shared object; recompile with -fPIC apei-base.c:(.text+0x1470): dangerous relocation: unsupported relocationQuoted 1 line
Quoted 1 line
aarch64-linux-ld: apei-base.c:(.text+0x1478): undefined reference to `pci_mmcfg_list'
aarch64-linux-ld: apei-base.c:(.text+0x147c): undefined reference to `pci_mmcfg_list'
aarch64-linux-ld: apei-base.c:(.text+0x1488): undefined reference to `pci_mmcfg_list'---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org