public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Uri Lublin <uril@qumranet.com>
To: "Yang, Sheng" <sheng.yang@intel.com>
Cc: kvm-devel@lists.sourceforge.net
Subject: Re: [PATCH 3/6] kvm: qemu: Add option for enable/disable in	kernel PIT
Date: Tue, 04 Mar 2008 15:23:46 +0200	[thread overview]
Message-ID: <47CD4D62.9050206@qumranet.com> (raw)
In-Reply-To: <200803041822.52573.sheng.yang@intel.com>


Yang, Sheng wrote:
> From 40cf60009d1031891a34685b690dad47290a0b04 Mon Sep 17 00:00:00 2001
> From: Sheng Yang <sheng.yang@intel.com>
> Date: Tue, 4 Mar 2008 09:29:55 +0800
> Subject: [PATCH] kvm: qemu: Add option for enable/disable in kernel PIT
>
> diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
> index b3a241e..22a6283 100644
> --- a/libkvm/libkvm-x86.c
> +++ b/libkvm/libkvm-x86.c
> @@ -630,3 +630,10 @@ int kvm_disable_tpr_access_reporting(kvm_context_t kvm, 
> int vcpu)
>  }
>
>  #endif
> +
> +int kvm_pit_in_kernel(kvm_context_t kvm)
> +{
> +#ifdef KVM_CAP_PIT
> +	return kvm->pit_in_kernel;
>   
#else
                  return 0;
> +#endif
>   
> +}
> diff --git a/qemu/hw/i8254.c b/qemu/hw/i8254.c
> index c281680..0753ca9 100644
> --- a/qemu/hw/i8254.c
> +++ b/qemu/hw/i8254.c
> @@ -26,6 +26,8 @@
>  #include "isa.h"
>  #include "qemu-timer.h"
>
> +#include "qemu-kvm.h"
> +
>  //#define DEBUG_PIT
>
>  #define RW_STATE_LSB 1
> @@ -492,9 +494,13 @@ PITState *pit_init(int base, qemu_irq irq)
>      PITChannelState *s;
>
>      s = &pit->channels[0];
> -    /* the timer 0 is connected to an IRQ */
> -    s->irq_timer = qemu_new_timer(vm_clock, pit_irq_timer, s);
> -    s->irq = irq;
> +#ifdef KVM_CAP_PIT
>   
I  think you should remove the ifdef such that the if-statement is 
executed even if KVM_CAP_PIT
is not defined (in which case qemu pit emulation should be used).

> +    if (!kvm_enabled() || !qemu_kvm_pit_in_kernel()) {
> +	    /* the timer 0 is connected to an IRQ */
> +	    s->irq_timer = qemu_new_timer(vm_clock, pit_irq_timer, s);
> +	    s->irq = irq;
> +    }
> +#endif
>
>      register_savevm("i8254", base, 1, pit_save, pit_load, pit);
>
> diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
> index 1122b87..4587a5c 100644
> --- a/qemu/hw/pc.c
> +++ b/qemu/hw/pc.c
> @@ -984,7 +984,13 @@ static void pc_init1(ram_addr_t ram_size, int 
> vga_ram_size,
>          ioapic = ioapic_init();
>      }
>      pit = pit_init(0x40, i8259[0]);
> +#ifdef KVM_CAP_PIT
>   
and here
> +    if (!kvm_enabled() || !qemu_kvm_pit_in_kernel()) {
> +#endif
>      pcspk_init(pit);
> +#ifdef KVM_CAP_PIT
> +    }
> +#endif
>      if (pci_enabled) {
>          pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic);
>      }
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

  reply	other threads:[~2008-03-04 13:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-04 10:22 [PATCH 3/6] kvm: qemu: Add option for enable/disable in kernel PIT Yang, Sheng
2008-03-04 13:23 ` Uri Lublin [this message]
2008-03-05  2:20   ` Yang, Sheng
2008-03-06  8:46     ` Yang, Sheng
  -- strict thread matches above, loose matches on Subject: below --
2008-03-07 12:52 Yang, Sheng
2008-03-11 18:25 ` Hollis Blanchard

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=47CD4D62.9050206@qumranet.com \
    --to=uril@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=sheng.yang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox