* Re: [Qemu-devel] [PATCH 3/3] Add KVM support to QEMU [not found] ` <1225224814-9875-3-git-send-email-aliguori@us.ibm.com> @ 2008-10-28 20:49 ` Hollis Blanchard [not found] ` <fb412d760810281349q2572acf0j4a3f5eff9e8a55a4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 2+ messages in thread From: Hollis Blanchard @ 2008-10-28 20:49 UTC (permalink / raw) To: qemu-devel; +Cc: Glauber Costa, Avi Kivity, kvm-devel, Anthony Liguori, kvm-ppc Just a quick skim... On Tue, Oct 28, 2008 at 3:13 PM, Anthony Liguori <aliguori@us.ibm.com> wrote: > +int kvm_cpu_exec(CPUState *env) > +{ > + struct kvm_run *run = env->kvm_run; > + int ret; > + > + dprintf("kvm_cpu_exec()\n"); > + > + do { > + kvm_arch_pre_run(env, run); > + > + if ((env->interrupt_request & CPU_INTERRUPT_EXIT)) { > + dprintf("interrupt exit requested\n"); > + ret = 0; > + break; > + } > + > + dprintf("setting tpr\n"); > + run->cr8 = cpu_get_apic_tpr(env); This belongs in the arch_pre_run hook above. > + ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); > + kvm_arch_post_run(env, run); > + > + if (ret = -EINTR || ret = -EAGAIN) { > + dprintf("io window exit\n"); > + ret = 0; > + break; > + } > + > + if (ret < 0) { > + dprintf("kvm run failed %s\n", strerror(-ret)); > + abort(); > + } > + > + ret = 0; /* exit loop */ > + switch (run->exit_reason) { > + case KVM_EXIT_IO: > + dprintf("handle_io\n"); > + ret = kvm_handle_io(env, run->io.port, > + (uint8_t *)run + run->io.data_offset, > + run->io.direction, > + run->io.size, > + run->io.count); > + break; > + case KVM_EXIT_MMIO: > + dprintf("handle_mmio\n"); > + cpu_physical_memory_rw(run->mmio.phys_addr, > + run->mmio.data, > + run->mmio.len, > + run->mmio.is_write); > + ret = 1; > + break; > + case KVM_EXIT_IRQ_WINDOW_OPEN: > + dprintf("irq_window_open\n"); > + break; > + case KVM_EXIT_SHUTDOWN: > + dprintf("shutdown\n"); > + qemu_system_reset_request(); > + ret = 1; > + break; > + case KVM_EXIT_UNKNOWN: > + dprintf("kvm_exit_unknown\n"); > + break; > + case KVM_EXIT_FAIL_ENTRY: > + dprintf("kvm_exit_fail_entry\n"); > + break; > + case KVM_EXIT_EXCEPTION: > + dprintf("kvm_exit_exception\n"); > + break; > + case KVM_EXIT_DEBUG: > + dprintf("kvm_exit_debug\n"); > + break; > + default: > + dprintf("kvm_arch_handle_exit\n"); > + ret = kvm_arch_handle_exit(env, run); > + break; > + } > + } while (ret > 0); > + > + return ret; > +} How did you decide which exit handlers should go into architecture-specific code? Looking at just the KVM architecture set: IO: x86 and ia64, not PowerPC or s390 MMIO: everybody except s390 DCRs: PowerPC only IRQ window: not sure -Hollis ^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <fb412d760810281349q2572acf0j4a3f5eff9e8a55a4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [Qemu-devel] [PATCH 3/3] Add KVM support to QEMU [not found] ` <fb412d760810281349q2572acf0j4a3f5eff9e8a55a4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2008-10-28 21:10 ` Anthony Liguori 0 siblings, 0 replies; 2+ messages in thread From: Anthony Liguori @ 2008-10-28 21:10 UTC (permalink / raw) To: Hollis Blanchard Cc: qemu-devel-qX2TKyscuCcdnm+yROfE0A, Glauber Costa, Avi Kivity, kvm-devel, Anthony Liguori, kvm-ppc-u79uwXL29TY76Z2rM5mHXA Hollis Blanchard wrote: > Just a quick skim... > > On Tue, Oct 28, 2008 at 3:13 PM, Anthony Liguori <aliguori@us.ibm.com> wrote: > >> +int kvm_cpu_exec(CPUState *env) >> +{ >> + struct kvm_run *run = env->kvm_run; >> + int ret; >> + >> + dprintf("kvm_cpu_exec()\n"); >> + >> + do { >> + kvm_arch_pre_run(env, run); >> + >> + if ((env->interrupt_request & CPU_INTERRUPT_EXIT)) { >> + dprintf("interrupt exit requested\n"); >> + ret = 0; >> + break; >> + } >> + >> + dprintf("setting tpr\n"); >> + run->cr8 = cpu_get_apic_tpr(env); >> > > This belongs in the arch_pre_run hook above. > Good catch, I've updated the patch. > How did you decide which exit handlers should go into > architecture-specific code? Looking at just the KVM architecture set: > Based on whether the implementation required target-specific code. > IO: x86 and ia64, not PowerPC or s390 > cpu_{in,out}[bwl] are defined in vl.c and are available for all architectures. They are no-ops on most architectures because they are never used. > MMIO: everybody except s390 > cpu_physical_memory_rw() is defined by everyone. > DCRs: PowerPC only > This will have to be an architecture specific handler. > IRQ window: not sure > It's a no-op implementation. I would think that this would be needed on PPC. If you want to inject an interrupt, but the guest is unable to handle an interrupt, you need to exit to userspace when the guest re-enables interrupts. Otherwise, you may never return to userspace for the interrupt to be injected. How do you handle that now? Does PPC have something that makes this unnecessary? Regards, Anthony Liguori > -Hollis > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-28 21:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1225224814-9875-1-git-send-email-aliguori@us.ibm.com>
[not found] ` <1225224814-9875-2-git-send-email-aliguori@us.ibm.com>
[not found] ` <1225224814-9875-3-git-send-email-aliguori@us.ibm.com>
2008-10-28 20:49 ` [Qemu-devel] [PATCH 3/3] Add KVM support to QEMU Hollis Blanchard
[not found] ` <fb412d760810281349q2572acf0j4a3f5eff9e8a55a4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-10-28 21:10 ` Anthony Liguori
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox