aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/cpu/perf_event.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 5adce1040b11..53b569910175 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1210,6 +1210,7 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1210 break; 1210 break;
1211 1211
1212 case CPU_STARTING: 1212 case CPU_STARTING:
1213 set_in_cr4(X86_CR4_PCE);
1213 if (x86_pmu.cpu_starting) 1214 if (x86_pmu.cpu_starting)
1214 x86_pmu.cpu_starting(cpu); 1215 x86_pmu.cpu_starting(cpu);
1215 break; 1216 break;
@@ -1542,6 +1543,18 @@ static int x86_pmu_event_init(struct perf_event *event)
1542 return err; 1543 return err;
1543} 1544}
1544 1545
1546static int x86_pmu_event_idx(struct perf_event *event)
1547{
1548 int idx = event->hw.idx;
1549
1550 if (x86_pmu.num_counters_fixed && idx >= X86_PMC_IDX_FIXED) {
1551 idx -= X86_PMC_IDX_FIXED;
1552 idx |= 1 << 30;
1553 }
1554
1555 return idx + 1;
1556}
1557
1545static struct pmu pmu = { 1558static struct pmu pmu = {
1546 .pmu_enable = x86_pmu_enable, 1559 .pmu_enable = x86_pmu_enable,
1547 .pmu_disable = x86_pmu_disable, 1560 .pmu_disable = x86_pmu_disable,
@@ -1557,6 +1570,8 @@ static struct pmu pmu = {
1557 .start_txn = x86_pmu_start_txn, 1570 .start_txn = x86_pmu_start_txn,
1558 .cancel_txn = x86_pmu_cancel_txn, 1571 .cancel_txn = x86_pmu_cancel_txn,
1559 .commit_txn = x86_pmu_commit_txn, 1572 .commit_txn = x86_pmu_commit_txn,
1573
1574 .event_idx = x86_pmu_event_idx,
1560}; 1575};
1561 1576
1562/* 1577/*