18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/sh/kernel/cpu/init.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * CPU init code
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2002 - 2009  Paul Mundt
88c2ecf20Sopenharmony_ci * Copyright (C) 2003  Richard Curnow
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#include <linux/init.h>
118c2ecf20Sopenharmony_ci#include <linux/kernel.h>
128c2ecf20Sopenharmony_ci#include <linux/mm.h>
138c2ecf20Sopenharmony_ci#include <linux/log2.h>
148c2ecf20Sopenharmony_ci#include <asm/mmu_context.h>
158c2ecf20Sopenharmony_ci#include <asm/processor.h>
168c2ecf20Sopenharmony_ci#include <linux/uaccess.h>
178c2ecf20Sopenharmony_ci#include <asm/page.h>
188c2ecf20Sopenharmony_ci#include <asm/cacheflush.h>
198c2ecf20Sopenharmony_ci#include <asm/cache.h>
208c2ecf20Sopenharmony_ci#include <asm/elf.h>
218c2ecf20Sopenharmony_ci#include <asm/io.h>
228c2ecf20Sopenharmony_ci#include <asm/smp.h>
238c2ecf20Sopenharmony_ci#include <asm/sh_bios.h>
248c2ecf20Sopenharmony_ci#include <asm/setup.h>
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#ifdef CONFIG_SH_FPU
278c2ecf20Sopenharmony_ci#define cpu_has_fpu	1
288c2ecf20Sopenharmony_ci#else
298c2ecf20Sopenharmony_ci#define cpu_has_fpu	0
308c2ecf20Sopenharmony_ci#endif
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifdef CONFIG_SH_DSP
338c2ecf20Sopenharmony_ci#define cpu_has_dsp	1
348c2ecf20Sopenharmony_ci#else
358c2ecf20Sopenharmony_ci#define cpu_has_dsp	0
368c2ecf20Sopenharmony_ci#endif
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/*
398c2ecf20Sopenharmony_ci * Generic wrapper for command line arguments to disable on-chip
408c2ecf20Sopenharmony_ci * peripherals (nofpu, nodsp, and so forth).
418c2ecf20Sopenharmony_ci */
428c2ecf20Sopenharmony_ci#define onchip_setup(x)					\
438c2ecf20Sopenharmony_cistatic int x##_disabled = !cpu_has_##x;			\
448c2ecf20Sopenharmony_ci							\
458c2ecf20Sopenharmony_cistatic int x##_setup(char *opts)			\
468c2ecf20Sopenharmony_ci{							\
478c2ecf20Sopenharmony_ci	x##_disabled = 1;				\
488c2ecf20Sopenharmony_ci	return 1;					\
498c2ecf20Sopenharmony_ci}							\
508c2ecf20Sopenharmony_ci__setup("no" __stringify(x), x##_setup);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cionchip_setup(fpu);
538c2ecf20Sopenharmony_cionchip_setup(dsp);
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#ifdef CONFIG_SPECULATIVE_EXECUTION
568c2ecf20Sopenharmony_ci#define CPUOPM		0xff2f0000
578c2ecf20Sopenharmony_ci#define CPUOPM_RABD	(1 << 5)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_cistatic void speculative_execution_init(void)
608c2ecf20Sopenharmony_ci{
618c2ecf20Sopenharmony_ci	/* Clear RABD */
628c2ecf20Sopenharmony_ci	__raw_writel(__raw_readl(CPUOPM) & ~CPUOPM_RABD, CPUOPM);
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci	/* Flush the update */
658c2ecf20Sopenharmony_ci	(void)__raw_readl(CPUOPM);
668c2ecf20Sopenharmony_ci	ctrl_barrier();
678c2ecf20Sopenharmony_ci}
688c2ecf20Sopenharmony_ci#else
698c2ecf20Sopenharmony_ci#define speculative_execution_init()	do { } while (0)
708c2ecf20Sopenharmony_ci#endif
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_SH4A
738c2ecf20Sopenharmony_ci#define EXPMASK			0xff2f0004
748c2ecf20Sopenharmony_ci#define EXPMASK_RTEDS		(1 << 0)
758c2ecf20Sopenharmony_ci#define EXPMASK_BRDSSLP		(1 << 1)
768c2ecf20Sopenharmony_ci#define EXPMASK_MMCAW		(1 << 4)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistatic void expmask_init(void)
798c2ecf20Sopenharmony_ci{
808c2ecf20Sopenharmony_ci	unsigned long expmask = __raw_readl(EXPMASK);
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci	/*
838c2ecf20Sopenharmony_ci	 * Future proofing.
848c2ecf20Sopenharmony_ci	 *
858c2ecf20Sopenharmony_ci	 * Disable support for slottable sleep instruction, non-nop
868c2ecf20Sopenharmony_ci	 * instructions in the rte delay slot, and associative writes to
878c2ecf20Sopenharmony_ci	 * the memory-mapped cache array.
888c2ecf20Sopenharmony_ci	 */
898c2ecf20Sopenharmony_ci	expmask &= ~(EXPMASK_RTEDS | EXPMASK_BRDSSLP | EXPMASK_MMCAW);
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci	__raw_writel(expmask, EXPMASK);
928c2ecf20Sopenharmony_ci	ctrl_barrier();
938c2ecf20Sopenharmony_ci}
948c2ecf20Sopenharmony_ci#else
958c2ecf20Sopenharmony_ci#define expmask_init()	do { } while (0)
968c2ecf20Sopenharmony_ci#endif
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* 2nd-level cache init */
998c2ecf20Sopenharmony_civoid __attribute__ ((weak)) l2_cache_init(void)
1008c2ecf20Sopenharmony_ci{
1018c2ecf20Sopenharmony_ci}
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/*
1048c2ecf20Sopenharmony_ci * Generic first-level cache init
1058c2ecf20Sopenharmony_ci */
1068c2ecf20Sopenharmony_ci#if !defined(CONFIG_CPU_J2)
1078c2ecf20Sopenharmony_cistatic void cache_init(void)
1088c2ecf20Sopenharmony_ci{
1098c2ecf20Sopenharmony_ci	unsigned long ccr, flags;
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci	jump_to_uncached();
1128c2ecf20Sopenharmony_ci	ccr = __raw_readl(SH_CCR);
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci	/*
1158c2ecf20Sopenharmony_ci	 * At this point we don't know whether the cache is enabled or not - a
1168c2ecf20Sopenharmony_ci	 * bootloader may have enabled it.  There are at least 2 things that
1178c2ecf20Sopenharmony_ci	 * could be dirty in the cache at this point:
1188c2ecf20Sopenharmony_ci	 * 1. kernel command line set up by boot loader
1198c2ecf20Sopenharmony_ci	 * 2. spilled registers from the prolog of this function
1208c2ecf20Sopenharmony_ci	 * => before re-initialising the cache, we must do a purge of the whole
1218c2ecf20Sopenharmony_ci	 * cache out to memory for safety.  As long as nothing is spilled
1228c2ecf20Sopenharmony_ci	 * during the loop to lines that have already been done, this is safe.
1238c2ecf20Sopenharmony_ci	 * - RPC
1248c2ecf20Sopenharmony_ci	 */
1258c2ecf20Sopenharmony_ci	if (ccr & CCR_CACHE_ENABLE) {
1268c2ecf20Sopenharmony_ci		unsigned long ways, waysize, addrstart;
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci		waysize = current_cpu_data.dcache.sets;
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci#ifdef CCR_CACHE_ORA
1318c2ecf20Sopenharmony_ci		/*
1328c2ecf20Sopenharmony_ci		 * If the OC is already in RAM mode, we only have
1338c2ecf20Sopenharmony_ci		 * half of the entries to flush..
1348c2ecf20Sopenharmony_ci		 */
1358c2ecf20Sopenharmony_ci		if (ccr & CCR_CACHE_ORA)
1368c2ecf20Sopenharmony_ci			waysize >>= 1;
1378c2ecf20Sopenharmony_ci#endif
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci		waysize <<= current_cpu_data.dcache.entry_shift;
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#ifdef CCR_CACHE_EMODE
1428c2ecf20Sopenharmony_ci		/* If EMODE is not set, we only have 1 way to flush. */
1438c2ecf20Sopenharmony_ci		if (!(ccr & CCR_CACHE_EMODE))
1448c2ecf20Sopenharmony_ci			ways = 1;
1458c2ecf20Sopenharmony_ci		else
1468c2ecf20Sopenharmony_ci#endif
1478c2ecf20Sopenharmony_ci			ways = current_cpu_data.dcache.ways;
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci		addrstart = CACHE_OC_ADDRESS_ARRAY;
1508c2ecf20Sopenharmony_ci		do {
1518c2ecf20Sopenharmony_ci			unsigned long addr;
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci			for (addr = addrstart;
1548c2ecf20Sopenharmony_ci			     addr < addrstart + waysize;
1558c2ecf20Sopenharmony_ci			     addr += current_cpu_data.dcache.linesz)
1568c2ecf20Sopenharmony_ci				__raw_writel(0, addr);
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci			addrstart += current_cpu_data.dcache.way_incr;
1598c2ecf20Sopenharmony_ci		} while (--ways);
1608c2ecf20Sopenharmony_ci	}
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci	/*
1638c2ecf20Sopenharmony_ci	 * Default CCR values .. enable the caches
1648c2ecf20Sopenharmony_ci	 * and invalidate them immediately..
1658c2ecf20Sopenharmony_ci	 */
1668c2ecf20Sopenharmony_ci	flags = CCR_CACHE_ENABLE | CCR_CACHE_INVALIDATE;
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#ifdef CCR_CACHE_EMODE
1698c2ecf20Sopenharmony_ci	/* Force EMODE if possible */
1708c2ecf20Sopenharmony_ci	if (current_cpu_data.dcache.ways > 1)
1718c2ecf20Sopenharmony_ci		flags |= CCR_CACHE_EMODE;
1728c2ecf20Sopenharmony_ci	else
1738c2ecf20Sopenharmony_ci		flags &= ~CCR_CACHE_EMODE;
1748c2ecf20Sopenharmony_ci#endif
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#if defined(CONFIG_CACHE_WRITETHROUGH)
1778c2ecf20Sopenharmony_ci	/* Write-through */
1788c2ecf20Sopenharmony_ci	flags |= CCR_CACHE_WT;
1798c2ecf20Sopenharmony_ci#elif defined(CONFIG_CACHE_WRITEBACK)
1808c2ecf20Sopenharmony_ci	/* Write-back */
1818c2ecf20Sopenharmony_ci	flags |= CCR_CACHE_CB;
1828c2ecf20Sopenharmony_ci#else
1838c2ecf20Sopenharmony_ci	/* Off */
1848c2ecf20Sopenharmony_ci	flags &= ~CCR_CACHE_ENABLE;
1858c2ecf20Sopenharmony_ci#endif
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	l2_cache_init();
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci	__raw_writel(flags, SH_CCR);
1908c2ecf20Sopenharmony_ci	back_to_cached();
1918c2ecf20Sopenharmony_ci}
1928c2ecf20Sopenharmony_ci#else
1938c2ecf20Sopenharmony_ci#define cache_init()	do { } while (0)
1948c2ecf20Sopenharmony_ci#endif
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci#define CSHAPE(totalsize, linesize, assoc) \
1978c2ecf20Sopenharmony_ci	((totalsize & ~0xff) | (linesize << 4) | assoc)
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci#define CACHE_DESC_SHAPE(desc)	\
2008c2ecf20Sopenharmony_ci	CSHAPE((desc).way_size * (desc).ways, ilog2((desc).linesz), (desc).ways)
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_cistatic void detect_cache_shape(void)
2038c2ecf20Sopenharmony_ci{
2048c2ecf20Sopenharmony_ci	l1d_cache_shape = CACHE_DESC_SHAPE(current_cpu_data.dcache);
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci	if (current_cpu_data.dcache.flags & SH_CACHE_COMBINED)
2078c2ecf20Sopenharmony_ci		l1i_cache_shape = l1d_cache_shape;
2088c2ecf20Sopenharmony_ci	else
2098c2ecf20Sopenharmony_ci		l1i_cache_shape = CACHE_DESC_SHAPE(current_cpu_data.icache);
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci	if (current_cpu_data.flags & CPU_HAS_L2_CACHE)
2128c2ecf20Sopenharmony_ci		l2_cache_shape = CACHE_DESC_SHAPE(current_cpu_data.scache);
2138c2ecf20Sopenharmony_ci	else
2148c2ecf20Sopenharmony_ci		l2_cache_shape = -1; /* No S-cache */
2158c2ecf20Sopenharmony_ci}
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_cistatic void fpu_init(void)
2188c2ecf20Sopenharmony_ci{
2198c2ecf20Sopenharmony_ci	/* Disable the FPU */
2208c2ecf20Sopenharmony_ci	if (fpu_disabled && (current_cpu_data.flags & CPU_HAS_FPU)) {
2218c2ecf20Sopenharmony_ci		printk("FPU Disabled\n");
2228c2ecf20Sopenharmony_ci		current_cpu_data.flags &= ~CPU_HAS_FPU;
2238c2ecf20Sopenharmony_ci	}
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	disable_fpu();
2268c2ecf20Sopenharmony_ci	clear_used_math();
2278c2ecf20Sopenharmony_ci}
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci#ifdef CONFIG_SH_DSP
2308c2ecf20Sopenharmony_cistatic void release_dsp(void)
2318c2ecf20Sopenharmony_ci{
2328c2ecf20Sopenharmony_ci	unsigned long sr;
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci	/* Clear SR.DSP bit */
2358c2ecf20Sopenharmony_ci	__asm__ __volatile__ (
2368c2ecf20Sopenharmony_ci		"stc\tsr, %0\n\t"
2378c2ecf20Sopenharmony_ci		"and\t%1, %0\n\t"
2388c2ecf20Sopenharmony_ci		"ldc\t%0, sr\n\t"
2398c2ecf20Sopenharmony_ci		: "=&r" (sr)
2408c2ecf20Sopenharmony_ci		: "r" (~SR_DSP)
2418c2ecf20Sopenharmony_ci	);
2428c2ecf20Sopenharmony_ci}
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_cistatic void dsp_init(void)
2458c2ecf20Sopenharmony_ci{
2468c2ecf20Sopenharmony_ci	unsigned long sr;
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci	/*
2498c2ecf20Sopenharmony_ci	 * Set the SR.DSP bit, wait for one instruction, and then read
2508c2ecf20Sopenharmony_ci	 * back the SR value.
2518c2ecf20Sopenharmony_ci	 */
2528c2ecf20Sopenharmony_ci	__asm__ __volatile__ (
2538c2ecf20Sopenharmony_ci		"stc\tsr, %0\n\t"
2548c2ecf20Sopenharmony_ci		"or\t%1, %0\n\t"
2558c2ecf20Sopenharmony_ci		"ldc\t%0, sr\n\t"
2568c2ecf20Sopenharmony_ci		"nop\n\t"
2578c2ecf20Sopenharmony_ci		"stc\tsr, %0\n\t"
2588c2ecf20Sopenharmony_ci		: "=&r" (sr)
2598c2ecf20Sopenharmony_ci		: "r" (SR_DSP)
2608c2ecf20Sopenharmony_ci	);
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci	/* If the DSP bit is still set, this CPU has a DSP */
2638c2ecf20Sopenharmony_ci	if (sr & SR_DSP)
2648c2ecf20Sopenharmony_ci		current_cpu_data.flags |= CPU_HAS_DSP;
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci	/* Disable the DSP */
2678c2ecf20Sopenharmony_ci	if (dsp_disabled && (current_cpu_data.flags & CPU_HAS_DSP)) {
2688c2ecf20Sopenharmony_ci		printk("DSP Disabled\n");
2698c2ecf20Sopenharmony_ci		current_cpu_data.flags &= ~CPU_HAS_DSP;
2708c2ecf20Sopenharmony_ci	}
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci	/* Now that we've determined the DSP status, clear the DSP bit. */
2738c2ecf20Sopenharmony_ci	release_dsp();
2748c2ecf20Sopenharmony_ci}
2758c2ecf20Sopenharmony_ci#else
2768c2ecf20Sopenharmony_cistatic inline void dsp_init(void) { }
2778c2ecf20Sopenharmony_ci#endif /* CONFIG_SH_DSP */
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci/**
2808c2ecf20Sopenharmony_ci * cpu_init
2818c2ecf20Sopenharmony_ci *
2828c2ecf20Sopenharmony_ci * This is our initial entry point for each CPU, and is invoked on the
2838c2ecf20Sopenharmony_ci * boot CPU prior to calling start_kernel(). For SMP, a combination of
2848c2ecf20Sopenharmony_ci * this and start_secondary() will bring up each processor to a ready
2858c2ecf20Sopenharmony_ci * state prior to hand forking the idle loop.
2868c2ecf20Sopenharmony_ci *
2878c2ecf20Sopenharmony_ci * We do all of the basic processor init here, including setting up
2888c2ecf20Sopenharmony_ci * the caches, FPU, DSP, etc. By the time start_kernel() is hit (and
2898c2ecf20Sopenharmony_ci * subsequently platform_setup()) things like determining the CPU
2908c2ecf20Sopenharmony_ci * subtype and initial configuration will all be done.
2918c2ecf20Sopenharmony_ci *
2928c2ecf20Sopenharmony_ci * Each processor family is still responsible for doing its own probing
2938c2ecf20Sopenharmony_ci * and cache configuration in cpu_probe().
2948c2ecf20Sopenharmony_ci */
2958c2ecf20Sopenharmony_ciasmlinkage void cpu_init(void)
2968c2ecf20Sopenharmony_ci{
2978c2ecf20Sopenharmony_ci	current_thread_info()->cpu = hard_smp_processor_id();
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci	/* First, probe the CPU */
3008c2ecf20Sopenharmony_ci	cpu_probe();
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci	if (current_cpu_data.type == CPU_SH_NONE)
3038c2ecf20Sopenharmony_ci		panic("Unknown CPU");
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci	/* First setup the rest of the I-cache info */
3068c2ecf20Sopenharmony_ci	current_cpu_data.icache.entry_mask = current_cpu_data.icache.way_incr -
3078c2ecf20Sopenharmony_ci				      current_cpu_data.icache.linesz;
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci	current_cpu_data.icache.way_size = current_cpu_data.icache.sets *
3108c2ecf20Sopenharmony_ci				    current_cpu_data.icache.linesz;
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci	/* And the D-cache too */
3138c2ecf20Sopenharmony_ci	current_cpu_data.dcache.entry_mask = current_cpu_data.dcache.way_incr -
3148c2ecf20Sopenharmony_ci				      current_cpu_data.dcache.linesz;
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci	current_cpu_data.dcache.way_size = current_cpu_data.dcache.sets *
3178c2ecf20Sopenharmony_ci				    current_cpu_data.dcache.linesz;
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci	/* Init the cache */
3208c2ecf20Sopenharmony_ci	cache_init();
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci	if (raw_smp_processor_id() == 0) {
3238c2ecf20Sopenharmony_ci#ifdef CONFIG_MMU
3248c2ecf20Sopenharmony_ci		shm_align_mask = max_t(unsigned long,
3258c2ecf20Sopenharmony_ci				       current_cpu_data.dcache.way_size - 1,
3268c2ecf20Sopenharmony_ci				       PAGE_SIZE - 1);
3278c2ecf20Sopenharmony_ci#else
3288c2ecf20Sopenharmony_ci		shm_align_mask = PAGE_SIZE - 1;
3298c2ecf20Sopenharmony_ci#endif
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci		/* Boot CPU sets the cache shape */
3328c2ecf20Sopenharmony_ci		detect_cache_shape();
3338c2ecf20Sopenharmony_ci	}
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci	fpu_init();
3368c2ecf20Sopenharmony_ci	dsp_init();
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci	/*
3398c2ecf20Sopenharmony_ci	 * Initialize the per-CPU ASID cache very early, since the
3408c2ecf20Sopenharmony_ci	 * TLB flushing routines depend on this being setup.
3418c2ecf20Sopenharmony_ci	 */
3428c2ecf20Sopenharmony_ci	current_cpu_data.asid_cache = NO_CONTEXT;
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci	current_cpu_data.phys_bits = __in_29bit_mode() ? 29 : 32;
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci	speculative_execution_init();
3478c2ecf20Sopenharmony_ci	expmask_init();
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci	/* Do the rest of the boot processor setup */
3508c2ecf20Sopenharmony_ci	if (raw_smp_processor_id() == 0) {
3518c2ecf20Sopenharmony_ci		/* Save off the BIOS VBR, if there is one */
3528c2ecf20Sopenharmony_ci		sh_bios_vbr_init();
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci		/*
3558c2ecf20Sopenharmony_ci		 * Setup VBR for boot CPU. Secondary CPUs do this through
3568c2ecf20Sopenharmony_ci		 * start_secondary().
3578c2ecf20Sopenharmony_ci		 */
3588c2ecf20Sopenharmony_ci		per_cpu_trap_init();
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci		/*
3618c2ecf20Sopenharmony_ci		 * Boot processor to setup the FP and extended state
3628c2ecf20Sopenharmony_ci		 * context info.
3638c2ecf20Sopenharmony_ci		 */
3648c2ecf20Sopenharmony_ci		init_thread_xstate();
3658c2ecf20Sopenharmony_ci	}
3668c2ecf20Sopenharmony_ci}
367