arch/x86/Kconfig: introduce RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT
Since also some AMD CPUs have reserved physical address bits that can't
be used as normal address bits, introduce the
RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT Kconfig option which gets
selected by CPU_INTEL_COMMON, and use the new common option to configure
if the specific SoC/CPU code implements get_reserved_phys_addr_bits or
if the default of this returning 0 is used instead.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I0059e63a160e60ddee280635bba72d363deca7f7
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78073
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 8676fad..c97fecb 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -92,6 +92,16 @@
The position where to place pagetables. Needs to be known at
compile time. Must not overlap other files in CBFS.
+config RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT
+ bool
+ help
+ On some systems, the upper physical address bits are reserved and
+ used as a tag which is typically related to a memory encryption
+ feature. When selecting this option, the SoC code needs to implement
+ get_reserved_phys_addr_bits so that the common code knows how many of
+ the most significant physical address bits are reserved and can't be
+ used as address bits.
+
# This is an SMP option. It relates to starting up APs.
# It is usually set in mainboard/*/Kconfig.
# TODO: Improve description.
diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h
index b24cd23..2c98d1e 100644
--- a/src/arch/x86/include/arch/cpu.h
+++ b/src/arch/x86/include/arch/cpu.h
@@ -316,7 +316,7 @@
*/
bool fill_cpu_cache_info(uint8_t level, struct cpu_cache_info *info);
-#if CONFIG(CPU_INTEL_COMMON)
+#if CONFIG(RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT)
unsigned int get_reserved_phys_addr_bits(void);
#else
/* Default implementation */
diff --git a/src/cpu/intel/common/Kconfig b/src/cpu/intel/common/Kconfig
index 7f9033c..51b8ccb 100644
--- a/src/cpu/intel/common/Kconfig
+++ b/src/cpu/intel/common/Kconfig
@@ -1,5 +1,6 @@
config CPU_INTEL_COMMON
bool
+ select RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT
if CPU_INTEL_COMMON