Yang, Sheng wrote:
> From 40cf60009d1031891a34685b690dad47290a0b04 Mon Sep 17 00:00:00 2001
> From: Sheng Yang <[EMAIL PROTECTED]>
> 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/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to