]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Suresh Siddha <suresh.b.siddha@intel.com> |
2 | Subject: x64, x2apic/intr-remap: use CONFIG_DMAR for DMA-remapping specific code | |
3 | References: fate #303948 and fate #303984 | |
4 | Patch-Mainline: queued for .28 | |
5 | Commit-ID: aaa9d1dd63bf89b62f4ea9f46de376ab1a3fbc6c | |
6 | ||
7 | Signed-off-by: Thomas Renninger <trenn@suse.de> | |
8 | ||
9 | DMA remapping specific code covered with CONFIG_DMAR in | |
10 | the generic code which will also be used later for enabling Interrupt-remapping. | |
11 | ||
12 | Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> | |
13 | Cc: akpm@linux-foundation.org | |
14 | Cc: arjan@linux.intel.com | |
15 | Cc: andi@firstfloor.org | |
16 | Cc: ebiederm@xmission.com | |
17 | Cc: jbarnes@virtuousgeek.org | |
18 | Cc: steiner@sgi.com | |
19 | Signed-off-by: Ingo Molnar <mingo@elte.hu> | |
20 | ||
21 | --- | |
22 | drivers/pci/dmar.c | 39 +++++++++++++++++++++++++++------------ | |
23 | 1 file changed, 27 insertions(+), 12 deletions(-) | |
24 | ||
25 | Index: linux-2.6.26/drivers/pci/dmar.c | |
26 | =================================================================== | |
27 | --- linux-2.6.26.orig/drivers/pci/dmar.c | |
28 | +++ linux-2.6.26/drivers/pci/dmar.c | |
29 | @@ -39,7 +39,6 @@ | |
30 | * these units are not supported by the architecture. | |
31 | */ | |
32 | LIST_HEAD(dmar_drhd_units); | |
33 | -LIST_HEAD(dmar_rmrr_units); | |
34 | ||
35 | static struct acpi_table_header * __initdata dmar_tbl; | |
36 | ||
37 | @@ -55,11 +54,6 @@ static void __init dmar_register_drhd_un | |
38 | list_add(&drhd->list, &dmar_drhd_units); | |
39 | } | |
40 | ||
41 | -static void __init dmar_register_rmrr_unit(struct dmar_rmrr_unit *rmrr) | |
42 | -{ | |
43 | - list_add(&rmrr->list, &dmar_rmrr_units); | |
44 | -} | |
45 | - | |
46 | static int __init dmar_parse_one_dev_scope(struct acpi_dmar_device_scope *scope, | |
47 | struct pci_dev **dev, u16 segment) | |
48 | { | |
49 | @@ -224,6 +218,15 @@ dmar_parse_dev(struct dmar_drhd_unit *dm | |
50 | return ret; | |
51 | } | |
52 | ||
53 | +#ifdef CONFIG_DMAR | |
54 | +LIST_HEAD(dmar_rmrr_units); | |
55 | + | |
56 | +static void __init dmar_register_rmrr_unit(struct dmar_rmrr_unit *rmrr) | |
57 | +{ | |
58 | + list_add(&rmrr->list, &dmar_rmrr_units); | |
59 | +} | |
60 | + | |
61 | + | |
62 | static int __init | |
63 | dmar_parse_one_rmrr(struct acpi_dmar_header *header) | |
64 | { | |
65 | @@ -260,6 +263,7 @@ rmrr_parse_dev(struct dmar_rmrr_unit *rm | |
66 | } | |
67 | return ret; | |
68 | } | |
69 | +#endif | |
70 | ||
71 | static void __init | |
72 | dmar_table_print_dmar_entry(struct acpi_dmar_header *header) | |
73 | @@ -284,6 +288,7 @@ dmar_table_print_dmar_entry(struct acpi_ | |
74 | } | |
75 | } | |
76 | ||
77 | + | |
78 | /** | |
79 | * parse_dmar_table - parses the DMA reporting table | |
80 | */ | |
81 | @@ -316,7 +321,9 @@ parse_dmar_table(void) | |
82 | ret = dmar_parse_one_drhd(entry_header); | |
83 | break; | |
84 | case ACPI_DMAR_TYPE_RESERVED_MEMORY: | |
85 | +#ifdef CONFIG_DMAR | |
86 | ret = dmar_parse_one_rmrr(entry_header); | |
87 | +#endif | |
88 | break; | |
89 | default: | |
90 | printk(KERN_WARNING PREFIX | |
91 | @@ -366,7 +373,6 @@ dmar_find_matched_drhd_unit(struct pci_d | |
92 | int __init dmar_dev_scope_init(void) | |
93 | { | |
94 | struct dmar_drhd_unit *drhd; | |
95 | - struct dmar_rmrr_unit *rmrr; | |
96 | int ret = -ENODEV; | |
97 | ||
98 | for_each_drhd_unit(drhd) { | |
99 | @@ -375,11 +381,16 @@ int __init dmar_dev_scope_init(void) | |
100 | return ret; | |
101 | } | |
102 | ||
103 | - for_each_rmrr_units(rmrr) { | |
104 | - ret = rmrr_parse_dev(rmrr); | |
105 | - if (ret) | |
106 | - return ret; | |
107 | +#ifdef CONFIG_DMAR | |
108 | + { | |
109 | + struct dmar_rmrr_unit *rmrr; | |
110 | + for_each_rmrr_units(rmrr) { | |
111 | + ret = rmrr_parse_dev(rmrr); | |
112 | + if (ret) | |
113 | + return ret; | |
114 | + } | |
115 | } | |
116 | +#endif | |
117 | ||
118 | return ret; | |
119 | } | |
120 | @@ -407,8 +418,12 @@ int __init dmar_table_init(void) | |
121 | return -ENODEV; | |
122 | } | |
123 | ||
124 | - if (list_empty(&dmar_rmrr_units)) | |
125 | +#ifdef CONFIG_DMAR | |
126 | + if (list_empty(&dmar_rmrr_units)) { | |
127 | printk(KERN_INFO PREFIX "No RMRR found\n"); | |
128 | + return -ENODEV; | |
129 | + } | |
130 | +#endif | |
131 | ||
132 | return 0; | |
133 | } |