Yang Zhang
2013-Apr-16 06:18 UTC
[PATCH] VTD: Remove the check for reserved device scope type
From: Yang Zhang <yang.z.zhang@Intel.com> Though we only have four valid types now, the new type may be added in future. It''s better to remove the check and only deal with the type that we can recognize. Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Signed-off-by: Xiantao Zhang <xiantao.zhang@Intel.com> --- xen/drivers/passthrough/vtd/dmar.c | 7 +++++-- xen/include/acpi/actbl2.h | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index 370d5d6..eda04a3 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -283,8 +283,7 @@ static int __init scope_device_count(const void *start, const void *end) while ( start < end ) { scope = start; - if ( (scope->length < MIN_SCOPE_LEN) || - (scope->entry_type >= ACPI_DMAR_SCOPE_TYPE_RESERVED) ) + if ( scope->length < MIN_SCOPE_LEN ) { dprintk(XENLOG_WARNING VTDPREFIX, "Invalid device scope.\n"); return -EINVAL; @@ -409,6 +408,10 @@ static int __init acpi_parse_dev_scope( } break; + + default: + start += acpi_scope->length; + continue; } scope->devices[didx++] = PCI_BDF(bus, path->dev, path->fn); start += acpi_scope->length; diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h index a28226a..87bc6b3 100644 --- a/xen/include/acpi/actbl2.h +++ b/xen/include/acpi/actbl2.h @@ -303,7 +303,6 @@ enum acpi_dmar_scope_type { ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, ACPI_DMAR_SCOPE_TYPE_HPET = 4, - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ }; struct acpi_dmar_pci_path { -- 1.7.1
Keir Fraser
2013-Apr-16 06:45 UTC
Re: [PATCH] VTD: Remove the check for reserved device scope type
On 16/04/2013 07:18, "Yang Zhang" <yang.z.zhang@intel.com> wrote:> From: Yang Zhang <yang.z.zhang@Intel.com> > > Though we only have four valid types now, the new type may be added in future. > It''s better to remove the check and only deal with the type that we can > recognize. > > Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> > Signed-off-by: Xiantao Zhang <xiantao.zhang@Intel.com>Acked-by: Keir Fraser <keir@xen.org>> --- > xen/drivers/passthrough/vtd/dmar.c | 7 +++++-- > xen/include/acpi/actbl2.h | 1 - > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/xen/drivers/passthrough/vtd/dmar.c > b/xen/drivers/passthrough/vtd/dmar.c > index 370d5d6..eda04a3 100644 > --- a/xen/drivers/passthrough/vtd/dmar.c > +++ b/xen/drivers/passthrough/vtd/dmar.c > @@ -283,8 +283,7 @@ static int __init scope_device_count(const void *start, > const void *end) > while ( start < end ) > { > scope = start; > - if ( (scope->length < MIN_SCOPE_LEN) || > - (scope->entry_type >= ACPI_DMAR_SCOPE_TYPE_RESERVED) ) > + if ( scope->length < MIN_SCOPE_LEN ) > { > dprintk(XENLOG_WARNING VTDPREFIX, "Invalid device scope.\n"); > return -EINVAL; > @@ -409,6 +408,10 @@ static int __init acpi_parse_dev_scope( > } > > break; > + > + default: > + start += acpi_scope->length; > + continue; > } > scope->devices[didx++] = PCI_BDF(bus, path->dev, path->fn); > start += acpi_scope->length; > diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h > index a28226a..87bc6b3 100644 > --- a/xen/include/acpi/actbl2.h > +++ b/xen/include/acpi/actbl2.h > @@ -303,7 +303,6 @@ enum acpi_dmar_scope_type { > ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, > ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, > ACPI_DMAR_SCOPE_TYPE_HPET = 4, > - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ > }; > > struct acpi_dmar_pci_path {
Ian Campbell
2013-Apr-16 08:06 UTC
Re: [PATCH] VTD: Remove the check for reserved device scope type
On Tue, 2013-04-16 at 07:18 +0100, Yang Zhang wrote:> From: Yang Zhang <yang.z.zhang@Intel.com> > > Though we only have four valid types now, the new type may be added in future. > It''s better to remove the check and only deal with the type that we can > recognize. > > Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> > Signed-off-by: Xiantao Zhang <xiantao.zhang@Intel.com> > --- > xen/drivers/passthrough/vtd/dmar.c | 7 +++++-- > xen/include/acpi/actbl2.h | 1 - > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c > index 370d5d6..eda04a3 100644 > --- a/xen/drivers/passthrough/vtd/dmar.c > +++ b/xen/drivers/passthrough/vtd/dmar.c > @@ -283,8 +283,7 @@ static int __init scope_device_count(const void *start, const void *end) > while ( start < end ) > { > scope = start; > - if ( (scope->length < MIN_SCOPE_LEN) || > - (scope->entry_type >= ACPI_DMAR_SCOPE_TYPE_RESERVED) ) > + if ( scope->length < MIN_SCOPE_LEN ) > { > dprintk(XENLOG_WARNING VTDPREFIX, "Invalid device scope.\n"); > return -EINVAL; > @@ -409,6 +408,10 @@ static int __init acpi_parse_dev_scope( > } > > break; > + > + default:Worth a log message? At least if iommu_verbose?> + start += acpi_scope->length; > + continue; > } > scope->devices[didx++] = PCI_BDF(bus, path->dev, path->fn); > start += acpi_scope->length; > diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h > index a28226a..87bc6b3 100644 > --- a/xen/include/acpi/actbl2.h > +++ b/xen/include/acpi/actbl2.h > @@ -303,7 +303,6 @@ enum acpi_dmar_scope_type { > ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, > ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, > ACPI_DMAR_SCOPE_TYPE_HPET = 4, > - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ > }; > > struct acpi_dmar_pci_path {
Zhang, Yang Z
2013-Apr-16 08:11 UTC
Re: [PATCH] VTD: Remove the check for reserved device scope type
Ian Campbell wrote on 2013-04-16:> On Tue, 2013-04-16 at 07:18 +0100, Yang Zhang wrote: >> From: Yang Zhang <yang.z.zhang@Intel.com> >> >> Though we only have four valid types now, the new type may be added in >> future. It''s better to remove the check and only deal with the type >> that we can recognize. >> >> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> >> Signed-off-by: Xiantao Zhang <xiantao.zhang@Intel.com> >> --- >> xen/drivers/passthrough/vtd/dmar.c | 7 +++++-- >> xen/include/acpi/actbl2.h | 1 - >> 2 files changed, 5 insertions(+), 3 deletions(-) >> diff --git a/xen/drivers/passthrough/vtd/dmar.c >> b/xen/drivers/passthrough/vtd/dmar.c index 370d5d6..eda04a3 100644 --- >> a/xen/drivers/passthrough/vtd/dmar.c +++ >> b/xen/drivers/passthrough/vtd/dmar.c @@ -283,8 +283,7 @@ static int >> __init scope_device_count(const void *start, > const void *end) >> while ( start < end ) >> { >> scope = start; >> - if ( (scope->length < MIN_SCOPE_LEN) || - >> (scope->entry_type >= ACPI_DMAR_SCOPE_TYPE_RESERVED) ) + if ( >> scope->length < MIN_SCOPE_LEN ) >> { >> dprintk(XENLOG_WARNING VTDPREFIX, "Invalid device >> scope.\n"); return -EINVAL; @@ -409,6 +408,10 @@ static >> int __init acpi_parse_dev_scope( } >> >> break; >> + >> + default: > > Worth a log message? At least if iommu_verbose?Sure.> >> + start += acpi_scope->length; >> + continue; >> } >> scope->devices[didx++] = PCI_BDF(bus, path->dev, path->fn); >> start += acpi_scope->length; >> diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h >> index a28226a..87bc6b3 100644 >> --- a/xen/include/acpi/actbl2.h >> +++ b/xen/include/acpi/actbl2.h >> @@ -303,7 +303,6 @@ enum acpi_dmar_scope_type { >> ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, >> ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, >> ACPI_DMAR_SCOPE_TYPE_HPET = 4, >> - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved > */ >> }; >> >> struct acpi_dmar_pci_path { >Best regards, Yang
Zhang, Yang Z
2013-Aug-15 01:39 UTC
Re: [PATCH] VTD: Remove the check for reserved device scope type
Zhang, Yang Z wrote on 2013-04-16:> From: Yang Zhang <yang.z.zhang@Intel.com> > > Though we only have four valid types now, the new type may be added in > future. It''s better to remove the check and only deal with the type that > we can recognize. > > Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> > Signed-off-by: Xiantao Zhang <xiantao.zhang@Intel.com> > --- > xen/drivers/passthrough/vtd/dmar.c | 7 +++++-- > xen/include/acpi/actbl2.h | 1 - > 2 files changed, 5 insertions(+), 3 deletions(-) > diff --git a/xen/drivers/passthrough/vtd/dmar.c > b/xen/drivers/passthrough/vtd/dmar.c index 370d5d6..eda04a3 100644 --- > a/xen/drivers/passthrough/vtd/dmar.c +++ > b/xen/drivers/passthrough/vtd/dmar.c @@ -283,8 +283,7 @@ static int > __init scope_device_count(const void *start, const void *end) > while ( start < end ) > { > scope = start; > - if ( (scope->length < MIN_SCOPE_LEN) || > - (scope->entry_type >> ACPI_DMAR_SCOPE_TYPE_RESERVED) ) > + if ( scope->length < MIN_SCOPE_LEN ) > { > dprintk(XENLOG_WARNING VTDPREFIX, "Invalid device > scope.\n"); return -EINVAL; @@ -409,6 +408,10 @@ static int > __init acpi_parse_dev_scope( } > > break; > + > + default: > + start += acpi_scope->length; > + continue; > } > scope->devices[didx++] = PCI_BDF(bus, path->dev, path->fn); > start += acpi_scope->length; > diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h index > a28226a..87bc6b3 100644 --- a/xen/include/acpi/actbl2.h +++ > b/xen/include/acpi/actbl2.h @@ -303,7 +303,6 @@ enum > acpi_dmar_scope_type { > ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, > ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, > ACPI_DMAR_SCOPE_TYPE_HPET = 4, > - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved > */ > }; > > struct acpi_dmar_pci_path {Please help to back port this patch to Xen 4.2 and Xen 4.1. Currently , we found the old Xen cannot use VT-d in some special platform without this patch. Thanks. Best regards, Yang
Jan Beulich
2013-Aug-15 07:17 UTC
Re: [PATCH] VTD: Remove the check for reserved device scope type
>>> On 15.08.13 at 03:39, "Zhang, Yang Z" <yang.z.zhang@intel.com> wrote: > Please help to back port this patch to Xen 4.2 and Xen 4.1. Currently , we > found the old Xen cannot use VT-d in some special platform without this patch.Done for 4.2; the patch doesn''t apply as-is to 4.1, so please provide a backported version if you think it really is relevant for this soon to be closed tree (and depending on timing, we may close the tree before that backport becomes ready for it). Jan
Zhang, Yang Z
2013-Aug-15 07:23 UTC
Re: [PATCH] VTD: Remove the check for reserved device scope type
Jan Beulich wrote on 2013-08-15:>>>> On 15.08.13 at 03:39, "Zhang, Yang Z" <yang.z.zhang@intel.com> wrote: >> Please help to back port this patch to Xen 4.2 and Xen 4.1. >> Currently , we found the old Xen cannot use VT-d in some special >> platform without this > patch. > > Done for 4.2; the patch doesn''t apply as-is to 4.1, so please provide > a backported version if you think it really is relevant for this soon > to be closed tree (and depending on timing, we may close the tree > before that backport becomes ready for it). > JanThanks. It''s not so urgent. I will send out a 4.1 compatible patch later. Best regards, Yang