Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1229049rdb; Fri, 2 Feb 2024 20:05:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaFI0iq9235Q0b79OlquNt7pJZ7BUJCl8XnRg2CvfvNTQNwPA7ecpe1B7GENv6M2zeEyB4 X-Received: by 2002:a05:6a20:d498:b0:19c:9a00:1351 with SMTP id im24-20020a056a20d49800b0019c9a001351mr881084pzb.25.1706933105136; Fri, 02 Feb 2024 20:05:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706933105; cv=pass; d=google.com; s=arc-20160816; b=T2CRZnRCEVNzd+RuF3s35CQnz6UNkeq4pxJEdnw9cy4ZWw30wA6vItV2j3WeUZSHNX Yhfbdae457J+rwXi68OkpDv2sfZLe81i5UuM587wRYeyqooeU1VbiSTFNJfvuwxDYzYt qdMUS49Fus3mCU5I5LL5v/azWqNU+2PInHWFCheePiEiLH9bvsYtfTE7qd3YUdCSohCh eFGQVqQkMewGclztaGRPeQ8mTVORx6qpZvr4w/sqgOjA0KvZ+mhnY5aUPHPYXkixm/MO RDsTS1Viz0sFlarQH0MU+Fg6hmnnuL+7VJoAffPufqP//sS4fInpETaJ8K7NTcJXD8+h OPmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=S/g3f+KXb0ZkTZ85yLowFjbHA7A6qWiZDlxGs+N5v20=; fh=Mu1boy98F2inAf4y52+0vVLBdDDjtUNrOv2WLTPzH2Y=; b=ufffz38v1y/qfmc/hfp8p1F0MadGIGX+Wa1cgNsQVCeS3CulukPiMnD45hC+ZR5tJ2 iTpgneVpFe9YNdI2CDTeWrgxARj/k5nxQYMG3BjyRALn4FK6v3is5Y6kJlhWhxzXQwY8 Q+28OSFqOAyMZyDKW1SkidtexYxUlEMi2HBsLZUScIoq+8rEMeeTUD19wEcHGXDb0HnN Uh5zYBDghcKg4tJbFJBJMaFkVeH/X0Isf0fuUaWP/aX+y3ABeSbEtnaFUDmRtJqS4lbN KDxHD5ad7DZRsiq8uEpaLg58kYN4rEEoIhXxbzcDIhhaSx7NarGKQpoSrXdDU43k0I/C ZyYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="kX/rc4Fk"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-50901-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50901-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCWod56HaS9fk0IuUf3xou82o/lpvCffs+Bpu3qdQSTsM8WZmGm06s3dPAeoPPSYezeDkM/cn/WrFSUNd41nlKpkQXovagzIBKioqwb3pA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k16-20020a628410000000b006dddf6290cfsi2479077pfd.392.2024.02.02.20.05.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 20:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50901-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="kX/rc4Fk"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-50901-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50901-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3045928A548 for ; Sat, 3 Feb 2024 04:05:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC002111B0; Sat, 3 Feb 2024 04:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kX/rc4Fk" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCECDF9FD; Sat, 3 Feb 2024 04:04:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706933047; cv=none; b=rAoPNJKfdblkP07BDaA97EBWiTsL0XuetURcYkUWLiIKVp18vgvjWucZOWa96wWXNM5920C/oboFxDh9kxn/mRHbtdOXb/rgBQAK5PojpV7m7LfPTiBVzzF++zW92c+UBTXjAAYZN2pBGCTM/AJ1v4uBND4C/6Yga+uWMyE56rI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706933047; c=relaxed/simple; bh=Pcpg+RONIxK6V+cB6JOTzMh7v9Tu8BTb7TgeuU7pUV4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=UoOcj6OSj8ar1gji3u3ak/0u/5rC1GFQtqN8Wc1SChEJW2HbOnbhijcSb5NTXXaVO0Gb7pusjvFN+3clH8NIlq7fpP93kImBo9OGCBdPMZlaD4+vv5mG8QWVMMFnGqyPBHIQQem3EuvOSUMNwCwnEofo98ES8vB3helgCvTZpuc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kX/rc4Fk; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706933046; x=1738469046; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Pcpg+RONIxK6V+cB6JOTzMh7v9Tu8BTb7TgeuU7pUV4=; b=kX/rc4Fkf/tBAyaX0uyKsX0onz6aoBcXH0IYYm0cuGgpIbJn78sGb5VT 68fYXO/MCUyiCz+JAAapKaRFCyUWVTaaUueX6ahjY271jNVPf2+cX1Omz XFiNlNMn9I+2WMwlNK1ghcN/ZWQg8+P5rbn3SgDVIjZqh5h1SQb30y3VB JBwaubJTYPwMb7ghGwFBvzSwmzgZB/bNa4FoKR5g1Xq2i2aMIUBh4zYgU hnzyFO6NHPvQEGrUo2i/cmN4oJITmWWZAH+ujQOLn65aIUEH2pvkvuld6 9koOEgsqY4GVgaZ2NwLlCaFjd4+KNbrDOkO5VDKrr7APGGXn+uxfszbgT A==; X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="4181417" X-IronPort-AV: E=Sophos;i="6.05,238,1701158400"; d="scan'208";a="4181417" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 20:04:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="823382511" X-IronPort-AV: E=Sophos;i="6.05,238,1701158400"; d="scan'208";a="823382511" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga001.jf.intel.com with ESMTP; 02 Feb 2024 20:04:03 -0800 From: Ricardo Neri To: "Rafael J. Wysocki" Cc: Len Brown , Srinivas Pandruvada , Stanislaw Gruszka , Zhao Liu , Zhuocheng Ding , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri Subject: [PATCH 3/9] thermal: intel: hfi: Move selected data structures to a header file Date: Fri, 2 Feb 2024 20:05:09 -0800 Message-Id: <20240203040515.23947-4-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240203040515.23947-1-ricardo.neri-calderon@linux.intel.com> References: <20240203040515.23947-1-ricardo.neri-calderon@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Zhuocheng Ding 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 Cc: Rafael J. Wysocki Cc: Srinivas Pandruvada Cc: Stanislaw Gruszka Cc: x86@kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Zhuocheng Ding Co-developed-by: Zhao Liu Signed-off-by: Zhao Liu Signed-off-by: Ricardo Neri --- 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 #include +#include #include #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