hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/cpufreq/amd_freq_sensitivity.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * amd_freq_sensitivity.c: AMD frequency sensitivity feedback powersave bias
34 * for the ondemand governor.
....@@ -5,10 +6,6 @@
56 * Copyright (C) 2013 Advanced Micro Devices, Inc.
67 *
78 * Author: Jacob Shin <jacob.shin@amd.com>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
129 */
1310
1411 #include <linux/kernel.h>
....@@ -21,6 +18,7 @@
2118
2219 #include <asm/msr.h>
2320 #include <asm/cpufeature.h>
21
+#include <asm/cpu_device_id.h>
2422
2523 #include "cpufreq_ondemand.h"
2624
....@@ -111,15 +109,20 @@
111109 {
112110 u64 val;
113111 struct pci_dev *pcidev;
112
+ unsigned int pci_vendor;
114113
115
- if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
114
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
115
+ pci_vendor = PCI_VENDOR_ID_AMD;
116
+ else if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
117
+ pci_vendor = PCI_VENDOR_ID_HYGON;
118
+ else
116119 return -ENODEV;
117120
118
- pcidev = pci_get_device(PCI_VENDOR_ID_AMD,
121
+ pcidev = pci_get_device(pci_vendor,
119122 PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, NULL);
120123
121124 if (!pcidev) {
122
- if (!static_cpu_has(X86_FEATURE_PROC_FEEDBACK))
125
+ if (!boot_cpu_has(X86_FEATURE_PROC_FEEDBACK))
123126 return -ENODEV;
124127 }
125128
....@@ -141,8 +144,8 @@
141144 }
142145 module_exit(amd_freq_sensitivity_exit);
143146
144
-static const struct x86_cpu_id amd_freq_sensitivity_ids[] = {
145
- X86_FEATURE_MATCH(X86_FEATURE_PROC_FEEDBACK),
147
+static const struct x86_cpu_id __maybe_unused amd_freq_sensitivity_ids[] = {
148
+ X86_MATCH_FEATURE(X86_FEATURE_PROC_FEEDBACK, NULL),
146149 {}
147150 };
148151 MODULE_DEVICE_TABLE(x86cpu, amd_freq_sensitivity_ids);