svn commit: r306756 - in head/sys/arm: allwinner altera/socfpga amlogic/aml8726 arm broadcom/bcm2835 freescale/imx include mv/armada38x nvidia/tegra124 rockchip samsung/exynos ti/omap4 xilinx

Michal Meloun mmel at FreeBSD.org
Thu Oct 6 13:18:21 UTC 2016


Author: mmel
Date: Thu Oct  6 13:18:18 2016
New Revision: 306756
URL: https://svnweb.freebsd.org/changeset/base/306756

Log:
  ARM: SEV/WFE instructions are implemented starting from ARMv6K,
  use it directly.
  
  MFC after: 1 week

Modified:
  head/sys/arm/allwinner/aw_mp.c
  head/sys/arm/altera/socfpga/socfpga_mp.c
  head/sys/arm/amlogic/aml8726/aml8726_mp.c
  head/sys/arm/arm/cpufunc_asm_armv7.S
  head/sys/arm/arm/mp_machdep.c
  head/sys/arm/broadcom/bcm2835/bcm2836_mp.c
  head/sys/arm/freescale/imx/imx6_mp.c
  head/sys/arm/include/cpu-v6.h
  head/sys/arm/include/cpufunc.h
  head/sys/arm/mv/armada38x/pmsu.c
  head/sys/arm/nvidia/tegra124/tegra124_mp.c
  head/sys/arm/rockchip/rk30xx_mp.c
  head/sys/arm/samsung/exynos/exynos5_mp.c
  head/sys/arm/ti/omap4/omap4_mp.c
  head/sys/arm/xilinx/zy7_mp.c

Modified: head/sys/arm/allwinner/aw_mp.c
==============================================================================
--- head/sys/arm/allwinner/aw_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/allwinner/aw_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -193,7 +193,8 @@ aw_mp_start_ap(platform_t plat)
 		val |= (1 << i);
 	bus_space_write_4(fdtbus_bs_tag, cpucfg, CPUCFG_DBGCTL1, val);
 
-	armv7_sev();
+	dsb();
+	sev();
 	bus_space_unmap(fdtbus_bs_tag, cpucfg, CPUCFG_SIZE);
 	if (soc_family != ALLWINNERSOC_SUN7I)
 		bus_space_unmap(fdtbus_bs_tag, prcm, PRCM_SIZE);
@@ -279,7 +280,8 @@ a83t_mp_start_ap(platform_t plat)
 		panic("Couldn't map the PRCM\n");
 
 	aw_mc_mp_start_ap(cpuscfg, cpuxcfg, prcm);
-	armv7_sev();
+	dsb();
+	sev();
 	bus_space_unmap(fdtbus_bs_tag, cpuxcfg, CPUXCFG_SIZE);
 	bus_space_unmap(fdtbus_bs_tag, cpuscfg, CPUCFG_SIZE);
 	bus_space_unmap(fdtbus_bs_tag, prcm, PRCM_SIZE);

Modified: head/sys/arm/altera/socfpga/socfpga_mp.c
==============================================================================
--- head/sys/arm/altera/socfpga/socfpga_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/altera/socfpga/socfpga_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -151,7 +151,8 @@ platform_mp_start_ap(void)
 	/* Put CPU1 out from reset */
 	bus_space_write_4(fdtbus_bs_tag, rst, MPUMODRST, 0);
 
-	armv7_sev();
+	dsb();
+	sev();
 
 	bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE);
 	bus_space_unmap(fdtbus_bs_tag, rst, RSTMGR_SIZE);

Modified: head/sys/arm/amlogic/aml8726/aml8726_mp.c
==============================================================================
--- head/sys/arm/amlogic/aml8726/aml8726_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/amlogic/aml8726/aml8726_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -487,7 +487,8 @@ platform_mp_start_ap(void)
 	CPUCONF_BARRIER(AML_CPUCONF_CONTROL_REG);
 
 	/* Wakeup the now enabled APs */
-	armv7_sev();
+	dsb();
+	sev();
 
 	/*
 	 * Free the resources which are not needed after startup.

Modified: head/sys/arm/arm/cpufunc_asm_armv7.S
==============================================================================
--- head/sys/arm/arm/cpufunc_asm_armv7.S	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/arm/cpufunc_asm_armv7.S	Thu Oct  6 13:18:18 2016	(r306756)
@@ -165,10 +165,3 @@ ENTRY(armv7_drain_writebuf)
 	dsb
 	RET
 END(armv7_drain_writebuf)
-
-ENTRY(armv7_sev)
-	dsb
-	sev
-	nop
-	RET
-END(armv7_sev)

Modified: head/sys/arm/arm/mp_machdep.c
==============================================================================
--- head/sys/arm/arm/mp_machdep.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/arm/mp_machdep.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -467,9 +467,8 @@ release_aps(void *dummy __unused)
 #endif
 	atomic_store_rel_int(&aps_ready, 1);
 	/* Wake the other threads up */
-#if __ARM_ARCH >= 7
-	armv7_sev();
-#endif
+	dsb();
+	sev();
 
 	printf("Release APs\n");
 

Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2836_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/broadcom/bcm2835/bcm2836_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -135,7 +135,8 @@ bcm2836_mp_start_ap(platform_t plat)
 		} while (1);
 
 		/* dsb and sev */
-		armv7_sev();
+		dsb();
+		sev();
 
 		/* recode AP in CPU map */
 		CPU_SET(i, &all_cpus);

Modified: head/sys/arm/freescale/imx/imx6_mp.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/freescale/imx/imx6_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -150,7 +150,8 @@ platform_mp_start_ap(void)
 	}
 	bus_space_write_4(fdtbus_bs_tag, src, SRC_CONTROL_REG, val);
 
-	armv7_sev();
+	dsb();
+	sev();
 
 	bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE);
 	bus_space_unmap(fdtbus_bs_tag, src, SRC_SIZE);

Modified: head/sys/arm/include/cpu-v6.h
==============================================================================
--- head/sys/arm/include/cpu-v6.h	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/include/cpu-v6.h	Thu Oct  6 13:18:18 2016	(r306756)
@@ -56,6 +56,8 @@ extern uint32_t	ccnt_hi[MAXCPU];
 extern int pmu_attched;
 #endif /* DEV_PMU */
 
+#define sev()  __asm __volatile("sev" : : : "memory")
+#define wfe()  __asm __volatile("wfe" : : : "memory")
 
 /*
  * Macros to generate CP15 (system control processor) read/write functions.

Modified: head/sys/arm/include/cpufunc.h
==============================================================================
--- head/sys/arm/include/cpufunc.h	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/include/cpufunc.h	Thu Oct  6 13:18:18 2016	(r306756)
@@ -284,7 +284,6 @@ void	armv7_idcache_wbinv_all		(void);
 void	armv7_cpu_sleep			(int);
 void	armv7_setup			(void);
 void	armv7_drain_writebuf		(void);
-void	armv7_sev			(void);
 
 void	armadaxp_idcache_wbinv_all	(void);
 

Modified: head/sys/arm/mv/armada38x/pmsu.c
==============================================================================
--- head/sys/arm/mv/armada38x/pmsu.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/mv/armada38x/pmsu.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -146,7 +146,8 @@ pmsu_boot_secondary_cpu(void)
 	    pmap_kextract((vm_offset_t)mpentry));
 
 	dcache_wbinv_poc_all();
-	armv7_sev();
+	dsb();
+	sev();
 
 	bus_space_unmap(fdtbus_bs_tag, vaddr, MV_PMSU_REGS_LEN);
 

Modified: head/sys/arm/nvidia/tegra124/tegra124_mp.c
==============================================================================
--- head/sys/arm/nvidia/tegra124/tegra124_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/nvidia/tegra124/tegra124_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -121,7 +121,8 @@ tegra124_mp_start_ap(platform_t plat)
 		}
 
 	}
-	armv7_sev();
+	dsb();
+	sev();
 	bus_space_unmap(fdtbus_bs_tag, pmc, PMC_SIZE);
 	bus_space_unmap(fdtbus_bs_tag, exvec, TEGRA_EXCEPTION_VECTORS_SIZE);
 }

Modified: head/sys/arm/rockchip/rk30xx_mp.c
==============================================================================
--- head/sys/arm/rockchip/rk30xx_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/rockchip/rk30xx_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -163,7 +163,8 @@ platform_mp_start_ap(void)
 		val &= ~(1 << i);
 	bus_space_write_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON, val);
 
-	armv7_sev();
+	dsb();
+	sev();
 
 	bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE);
 	bus_space_unmap(fdtbus_bs_tag, imem, IMEM_SIZE);

Modified: head/sys/arm/samsung/exynos/exynos5_mp.c
==============================================================================
--- head/sys/arm/samsung/exynos/exynos5_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/samsung/exynos/exynos5_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -124,7 +124,8 @@ platform_mp_start_ap(void)
 
 	dcache_wbinv_poc_all();
 
-	armv7_sev();
+	dsb();
+	sev();
 	bus_space_unmap(fdtbus_bs_tag, sysram, 0x100);
 	bus_space_unmap(fdtbus_bs_tag, pmu, 0x20000);
 }

Modified: head/sys/arm/ti/omap4/omap4_mp.c
==============================================================================
--- head/sys/arm/ti/omap4/omap4_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/ti/omap4/omap4_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -64,6 +64,7 @@ platform_mp_start_ap(void)
 
 	ti_smc0(0x200, 0xfffffdff, MODIFY_AUX_CORE_0);
 	ti_smc0(pmap_kextract((vm_offset_t)mpentry), 0, WRITE_AUX_CORE_1);
-	armv7_sev();
+	dsb();
+	sev();
 	bus_space_unmap(fdtbus_bs_tag, scu_addr, 0x1000);
 }

Modified: head/sys/arm/xilinx/zy7_mp.c
==============================================================================
--- head/sys/arm/xilinx/zy7_mp.c	Thu Oct  6 12:01:10 2016	(r306755)
+++ head/sys/arm/xilinx/zy7_mp.c	Thu Oct  6 13:18:18 2016	(r306756)
@@ -94,5 +94,6 @@ platform_mp_start_ap(void)
 	dcache_wbinv_poc_all();
 
 	/* Wake up CPU1. */
-	armv7_sev();
+	dsb();
+	sev();
 }


More information about the svn-src-all mailing list