diff mbox series

[v4,6/7] x86/jailhouse: Allow to use PCI_MMCONFIG without ACPI

Message ID b4504c33ee7edb6e4f2220f7828f3a27586f4741.1520188299.git.jan.kiszka@siemens.com
State Superseded
Delegated to: Bjorn Helgaas
Headers show
Series jailhouse: Enhance secondary Jailhouse guest support /wrt PCI | expand

Commit Message

Jan Kiszka March 4, 2018, 6:31 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Jailhouse does not use ACPI, but it does support MMCONFIG. Make sure the
latter can be built without having to enable ACPI as well. Primarily, we
need to make the AMD mmconf-fam10h_64 depend upon MMCONFIG and ACPI,
instead of just the former.

Saves some bytes in the Jailhouse non-root kernel.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/Kconfig          | 6 +++++-
 arch/x86/kernel/Makefile  | 2 +-
 arch/x86/kernel/cpu/amd.c | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

Comments

kernel test robot March 6, 2018, 12:41 a.m. UTC | #1
Hi Jan,

I love your patch! Yet something to improve:

[auto build test ERROR on pci/next]
[also build test ERROR on v4.16-rc4 next-20180305]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jan-Kiszka/jailhouse-Enhance-secondary-Jailhouse-guest-support-wrt-PCI/20180306-070138
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-randconfig-x079-201809 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   arch/x86/kernel/cpu/amd.c: In function 'init_amd_gh':
>> arch/x86/kernel/cpu/amd.c:722:3: error: implicit declaration of function 'check_enable_amd_mmconf_dmi' [-Werror=implicit-function-declaration]
      check_enable_amd_mmconf_dmi();
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kernel/cpu/amd.c:724:2: error: implicit declaration of function 'fam10h_check_enable_mmcfg' [-Werror=implicit-function-declaration]
     fam10h_check_enable_mmcfg();
     ^~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/check_enable_amd_mmconf_dmi +722 arch/x86/kernel/cpu/amd.c

0d96b9ff7 Yinghai Lu      2009-08-29  716  
26bfa5f89 Borislav Petkov 2014-06-24  717  static void init_amd_gh(struct cpuinfo_x86 *c)
26bfa5f89 Borislav Petkov 2014-06-24  718  {
377b0048c Jan Kiszka      2018-03-04  719  #ifdef CONFIG_MMCONF_FAM10H
26bfa5f89 Borislav Petkov 2014-06-24  720  	/* do this for boot cpu */
26bfa5f89 Borislav Petkov 2014-06-24  721  	if (c == &boot_cpu_data)
26bfa5f89 Borislav Petkov 2014-06-24 @722  		check_enable_amd_mmconf_dmi();
26bfa5f89 Borislav Petkov 2014-06-24  723  
26bfa5f89 Borislav Petkov 2014-06-24 @724  	fam10h_check_enable_mmcfg();
26bfa5f89 Borislav Petkov 2014-06-24  725  #endif
6c62aa4a3 Yinghai Lu      2008-09-07  726  
6c62aa4a3 Yinghai Lu      2008-09-07  727  	/*
26bfa5f89 Borislav Petkov 2014-06-24  728  	 * Disable GART TLB Walk Errors on Fam10h. We do this here because this
26bfa5f89 Borislav Petkov 2014-06-24  729  	 * is always needed when GART is enabled, even in a kernel which has no
26bfa5f89 Borislav Petkov 2014-06-24  730  	 * MCE support built in. BIOS should disable GartTlbWlk Errors already.
26bfa5f89 Borislav Petkov 2014-06-24  731  	 * If it doesn't, we do it here as suggested by the BKDG.
26bfa5f89 Borislav Petkov 2014-06-24  732  	 *
26bfa5f89 Borislav Petkov 2014-06-24  733  	 * Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=33012
6c62aa4a3 Yinghai Lu      2008-09-07  734  	 */
26bfa5f89 Borislav Petkov 2014-06-24  735  	msr_set_bit(MSR_AMD64_MCx_MASK(4), 10);
6c62aa4a3 Yinghai Lu      2008-09-07  736  
26bfa5f89 Borislav Petkov 2014-06-24  737  	/*
26bfa5f89 Borislav Petkov 2014-06-24  738  	 * On family 10h BIOS may not have properly enabled WC+ support, causing
26bfa5f89 Borislav Petkov 2014-06-24  739  	 * it to be converted to CD memtype. This may result in performance
26bfa5f89 Borislav Petkov 2014-06-24  740  	 * degradation for certain nested-paging guests. Prevent this conversion
26bfa5f89 Borislav Petkov 2014-06-24  741  	 * by clearing bit 24 in MSR_AMD64_BU_CFG2.
26bfa5f89 Borislav Petkov 2014-06-24  742  	 *
26bfa5f89 Borislav Petkov 2014-06-24  743  	 * NOTE: we want to use the _safe accessors so as not to #GP kvm
26bfa5f89 Borislav Petkov 2014-06-24  744  	 * guests on older kvm hosts.
26bfa5f89 Borislav Petkov 2014-06-24  745  	 */
26bfa5f89 Borislav Petkov 2014-06-24  746  	msr_clear_bit(MSR_AMD64_BU_CFG2, 24);
11fdd252b Yinghai Lu      2008-09-07  747  
26bfa5f89 Borislav Petkov 2014-06-24  748  	if (cpu_has_amd_erratum(c, amd_erratum_383))
26bfa5f89 Borislav Petkov 2014-06-24  749  		set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
11fdd252b Yinghai Lu      2008-09-07  750  }
11fdd252b Yinghai Lu      2008-09-07  751  

:::::: The code at line 722 was first introduced by commit
:::::: 26bfa5f89486a8926cd4d4ca81a04d3f0f174934 x86, amd: Cleanup init_amd

:::::: TO: Borislav Petkov <bp@suse.de>
:::::: CC: H. Peter Anvin <hpa@linux.intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 8986a6b6e3df..08a3236cb6f2 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2643,7 +2643,7 @@  config PCI_DIRECT
 config PCI_MMCONFIG
 	bool "Support mmconfig PCI config space access" if X86_64
 	default y
-	depends on PCI && (ACPI || SFI)
+	depends on PCI && (ACPI || SFI || JAILHOUSE_GUEST)
 	depends on X86_64 || (PCI_GOANY || PCI_GOMMCONFIG)
 
 config PCI_OLPC
@@ -2659,6 +2659,10 @@  config PCI_DOMAINS
 	def_bool y
 	depends on PCI
 
+config MMCONF_FAM10H
+	def_bool y
+	depends on PCI_MMCONFIG && ACPI
+
 config PCI_CNB20LE_QUIRK
 	bool "Read CNB20LE Host Bridge Windows" if EXPERT
 	depends on PCI
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 29786c87e864..73ccf80c09a2 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -146,6 +146,6 @@  ifeq ($(CONFIG_X86_64),y)
 	obj-$(CONFIG_GART_IOMMU)	+= amd_gart_64.o aperture_64.o
 	obj-$(CONFIG_CALGARY_IOMMU)	+= pci-calgary_64.o tce_64.o
 
-	obj-$(CONFIG_PCI_MMCONFIG)	+= mmconf-fam10h_64.o
+	obj-$(CONFIG_MMCONF_FAM10H)	+= mmconf-fam10h_64.o
 	obj-y				+= vsmp_64.o
 endif
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f0e6456ca7d3..12bc0a1139da 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -716,7 +716,7 @@  static void init_amd_k8(struct cpuinfo_x86 *c)
 
 static void init_amd_gh(struct cpuinfo_x86 *c)
 {
-#ifdef CONFIG_X86_64
+#ifdef CONFIG_MMCONF_FAM10H
 	/* do this for boot cpu */
 	if (c == &boot_cpu_data)
 		check_enable_amd_mmconf_dmi();