diff mbox series

[1/3] KVM: SVM: Force sev_es_host_save_area() to be inlined (for noinstr usage)

Message ID 20240617210432.1642542-2-seanjc@google.com (mailing list archive)
State New, archived
Headers show
Series KVM: SVM: SEV-ES save area fix+cleanups | expand

Commit Message

Sean Christopherson June 17, 2024, 9:04 p.m. UTC
Force sev_es_host_save_area() to be always inlined, as it's used in the
low level VM-Enter/VM-Exit path, which is non-instrumentable.

  vmlinux.o: warning: objtool: svm_vcpu_enter_exit+0xb0: call to
    sev_es_host_save_area() leaves .noinstr.text section
  vmlinux.o: warning: objtool: svm_vcpu_enter_exit+0xbf: call to
    sev_es_host_save_area.isra.0() leaves .noinstr.text section

Fixes: c92be2fd8edf ("KVM: SVM: Save/restore non-volatile GPRs in SEV-ES VMRUN via host save area")
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/svm/svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Borislav Petkov June 18, 2024, 10:17 a.m. UTC | #1
On Mon, Jun 17, 2024 at 02:04:30PM -0700, Sean Christopherson wrote:
> Force sev_es_host_save_area() to be always inlined, as it's used in the
> low level VM-Enter/VM-Exit path, which is non-instrumentable.
> 
>   vmlinux.o: warning: objtool: svm_vcpu_enter_exit+0xb0: call to
>     sev_es_host_save_area() leaves .noinstr.text section
>   vmlinux.o: warning: objtool: svm_vcpu_enter_exit+0xbf: call to
>     sev_es_host_save_area.isra.0() leaves .noinstr.text section
> 
> Fixes: c92be2fd8edf ("KVM: SVM: Save/restore non-volatile GPRs in SEV-ES VMRUN via host save area")
> Reported-by: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>  arch/x86/kvm/svm/svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 9ac6fca50cf3..0a36c82b316f 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -1504,7 +1504,7 @@ static void svm_vcpu_free(struct kvm_vcpu *vcpu)
>  	__free_pages(virt_to_page(svm->msrpm), get_order(MSRPM_SIZE));
>  }
>  
> -static struct sev_es_save_area *sev_es_host_save_area(struct svm_cpu_data *sd)
> +static __always_inline struct sev_es_save_area *sev_es_host_save_area(struct svm_cpu_data *sd)
>  {
>  	return page_address(sd->save_area) + 0x400;
>  }
> -- 

Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
diff mbox series

Patch

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 9ac6fca50cf3..0a36c82b316f 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -1504,7 +1504,7 @@  static void svm_vcpu_free(struct kvm_vcpu *vcpu)
 	__free_pages(virt_to_page(svm->msrpm), get_order(MSRPM_SIZE));
 }
 
-static struct sev_es_save_area *sev_es_host_save_area(struct svm_cpu_data *sd)
+static __always_inline struct sev_es_save_area *sev_es_host_save_area(struct svm_cpu_data *sd)
 {
 	return page_address(sd->save_area) + 0x400;
 }