Commit 47d68c7f authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki

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: 86dfc6f3
 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: default avatarYuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 2947c1d5
...@@ -69,6 +69,11 @@ acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc, ...@@ -69,6 +69,11 @@ acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc,
void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc); void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc);
acpi_status acpi_tb_validate_temp_table(struct acpi_table_desc *table_desc);
acpi_status
acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature);
u8 acpi_tb_is_table_loaded(u32 table_index); u8 acpi_tb_is_table_loaded(u32 table_index);
void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded); void 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,9 +101,6 @@ acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc);
void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc); void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc);
acpi_status
acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature);
void acpi_tb_override_table(struct acpi_table_desc *old_table_desc); void acpi_tb_override_table(struct acpi_table_desc *old_table_desc);
acpi_status acpi_status
......
...@@ -322,7 +322,39 @@ void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc) ...@@ -322,7 +322,39 @@ void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc)
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: acpi_tb_verify_table * FUNCTION: acpi_tb_validate_temp_table
*
* PARAMETERS: table_desc - Table descriptor
*
* RETURN: Status
*
* DESCRIPTION: This function is called to validate the table, the returned
* table descriptor is in "VALIDATED" state.
*
*****************************************************************************/
acpi_status acpi_tb_validate_temp_table(struct acpi_table_desc *table_desc)
{
if (!table_desc->pointer && !acpi_gbl_verify_table_checksum) {
/*
* Only validates the header of the table.
* Note that Length contains the size of the mapping after invoking
* this work around, this value is required by
* acpi_tb_release_temp_table().
* We can do this because in acpi_init_table_descriptor(), the Length
* field of the installed descriptor is filled with the actual
* table length obtaining from the table header.
*/
table_desc->length = sizeof(struct acpi_table_header);
}
return (acpi_tb_validate_table(table_desc));
}
/******************************************************************************
*
* FUNCTION: acpi_tb_verify_temp_table
* *
* PARAMETERS: table_desc - Table descriptor * PARAMETERS: table_desc - Table descriptor
* signature - Table signature to verify * signature - Table signature to verify
...@@ -335,15 +367,15 @@ void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc) ...@@ -335,15 +367,15 @@ void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc)
*****************************************************************************/ *****************************************************************************/
acpi_status acpi_status
acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature) acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE(tb_verify_table); ACPI_FUNCTION_TRACE(tb_verify_temp_table);
/* Validate the table */ /* Validate the table */
status = acpi_tb_validate_table(table_desc); status = acpi_tb_validate_temp_table(table_desc);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
...@@ -360,17 +392,22 @@ acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature) ...@@ -360,17 +392,22 @@ acpi_tb_verify_table(struct acpi_table_desc *table_desc, char *signature)
/* Verify the checksum */ /* Verify the checksum */
status = if (acpi_gbl_verify_table_checksum) {
acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); status =
if (ACPI_FAILURE(status)) { acpi_tb_verify_checksum(table_desc->pointer,
ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, table_desc->length);
"%4.4s " ACPI_PRINTF_UINT if (ACPI_FAILURE(status)) {
" Attempted table install failed", ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY,
acpi_ut_valid_acpi_name(table_desc->signature. "%4.4s " ACPI_PRINTF_UINT
ascii) ? table_desc-> " Attempted table install failed",
signature.ascii : "????", acpi_ut_valid_acpi_name(table_desc->
ACPI_FORMAT_TO_UINT(table_desc->address))); signature.
goto invalidate_and_exit; ascii) ?
table_desc->signature.ascii : "????",
ACPI_FORMAT_TO_UINT(table_desc->
address)));
goto invalidate_and_exit;
}
} }
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
......
...@@ -194,7 +194,7 @@ acpi_tb_install_fixed_table(acpi_physical_address address, ...@@ -194,7 +194,7 @@ acpi_tb_install_fixed_table(acpi_physical_address address,
/* Validate and verify a table before installation */ /* Validate and verify a table before installation */
status = acpi_tb_verify_table(&new_table_desc, signature); status = acpi_tb_verify_temp_table(&new_table_desc, signature);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto release_and_exit; goto release_and_exit;
} }
...@@ -266,7 +266,7 @@ acpi_tb_install_standard_table(acpi_physical_address address, ...@@ -266,7 +266,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,
/* Validate and verify a table before installation */ /* Validate and verify a table before installation */
status = acpi_tb_verify_table(&new_table_desc, NULL); status = acpi_tb_verify_temp_table(&new_table_desc, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto release_and_exit; goto release_and_exit;
} }
...@@ -424,7 +424,7 @@ void acpi_tb_override_table(struct acpi_table_desc *old_table_desc) ...@@ -424,7 +424,7 @@ void acpi_tb_override_table(struct acpi_table_desc *old_table_desc)
/* Validate and verify a table before overriding */ /* Validate and verify a table before overriding */
status = acpi_tb_verify_table(&new_table_desc, NULL); status = acpi_tb_verify_temp_table(&new_table_desc, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return; return;
} }
...@@ -446,7 +446,7 @@ void acpi_tb_override_table(struct acpi_table_desc *old_table_desc) ...@@ -446,7 +446,7 @@ void acpi_tb_override_table(struct acpi_table_desc *old_table_desc)
acpi_tb_init_table_descriptor(old_table_desc, new_table_desc.address, acpi_tb_init_table_descriptor(old_table_desc, new_table_desc.address,
new_table_desc.flags, new_table_desc.flags,
new_table_desc.pointer); new_table_desc.pointer);
acpi_tb_validate_table(old_table_desc); acpi_tb_validate_temp_table(old_table_desc);
/* Release the temporary table descriptor */ /* Release the temporary table descriptor */
......
...@@ -395,10 +395,6 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) ...@@ -395,10 +395,6 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
table_entry += table_entry_size; table_entry += table_entry_size;
} }
/*
* It is not possible to map more than one entry in some environments,
* so unmap the root table here before mapping other tables
*/
acpi_os_unmap_memory(table, length); acpi_os_unmap_memory(table, length);
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
......
...@@ -161,6 +161,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE); ...@@ -161,6 +161,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);
*/ */
ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE); ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE);
/*
* Whether or not to verify the table checksum before installation. Set
* this to TRUE to verify the table checksum before install it to the table
* manager. Note that enabling this option causes errors to happen in some
* OSPMs during early initialization stages. Default behavior is to do such
* verification.
*/
ACPI_INIT_GLOBAL(u8, acpi_gbl_verify_table_checksum, TRUE);
/* /*
* Optionally enable output from the AML Debug Object. * Optionally enable output from the AML Debug Object.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment