* [PATCH 1/5] resource: add reserve_memblock_reserved_resources()
2026-12-04 15:29 [PATCH 0/5] Mirror reserved memblock regions in linear time Ayubjon Qosimov via B4 Relay
@ 2026-12-04 15:29 ` Ayubjon Qosimov via B4 Relay
2026-12-04 15:29 ` [PATCH 2/5] resource, kunit: add test cases for reserve_memblock_reserved_resources() Ayubjon Qosimov via B4 Relay
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ayubjon Qosimov via B4 Relay @ 2026-12-04 15:29 UTC (permalink / raw)
To: Andrew Morton
Cc: Mike Rapoport, linux-mm, Catalin Marinas, Will Deacon,
Mark Rutland, linux-arm-kernel, Paul Walmsley, linux-riscv,
Huacai Chen, loongarch, nh-open-source, linux-kernel,
Ayubjon Qosimov
From: Ayubjon Qosimov <ayubjon@amazon.de>
arm64, riscv and LoongArch each have a reserve_memblock_reserved_regions()
initcall that mirrors memblock.reserved into /proc/iomem: under every
standard memory resource, it adds a child for each reserved range that
overlaps it, with reserve_region_with_split(). The three copies are the
same apart from the name of the children, "reserved" on arm64 and
"Reserved" on the other two. Each insertion walks the parent's child
list from its head, so n reserved ranges cost O(n^2).
Add one helper for the three architectures. It takes resource_lock once
for the whole array of memory resources and, for each of them, walks
memblock.reserved with a hint, so that each insertion resumes at the
child inserted or hit last instead of at the head of the list, and stops
at the first range past the end of the resource. The insertions then
cost O(n) for n ranges. The array may be in any order; riscv builds it
in descending address order. The helper lives in kernel/resource.c
rather than mm/memblock.c because it needs resource_lock and the
internal insertion code.
Holding resource_lock across the whole walk, instead of once per range
as reserve_region_with_split() does, adds no new constraint:
__reserve_region_with_split() runs under that lock in either case and
already allocates with GFP_ATOMIC, nothing in the walk sleeps, and the
helper runs once at arch_initcall, where the whole walk takes about
0.2 ms for 3200 ranges.
__request_resource() becomes a wrapper around __request_resource_hint(),
which can start the walk at a given child: children are sorted and do
not overlap, so the children it skips all end below the new range, and
the tree is unchanged. __reserve_region_with_split() passes the hint
through; existing callers pass NULL.
The architecture loops also skipped a memory resource unless
memblock_is_region_reserved() reported an overlap. For resources whose
start and end + 1 are page aligned, as on all three architectures, a
reserved range overlaps one exactly when its page-rounded copy does, so
the helper does without that check. It skips resources that are inverted
or whose size wraps to zero, such as the [0, ~0] resource arm64 builds
when less than a page of memory remains at physical address 0.
Signed-off-by: Ayubjon Qosimov <ayubjon@amazon.de>
---
include/linux/ioport.h | 2 ++
kernel/resource.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 89 insertions(+), 5 deletions(-)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index f7930b3dfd0a..377f2f7808e3 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -248,6 +248,8 @@ void release_child_resources(struct resource *new);
extern void reserve_region_with_split(struct resource *root,
resource_size_t start, resource_size_t end,
const char *name);
+void reserve_memblock_reserved_resources(struct resource *res, unsigned int nr,
+ const char *name);
extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new);
extern int insert_resource(struct resource *parent, struct resource *new);
extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
diff --git a/kernel/resource.c b/kernel/resource.c
index 0c315c917fbb..2b274f30fbde 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -13,6 +13,7 @@
#include <linux/export.h>
#include <linux/errno.h>
#include <linux/ioport.h>
+#include <linux/memblock.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -185,8 +186,18 @@ static struct resource *alloc_resource(gfp_t flags)
return kzalloc_obj(struct resource, flags);
}
-/* Return the conflict entry if you can't request it */
-static struct resource * __request_resource(struct resource *root, struct resource *new)
+/*
+ * Return the conflict entry if you can't request it.
+ *
+ * @hint, if not NULL, points to NULL or to a child of @root. If that child
+ * starts at or below @new, the walk starts there: every child before it ends
+ * below @new. *@hint is then set to @new, or to a conflict that starts at or
+ * below @new, so ascending insertions visit each child once. The caller
+ * holds resource_lock.
+ */
+static struct resource *__request_resource_hint(struct resource *root,
+ struct resource *new,
+ struct resource **hint)
{
resource_size_t start = new->start;
resource_size_t end = new->end;
@@ -199,21 +210,36 @@ static struct resource * __request_resource(struct resource *root, struct resour
if (end > root->end)
return root;
p = &root->child;
+ if (hint && *hint && (*hint)->start <= start) {
+ if ((*hint)->end >= start)
+ return *hint;
+ p = &(*hint)->sibling;
+ }
for (;;) {
tmp = *p;
if (!tmp || tmp->start > end) {
new->sibling = tmp;
*p = new;
new->parent = root;
+ if (hint)
+ *hint = new;
return NULL;
}
p = &tmp->sibling;
if (tmp->end < start)
continue;
+ if (hint && tmp->start <= start)
+ *hint = tmp;
return tmp;
}
}
+static struct resource *__request_resource(struct resource *root,
+ struct resource *new)
+{
+ return __request_resource_hint(root, new, NULL);
+}
+
static int __release_resource(struct resource *old, bool release_child)
{
struct resource *tmp, **p, *chd;
@@ -1142,9 +1168,11 @@ int adjust_resource(struct resource *res, resource_size_t start,
}
EXPORT_SYMBOL(adjust_resource);
+/* Called with resource_lock held; @hint is passed to __request_resource_hint(). */
static void __init
__reserve_region_with_split(struct resource *root, resource_size_t start,
- resource_size_t end, const char *name)
+ resource_size_t end, const char *name,
+ struct resource **hint)
{
struct resource *parent = root;
struct resource *conflict;
@@ -1163,7 +1191,7 @@ __reserve_region_with_split(struct resource *root, resource_size_t start,
while (1) {
- conflict = __request_resource(parent, res);
+ conflict = __request_resource_hint(parent, res, hint);
if (!conflict) {
if (!next_res)
break;
@@ -1228,10 +1256,64 @@ reserve_region_with_split(struct resource *root, resource_size_t start,
dump_stack();
}
if (!abort)
- __reserve_region_with_split(root, start, end, name);
+ __reserve_region_with_split(root, start, end, name, NULL);
+ write_unlock(&resource_lock);
+}
+
+/* reserve_memblock_reserved_resources() on the ranges of @type. */
+static void __init __reserve_memblock_resources(struct memblock_type *type,
+ struct resource *res,
+ unsigned int nr,
+ const char *name)
+{
+ phys_addr_t r_start, r_end;
+ unsigned int k;
+ u64 i;
+
+ write_lock(&resource_lock);
+ for (k = 0; k < nr; k++) {
+ struct resource *mem = &res[k], *hint = NULL;
+
+ if (mem->start > mem->end || !resource_size(mem))
+ continue;
+
+ __for_each_mem_range(i, type, NULL, NUMA_NO_NODE, MEMBLOCK_NONE,
+ &r_start, &r_end, NULL) {
+ resource_size_t start, end;
+
+ start = max(PFN_PHYS(PFN_DOWN(r_start)), mem->start);
+ end = min(PFN_PHYS(PFN_UP(r_end)) - 1, mem->end);
+ if (start > mem->end)
+ break;
+ if (end < mem->start)
+ continue;
+ __reserve_region_with_split(mem, start, end, name, &hint);
+ }
+ }
write_unlock(&resource_lock);
}
+/**
+ * reserve_memblock_reserved_resources - show reserved memory in /proc/iomem
+ * @res: memory resources whose start and end + 1 are page aligned, in any
+ * order
+ * @nr: number of entries in @res
+ * @name: name of the resources to add
+ *
+ * Under each resource in @res, add a busy child named @name for each range
+ * of memblock.reserved that overlaps it, rounded out to whole pages, as
+ * reserve_region_with_split() does. Resources that are inverted or whose
+ * size wraps to zero are skipped. Call it from an initcall at boot; it
+ * takes resource_lock. Without CONFIG_ARCH_KEEP_MEMBLOCK, memblock.reserved
+ * may already be freed by then.
+ */
+void __init reserve_memblock_reserved_resources(struct resource *res,
+ unsigned int nr,
+ const char *name)
+{
+ __reserve_memblock_resources(&memblock.reserved, res, nr, name);
+}
+
/**
* resource_alignment - calculate resource's alignment
* @res: resource pointer
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/5] resource, kunit: add test cases for reserve_memblock_reserved_resources()
2026-12-04 15:29 [PATCH 0/5] Mirror reserved memblock regions in linear time Ayubjon Qosimov via B4 Relay
2026-12-04 15:29 ` [PATCH 1/5] resource: add reserve_memblock_reserved_resources() Ayubjon Qosimov via B4 Relay
@ 2026-12-04 15:29 ` Ayubjon Qosimov via B4 Relay
2026-12-05 15:30 ` sashiko-bot
2026-12-04 15:29 ` [PATCH 3/5] arm64: Use reserve_memblock_reserved_resources() Ayubjon Qosimov via B4 Relay
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Ayubjon Qosimov via B4 Relay @ 2026-12-04 15:29 UTC (permalink / raw)
To: Andrew Morton
Cc: Mike Rapoport, linux-mm, Catalin Marinas, Will Deacon,
Mark Rutland, linux-arm-kernel, Paul Walmsley, linux-riscv,
Huacai Chen, loongarch, nh-open-source, linux-kernel,
Ayubjon Qosimov
From: Ayubjon Qosimov <ayubjon@amazon.de>
The hint that reserve_memblock_reserved_resources() uses must leave the
resource tree exactly as reserve_region_with_split() builds it; it only
changes where each walk starts.
Build the same tree under two identical roots, once with
reserve_region_with_split() and once through
__reserve_region_with_split() with a hint, for ascending ranges, ranges
that overlap pre-existing children, ranges that overlap the hint (as page
rounding produces) and unsorted ranges, and check after each range that
the hint is a child of the root starting no higher than the range. A
second case checks that a range a child already covers moves the hint
onto that child. A third runs the helper's walk on a memblock table of
its own, against the loop the architectures used: memory resources out
of order, a range spanning two of them, a resource no range reaches,
overlapping resources, a pre-existing child, and inverted and wrapping
entries that must be skipped.
For this, __reserve_region_with_split() and the walk,
__reserve_memblock_resources(), are made visible to KUnit through
kernel/resource_internal.h. The functions are __init, so the cases run
in an init-section suite, and only when the test is built in.
Signed-off-by: Ayubjon Qosimov <ayubjon@amazon.de>
---
kernel/resource.c | 12 ++-
kernel/resource_internal.h | 18 ++++
kernel/resource_kunit.c | 254 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 279 insertions(+), 5 deletions(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index 2b274f30fbde..247c4b56563d 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -31,6 +31,9 @@
#include <linux/string.h>
#include <linux/vmalloc.h>
#include <asm/io.h>
+#include <kunit/visibility.h>
+
+#include "resource_internal.h"
struct resource ioport_resource = {
@@ -1169,7 +1172,7 @@ int adjust_resource(struct resource *res, resource_size_t start,
EXPORT_SYMBOL(adjust_resource);
/* Called with resource_lock held; @hint is passed to __request_resource_hint(). */
-static void __init
+VISIBLE_IF_KUNIT void __init
__reserve_region_with_split(struct resource *root, resource_size_t start,
resource_size_t end, const char *name,
struct resource **hint)
@@ -1261,10 +1264,9 @@ reserve_region_with_split(struct resource *root, resource_size_t start,
}
/* reserve_memblock_reserved_resources() on the ranges of @type. */
-static void __init __reserve_memblock_resources(struct memblock_type *type,
- struct resource *res,
- unsigned int nr,
- const char *name)
+VISIBLE_IF_KUNIT void __init
+__reserve_memblock_resources(struct memblock_type *type, struct resource *res,
+ unsigned int nr, const char *name)
{
phys_addr_t r_start, r_end;
unsigned int k;
diff --git a/kernel/resource_internal.h b/kernel/resource_internal.h
new file mode 100644
index 000000000000..81a872b48385
--- /dev/null
+++ b/kernel/resource_internal.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _KERNEL_RESOURCE_INTERNAL_H
+#define _KERNEL_RESOURCE_INTERNAL_H
+
+#include <linux/ioport.h>
+
+#if IS_ENABLED(CONFIG_KUNIT)
+/* Exposed for kernel/resource_kunit.c */
+void __reserve_region_with_split(struct resource *root, resource_size_t start,
+ resource_size_t end, const char *name,
+ struct resource **hint);
+struct memblock_type;
+void __reserve_memblock_resources(struct memblock_type *type,
+ struct resource *res, unsigned int nr,
+ const char *name);
+#endif
+
+#endif /* _KERNEL_RESOURCE_INTERNAL_H */
diff --git a/kernel/resource_kunit.c b/kernel/resource_kunit.c
index 9eeb2b1a85c0..75d7a92a23bb 100644
--- a/kernel/resource_kunit.c
+++ b/kernel/resource_kunit.c
@@ -9,6 +9,11 @@
#include <linux/string.h>
#include <linux/sizes.h>
#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/memblock.h>
+#include <linux/pfn.h>
+
+#include "resource_internal.h"
#define R0_START 0x0000
#define R0_END 0xffff
@@ -305,5 +310,254 @@ static struct kunit_suite resource_test_suite = {
};
kunit_test_suite(resource_test_suite);
+#if IS_BUILTIN(CONFIG_RESOURCE_KUNIT_TEST)
+/*
+ * The functions below are __init, so these cases run in an init-section suite
+ * and only when the test is built in. Each case builds the same tree twice,
+ * once the way the architectures used to and once with the hint, and checks
+ * that the two match.
+ */
+struct hint_range {
+ resource_size_t start, end;
+};
+
+/* Frees every child below @root; they are all kmalloc'ed. */
+static void __init hint_free_tree(struct resource *root)
+{
+ struct resource *p = root->child, *next;
+
+ root->child = NULL;
+ for (; p; p = next) {
+ next = p->sibling;
+ hint_free_tree(p);
+ kfree(p);
+ }
+}
+
+struct hint_roots {
+ struct resource *res;
+ unsigned int nr;
+};
+
+/* Runs when the case ends, also after a failed assertion. */
+static void __init hint_cleanup(void *data)
+{
+ struct hint_roots *roots = data;
+ unsigned int k;
+
+ for (k = 0; k < roots->nr; k++)
+ hint_free_tree(&roots->res[k]);
+}
+
+static struct resource * __init hint_alloc_roots(struct kunit *test,
+ const struct hint_range *mem,
+ unsigned int nr)
+{
+ struct hint_roots *roots;
+ unsigned int k;
+
+ roots = kunit_kzalloc(test, sizeof(*roots), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, roots);
+ roots->res = kunit_kcalloc(test, nr, sizeof(*roots->res), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, roots->res);
+ roots->nr = nr;
+ for (k = 0; k < nr; k++) {
+ resource_size_t size = mem[k].end - mem[k].start + 1;
+
+ roots->res[k] = DEFINE_RES_MEM_NAMED(mem[k].start, size, "mem");
+ }
+ resource_test_add_action_or_abort(test, hint_cleanup, roots);
+ return roots->res;
+}
+
+/* Request a kmalloc'ed [start, end] named "pre" under @a and under @b. */
+static void __init hint_add_pre(struct kunit *test, struct resource *a,
+ struct resource *b, resource_size_t start,
+ resource_size_t end)
+{
+ struct resource *root[] = { a, b }, *r;
+ int i, ret;
+
+ for (i = 0; i < 2; i++) {
+ r = kzalloc_obj(*r);
+ KUNIT_ASSERT_NOT_NULL(test, r);
+ *r = DEFINE_RES_MEM_NAMED(start, end - start + 1, "pre");
+ ret = request_resource(root[i], r);
+ if (ret)
+ kfree(r);
+ KUNIT_ASSERT_EQ(test, 0, ret);
+ }
+}
+
+static void __init hint_expect_same(struct kunit *test, struct resource *a,
+ struct resource *b)
+{
+ struct resource *pa, *pb;
+
+ for (pa = a->child, pb = b->child; pa && pb;
+ pa = pa->sibling, pb = pb->sibling) {
+ KUNIT_EXPECT_EQ(test, pa->start, pb->start);
+ KUNIT_EXPECT_EQ(test, pa->end, pb->end);
+ KUNIT_EXPECT_STREQ(test, pa->name, pb->name);
+ KUNIT_EXPECT_PTR_EQ(test, pb->parent, b);
+ hint_expect_same(test, pa, pb);
+ }
+ KUNIT_EXPECT_NULL(test, pa);
+ KUNIT_EXPECT_NULL(test, pb);
+}
+
+struct hint_case {
+ const char *desc;
+ struct hint_range pre[2];
+ unsigned int npre;
+ struct hint_range r[5];
+ unsigned int n;
+ bool tail;
+};
+
+static const struct hint_case hint_cases[] = {
+ { "ascending", {}, 0,
+ { { 0x0000, 0x0fff }, { 0x2000, 0x2fff }, { 0x3000, 0x3fff },
+ { 0x8000, 0x80ff }, { 0x9000, 0xffff } }, 5, true },
+ { "pre-existing children", { { 0x1800, 0x27ff }, { 0x6000, 0x6fff } }, 2,
+ { { 0x1000, 0x1fff }, { 0x2000, 0x3fff }, { 0x5000, 0x7fff },
+ { 0x6100, 0x61ff }, { 0x8000, 0x8fff } }, 5, false },
+ { "overlapping the hint", {}, 0,
+ { { 0x1000, 0x1fff }, { 0x1000, 0x1fff }, { 0x1000, 0x2fff },
+ { 0x2000, 0x3fff }, { 0x4000, 0x4fff } }, 5, false },
+ { "unsorted", {}, 0,
+ { { 0x9000, 0x9fff }, { 0x5000, 0x5fff }, { 0x7000, 0x7fff },
+ { 0x1000, 0x1fff }, { 0x0000, 0x0fff } }, 5, false },
+};
+
+static void hint_case_desc(const struct hint_case *c, char *desc)
+{
+ strscpy(desc, c->desc, KUNIT_PARAM_DESC_SIZE);
+}
+
+KUNIT_ARRAY_PARAM(hint, hint_cases, hint_case_desc);
+
+static void __init resource_test_hint(struct kunit *test)
+{
+ static const struct hint_range root = { 0, SZ_64K - 1 };
+ const struct hint_case *c = test->param_value;
+ struct resource *a, *b, *hint = NULL;
+ unsigned int i;
+
+ a = hint_alloc_roots(test, &root, 1);
+ b = hint_alloc_roots(test, &root, 1);
+ for (i = 0; i < c->npre; i++)
+ hint_add_pre(test, a, b, c->pre[i].start, c->pre[i].end);
+
+ for (i = 0; i < c->n; i++) {
+ reserve_region_with_split(a, c->r[i].start, c->r[i].end, "r");
+ /* @b is not in the resource tree, so resource_lock is not needed. */
+ __reserve_region_with_split(b, c->r[i].start, c->r[i].end, "r",
+ &hint);
+
+ /* The hint is a child of @b starting no higher than r[i].end. */
+ KUNIT_ASSERT_NOT_NULL(test, hint);
+ KUNIT_EXPECT_PTR_EQ(test, hint->parent, b);
+ KUNIT_EXPECT_LE(test, hint->start, c->r[i].end);
+ if (c->tail)
+ KUNIT_EXPECT_NULL(test, hint->sibling);
+ }
+ hint_expect_same(test, a, b);
+}
+
+static void __init resource_test_hint_absorbed(struct kunit *test)
+{
+ /* A range that a child covers moves the hint onto that child. */
+ static const struct hint_range root = { 0, SZ_64K - 1 };
+ struct resource *a, *b, *pre, *hint = NULL;
+
+ a = hint_alloc_roots(test, &root, 1);
+ b = hint_alloc_roots(test, &root, 1);
+ hint_add_pre(test, a, b, 0x6000, 0x6fff);
+ pre = b->child;
+
+ __reserve_region_with_split(b, 0x5000, 0x5fff, "r", &hint);
+ KUNIT_ASSERT_NOT_NULL(test, hint);
+ KUNIT_EXPECT_PTR_EQ(test, hint->sibling, pre);
+ __reserve_region_with_split(b, 0x6100, 0x61ff, "r", &hint);
+ KUNIT_EXPECT_PTR_EQ(test, hint, pre);
+ __reserve_region_with_split(b, 0x6200, 0x62ff, "r", &hint);
+ KUNIT_EXPECT_PTR_EQ(test, hint, pre);
+}
+
+static void __init resource_test_memblock_walk(struct kunit *test)
+{
+ /*
+ * Memory resources out of order: a range spans two of them, no range
+ * reaches one, one overlaps another, one has a child already, and an
+ * inverted and a wrapping one must be skipped.
+ */
+ static struct memblock_region regions[] __initdata = {
+ { .base = 1 * PAGE_SIZE, .size = PAGE_SIZE },
+ { .base = 3 * PAGE_SIZE, .size = 2 * PAGE_SIZE },
+ { .base = 7 * PAGE_SIZE + PAGE_SIZE / 2, .size = PAGE_SIZE / 16 },
+ { .base = 10 * PAGE_SIZE, .size = PAGE_SIZE / 16 },
+ { .base = 12 * PAGE_SIZE, .size = 4 * PAGE_SIZE },
+ };
+ static struct memblock_type type __initdata = {
+ .regions = regions,
+ .cnt = ARRAY_SIZE(regions),
+ .max = ARRAY_SIZE(regions),
+ .name = "test",
+ };
+#define P(n) ((resource_size_t)(n) * PAGE_SIZE)
+ static const struct hint_range mem[] __initconst = {
+ { P(14), P(17) - 1 }, { P(9), P(10) - 1 }, { P(4), P(8) - 1 },
+ { P(11), P(14) - 1 }, { P(0), P(4) - 1 }, { P(2), P(6) - 1 },
+ { P(32), P(32) - 1 }, { 0, ~(resource_size_t)0 },
+ };
+#undef P
+ const unsigned int nr = ARRAY_SIZE(mem);
+ phys_addr_t r_start, r_end;
+ struct resource *a, *b;
+ unsigned int k;
+ u64 i;
+
+ a = hint_alloc_roots(test, mem, nr);
+ b = hint_alloc_roots(test, mem, nr);
+ hint_add_pre(test, &a[2], &b[2], 4 * PAGE_SIZE + PAGE_SIZE / 4,
+ 4 * PAGE_SIZE + PAGE_SIZE / 2 - 1);
+
+ /* The loop the helper replaces, on the six valid resources. */
+ for (k = 0; k < nr - 2; k++) {
+ __for_each_mem_range(i, &type, NULL, NUMA_NO_NODE, MEMBLOCK_NONE,
+ &r_start, &r_end, NULL) {
+ resource_size_t start, end;
+
+ start = max(PFN_PHYS(PFN_DOWN(r_start)), a[k].start);
+ end = min(PFN_PHYS(PFN_UP(r_end)) - 1, a[k].end);
+ if (start > a[k].end || end < a[k].start)
+ continue;
+ reserve_region_with_split(&a[k], start, end, "r");
+ }
+ }
+ __reserve_memblock_resources(&type, b, nr, "r");
+
+ for (k = 0; k < nr; k++)
+ hint_expect_same(test, &a[k], &b[k]);
+ KUNIT_EXPECT_NOT_NULL(test, b[0].child);
+ KUNIT_EXPECT_NULL(test, b[1].child);
+ KUNIT_EXPECT_NOT_NULL(test, b[3].child);
+}
+
+static struct kunit_case __refdata resource_init_test_cases[] = {
+ KUNIT_CASE_PARAM(resource_test_hint, hint_gen_params),
+ KUNIT_CASE(resource_test_hint_absorbed),
+ KUNIT_CASE(resource_test_memblock_walk),
+ {}
+};
+
+static struct kunit_suite resource_init_test_suite = {
+ .name = "resource_init",
+ .test_cases = resource_init_test_cases,
+};
+kunit_test_init_section_suite(resource_init_test_suite);
+#endif /* IS_BUILTIN(CONFIG_RESOURCE_KUNIT_TEST) */
+
MODULE_DESCRIPTION("I/O Port & Memory Resource manager unit tests");
MODULE_LICENSE("GPL");
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread