From: Matt Fleming <matt@codeblueprint.co.uk>
To: Dave Young <dyoung@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
linux-acpi@vger.kernel.org, kexec@lists.infradead.org,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Josh Triplett <josh@joshtriplett.org>,
Borislav Petkov <bp@alien8.de>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Vivek Goyal <vgoyal@redhat.com>,
Matt Fleming <matt@codeblueprint.co.uk>
Subject: [PATCH 1/2] ACPICA: Tables: Add function to remove ACPI tables
Date: Wed, 17 Feb 2016 15:45:09 +0000 [thread overview]
Message-ID: <1455723910-16710-2-git-send-email-matt@codeblueprint.co.uk> (raw)
In-Reply-To: <1455723910-16710-1-git-send-email-matt@codeblueprint.co.uk>
There are existing internal functions that allow the removal of ACPI
tables, but they're not exposed to the OS in any useful way.
Introduce acpi_remove_table() which allows tables to be invalidated in
the global table list, resulting in failure of subsequent calls to
acpi_get_table() for those tables.
The rationale for this change is the ability to remove the BGRT table
during kexec boot. The BGRT table refers to memory regions that are no
longer reserved by the firmware once the kexec kernel boots, having
been released for general allocation by the previous kernel.
Cc: Dave Young <dyoung@redhat.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: <kexec@lists.infradead.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
drivers/acpi/acpica/tbxface.c | 54 +++++++++++++++++++++++++++++++++++++++++++
include/acpi/acpixf.h | 3 +++
2 files changed, 57 insertions(+)
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 326df65decef..999eecd89601 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -480,3 +480,57 @@ cleanup:
}
ACPI_EXPORT_SYMBOL(acpi_remove_table_handler)
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_remove_table
+ *
+ * PARAMETERS: signature - ACPI signature of needed table
+ * instance - Which instance (for SSDTs)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Finds and removes an ACPI table.
+ *
+ ******************************************************************************/
+acpi_status acpi_remove_table(char *signature, u32 instance)
+{
+ struct acpi_table_desc *table_desc;
+ acpi_status status;
+ u32 i;
+ u32 j;
+
+ /* Parameter validation */
+ if (!signature) {
+ return (AE_BAD_PARAMETER);
+ }
+
+ /* Walk the root table list */
+
+ for (i = 0, j = 0; i < acpi_gbl_root_table_list.current_table_count;
+ i++) {
+ if (!ACPI_COMPARE_NAME
+ (&(acpi_gbl_root_table_list.tables[i].signature),
+ signature)) {
+ continue;
+ }
+
+ if (++j < instance) {
+ continue;
+ }
+
+ table_desc = &acpi_gbl_root_table_list.tables[i];
+
+ status = acpi_tb_validate_table(table_desc);
+ if (ACPI_FAILURE(status)) {
+ return (status);
+ }
+
+ acpi_tb_uninstall_table(table_desc);
+ return (AE_OK);
+ }
+
+ return (AE_NOT_FOUND);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_remove_table);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index c96621e87c19..47e51612293e 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -505,6 +505,9 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
acpi_remove_table_handler(acpi_table_handler
handler))
+ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+ acpi_remove_table(acpi_string signature,
+ u32 instance))
/*
* Namespace and name interfaces
--
2.6.2
next prev parent reply other threads:[~2016-02-17 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 15:45 [PATCH 0/2] ACPI, x86/efi: Remove ACPI BGRT tables for kexec Matt Fleming
2016-02-17 15:45 ` Matt Fleming [this message]
2016-02-18 2:34 ` [PATCH 1/2] ACPICA: Tables: Add function to remove ACPI tables Zheng, Lv
2016-02-18 20:15 ` Rafael J. Wysocki
2016-02-18 20:41 ` Matt Fleming
2016-02-18 20:45 ` Rafael J. Wysocki
2016-02-19 3:19 ` Zheng, Lv
2016-02-17 15:45 ` [PATCH 2/2] x86/efi: Delete ACPI BGRT when booting via kexec Matt Fleming
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=1455723910-16710-2-git-send-email-matt@codeblueprint.co.uk \
--to=matt@codeblueprint.co.uk \
--cc=bp@alien8.de \
--cc=dyoung@redhat.com \
--cc=josh@joshtriplett.org \
--cc=kexec@lists.infradead.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=rafael.j.wysocki@intel.com \
--cc=vgoyal@redhat.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).