Re: [PATCH for 6.12] LoongArch: KVM: Compile switch.S directly into the kernel

From: Greg Kroah-Hartman

Date: Fri May 15 2026 - 06:32:50 EST


On Wed, May 13, 2026 at 11:12:24AM +0800, Huacai Chen wrote:
> From: Xianglai Li <lixianglai@xxxxxxxxxxx>
>
> commit 5203012fa6045aac4b69d4e7c212e16dcf38ef10 upstream.
>
> If we directly compile the switch.S file into the kernel, the address of
> the kvm_exc_entry function will definitely be within the DMW memory area.
> Therefore, we will no longer need to perform a copy relocation of the
> kvm_exc_entry.
>
> So this patch compiles switch.S directly into the kernel, and then remove
> the copy relocation execution logic for the kvm_exc_entry function.
>
> Signed-off-by: Xianglai Li <lixianglai@xxxxxxxxxxx>
> Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
> ---
> arch/loongarch/Kbuild | 2 +-
> arch/loongarch/include/asm/asm-prototypes.h | 20 ++++++++++++
> arch/loongarch/include/asm/kvm_host.h | 3 --
> arch/loongarch/kvm/Makefile | 3 +-
> arch/loongarch/kvm/main.c | 35 ++-------------------
> arch/loongarch/kvm/switch.S | 19 ++++++++---
> 6 files changed, 40 insertions(+), 42 deletions(-)

Does not apply properly to the 6.12.y tree :(