diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index 9b390f1b5920d9fc88c84bb18813777e4d41f433..5403eb3adde8d28416772d0ae0b97be6fd52f19f 100644 --- a/arch/arm64/include/asm/cputype.h +++ b/arch/arm64/include/asm/cputype.h @@ -100,6 +100,7 @@ #define PHYTIUM_CPU_PART_2000PLUS 0x662 #define PHYTIUM_CPU_PART_2004 0x663 #define PHYTIUM_CPU_PART_2500 0x663 +#define PHYTIUM_CPU_PART_FTC862 0x862 #define CAVIUM_CPU_PART_THUNDERX 0x0A1 #define CAVIUM_CPU_PART_THUNDERX_81XX 0x0A2 @@ -153,6 +154,7 @@ #define MIDR_FT_2004 MIDR_CPU_MODEL(ARM_CPU_IMP_PHYTIUM, PHYTIUM_CPU_PART_2004) #define MIDR_FT_2500 MIDR_CPU_MODEL(ARM_CPU_IMP_PHYTIUM, PHYTIUM_CPU_PART_2500) #define MIDR_AMPERE1 MIDR_CPU_MODEL(ARM_CPU_IMP_AMPERE, AMPERE_CPU_PART_AMPERE1) +#define MIDR_PHYTIUM_FTC862 MIDR_CPU_MODEL(ARM_CPU_IMP_PHYTIUM, PHYTIUM_CPU_PART_FTC862) #ifndef __ASSEMBLY__ diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index e8f3ff4c8658b6d38ba2ae403eaa8f5720a7d455..09f06599a518eabb910291052242db3ef37984d6 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -459,6 +459,19 @@ static void __init fdt_enforce_memory_region(void) memblock_cap_memory_ranges(usablemem.regions, usablemem.cnt); } +#ifdef CONFIG_ARCH_PHYTIUM +#define SOCID_PS23064 0x8 +#define RMV_PS23064 0x510783f00000 +static inline void phytium_ps23064_quirk(void) +{ + if (read_sysreg_s(SYS_AIDR_EL1) == SOCID_PS23064 && + read_cpuid_id() == MIDR_PHYTIUM_FTC862) { + pr_warn("Enable Phytium S5000C-128 Core quirk\n"); + memblock_remove(RMV_PS23064, (1ULL << PHYS_MASK_SHIFT) - RMV_PS23064); + } +} +#endif + void __init arm64_memblock_init(void) { const s64 linear_region_size = -(s64)PAGE_OFFSET; @@ -468,7 +481,10 @@ void __init arm64_memblock_init(void) /* Remove memory above our supported physical address size */ memblock_remove(1ULL << PHYS_MASK_SHIFT, ULLONG_MAX); - +#ifdef CONFIG_ARCH_PHYTIUM + if (IS_ENABLED(CONFIG_KASAN)) + phytium_ps23064_quirk(); +#endif /* * Ensure that the linear region takes up exactly half of the kernel * virtual address space. This way, we can distinguish a linear address