Re: [PATCH 1/3] x86/split_lock: Move Split and Bus lock code to a dedicated file

Borislav Petkov
2024-05-06T12:59:26Z

On Mon, Apr 29, 2024 at 11:36:41AM +0530, Ravi Bangoria wrote:
> Upcoming AMD uarch will support Bus Lock Detect, which functionally works
> identical to Intel. Move split_lock and bus_lock specific code from
> intel.c to a dedicated file so that it can be compiled and supported on
> non-intel platforms.
>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
> ---
> arch/x86/include/asm/cpu.h | 4 +
> arch/x86/kernel/cpu/Makefile | 1 +
> arch/x86/kernel/cpu/intel.c | 407 ---------------------------
> arch/x86/kernel/cpu/split-bus-lock.c | 406 ++++++++++++++++++++++++++
> 4 files changed, 411 insertions(+), 407 deletions(-)
> create mode 100644 arch/x86/kernel/cpu/split-bus-lock.c
>
> diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
> index aa30fd8cad7f..4b5c31dc8112 100644
> --- a/arch/x86/include/asm/cpu.h
> +++ b/arch/x86/include/asm/cpu.h
> @@ -51,6 +51,10 @@ static inline u8 get_this_hybrid_cpu_type(void)
> return 0;
> }
> #endif
> +
> +void split_lock_init(void);
> +void bus_lock_init(void);
> +
> #ifdef CONFIG_IA32_FEAT_CTL
> void init_ia32_feat_ctl(struct cpuinfo_x86 *c);
> #else
> diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
> index eb4dbcdf41f1..86a10472ad1d 100644
> --- a/arch/x86/kernel/cpu/Makefile
> +++ b/arch/x86/kernel/cpu/Makefile
> @@ -27,6 +27,7 @@ obj-y += aperfmperf.o
> obj-y += cpuid-deps.o
> obj-y += umwait.o
> obj-y += capflags.o powerflags.o
> +obj-y += split-bus-lock.o

Too fine-grained a name and those "-" should be "_".

Perhaps bus_lock.c only...

--
Regards/Gruss,
Boris.