hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/arch/x86/events/amd/power.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Performance events - AMD Processor Power Reporting Mechanism
34 *
45 * Copyright (C) 2016 Advanced Micro Devices, Inc.
56 *
67 * Author: Huang Rui <ray.huang@amd.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/module.h>
....@@ -15,10 +12,6 @@
1512 #include <linux/perf_event.h>
1613 #include <asm/cpu_device_id.h>
1714 #include "../perf_event.h"
18
-
19
-#define MSR_F15H_CU_PWR_ACCUMULATOR 0xc001007a
20
-#define MSR_F15H_CU_MAX_PWR_ACCUMULATOR 0xc001007b
21
-#define MSR_F15H_PTSC 0xc0010280
2215
2316 /* Event code: LSB 8 bits, passed in attr->config any other bit is reserved. */
2417 #define AMD_POWER_EVENT_MASK 0xFFULL
....@@ -136,14 +129,7 @@
136129 return -ENOENT;
137130
138131 /* Unsupported modes and filters. */
139
- if (event->attr.exclude_user ||
140
- event->attr.exclude_kernel ||
141
- event->attr.exclude_hv ||
142
- event->attr.exclude_idle ||
143
- event->attr.exclude_host ||
144
- event->attr.exclude_guest ||
145
- /* no sampling */
146
- event->attr.sample_period)
132
+ if (event->attr.sample_period)
147133 return -EINVAL;
148134
149135 if (cfg != AMD_POWER_EVENTSEL_PKG)
....@@ -226,6 +212,8 @@
226212 .start = pmu_event_start,
227213 .stop = pmu_event_stop,
228214 .read = pmu_event_read,
215
+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
216
+ .module = THIS_MODULE,
229217 };
230218
231219 static int power_cpu_exit(unsigned int cpu)
....@@ -268,7 +256,7 @@
268256 }
269257
270258 static const struct x86_cpu_id cpu_match[] = {
271
- { .vendor = X86_VENDOR_AMD, .family = 0x15 },
259
+ X86_MATCH_VENDOR_FAM(AMD, 0x15, NULL),
272260 {},
273261 };
274262