Skip to content

Commit

Permalink
Merge tag 'kvmarm-fixes-6.15-2' of https://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/kvmarm/kvmarm into HEAD

KVM/arm64 fixes for 6.15, round #2

 - Single fix for broken usage of 'multi-MIDR' infrastructure in PI
   code, adding an open-coded erratum check for everyone's favorite pile
   of sand: Cavium ThunderX
  • Loading branch information
Paolo Bonzini committed Apr 24, 2025
2 parents 38e9326 + 117c3b2 commit 2d71249
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
11 changes: 0 additions & 11 deletions arch/arm64/include/asm/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,6 @@ static inline bool kaslr_requires_kpti(void)
return false;
}

/*
* Systems affected by Cavium erratum 24756 are incompatible
* with KPTI.
*/
if (IS_ENABLED(CONFIG_CAVIUM_ERRATUM_27456)) {
extern const struct midr_range cavium_erratum_27456_cpus[];

if (is_midr_in_range_list(cavium_erratum_27456_cpus))
return false;
}

return true;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/cpu_errata.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ static const struct midr_range cavium_erratum_23154_cpus[] = {
#endif

#ifdef CONFIG_CAVIUM_ERRATUM_27456
const struct midr_range cavium_erratum_27456_cpus[] = {
static const struct midr_range cavium_erratum_27456_cpus[] = {
/* Cavium ThunderX, T88 pass 1.x - 2.1 */
MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 1),
/* Cavium ThunderX, T81 pass 1.0 */
Expand Down
4 changes: 0 additions & 4 deletions arch/arm64/kernel/image-vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ PROVIDE(__pi_id_aa64smfr0_override = id_aa64smfr0_override);
PROVIDE(__pi_id_aa64zfr0_override = id_aa64zfr0_override);
PROVIDE(__pi_arm64_sw_feature_override = arm64_sw_feature_override);
PROVIDE(__pi_arm64_use_ng_mappings = arm64_use_ng_mappings);
#ifdef CONFIG_CAVIUM_ERRATUM_27456
PROVIDE(__pi_cavium_erratum_27456_cpus = cavium_erratum_27456_cpus);
PROVIDE(__pi_is_midr_in_range_list = is_midr_in_range_list);
#endif
PROVIDE(__pi__ctype = _ctype);
PROVIDE(__pi_memstart_offset_seed = memstart_offset_seed);

Expand Down
25 changes: 24 additions & 1 deletion arch/arm64/kernel/pi/map_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,29 @@ static void __init map_fdt(u64 fdt)
dsb(ishst);
}

/*
* PI version of the Cavium Eratum 27456 detection, which makes it
* impossible to use non-global mappings.
*/
static bool __init ng_mappings_allowed(void)
{
static const struct midr_range cavium_erratum_27456_cpus[] __initconst = {
/* Cavium ThunderX, T88 pass 1.x - 2.1 */
MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 1),
/* Cavium ThunderX, T81 pass 1.0 */
MIDR_REV(MIDR_THUNDERX_81XX, 0, 0),
{},
};

for (const struct midr_range *r = cavium_erratum_27456_cpus; r->model; r++) {
if (midr_is_cpu_model_range(read_cpuid_id(), r->model,
r->rv_min, r->rv_max))
return false;
}

return true;
}

asmlinkage void __init early_map_kernel(u64 boot_status, void *fdt)
{
static char const chosen_str[] __initconst = "/chosen";
Expand Down Expand Up @@ -246,7 +269,7 @@ asmlinkage void __init early_map_kernel(u64 boot_status, void *fdt)
u64 kaslr_seed = kaslr_early_init(fdt, chosen);

if (kaslr_seed && kaslr_requires_kpti())
arm64_use_ng_mappings = true;
arm64_use_ng_mappings = ng_mappings_allowed();

kaslr_offset |= kaslr_seed & ~(MIN_KIMG_ALIGN - 1);
}
Expand Down

0 comments on commit 2d71249

Please sign in to comment.