From: Dan Williams <dan.j.williams@intel.com>
To: Shiyang Ruan <ruansy.fnst@fujitsu.com>, <qemu-devel@nongnu.org>,
<linux-cxl@vger.kernel.org>
Cc: <Jonathan.Cameron@huawei.com>, <dan.j.williams@intel.com>
Subject: RE: [RFC PATCH 2/5] cxl/core: introduce cxl_memdev_dpa_to_hpa()
Date: Fri, 9 Feb 2024 22:39:37 -0800 [thread overview]
Message-ID: <65c71a295f47f_d2d42942c@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20240209115417.724638-5-ruansy.fnst@fujitsu.com>
Shiyang Ruan wrote:
> When a memdev is assigned to a region, its Device Physical Address will be
> mapped to Host Physical Address. Introduce this helper function to
> translate HPA from a given memdev and its DPA.
>
> Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
> ---
> drivers/cxl/core/memdev.c | 12 ++++++++++++
> drivers/cxl/cxlmem.h | 1 +
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
> index dae8802ecdb0..c304e709ef0e 100644
> --- a/drivers/cxl/core/memdev.c
> +++ b/drivers/cxl/core/memdev.c
> @@ -319,6 +319,18 @@ static int cxl_validate_poison_dpa(struct cxl_memdev *cxlmd, u64 dpa)
> return 0;
> }
>
> +phys_addr_t cxl_memdev_dpa_to_hpa(struct cxl_memdev *cxlmd, u64 dpa)
> +{
> + struct cxl_region *cxlr = cxl_dpa_to_region(cxlmd, dpa);
> +
> + if (cxlr)
> + return cxlr->params.res->start + dpa;
> + else {
> + dev_dbg(&cxlmd->dev, "device belongs to no region.\n");
> + return 0;
> + }
> +}
Hmm no, I would not say memdevs are assigned to regions, *endpoint
decoders* are assigned to regions. cxl_dpa_to_region() is only an
internal helper when the endpoint decoder is unknown. Otherwise endpoint
decoders have a direct-link to their region, if mapped. See usage of
"cxled->cxld.region".
next prev parent reply other threads:[~2024-02-10 6:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 11:54 [RFC PATCH SET] cxl: add poison event handler Shiyang Ruan via
2024-02-09 11:54 ` [RFC PATCH 1/2] hw/cxl/type3: add missing flag bit for GMER Shiyang Ruan via
2024-02-13 16:27 ` Jonathan Cameron via
2024-02-09 11:54 ` [RFC PATCH 2/2] hw/cxl/type3: send a GMER while injecting poison Shiyang Ruan via
2024-02-13 16:32 ` Jonathan Cameron via
2024-02-09 11:54 ` [RFC PATCH 1/5] cxl/core: correct length of DPA field masks Shiyang Ruan via
2024-02-10 6:34 ` Dan Williams
2024-02-19 10:49 ` Shiyang Ruan via
2024-02-22 2:27 ` Dan Williams
2024-02-09 11:54 ` [RFC PATCH 2/5] cxl/core: introduce cxl_memdev_dpa_to_hpa() Shiyang Ruan via
2024-02-10 6:39 ` Dan Williams [this message]
2024-02-09 11:54 ` [RFC PATCH 3/5] cxl/core: introduce cxl_mem_report_poison() Shiyang Ruan via
2024-02-10 6:46 ` Dan Williams
2024-03-14 15:23 ` Shiyang Ruan via
2024-02-15 1:19 ` Tony Luck
2024-02-09 11:54 ` [RFC PATCH 4/5] cxl/core: add report option for cxl_mem_get_poison() Shiyang Ruan via
2024-02-10 6:49 ` Dan Williams
2024-03-14 15:01 ` Shiyang Ruan via
2024-02-09 11:54 ` [RFC PATCH 5/5] cxl/core: add poison injection event handler Shiyang Ruan via
2024-02-10 6:54 ` Dan Williams
2024-02-13 16:51 ` Jonathan Cameron via
2024-03-15 2:29 ` Shiyang Ruan via
2024-04-05 17:35 ` Jonathan Cameron via
2024-02-13 0:20 ` [RFC PATCH SET] cxl: add poison " 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=65c71a295f47f_d2d42942c@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=ruansy.fnst@fujitsu.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;
as well as URLs for NNTP newsgroup(s).