forked from Mirrors/opensbi
		
	lib: Support vector extension
Enable vector context in mstatus by updating the corresponding bits in mstatus if vector extension is supported by the hart. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
		@@ -25,6 +25,7 @@
 | 
			
		||||
#define MSTATUS_MPP			(_UL(3) << MSTATUS_MPP_SHIFT)
 | 
			
		||||
#define MSTATUS_FS			_UL(0x00006000)
 | 
			
		||||
#define MSTATUS_XS			_UL(0x00018000)
 | 
			
		||||
#define MSTATUS_VS			_UL(0x01800000)
 | 
			
		||||
#define MSTATUS_MPRV			_UL(0x00020000)
 | 
			
		||||
#define MSTATUS_SUM			_UL(0x00040000)
 | 
			
		||||
#define MSTATUS_MXR			_UL(0x00080000)
 | 
			
		||||
@@ -53,6 +54,7 @@
 | 
			
		||||
#define SSTATUS_SPP			MSTATUS_SPP
 | 
			
		||||
#define SSTATUS_FS			MSTATUS_FS
 | 
			
		||||
#define SSTATUS_XS			MSTATUS_XS
 | 
			
		||||
#define SSTATUS_VS			MSTATUS_VS
 | 
			
		||||
#define SSTATUS_SUM			MSTATUS_SUM
 | 
			
		||||
#define SSTATUS_MXR			MSTATUS_MXR
 | 
			
		||||
#define SSTATUS32_SD			MSTATUS32_SD
 | 
			
		||||
 
 | 
			
		||||
@@ -25,10 +25,17 @@ void (*sbi_hart_unpriv_trap)(void) = &__sbi_unpriv_trap;
 | 
			
		||||
static void mstatus_init(struct sbi_scratch *scratch, u32 hartid)
 | 
			
		||||
{
 | 
			
		||||
	const struct sbi_platform *plat = sbi_platform_ptr(scratch);
 | 
			
		||||
	unsigned long mstatus_val = 0;
 | 
			
		||||
 | 
			
		||||
	/* Enable FPU */
 | 
			
		||||
	if (misa_extension('D') || misa_extension('F'))
 | 
			
		||||
		csr_write(CSR_MSTATUS, MSTATUS_FS);
 | 
			
		||||
		mstatus_val |=  MSTATUS_FS;
 | 
			
		||||
 | 
			
		||||
	/* Enable Vector context */
 | 
			
		||||
	if (misa_extension('V'))
 | 
			
		||||
		mstatus_val |=  MSTATUS_VS;
 | 
			
		||||
 | 
			
		||||
	csr_write(CSR_MSTATUS, mstatus_val);
 | 
			
		||||
 | 
			
		||||
	/* Enable user/supervisor use of perf counters */
 | 
			
		||||
	if (misa_extension('S') && sbi_platform_has_scounteren(plat))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user