linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>,
	Alexander Graf <graf@amazon.com>
Subject: Re: [PATCH 3/3] KVM: x86: introduce complete_emulated_msr callback
Date: Mon, 14 Dec 2020 14:55:12 -0600	[thread overview]
Message-ID: <da346203-7465-dcc8-9ed3-7e92aa136e62@amd.com> (raw)
In-Reply-To: <20201214183250.1034541-4-pbonzini@redhat.com>

On 12/14/20 12:32 PM, Paolo Bonzini wrote:
> This will be used by SEV-ES to inject MSR failure via the GHCB.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

(Changed Sean's email on this reply, but missed the others...)

> ---
>  arch/x86/include/asm/kvm_host.h | 1 +
>  arch/x86/kvm/svm/svm.c          | 1 +
>  arch/x86/kvm/vmx/vmx.c          | 1 +
>  arch/x86/kvm/x86.c              | 8 ++++----
>  4 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 8cf6b0493d49..18aa15e6fadd 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1285,6 +1285,7 @@ struct kvm_x86_ops {
>  
>  	void (*migrate_timers)(struct kvm_vcpu *vcpu);
>  	void (*msr_filter_changed)(struct kvm_vcpu *vcpu);
> +	int (*complete_emulated_msr)(struct kvm_vcpu *vcpu, int err);
>  };
>  
>  struct kvm_x86_nested_ops {
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 801e0a641258..4067d511be08 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -4306,6 +4306,7 @@ static struct kvm_x86_ops svm_x86_ops __initdata = {
>  	.apic_init_signal_blocked = svm_apic_init_signal_blocked,
>  
>  	.msr_filter_changed = svm_msr_filter_changed,
> +	.complete_emulated_msr = kvm_complete_insn_gp,
>  };
>  
>  static struct kvm_x86_init_ops svm_init_ops __initdata = {
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 849be2a9f260..55fa51c0cd9d 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -7701,6 +7701,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = {
>  	.migrate_timers = vmx_migrate_timers,
>  
>  	.msr_filter_changed = vmx_msr_filter_changed,
> +	.complete_emulated_msr = kvm_complete_insn_gp,
>  	.cpu_dirty_log_size = vmx_cpu_dirty_log_size,
>  };
>  
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 2f1bc52e70c0..6c4482b97c91 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1642,12 +1642,12 @@ static int complete_emulated_rdmsr(struct kvm_vcpu *vcpu)
>  		kvm_rdx_write(vcpu, vcpu->run->msr.data >> 32);
>  	}
>  
> -	return kvm_complete_insn_gp(vcpu, err);
> +	return kvm_x86_ops.complete_emulated_msr(vcpu, err);
>  }
>  
>  static int complete_emulated_wrmsr(struct kvm_vcpu *vcpu)
>  {
> -	return kvm_complete_insn_gp(vcpu, vcpu->run->msr.error);
> +	return kvm_x86_ops.complete_emulated_msr(vcpu, vcpu->run->msr.error);
>  }
>  
>  static u64 kvm_msr_reason(int r)
> @@ -1720,7 +1720,7 @@ int kvm_emulate_rdmsr(struct kvm_vcpu *vcpu)
>  		trace_kvm_msr_read_ex(ecx);
>  	}
>  
> -	return kvm_complete_insn_gp(vcpu, r);
> +	return kvm_x86_ops.complete_emulated_msr(vcpu, r);
>  }
>  EXPORT_SYMBOL_GPL(kvm_emulate_rdmsr);
>  
> @@ -1747,7 +1747,7 @@ int kvm_emulate_wrmsr(struct kvm_vcpu *vcpu)
>  	else
>  		trace_kvm_msr_write_ex(ecx, data);
>  
> -	return kvm_complete_insn_gp(vcpu, r);
> +	return kvm_x86_ops.complete_emulated_msr(vcpu, r);
>  }
>  EXPORT_SYMBOL_GPL(kvm_emulate_wrmsr);
>  
> 

  reply	other threads:[~2020-12-14 20:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 18:32 [PATCH 0/3] KVM: x86: MSR completion refactoring for SEV-ES Paolo Bonzini
2020-12-14 18:32 ` [PATCH 1/3] KVM: x86: remove bogus #GP injection Paolo Bonzini
2020-12-14 20:50   ` Tom Lendacky
2020-12-14 18:32 ` [PATCH 2/3] KVM: x86: use kvm_complete_insn_gp in emulating RDMSR/WRMSR Paolo Bonzini
2020-12-14 20:52   ` Tom Lendacky
2020-12-14 18:32 ` [PATCH 3/3] KVM: x86: introduce complete_emulated_msr callback Paolo Bonzini
2020-12-14 20:55   ` Tom Lendacky [this message]
2020-12-15 10:23     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=da346203-7465-dcc8-9ed3-7e92aa136e62@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=graf@amazon.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).