mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <shiju.jose@huawei.com>
To: <dave.jiang@intel.com>, <dan.j.williams@intel.com>,
	<jonathan.cameron@huawei.com>, <alison.schofield@intel.com>,
	<vishal.l.verma@intel.com>, <ira.weiny@intel.com>,
	<dave@stgolabs.net>, <linux-cxl@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>,
	<tanxiaofei@huawei.com>, <prime.zeng@hisilicon.com>,
	<shiju.jose@huawei.com>
Subject: [PATCH v2 2/6] cxl/events: Add Component Identifier formatting for CXL spec rev 3.1
Date: Tue, 22 Oct 2024 11:58:45 +0100	[thread overview]
Message-ID: <20241022105849.1272-3-shiju.jose@huawei.com> (raw)
In-Reply-To: <20241022105849.1272-1-shiju.jose@huawei.com>

From: Shiju Jose <shiju.jose@huawei.com>

Add Component Identifier formatting for CXL spec rev 3.1, Section
8.2.9.2.1, Table 8-44.

Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
---
 drivers/cxl/core/trace.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
index 7305974e2301..81908072c6f3 100644
--- a/drivers/cxl/core/trace.h
+++ b/drivers/cxl/core/trace.h
@@ -268,6 +268,26 @@ TRACE_EVENT(cxl_generic_event,
 	{ CXL_DPA_NOT_REPAIRABLE,		"NOT_REPAIRABLE"	}  \
 )
 
+/*
+ * Component ID Format
+ * CXL 3.1 section 8.2.9.2.1; Table 8-44
+ */
+#define CXL_PLDM_COMPONENT_ID_ENTITY_VALID	BIT(0)
+#define CXL_PLDM_COMPONENT_ID_RES_VALID		BIT(1)
+
+#define comp_id_pldm_flags(flags)  __print_flags(flags, " | ",			\
+	{ CXL_PLDM_COMPONENT_ID_ENTITY_VALID,   "PLDM_Entity_ID[5:0] " },	\
+	{ CXL_PLDM_COMPONENT_ID_RES_VALID,      "Resource_ID[9:6] " }		\
+)
+
+#define cxl_print_component_id(flags, valid_comp_id, valid_id_format, comp_id)			\
+	(flags & valid_comp_id && flags & valid_id_format) ?					\
+	(comp_id[0] & (CXL_PLDM_COMPONENT_ID_ENTITY_VALID | CXL_PLDM_COMPONENT_ID_RES_VALID)) ?	\
+	__print_hex(&comp_id[1], 10) : (comp_id[0] & CXL_PLDM_COMPONENT_ID_ENTITY_VALID) ?	\
+	__print_hex(&comp_id[1], 6) : (comp_id[0] & CXL_PLDM_COMPONENT_ID_RES_VALID) ?		\
+	__print_hex(&comp_id[7], 4) : __print_hex(comp_id, CXL_EVENT_GEN_MED_COMP_ID_SIZE) :	\
+	__print_hex(comp_id, CXL_EVENT_GEN_MED_COMP_ID_SIZE)
+
 /*
  * General Media Event Record - GMER
  * CXL rev 3.0 Section 8.2.9.2.1.1; Table 8-43
-- 
2.34.1


  parent reply	other threads:[~2024-10-22 10:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22 10:58 [PATCH v2 0/6] Update Event Records to " shiju.jose
2024-10-22 10:58 ` [PATCH v2 1/6] cxl/events: Update Common Event Record " shiju.jose
2024-10-23  0:50   ` Davidlohr Bueso
2024-10-22 10:58 ` shiju.jose [this message]
2024-10-22 16:58   ` [PATCH v2 2/6] cxl/events: Add Component Identifier formatting for " Jonathan Cameron
2024-10-22 18:07     ` Shiju Jose
2024-10-22 10:58 ` [PATCH v2 3/6] cxl/events: Update General Media Event Record to " shiju.jose
2024-10-23  2:23   ` Davidlohr Bueso
2024-10-22 10:58 ` [PATCH v2 4/6] cxl/events: Update DRAM " shiju.jose
2024-10-23  2:24   ` Davidlohr Bueso
2024-10-22 10:58 ` [PATCH v2 5/6] cxl/events: Update Memory Module " shiju.jose
2024-10-22 10:58 ` [PATCH v2 6/6] cxl/test: Update test code for event records " shiju.jose

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=20241022105849.1272-3-shiju.jose@huawei.com \
    --to=shiju.jose@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=tanxiaofei@huawei.com \
    --cc=vishal.l.verma@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®