[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6319824968fa7_580162946f@dwillia2-xfh.jf.intel.com.notmuch>
Date: Wed, 7 Sep 2022 22:48:57 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Robert Richter <rrichter@....com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
"Ira Weiny" <ira.weiny@...el.com>,
Ben Widawsky <bwidawsk@...nel.org>,
Dan Williams <dan.j.williams@...el.com>
CC: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Robert Richter <rrichter@....com>
Subject: RE: [PATCH 02/15] cxl/core: Check physical address before mapping it
in devm_cxl_iomap_block()
Robert Richter wrote:
> The physical base address of a CXL range can be invalid and is then
> set to CXL_RESOURCE_NONE. Early check this case before mapping a
> memory block in devm_cxl_iomap_block().
>
> Signed-off-by: Robert Richter <rrichter@....com>
> ---
> drivers/cxl/core/regs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c
> index 39a129c57d40..f216c017a474 100644
> --- a/drivers/cxl/core/regs.c
> +++ b/drivers/cxl/core/regs.c
> @@ -165,6 +165,9 @@ void __iomem *devm_cxl_iomap_block(struct device *dev, resource_size_t addr,
> void __iomem *ret_val;
> struct resource *res;
>
> + if (addr == CXL_RESOURCE_NONE)
> + return NULL;
> +
> res = devm_request_mem_region(dev, addr, length, dev_name(dev));
> if (!res) {
> resource_size_t end = addr + length - 1;
> --
> 2.30.2
>
devm_request_mem_region() succeeds for you when this happens? More
details about the failure scenario please.
Powered by blists - more mailing lists