[PATCH v2 04/16] arm64: text replication: add init function
Russell King (Oracle)
rmk+kernel at armlinux.org.uk
Thu Jul 27 08:30:15 PDT 2023
A simple patch that adds an empty function for kernel text replication
initialisation and hooks it into the initialisation path.
Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
---
arch/arm64/include/asm/ktext.h | 20 ++++++++++++++++++++
arch/arm64/mm/Makefile | 2 ++
arch/arm64/mm/init.c | 3 +++
arch/arm64/mm/ktext.c | 8 ++++++++
4 files changed, 33 insertions(+)
create mode 100644 arch/arm64/include/asm/ktext.h
create mode 100644 arch/arm64/mm/ktext.c
diff --git a/arch/arm64/include/asm/ktext.h b/arch/arm64/include/asm/ktext.h
new file mode 100644
index 000000000000..1a5f7452a3bf
--- /dev/null
+++ b/arch/arm64/include/asm/ktext.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2022, Oracle and/or its affiliates.
+ */
+#ifndef ASM_KTEXT_H
+#define ASM_KTEXT_H
+
+#ifdef CONFIG_REPLICATE_KTEXT
+
+void ktext_replication_init(void);
+
+#else
+
+static inline void ktext_replication_init(void)
+{
+}
+
+#endif
+
+#endif
diff --git a/arch/arm64/mm/Makefile b/arch/arm64/mm/Makefile
index dbd1bc95967d..41e705027c57 100644
--- a/arch/arm64/mm/Makefile
+++ b/arch/arm64/mm/Makefile
@@ -14,3 +14,5 @@ KASAN_SANITIZE_physaddr.o += n
obj-$(CONFIG_KASAN) += kasan_init.o
KASAN_SANITIZE_kasan_init.o := n
+
+obj-$(CONFIG_REPLICATE_KTEXT) += ktext.o
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index d31c3a9290c5..df90738fd6bb 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -36,6 +36,7 @@
#include <asm/fixmap.h>
#include <asm/kasan.h>
#include <asm/kernel-pgtable.h>
+#include <asm/ktext.h>
#include <asm/kvm_host.h>
#include <asm/memory.h>
#include <asm/numa.h>
@@ -425,6 +426,8 @@ void __init bootmem_init(void)
arch_numa_init();
+ ktext_replication_init();
+
/*
* must be done after arch_numa_init() which calls numa_init() to
* initialize node_online_map that gets used in hugetlb_cma_reserve()
diff --git a/arch/arm64/mm/ktext.c b/arch/arm64/mm/ktext.c
new file mode 100644
index 000000000000..3a8d37c9abc4
--- /dev/null
+++ b/arch/arm64/mm/ktext.c
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2022, Oracle and/or its affiliates.
+ */
+
+void __init ktext_replication_init(void)
+{
+}
--
2.30.2
More information about the linux-arm-kernel
mailing list