aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-05-30 20:14:44 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-31 18:18:52 -0400
commit47d68c7f688c01557cb67dd80eb540e88d7913b6 (patch)
treebc1415fd1b1ead6a1fe0818458f890ebed2ec4e1
parent2947c1d5f72b77078aeb3df05d4298274234534d (diff)
ACPICA: Tables: Add mechanism to control early table checksum verification.
It is reported that Linux x86 kernel cannot map large tables. The following large SSDT table on such platform fails to pass checksum verification and cannot be installed: ACPI: SSDT 0x00000000B9638018 07A0C4 (v02 INTEL S2600CP 00004000 INTL 20100331) It sounds strange that in the 64-bit virtual memory address space, we cannot map a single ACPI table to do checksum verification. The root cause is: 1. ACPICA doesn't split IO memory mapping and table mapping; 2. Linux x86 OSL implements acpi_os_map_memory() using a size limited fix-map mechanism during early boot stage, which is more suitable for only IO mappings. ACPICA originally only mapped table header for signature validation, and this header mapping is required by OSL override mechanism. There was no checksum verification because we could not map the whole table using this OSL. While the following ACPICA commit enforces checksum verification by mapping the whole table during Linux boot stage and it finally triggers this issue on some platforms: Commit: 86dfc6f339886559d80ee0d4bd20fe5ee90450f0 Subject: ACPICA: Tables: Fix table checksums verification before installation. Before doing further cleanups for the OSL table mapping and override implementation, this patch introduces an option for such OSPMs to temporarily discard the checksum verification feature. It then can be re-enabled easily when the ACPICA and the underlying OSL is ready. This patch also deletes a comment around the limitation of mappings because it is not correct. The limitation is not how many times we can map in the early stage, but the OSL mapping facility may not be suitable for mapping the ACPI tables and thus may complain us the size limitation. The acpi_tb_verify_table() is renamed to acpi_tb_verify_temp_table() due to the work around added, it now only applies to the table descriptor that hasn't been installed and cannot be used in other cases. Lv Zheng. Tested-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/actables.h8
-rw-r--r--drivers/acpi/acpica/tbdata.c67
-rw-r--r--drivers/acpi/acpica/tbinstal.c8
-rw-r--r--drivers/acpi/acpica/tbutils.c4
-rw-r--r--include/acpi/acpixf.h9
5 files changed, 70 insertions, 26 deletions
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index bda9a7eb50c1..f14882788eee 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -69,6 +69,11 @@ acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc,
69 69
70void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc); 70void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc);
71 71
72acpi_status acpi_tb_validate_temp_table(struct acpi_table_desc *table_desc);
73
74acpi_status
75acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature);
76
72u8 acpi_tb_is_table_loaded(u32 table_index); 77u8 acpi_tb_is_table_loaded(u32 table_index);
73 78
74void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded); 79void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded);
@@ -96,9 +101,6 @@ acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc);
96 101
97void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc); 102void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc);
98 103
99acpi_status
100acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature);
101
102void acpi_tb_override_table(struct acpi_table_desc *old_table_desc); 104void acpi_tb_override_table(struct acpi_table_desc *old_table_desc);
103 105
104acpi_status 106acpi_status
diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c
index cbe29944dc97..f499c10ceb4a 100644
--- a/drivers/acpi/acpica/tbdata.c
+++ b/drivers/acpi/acpica/tbdata.c
@@ -322,7 +322,39 @@ void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc)
322 322
323/****************************************************************************** 323/******************************************************************************
324 * 324 *
325 * FUNCTION: acpi_tb_verify_table 325 * FUNCTION: acpi_tb_validate_temp_table
326 *
327 * PARAMETERS: table_desc - Table descriptor
328 *
329 * RETURN: Status
330 *
331 * DESCRIPTION: This function is called to validate the table, the returned
332 * table descriptor is in "VALIDATED" state.
333 *
334 *****************************************************************************/
335
336acpi_status acpi_tb_validate_temp_table(struct acpi_table_desc *table_desc)
337{
338
339 if (!table_desc->pointer && !acpi_gbl_verify_table_checksum) {
340 /*
341 * Only validates the header of the table.
342 * Note that Length contains the size of the mapping after invoking
343 * this work around, this value is required by
344 * acpi_tb_release_temp_table().
345 * We can do this because in acpi_init_table_descriptor(), the Length
346 * field of the installed descriptor is filled with the actual
347 * table length obtaining from the table header.
348 */
349 table_desc->length = sizeof(struct acpi_table_header);
350 }
351
352 return (acpi_tb_validate_table(table_desc));
353}
354
355/******************************************************************************
356 *
357 * FUNCTION: acpi_tb_verify_temp_table
326 * 358 *
327 * PARAMETERS: table_desc - Table descriptor 359 * PARAMETERS: table_desc - Table descriptor
328 * signature - Table signature to verify 360 * signature - Table signature to verify
@@ -335,15 +367,15 @@ void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc)
335 *****************************************************************************/ 367 *****************************************************************************/
336 368
337acpi_status 369acpi_status
338acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature) 370acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature)
339{ 371{
340 acpi_status status = AE_OK; 372 acpi_status status = AE_OK;
341 373
342 ACPI_FUNCTION_TRACE(tb_verify_table); 374 ACPI_FUNCTION_TRACE(tb_verify_temp_table);
343 375
344 /* Validate the table */ 376 /* Validate the table */
345 377
346 status = acpi_tb_validate_table(table_desc); 378 status = acpi_tb_validate_temp_table(table_desc);
347 if (ACPI_FAILURE(status)) { 379 if (ACPI_FAILURE(status)) {
348 return_ACPI_STATUS(AE_NO_MEMORY); 380 return_ACPI_STATUS(AE_NO_MEMORY);
349 } 381 }
@@ -360,17 +392,22 @@ acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature)
360 392
361 /* Verify the checksum */ 393 /* Verify the checksum */
362 394
363 status = 395 if (acpi_gbl_verify_table_checksum) {
364 acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); 396 status =
365 if (ACPI_FAILURE(status)) { 397 acpi_tb_verify_checksum(table_desc->pointer,
366 ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, 398 table_desc->length);
367 "%4.4s " ACPI_PRINTF_UINT 399 if (ACPI_FAILURE(status)) {
368 " Attempted table install failed", 400 ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY,
369 acpi_ut_valid_acpi_name(table_desc->signature. 401 "%4.4s " ACPI_PRINTF_UINT
370 ascii) ? table_desc-> 402 " Attempted table install failed",
371 signature.ascii : "????", 403 acpi_ut_valid_acpi_name(table_desc->
372 ACPI_FORMAT_TO_UINT(table_desc->address))); 404 signature.
373 goto invalidate_and_exit; 405 ascii) ?
406 table_desc->signature.ascii : "????",
407 ACPI_FORMAT_TO_UINT(table_desc->
408 address)));
409 goto invalidate_and_exit;
410 }
374 } 411 }
375 412
376 return_ACPI_STATUS(AE_OK); 413 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index d4d6029fef44..755b90c40ddf 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -194,7 +194,7 @@ acpi_tb_install_fixed_table(acpi_physical_address address,
194 194
195 /* Validate and verify a table before installation */ 195 /* Validate and verify a table before installation */
196 196
197 status = acpi_tb_verify_table(&new_table_desc, signature); 197 status = acpi_tb_verify_temp_table(&new_table_desc, signature);
198 if (ACPI_FAILURE(status)) { 198 if (ACPI_FAILURE(status)) {
199 goto release_and_exit; 199 goto release_and_exit;
200 } 200 }
@@ -266,7 +266,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,
266 266
267 /* Validate and verify a table before installation */ 267 /* Validate and verify a table before installation */
268 268
269 status = acpi_tb_verify_table(&new_table_desc, NULL); 269 status = acpi_tb_verify_temp_table(&new_table_desc, NULL);
270 if (ACPI_FAILURE(status)) { 270 if (ACPI_FAILURE(status)) {
271 goto release_and_exit; 271 goto release_and_exit;
272 } 272 }
@@ -424,7 +424,7 @@ finish_override:
424 424
425 /* Validate and verify a table before overriding */ 425 /* Validate and verify a table before overriding */
426 426
427 status = acpi_tb_verify_table(&new_table_desc, NULL); 427 status = acpi_tb_verify_temp_table(&new_table_desc, NULL);
428 if (ACPI_FAILURE(status)) { 428 if (ACPI_FAILURE(status)) {
429 return; 429 return;
430 } 430 }
@@ -446,7 +446,7 @@ finish_override:
446 acpi_tb_init_table_descriptor(old_table_desc, new_table_desc.address, 446 acpi_tb_init_table_descriptor(old_table_desc, new_table_desc.address,
447 new_table_desc.flags, 447 new_table_desc.flags,
448 new_table_desc.pointer); 448 new_table_desc.pointer);
449 acpi_tb_validate_table(old_table_desc); 449 acpi_tb_validate_temp_table(old_table_desc);
450 450
451 /* Release the temporary table descriptor */ 451 /* Release the temporary table descriptor */
452 452
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index e37a103013a4..6b1ca9991b90 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -395,10 +395,6 @@ next_table:
395 table_entry += table_entry_size; 395 table_entry += table_entry_size;
396 } 396 }
397 397
398 /*
399 * It is not possible to map more than one entry in some environments,
400 * so unmap the root table here before mapping other tables
401 */
402 acpi_os_unmap_memory(table, length); 398 acpi_os_unmap_memory(table, length);
403 399
404 return_ACPI_STATUS(AE_OK); 400 return_ACPI_STATUS(AE_OK);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index b5f7132f431f..35b525c19711 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -162,6 +162,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);
162ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE); 162ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE);
163 163
164/* 164/*
165 * Whether or not to verify the table checksum before installation. Set
166 * this to TRUE to verify the table checksum before install it to the table
167 * manager. Note that enabling this option causes errors to happen in some
168 * OSPMs during early initialization stages. Default behavior is to do such
169 * verification.
170 */
171ACPI_INIT_GLOBAL(u8, acpi_gbl_verify_table_checksum, TRUE);
172
173/*
165 * Optionally enable output from the AML Debug Object. 174 * Optionally enable output from the AML Debug Object.
166 */ 175 */
167ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE); 176ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE);