All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] test: Add XSAVE unit test
Date: Tue, 01 Jun 2010 11:51:05 +0300	[thread overview]
Message-ID: <4C04C9F9.3080703@redhat.com> (raw)
In-Reply-To: <1275304621-29668-1-git-send-email-sheng@linux.intel.com>

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.

> +
> +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.

> +
> +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.

> +}
> +
>    


-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2010-06-01  8:51 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 [this message]
2010-06-01  9:00   ` Sheng Yang
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=4C04C9F9.3080703@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=sheng@linux.intel.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.