All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] iommu/vt-d: Don't reject nvme host due to scope mismatch
@ 2020-01-05 13:57 ` jimyan
  0 siblings, 0 replies; 4+ messages in thread
From: jimyan @ 2020-01-05 13:57 UTC (permalink / raw)
  To: joro, jsnitsel, baolu.lu, roland; +Cc: iommu, linux-kernel, jimyan

On a system with an Intel PCIe port configured as a nvme host device, iommu
initialization fails with

    DMAR: Device scope type does not match for 0000:80:00.0

This is because the DMAR table reports this device as having scope 2
(ACPI_DMAR_SCOPE_TYPE_BRIDGE):

but the device has a type 0 PCI header:
80:00.0 Class 0600: Device 8086:2020 (rev 06)
00: 86 80 20 20 47 05 10 00 06 00 00 06 10 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 86 80 00 00
30: 00 00 00 00 90 00 00 00 00 00 00 00 00 01 00 00

VT-d works perfectly on this system, so there's no reason to bail out
on initialization due to this apparent scope mismatch. Add the class
0x06 ("PCI_BASE_CLASS_BRIDGE") as a heuristic for allowing DMAR
initialization for non-bridge PCI devices listed with scope bridge.

Signed-off-by: jimyan <jimyan@baidu.com>
---
 drivers/iommu/dmar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index eecd6a421667..50c92eb23ee4 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -244,7 +244,7 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
 		     info->dev->hdr_type != PCI_HEADER_TYPE_NORMAL) ||
 		    (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE &&
 		     (info->dev->hdr_type == PCI_HEADER_TYPE_NORMAL &&
-		      info->dev->class >> 8 != PCI_CLASS_BRIDGE_OTHER))) {
+		      info->dev->class >> 16 != PCI_BASE_CLASS_BRIDGE))) {
 			pr_warn("Device scope type does not match for %s\n",
 				pci_name(info->dev));
 			return -EINVAL;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] iommu/vt-d: Don't reject nvme host due to scope mismatch
@ 2020-01-05 13:57 ` jimyan
  0 siblings, 0 replies; 4+ messages in thread
From: jimyan @ 2020-01-05 13:57 UTC (permalink / raw)
  To: joro, jsnitsel, baolu.lu, roland; +Cc: jimyan, iommu, linux-kernel

On a system with an Intel PCIe port configured as a nvme host device, iommu
initialization fails with

    DMAR: Device scope type does not match for 0000:80:00.0

This is because the DMAR table reports this device as having scope 2
(ACPI_DMAR_SCOPE_TYPE_BRIDGE):

but the device has a type 0 PCI header:
80:00.0 Class 0600: Device 8086:2020 (rev 06)
00: 86 80 20 20 47 05 10 00 06 00 00 06 10 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 86 80 00 00
30: 00 00 00 00 90 00 00 00 00 00 00 00 00 01 00 00

VT-d works perfectly on this system, so there's no reason to bail out
on initialization due to this apparent scope mismatch. Add the class
0x06 ("PCI_BASE_CLASS_BRIDGE") as a heuristic for allowing DMAR
initialization for non-bridge PCI devices listed with scope bridge.

Signed-off-by: jimyan <jimyan@baidu.com>
---
 drivers/iommu/dmar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index eecd6a421667..50c92eb23ee4 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -244,7 +244,7 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
 		     info->dev->hdr_type != PCI_HEADER_TYPE_NORMAL) ||
 		    (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE &&
 		     (info->dev->hdr_type == PCI_HEADER_TYPE_NORMAL &&
-		      info->dev->class >> 8 != PCI_CLASS_BRIDGE_OTHER))) {
+		      info->dev->class >> 16 != PCI_BASE_CLASS_BRIDGE))) {
 			pr_warn("Device scope type does not match for %s\n",
 				pci_name(info->dev));
 			return -EINVAL;
-- 
2.11.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] iommu/vt-d: Don't reject nvme host due to scope mismatch
  2020-01-05 13:57 ` jimyan
@ 2020-01-07  1:57   ` Jerry Snitselaar
  -1 siblings, 0 replies; 4+ messages in thread
From: Jerry Snitselaar @ 2020-01-07  1:57 UTC (permalink / raw)
  To: jimyan; +Cc: joro, baolu.lu, roland, iommu, linux-kernel

On Sun Jan 05 20, jimyan wrote:
>On a system with an Intel PCIe port configured as a nvme host device, iommu
>initialization fails with
>
>    DMAR: Device scope type does not match for 0000:80:00.0
>
>This is because the DMAR table reports this device as having scope 2
>(ACPI_DMAR_SCOPE_TYPE_BRIDGE):
>
>but the device has a type 0 PCI header:
>80:00.0 Class 0600: Device 8086:2020 (rev 06)
>00: 86 80 20 20 47 05 10 00 06 00 00 06 10 00 00 00
>10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>20: 00 00 00 00 00 00 00 00 00 00 00 00 86 80 00 00
>30: 00 00 00 00 90 00 00 00 00 00 00 00 00 01 00 00
>
>VT-d works perfectly on this system, so there's no reason to bail out
>on initialization due to this apparent scope mismatch. Add the class
>0x06 ("PCI_BASE_CLASS_BRIDGE") as a heuristic for allowing DMAR
>initialization for non-bridge PCI devices listed with scope bridge.
>
>Signed-off-by: jimyan <jimyan@baidu.com>

Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] iommu/vt-d: Don't reject nvme host due to scope mismatch
@ 2020-01-07  1:57   ` Jerry Snitselaar
  0 siblings, 0 replies; 4+ messages in thread
From: Jerry Snitselaar @ 2020-01-07  1:57 UTC (permalink / raw)
  To: jimyan; +Cc: roland, linux-kernel, iommu

On Sun Jan 05 20, jimyan wrote:
>On a system with an Intel PCIe port configured as a nvme host device, iommu
>initialization fails with
>
>    DMAR: Device scope type does not match for 0000:80:00.0
>
>This is because the DMAR table reports this device as having scope 2
>(ACPI_DMAR_SCOPE_TYPE_BRIDGE):
>
>but the device has a type 0 PCI header:
>80:00.0 Class 0600: Device 8086:2020 (rev 06)
>00: 86 80 20 20 47 05 10 00 06 00 00 06 10 00 00 00
>10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>20: 00 00 00 00 00 00 00 00 00 00 00 00 86 80 00 00
>30: 00 00 00 00 90 00 00 00 00 00 00 00 00 01 00 00
>
>VT-d works perfectly on this system, so there's no reason to bail out
>on initialization due to this apparent scope mismatch. Add the class
>0x06 ("PCI_BASE_CLASS_BRIDGE") as a heuristic for allowing DMAR
>initialization for non-bridge PCI devices listed with scope bridge.
>
>Signed-off-by: jimyan <jimyan@baidu.com>

Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-07  1:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-05 13:57 [PATCH v2] iommu/vt-d: Don't reject nvme host due to scope mismatch jimyan
2020-01-05 13:57 ` jimyan
2020-01-07  1:57 ` Jerry Snitselaar
2020-01-07  1:57   ` Jerry Snitselaar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.