linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>,
	Robert Moore <robert.moore@intel.com>,
	Lv Zheng <lv.zheng@intel.com>,
	"David E . Box" <david.e.box@intel.com>
Cc: Lv Zheng <zetalog@gmail.com>,
	linux-acpi@vger.kernel.org, devel@acpica.org
Subject: [RFC PATCH v3 3/5] ACPICA: Tables: Change table duplication check to be related to acpi_gbl_verify_table_checksum
Date: Thu, 18 May 2017 17:57:39 +0800	[thread overview]
Message-ID: <9e1c30cf0cb65db38cbb77a2e64c4922a31712fd.1495100623.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1495100623.git.lv.zheng@intel.com>

acpi_gbl_verify_table_checksum is used to avoid validating (mapping) an entire
table in OS boot stage. 2nd "Reload" check in acpi_tb_install_standard_table()
is prepared for the same purpose. So this patch combines them together
using a renamed acpi_gbl_enable_table_validation flag. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/tbdata.c   |  4 ++--
 drivers/acpi/acpica/tbinstal.c |  2 +-
 drivers/acpi/acpica/tbxface.c  |  8 ++++++++
 drivers/acpi/bus.c             |  3 ---
 drivers/acpi/tables.c          |  4 ++--
 include/acpi/acpixf.h          | 15 ++++++++-------
 6 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c
index 42ea044..e81355b 100644
--- a/drivers/acpi/acpica/tbdata.c
+++ b/drivers/acpi/acpica/tbdata.c
@@ -338,7 +338,7 @@ void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc)
 acpi_status acpi_tb_validate_temp_table(struct acpi_table_desc *table_desc)
 {
 
-	if (!table_desc->pointer && !acpi_gbl_verify_table_checksum) {
+	if (!table_desc->pointer && !acpi_gbl_enable_table_validation) {
 		/*
 		 * Only validates the header of the table.
 		 * Note that Length contains the size of the mapping after invoking
@@ -394,7 +394,7 @@ acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature)
 
 	/* Verify the checksum */
 
-	if (acpi_gbl_verify_table_checksum) {
+	if (acpi_gbl_enable_table_validation) {
 		status =
 		    acpi_tb_verify_checksum(table_desc->pointer,
 					    table_desc->length);
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 9d21296..f7bc362 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -221,7 +221,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,
 
 	(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
 
-	if (reload) {
+	if (acpi_gbl_enable_table_validation) {
 
 		/* Check if table is already registered */
 
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 010b1c43..b0dc841 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -194,6 +194,14 @@ acpi_status ACPI_INIT_FUNCTION acpi_reallocate_root_table(void)
 		}
 	}
 
+	if (!acpi_gbl_enable_table_validation) {
+		/*
+		 * Now it's safe to do full table validation. We can do deferred
+		 * table initilization here once the flag is set.
+		 */
+		acpi_gbl_enable_table_validation = TRUE;
+	}
+
 	acpi_gbl_root_table_list.flags |= ACPI_ROOT_ALLOW_RESIZE;
 
 	status = acpi_tb_resize_root_table_list();
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 34fbe02..93c7c5b 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1009,9 +1009,6 @@ void __init acpi_early_init(void)
 
 	printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);
 
-	/* It's safe to verify table checksums during late stage */
-	acpi_gbl_verify_table_checksum = TRUE;
-
 	/* enable workarounds, unless strict ACPI spec. compliance */
 	if (!acpi_strict)
 		acpi_gbl_enable_interpreter_slack = TRUE;
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 0dae722..b5cc09c 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -740,10 +740,10 @@ int __init acpi_table_init(void)
 
 	if (acpi_verify_table_checksum) {
 		pr_info("Early table checksum verification enabled\n");
-		acpi_gbl_verify_table_checksum = TRUE;
+		acpi_gbl_enable_table_validation = TRUE;
 	} else {
 		pr_info("Early table checksum verification disabled\n");
-		acpi_gbl_verify_table_checksum = FALSE;
+		acpi_gbl_enable_table_validation = FALSE;
 	}
 
 	status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 15c86ce..88a1de8 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -160,13 +160,14 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, 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);
+ * Whether or not to validate (map) an entire table to verify
+ * checksum/duplication in early stage before install. Set this to TRUE to
+ * allow early table validation 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 allow such
+ * validation.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_table_validation, TRUE);
 
 /*
  * Optionally enable output from the AML Debug Object.
-- 
2.7.4


  parent reply	other threads:[~2017-05-18  9:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27  9:34 [PATCH] ACPICA: Detect duplicate SSDT tables Hans de Goede
2017-02-28  5:19 ` Zheng, Lv
2017-02-28 14:31   ` Hans de Goede
2017-02-28 15:46     ` Moore, Robert
2017-02-28 23:44       ` Hans de Goede
2017-03-01  0:11         ` Moore, Robert
2017-03-01  3:21     ` Zheng, Lv
2017-03-01  9:19       ` Hans de Goede
2017-03-01 20:38         ` Moore, Robert
2017-03-01 21:56           ` Rafael J. Wysocki
2017-03-02  1:59         ` Zheng, Lv
2017-03-02 15:24           ` Hans de Goede
2017-03-03  2:50             ` Zheng, Lv
2017-03-03 13:52               ` Hans de Goede
2017-03-13  6:01                 ` Zheng, Lv
2017-05-16  7:13 ` [RFC PATCH v2 0/5] ACPICA: Tables: Add deferred verification support Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 1/5] ACPICA: Tables: Cleanup table handler invokers Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 2/5] ACPICA: Tables: Do not validate signature for dynamic table load Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 3/5] ACPICA: Tables: Change table duplication check to be related to acpi_gbl_verify_table_checksum Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 4/5] ACPICA: Tables: Combine checksum/duplication verification together Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 5/5] ACPICA: Tables: Add deferred table verification support Lv Zheng
2017-05-18 14:01   ` [RFC PATCH v2 0/5] ACPICA: Tables: Add deferred " Hans de Goede
2017-05-19  7:59     ` Zheng, Lv
2017-05-19  9:49       ` Hans de Goede
2017-05-18  9:57 ` [RFC PATCH v3 " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 1/5] ACPICA: Tables: Cleanup table handler invokers Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 2/5] ACPICA: Tables: Do not validate signature for dynamic table load Lv Zheng
2017-05-18  9:57   ` Lv Zheng [this message]
2017-05-18  9:57   ` [RFC PATCH v3 4/5] ACPICA: Tables: Combine checksum/duplication verification together Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 5/5] ACPICA: Tables: Add deferred table verification support Lv Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e1c30cf0cb65db38cbb77a2e64c4922a31712fd.1495100623.git.lv.zheng@intel.com \
    --to=lv.zheng@intel.com \
    --cc=david.e.box@intel.com \
    --cc=devel@acpica.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    --cc=zetalog@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).