From mboxrd@z Thu Jan 1 00:00:00 1970 From: Weidong Han Subject: Re: PCI Passthrough Problems/Questions Date: Wed, 27 Oct 2010 14:40:30 +0800 Message-ID: <4CC7C95E.7020500@intel.com> References: <4CC55D5C02000099000BA698@collaborate.seakr.com> <20101025174033.GA5766@dumpdata.com> <4CC5790502000099000BA6DC@collaborate.seakr.com> <20101025184818.GA6259@dumpdata.com> <4CC57D2102000099000BA6E6@collaborate.seakr.com> <20101025190752.GB6452@dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20101025190752.GB6452@dumpdata.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Konrad Rzeszutek Wilk Cc: "xen-devel@lists.xensource.com" , Nick Couchman List-Id: xen-devel@lists.xenproject.org Konrad Rzeszutek Wilk wrote: > On Mon, Oct 25, 2010 at 12:50:41PM -0600, Nick Couchman wrote: > >> On Mon, 2010-10-25 at 14:48 -0400, Konrad Rzeszutek Wilk wrote: >> >>> On Mon, Oct 25, 2010 at 12:33:09PM -0600, Nick Couchman wrote: >>> >>>> On Mon, 2010-10-25 at 13:40 -0400, Konrad Rzeszutek Wilk wrote: >>>> >>>> >>>>> What do you see on your Xen serial output? I presume you cranked up logging: >>>>> loglevel=all guest_lvl=all iommu=verbose on your Xen command line. >>>>> >>>>> Is there anything that shows up when you get the 'Failed to assign.." ? >>>>> >>>>> >>>> The only messages I get on the serial console after setting those >>>> parameters on the xen.gz kernel line in grub (and rebooting, of course) >>>> are the following: >>>> >>>> (XEN) [VT-D]iommu.c:1496: d0:PCI: unmap bdf = 2:0.0 >>>> (XEN) [VT-D]iommu.c:1364: d1:PCI: map bdf = 2:0.0 >>>> (XEN) domctl.c:848:d0 XEN_DOMCTL_assign_device: assign device (2:0.0) >>>> failed >>>> (XEN) event_channel.c:192:d0 EVTCHNOP failure: domain 1, error -22 >>>> Nick, I think the issue is 02:00.0 was mapped twice. Could you try with below patch? Then post the xen log. Pls post all output of 'lspci -v' on your system. diff -r eff592364826 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed Sep 01 11:23:49 2010 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed Oct 27 14:33:23 2010 +0800 @@ -1225,7 +1225,11 @@ static int domain_context_mapping_one( if (!pdev) res = -ENODEV; else if (pdev->domain != domain) - res = -EINVAL; + { + dprintk(VTDPREFIX, "context_present: %x:%x.%x: pdev->domain=%d domain=%d\n", + bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->domain, domain->domain_id); + // res = -EINVAL; + } unmap_vtd_domain_page(context_entries); spin_unlock(&iommu->lock); return res; @@ -1352,6 +1356,8 @@ static int domain_context_mapping(struct /* PCIe to PCI/PCIx bridge */ if ( pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE ) { + dprintk(VTDPREFIX, "d%d:PCI: map PCIe2PCI bdf = %x:%x.%x\n", + domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn); if ( ret ) return ret; @@ -1362,6 +1368,8 @@ static int domain_context_mapping(struct * on the secondary bus behind the bridge. Map that id * as well. */ + dprintk(VTDPREFIX, "d%d:PCI: map secbus (%d) with devfn 0\n", + domain->domain_id, secbus); ret = domain_context_mapping_one(domain, drhd->iommu, secbus, 0); } else /* Legacy PCI bridge */ >>> So, -EINVAL. How comfortable are you sticking a bunch of >>> dprintk(VTDPREFIX, " in the drivers/passthrough/vtd/iommu.c file? Basically >>> you need to figure which of the functions that are past line 1364 >>> are being called and return -EINVAL. >>> >> I'm happy to give it a shot...it'll take a while to get the devel >> environment configured, as I'm using packages right now and I don't even >> think I have a compiler on this system. I'll report back once I get >> that done and give that a try. >> > > Excellent. You might also want to CC Weidong (weidong.han@intel.com) in the future > who is right now on travel and he might have better suggestions. CC-ing him on this e-mail. >