16
16
#include <linux/percpu.h>
17
17
#include <asm/arcregs.h>
18
18
#include <asm/stacktrace.h>
19
+ #include <asm/cluster.h>
19
20
#include <asm/perf_cluster.h>
20
21
21
22
@@ -45,20 +46,20 @@ static void arc_cluster_pmu_read_reg(unsigned int reg, void *data)
45
46
unsigned int val ;
46
47
47
48
spin_lock_irqsave (& cln_prot_op_spinlock , flags );
48
- WRITE_AUX (CLNR_ADDR , reg );
49
- READ_BCR (CLNR_DATA , val );
49
+ WRITE_AUX (ARC_REG_CLNR_ADDR , reg );
50
+ READ_BCR (ARC_REG_CLNR_DATA , val );
50
51
spin_unlock_irqrestore (& cln_prot_op_spinlock , flags );
51
- * (unsigned int * )data = val ;
52
+ * (unsigned int * )data = val ;
52
53
}
53
54
54
55
static void arc_cluster_pmu_write_reg (unsigned int reg , void * data )
55
56
{
56
57
unsigned long flags ;
57
- unsigned int val = * (unsigned int * )data ;
58
+ unsigned int val = * (unsigned int * )data ;
58
59
59
60
spin_lock_irqsave (& cln_prot_op_spinlock , flags );
60
- WRITE_AUX (CLNR_ADDR , reg );
61
- WRITE_AUX (CLNR_DATA , val );
61
+ WRITE_AUX (ARC_REG_CLNR_ADDR , reg );
62
+ WRITE_AUX (ARC_REG_CLNR_DATA , val );
62
63
spin_unlock_irqrestore (& cln_prot_op_spinlock , flags );
63
64
}
64
65
@@ -702,9 +703,10 @@ static int arc_cluster_pmu_device_probe(struct platform_device *pdev)
702
703
int ii ;
703
704
int has_interrupts = 0 , irq = -1 ;
704
705
int counter_size ; /* in bits */
705
- int ncounters ;
706
- int nevents ;
706
+ int ncounters ;
707
+ int nevents ;
707
708
u32 int_reg ;
709
+ struct bcr_clustv3_cfg cbcr ;
708
710
struct arc_cluster_cpu __percpu * pcpu ;
709
711
int ret ;
710
712
@@ -713,22 +715,23 @@ static int arc_cluster_pmu_device_probe(struct platform_device *pdev)
713
715
return - ENODEV ;
714
716
#endif
715
717
716
- if (!arc_cluster_pmu_is_present ()){
717
- pr_err ("Error! Cluster PCT module is not presented in the system.\n" );
718
- return - ENODEV ;
719
- }
718
+ READ_BCR (ARC_REG_CLUSTER_BCR , cbcr );
719
+ if (!cbcr .ver_maj || !arc_cluster_pmu_is_present ()){
720
+ pr_err ("Cluster PCT module doesn't present in the system.\n" );
721
+ return - ENODEV ;
722
+ }
720
723
721
- ncounters = arc_cluster_pmu_get_n_counters ();
722
- if (!ncounters ) {
723
- pr_err ("Error! Cluster PCT module doesn't have counters.\n" );
724
- return - EINVAL ;
725
- }
724
+ ncounters = arc_cluster_pmu_get_n_counters ();
725
+ if (!ncounters ) {
726
+ pr_err ("Cluster PCT module doesn't have counters.\n" );
727
+ return - EINVAL ;
728
+ }
726
729
727
730
nevents = arc_cluster_pmu_get_events_number ();
728
- if (!nevents ) {
729
- pr_err ("Error! Cluster PCT module doesn't have countable conditions.\n" );
730
- return - EINVAL ;
731
- }
731
+ if (!nevents ) {
732
+ pr_err ("Cluster PCT module doesn't have countable conditions.\n" );
733
+ return - EINVAL ;
734
+ }
732
735
733
736
arc_cluster_pmu = devm_kzalloc (& pdev -> dev , sizeof (struct arc_cluster_pmu ), GFP_KERNEL );
734
737
if (!arc_cluster_pmu )
0 commit comments