Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 189941
b: refs/heads/master
c: 3551a70
h: refs/heads/master
i:
  189939: fcc6d47
v: v3
  • Loading branch information
Joerg Roedel committed Mar 1, 2010
1 parent 37d766d commit ca9af79
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 04e856c072b84042bb56c487c2868638bb3f78db
refs/heads/master: 3551a708f35fc712af43aeb7f541512c5cfc4936
38 changes: 27 additions & 11 deletions trunk/arch/x86/kernel/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ int amd_iommus_present;
bool amd_iommu_np_cache __read_mostly;

/*
* Set to true if ACPI table parsing and hardware intialization went properly
* The ACPI table parsing functions set this variable on an error
*/
static bool amd_iommu_initialized;
static int __initdata amd_iommu_init_err;

/*
* List of protection domains - used during resume
Expand Down Expand Up @@ -391,9 +391,11 @@ static int __init find_last_devid_acpi(struct acpi_table_header *table)
*/
for (i = 0; i < table->length; ++i)
checksum += p[i];
if (checksum != 0)
if (checksum != 0) {
/* ACPI table corrupt */
return -ENODEV;
amd_iommu_init_err = -ENODEV;
return 0;
}

p += IVRS_HEADER_LENGTH;

Expand Down Expand Up @@ -920,11 +922,16 @@ static int __init init_iommu_all(struct acpi_table_header *table)
h->mmio_phys);

iommu = kzalloc(sizeof(struct amd_iommu), GFP_KERNEL);
if (iommu == NULL)
return -ENOMEM;
if (iommu == NULL) {
amd_iommu_init_err = -ENOMEM;
return 0;
}

ret = init_iommu_one(iommu, h);
if (ret)
return ret;
if (ret) {
amd_iommu_init_err = ret;
return 0;
}
break;
default:
break;
Expand All @@ -934,8 +941,6 @@ static int __init init_iommu_all(struct acpi_table_header *table)
}
WARN_ON(p != end);

amd_iommu_initialized = true;

return 0;
}

Expand Down Expand Up @@ -1211,6 +1216,10 @@ static int __init amd_iommu_init(void)
if (acpi_table_parse("IVRS", find_last_devid_acpi) != 0)
return -ENODEV;

ret = amd_iommu_init_err;
if (ret)
goto out;

dev_table_size = tbl_size(DEV_TABLE_ENTRY_SIZE);
alias_table_size = tbl_size(ALIAS_TABLE_ENTRY_SIZE);
rlookup_table_size = tbl_size(RLOOKUP_TABLE_ENTRY_SIZE);
Expand Down Expand Up @@ -1270,12 +1279,19 @@ static int __init amd_iommu_init(void)
if (acpi_table_parse("IVRS", init_iommu_all) != 0)
goto free;

if (!amd_iommu_initialized)
if (amd_iommu_init_err) {
ret = amd_iommu_init_err;
goto free;
}

if (acpi_table_parse("IVRS", init_memory_definitions) != 0)
goto free;

if (amd_iommu_init_err) {
ret = amd_iommu_init_err;
goto free;
}

ret = sysdev_class_register(&amd_iommu_sysdev_class);
if (ret)
goto free;
Expand Down

0 comments on commit ca9af79

Please sign in to comment.