iommu/vt-d: Don't reject nvme host due to scope mismatch
PATCH 1/1 iommu/vt-d: Don't reject nvme host due to scope mismatch
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 0x600 ("PCI_CLASS_BRIDGE_HOST") as a heuristic for allowing DMAR initialization for non-bridge PCI devices listed with scope bridge.
--- drivers/iommu/dmar.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/dmar.c +1 -0
@@ -244,6 +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_HOST && info->dev->class >> 8 != PCI_CLASS_BRIDGE_OTHER))) {pr_warn ("Device scope type does not match for %s\n" ,pci_name (info->dev));
Signature · 6 lines
2.11.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 8 lines · 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):
Isn't that a problem to be fixed in the DMAR table then?
Quoted 37 lines
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 00VT-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
0x600("PCI_CLASS_BRIDGE_HOST") as a heuristic for allowing DMAR initialization for non-bridge PCI devices listed with scope bridge.Signed-off-by jimyan <[email protected]>---
drivers/iommu/dmar.c| 1 +1 file changed, 1 insertion(+)drivers/iommu/dmar.c +1
-0@@ -244,6 +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_HOST && info->dev->class >> 8 != PCI_CLASS_BRIDGE_OTHER))) {pr_warn ("Device scope type does not match for %s\n" ,pci_name (info->dev));Signature · 6 lines
2.11.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 51 lines
-----邮件原件-----
发件人: Jerry Snitselaar [mailto:[email protected]]
发送时间: 2019年12月20日 17:23
收件人: Jim,Yan <[email protected]>
抄送: [email protected]; [email protected]; [email protected] 主题: Re: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mismatchQuoted 8 lines · 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):Isn't that a problem to be fixed in the DMAR table then?
Quoted 32 lines
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 00VT-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
0x600("PCI_CLASS_BRIDGE_HOST") as a heuristic for allowing DMAR initialization for non-bridge PCI devices listed with scope bridge.Signed-off-by jimyan <[email protected]>---
drivers/iommu/dmar.c| 1 +1 file changed, 1 insertion(+)drivers/iommu/dmar.c index renamed from drivers/iommu/dmar.c +0
-0
eecd6a421667..9faf2f0e0237100644drivers/iommu/dmar.c +1
-1@@ -244,6 +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_HOST && info->dev->class >> 8 != PCI_CLASS_BRIDGE_OTHER))) {pr_warn ("Device scope type does not match for %s\n" ,pci_name (info->dev)); --2.11.0
Quoted 5 lines
Quoted 5 lines
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Actually this patch is similar to the commit: ffb2d1eb88c3("iommu/vt-d: Don't reject NTB devices due to scope mismatch"). Besides, modifying DMAR table need OEM update BIOS. It is hard to implement.
Jim
Quoted 53 lines
-----邮件原件-----
发件人: Jerry Snitselaar [mailto:[email protected]]
发送时间: 2019年12月20日 17:23
收件人: Jim,Yan <[email protected]>
抄送: [email protected]; [email protected]; [email protected]
主题: Re: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mismatchQuoted 8 lines · 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):Isn't that a problem to be fixed in the DMAR table then?
drivers/iommu/dmar.c int dmar_insert_dev_scope(struct
Quoted 22 lines
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 00VT-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
0x600("PCI_CLASS_BRIDGE_HOST") as a heuristic for allowing DMAR initialization for non-bridge PCI devices listed with scope bridge.Signed-off-by jimyan <[email protected]>---
drivers/iommu/dmar.c| 1 +1 file changed, 1 insertion(+)drivers/iommu/dmar.c index renamed from drivers/iommu/dmar.c +0
-0
eecd6a421667..9faf2f0e0237100644drivers/iommu/dmar.c +0
-0@@ -244,6 +244,7 @@ int dmar_insert_dev_scope(struct
dmar_pci_notify_info*info,Quoted 10 lines
drivers/iommu/dmar.c +1
-1info->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_HOST && info->dev->class >> 8 != PCI_CLASS_BRIDGE_OTHER))) {pr_warn ("Device scope type does not match for %s\n" ,pci_name (info->dev)); --2.11.0
Quoted 5 lines
Quoted 5 lines
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Actually this patch is similar to the commit: ffb2d1eb88c3("iommu/vt-d: Don't reject NTB devices due to scope mismatch"). Besides, modifying DMAR table need OEM update BIOS. It is hard to implement.
Jim
Hi,
Quoted 53 lines · Jim,Yan
Quoted 53 lines
-----邮件原件-----
发件人: Jerry Snitselaar [mailto:[email protected]]
发送时间: 2019年12月20日 17:23
收件人: Jim,Yan <[email protected]>
抄送: [email protected]; [email protected]; [email protected]
主题: Re: [PATCH] iommu/vt-d: Don't reject nvme host due to scope mismatchQuoted 8 lines · 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):Isn't that a problem to be fixed in the DMAR table then?
drivers/iommu/dmar.c int dmar_insert_dev_scope(struct
Quoted 22 lines
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 00VT-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
0x600("PCI_CLASS_BRIDGE_HOST") as a heuristic for allowing DMAR initialization for non-bridge PCI devices listed with scope bridge.Signed-off-by jimyan <[email protected]>---
drivers/iommu/dmar.c| 1 +1 file changed, 1 insertion(+)drivers/iommu/dmar.c index renamed from drivers/iommu/dmar.c +0
-0
eecd6a421667..9faf2f0e0237100644drivers/iommu/dmar.c +0
-0@@ -244,6 +244,7 @@ int dmar_insert_dev_scope(struct
dmar_pci_notify_info*info,Quoted 10 lines
drivers/iommu/dmar.c +1
-1info->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_HOST && info->dev->class >> 8 != PCI_CLASS_BRIDGE_OTHER))) {pr_warn ("Device scope type does not match for %s\n" ,pci_name (info->dev)); --2.11.0
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommuActually this patch is similar to the commit:
ffb2d1eb88c3("iommu/vt-d: Don't reject NTB devices due to scope mismatch"). Besides, modifying DMAR table need OEM update BIOS. It is hard to implement.
For both cases, a quirk flag seems to be more reasonable, so that unrelated devices will not be impacted.
Best regards,
baolu