From mboxrd@z Thu Jan 1 00:00:00 1970 From: Weidong Han Subject: Re: iommuu/vt-d issues with LSI MegaSAS (PERC5i) Date: Thu, 03 Jun 2010 09:14:00 +0800 Message-ID: <4C0701D8.2050103@intel.com> References: <1275143477.15573.19.camel@debmed> <4C05B299.60504@intel.com> <20100602062624.GJ17817@reaktio.net> <4C0602AF.5040806@intel.com> <20100602144906.GC13344@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20100602144906.GC13344@phenom.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: "M. Nunberg" , Xen-devel List-Id: xen-devel@lists.xenproject.org Konrad Rzeszutek Wilk wrote: > On Wed, Jun 02, 2010 at 03:05:19PM +0800, Weidong Han wrote: > =20 >> Pasi K=E4rkk=E4inen wrote: >> =20 >>> On Wed, Jun 02, 2010 at 09:23:37AM +0800, Weidong Han wrote: >>> =20 >>> =20 >>>> This PCI-x card is not suitable for assignment. It contains an invis= ible >>>> device 05:08.0 (lspci cannot show it), but this invisible device won= 't >>>> be mapped by VT-d because VT-d engine doesn't know this device, so y= ou >>>> can see the DMAR faults on it. One workaround is to hard code to map >>>> 05:08.0 when assign 05:0e.0. BTW, PCIe LSI card don't have this prob= lem. >>>> >>>> =20 >>>> =20 >>> Note that this problem happens when booting up dom0.. >>> =20 >>> =20 >> I see. all devices are assigned to dom0 in booting. It just needs to m= ap =20 >> 05:08.0 as well when map 05:0e.0 in domain_context_mapping. >> =20 > > Hey Weidong, > > Thank you the explanation. I am not that familiar with the VT-D chipset= , > but it seems that this issue also appears with CardBus controllers: > http://lkml.org/lkml/2010/5/22/69 ? > > For this device, the problem should also appear with the newer kernels > without using the Hypervisor and with CONFIG_DMAR enabled, right?=20 > =20 yes. > Am I to understand that the workaround you are proposing is doing > something akin to this: > =20 Your below code only make it work for dom0 by calling lsi_hack_init. but=20 if you want to assign it to guest, it still cannot work. You can=20 implement a a simple temporarily workaround like this: diff -r 2cd58d7d5db9 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Tue Jun 01 20:40:34 2010 -040= 0 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed Jun 02 14:09:37 2010 -040= 0 @@ -1339,6 +1339,15 @@ static int domain_context_mapping(struct if ( ret ) break; + /* NB. LSI workaround */ + if ( bus =3D=3D 0x05 && PCI_SLOT(devfn) =3D=3D 0x0e && PCI_FUNC(= devfn)=20 =3D=3D 0x0 ) + { + ret =3D domain_context_mapping_one(domain, drhd->iommu, + 0x05, PCI_DEVFN(8, 0)); + if ( ret ) + break; + } + if ( find_upstream_bridge(&bus, &devfn, &secbus) < 1 ) break; > > /* > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the GNU General Public License v2.0 as publish= ed by > * the Free Software Foundation > * > * This program is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > * GNU General Public License for more details. > */ > > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > > #include > > #include > #include > > #include > #include > > #define LSI_HACK "0.1" > > MODULE_AUTHOR("Konrad Rzeszutek Wilk "); > MODULE_DESCRIPTION("lsi hack"); > MODULE_LICENSE("GPL"); > MODULE_VERSION(LSI_HACK); > > static int __init lsi_hack_init(void) > { > int r =3D 0; > > struct physdev_manage_pci manage_pci =3D { > .bus =3D 0x5, > .devfn =3D PCI_DEVFN(8,0), > }; > r =3D HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add, > &manage_pci); > > return r; > } > > static void __exit lsi_hack_exit(void) > { > int r =3D 0; > struct physdev_manage_pci manage_pci; > > manage_pci.bus =3D 0x5; > manage_pci.devfn =3D PCI_DEVFN(8,0); > > r =3D HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, > &manage_pci); > if (r) > printk(KERN_ERR "%s: %d\n", __FUNCTION__, r); > } > > module_init(lsi_hack_init); > module_exit(lsi_hack_exit); > =20