From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhengwang Ruan Subject: Re: Some questions from a freshman to this community Date: Tue, 26 Jun 2012 10:20:03 +0800 Message-ID: <4FE91C53.2060904@gmail.com> References: <4FE8491D.2080309@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: avi@redhat.com Return-path: Received: from mail-pb0-f46.google.com ([209.85.160.46]:65179 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758040Ab2FZCT7 (ORCPT ); Mon, 25 Jun 2012 22:19:59 -0400 Received: by pbbrp8 with SMTP id rp8so7361322pbb.19 for ; Mon, 25 Jun 2012 19:19:59 -0700 (PDT) In-Reply-To: <4FE8491D.2080309@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi guys, Could you guys kindly help me answer these questions below? This is ver= y=20 helpful for me to learn kvm. Thanks! :-) Regards, Zhengwang -------- Original Message -------- =46rom: Zhengwang Ruan Sent: 2012=E5=B9=B406=E6=9C=8826=E6=97=A5 =E6=98=9F=E6=9C=9F=E4=BA=8C 1= 0=E6=97=B616=E5=88=8649=E7=A7=92 To: kvm Subject: Some questions from a freshman to this community > Hi all, > > I am freshman to this community, I have some questions roughly about=20 > how does KVM work, please help me answer these questions, thank you! > > 1, What is the relation between kvm-mod and kvm-qemu? > > Is kvm-qemu mainly used to emulate the first initial 16-bit code of a= =20 > guest, then this qemu context will be replaced by the real guest, suc= h=20 > as linux, windows? But I also see some emulation code in kvm-mod, wha= t=20 > are these code used for? > > 2, How to handle irqs in kvm-mod? > > I found vmx_inject_irq is used to inject an interrupt to a guest by=20 > writing vmcs for a guest, initialized by this call trace: vmx_init ->= =20 > kvm_init -> kvm_arch_init (kvm_x86_ops is assigned in this call), the= n=20 > kvm_x86_ops will be used everywhere to set_irq for guests. Am I right= ? > > But I seems to me that vmx_inject_irq is only called by=20 > .unlocked_ioctl in kvm_vcpu_fops file_operation struct, where could w= e=20 > use this file operation? If a device wants to issue an interrupt to a= =20 > guest, how does this happen in device driver? > > 3, APIC. > > I see that each vcpu has a local apic (vcpu.arch->apic), and some=20 > functions use this area ranged by this apic pointer to do setting and= =20 > reading. Is this used to emulate apic for each vcpu? If so, when and=20 > where this will be used by guests? > > 4, The relation between kvm_vcpu_arch and vmcs. > > There are some regular registers in kvm_vcpu_arch, and the values for= =20 > these registers also be used to read and write. I am confused about=20 > this, if we want to read/write a register for a guest, we don't=20 > directly use those values in vmcs?? > > > Regards, > > Zhengwang >