Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115338756
D47816.id147078.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D47816.id147078.diff
View Options
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -173,19 +173,20 @@
SYSINIT(ssp_warn2, SI_SUB_LAST, SI_ORDER_ANY, print_ssp_warning, NULL);
#endif
-static void
-pan_setup(void)
+static bool
+pan_check(const struct cpu_feat *feat __unused, u_int midr __unused)
{
uint64_t id_aa64mfr1;
id_aa64mfr1 = READ_SPECIALREG(id_aa64mmfr1_el1);
- if (ID_AA64MMFR1_PAN_VAL(id_aa64mfr1) != ID_AA64MMFR1_PAN_NONE)
- has_pan = 1;
+ return (ID_AA64MMFR1_PAN_VAL(id_aa64mfr1) != ID_AA64MMFR1_PAN_NONE);
}
-void
-pan_enable(void)
+static void
+pan_enable(const struct cpu_feat *feat __unused, bool has_errata __unused,
+ u_int errata_id __unused)
{
+ has_pan = 1;
/*
* The LLVM integrated assembler doesn't understand the PAN
@@ -197,13 +198,19 @@
* memory when userspace can also access it unless the kernel
* uses the userspace load/store instructions.
*/
- if (has_pan) {
- WRITE_SPECIALREG(sctlr_el1,
- READ_SPECIALREG(sctlr_el1) & ~SCTLR_SPAN);
- __asm __volatile(".inst 0xd500409f | (0x1 << 8)");
- }
+ WRITE_SPECIALREG(sctlr_el1,
+ READ_SPECIALREG(sctlr_el1) & ~SCTLR_SPAN);
+ __asm __volatile(".inst 0xd500409f | (0x1 << 8)");
}
+static struct cpu_feat feat_pan = {
+ .feat_name = "FEAT_PAN",
+ .feat_check = pan_check,
+ .feat_enable = pan_enable,
+ .feat_flags = CPU_FEAT_EARLY_BOOT | CPU_FEAT_PER_CPU,
+};
+DATA_SET(cpu_feat_set, feat_pan);
+
bool
has_hyp(void)
{
@@ -966,7 +973,6 @@
init_param1();
cache_setup();
- pan_setup();
/* Bootstrap enough of pmap to enter the kernel proper */
pmap_bootstrap(lastaddr - KERNBASE);
@@ -1031,7 +1037,6 @@
if ((boothowto & RB_KDB) != 0)
kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
#endif
- pan_enable();
kcsan_cpu_init(0);
kasan_init();
diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -256,7 +256,6 @@
#endif
dbg_init();
- pan_enable();
mtx_lock_spin(&ap_boot_mtx);
atomic_add_rel_32(&smp_cpus, 1);
diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h
--- a/sys/arm64/include/cpufunc.h
+++ b/sys/arm64/include/cpufunc.h
@@ -41,8 +41,6 @@
#ifdef _KERNEL
#include <machine/armreg.h>
-void pan_enable(void);
-
static __inline register_t
dbg_disable(void)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 23, 6:50 PM (1 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17738286
Default Alt Text
D47816.id147078.diff (2 KB)
Attached To
Mode
D47816: arm64: Move FEAT_PAN to the cpu feat framework
Attached
Detach File
Event Timeline
Log In to Comment