From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Brian Woods <brian.woods@amd.com>, xen-devel@lists.xen.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH 1/2] x86/svm: Add SVME checking for SVM intercepts
Date: Thu, 21 Dec 2017 23:52:27 -0500 [thread overview]
Message-ID: <1bd6230f-de6a-894e-883a-aa734ff8d3e2@oracle.com> (raw)
In-Reply-To: <20171221152619.38079-2-brian.woods@amd.com>
On 12/21/2017 10:26 AM, Brian Woods wrote:
> Checks the hvm EFER.SVME bit to make sure the EFER.SVME bit it high
s/it/is
> before allowing nested SVM intercepts to be handled successfully. On
> SVME being low, it generates a #UD as per the AMD APM vol2 15.4.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Brian Woods <brian.woods@amd.com>
> ---
> xen/arch/x86/hvm/svm/svm.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
> index 2e62b9bb6d..2d0a82ae77 100644
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -2587,6 +2587,35 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
> eventinj.fields.vector) )
> vmcb->eventinj = eventinj;
>
> + /*
> + * Making sure SVME is enabled see AMD APM vol2 section 15.4
> + * Nested Xen needs VMMCALL to boot. It hasn't set SVME by the time
> + * it uses it, therefore it isn't checked
> + */
> + switch ( exit_reason )
> + {
> + case VMEXIT_VMRUN:
> + case VMEXIT_VMLOAD:
> + case VMEXIT_VMSAVE:
> + case VMEXIT_CLGI:
> + case VMEXIT_INVLPGA:
> + if ( !(nestedhvm_enabled(v->domain) &&
> + nsvm_efer_svm_enabled(v)) )
I haven't checked all of them but at least for the first two
(svm_vmexit_do_vmrun() and smv_vmexit_do_vmload()) we check EFER and
print a similar error message. So it seems they can be handled in the
switch statement below.
-boris
> + {
> + gdprintk(XENLOG_ERR, "nestedhvm nested/SVME disabled, injecting #UD\n");
> + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC);
> + goto out;
> + }
> + case VMEXIT_STGI:
> + case VMEXIT_SKINIT:
> + if ( !nestedhvm_enabled(v->domain) )
> + {
> + gdprintk(XENLOG_ERR, "nestedhvm nested disabled, injecting #UD\n");
> + hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC);
> + goto out;
> + }
> + }
> +
> switch ( exit_reason )
> {
> case VMEXIT_INTR:
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2017-12-22 4:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 15:26 [PATCH 0/2] Various SVM Patches Brian Woods
2017-12-21 15:26 ` [PATCH 1/2] x86/svm: Add SVME checking for SVM intercepts Brian Woods
2017-12-22 4:52 ` Boris Ostrovsky [this message]
2017-12-22 15:07 ` Brian Woods
2017-12-21 15:26 ` [PATCH 2/2] x86/svm: Add checks for nested HW features Brian Woods
2017-12-22 4:55 ` Boris Ostrovsky
2017-12-22 15:15 ` Andrew Cooper
2018-01-05 15:27 ` Brian Woods
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=1bd6230f-de6a-894e-883a-aa734ff8d3e2@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=andrew.cooper3@citrix.com \
--cc=brian.woods@amd.com \
--cc=jbeulich@suse.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=xen-devel@lists.xen.org \
/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).