On Mon, Nov 07, 2022, Paolo Bonzini wrote: > diff --git a/arch/x86/kvm/svm/vmenter.S b/arch/x86/kvm/svm/vmenter.S > index 723f8534986c..8fac744361e5 100644 > --- a/arch/x86/kvm/svm/vmenter.S > +++ b/arch/x86/kvm/svm/vmenter.S Needs to include asm/asm-offsets.h, otherwise the compiler may think that SVM_vcpu_arch_regs is a symbol. ERROR: modpost: "SVM_vcpu_arch_regs" [arch/x86/kvm/kvm-amd.ko] undefined! diff --git a/arch/x86/kvm/svm/vmenter.S b/arch/x86/kvm/svm/vmenter.S index 8fac744361e5..8d0b0781462e 100644 --- a/arch/x86/kvm/svm/vmenter.S +++ b/arch/x86/kvm/svm/vmenter.S @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ #include <linux/linkage.h> #include <asm/asm.h> +#include <asm/asm-offsets.h> #include <asm/bitsperlong.h> #include <asm/kvm_vcpu_regs.h> #include <asm/nospec-branch.h> > @@ -8,23 +8,23 @@ > #define WORD_SIZE (BITS_PER_LONG / 8) > > /* Intentionally omit RAX as it's context switched by hardware */ > -#define VCPU_RCX __VCPU_REGS_RCX * WORD_SIZE > -#define VCPU_RDX __VCPU_REGS_RDX * WORD_SIZE > -#define VCPU_RBX __VCPU_REGS_RBX * WORD_SIZE > +#define VCPU_RCX (SVM_vcpu_arch_regs + __VCPU_REGS_RCX * WORD_SIZE) > +#define VCPU_RDX (SVM_vcpu_arch_regs + __VCPU_REGS_RDX * WORD_SIZE) > +#define VCPU_RBX (SVM_vcpu_arch_regs + __VCPU_REGS_RBX * WORD_SIZE) > /* Intentionally omit RSP as it's context switched by hardware */ > -#define VCPU_RBP __VCPU_REGS_RBP * WORD_SIZE > -#define VCPU_RSI __VCPU_REGS_RSI * WORD_SIZE > -#define VCPU_RDI __VCPU_REGS_RDI * WORD_SIZE > +#define VCPU_RBP (SVM_vcpu_arch_regs + __VCPU_REGS_RBP * WORD_SIZE) > +#define VCPU_RSI (SVM_vcpu_arch_regs + __VCPU_REGS_RSI * WORD_SIZE) > +#define VCPU_RDI (SVM_vcpu_arch_regs + __VCPU_REGS_RDI * WORD_SIZE) > > #ifdef CONFIG_X86_64 > -#define VCPU_R8 __VCPU_REGS_R8 * WORD_SIZE > -#define VCPU_R9 __VCPU_REGS_R9 * WORD_SIZE > -#define VCPU_R10 __VCPU_REGS_R10 * WORD_SIZE > -#define VCPU_R11 __VCPU_REGS_R11 * WORD_SIZE > -#define VCPU_R12 __VCPU_REGS_R12 * WORD_SIZE > -#define VCPU_R13 __VCPU_REGS_R13 * WORD_SIZE > -#define VCPU_R14 __VCPU_REGS_R14 * WORD_SIZE > -#define VCPU_R15 __VCPU_REGS_R15 * WORD_SIZE > +#define VCPU_R8 (SVM_vcpu_arch_regs + __VCPU_REGS_R8 * WORD_SIZE) > +#define VCPU_R9 (SVM_vcpu_arch_regs + __VCPU_REGS_R9 * WORD_SIZE) > +#define VCPU_R10 (SVM_vcpu_arch_regs + __VCPU_REGS_R10 * WORD_SIZE) > +#define VCPU_R11 (SVM_vcpu_arch_regs + __VCPU_REGS_R11 * WORD_SIZE) > +#define VCPU_R12 (SVM_vcpu_arch_regs + __VCPU_REGS_R12 * WORD_SIZE) > +#define VCPU_R13 (SVM_vcpu_arch_regs + __VCPU_REGS_R13 * WORD_SIZE) > +#define VCPU_R14 (SVM_vcpu_arch_regs + __VCPU_REGS_R14 * WORD_SIZE) > +#define VCPU_R15 (SVM_vcpu_arch_regs + __VCPU_REGS_R15 * WORD_SIZE) > #endif