* [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-14 9:16 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-14 9:16 UTC (permalink / raw)
To: linux-kernel
Cc: linux-s390, Baoquan He, linux-parisc, x86, kexec, takahiro.akashi,
ebiederm, linux-riscv, linuxppc-dev, akpm
This function, being a variant of walk_system_ram_res() introduced in
commit 8c86e70acead ("resource: provide new functions to walk through
resources"), walks through a list of all the resources of System RAM
in reversed order, i.e., from higher to lower.
It will be used in kexec_file code to load kernel, initrd etc when
preparing kexec reboot.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
include/linux/ioport.h | 3 +++
kernel/resource.c | 61 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 14f5cfabbbc8..db7fe25f3370 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -331,6 +331,9 @@ extern int
walk_system_ram_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
walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
void *arg, int (*func)(struct resource *, void *));
diff --git a/kernel/resource.c b/kernel/resource.c
index 866ef3663a0b..12bce44a2c08 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -27,6 +27,8 @@
#include <linux/mount.h>
#include <linux/resource_ext.h>
#include <uapi/linux/magic.h>
+#include <linux/string.h>
+#include <linux/vmalloc.h>
#include <asm/io.h>
@@ -429,6 +431,65 @@ int walk_system_ram_res(u64 start, u64 end, void *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
+ * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
+ * higher to lower.
+ */
+int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *))
+{
+ struct resource res, *rams;
+ int rams_size = 16, i;
+ unsigned long flags;
+ int ret = -1;
+
+ /* create a list */
+ rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
+ if (!rams)
+ return ret;
+
+ flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
+ i = 0;
+ while ((start < end) &&
+ (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
+ if (i >= rams_size) {
+ /* re-alloc */
+ struct resource *rams_new;
+ int rams_new_size;
+
+ rams_new_size = rams_size + 16;
+ rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
+ GFP_KERNEL);
+ if (!rams_new)
+ goto out;
+
+ memcpy(rams_new, rams,
+ sizeof(struct resource) * rams_size);
+ kvfree(rams);
+ rams = rams_new;
+ rams_size = rams_new_size;
+ }
+
+ rams[i].start = res.start;
+ rams[i++].end = res.end;
+
+ start = res.end + 1;
+ }
+
+ /* go reverse */
+ for (i--; i >= 0; i--) {
+ ret = (*func)(&rams[i], arg);
+ if (ret)
+ break;
+ }
+
+out:
+ kvfree(rams);
+ return ret;
+}
+
/*
* This function calls the @func callback against all memory ranges, which
* are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
--
2.41.0
^ permalink raw reply related [flat|nested] 36+ messages in thread* [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-14 9:16 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-14 9:16 UTC (permalink / raw)
To: linux-kernel
Cc: kexec, x86, linux-parisc, linuxppc-dev, linux-riscv, linux-s390,
akpm, ebiederm, takahiro.akashi, Baoquan He
This function, being a variant of walk_system_ram_res() introduced in
commit 8c86e70acead ("resource: provide new functions to walk through
resources"), walks through a list of all the resources of System RAM
in reversed order, i.e., from higher to lower.
It will be used in kexec_file code to load kernel, initrd etc when
preparing kexec reboot.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
include/linux/ioport.h | 3 +++
kernel/resource.c | 61 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 14f5cfabbbc8..db7fe25f3370 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -331,6 +331,9 @@ extern int
walk_system_ram_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
walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
void *arg, int (*func)(struct resource *, void *));
diff --git a/kernel/resource.c b/kernel/resource.c
index 866ef3663a0b..12bce44a2c08 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -27,6 +27,8 @@
#include <linux/mount.h>
#include <linux/resource_ext.h>
#include <uapi/linux/magic.h>
+#include <linux/string.h>
+#include <linux/vmalloc.h>
#include <asm/io.h>
@@ -429,6 +431,65 @@ int walk_system_ram_res(u64 start, u64 end, void *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
+ * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
+ * higher to lower.
+ */
+int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *))
+{
+ struct resource res, *rams;
+ int rams_size = 16, i;
+ unsigned long flags;
+ int ret = -1;
+
+ /* create a list */
+ rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
+ if (!rams)
+ return ret;
+
+ flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
+ i = 0;
+ while ((start < end) &&
+ (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
+ if (i >= rams_size) {
+ /* re-alloc */
+ struct resource *rams_new;
+ int rams_new_size;
+
+ rams_new_size = rams_size + 16;
+ rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
+ GFP_KERNEL);
+ if (!rams_new)
+ goto out;
+
+ memcpy(rams_new, rams,
+ sizeof(struct resource) * rams_size);
+ kvfree(rams);
+ rams = rams_new;
+ rams_size = rams_new_size;
+ }
+
+ rams[i].start = res.start;
+ rams[i++].end = res.end;
+
+ start = res.end + 1;
+ }
+
+ /* go reverse */
+ for (i--; i >= 0; i--) {
+ ret = (*func)(&rams[i], arg);
+ if (ret)
+ break;
+ }
+
+out:
+ kvfree(rams);
+ return ret;
+}
+
/*
* This function calls the @func callback against all memory ranges, which
* are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
--
2.41.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 36+ messages in thread* [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-14 9:16 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-14 9:16 UTC (permalink / raw)
To: linux-kernel
Cc: kexec, x86, linux-parisc, linuxppc-dev, linux-riscv, linux-s390,
akpm, ebiederm, takahiro.akashi, Baoquan He
This function, being a variant of walk_system_ram_res() introduced in
commit 8c86e70acead ("resource: provide new functions to walk through
resources"), walks through a list of all the resources of System RAM
in reversed order, i.e., from higher to lower.
It will be used in kexec_file code to load kernel, initrd etc when
preparing kexec reboot.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
include/linux/ioport.h | 3 +++
kernel/resource.c | 61 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 14f5cfabbbc8..db7fe25f3370 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -331,6 +331,9 @@ extern int
walk_system_ram_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
walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
void *arg, int (*func)(struct resource *, void *));
diff --git a/kernel/resource.c b/kernel/resource.c
index 866ef3663a0b..12bce44a2c08 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -27,6 +27,8 @@
#include <linux/mount.h>
#include <linux/resource_ext.h>
#include <uapi/linux/magic.h>
+#include <linux/string.h>
+#include <linux/vmalloc.h>
#include <asm/io.h>
@@ -429,6 +431,65 @@ int walk_system_ram_res(u64 start, u64 end, void *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
+ * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
+ * higher to lower.
+ */
+int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *))
+{
+ struct resource res, *rams;
+ int rams_size = 16, i;
+ unsigned long flags;
+ int ret = -1;
+
+ /* create a list */
+ rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
+ if (!rams)
+ return ret;
+
+ flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
+ i = 0;
+ while ((start < end) &&
+ (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
+ if (i >= rams_size) {
+ /* re-alloc */
+ struct resource *rams_new;
+ int rams_new_size;
+
+ rams_new_size = rams_size + 16;
+ rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
+ GFP_KERNEL);
+ if (!rams_new)
+ goto out;
+
+ memcpy(rams_new, rams,
+ sizeof(struct resource) * rams_size);
+ kvfree(rams);
+ rams = rams_new;
+ rams_size = rams_new_size;
+ }
+
+ rams[i].start = res.start;
+ rams[i++].end = res.end;
+
+ start = res.end + 1;
+ }
+
+ /* go reverse */
+ for (i--; i >= 0; i--) {
+ ret = (*func)(&rams[i], arg);
+ if (ret)
+ break;
+ }
+
+out:
+ kvfree(rams);
+ return ret;
+}
+
/*
* This function calls the @func callback against all memory ranges, which
* are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
--
2.41.0
^ permalink raw reply related [flat|nested] 36+ messages in thread* Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()
2023-11-14 9:16 ` Baoquan He
(?)
(?)
@ 2023-11-14 23:17 ` Andrew Morton
-1 siblings, 0 replies; 36+ messages in thread
From: Andrew Morton @ 2023-11-14 23:17 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, kexec, x86, linux-parisc, linuxppc-dev, linux-riscv,
linux-s390, ebiederm, takahiro.akashi
On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He <bhe@redhat.com> wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> ...
>
> +/*
> + * 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
> + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> + * higher to lower.
> + */
> +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> + int (*func)(struct resource *, void *))
> +{
> + struct resource res, *rams;
> + int rams_size = 16, i;
> + unsigned long flags;
> + int ret = -1;
> +
> + /* create a list */
> + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> + if (!rams)
> + return ret;
> +
> + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + i = 0;
> + while ((start < end) &&
> + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> + if (i >= rams_size) {
> + /* re-alloc */
> + struct resource *rams_new;
> + int rams_new_size;
> +
> + rams_new_size = rams_size + 16;
> + rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
> + GFP_KERNEL);
kvrealloc()?
> + if (!rams_new)
> + goto out;
> +
> + memcpy(rams_new, rams,
> + sizeof(struct resource) * rams_size);
> + kvfree(rams);
> + rams = rams_new;
> + rams_size = rams_new_size;
> + }
> +
> + rams[i].start = res.start;
> + rams[i++].end = res.end;
> +
> + start = res.end + 1;
> + }
> +
> + /* go reverse */
> + for (i--; i >= 0; i--) {
> + ret = (*func)(&rams[i], arg);
> + if (ret)
> + break;
> + }
> +
> +out:
> + kvfree(rams);
> + return ret;
> +}
> +
> /*
> * This function calls the @func callback against all memory ranges, which
> * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> --
> 2.41.0
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-14 23:17 ` Andrew Morton
0 siblings, 0 replies; 36+ messages in thread
From: Andrew Morton @ 2023-11-14 23:17 UTC (permalink / raw)
To: Baoquan He
Cc: linux-s390, linux-parisc, x86, kexec, linux-kernel,
takahiro.akashi, ebiederm, linux-riscv, linuxppc-dev
On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He <bhe@redhat.com> wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> ...
>
> +/*
> + * 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
> + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> + * higher to lower.
> + */
> +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> + int (*func)(struct resource *, void *))
> +{
> + struct resource res, *rams;
> + int rams_size = 16, i;
> + unsigned long flags;
> + int ret = -1;
> +
> + /* create a list */
> + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> + if (!rams)
> + return ret;
> +
> + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + i = 0;
> + while ((start < end) &&
> + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> + if (i >= rams_size) {
> + /* re-alloc */
> + struct resource *rams_new;
> + int rams_new_size;
> +
> + rams_new_size = rams_size + 16;
> + rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
> + GFP_KERNEL);
kvrealloc()?
> + if (!rams_new)
> + goto out;
> +
> + memcpy(rams_new, rams,
> + sizeof(struct resource) * rams_size);
> + kvfree(rams);
> + rams = rams_new;
> + rams_size = rams_new_size;
> + }
> +
> + rams[i].start = res.start;
> + rams[i++].end = res.end;
> +
> + start = res.end + 1;
> + }
> +
> + /* go reverse */
> + for (i--; i >= 0; i--) {
> + ret = (*func)(&rams[i], arg);
> + if (ret)
> + break;
> + }
> +
> +out:
> + kvfree(rams);
> + return ret;
> +}
> +
> /*
> * This function calls the @func callback against all memory ranges, which
> * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> --
> 2.41.0
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-14 23:17 ` Andrew Morton
0 siblings, 0 replies; 36+ messages in thread
From: Andrew Morton @ 2023-11-14 23:17 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, kexec, x86, linux-parisc, linuxppc-dev, linux-riscv,
linux-s390, ebiederm, takahiro.akashi
On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He <bhe@redhat.com> wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> ...
>
> +/*
> + * 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
> + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> + * higher to lower.
> + */
> +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> + int (*func)(struct resource *, void *))
> +{
> + struct resource res, *rams;
> + int rams_size = 16, i;
> + unsigned long flags;
> + int ret = -1;
> +
> + /* create a list */
> + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> + if (!rams)
> + return ret;
> +
> + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + i = 0;
> + while ((start < end) &&
> + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> + if (i >= rams_size) {
> + /* re-alloc */
> + struct resource *rams_new;
> + int rams_new_size;
> +
> + rams_new_size = rams_size + 16;
> + rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
> + GFP_KERNEL);
kvrealloc()?
> + if (!rams_new)
> + goto out;
> +
> + memcpy(rams_new, rams,
> + sizeof(struct resource) * rams_size);
> + kvfree(rams);
> + rams = rams_new;
> + rams_size = rams_new_size;
> + }
> +
> + rams[i].start = res.start;
> + rams[i++].end = res.end;
> +
> + start = res.end + 1;
> + }
> +
> + /* go reverse */
> + for (i--; i >= 0; i--) {
> + ret = (*func)(&rams[i], arg);
> + if (ret)
> + break;
> + }
> +
> +out:
> + kvfree(rams);
> + return ret;
> +}
> +
> /*
> * This function calls the @func callback against all memory ranges, which
> * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> --
> 2.41.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-14 23:17 ` Andrew Morton
0 siblings, 0 replies; 36+ messages in thread
From: Andrew Morton @ 2023-11-14 23:17 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, kexec, x86, linux-parisc, linuxppc-dev, linux-riscv,
linux-s390, ebiederm, takahiro.akashi
On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He <bhe@redhat.com> wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> ...
>
> +/*
> + * 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
> + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> + * higher to lower.
> + */
> +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> + int (*func)(struct resource *, void *))
> +{
> + struct resource res, *rams;
> + int rams_size = 16, i;
> + unsigned long flags;
> + int ret = -1;
> +
> + /* create a list */
> + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> + if (!rams)
> + return ret;
> +
> + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + i = 0;
> + while ((start < end) &&
> + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> + if (i >= rams_size) {
> + /* re-alloc */
> + struct resource *rams_new;
> + int rams_new_size;
> +
> + rams_new_size = rams_size + 16;
> + rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
> + GFP_KERNEL);
kvrealloc()?
> + if (!rams_new)
> + goto out;
> +
> + memcpy(rams_new, rams,
> + sizeof(struct resource) * rams_size);
> + kvfree(rams);
> + rams = rams_new;
> + rams_size = rams_new_size;
> + }
> +
> + rams[i].start = res.start;
> + rams[i++].end = res.end;
> +
> + start = res.end + 1;
> + }
> +
> + /* go reverse */
> + for (i--; i >= 0; i--) {
> + ret = (*func)(&rams[i], arg);
> + if (ret)
> + break;
> + }
> +
> +out:
> + kvfree(rams);
> + return ret;
> +}
> +
> /*
> * This function calls the @func callback against all memory ranges, which
> * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> --
> 2.41.0
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()
2023-11-14 23:17 ` Andrew Morton
(?)
(?)
@ 2023-11-15 0:40 ` Baoquan He
-1 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-15 0:40 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, kexec, x86, linux-parisc, linuxppc-dev, linux-riscv,
linux-s390, ebiederm, takahiro.akashi
On 11/14/23 at 03:17pm, Andrew Morton wrote:
> On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He <bhe@redhat.com> wrote:
>
> > This function, being a variant of walk_system_ram_res() introduced in
> > commit 8c86e70acead ("resource: provide new functions to walk through
> > resources"), walks through a list of all the resources of System RAM
> > in reversed order, i.e., from higher to lower.
> >
> > It will be used in kexec_file code to load kernel, initrd etc when
> > preparing kexec reboot.
> >
> > ...
> >
> > +/*
> > + * 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
> > + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> > + * higher to lower.
> > + */
> > +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> > + int (*func)(struct resource *, void *))
> > +{
> > + struct resource res, *rams;
> > + int rams_size = 16, i;
> > + unsigned long flags;
> > + int ret = -1;
> > +
> > + /* create a list */
> > + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> > + if (!rams)
> > + return ret;
> > +
> > + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> > + i = 0;
> > + while ((start < end) &&
> > + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> > + if (i >= rams_size) {
> > + /* re-alloc */
> > + struct resource *rams_new;
> > + int rams_new_size;
> > +
> > + rams_new_size = rams_size + 16;
> > + rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
> > + GFP_KERNEL);
>
> kvrealloc()?
Exactly. Will udpate. Thanks for the great suggestion.
>
> > + if (!rams_new)
> > + goto out;
> > +
> > + memcpy(rams_new, rams,
> > + sizeof(struct resource) * rams_size);
> > + kvfree(rams);
> > + rams = rams_new;
> > + rams_size = rams_new_size;
> > + }
> > +
> > + rams[i].start = res.start;
> > + rams[i++].end = res.end;
> > +
> > + start = res.end + 1;
> > + }
> > +
> > + /* go reverse */
> > + for (i--; i >= 0; i--) {
> > + ret = (*func)(&rams[i], arg);
> > + if (ret)
> > + break;
> > + }
> > +
> > +out:
> > + kvfree(rams);
> > + return ret;
> > +}
> > +
> > /*
> > * This function calls the @func callback against all memory ranges, which
> > * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> > --
> > 2.41.0
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-15 0:40 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-15 0:40 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-s390, linux-parisc, x86, kexec, linux-kernel,
takahiro.akashi, ebiederm, linux-riscv, linuxppc-dev
On 11/14/23 at 03:17pm, Andrew Morton wrote:
> On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He <bhe@redhat.com> wrote:
>
> > This function, being a variant of walk_system_ram_res() introduced in
> > commit 8c86e70acead ("resource: provide new functions to walk through
> > resources"), walks through a list of all the resources of System RAM
> > in reversed order, i.e., from higher to lower.
> >
> > It will be used in kexec_file code to load kernel, initrd etc when
> > preparing kexec reboot.
> >
> > ...
> >
> > +/*
> > + * 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
> > + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> > + * higher to lower.
> > + */
> > +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> > + int (*func)(struct resource *, void *))
> > +{
> > + struct resource res, *rams;
> > + int rams_size = 16, i;
> > + unsigned long flags;
> > + int ret = -1;
> > +
> > + /* create a list */
> > + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> > + if (!rams)
> > + return ret;
> > +
> > + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> > + i = 0;
> > + while ((start < end) &&
> > + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> > + if (i >= rams_size) {
> > + /* re-alloc */
> > + struct resource *rams_new;
> > + int rams_new_size;
> > +
> > + rams_new_size = rams_size + 16;
> > + rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
> > + GFP_KERNEL);
>
> kvrealloc()?
Exactly. Will udpate. Thanks for the great suggestion.
>
> > + if (!rams_new)
> > + goto out;
> > +
> > + memcpy(rams_new, rams,
> > + sizeof(struct resource) * rams_size);
> > + kvfree(rams);
> > + rams = rams_new;
> > + rams_size = rams_new_size;
> > + }
> > +
> > + rams[i].start = res.start;
> > + rams[i++].end = res.end;
> > +
> > + start = res.end + 1;
> > + }
> > +
> > + /* go reverse */
> > + for (i--; i >= 0; i--) {
> > + ret = (*func)(&rams[i], arg);
> > + if (ret)
> > + break;
> > + }
> > +
> > +out:
> > + kvfree(rams);
> > + return ret;
> > +}
> > +
> > /*
> > * This function calls the @func callback against all memory ranges, which
> > * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> > --
> > 2.41.0
>
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-15 0:40 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-15 0:40 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, kexec, x86, linux-parisc, linuxppc-dev, linux-riscv,
linux-s390, ebiederm, takahiro.akashi
On 11/14/23 at 03:17pm, Andrew Morton wrote:
> On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He <bhe@redhat.com> wrote:
>
> > This function, being a variant of walk_system_ram_res() introduced in
> > commit 8c86e70acead ("resource: provide new functions to walk through
> > resources"), walks through a list of all the resources of System RAM
> > in reversed order, i.e., from higher to lower.
> >
> > It will be used in kexec_file code to load kernel, initrd etc when
> > preparing kexec reboot.
> >
> > ...
> >
> > +/*
> > + * 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
> > + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> > + * higher to lower.
> > + */
> > +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> > + int (*func)(struct resource *, void *))
> > +{
> > + struct resource res, *rams;
> > + int rams_size = 16, i;
> > + unsigned long flags;
> > + int ret = -1;
> > +
> > + /* create a list */
> > + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> > + if (!rams)
> > + return ret;
> > +
> > + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> > + i = 0;
> > + while ((start < end) &&
> > + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> > + if (i >= rams_size) {
> > + /* re-alloc */
> > + struct resource *rams_new;
> > + int rams_new_size;
> > +
> > + rams_new_size = rams_size + 16;
> > + rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
> > + GFP_KERNEL);
>
> kvrealloc()?
Exactly. Will udpate. Thanks for the great suggestion.
>
> > + if (!rams_new)
> > + goto out;
> > +
> > + memcpy(rams_new, rams,
> > + sizeof(struct resource) * rams_size);
> > + kvfree(rams);
> > + rams = rams_new;
> > + rams_size = rams_new_size;
> > + }
> > +
> > + rams[i].start = res.start;
> > + rams[i++].end = res.end;
> > +
> > + start = res.end + 1;
> > + }
> > +
> > + /* go reverse */
> > + for (i--; i >= 0; i--) {
> > + ret = (*func)(&rams[i], arg);
> > + if (ret)
> > + break;
> > + }
> > +
> > +out:
> > + kvfree(rams);
> > + return ret;
> > +}
> > +
> > /*
> > * This function calls the @func callback against all memory ranges, which
> > * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> > --
> > 2.41.0
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-15 0:40 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-15 0:40 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, kexec, x86, linux-parisc, linuxppc-dev, linux-riscv,
linux-s390, ebiederm, takahiro.akashi
On 11/14/23 at 03:17pm, Andrew Morton wrote:
> On Tue, 14 Nov 2023 17:16:57 +0800 Baoquan He <bhe@redhat.com> wrote:
>
> > This function, being a variant of walk_system_ram_res() introduced in
> > commit 8c86e70acead ("resource: provide new functions to walk through
> > resources"), walks through a list of all the resources of System RAM
> > in reversed order, i.e., from higher to lower.
> >
> > It will be used in kexec_file code to load kernel, initrd etc when
> > preparing kexec reboot.
> >
> > ...
> >
> > +/*
> > + * 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
> > + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> > + * higher to lower.
> > + */
> > +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> > + int (*func)(struct resource *, void *))
> > +{
> > + struct resource res, *rams;
> > + int rams_size = 16, i;
> > + unsigned long flags;
> > + int ret = -1;
> > +
> > + /* create a list */
> > + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> > + if (!rams)
> > + return ret;
> > +
> > + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> > + i = 0;
> > + while ((start < end) &&
> > + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> > + if (i >= rams_size) {
> > + /* re-alloc */
> > + struct resource *rams_new;
> > + int rams_new_size;
> > +
> > + rams_new_size = rams_size + 16;
> > + rams_new = kvcalloc(rams_new_size, sizeof(struct resource),
> > + GFP_KERNEL);
>
> kvrealloc()?
Exactly. Will udpate. Thanks for the great suggestion.
>
> > + if (!rams_new)
> > + goto out;
> > +
> > + memcpy(rams_new, rams,
> > + sizeof(struct resource) * rams_size);
> > + kvfree(rams);
> > + rams = rams_new;
> > + rams_size = rams_new_size;
> > + }
> > +
> > + rams[i].start = res.start;
> > + rams[i++].end = res.end;
> > +
> > + start = res.end + 1;
> > + }
> > +
> > + /* go reverse */
> > + for (i--; i >= 0; i--) {
> > + ret = (*func)(&rams[i], arg);
> > + if (ret)
> > + break;
> > + }
> > +
> > +out:
> > + kvfree(rams);
> > + return ret;
> > +}
> > +
> > /*
> > * This function calls the @func callback against all memory ranges, which
> > * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> > --
> > 2.41.0
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
2023-11-14 9:16 ` Baoquan He
(?)
(?)
@ 2023-11-15 13:00 ` Baoquan He
-1 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-15 13:00 UTC (permalink / raw)
To: linux-kernel
Cc: kexec, x86, linux-parisc, linuxppc-dev, linux-riscv, linux-s390,
akpm, ebiederm, takahiro.akashi
This function, being a variant of walk_system_ram_res() introduced in
commit 8c86e70acead ("resource: provide new functions to walk through
resources"), walks through a list of all the resources of System RAM
in reversed order, i.e., from higher to lower.
It will be used in kexec_file code to load kernel, initrd etc when
preparing kexec reboot.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v1->v2:
- Use kvrealloc() to reallocate memory instead of kvcalloc(), this
simplifies code. Suggested by Andrew.
include/linux/ioport.h | 3 +++
kernel/resource.c | 57 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 14f5cfabbbc8..db7fe25f3370 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -331,6 +331,9 @@ extern int
walk_system_ram_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
walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
void *arg, int (*func)(struct resource *, void *));
diff --git a/kernel/resource.c b/kernel/resource.c
index 866ef3663a0b..e8a244300e5b 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -27,6 +27,8 @@
#include <linux/mount.h>
#include <linux/resource_ext.h>
#include <uapi/linux/magic.h>
+#include <linux/string.h>
+#include <linux/vmalloc.h>
#include <asm/io.h>
@@ -429,6 +431,61 @@ int walk_system_ram_res(u64 start, u64 end, void *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
+ * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
+ * higher to lower.
+ */
+int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *))
+{
+ struct resource res, *rams;
+ int rams_size = 16, i;
+ unsigned long flags;
+ int ret = -1;
+
+ /* create a list */
+ rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
+ if (!rams)
+ return ret;
+
+ flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
+ i = 0;
+ while ((start < end) &&
+ (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
+ if (i >= rams_size) {
+ /* re-alloc */
+ struct resource *rams_new;
+
+ rams_new = kvrealloc(rams, rams_size * sizeof(struct resource),
+ (rams_size + 16) * sizeof(struct resource),
+ GFP_KERNEL);
+ if (!rams_new)
+ goto out;
+
+ rams = rams_new;
+ rams_size += 16;
+ }
+
+ rams[i].start = res.start;
+ rams[i++].end = res.end;
+
+ start = res.end + 1;
+ }
+
+ /* go reverse */
+ for (i--; i >= 0; i--) {
+ ret = (*func)(&rams[i], arg);
+ if (ret)
+ break;
+ }
+
+out:
+ kvfree(rams);
+ return ret;
+}
+
/*
* This function calls the @func callback against all memory ranges, which
* are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
--
2.41.0
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 36+ messages in thread* [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-15 13:00 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-15 13:00 UTC (permalink / raw)
To: linux-kernel
Cc: linux-s390, linux-parisc, x86, kexec, takahiro.akashi, ebiederm,
linux-riscv, linuxppc-dev, akpm
This function, being a variant of walk_system_ram_res() introduced in
commit 8c86e70acead ("resource: provide new functions to walk through
resources"), walks through a list of all the resources of System RAM
in reversed order, i.e., from higher to lower.
It will be used in kexec_file code to load kernel, initrd etc when
preparing kexec reboot.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v1->v2:
- Use kvrealloc() to reallocate memory instead of kvcalloc(), this
simplifies code. Suggested by Andrew.
include/linux/ioport.h | 3 +++
kernel/resource.c | 57 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 14f5cfabbbc8..db7fe25f3370 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -331,6 +331,9 @@ extern int
walk_system_ram_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
walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
void *arg, int (*func)(struct resource *, void *));
diff --git a/kernel/resource.c b/kernel/resource.c
index 866ef3663a0b..e8a244300e5b 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -27,6 +27,8 @@
#include <linux/mount.h>
#include <linux/resource_ext.h>
#include <uapi/linux/magic.h>
+#include <linux/string.h>
+#include <linux/vmalloc.h>
#include <asm/io.h>
@@ -429,6 +431,61 @@ int walk_system_ram_res(u64 start, u64 end, void *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
+ * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
+ * higher to lower.
+ */
+int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *))
+{
+ struct resource res, *rams;
+ int rams_size = 16, i;
+ unsigned long flags;
+ int ret = -1;
+
+ /* create a list */
+ rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
+ if (!rams)
+ return ret;
+
+ flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
+ i = 0;
+ while ((start < end) &&
+ (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
+ if (i >= rams_size) {
+ /* re-alloc */
+ struct resource *rams_new;
+
+ rams_new = kvrealloc(rams, rams_size * sizeof(struct resource),
+ (rams_size + 16) * sizeof(struct resource),
+ GFP_KERNEL);
+ if (!rams_new)
+ goto out;
+
+ rams = rams_new;
+ rams_size += 16;
+ }
+
+ rams[i].start = res.start;
+ rams[i++].end = res.end;
+
+ start = res.end + 1;
+ }
+
+ /* go reverse */
+ for (i--; i >= 0; i--) {
+ ret = (*func)(&rams[i], arg);
+ if (ret)
+ break;
+ }
+
+out:
+ kvfree(rams);
+ return ret;
+}
+
/*
* This function calls the @func callback against all memory ranges, which
* are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
--
2.41.0
^ permalink raw reply related [flat|nested] 36+ messages in thread* [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-15 13:00 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-15 13:00 UTC (permalink / raw)
To: linux-kernel
Cc: kexec, x86, linux-parisc, linuxppc-dev, linux-riscv, linux-s390,
akpm, ebiederm, takahiro.akashi
This function, being a variant of walk_system_ram_res() introduced in
commit 8c86e70acead ("resource: provide new functions to walk through
resources"), walks through a list of all the resources of System RAM
in reversed order, i.e., from higher to lower.
It will be used in kexec_file code to load kernel, initrd etc when
preparing kexec reboot.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v1->v2:
- Use kvrealloc() to reallocate memory instead of kvcalloc(), this
simplifies code. Suggested by Andrew.
include/linux/ioport.h | 3 +++
kernel/resource.c | 57 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 14f5cfabbbc8..db7fe25f3370 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -331,6 +331,9 @@ extern int
walk_system_ram_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
walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
void *arg, int (*func)(struct resource *, void *));
diff --git a/kernel/resource.c b/kernel/resource.c
index 866ef3663a0b..e8a244300e5b 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -27,6 +27,8 @@
#include <linux/mount.h>
#include <linux/resource_ext.h>
#include <uapi/linux/magic.h>
+#include <linux/string.h>
+#include <linux/vmalloc.h>
#include <asm/io.h>
@@ -429,6 +431,61 @@ int walk_system_ram_res(u64 start, u64 end, void *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
+ * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
+ * higher to lower.
+ */
+int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *))
+{
+ struct resource res, *rams;
+ int rams_size = 16, i;
+ unsigned long flags;
+ int ret = -1;
+
+ /* create a list */
+ rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
+ if (!rams)
+ return ret;
+
+ flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
+ i = 0;
+ while ((start < end) &&
+ (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
+ if (i >= rams_size) {
+ /* re-alloc */
+ struct resource *rams_new;
+
+ rams_new = kvrealloc(rams, rams_size * sizeof(struct resource),
+ (rams_size + 16) * sizeof(struct resource),
+ GFP_KERNEL);
+ if (!rams_new)
+ goto out;
+
+ rams = rams_new;
+ rams_size += 16;
+ }
+
+ rams[i].start = res.start;
+ rams[i++].end = res.end;
+
+ start = res.end + 1;
+ }
+
+ /* go reverse */
+ for (i--; i >= 0; i--) {
+ ret = (*func)(&rams[i], arg);
+ if (ret)
+ break;
+ }
+
+out:
+ kvfree(rams);
+ return ret;
+}
+
/*
* This function calls the @func callback against all memory ranges, which
* are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
--
2.41.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 36+ messages in thread* [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-15 13:00 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-15 13:00 UTC (permalink / raw)
To: linux-kernel
Cc: kexec, x86, linux-parisc, linuxppc-dev, linux-riscv, linux-s390,
akpm, ebiederm, takahiro.akashi
This function, being a variant of walk_system_ram_res() introduced in
commit 8c86e70acead ("resource: provide new functions to walk through
resources"), walks through a list of all the resources of System RAM
in reversed order, i.e., from higher to lower.
It will be used in kexec_file code to load kernel, initrd etc when
preparing kexec reboot.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v1->v2:
- Use kvrealloc() to reallocate memory instead of kvcalloc(), this
simplifies code. Suggested by Andrew.
include/linux/ioport.h | 3 +++
kernel/resource.c | 57 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 14f5cfabbbc8..db7fe25f3370 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -331,6 +331,9 @@ extern int
walk_system_ram_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
walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
void *arg, int (*func)(struct resource *, void *));
diff --git a/kernel/resource.c b/kernel/resource.c
index 866ef3663a0b..e8a244300e5b 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -27,6 +27,8 @@
#include <linux/mount.h>
#include <linux/resource_ext.h>
#include <uapi/linux/magic.h>
+#include <linux/string.h>
+#include <linux/vmalloc.h>
#include <asm/io.h>
@@ -429,6 +431,61 @@ int walk_system_ram_res(u64 start, u64 end, void *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
+ * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
+ * higher to lower.
+ */
+int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
+ int (*func)(struct resource *, void *))
+{
+ struct resource res, *rams;
+ int rams_size = 16, i;
+ unsigned long flags;
+ int ret = -1;
+
+ /* create a list */
+ rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
+ if (!rams)
+ return ret;
+
+ flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
+ i = 0;
+ while ((start < end) &&
+ (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
+ if (i >= rams_size) {
+ /* re-alloc */
+ struct resource *rams_new;
+
+ rams_new = kvrealloc(rams, rams_size * sizeof(struct resource),
+ (rams_size + 16) * sizeof(struct resource),
+ GFP_KERNEL);
+ if (!rams_new)
+ goto out;
+
+ rams = rams_new;
+ rams_size += 16;
+ }
+
+ rams[i].start = res.start;
+ rams[i++].end = res.end;
+
+ start = res.end + 1;
+ }
+
+ /* go reverse */
+ for (i--; i >= 0; i--) {
+ ret = (*func)(&rams[i], arg);
+ if (ret)
+ break;
+ }
+
+out:
+ kvfree(rams);
+ return ret;
+}
+
/*
* This function calls the @func callback against all memory ranges, which
* are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
--
2.41.0
^ permalink raw reply related [flat|nested] 36+ messages in thread* Re: [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
2023-11-15 13:00 ` Baoquan He
(?)
(?)
@ 2023-11-23 13:27 ` Baoquan He
-1 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-23 13:27 UTC (permalink / raw)
To: akpm
Cc: kexec, x86, linux-parisc, linuxppc-dev, linux-riscv, linux-s390,
linux-kernel, ebiederm, takahiro.akashi
Hi Andrew,
On 11/15/23 at 09:00pm, Baoquan He wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
> v1->v2:
> - Use kvrealloc() to reallocate memory instead of kvcalloc(), this
> simplifies code. Suggested by Andrew.
>
> include/linux/ioport.h | 3 +++
> kernel/resource.c | 57 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 60 insertions(+)
Gentle ping.
Could you pick this patchset into next tree so that it can be run on
testing robots?
Thanks
Baoquan
>
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index 14f5cfabbbc8..db7fe25f3370 100644
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -331,6 +331,9 @@ extern int
> walk_system_ram_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
> walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
> void *arg, int (*func)(struct resource *, void *));
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 866ef3663a0b..e8a244300e5b 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -27,6 +27,8 @@
> #include <linux/mount.h>
> #include <linux/resource_ext.h>
> #include <uapi/linux/magic.h>
> +#include <linux/string.h>
> +#include <linux/vmalloc.h>
> #include <asm/io.h>
>
>
> @@ -429,6 +431,61 @@ int walk_system_ram_res(u64 start, u64 end, void *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
> + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> + * higher to lower.
> + */
> +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> + int (*func)(struct resource *, void *))
> +{
> + struct resource res, *rams;
> + int rams_size = 16, i;
> + unsigned long flags;
> + int ret = -1;
> +
> + /* create a list */
> + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> + if (!rams)
> + return ret;
> +
> + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + i = 0;
> + while ((start < end) &&
> + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> + if (i >= rams_size) {
> + /* re-alloc */
> + struct resource *rams_new;
> +
> + rams_new = kvrealloc(rams, rams_size * sizeof(struct resource),
> + (rams_size + 16) * sizeof(struct resource),
> + GFP_KERNEL);
> + if (!rams_new)
> + goto out;
> +
> + rams = rams_new;
> + rams_size += 16;
> + }
> +
> + rams[i].start = res.start;
> + rams[i++].end = res.end;
> +
> + start = res.end + 1;
> + }
> +
> + /* go reverse */
> + for (i--; i >= 0; i--) {
> + ret = (*func)(&rams[i], arg);
> + if (ret)
> + break;
> + }
> +
> +out:
> + kvfree(rams);
> + return ret;
> +}
> +
> /*
> * This function calls the @func callback against all memory ranges, which
> * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> --
> 2.41.0
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-23 13:27 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-23 13:27 UTC (permalink / raw)
To: akpm
Cc: linux-s390, linux-parisc, x86, kexec, linux-kernel,
takahiro.akashi, ebiederm, linux-riscv, linuxppc-dev
Hi Andrew,
On 11/15/23 at 09:00pm, Baoquan He wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
> v1->v2:
> - Use kvrealloc() to reallocate memory instead of kvcalloc(), this
> simplifies code. Suggested by Andrew.
>
> include/linux/ioport.h | 3 +++
> kernel/resource.c | 57 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 60 insertions(+)
Gentle ping.
Could you pick this patchset into next tree so that it can be run on
testing robots?
Thanks
Baoquan
>
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index 14f5cfabbbc8..db7fe25f3370 100644
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -331,6 +331,9 @@ extern int
> walk_system_ram_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
> walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
> void *arg, int (*func)(struct resource *, void *));
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 866ef3663a0b..e8a244300e5b 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -27,6 +27,8 @@
> #include <linux/mount.h>
> #include <linux/resource_ext.h>
> #include <uapi/linux/magic.h>
> +#include <linux/string.h>
> +#include <linux/vmalloc.h>
> #include <asm/io.h>
>
>
> @@ -429,6 +431,61 @@ int walk_system_ram_res(u64 start, u64 end, void *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
> + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> + * higher to lower.
> + */
> +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> + int (*func)(struct resource *, void *))
> +{
> + struct resource res, *rams;
> + int rams_size = 16, i;
> + unsigned long flags;
> + int ret = -1;
> +
> + /* create a list */
> + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> + if (!rams)
> + return ret;
> +
> + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + i = 0;
> + while ((start < end) &&
> + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> + if (i >= rams_size) {
> + /* re-alloc */
> + struct resource *rams_new;
> +
> + rams_new = kvrealloc(rams, rams_size * sizeof(struct resource),
> + (rams_size + 16) * sizeof(struct resource),
> + GFP_KERNEL);
> + if (!rams_new)
> + goto out;
> +
> + rams = rams_new;
> + rams_size += 16;
> + }
> +
> + rams[i].start = res.start;
> + rams[i++].end = res.end;
> +
> + start = res.end + 1;
> + }
> +
> + /* go reverse */
> + for (i--; i >= 0; i--) {
> + ret = (*func)(&rams[i], arg);
> + if (ret)
> + break;
> + }
> +
> +out:
> + kvfree(rams);
> + return ret;
> +}
> +
> /*
> * This function calls the @func callback against all memory ranges, which
> * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> --
> 2.41.0
>
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-23 13:27 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-23 13:27 UTC (permalink / raw)
To: akpm
Cc: kexec, x86, linux-parisc, linuxppc-dev, linux-riscv, linux-s390,
linux-kernel, ebiederm, takahiro.akashi
Hi Andrew,
On 11/15/23 at 09:00pm, Baoquan He wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
> v1->v2:
> - Use kvrealloc() to reallocate memory instead of kvcalloc(), this
> simplifies code. Suggested by Andrew.
>
> include/linux/ioport.h | 3 +++
> kernel/resource.c | 57 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 60 insertions(+)
Gentle ping.
Could you pick this patchset into next tree so that it can be run on
testing robots?
Thanks
Baoquan
>
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index 14f5cfabbbc8..db7fe25f3370 100644
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -331,6 +331,9 @@ extern int
> walk_system_ram_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
> walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
> void *arg, int (*func)(struct resource *, void *));
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 866ef3663a0b..e8a244300e5b 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -27,6 +27,8 @@
> #include <linux/mount.h>
> #include <linux/resource_ext.h>
> #include <uapi/linux/magic.h>
> +#include <linux/string.h>
> +#include <linux/vmalloc.h>
> #include <asm/io.h>
>
>
> @@ -429,6 +431,61 @@ int walk_system_ram_res(u64 start, u64 end, void *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
> + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> + * higher to lower.
> + */
> +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> + int (*func)(struct resource *, void *))
> +{
> + struct resource res, *rams;
> + int rams_size = 16, i;
> + unsigned long flags;
> + int ret = -1;
> +
> + /* create a list */
> + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> + if (!rams)
> + return ret;
> +
> + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + i = 0;
> + while ((start < end) &&
> + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> + if (i >= rams_size) {
> + /* re-alloc */
> + struct resource *rams_new;
> +
> + rams_new = kvrealloc(rams, rams_size * sizeof(struct resource),
> + (rams_size + 16) * sizeof(struct resource),
> + GFP_KERNEL);
> + if (!rams_new)
> + goto out;
> +
> + rams = rams_new;
> + rams_size += 16;
> + }
> +
> + rams[i].start = res.start;
> + rams[i++].end = res.end;
> +
> + start = res.end + 1;
> + }
> +
> + /* go reverse */
> + for (i--; i >= 0; i--) {
> + ret = (*func)(&rams[i], arg);
> + if (ret)
> + break;
> + }
> +
> +out:
> + kvfree(rams);
> + return ret;
> +}
> +
> /*
> * This function calls the @func callback against all memory ranges, which
> * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> --
> 2.41.0
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2023-11-23 13:27 ` Baoquan He
0 siblings, 0 replies; 36+ messages in thread
From: Baoquan He @ 2023-11-23 13:27 UTC (permalink / raw)
To: akpm
Cc: kexec, x86, linux-parisc, linuxppc-dev, linux-riscv, linux-s390,
linux-kernel, ebiederm, takahiro.akashi
Hi Andrew,
On 11/15/23 at 09:00pm, Baoquan He wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
> v1->v2:
> - Use kvrealloc() to reallocate memory instead of kvcalloc(), this
> simplifies code. Suggested by Andrew.
>
> include/linux/ioport.h | 3 +++
> kernel/resource.c | 57 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 60 insertions(+)
Gentle ping.
Could you pick this patchset into next tree so that it can be run on
testing robots?
Thanks
Baoquan
>
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index 14f5cfabbbc8..db7fe25f3370 100644
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -331,6 +331,9 @@ extern int
> walk_system_ram_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
> walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
> void *arg, int (*func)(struct resource *, void *));
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 866ef3663a0b..e8a244300e5b 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -27,6 +27,8 @@
> #include <linux/mount.h>
> #include <linux/resource_ext.h>
> #include <uapi/linux/magic.h>
> +#include <linux/string.h>
> +#include <linux/vmalloc.h>
> #include <asm/io.h>
>
>
> @@ -429,6 +431,61 @@ int walk_system_ram_res(u64 start, u64 end, void *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
> + * IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY in reversed order, i.e., from
> + * higher to lower.
> + */
> +int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> + int (*func)(struct resource *, void *))
> +{
> + struct resource res, *rams;
> + int rams_size = 16, i;
> + unsigned long flags;
> + int ret = -1;
> +
> + /* create a list */
> + rams = kvcalloc(rams_size, sizeof(struct resource), GFP_KERNEL);
> + if (!rams)
> + return ret;
> +
> + flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + i = 0;
> + while ((start < end) &&
> + (!find_next_iomem_res(start, end, flags, IORES_DESC_NONE, &res))) {
> + if (i >= rams_size) {
> + /* re-alloc */
> + struct resource *rams_new;
> +
> + rams_new = kvrealloc(rams, rams_size * sizeof(struct resource),
> + (rams_size + 16) * sizeof(struct resource),
> + GFP_KERNEL);
> + if (!rams_new)
> + goto out;
> +
> + rams = rams_new;
> + rams_size += 16;
> + }
> +
> + rams[i].start = res.start;
> + rams[i++].end = res.end;
> +
> + start = res.end + 1;
> + }
> +
> + /* go reverse */
> + for (i--; i >= 0; i--) {
> + ret = (*func)(&rams[i], arg);
> + if (ret)
> + break;
> + }
> +
> +out:
> + kvfree(rams);
> + return ret;
> +}
> +
> /*
> * This function calls the @func callback against all memory ranges, which
> * are ranges marked as IORESOURCE_MEM and IORESOUCE_BUSY.
> --
> 2.41.0
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
2023-11-15 13:00 ` Baoquan He
(?)
(?)
@ 2024-01-20 21:09 ` patchwork-bot+linux-riscv
-1 siblings, 0 replies; 36+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-01-20 21:09 UTC (permalink / raw)
To: Baoquan He
Cc: linux-riscv, linux-kernel, kexec, x86, linux-parisc, linuxppc-dev,
linux-s390, akpm, ebiederm, takahiro.akashi
Hello:
This patch was applied to riscv/linux.git (fixes)
by Andrew Morton <akpm@linux-foundation.org>:
On Wed, 15 Nov 2023 21:00:27 +0800 you wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> [...]
Here is the summary with links:
- [v2,1/2] resource: add walk_system_ram_res_rev()
https://git.kernel.org/riscv/c/7acf164b259d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2024-01-20 21:09 ` patchwork-bot+linux-riscv
0 siblings, 0 replies; 36+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-01-20 21:09 UTC (permalink / raw)
To: Baoquan He
Cc: linux-s390, linux-parisc, x86, kexec, linux-kernel,
takahiro.akashi, ebiederm, linux-riscv, linuxppc-dev, akpm
Hello:
This patch was applied to riscv/linux.git (fixes)
by Andrew Morton <akpm@linux-foundation.org>:
On Wed, 15 Nov 2023 21:00:27 +0800 you wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> [...]
Here is the summary with links:
- [v2,1/2] resource: add walk_system_ram_res_rev()
https://git.kernel.org/riscv/c/7acf164b259d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2024-01-20 21:09 ` patchwork-bot+linux-riscv
0 siblings, 0 replies; 36+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-01-20 21:09 UTC (permalink / raw)
To: Baoquan He
Cc: linux-riscv, linux-kernel, kexec, x86, linux-parisc, linuxppc-dev,
linux-s390, akpm, ebiederm, takahiro.akashi
Hello:
This patch was applied to riscv/linux.git (fixes)
by Andrew Morton <akpm@linux-foundation.org>:
On Wed, 15 Nov 2023 21:00:27 +0800 you wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> [...]
Here is the summary with links:
- [v2,1/2] resource: add walk_system_ram_res_rev()
https://git.kernel.org/riscv/c/7acf164b259d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 36+ messages in thread* Re: [PATCH v2 1/2] resource: add walk_system_ram_res_rev()
@ 2024-01-20 21:09 ` patchwork-bot+linux-riscv
0 siblings, 0 replies; 36+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-01-20 21:09 UTC (permalink / raw)
To: Baoquan He
Cc: linux-riscv, linux-kernel, kexec, x86, linux-parisc, linuxppc-dev,
linux-s390, akpm, ebiederm, takahiro.akashi
Hello:
This patch was applied to riscv/linux.git (fixes)
by Andrew Morton <akpm@linux-foundation.org>:
On Wed, 15 Nov 2023 21:00:27 +0800 you wrote:
> This function, being a variant of walk_system_ram_res() introduced in
> commit 8c86e70acead ("resource: provide new functions to walk through
> resources"), walks through a list of all the resources of System RAM
> in reversed order, i.e., from higher to lower.
>
> It will be used in kexec_file code to load kernel, initrd etc when
> preparing kexec reboot.
>
> [...]
Here is the summary with links:
- [v2,1/2] resource: add walk_system_ram_res_rev()
https://git.kernel.org/riscv/c/7acf164b259d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 36+ messages in thread