lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240306102846.1020868-3-lizhijian@fujitsu.com>
Date: Wed,  6 Mar 2024 18:28:41 +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 2/7] mm: memremap: add pgmap_parent_resource() helper

It's a helper to set the parent resource for the altmap of a given pgmap

CC: Andrew Morton <akpm@...ux-foundation.org>
CC: Dan Williams <dan.j.williams@...el.com>
CC: Baoquan He <bhe@...hat.com>
CC: linux-mm@...ck.org
Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
---
 include/linux/memremap.h | 1 +
 mm/memremap.c            | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/include/linux/memremap.h b/include/linux/memremap.h
index ca1f12353008..1e8b25352f7c 100644
--- a/include/linux/memremap.h
+++ b/include/linux/memremap.h
@@ -193,6 +193,7 @@ static inline bool folio_is_device_coherent(const struct folio *folio)
 void zone_device_page_init(struct page *page);
 void *memremap_pages(struct dev_pagemap *pgmap, int nid);
 void memunmap_pages(struct dev_pagemap *pgmap);
+void pgmap_parent_resource(struct dev_pagemap *pgmap, struct resource *res);
 void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap);
 void devm_memunmap_pages(struct device *dev, struct dev_pagemap *pgmap);
 struct dev_pagemap *get_dev_pagemap(unsigned long pfn,
diff --git a/mm/memremap.c b/mm/memremap.c
index 78047157b0ee..0bbf163d4817 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -390,6 +390,13 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
 }
 EXPORT_SYMBOL_GPL(memremap_pages);
 
+void pgmap_parent_resource(struct dev_pagemap *pgmap, struct resource *res)
+{
+	if (pgmap && res)
+		pgmap->altmap.parent = res;
+}
+EXPORT_SYMBOL_GPL(pgmap_parent_resource);
+
 /**
  * devm_memremap_pages - remap and provide memmap backing for the given resource
  * @dev: hosting device for @res
-- 
2.29.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ