From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neo Jia Subject: Re: :could anyone give me some instruction for KVM pci driver? Thanks Date: Thu, 18 Aug 2011 17:52:12 -0700 Message-ID: <20110819005212.GB28702@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: liu pf Return-path: Received: from mail-iy0-f170.google.com ([209.85.210.170]:59362 "EHLO mail-iy0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975Ab1HSAyI (ORCPT ); Thu, 18 Aug 2011 20:54:08 -0400 Received: by iye16 with SMTP id 16so4922453iye.1 for ; Thu, 18 Aug 2011 17:54:07 -0700 (PDT) Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Aug 17, 2011 at 04:48:52PM +0800, liu pf wrote: > Hi guys, >=20 > After objdump the driver, I found that the access to the pci-memmap > register was optimized by GCC, and no code was generated. > And the EPT in 2.6.39 is fine. Are you registering a callback function for the register range you are = going to monitor on QEMU? You will see a VM_EXIT, which then trigger a mmio acce= ss from KVM. Thanks, CJ >=20 > Thanks, > Pierce >=20 >=20 > On Fri, Aug 12, 2011 at 4:33 PM, liu pf wrote: > > Hi guys, > > > > When I develop a PCI device driver for qemu-kvm, I am suffering fro= m > > some problem, Could anyone give me some instruction? Thanks :) > > > > My solution consists of two parts: =A0emulated PCI device in Qemu a= nd > > corresponding PCI device driver in guest OS. > > The emulated =A0device has a PCI -memmap registers. So as expected,= when > > the guest device driver wrote this area, we will capture such event= in > > Qemu. > > But it failed to do so. After tracing the host kernel, I found that > > =A01. my guest PCI device driver had claimed the gpa from > > pci_dev->resource[0].start=3D0xf0050000 to resource[0].end=3D0xf005= 00ff > > and succeed to ioremap > > =A02. In host kernel, =A0I added "printk" after > > handle_ept_violation(struct kvm_vcpu *vcpu) {gpa > > =3Dvmcs_read64(GUEST_PHYSICAL_ADDRESS); printk(..);} > > =A0 =A0BUT, when guest wrote this "ioremap" area, the host did NOT = hit > > the region [0xf0050000,0xf00500ff] > > > > > > I had thought that when accessing the emulated device, the gva ->gp= a > > has been set up by guest, so EPT violation will be the only reason > > which caused guest exit . =A0And the event will be finally passed t= o the > > user mode--qemu. =A0Am I right? > > > > And the most important is what I can do for the next step? > > > > BTW, I am sure that "kvm_enable_tdp". and kernel is 2.6.39, for con= fig > > file, pls see attachment. > > > > > > Thanks, > > Pierce > > > -- > 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