Skip to content

Commit

Permalink
perf: qcom_l2_pmu: Use Kryo L2 accessors functions from separate file
Browse files Browse the repository at this point in the history
The Kryo L2 Accessors functions have been moved to a separate
file so that they are accessible by more than just the qcom_l2_pmu.
  • Loading branch information
kholk committed May 24, 2019
1 parent e67e38a commit 85bb7f8
Showing 1 changed file with 1 addition and 47 deletions.
48 changes: 1 addition & 47 deletions drivers/perf/qcom_l2_pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <asm/barrier.h>
#include <asm/local64.h>
#include <asm/sysreg.h>
#include <soc/qcom/kryo-l2-accessors.h>

#define MAX_L2_CTRS 9

Expand Down Expand Up @@ -87,9 +87,6 @@
#define L2_COUNTER_RELOAD BIT_ULL(31)
#define L2_CYCLE_COUNTER_RELOAD BIT_ULL(63)

#define L2CPUSRSELR_EL1 sys_reg(3, 3, 15, 0, 6)
#define L2CPUSRDR_EL1 sys_reg(3, 3, 15, 0, 7)

#define reg_idx(reg, i) (((i) * IA_L2_REG_OFFSET) + reg##_BASE)

/*
Expand All @@ -107,49 +104,6 @@
#define L2_EVENT_STREX 0x421
#define L2_EVENT_CLREX 0x422

static DEFINE_RAW_SPINLOCK(l2_access_lock);

/**
* set_l2_indirect_reg: write value to an L2 register
* @reg: Address of L2 register.
* @value: Value to be written to register.
*
* Use architecturally required barriers for ordering between system register
* accesses
*/
static void set_l2_indirect_reg(u64 reg, u64 val)
{
unsigned long flags;

raw_spin_lock_irqsave(&l2_access_lock, flags);
write_sysreg_s(reg, L2CPUSRSELR_EL1);
isb();
write_sysreg_s(val, L2CPUSRDR_EL1);
isb();
raw_spin_unlock_irqrestore(&l2_access_lock, flags);
}

/**
* get_l2_indirect_reg: read an L2 register value
* @reg: Address of L2 register.
*
* Use architecturally required barriers for ordering between system register
* accesses
*/
static u64 get_l2_indirect_reg(u64 reg)
{
u64 val;
unsigned long flags;

raw_spin_lock_irqsave(&l2_access_lock, flags);
write_sysreg_s(reg, L2CPUSRSELR_EL1);
isb();
val = read_sysreg_s(L2CPUSRDR_EL1);
raw_spin_unlock_irqrestore(&l2_access_lock, flags);

return val;
}

struct cluster_pmu;

/*
Expand Down

0 comments on commit 85bb7f8

Please sign in to comment.