Author: mhorne
Date: Tue Sep 24 02:41:39 2019
New Revision: 352642
URL: https://svnweb.freebsd.org/changeset/base/352642

Log:
  MFC r352430:
  
  RISC-V: Support EARLY_AP_STARTUP

Modified:
  stable/12/sys/riscv/conf/GENERIC
  stable/12/sys/riscv/riscv/clock.c
  stable/12/sys/riscv/riscv/mp_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/conf/GENERIC
==============================================================================
--- stable/12/sys/riscv/conf/GENERIC    Tue Sep 24 02:38:08 2019        
(r352641)
+++ stable/12/sys/riscv/conf/GENERIC    Tue Sep 24 02:41:39 2019        
(r352642)
@@ -72,6 +72,7 @@ options       RACCT                   # Resource accounting 
framework
 options        RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default
 options        RCTL                    # Resource limits
 options        SMP
+options        EARLY_AP_STARTUP
 options        INTRNG
 
 # RISC-V SBI console

Modified: stable/12/sys/riscv/riscv/clock.c
==============================================================================
--- stable/12/sys/riscv/riscv/clock.c   Tue Sep 24 02:38:08 2019        
(r352641)
+++ stable/12/sys/riscv/riscv/clock.c   Tue Sep 24 02:41:39 2019        
(r352642)
@@ -37,10 +37,34 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 #include <sys/systm.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/proc.h>
+#include <sys/sched.h>
+#include <sys/smp.h>
 
 void
 cpu_initclocks(void)
 {
+#ifdef EARLY_AP_STARTUP
+       struct thread *td;
+       int i;
 
+       td = curthread;
        cpu_initclocks_bsp();
+       CPU_FOREACH(i) {
+               if (i == 0)
+                       continue;
+               thread_lock(td);
+               sched_bind(td, i);
+               thread_unlock(td);
+               cpu_initclocks_ap();
+       }
+       thread_lock(td);
+       if (sched_is_bound(td))
+               sched_unbind(td);
+       thread_unlock(td);
+#else
+       cpu_initclocks_bsp();
+#endif
 }

Modified: stable/12/sys/riscv/riscv/mp_machdep.c
==============================================================================
--- stable/12/sys/riscv/riscv/mp_machdep.c      Tue Sep 24 02:38:08 2019        
(r352641)
+++ stable/12/sys/riscv/riscv/mp_machdep.c      Tue Sep 24 02:41:39 2019        
(r352642)
@@ -258,8 +258,10 @@ init_secondary(uint64_t hart)
        /* Enable software interrupts */
        riscv_unmask_ipi();
 
+#ifndef EARLY_AP_STARTUP
        /* Start per-CPU event timers. */
        cpu_initclocks_ap();
+#endif
 
        /* Enable external (PLIC) interrupts */
        csr_set(sie, SIE_SEIE);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to