mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-18 06:50:08 +00:00
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>
This commit is contained in:
parent
04e856c072
commit
3551a708f3
@ -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
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user