提交 2d772f3f 编写于 作者: J Julien Thierry 提交者: Xie XiuQi

armv7 save/resore pmsel

hulk inclusion
category: feature
bugzilla: 12804
CVE: NA

-------------------------------------------------
Signed-off-by: NJulien Thierry <julien.thierry@arm.com>
Signed-off-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 0fdcd3a3
......@@ -736,10 +736,22 @@ static inline int armv7_pmnc_counter_has_overflowed(u32 pmnc, int idx)
return pmnc & BIT(ARMV7_IDX_TO_COUNTER(idx));
}
static inline void armv7_pmnc_select_counter(int idx)
static inline u32 armv7_pmsel_read(void)
{
u32 pmsel;
asm volatile("mrc p15, 0, %0, c9, c12, 5" : "=&r" (pmsel));
return pmsel;
}
static inline void armv7_pmsel_write(u32 counter)
{
u32 counter = ARMV7_IDX_TO_COUNTER(idx);
asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter));
}
static inline void armv7_pmnc_select_counter(int idx)
{
armv7_pmsel_write(ARMV7_IDX_TO_COUNTER(idx));
isb();
}
......@@ -952,8 +964,11 @@ static irqreturn_t armv7pmu_handle_irq(struct arm_pmu *cpu_pmu)
struct perf_sample_data data;
struct pmu_hw_events *cpuc = this_cpu_ptr(cpu_pmu->hw_events);
struct pt_regs *regs;
u32 pmsel;
int idx;
pmsel = armv7_pmsel_read();
/*
* Get and reset the IRQ flags
*/
......@@ -1004,6 +1019,8 @@ static irqreturn_t armv7pmu_handle_irq(struct arm_pmu *cpu_pmu)
*/
irq_work_run();
armv7_pmsel_write(pmsel);
return IRQ_HANDLED;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册