From: Huang Shijie <shijie@os.amperecomputing.com>
To: catalin.marinas@arm.com
Cc: will@kernel.org, mark.rutland@arm.com, suzuki.poulose@arm.com,
broonie@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, anshuman.khandual@arm.com,
robh@kernel.org, oliver.upton@linux.dev, maz@kernel.org,
patches@amperecomputing.com,
Huang Shijie <shijie@os.amperecomputing.com>
Subject: [PATCH 1/4] extable: add __sort_main_extable
Date: Wed, 22 Nov 2023 17:28:52 +0800 [thread overview]
Message-ID: <20231122092855.4440-2-shijie@os.amperecomputing.com> (raw)
In-Reply-To: <20231122092855.4440-1-shijie@os.amperecomputing.com>
The AmpereOne chip(arm64) may change the kernel exception table at
boot time, so it needs to sort the kernel extable table during
the kernel boot.
Introduce __sort_main_extable which is used to sort the kernel
exception table.
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
---
include/linux/extable.h | 2 ++
kernel/extable.c | 8 +++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/linux/extable.h b/include/linux/extable.h
index 4ab9e78f313b..ef70ec3633b0 100644
--- a/include/linux/extable.h
+++ b/include/linux/extable.h
@@ -15,6 +15,8 @@ search_extable(const struct exception_table_entry *base,
void sort_extable(struct exception_table_entry *start,
struct exception_table_entry *finish);
void sort_main_extable(void);
+void __sort_main_extable(void);
+
void trim_init_extable(struct module *m);
/* Given an address, look for it in the exception tables */
diff --git a/kernel/extable.c b/kernel/extable.c
index 71f482581cab..0fbe0ccb1c3a 100644
--- a/kernel/extable.c
+++ b/kernel/extable.c
@@ -32,13 +32,19 @@ extern struct exception_table_entry __stop___ex_table[];
/* Cleared by build time tools if the table is already sorted. */
u32 __initdata __visible main_extable_sort_needed = 1;
+void __sort_main_extable(void)
+{
+ if (&__stop___ex_table > &__start___ex_table)
+ sort_extable(__start___ex_table, __stop___ex_table);
+}
+
/* Sort the kernel's built-in exception table */
void __init sort_main_extable(void)
{
if (main_extable_sort_needed &&
&__stop___ex_table > &__start___ex_table) {
pr_notice("Sorting __ex_table...\n");
- sort_extable(__start___ex_table, __stop___ex_table);
+ __sort_main_extable();
}
}
--
2.40.1
next prev parent reply other threads:[~2023-11-22 9:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 9:28 [PATCH 0/4] arm64: an optimization for AmpereOne Huang Shijie
2023-11-22 9:28 ` Huang Shijie [this message]
2023-11-22 9:28 ` [PATCH 2/4] arm64: alternative: handle the kernel exception table Huang Shijie
2023-11-22 9:28 ` [PATCH 3/4] arm64: copy_template.S: add loop_for_copy_128_bytes macro Huang Shijie
2023-11-22 9:28 ` [PATCH 4/4] arm64: add software prefetches for AmpereOne Huang Shijie
2023-11-22 11:34 ` Robin Murphy
2023-11-22 9:48 ` [PATCH 0/4] arm64: an optimization " Will Deacon
2023-11-22 11:40 ` Mark Rutland
2023-11-22 12:11 ` Marc Zyngier
2023-11-23 7:59 ` Linus Walleij
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=20231122092855.4440-2-shijie@os.amperecomputing.com \
--to=shijie@os.amperecomputing.com \
--cc=anshuman.khandual@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=patches@amperecomputing.com \
--cc=robh@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
/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