[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240306102846.1020868-6-lizhijian@fujitsu.com>
Date: Wed, 6 Mar 2024 18:28:44 +0800
From: Li Zhijian <lizhijian@...itsu.com>
To: linux-kernel@...r.kernel.org
Cc: y-goto@...itsu.com,
Alison Schofield <alison.schofield@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Baoquan He <bhe@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Dave Jiang <dave.jiang@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
hpa@...or.com,
Ingo Molnar <mingo@...hat.com>,
Ira Weiny <ira.weiny@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Vishal Verma <vishal.l.verma@...el.com>,
linux-cxl@...r.kernel.org,
linux-mm@...ck.org,
nvdimm@...ts.linux.dev,
x86@...nel.org,
kexec@...ts.infradead.org,
Li Zhijian <lizhijian@...itsu.com>
Subject: [PATCH v3 5/7] resource: Introduce walk device_backed_vmemmap res() helper
It walks resources registered with flags
(IORESOURCE_DEVICE_BACKED_VMEMMAP | IORESOURCE_BUSY), usually used by
device backed vmemmap region. currently, it only sticks to the
persistent memory type since it is only one user.
CC: Andrew Morton <akpm@...ux-foundation.org>
CC: Baoquan He <bhe@...hat.com>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: Alison Schofield <alison.schofield@...el.com>
CC: Dave Jiang <dave.jiang@...el.com>
CC: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
---
include/linux/ioport.h | 3 +++
kernel/resource.c | 13 +++++++++++++
2 files changed, 16 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 3b59e924f531..10a60227d6c2 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -332,6 +332,9 @@ extern int
walk_system_ram_res(u64 start, u64 end, void *arg,
int (*func)(struct resource *, void *));
extern int
+walk_device_backed_vmemmap_res(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *));
+extern int
walk_system_ram_res_rev(u64 start, u64 end, void *arg,
int (*func)(struct resource *, void *));
extern int
diff --git a/kernel/resource.c b/kernel/resource.c
index fcbca39dbc45..5f484266af07 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -431,6 +431,19 @@ int walk_system_ram_res(u64 start, u64 end, void *arg,
func);
}
+/*
+ * This function calls the @func callback against all memory ranges, which
+ * are ranges marked as (IORESOURCE_DEVICE_BACKED_VMEMMAP | IORESOURCE_BUSY)
+ * and IORES_DESC_PERSISTENT_MEMORY.
+ */
+int walk_device_backed_vmemmap_res(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *))
+{
+ return __walk_iomem_res_desc(start, end,
+ IORESOURCE_DEVICE_BACKED_VMEMMAP | IORESOURCE_BUSY,
+ IORES_DESC_PERSISTENT_MEMORY, arg, func);
+}
+
/*
* This function, being a variant of walk_system_ram_res(), calls the @func
* callback against all memory ranges of type System RAM which are marked as
--
2.29.2
Powered by blists - more mailing lists