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 21:19:40 +0900 Message-ID: <4B58465C.40508@jp.fujitsu.com> References: <4B583122.6030002@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040202070301010102060803" Return-path: In-Reply-To: <4B583122.6030002@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. --------------040202070301010102060803 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Weidong, I re-send the DRHD-fix patch. If DRHD does not have existent devices, ignore it. If DRHD has both existent and non-existent devices, consider it invalid and not register. According to this patch and yours, my machine successfully booted with vt-d enabled. Signed-off-by: Noboru Iwamatsu > Keir Fraser wrote: >> On 21/01/2010 10:19, "Weidong Han" wrote: >> >>>> Sorry this is typo. >>>> I mean: >>>> So, I think RMRR that has no-existent device is "invalid" >>>> and whole RMRR should be ignored. >>> looks reasonable. >>> >>> Keir, I Acks Noboru's rmrr patch. Or do you want us to merge them to one >>> patch? >> >> Merge them up, re-send with both sign-off and acked-by all in one email. >> >> Thanks, >> Keir >> > Sorry, I disagree with Noboru after thinking it again. If the RMRR has > both no-existent device and also has existent devices in its scope, we > should not ignore it because the existent devices under its scope will > be impacted without the RMRR. so I suggest to print a warning instead of > ignore it. Attached a patch for it. > > Signed-off-by: Weidong Han --------------040202070301010102060803 Content-Type: text/plain; name="vtd-drhd-fix-v2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vtd-drhd-fix-v2.patch" diff -r 2eee03873667 -r 65e84fc54aa5 xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Thu Jan 21 21:06:50 2010 +0900 +++ b/xen/drivers/passthrough/vtd/dmar.c Thu Jan 21 20:58:12 2010 +0900 @@ -397,7 +397,42 @@ if ( ret ) xfree(dmaru); else - acpi_register_drhd_unit(dmaru); + { + u8 b, d, f; + int i, invalid_cnt = 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 ) + { + dprintk(XENLOG_WARNING VTDPREFIX, + " Non-existent device (%x:%x.%x) is reported " + "in DRHD's scope!\n", + b, d, f); + invalid_cnt++; + } + } + + if ( invalid_cnt ) + { + xfree(dmaru); + if ( invalid_cnt == dmaru->scope.devices_cnt ) + { + dprintk(XENLOG_WARNING VTDPREFIX, + " Ignore the DRHD due to " + "devices under its scope are not PCI discoverable!\n"); + } + else + ret = -EINVAL; + } + else + acpi_register_drhd_unit(dmaru); + } + return ret; } --------------040202070301010102060803 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 --------------040202070301010102060803--