forked from Mirrors/opensbi
		
	lib: pmu: check SSCOF before masking
We should check if SSCOF extension is present, before applying inhibit mask and clearing overflow, otherwise undesirable value can be written in MHPMEVENT_N CSR. Signed-off-by: Nikita Shubin <n.shubin@yadro.com> Reviewed-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Xiang W <wxjstz@126.com>
This commit is contained in:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							66fbcc03df
						
					
				
				
					commit
					460041c816
				
			@@ -467,7 +467,8 @@ static int pmu_update_hw_mhpmevent(struct sbi_pmu_hw_event *hw_evt, int ctr_idx,
 | 
			
		||||
		return SBI_EFAIL;
 | 
			
		||||
 | 
			
		||||
	/* Always clear the OVF bit and inhibit countin of events in M-mode */
 | 
			
		||||
	mhpmevent_val = (mhpmevent_val & ~MHPMEVENT_SSCOF_MASK) | MHPMEVENT_MINH;
 | 
			
		||||
	if (sbi_hart_has_feature(scratch, SBI_HART_HAS_SSCOFPMF))
 | 
			
		||||
		mhpmevent_val = (mhpmevent_val & ~MHPMEVENT_SSCOF_MASK) | MHPMEVENT_MINH;
 | 
			
		||||
 | 
			
		||||
	/* Update the inhibit flags based on inhibit flags received from supervisor */
 | 
			
		||||
	pmu_update_inhibit_flags(flags, &mhpmevent_val);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user