Skip to content

Commit fd3ae1e

Browse files
Stephane EranianIngo Molnar
authored andcommitted
perf/x86/rapl: Move RAPL support to common x86 code
To prepare for support of both Intel and AMD RAPL. As per the AMD PPR, Fam17h support Package RAPL counters to monitor power usage. The RAPL counter operates as with Intel RAPL, and as such it is beneficial to share the code. No change in functionality. Signed-off-by: Stephane Eranian <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0bffedb commit fd3ae1e

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

arch/x86/events/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ config PERF_EVENTS_INTEL_UNCORE
1010
available on NehalemEX and more modern processors.
1111

1212
config PERF_EVENTS_INTEL_RAPL
13-
tristate "Intel rapl performance events"
14-
depends on PERF_EVENTS && CPU_SUP_INTEL && PCI
13+
tristate "Intel/AMD rapl performance events"
14+
depends on PERF_EVENTS && (CPU_SUP_INTEL || CPU_SUP_AMD) && PCI
1515
default y
1616
---help---
17-
Include support for Intel rapl performance events for power
17+
Include support for Intel and AMD rapl performance events for power
1818
monitoring on modern processors.
1919

2020
config PERF_EVENTS_INTEL_CSTATE

arch/x86/events/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-y += core.o probe.o
3+
obj-$(PERF_EVENTS_INTEL_RAPL) += rapl.o
34
obj-y += amd/
45
obj-$(CONFIG_X86_LOCAL_APIC) += msr.o
56
obj-$(CONFIG_CPU_SUP_INTEL) += intel/

arch/x86/events/intel/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
obj-$(CONFIG_CPU_SUP_INTEL) += core.o bts.o
33
obj-$(CONFIG_CPU_SUP_INTEL) += ds.o knc.o
44
obj-$(CONFIG_CPU_SUP_INTEL) += lbr.o p4.o p6.o pt.o
5-
obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL) += intel-rapl-perf.o
6-
intel-rapl-perf-objs := rapl.o
75
obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE) += intel-uncore.o
86
intel-uncore-objs := uncore.o uncore_nhmex.o uncore_snb.o uncore_snbep.o
97
obj-$(CONFIG_PERF_EVENTS_INTEL_CSTATE) += intel-cstate.o

arch/x86/events/intel/rapl.c renamed to arch/x86/events/rapl.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Support Intel RAPL energy consumption counters
3+
* Support Intel/AMD RAPL energy consumption counters
44
* Copyright (C) 2013 Google, Inc., Stephane Eranian
55
*
66
* Intel RAPL interface is specified in the IA-32 Manual Vol3b
77
* section 14.7.1 (September 2013)
88
*
9+
* AMD RAPL interface for Fam17h is described in the public PPR:
10+
* https://bugzilla.kernel.org/show_bug.cgi?id=206537
11+
*
912
* RAPL provides more controls than just reporting energy consumption
1013
* however here we only expose the 3 energy consumption free running
1114
* counters (pp0, pkg, dram).
@@ -58,8 +61,8 @@
5861
#include <linux/nospec.h>
5962
#include <asm/cpu_device_id.h>
6063
#include <asm/intel-family.h>
61-
#include "../perf_event.h"
62-
#include "../probe.h"
64+
#include "perf_event.h"
65+
#include "probe.h"
6366

6467
MODULE_LICENSE("GPL");
6568

0 commit comments

Comments
 (0)