mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>
Subject: [PATCH 04/10] platform/x86/intel/tpmi: Add additional TPMI header fields
Date: Tue, 23 Apr 2024 13:46:13 -0700	[thread overview]
Message-ID: <20240423204619.3946901-5-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <20240423204619.3946901-1-srinivas.pandruvada@linux.intel.com>

TPMI information header added additional fields in version 2. Some of the
reserved fields in version 1 are used to define new fields.

Parse new fields and export as part of platform data. These fields include:
- PCI segment ID
- Partition ID of the package: If a package is represented by more than
  one PCI device, then partition ID along with cdie_mask, describes the
  scope. For example to update get/set properties for a compute die, one
  of the PCI MMIO region is selected from the partition ID.
- cdie_mask: Mask of all compute dies in this partition.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/platform/x86/intel/tpmi.c | 15 ++++++++++++++-
 include/linux/intel_tpmi.h        |  6 ++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel/tpmi.c b/drivers/platform/x86/intel/tpmi.c
index a5bcb77bcb35..6c0cbccd80bb 100644
--- a/drivers/platform/x86/intel/tpmi.c
+++ b/drivers/platform/x86/intel/tpmi.c
@@ -128,6 +128,9 @@ struct intel_tpmi_info {
  * @dev:	PCI device number
  * @bus:	PCI bus number
  * @pkg:	CPU Package id
+ * @segment:	PCI segment id
+ * @partition:	Package Partition id
+ * @cdie_mask:	Bitmap of compute dies in the current partition
  * @reserved:	Reserved for future use
  * @lock:	When set to 1 the register is locked and becomes read-only
  *		until next reset. Not for use by the OS driver.
@@ -139,7 +142,10 @@ struct tpmi_info_header {
 	u64 dev:5;
 	u64 bus:8;
 	u64 pkg:8;
-	u64 reserved:39;
+	u64 segment:8;
+	u64 partition:2;
+	u64 cdie_mask:16;
+	u64 reserved:13;
 	u64 lock:1;
 } __packed;
 
@@ -667,6 +673,7 @@ static int tpmi_create_devices(struct intel_tpmi_info *tpmi_info)
 
 #define TPMI_INFO_BUS_INFO_OFFSET	0x08
 #define TPMI_INFO_MAJOR_VERSION		0x00
+#define TPMI_INFO_MINOR_VERSION		0x02
 
 static int tpmi_process_info(struct intel_tpmi_info *tpmi_info,
 			     struct intel_tpmi_pm_feature *pfs)
@@ -693,6 +700,12 @@ static int tpmi_process_info(struct intel_tpmi_info *tpmi_info,
 	tpmi_info->plat_info.device_number = header.dev;
 	tpmi_info->plat_info.function_number = header.fn;
 
+	if (TPMI_MINOR_VERSION(feature_header) >= TPMI_INFO_MINOR_VERSION) {
+		tpmi_info->plat_info.cdie_mask = header.cdie_mask;
+		tpmi_info->plat_info.partition = header.partition;
+		tpmi_info->plat_info.segment = header.segment;
+	}
+
 error_info_header:
 	iounmap(info_mem);
 
diff --git a/include/linux/intel_tpmi.h b/include/linux/intel_tpmi.h
index 685a41dddf82..1e880cb0f454 100644
--- a/include/linux/intel_tpmi.h
+++ b/include/linux/intel_tpmi.h
@@ -27,7 +27,10 @@ enum intel_tpmi_id {
 
 /**
  * struct intel_tpmi_plat_info - Platform information for a TPMI device instance
+ * @cdie_mask:       Mask of all compute dies in the partition
  * @package_id:      CPU Package id
+ * @partition:       Package partition id when multiple VSEC PCI devices per package
+ * @segment:         PCI segment ID
  * @bus_number:      PCI bus number
  * @device_number:   PCI device number
  * @function_number: PCI function number
@@ -36,7 +39,10 @@ enum intel_tpmi_id {
  * struct is used to return data via tpmi_get_platform_data().
  */
 struct intel_tpmi_plat_info {
+	u16 cdie_mask;
 	u8 package_id;
+	u8 partition;
+	u8 segment;
 	u8 bus_number;
 	u8 device_number;
 	u8 function_number;
-- 
2.40.1


  parent reply	other threads:[~2024-04-23 20:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 20:46 [PATCH 00/10] Support partitioned systems Srinivas Pandruvada
2024-04-23 20:46 ` [PATCH 01/10] platform/x86/intel/tpmi: Handle error from tpmi_process_info() Srinivas Pandruvada
2024-04-23 20:46 ` [PATCH 02/10] platform/x86/intel/tpmi: Check major version change for TPMI Information Srinivas Pandruvada
2024-04-23 20:46 ` [PATCH 03/10] platform/x86/intel/tpmi: Align comments in kernel-doc Srinivas Pandruvada
2024-04-23 20:46 ` Srinivas Pandruvada [this message]
2024-04-23 20:46 ` [PATCH 05/10] platform/x86: ISST: Use local variable for auxdev->dev Srinivas Pandruvada
2024-04-23 20:46 ` [PATCH 06/10] platform/x86: ISST: Shorten the assignments for power_domain_info Srinivas Pandruvada
2024-04-23 20:46 ` [PATCH 07/10] platform/x86: ISST: Support partitioned systems Srinivas Pandruvada
2024-04-23 20:46 ` [PATCH 08/10] platform/x86: ISST: Use in_range() to check package ID validity Srinivas Pandruvada
2024-04-23 20:46 ` [PATCH 09/10] platform/x86: ISST: Add dev_fmt Srinivas Pandruvada
2024-04-23 20:46 ` [PATCH 10/10] platform/x86: ISST: Add missing MODULE_DESCRIPTION Srinivas Pandruvada
2024-04-29 11:03 ` [PATCH 00/10] Support partitioned systems Hans de Goede

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=20240423204619.3946901-5-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rui.zhang@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®