From: Ira Weiny <ira.weiny@intel.com>
To: Dave Jiang <dave.jiang@intel.com>, Fan Ni <fan.ni@samsung.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Navneet Singh <navneet.singh@intel.com>,
Jonathan Corbet <corbet@lwn.net>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Williams <dan.j.williams@intel.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
linux-cxl@vger.kernel.org, linux-doc@vger.kernel.org,
nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org,
Li Ming <ming4.li@intel.com>
Subject: [PATCH v7 19/27] cxl/core: Return endpoint decoder information from region search
Date: Thu, 07 Nov 2024 14:58:37 -0600 [thread overview]
Message-ID: <20241107-dcd-type2-upstream-v7-19-56a84e66bc36@intel.com> (raw)
In-Reply-To: <20241107-dcd-type2-upstream-v7-0-56a84e66bc36@intel.com>
cxl_dpa_to_region() finds the region from a <DPA, device> tuple.
The search involves finding the device endpoint decoder as well.
Dynamic capacity extent processing uses the endpoint decoder HPA
information to calculate the HPA offset. In addition, well behaved
extents should be contained within an endpoint decoder.
Return the endpoint decoder found to be used in subsequent DCD code.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Li Ming <ming4.li@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
drivers/cxl/core/core.h | 6 ++++--
drivers/cxl/core/mbox.c | 2 +-
drivers/cxl/core/memdev.c | 4 ++--
drivers/cxl/core/region.c | 8 +++++++-
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h
index 5d6fe7ab0a78cddb01c7e0d63ed55c36879c4cef..94ee06cfbdca07b50130299dfe0dd6546e7b9dac 100644
--- a/drivers/cxl/core/core.h
+++ b/drivers/cxl/core/core.h
@@ -39,7 +39,8 @@ void cxl_decoder_kill_region(struct cxl_endpoint_decoder *cxled);
int cxl_region_init(void);
void cxl_region_exit(void);
int cxl_get_poison_by_endpoint(struct cxl_port *port);
-struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa);
+struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa,
+ struct cxl_endpoint_decoder **cxled);
u64 cxl_dpa_to_hpa(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd,
u64 dpa);
@@ -50,7 +51,8 @@ static inline u64 cxl_dpa_to_hpa(struct cxl_region *cxlr,
return ULLONG_MAX;
}
static inline
-struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa)
+struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa,
+ struct cxl_endpoint_decoder **cxled)
{
return NULL;
}
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index a4b5cb61b4e6f9b17e3e3e0cce356b0ac9f960d0..a06137d95c6822192fb279068abf964f98f0a335 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -916,7 +916,7 @@ void cxl_event_trace_record(const struct cxl_memdev *cxlmd,
guard(rwsem_read)(&cxl_dpa_rwsem);
dpa = le64_to_cpu(evt->media_hdr.phys_addr) & CXL_DPA_MASK;
- cxlr = cxl_dpa_to_region(cxlmd, dpa);
+ cxlr = cxl_dpa_to_region(cxlmd, dpa, NULL);
if (cxlr)
hpa = cxl_dpa_to_hpa(cxlr, cxlmd, dpa);
diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
index 857a9dd88b20291116d20b9c0bbe9e7961f4491f..f0e68264af7b4aa19e44c5a5e01c0a0614b0f27e 100644
--- a/drivers/cxl/core/memdev.c
+++ b/drivers/cxl/core/memdev.c
@@ -313,7 +313,7 @@ int cxl_inject_poison(struct cxl_memdev *cxlmd, u64 dpa)
if (rc)
goto out;
- cxlr = cxl_dpa_to_region(cxlmd, dpa);
+ cxlr = cxl_dpa_to_region(cxlmd, dpa, NULL);
if (cxlr)
dev_warn_once(cxl_mbox->host,
"poison inject dpa:%#llx region: %s\n", dpa,
@@ -377,7 +377,7 @@ int cxl_clear_poison(struct cxl_memdev *cxlmd, u64 dpa)
if (rc)
goto out;
- cxlr = cxl_dpa_to_region(cxlmd, dpa);
+ cxlr = cxl_dpa_to_region(cxlmd, dpa, NULL);
if (cxlr)
dev_warn_once(cxl_mbox->host,
"poison clear dpa:%#llx region: %s\n", dpa,
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 34a6f447e75b18e6a1c8c27250a3e425bd0cc515..a0c181cc33e4988e5c841d5b009d3d4aed5606c1 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -2827,6 +2827,7 @@ int cxl_get_poison_by_endpoint(struct cxl_port *port)
struct cxl_dpa_to_region_context {
struct cxl_region *cxlr;
u64 dpa;
+ struct cxl_endpoint_decoder *cxled;
};
static int __cxl_dpa_to_region(struct device *dev, void *arg)
@@ -2860,11 +2861,13 @@ static int __cxl_dpa_to_region(struct device *dev, void *arg)
dev_name(dev));
ctx->cxlr = cxlr;
+ ctx->cxled = cxled;
return 1;
}
-struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa)
+struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa,
+ struct cxl_endpoint_decoder **cxled)
{
struct cxl_dpa_to_region_context ctx;
struct cxl_port *port;
@@ -2876,6 +2879,9 @@ struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa)
if (port && is_cxl_endpoint(port) && cxl_num_decoders_committed(port))
device_for_each_child(&port->dev, &ctx, __cxl_dpa_to_region);
+ if (cxled)
+ *cxled = ctx.cxled;
+
return ctx.cxlr;
}
--
2.47.0
next prev parent reply other threads:[~2024-11-07 20:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 20:58 [PATCH v7 00/27] DCD: Add support for Dynamic Capacity Devices (DCD) Ira Weiny
2024-11-07 20:58 ` [PATCH v7 01/27] range: Add range_overlaps() Ira Weiny
2024-11-07 20:58 ` [PATCH v7 02/27] ACPI/CDAT: Add CDAT/DSMAS shared and read only flag values Ira Weiny
2024-11-07 20:58 ` [PATCH v7 03/27] dax: Document struct dev_dax_range Ira Weiny
2024-11-07 20:58 ` [PATCH v7 04/27] cxl/pci: Delay event buffer allocation Ira Weiny
2024-11-07 20:58 ` [PATCH v7 05/27] cxl/hdm: Use guard() in cxl_dpa_set_mode() Ira Weiny
2024-11-07 20:58 ` [PATCH v7 06/27] cxl/region: Refactor common create region code Ira Weiny
2024-11-07 20:58 ` [PATCH v7 07/27] cxl/mbox: Flag support for Dynamic Capacity Devices (DCD) ira.weiny
2024-11-07 20:58 ` [PATCH v7 08/27] cxl/mem: Read dynamic capacity configuration from the device ira.weiny
2024-11-07 20:58 ` [PATCH v7 09/27] cxl/core: Separate region mode from decoder mode ira.weiny
2024-11-07 20:58 ` [PATCH v7 10/27] cxl/region: Add dynamic capacity decoder and region modes ira.weiny
2024-11-07 20:58 ` [PATCH v7 11/27] cxl/hdm: Add dynamic capacity size support to endpoint decoders ira.weiny
2024-11-07 20:58 ` [PATCH v7 12/27] cxl/cdat: Gather DSMAS data for DCD regions Ira Weiny
2024-11-07 20:58 ` [PATCH v7 13/27] cxl/mem: Expose DCD partition capabilities in sysfs ira.weiny
2024-11-07 20:58 ` [PATCH v7 14/27] cxl/port: Add endpoint decoder DC mode support to sysfs ira.weiny
2024-11-07 20:58 ` [PATCH v7 15/27] cxl/region: Add sparse DAX region support ira.weiny
2024-11-07 20:58 ` [PATCH v7 16/27] cxl/events: Split event msgnum configuration from irq setup Ira Weiny
2024-11-07 20:58 ` [PATCH v7 17/27] cxl/pci: Factor out interrupt policy check Ira Weiny
2024-11-07 20:58 ` [PATCH v7 18/27] cxl/mem: Configure dynamic capacity interrupts ira.weiny
2024-11-07 20:58 ` Ira Weiny [this message]
2024-11-07 20:58 ` [PATCH v7 20/27] cxl/extent: Process DCD events and realize region extents ira.weiny
2024-11-07 20:58 ` [PATCH v7 21/27] cxl/region/extent: Expose region extent information in sysfs ira.weiny
2024-11-07 20:58 ` [PATCH v7 22/27] dax/bus: Factor out dev dax resize logic Ira Weiny
2024-11-07 20:58 ` [PATCH v7 23/27] dax/region: Create resources on sparse DAX regions ira.weiny
2024-11-07 20:58 ` [PATCH v7 24/27] cxl/region: Read existing extents on region creation ira.weiny
2024-11-07 20:58 ` [PATCH v7 25/27] cxl/mem: Trace Dynamic capacity Event Record ira.weiny
2024-11-07 20:58 ` [PATCH v7 26/27] tools/testing/cxl: Make event logs dynamic Ira Weiny
2024-11-07 20:58 ` [PATCH v7 27/27] tools/testing/cxl: Add DC Regions to mock mem data Ira Weiny
2024-11-08 17:27 ` [PATCH v7 00/27] DCD: Add support for Dynamic Capacity Devices (DCD) 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=20241107-dcd-type2-upstream-v7-19-56a84e66bc36@intel.com \
--to=ira.weiny@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=fan.ni@samsung.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming4.li@intel.com \
--cc=navneet.singh@intel.com \
--cc=nvdimm@lists.linux.dev \
--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