From: Sheng Yang <sheng@linux.intel.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] test: Add XSAVE unit test
Date: Tue, 1 Jun 2010 17:00:35 +0800 [thread overview]
Message-ID: <201006011700.36129.sheng@linux.intel.com> (raw)
In-Reply-To: <4C04C9F9.3080703@redhat.com>
On Tuesday 01 June 2010 16:51:05 Avi Kivity wrote:
> On 05/31/2010 02:17 PM, Sheng Yang wrote:
> > Only test legal action so far, we can extend it later.
>
> The legal actions are tested by guests, so it's more important for unit
> tests to check illegal (and potentially subversive) actions.
Yes. This is just the first step. I think we need construct IDT and use something
similar to fixup exception table. That's not a quick work, and we need some base
for it.
>
> > +
> > +void test_xsave()
> > +{
> > + unsigned int cr4;
> > + uint64_t supported_xcr0;
> > + uint64_t test_bits;
> > +
> > + supported_xcr0 = get_supported_xcr0();
> > + printf("Supported XCR0 bits: 0x%x\n", supported_xcr0);
> > +
> > + printf("Check minimal XSAVE required bits: ");
> > + test_bits = XSTATE_FP | XSTATE_SSE | XSTATE_YMM;
> > + pass_if((supported_xcr0& test_bits) == test_bits);
>
> This will fail on a cpu without YMM but with xsave.
Yes, would discard this...
>
> > +
> > +int main()
> > +{
> > + int cpuid_has_xsave;
> > +
> > + cpuid_has_xsave = check_xsave();
> > + if (cpuid_has_xsave) {
> > + printf("CPU has XSAVE feature\n");
> > + test_xsave();
> > + } else
> > + printf("CPU don't has XSAVE feature\n");
> > + return 0;
>
> Should return 1 if any failure for autotest integration.
OK
>
> > +}
> > +
--
regards
Yang, Sheng
next prev parent reply other threads:[~2010-06-01 9:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-31 11:17 [PATCH] test: Add XSAVE unit test Sheng Yang
2010-06-01 8:51 ` Avi Kivity
2010-06-01 9:00 ` Sheng Yang [this message]
2010-06-01 9:08 ` Avi Kivity
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=201006011700.36129.sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=avi@redhat.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 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).