Page MenuHomeFreeBSD

D47244.id145358.diff
No OneTemporary

D47244.id145358.diff

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
@@ -924,6 +924,12 @@
__asm __volatile(
"mov x18, %0 \n"
"msr tpidr_el1, %0" :: "r"(pcpup));
+ /*
+ * If we are in VHE also set tpidr_el2. It can be used when tpidr_el1
+ * is known to have been trashed.
+ */
+ if (in_vhe())
+ WRITE_SPECIALREG(tpidr_el2, pcpup);
/* locore.S sets sp_el0 to &thread0 so no need to set it here. */
PCPU_SET(curthread, &thread0);
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
@@ -220,6 +220,10 @@
pcpup->pc_midr = get_midr();
identify_cpu(cpu);
+ /* As in machdep.c set tpidr_el2 */
+ if (in_vhe())
+ WRITE_SPECIALREG(tpidr_el2, pcpup);
+
/* Ensure the stores in identify_cpu have completed */
atomic_thread_fence_acq_rel();

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 28, 3:58 PM (7 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15624171
Default Alt Text
D47244.id145358.diff (920 B)

Event Timeline