From mboxrd@z Thu Jan 1 00:00:00 1970 From: Noboru Iwamatsu Subject: Re: [PATCH] VT-d: improve RMRR validity checking Date: Thu, 21 Jan 2010 17:25:48 +0900 Message-ID: <4B580F8C.5090807@jp.fujitsu.com> References: <60E426D47DE8EA47AA104E65008A100D14458756F3@shzsmsx501.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080205080005030200010800" Return-path: In-Reply-To: <60E426D47DE8EA47AA104E65008A100D14458756F3@shzsmsx501.ccr.corp.intel.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: weidong.han@intel.com Cc: xen-devel@lists.xensource.com, keir.fraser@eu.citrix.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------080205080005030200010800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, Some Q35 mainboard that has buggy BIOS, I have one of this, reports invalid DRHD in addition to the invalid RMRR. Attached patch fixes this DRHD issue in the same way as RMRR. And also, I fixed RMRR validity checking loop. Noboru. Signed-off-by: Noboru Iwamatsu -------- Original Message -------- Subject: [Xen-devel] [PATCH] VT-d: improve RMRR validity checking From: Han, Weidong To: xen-devel@lists.xensource.com Date: Thu Jan 21 2010 11:46:12 GMT+0900 > Currently, Xen checks RMRR range and disables VT-d if RMRR range is set incorrectly in BIOS rigorously. But, actually we can ignore the RMRR if the device under its scope are not pci discoverable, because the RMRR won't be used by non-existed or disabled devices. > > This patch ignores the RMRR if the device under its scope are not pci discoverable, and only checks the validity of RMRRs that are actually used. In order to avoid duplicate pci device detection code, this patch defines a function pci_device_detect for it. > > Signed-off-by: Weidong Han > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel --------------080205080005030200010800 Content-Type: text/plain; name="01_vtd-drhd-workaround.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="01_vtd-drhd-workaround.patch" diff -r bbad08b156e9 -r 072ffd2fa8f7 xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Thu Jan 21 14:08:42 2010 +0900 +++ b/xen/drivers/passthrough/vtd/dmar.c Thu Jan 21 16:39:46 2010 +0900 @@ -397,7 +397,34 @@ if ( ret ) xfree(dmaru); else - acpi_register_drhd_unit(dmaru); + { + u8 b, d, f; + int i, ignore = 0; + + for ( i = 0; i < dmaru->scope.devices_cnt; i++ ) + { + b = PCI_BUS(dmaru->scope.devices[i]); + d = PCI_SLOT(dmaru->scope.devices[i]); + f = PCI_FUNC(dmaru->scope.devices[i]); + + if ( pci_device_detect(b, d, f) == 0 ) + { + ignore = 1; + break; + } + } + + if ( ignore ) + { + dprintk(XENLOG_WARNING VTDPREFIX, + " Ignore the DRHD due to " + "devices under its scope are not PCI discoverable!\n"); + xfree(dmaru); + } + else + acpi_register_drhd_unit(dmaru); + } + return ret; } --------------080205080005030200010800 Content-Type: text/plain; name="02_vtd-rmrr-workaround-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="02_vtd-rmrr-workaround-fix.patch" diff -r 072ffd2fa8f7 -r 958f11b847cc xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Thu Jan 21 16:39:46 2010 +0900 +++ b/xen/drivers/passthrough/vtd/dmar.c Thu Jan 21 16:42:04 2010 +0900 @@ -480,10 +480,8 @@ f = PCI_FUNC(rmrru->scope.devices[i]); if ( pci_device_detect(b, d, f) == 0 ) + { ignore = 1; - else - { - ignore = 0; break; } } --------------080205080005030200010800 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------080205080005030200010800--