qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Liu, Jinsong" <jinsong.liu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [PATCH] apic: test tsc deadline timer
Date: Sun, 09 Oct 2011 12:24:15 +0200	[thread overview]
Message-ID: <4E91764F.4040109@redhat.com> (raw)
In-Reply-To: <BC00F5384FCFC9499AF06F92E8B78A9E265DEF322C@shsmsx502.ccr.corp.intel.com>

On 10/09/2011 12:05 PM, Liu, Jinsong wrote:
> Marcelo,
>
> I add test case for tsc deadline timer https://github.com/avikivity/kvm-unit-tests, as attached.
>
> According to the kvm-unit-tests README, I try to run
> qemu-system-x86_64 -device testdev,chardev=testlog -chardev file,id=testlog,path=apic.out -kernel ./x86/apic.flat
> but get nothing from the testlog 'apic.out'
> (BTW, at kvm side I did observe the expected tsc deadline timer action)
>
> I also try to run the README example
> qemu-system-x86_64 -device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out -kernel ./x86/msr.flat
> but still get nothing from 'msr.out'
>
> Do I miss something? how can I get test log?

This was recently changed, it now outputs to the serial port.

Try


qemu-system-x86_64 -device testdev,chardev=testlog -chardev file,id=testlog,path=apic.out -serial stdio -kernel ./x86/apic.flat


> +
> +static void start_tsc_deadline_timer(void)
> +{
> +    unsigned a, d;
> +
> +    handle_irq(TSC_DEADLINE_TIMER_VECTOR, tsc_deadline_timer_isr);
> +    irq_enable();
> +
> +    asm ("rdmsr" : "=a"(a), "=d"(d) : "c"(MSR_IA32_TSC));
> +    asm ("wrmsr" : : "a"(a), "d"(d), "c"(MSR_IA32_TSCDEADLINE));
> +    asm volatile ("nop");
> +    report("tsc deadline timer", tdt_count == 1);
> +}

Please use rdmsr()/wrmsr() from processor.h.

> +
> +static int enable_tsc_deadline_timer(void)
> +{
> +    unsigned a, b, c, d;
> +    uint32_t lvtt;
> +
> +    asm ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1));

cpuid()...

> +
> +    if (c&  (1<<  24)) {
> +        lvtt = TSC_DEADLINE_TIMER_MODE | TSC_DEADLINE_TIMER_VECTOR;
> +        apic_write(APIC_LVTT, lvtt);
> +        start_tsc_deadline_timer();
> +        return 1;
> +    } else {
> +        return 0;
> +    }
> +}
> +
> +static void test_tsc_deadline_timer(void)
> +{
> +    if(enable_tsc_deadline_timer()) {
> +        printf("tsc deadline timer enabled\n");
> +    } else {
> +        printf("tsc deadline timer not detected\n");
> +    }
> +}
> +
>   #define MSR_APIC_BASE 0x0000001b
>
>   void test_enable_x2apic(void)
> @@ -291,6 +342,8 @@ int main()
>       test_sti_nmi();
>       test_multiple_nmi();
>
> +    test_tsc_deadline_timer();
> +
>       printf("\nsummary: %d tests, %d failures\n", g_tests, g_fail);
>
>       return g_fail != 0;


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

  reply	other threads:[~2011-10-09 10:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-09 10:05 [Qemu-devel] [PATCH] apic: test tsc deadline timer Liu, Jinsong
2011-10-09 10:24 ` Avi Kivity [this message]
2011-10-09 15:14   ` Liu, Jinsong
2011-10-09 16:02     ` [Qemu-devel] [PATCH] Update README example Liu, Jinsong
2011-10-10 10:29       ` Avi Kivity
2011-10-09 15:32   ` [Qemu-devel] [PATCH] apic: test tsc deadline timer Liu, Jinsong
2011-10-10 10:30     ` Avi Kivity
2011-10-13  7:56       ` Liu, Jinsong

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=4E91764F.4040109@redhat.com \
    --to=avi@redhat.com \
    --cc=jinsong.liu@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.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).