From: Avi Kivity <avi@redhat.com>
To: Joerg Roedel <joerg.roedel@amd.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 1/7] svm: Add test for selective cr0 intercept
Date: Sun, 12 Sep 2010 11:06:34 +0200 [thread overview]
Message-ID: <4C8C981A.9070303@redhat.com> (raw)
In-Reply-To: <1284132850-19302-2-git-send-email-joerg.roedel@amd.com>
On 09/10/2010 06:34 PM, Joerg Roedel wrote:
> This patch adds a test to check if the selective cr0
> intercept emulation of the kvm svm emulation works.
>
> Signed-off-by: Joerg Roedel<joerg.roedel@amd.com>
> ---
> x86/svm.c | 37 ++++++++++++++++++++++++++++++++++++-
> 1 files changed, 36 insertions(+), 1 deletions(-)
>
> diff --git a/x86/svm.c b/x86/svm.c
> index 2f1c900..e65360e 100644
> --- a/x86/svm.c
> +++ b/x86/svm.c
> @@ -357,6 +357,40 @@ static bool check_asid_zero(struct test *test)
> return test->vmcb->control.exit_code == SVM_EXIT_ERR;
> }
>
> +static void sel_cr0_prepare(struct test *test)
> +{
> + vmcb_ident(test->vmcb);
> + test->vmcb->control.intercept |= (1ULL<< INTERCEPT_SELECTIVE_CR0);
> +}
> +
> +static bool sel_cr0_finished(struct test *test)
> +{
> + return true;
> +}
Coding style - kvm-unit-tests uses the qemu style. Please drop the tabs
from new code.
> +
> +static void sel_cr0_test(struct test *test)
> +{
> + unsigned long cr0;
> +
> + /* read cr0, clear CD, and write back */
set CD. Better to ^= it to be sure to trigger.
> + cr0 = read_cr0();
> + cr0 |= (1UL<< 30);
> + write_cr0(cr0);
How about a test that ^= TS to see that we don't intercept unnecessarily?
> +
> + /*
> + * If we are here the test failed, not sure what to do now because we
> + * are not in guest-mode anymore so we can't trigger an intercept.
> + * Trigger a tripple-fault for now.
> + */
> + printf("sel_cr0 test failed. Can not recover from this - exiting\n");
> + exit(1);
Don't understand - we're still in guest mode (only running very
slowly...). All you have to do is fall off the end here, and you'll
exit with VMMCALL.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2010-09-12 9:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-10 15:34 [PATCH 0/7] New Unit-Tests for KVM SVM emulation Joerg Roedel
2010-09-10 15:34 ` [PATCH 1/7] svm: Add test for selective cr0 intercept Joerg Roedel
2010-09-12 9:06 ` Avi Kivity [this message]
2010-09-12 9:36 ` Joerg Roedel
2010-09-12 14:42 ` Avi Kivity
2010-09-10 15:34 ` [PATCH 2/7] svm: Run tests with NPT enabled if available Joerg Roedel
2010-09-12 9:10 ` Avi Kivity
2010-09-12 14:39 ` Joerg Roedel
2010-09-10 15:34 ` [PATCH 3/7] svm: Add test for NX bit check in emulated NPT Joerg Roedel
2010-09-10 15:34 ` [PATCH 4/7] svm: Add test for US " Joerg Roedel
2010-09-10 15:34 ` [PATCH 5/7] svm: Add test for RSVD " Joerg Roedel
2010-09-10 15:34 ` [PATCH 6/7] svm: Add test for RW " Joerg Roedel
2010-09-10 15:34 ` [PATCH 7/7] svm: Add test for the NPT page table walker Joerg Roedel
-- strict thread matches above, loose matches on Subject: below --
2010-09-14 15:59 [PATCH 0/7] New Unit-Tests for KVM SVM emulation v2 Joerg Roedel
2010-09-14 15:59 ` [PATCH 1/7] svm: Add test for selective cr0 intercept Joerg Roedel
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=4C8C981A.9070303@redhat.com \
--to=avi@redhat.com \
--cc=joerg.roedel@amd.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.