From: Amit Shah Subject: Re: PCI PT: irq issue Date: Fri, 20 Jun 2008 16:16:47 +0530 Message-ID: <200806201616.48356.amit.shah@qumranet.com> References: <1213793776.9177.60.camel@lnx-benami> <200806191017.30172.amit.shah@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, "Muli Ben-Yehuda" , "Han, Weidong" , Allen Kay To: "Ben-Ami Yassour" Return-path: Received: from mis011-1.exch011.intermedia.net ([64.78.21.128]:6082 "EHLO mis011-1.exch011.intermedia.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751881AbYFTKoA (ORCPT ); Fri, 20 Jun 2008 06:44:00 -0400 In-Reply-To: <200806191017.30172.amit.shah@qumranet.com> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Thursday 19 June 2008 10:17:29 Amit Shah wrote: > * On Wednesday 18 June 2008 18:26:16 Ben-Ami Yassour wrote: > > Amit, > > > > With the current implementation we have an issue if the driver on the > > host was never loaded. > > > > To be able to run kvm with passthrough we have to load and then unload > > the driver on the host at least once. After that it works ok. > > Yes, whenever a device issues pci_request_regions(), the IRQ may be > reassigned. > > The unloading / loading should not be necessary once I commit these changes > to the tree. > > > Note that after doing the load and unload the irq as reported by lspci > > -v is changed. > > > > The questions that I think we need to figure out are: > > 1. How does the loading of the driver on the host causes the irq to > > change? > > 2. What other side effects does it do that helps kvm pcipt work? > > 3. What do we need to add to the pcipt code that will do the same "side > > effect" (or bypass the problem)? > > That already answers all these. > > > Also note that in the current implementation the user is required to > > provide the irq for the device in the kvm command line. > > With respect to the comments above it is clear that lspci will show an > > irrelevant irq value. > > Why do we need the user to provide this information anyhow? > > Why can't KVM find it out automatically? > > I thought we discussed this several times. The next commit is going to fix > this. > > > Note, if the kernel can find this information then we can also remove it > > from the ioctl interface. > > Coming soon; coming soon indeed. I just pushed out the changes so the trickery with module loading / unloading, assigning irq number, etc. are not needed. The userspace command line still expects a number for the irq, though, and you can pass it any number as long as you use the in-kernel irq handler (this is needed for the irqhook module, which I'm not updating the irqhook module as of now). A couple of notes for the VT-d patch: - The pci_dev struct is now available in the pci_pt kernel structure, so just use that information each time you want to add a device instead of searching for it each time. - The kernel with KVM VT-d patches doesn't build on the kvm-userspace.git tree. Please fix that. Amit.