public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: linux-cxl@vger.kernel.org
Cc: dave@stgolabs.net, jonathan.cameron@huawei.com,
	alison.schofield@intel.com, vishal.l.verma@intel.com,
	ira.weiny@intel.com, dan.j.williams@intel.com
Subject: [PATCH 4/4] cxl: Adjust offset calculation for poison injection
Date: Fri, 31 Oct 2025 10:32:24 -0700	[thread overview]
Message-ID: <20251031173224.3537030-5-dave.jiang@intel.com> (raw)
In-Reply-To: <20251031173224.3537030-1-dave.jiang@intel.com>

The HPA to DPA translation for poison injection assumes that the
base address starts from where the CXL region begins. When the
extended linear cache is active, the offset can be within the DRAM
region. Adjust the offset so that it correctly reflects the offset
within the CXL region.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/cxl/core/region.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 095f5dcd17a1..eaf085aa44c4 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -3731,6 +3731,7 @@ static int cxl_region_debugfs_poison_inject(void *data, u64 offset)
 	if (validate_region_offset(cxlr, offset))
 		return -EINVAL;
 
+	offset -= cxlr->params.cache_size;
 	rc = region_offset_to_dpa_result(cxlr, offset, &result);
 	if (rc || !result.cxlmd || result.dpa == ULLONG_MAX) {
 		dev_dbg(&cxlr->dev,
@@ -3763,6 +3764,7 @@ static int cxl_region_debugfs_poison_clear(void *data, u64 offset)
 	if (validate_region_offset(cxlr, offset))
 		return -EINVAL;
 
+	offset -= cxlr->params.cache_size;
 	rc = region_offset_to_dpa_result(cxlr, offset, &result);
 	if (rc || !result.cxlmd || result.dpa == ULLONG_MAX) {
 		dev_dbg(&cxlr->dev,
-- 
2.51.0


  parent reply	other threads:[~2025-10-31 17:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 17:32 [PATCH 0/4] cxl/test: Add unit testing for extended linear cache Dave Jiang
2025-10-31 17:32 ` [PATCH 1/4] cxl/test: Standardize CXL auto region size Dave Jiang
2025-11-11 14:08   ` Jonathan Cameron
2025-11-15  2:59   ` Alison Schofield
2025-10-31 17:32 ` [PATCH 2/4] cxl/test: Add cxl_test CFMWS support for extended linear cache Dave Jiang
2025-11-11 14:09   ` Jonathan Cameron
2025-11-15  3:00   ` Alison Schofield
2025-10-31 17:32 ` [PATCH 3/4] cxl/test: Add support for acpi " Dave Jiang
2025-11-11 14:13   ` Jonathan Cameron
2025-11-15  3:01   ` Alison Schofield
2025-10-31 17:32 ` Dave Jiang [this message]
2025-10-31 20:58   ` [PATCH 4/4] cxl: Adjust offset calculation for poison injection Alison Schofield
2025-10-31 21:06     ` Dave Jiang
2025-11-07 17:52   ` Dave Jiang

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=20251031173224.3537030-5-dave.jiang@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --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