Skip to contentSkip to conversation

amd_iommu: IO_PAGE_FAULTs on unity mapped regions during amd_iommu_init()

PATCH In review Shuah Khan 4 participants 5 messages Feb 7, 2013 – Feb 26, 2013 1 message not in the archive x86

lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

PATCH 1/1 amd_iommu: IO_PAGE_FAULTs on unity mapped regions during amd_iommu_init()

When dma_ops are initialized the unity mappings are created. The init_device_table_dma() function makes sure DMA from all devices is blocked by default. This opens a short window in time where DMA to unity mapped regions is blocked by the IOMMU. Make sure this does not happen by initializing the device table after dma_ops.

Reference: http://www.gossamer-threads.com/lists/linux/kernel/1670769

---
 arch/x86/kernel/amd_iommu_init.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/kernel/amd_iommu_init.c +7 -3
index 33df6e8..d86aa3f 100644
@@ -1363,6 +1363,7 @@ static struct syscore_ops amd_iommu_syscore_ops = {
  */
 static int __init amd_iommu_init(void)
 {
+	struct amd_iommu *iommu;
 	int i, ret = 0;
 
 	/*
@@ -1411,9 +1412,6 @@ static int __init amd_iommu_init(void)
 	if (amd_iommu_pd_alloc_bitmap == NULL)
 		goto free;
 
-	/* init the device table */
-	init_device_table();
-
 	/*
 	 * let all alias entries point to itself
 	 */
@@ -1463,6 +1461,12 @@ static int __init amd_iommu_init(void)
 	if (ret)
 		goto free_disable;
 
+	/* init the device table */
+	init_device_table();
+
+	for_each_iommu(iommu)
+		iommu_flush_all_caches(iommu);
+
 	amd_iommu_init_api();
 
 	amd_iommu_init_notifier();
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 6 lines · Shuah Khan

When dma_ops are initialized the unity mappings are created. The init_device_table_dma() function makes sure DMA from all devices is blocked by default. This opens a short window in time where DMA to unity mapped regions is blocked by the IOMMU. Make sure this does not happen by initializing the device table after dma_ops.

Quoted 7 lines

Reference: http://www.gossamer-threads.com/lists/linux/kernel/1670769

---
 arch/x86/kernel/amd_iommu_init.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

That file does not exist anymore, it died 2.5+ years ago:

403f81d8ee53 iommu/amd: Move missing parts to drivers/iommu

Thanks,

Ingo

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 8 lines · Ingo Molnar
Quoted 2 lines · Shuah Khan
 arch/x86/kernel/amd_iommu_init.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

That file does not exist anymore, it died 2.5+ years ago:

403f81d8ee53 iommu/amd: Move missing parts to drivers/iommu

Right, the file was moved for Linux v3.1 AFAIR. But this patch is a stable-packport for v3.0 of a patch I sent yersterday :)

Joerg

#4 lore raw

PATCH 1/1 amd_iommu: IO_PAGE_FAULTs on unity mapped regions during amd_iommu_init()

Quoted 6 lines · Joerg Roedel
Quoted 5 lines · Ingo Molnar
Quoted 2 lines · Shuah Khan
 arch/x86/kernel/amd_iommu_init.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Quoted 6 lines
Quoted 3 lines

That file does not exist anymore, it died 2.5+ years ago:

403f81d8ee53 iommu/amd: Move missing parts to drivers/iommu

Right, the file was moved for Linux v3.1 AFAIR. But this patch is a stable-packport for v3.0 of a patch I sent yersterday :)

I changed the title accordingly.

Thanks,

Ingo

author
#5 lore raw

PATCH 1/1 iommu/amd: Initialize device table after dma_ops

When dma_ops are initialized the unity mappings are created. The init_device_table_dma() function makes sure DMA from all devices is blocked by default. This opens a short window in time where DMA to unity mapped regions is blocked by the IOMMU. Make sure this does not happen by initializing the device table after dma_ops.

Back-port upstream commit: f528d980c17b8714aedc918ba86e058af914d66b

---
 arch/x86/kernel/amd_iommu_init.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/kernel/amd_iommu_init.c +7 -3
index 33df6e8..d86aa3f 100644
@@ -1363,6 +1363,7 @@ static struct syscore_ops amd_iommu_syscore_ops = {
  */
 static int __init amd_iommu_init(void)
 {
+	struct amd_iommu *iommu;
 	int i, ret = 0;
 
 	/*
@@ -1411,9 +1412,6 @@ static int __init amd_iommu_init(void)
 	if (amd_iommu_pd_alloc_bitmap == NULL)
 		goto free;
 
-	/* init the device table */
-	init_device_table();
-
 	/*
 	 * let all alias entries point to itself
 	 */
@@ -1463,6 +1461,12 @@ static int __init amd_iommu_init(void)
 	if (ret)
 		goto free_disable;
 
+	/* init the device table */
+	init_device_table();
+
+	for_each_iommu(iommu)
+		iommu_flush_all_caches(iommu);
+
 	amd_iommu_init_api();
 
 	amd_iommu_init_notifier();
Signature · 1 line
1.7.9.5