]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Merge branch 'for-next/timers' into for-next/core
authorWill Deacon <will@kernel.org>
Thu, 12 Sep 2024 12:44:03 +0000 (13:44 +0100)
committerWill Deacon <will@kernel.org>
Thu, 12 Sep 2024 12:44:03 +0000 (13:44 +0100)
* for-next/timers:
  arm64: Implement prctl(PR_{G,S}ET_TSC)

1  2 
arch/arm64/include/asm/processor.h
arch/arm64/kernel/process.c
arch/arm64/kernel/traps.c

Simple merge
index f365b033a64958f8dab67b2f9b4aabe158f9c7cd,1b6bbf839bb5ed74f0fd79169c5604bcd727bca6..0540653fbf382bf8a0984a7e9f97cafbedc3251b
@@@ -500,24 -492,35 +504,46 @@@ static void update_cntkctl_el1(struct t
                sysreg_clear_set(cntkctl_el1, 0, ARCH_TIMER_USR_VCT_ACCESS_EN);
  }
  
- static void erratum_1418040_new_exec(void)
+ static void cntkctl_thread_switch(struct task_struct *prev,
+                                 struct task_struct *next)
+ {
+       if ((read_ti_thread_flags(task_thread_info(prev)) &
+            (_TIF_32BIT | _TIF_TSC_SIGSEGV)) !=
+           (read_ti_thread_flags(task_thread_info(next)) &
+            (_TIF_32BIT | _TIF_TSC_SIGSEGV)))
+               update_cntkctl_el1(next);
+ }
+ static int do_set_tsc_mode(unsigned int val)
  {
+       bool tsc_sigsegv;
+       if (val == PR_TSC_SIGSEGV)
+               tsc_sigsegv = true;
+       else if (val == PR_TSC_ENABLE)
+               tsc_sigsegv = false;
+       else
+               return -EINVAL;
        preempt_disable();
-       erratum_1418040_thread_switch(current);
+       update_thread_flag(TIF_TSC_SIGSEGV, tsc_sigsegv);
+       update_cntkctl_el1(current);
        preempt_enable();
+       return 0;
  }
  
 +static void permission_overlay_switch(struct task_struct *next)
 +{
 +      if (!system_supports_poe())
 +              return;
 +
 +      current->thread.por_el0 = read_sysreg_s(SYS_POR_EL0);
 +      if (current->thread.por_el0 != next->thread.por_el0) {
 +              write_sysreg_s(next->thread.por_el0, SYS_POR_EL0);
 +      }
 +}
 +
  /*
   * __switch_to() checks current->thread.sctlr_user as an optimisation. Therefore
   * this function must be called with preemption disabled and the update to
@@@ -551,9 -554,8 +577,9 @@@ struct task_struct *__switch_to(struct 
        contextidr_thread_switch(next);
        entry_task_switch(next);
        ssbs_thread_switch(next);
-       erratum_1418040_thread_switch(next);
+       cntkctl_thread_switch(prev, next);
        ptrauth_thread_switch_user(next);
 +      permission_overlay_switch(next);
  
        /*
         * Complete any pending TLB or cache maintenance on this CPU in case
Simple merge