From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Len Brown <len.brown@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,
Zhao Liu <zhao1.liu@intel.com>,
Zhuocheng Ding <zhuocheng.ding@intel.com>,
x86@kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Subject: [PATCH 3/9] thermal: intel: hfi: Move selected data structures to a header file
Date: Fri, 2 Feb 2024 20:05:09 -0800 [thread overview]
Message-ID: <20240203040515.23947-4-ricardo.neri-calderon@linux.intel.com> (raw)
In-Reply-To: <20240203040515.23947-1-ricardo.neri-calderon@linux.intel.com>
From: Zhuocheng Ding <zhuocheng.ding@intel.com>
The virtualization of HFI needs the definitions of HFI capabilities and
the HFI table. Move these definitions into a header file under arch/x86.
No changes in the relocated structures.
Cc: Len Brown <len.brown@intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Cc: x86@kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Zhuocheng Ding <zhuocheng.ding@intel.com>
Co-developed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
MAINTAINERS | 1 +
arch/x86/include/asm/hfi.h | 70 +++++++++++++++++++++++++++++++
drivers/thermal/intel/intel_hfi.c | 66 +----------------------------
3 files changed, 72 insertions(+), 65 deletions(-)
create mode 100644 arch/x86/include/asm/hfi.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 8999497011a2..8bc873ba82fa 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21788,6 +21788,7 @@ L: linux-pm@vger.kernel.org
S: Supported
Q: https://patchwork.kernel.org/project/linux-pm/list/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal
+F: arch/x86/include/asm/hfi.h
F: Documentation/ABI/testing/sysfs-class-thermal
F: Documentation/admin-guide/thermal/
F: Documentation/devicetree/bindings/thermal/
diff --git a/arch/x86/include/asm/hfi.h b/arch/x86/include/asm/hfi.h
new file mode 100644
index 000000000000..ed8a548a376e
--- /dev/null
+++ b/arch/x86/include/asm/hfi.h
@@ -0,0 +1,70 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_X86_HFI_H
+#define _ASM_X86_HFI_H
+
+/* CPUID detection and enumeration definitions for HFI */
+
+union hfi_capabilities {
+ struct {
+ u8 performance:1;
+ u8 energy_efficiency:1;
+ u8 __reserved:6;
+ } split;
+ u8 bits;
+};
+
+union cpuid6_edx {
+ struct {
+ union hfi_capabilities capabilities;
+ u32 table_pages:4;
+ u32 __reserved:4;
+ s32 index:16;
+ } split;
+ u32 full;
+};
+
+/**
+ * struct hfi_hdr - Header of the HFI table
+ * @perf_updated: Hardware updated performance capabilities
+ * @ee_updated: Hardware updated energy efficiency capabilities
+ *
+ * Properties of the data in an HFI table.
+ */
+struct hfi_hdr {
+ u8 perf_updated;
+ u8 ee_updated;
+} __packed;
+
+/**
+ * struct hfi_table - Representation of an HFI table
+ * @base_addr: Base address of the local copy of the HFI table
+ * @timestamp: Timestamp of the last update of the local table.
+ * Located at the base of the local table.
+ * @hdr: Base address of the header of the local table
+ * @data: Base address of the data of the local table
+ */
+struct hfi_table {
+ union {
+ void *base_addr;
+ u64 *timestamp;
+ };
+ void *hdr;
+ void *data;
+};
+
+/**
+ * struct hfi_features - Supported HFI features
+ * @nr_table_pages: Size of the HFI table in 4KB pages
+ * @cpu_stride: Stride size to locate the capability data of a logical
+ * processor within the table (i.e., row stride)
+ * @hdr_size: Size of the table header
+ *
+ * Parameters and supported features that are common to all HFI instances
+ */
+struct hfi_features {
+ size_t nr_table_pages;
+ unsigned int cpu_stride;
+ unsigned int hdr_size;
+};
+
+#endif /* _ASM_X86_HFI_H */
diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c
index eeabdf072efd..ee8950a60f72 100644
--- a/drivers/thermal/intel/intel_hfi.c
+++ b/drivers/thermal/intel/intel_hfi.c
@@ -41,6 +41,7 @@
#include <linux/topology.h>
#include <linux/workqueue.h>
+#include <asm/hfi.h>
#include <asm/msr.h>
#include "intel_hfi.h"
@@ -48,29 +49,8 @@
#include "../thermal_netlink.h"
-/* CPUID detection and enumeration definitions for HFI */
-
#define CPUID_HFI_LEAF 6
-union hfi_capabilities {
- struct {
- u8 performance:1;
- u8 energy_efficiency:1;
- u8 __reserved:6;
- } split;
- u8 bits;
-};
-
-union cpuid6_edx {
- struct {
- union hfi_capabilities capabilities;
- u32 table_pages:4;
- u32 __reserved:4;
- s32 index:16;
- } split;
- u32 full;
-};
-
/**
* struct hfi_cpu_data - HFI capabilities per CPU
* @perf_cap: Performance capability
@@ -84,35 +64,6 @@ struct hfi_cpu_data {
u8 ee_cap;
} __packed;
-/**
- * struct hfi_hdr - Header of the HFI table
- * @perf_updated: Hardware updated performance capabilities
- * @ee_updated: Hardware updated energy efficiency capabilities
- *
- * Properties of the data in an HFI table.
- */
-struct hfi_hdr {
- u8 perf_updated;
- u8 ee_updated;
-} __packed;
-
-/**
- * struct hfi_table - Representation of an HFI table
- * @base_addr: Base address of the local copy of the HFI table
- * @timestamp: Timestamp of the last update of the local table.
- * Located at the base of the local table.
- * @hdr: Base address of the header of the local table
- * @data: Base address of the data of the local table
- */
-struct hfi_table {
- union {
- void *base_addr;
- u64 *timestamp;
- };
- void *hdr;
- void *data;
-};
-
/**
* struct hfi_instance - Representation of an HFI instance (i.e., a table)
* @local_table: Local copy of HFI table for this instance
@@ -133,21 +84,6 @@ struct hfi_instance {
raw_spinlock_t event_lock;
};
-/**
- * struct hfi_features - Supported HFI features
- * @nr_table_pages: Size of the HFI table in 4KB pages
- * @cpu_stride: Stride size to locate the capability data of a logical
- * processor within the table (i.e., row stride)
- * @hdr_size: Size of the table header
- *
- * Parameters and supported features that are common to all HFI instances
- */
-struct hfi_features {
- size_t nr_table_pages;
- unsigned int cpu_stride;
- unsigned int hdr_size;
-};
-
/**
* struct hfi_cpu_info - Per-CPU attributes to consume HFI data
* @index: Row of this CPU in its HFI table
--
2.25.1
next prev parent reply other threads:[~2024-02-03 4:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-03 4:05 [PATCH 0/9] thermal: intel: hfi: Prework for the virtualization of HFI Ricardo Neri
2024-02-03 4:05 ` [PATCH 1/9] thermal: intel: hfi: Relocate bit definitions of HFI registers Ricardo Neri
2024-02-03 4:05 ` [PATCH 2/9] thermal: intel: hfi: Introduce the hfi_table structure Ricardo Neri
2024-02-03 4:05 ` Ricardo Neri [this message]
2024-02-03 4:05 ` [PATCH 4/9] thermal: intel: hfi: Introduce Intel Thread Director classes Ricardo Neri
2024-02-03 4:05 ` [PATCH 5/9] x86/cpufeatures: Add the Intel Thread Director feature definitions Ricardo Neri
2024-02-03 4:05 ` [PATCH 6/9] thermal: intel: hfi: Enable Intel Thread Director Ricardo Neri
2024-02-05 10:28 ` Stanislaw Gruszka
2024-02-06 2:57 ` Ricardo Neri
2024-02-03 4:05 ` [PATCH 7/9] x86/cpufeatures: Add feature bit for HRESET Ricardo Neri
2024-02-03 9:36 ` Borislav Petkov
2024-02-04 3:49 ` Ricardo Neri
2024-02-03 4:05 ` [PATCH 8/9] x86/hreset: Configure history reset Ricardo Neri
2024-02-03 9:38 ` Borislav Petkov
2024-02-04 3:55 ` Ricardo Neri
2024-02-04 10:49 ` Borislav Petkov
2024-02-06 2:37 ` Ricardo Neri
2024-02-03 4:05 ` [PATCH 9/9] x86/cpu: Introduce interface to reset hardware history Ricardo Neri
2024-02-03 9:40 ` Borislav Petkov
2024-02-04 3:48 ` Ricardo Neri
2024-02-06 2:59 ` [PATCH 0/9] thermal: intel: hfi: Prework for the virtualization of HFI Ricardo Neri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240203040515.23947-4-ricardo.neri-calderon@linux.intel.com \
--to=ricardo.neri-calderon@linux.intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=stanislaw.gruszka@linux.intel.com \
--cc=x86@kernel.org \
--cc=zhao1.liu@intel.com \
--cc=zhuocheng.ding@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®