|
@@ -472,24 +472,23 @@ int __init dmar_table_init(void)
|
|
|
static int dmar_table_initialized;
|
|
|
int ret;
|
|
|
|
|
|
- if (dmar_table_initialized)
|
|
|
- return 0;
|
|
|
-
|
|
|
- dmar_table_initialized = 1;
|
|
|
-
|
|
|
- ret = parse_dmar_table();
|
|
|
- if (ret) {
|
|
|
- if (ret != -ENODEV)
|
|
|
- pr_info("parse DMAR table failure.\n");
|
|
|
- return ret;
|
|
|
- }
|
|
|
+ if (dmar_table_initialized == 0) {
|
|
|
+ ret = parse_dmar_table();
|
|
|
+ if (ret < 0) {
|
|
|
+ if (ret != -ENODEV)
|
|
|
+ pr_info("parse DMAR table failure.\n");
|
|
|
+ } else if (list_empty(&dmar_drhd_units)) {
|
|
|
+ pr_info("No DMAR devices found\n");
|
|
|
+ ret = -ENODEV;
|
|
|
+ }
|
|
|
|
|
|
- if (list_empty(&dmar_drhd_units)) {
|
|
|
- pr_info("No DMAR devices found\n");
|
|
|
- return -ENODEV;
|
|
|
+ if (ret < 0)
|
|
|
+ dmar_table_initialized = ret;
|
|
|
+ else
|
|
|
+ dmar_table_initialized = 1;
|
|
|
}
|
|
|
|
|
|
- return 0;
|
|
|
+ return dmar_table_initialized < 0 ? dmar_table_initialized : 0;
|
|
|
}
|
|
|
|
|
|
static void warn_invalid_dmar(u64 addr, const char *message)
|