[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878cae8c-4da1-ca80-7215-24cdcb80474a@amd.com>
Date: Tue, 6 Aug 2024 08:49:40 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Ravi Bangoria <ravi.bangoria@....com>, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
seanjc@...gle.com, pbonzini@...hat.com, jmattson@...gle.com
Cc: hpa@...or.com, rmk+kernel@...linux.org.uk, peterz@...radead.org,
james.morse@....com, lukas.bulwahn@...il.com, arjan@...ux.intel.com,
j.granados@...sung.com, sibs@...natelecom.cn, nik.borisov@...e.com,
michael.roth@....com, nikunj.dadhania@....com, babu.moger@....com,
x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
santosh.shukla@....com, ananth.narayan@....com, sandipan.das@....com,
manali.shukla@....com
Subject: Re: [PATCH v3 1/4] x86/split_lock: Move Split and Bus lock code to a
dedicated file
On 8/6/24 07:54, Ravi Bangoria wrote:
> Bus Lock Detect functionality on AMD platforms 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@....com>
> ---
> arch/x86/include/asm/cpu.h | 4 +
> arch/x86/kernel/cpu/Makefile | 1 +
> arch/x86/kernel/cpu/bus_lock.c | 410 +++++++++++++++++++++++++++++++++
> arch/x86/kernel/cpu/intel.c | 406 --------------------------------
> 4 files changed, 415 insertions(+), 406 deletions(-)
> create mode 100644 arch/x86/kernel/cpu/bus_lock.c
>
> diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
> index aa30fd8cad7f..051d872d2faf 100644
> --- a/arch/x86/include/asm/cpu.h
> +++ b/arch/x86/include/asm/cpu.h
> @@ -31,6 +31,8 @@ extern void __init sld_setup(struct cpuinfo_x86 *c);
> extern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
> extern bool handle_guest_split_lock(unsigned long ip);
> extern void handle_bus_lock(struct pt_regs *regs);
> +void split_lock_init(void);
> +void bus_lock_init(void);
> u8 get_this_hybrid_cpu_type(void);
> #else
> static inline void __init sld_setup(struct cpuinfo_x86 *c) {}
> @@ -45,6 +47,8 @@ static inline bool handle_guest_split_lock(unsigned long ip)
> }
>
> static inline void handle_bus_lock(struct pt_regs *regs) {}
> +static inline void split_lock_init(void) {}
> +static inline void bus_lock_init(void) {}
>
> static inline u8 get_this_hybrid_cpu_type(void)
> {
> diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
> index 5857a0f5d514..9f74e0011f01 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 += bus_lock.o
Since the whole file is protected by a "#if defined", why not just use
that here and conditionally build it?
You could also create a Kconfig that is set when CPU_SUP_INTEL is
selected and, later when CPU_SUP_AMD is selected, and use that
(CONFIG_X86_BUS_LOCK or such).
Either way:
Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
>
> obj-$(CONFIG_X86_LOCAL_APIC) += topology.o
>
Powered by blists - more mailing lists