]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.0.68/iommu-amd-initialize-device-table-after-dma_ops.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.0.68 / iommu-amd-initialize-device-table-after-dma_ops.patch
1 From f528d980c17b8714aedc918ba86e058af914d66b Mon Sep 17 00:00:00 2001
2 From: Joerg Roedel <joro@8bytes.org>
3 Date: Wed, 6 Feb 2013 12:55:23 +0100
4 Subject: iommu/amd: Initialize device table after dma_ops
5
6 From: Joerg Roedel <joro@8bytes.org>
7
8 commit f528d980c17b8714aedc918ba86e058af914d66b upstream.
9
10 When dma_ops are initialized the unity mappings are
11 created. The init_device_table_dma() function makes sure DMA
12 from all devices is blocked by default. This opens a short
13 window in time where DMA to unity mapped regions is blocked
14 by the IOMMU. Make sure this does not happen by initializing
15 the device table after dma_ops.
16
17 Signed-off-by: Joerg Roedel <joro@8bytes.org>
18 Signed-off-by: Shuah Khan <shuah.khan@hp.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 arch/x86/kernel/amd_iommu_init.c | 10 +++++++---
23 1 file changed, 7 insertions(+), 3 deletions(-)
24
25 --- a/arch/x86/kernel/amd_iommu_init.c
26 +++ b/arch/x86/kernel/amd_iommu_init.c
27 @@ -1363,6 +1363,7 @@ static struct syscore_ops amd_iommu_sysc
28 */
29 static int __init amd_iommu_init(void)
30 {
31 + struct amd_iommu *iommu;
32 int i, ret = 0;
33
34 /*
35 @@ -1411,9 +1412,6 @@ static int __init amd_iommu_init(void)
36 if (amd_iommu_pd_alloc_bitmap == NULL)
37 goto free;
38
39 - /* init the device table */
40 - init_device_table();
41 -
42 /*
43 * let all alias entries point to itself
44 */
45 @@ -1463,6 +1461,12 @@ static int __init amd_iommu_init(void)
46 if (ret)
47 goto free_disable;
48
49 + /* init the device table */
50 + init_device_table();
51 +
52 + for_each_iommu(iommu)
53 + iommu_flush_all_caches(iommu);
54 +
55 amd_iommu_init_api();
56
57 amd_iommu_init_notifier();