Unverified Commit 4eaaa65e authored by Clément Léger's avatar Clément Léger Committed by Palmer Dabbelt
Browse files

riscv: misaligned: move emulated access uniformity check in a function



Split the code that check for the uniformity of misaligned accesses
performance on all cpus from check_unaligned_access_emulated_all_cpus()
to its own function which will be used for delegation check. No
functional changes intended.

Signed-off-by: default avatarClément Léger <cleger@rivosinc.com>
Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
Reviewed-by: default avatarCharlie Jenkins <charlie@rivosinc.com>
Tested-by: default avatarCharlie Jenkins <charlie@rivosinc.com>
Link: https://lore.kernel.org/r/20250523101932.1594077-10-cleger@rivosinc.com


Signed-off-by: default avatarPalmer Dabbelt <palmer@dabbelt.com>
parent 1317045a
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -645,6 +645,18 @@ bool __init check_vector_unaligned_access_emulated_all_cpus(void)
}
#endif

static bool all_cpus_unaligned_scalar_access_emulated(void)
{
	int cpu;

	for_each_online_cpu(cpu)
		if (per_cpu(misaligned_access_speed, cpu) !=
		    RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED)
			return false;

	return true;
}

#ifdef CONFIG_RISCV_SCALAR_MISALIGNED

static bool unaligned_ctl __read_mostly;
@@ -683,8 +695,6 @@ static int cpu_online_check_unaligned_access_emulated(unsigned int cpu)

bool __init check_unaligned_access_emulated_all_cpus(void)
{
	int cpu;

	/*
	 * We can only support PR_UNALIGN controls if all CPUs have misaligned
	 * accesses emulated since tasks requesting such control can run on any
@@ -692,9 +702,7 @@ bool __init check_unaligned_access_emulated_all_cpus(void)
	 */
	on_each_cpu(check_unaligned_access_emulated, NULL, 1);

	for_each_online_cpu(cpu)
		if (per_cpu(misaligned_access_speed, cpu)
		    != RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED)
	if (!all_cpus_unaligned_scalar_access_emulated())
		return false;

	unaligned_ctl = true;