[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] VT-d: improve RMRR validity checking
On Thu, 2010-03-11 at 11:44 +0800, Weidong Han wrote: > good suggestion to check the device type. I cooked a new patch. It skips > checking IOAPIC and HPET. pls have a try. I like this approach better, but the patch doesn't work as is. The problem is acpi_scope is getting incremented as a structure instead of by length bytes. It either needs to be cast on the increment, or maybe cast on use like this: Signed-off-by: Alex Williamson <alex.williamson@xxxxxx> diff -r 132ac04cbdba xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Tue Mar 09 18:18:19 2010 +0000 +++ b/xen/drivers/passthrough/vtd/dmar.c Wed Mar 10 21:46:49 2010 -0700 @@ -407,9 +407,15 @@ { u8 b, d, f; int i, invalid_cnt = 0; + void *p; - for ( i = 0; i < dmaru->scope.devices_cnt; i++ ) + for ( i = 0, p = dev_scope_start; i < dmaru->scope.devices_cnt; + i++, p += ((struct acpi_dev_scope *)p)->length ) { + if ( ((struct acpi_dev_scope *)p)->dev_type == ACPI_DEV_IOAPIC || + ((struct acpi_dev_scope *)p)->dev_type == ACPI_DEV_MSI_HPET ) + continue; + b = PCI_BUS(dmaru->scope.devices[i]); d = PCI_SLOT(dmaru->scope.devices[i]); f = PCI_FUNC(dmaru->scope.devices[i]); > diff -r cadf1bae9ee2 xen/drivers/passthrough/vtd/dmar.c > --- a/xen/drivers/passthrough/vtd/dmar.c Thu Feb 25 18:26:45 2010 +0800 > +++ b/xen/drivers/passthrough/vtd/dmar.c Thu Mar 11 19:39:45 2010 +0800 > @@ -407,9 +407,15 @@ acpi_parse_one_drhd(struct acpi_dmar_ent > { > u8 b, d, f; > int i, invalid_cnt = 0; > + struct acpi_dev_scope *acpi_scope = dev_scope_start; > > for ( i = 0; i < dmaru->scope.devices_cnt; i++ ) > { > + acpi_scope += (i == 0) ? 0 : acpi_scope->length; > + if ( acpi_scope->dev_type == ACPI_DEV_IOAPIC || > + acpi_scope->dev_type == ACPI_DEV_MSI_HPET ) > + continue; > + > b = PCI_BUS(dmaru->scope.devices[i]); > d = PCI_SLOT(dmaru->scope.devices[i]); > f = PCI_FUNC(dmaru->scope.devices[i]); > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |