From: eillon <yezhenyu2@xxxxxxxxxx> The HDBSS feature introduces new assembly registers (HDBSSBR_EL2 and HDBSSPROD_EL2), which depends on the armv9.5-a compilation support. So add ARM64_HDBSS config to control whether enable the HDBSS feature. Signed-off-by: eillon <yezhenyu2@xxxxxxxxxx> --- arch/arm64/Kconfig | 19 +++++++++++++++++++ arch/arm64/Makefile | 4 +++- arch/arm64/include/asm/cpufeature.h | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 940343beb3d4..3458261eb14b 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2237,6 +2237,25 @@ config ARM64_GCS endmenu # "v9.4 architectural features" +menu "ARMv9.5 architectural features" + +config ARM64_HDBSS + bool "Enable support for Hardware Dirty state tracking Structure (HDBSS)" + default y + depends on AS_HAS_ARMV9_5 + help + Hardware Dirty state tracking Structure(HDBSS) enhances tracking + translation table descriptors’ dirty state to reduce the cost of + surveying for dirtied granules. + + The feature introduces new assembly registers (HDBSSBR_EL2 and + HDBSSPROD_EL2), which depends on AS_HAS_ARMV9_5. + +config AS_HAS_ARMV9_5 + def_bool $(cc-option,-Wa$(comma)-march=armv9.5-a) + +endmenu # "ARMv9.5 architectural features" + config ARM64_SVE bool "ARM Scalable Vector Extension support" default y diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 2b25d671365f..f22507fb09b9 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -103,7 +103,9 @@ endif # freely generate instructions which are not supported by earlier architecture # versions, which would prevent a single kernel image from working on earlier # hardware. -ifeq ($(CONFIG_AS_HAS_ARMV8_5), y) +ifeq ($(CONFIG_AS_HAS_ARMV9_5), y) + asm-arch := armv9.5-a +else ifeq ($(CONFIG_AS_HAS_ARMV8_5), y) asm-arch := armv8.5-a else ifeq ($(CONFIG_AS_HAS_ARMV8_4), y) asm-arch := armv8.4-a diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index c76d51506562..32e432827934 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -748,6 +748,9 @@ static inline bool system_supports_hdbss(void) u64 mmfr1; u32 val; + if (!IS_ENABLED(CONFIG_ARM64_HDBSS)) + return false; + mmfr1 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR1_EL1); val = cpuid_feature_extract_unsigned_field(mmfr1, ID_AA64MMFR1_EL1_HAFDBS_SHIFT); -- 2.39.3