File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -690,18 +690,19 @@ static void arm_cmn_pmu_disable(struct pmu *pmu)
690
690
static u64 arm_cmn_read_dtm (struct arm_cmn * cmn , struct arm_cmn_hw_event * hw ,
691
691
bool snapshot )
692
692
{
693
+ struct arm_cmn_dtm * dtm = NULL ;
693
694
struct arm_cmn_node * dn ;
694
- unsigned int i , offset ;
695
- u64 count = 0 ;
695
+ unsigned int i , offset , dtm_idx ;
696
+ u64 reg , count = 0 ;
696
697
697
698
offset = snapshot ? CMN_DTM_PMEVCNTSR : CMN_DTM_PMEVCNT ;
698
699
for_each_hw_dn (hw , dn , i ) {
699
- struct arm_cmn_dtm * dtm = & cmn -> dtms [dn -> dtm ];
700
- int dtm_idx = arm_cmn_get_index ( hw -> dtm_idx , i ) ;
701
- u64 reg = readq_relaxed (dtm -> base + offset );
702
- u16 dtm_count = reg >> ( dtm_idx * 16 );
703
-
704
- count += dtm_count ;
700
+ if ( dtm ! = & cmn -> dtms [dn -> dtm ]) {
701
+ dtm = & cmn -> dtms [ dn -> dtm ] ;
702
+ reg = readq_relaxed (dtm -> base + offset );
703
+ }
704
+ dtm_idx = arm_cmn_get_index ( hw -> dtm_idx , i );
705
+ count += ( u16 )( reg >> ( dtm_idx * 16 )) ;
705
706
}
706
707
return count ;
707
708
}
You can’t perform that action at this time.
0 commit comments