aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2010-03-01 07:52:19 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2010-03-01 08:16:37 -0500
commit3551a708f35fc712af43aeb7f541512c5cfc4936 (patch)
tree8126147d8b522a99ff2ae6cc92268a5691565f21 /arch
parent04e856c072b84042bb56c487c2868638bb3f78db (diff)
x86/amd-iommu: Report errors in acpi parsing functions upstream
Since acpi_table_parse ignores the return values of the parsing function this patch introduces a workaround and reports these errors upstream via a global variable. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/amd_iommu_init.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 9dc91b431470..feaf47184900 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -138,9 +138,9 @@ int amd_iommus_present;
138bool amd_iommu_np_cache __read_mostly; 138bool amd_iommu_np_cache __read_mostly;
139 139
140/* 140/*
141 * Set to true if ACPI table parsing and hardware intialization went properly 141 * The ACPI table parsing functions set this variable on an error
142 */ 142 */
143static bool amd_iommu_initialized; 143static int __initdata amd_iommu_init_err;
144 144
145/* 145/*
146 * List of protection domains - used during resume 146 * List of protection domains - used during resume
@@ -391,9 +391,11 @@ static int __init find_last_devid_acpi(struct acpi_table_header *table)
391 */ 391 */
392 for (i = 0; i < table->length; ++i) 392 for (i = 0; i < table->length; ++i)
393 checksum += p[i]; 393 checksum += p[i];
394 if (checksum != 0) 394 if (checksum != 0) {
395 /* ACPI table corrupt */ 395 /* ACPI table corrupt */
396 return -ENODEV; 396 amd_iommu_init_err = -ENODEV;
397 return 0;
398 }
397 399
398 p += IVRS_HEADER_LENGTH; 400 p += IVRS_HEADER_LENGTH;
399 401
@@ -920,11 +922,16 @@ static int __init init_iommu_all(struct acpi_table_header *table)
920 h->mmio_phys); 922 h->mmio_phys);
921 923
922 iommu = kzalloc(sizeof(struct amd_iommu), GFP_KERNEL); 924 iommu = kzalloc(sizeof(struct amd_iommu), GFP_KERNEL);
923 if (iommu == NULL) 925 if (iommu == NULL) {
924 return -ENOMEM; 926 amd_iommu_init_err = -ENOMEM;
927 return 0;
928 }
929
925 ret = init_iommu_one(iommu, h); 930 ret = init_iommu_one(iommu, h);
926 if (ret) 931 if (ret) {
927 return ret; 932 amd_iommu_init_err = ret;
933 return 0;
934 }
928 break; 935 break;
929 default: 936 default:
930 break; 937 break;
@@ -934,8 +941,6 @@ static int __init init_iommu_all(struct acpi_table_header *table)
934 } 941 }
935 WARN_ON(p != end); 942 WARN_ON(p != end);
936 943
937 amd_iommu_initialized = true;
938
939 return 0; 944 return 0;
940} 945}
941 946
@@ -1211,6 +1216,10 @@ static int __init amd_iommu_init(void)
1211 if (acpi_table_parse("IVRS", find_last_devid_acpi) != 0) 1216 if (acpi_table_parse("IVRS", find_last_devid_acpi) != 0)
1212 return -ENODEV; 1217 return -ENODEV;
1213 1218
1219 ret = amd_iommu_init_err;
1220 if (ret)
1221 goto out;
1222
1214 dev_table_size = tbl_size(DEV_TABLE_ENTRY_SIZE); 1223 dev_table_size = tbl_size(DEV_TABLE_ENTRY_SIZE);
1215 alias_table_size = tbl_size(ALIAS_TABLE_ENTRY_SIZE); 1224 alias_table_size = tbl_size(ALIAS_TABLE_ENTRY_SIZE);
1216 rlookup_table_size = tbl_size(RLOOKUP_TABLE_ENTRY_SIZE); 1225 rlookup_table_size = tbl_size(RLOOKUP_TABLE_ENTRY_SIZE);
@@ -1270,12 +1279,19 @@ static int __init amd_iommu_init(void)
1270 if (acpi_table_parse("IVRS", init_iommu_all) != 0) 1279 if (acpi_table_parse("IVRS", init_iommu_all) != 0)
1271 goto free; 1280 goto free;
1272 1281
1273 if (!amd_iommu_initialized) 1282 if (amd_iommu_init_err) {
1283 ret = amd_iommu_init_err;
1274 goto free; 1284 goto free;
1285 }
1275 1286
1276 if (acpi_table_parse("IVRS", init_memory_definitions) != 0) 1287 if (acpi_table_parse("IVRS", init_memory_definitions) != 0)
1277 goto free; 1288 goto free;
1278 1289
1290 if (amd_iommu_init_err) {
1291 ret = amd_iommu_init_err;
1292 goto free;
1293 }
1294
1279 ret = sysdev_class_register(&amd_iommu_sysdev_class); 1295 ret = sysdev_class_register(&amd_iommu_sysdev_class);
1280 if (ret) 1296 if (ret)
1281 goto free; 1297 goto free;