Skip to contentSkip to conversation

iommu/amd: Increase interrupt remapping table limit to 512 entries

PATCH In review Suravee Suthikulpanit 3 participants 5 messages Oct 15, 2020 – Dec 7, 2020

Subsystems (2)
lore
Share & tools
lore

Suravee Suthikulpanit

author reviewer
#0 lore raw

PATCH 1/1 iommu/amd: Increase interrupt remapping table limit to 512 entries

Certain device drivers allocate IO queues on a per-cpu basis. On AMD EPYC platform, which can support up-to 256 cpu threads, this can exceed the current MAX_IRQ_PER_TABLE limit of 256, and result in the error message:

AMD-Vi: Failed to allocate IRTE

This has been observed with certain NVME devices.

AMD IOMMU hardware can actually support upto 512 interrupt remapping table entries. Therefore, update the driver to match the hardware limit.

Please note that this also increases the size of interrupt remapping table to 8KB per device when using the 128-bit IRTE format.

---
 drivers/iommu/amd/amd_iommu_types.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/amd/amd_iommu_types.h +5 -1
index 30a5d412255a..427484c45589 100644
@@ -406,7 +406,11 @@ extern bool amd_iommu_np_cache;
 /* Only true if all IOMMUs support device IOTLBs */
 extern bool amd_iommu_iotlb_sup;
 
-#define MAX_IRQS_PER_TABLE	256
+/*
+ * AMD IOMMU hardware only support 512 IRTEs despite
+ * the architectural limitation of 2048 entries.
+ */
+#define MAX_IRQS_PER_TABLE	512
 #define IRQ_TABLE_ALIGNMENT	128
 
 struct irq_remap_table {
Signature · 1 line
2.17.1
author reviewer
#1 lore raw

Hi Joerg,

Do you have any concerns regarding this patch?

Thanks,
Suravee

Quoted 39 lines · Suravee Suthikulpanit

Certain device drivers allocate IO queues on a per-cpu basis. On AMD EPYC platform, which can support up-to 256 cpu threads, this can exceed the current MAX_IRQ_PER_TABLE limit of 256, and result in the error message:

AMD-Vi: Failed to allocate IRTE

This has been observed with certain NVME devices.

AMD IOMMU hardware can actually support upto 512 interrupt remapping table entries. Therefore, update the driver to match the hardware limit.

Please note that this also increases the size of interrupt remapping table to 8KB per device when using the 128-bit IRTE format.

---
  drivers/iommu/amd/amd_iommu_types.h | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/amd/amd_iommu_types.h +5 -1
index 30a5d412255a..427484c45589 100644
@@ -406,7 +406,11 @@ extern bool amd_iommu_np_cache;
  /* Only true if all IOMMUs support device IOTLBs */
  extern bool amd_iommu_iotlb_sup;
 
-#define MAX_IRQS_PER_TABLE	256
+/*
+ * AMD IOMMU hardware only support 512 IRTEs despite
+ * the architectural limitation of 2048 entries.
+ */
+#define MAX_IRQS_PER_TABLE	512
  #define IRQ_TABLE_ALIGNMENT	128
 
  struct irq_remap_table {
maintainer
#2 lore raw
In reply to Suravee Suthikulpanit
Quoted 13 lines · Suravee Suthikulpanit

Certain device drivers allocate IO queues on a per-cpu basis. On AMD EPYC platform, which can support up-to 256 cpu threads, this can exceed the current MAX_IRQ_PER_TABLE limit of 256, and result in the error message:

AMD-Vi: Failed to allocate IRTE

This has been observed with certain NVME devices.

AMD IOMMU hardware can actually support upto 512 interrupt remapping table entries. Therefore, update the driver to match the hardware limit.

Quoted 7 lines

Please note that this also increases the size of interrupt remapping table to 8KB per device when using the 128-bit IRTE format.

---
 drivers/iommu/amd/amd_iommu_types.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Applied for 5.10, thanks.

#3 lore raw
In reply to Suravee Suthikulpanit

Suravee Suthikulpanit @ 2020-10-14 19:50 MST:

Quoted 28 lines

Certain device drivers allocate IO queues on a per-cpu basis. On AMD EPYC platform, which can support up-to 256 cpu threads, this can exceed the current MAX_IRQ_PER_TABLE limit of 256, and result in the error message:

AMD-Vi: Failed to allocate IRTE

This has been observed with certain NVME devices.

AMD IOMMU hardware can actually support upto 512 interrupt remapping table entries. Therefore, update the driver to match the hardware limit.

Please note that this also increases the size of interrupt remapping table to 8KB per device when using the 128-bit IRTE format.

---
 drivers/iommu/amd/amd_iommu_types.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/amd/amd_iommu_types.h +0 -0
index 30a5d412255a..427484c45589 100644
@@ -406,7 +406,11 @@ extern bool amd_iommu_np_cache;
 /* Only true if all IOMMUs support device IOTLBs */
 extern bool amd_iommu_iotlb_sup;

drivers/iommu/amd/amd_iommu_types.h extern bool amd_iommu_np_cache; · line 416

Quoted 10 lines
drivers/iommu/amd/amd_iommu_types.h +5 -1
 
-#define MAX_IRQS_PER_TABLE	256
+/*
+ * AMD IOMMU hardware only support 512 IRTEs despite
+ * the architectural limitation of 2048 entries.
+ */
+#define MAX_IRQS_PER_TABLE	512
 #define IRQ_TABLE_ALIGNMENT	128
 
 struct irq_remap_table {

With this change should DTE_IRQ_TABLE_LEN be changed to 9? IIUC the spec correctly leaving it at 8 is saying the table is 256 entries long.

Regards,
Jerry

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

author reviewer
#4 lore raw

Jerry,

Quoted 40 lines · Jerry Snitselaar

Suravee Suthikulpanit @ 2020-10-14 19:50 MST:

Quoted 37 lines

Certain device drivers allocate IO queues on a per-cpu basis. On AMD EPYC platform, which can support up-to 256 cpu threads, this can exceed the current MAX_IRQ_PER_TABLE limit of 256, and result in the error message:

AMD-Vi: Failed to allocate IRTE

This has been observed with certain NVME devices.

AMD IOMMU hardware can actually support upto 512 interrupt remapping table entries. Therefore, update the driver to match the hardware limit.

Please note that this also increases the size of interrupt remapping table to 8KB per device when using the 128-bit IRTE format.

---
  drivers/iommu/amd/amd_iommu_types.h | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/amd/amd_iommu_types.h +5 -1
index 30a5d412255a..427484c45589 100644
@@ -406,7 +406,11 @@ extern bool amd_iommu_np_cache;
  /* Only true if all IOMMUs support device IOTLBs */
  extern bool amd_iommu_iotlb_sup;
 
-#define MAX_IRQS_PER_TABLE	256
+/*
+ * AMD IOMMU hardware only support 512 IRTEs despite
+ * the architectural limitation of 2048 entries.
+ */
+#define MAX_IRQS_PER_TABLE	512
  #define IRQ_TABLE_ALIGNMENT	128
 
Quoted 4 lines

drivers/iommu/amd/amd_iommu_types.h extern bool amd_iommu_np_cache; · line 416

Quoted 1 line
drivers/iommu/amd/amd_iommu_types.h +0 -0
  struct irq_remap_table {

With this change should DTE_IRQ_TABLE_LEN be changed to 9? IIUC the spec correctly leaving it at 8 is saying the table is 256 entries long.

You are correct. Sorry I missed this part. I'll send the fix-up patch ASAP.

Thank you,
Suravee