> qemu/hw/apic.c  |   17 ++++++++++++++++-
> qemu/hw/pc.c    |   11 +++++++++++
> qemu/qemu-kvm.c |   12 +++++-------
> user/kvmctl.c   |   25 +++++++++++++++++++++++--
> user/kvmctl.h   |    5 +++--
> user/main.c     |    3 +--
> 6 files changed, 59 insertions(+), 14 deletions(-)
>
>diff --git a/qemu/hw/apic.c b/qemu/hw/apic.c
>@@ -888,10 +893,20 @@ static void ioapic_service(IOAPICState *s)
>                     vector = pic_read_irq(isa_pic);
>                 else
>                     vector = entry & 0xff;
>-
>+
>+#ifdef USE_KVM
>+              if (kvm_allowed) {

For having the option of using kvm with qemu-apic you can use the
apic_level variable below and add it to qemu's configuration params.
This will be valuable while testing your implementation.



>+                  kvm_apic_bus_deliver(kvm_context, dest, trig_mode,
>+                                       dest_mode, delivery_mode,
vector);
>+              } else {
>+#endif
>                 apic_get_delivery_bitmask(deliver_bitmask, dest,
>dest_mode);
>                 apic_bus_deliver(deliver_bitmask, delivery_mode,
>                                  vector, polarity, trig_mode);
>+#ifdef USE_KVM
>+              }
>+#endif
>+
>             }
>         }
>     }


....

>diff --git a/user/kvmctl.c b/user/kvmctl.c
>index dcdffbf..e5f3e3e 100644
>--- a/user/kvmctl.c
>+++ b/user/kvmctl.c
>@@ -233,6 +233,7 @@ int kvm_create(kvm_context_t kvm, unsigned long
memory,
>void **vm_mem)
>       int fd = kvm->fd;
>       int zfd;
>       int r;
>+      const int apic_level = 1;
>       struct kvm_memory_region low_memory = {
>               .slot = 3,
>               .memory_size = memory  < dosmem ? memory : dosmem,
>@@ -282,6 +283,12 @@ int kvm_create(kvm_context_t kvm, unsigned long
>memory, void **vm_mem)
>            MAP_PRIVATE|MAP_FIXED, zfd, 0);
>       close(zfd);
>
>+      r = ioctl(fd, KVM_ENABLE_KERNEL_PIC, &apic_level);
>+      if (r == -1) {
>+              fprintf(stderr, "kvm_enable_kernel_pic: %m\n");
>+              return -1;
>+      }
>+
>       r = ioctl(fd, KVM_CREATE_VCPU, 0);
>       if (r == -1) {
>               fprintf(stderr, "kvm_create_vcpu: %m\n");
>@@ -772,12 +779,26 @@ more:
>       return r;
> }
>
>-int kvm_inject_irq(kvm_context_t kvm, int vcpu, unsigned irq)
>+int kvm_inject_isa_irq(kvm_context_t kvm, unsigned irq)
> {
>       struct kvm_interrupt intr;
>
>       intr.irq = irq;
>-      return ioctl(kvm->vcpu_fd[vcpu], KVM_INTERRUPT, &intr);
>+      return ioctl(kvm->vm_fd, KVM_ISA_INTERRUPT, &intr);
>+}

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to