Skip to contentSkip to conversation

cxl/hdm: Add debug message for invalid interleave granularity

PATCH In review Huang Ying 2 participants 2 messages Apr 2, 2024 – Apr 3, 2024 CXL

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

PATCH 1/1 cxl/hdm: Add debug message for invalid interleave granularity

There's no debug message for invalid interleave granularity. This makes it hard to debug related bugs. So, this is added in this patch.

---
 drivers/cxl/core/hdm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/cxl/core/hdm.c +5 -1
index 7d97790b893d..973a27543ed5 100644
@@ -888,8 +888,12 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
 	}
 	rc = eig_to_granularity(FIELD_GET(CXL_HDM_DECODER0_CTRL_IG_MASK, ctrl),
 				 &cxld->interleave_granularity);
-	if (rc)
+	if (rc) {
+		dev_warn(&port->dev,
+			 "decoder%d.%d: Invalid interleave granularity (ctrl: %#x)\n",
+			 port->id, cxld->id, ctrl);
 		return rc;
+	}
 
 	dev_dbg(&port->dev, "decoder%d.%d: range: %#llx-%#llx iw: %d ig: %d\n",
 		port->id, cxld->id, cxld->hpa_range.start, cxld->hpa_range.end,
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · On Tue, 2 Apr 2024 14:10:16 +0800 Huang Ying <[email protected]> wrote:

There's no debug message for invalid interleave granularity. This makes it hard to debug related bugs. So, this is added in this patch.

That is indeed odd given similar code around it.

Quoted 22 lines
---
 drivers/cxl/core/hdm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/cxl/core/hdm.c +5 -1
index 7d97790b893d..973a27543ed5 100644
@@ -888,8 +888,12 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
 	}
 	rc = eig_to_granularity(FIELD_GET(CXL_HDM_DECODER0_CTRL_IG_MASK, ctrl),
 				 &cxld->interleave_granularity);
-	if (rc)
+	if (rc) {
+		dev_warn(&port->dev,
+			 "decoder%d.%d: Invalid interleave granularity (ctrl: %#x)\n",
+			 port->id, cxld->id, ctrl);
 		return rc;
+	}
 
 	dev_dbg(&port->dev, "decoder%d.%d: range: %#llx-%#llx iw: %d ig: %d\n",
 		port->id, cxld->id, cxld->hpa_range.start, cxld->hpa_range.end,