Received: from eggs.gnu.org ([208.118.235.92]:37858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5TRg-0006WL-Dv for qemu-devel@nongnu.org; Wed, 07 Mar 2012 21:51:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5TRd-00048i-KA for qemu-devel@nongnu.org; Wed, 07 Mar 2012 21:51:11 -0500 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:13889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5TRb-00047s-AS for qemu-devel@nongnu.org; Wed, 07 Mar 2012 21:51:09 -0500 Date: Thu, 8 Mar 2012 10:50:53 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7?= Message-ID: <20120308025052.GA9198@cs.nctu.edu.tw> References: <20120304123140.GA1760@liwp@linux.vnet.ibm.com> <20120306101016.GA66053@cs.nctu.edu.tw> <20120307114708.GA2404@liwp@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120307114708.GA2404@liwp@linux.vnet.ibm.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] questions about pci List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: WanPeng Li Cc: qemu-devel CC'ed to the list. On Wed, Mar 07, 2012 at 07:47:08PM +0800, WanPeng Li wrote: > On Tue, Mar 06, 2012 at 06:10:16PM +0800, =E9=99=B3=E9=9F=8B=E4=BB=BB w= rote: > >> I read pci code in qemu about i440fx, pci.c and so on. I think if gu= est > >> os whose mainboard is based on x86, it will use IO instructions to > >> access PCI configuration space.If not use passthrough, qemu should > >> emulate these operations.I find a function called kvm_handle_io who = will > > ^^^^^^^^^^^^^ > > > > Looks suspicious. Prefix kvm mean passthrough, I guess. >=20 > If want to use passthrough, you should add additional options, but I'am > not. so not use passthrough here. Are you sure you are running into kvm_handle_io while booting a guest O= S by using QEMU? I set a breakpoint at kvm_handle_io but never stopping at = it. Or you're using KVM?=20 > I think you know something about PCI, so I need your help to confirm > some details.In phyical machine based on x86 platform, for example, > during the process of kernel traverse pci devices, it needs to write pc= i > configuration space, this influnce will reach the configuration space > by two registers(0xcf8,0xcfc).In Qemu 0xcf8 and 0xcfc bind to some > methods(read/write) of PHB.So every IO instructions(in/out) in guest os > who intend to write pci configuration space should capture by kvm then > pass to qemu to emulate(if not use passthrough).In guest os IO O.K., from here I am pretty sure you are talking about KVM which uses QEMU to emulate devices. I am not familiar in this part, so ... > instructions just read/write 0xcf8, 0xcfc, then pci will parse the > address and forward to right device.In qemu it should first through PHB > who binds methods and 0xcf8/0xcfc,then parse the address by the code > itself.right? So every pci read/write configuration space should throug= h > PHB read/write methods first. Regards, chenwj --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj