From: Konrad Dybcio <konrad.dybcio-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Stephan Gerhold <stephan-3XONVrnlUWDR7s880joybQ@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Krzysztof Kozlowski
<krzysztof.kozlowski+dt-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Conor Dooley <conor+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Frank Rowand
<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Andy Gross <agross-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Bjorn Andersson
<andersson-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/5] of: reserved_mem: Implement alloc-{bottom-up,top-down}
Date: Wed, 17 May 2023 21:28:24 +0200 [thread overview]
Message-ID: <15df78fc-c35b-aae0-fd64-917c9882c815@linaro.org> (raw)
In-Reply-To: <20230510-dt-resv-bottom-up-v1-2-3bf68873dbed-3XONVrnlUWDR7s880joybQ@public.gmane.org>
On 15.05.2023 12:12, Stephan Gerhold wrote:
> Use memblock_set_bottom_up() to specify an explicit allocation order for
> dynamic reservations with "alloc-ranges". Since the default value varies
> between architectures the previous value is saved and restored after
> trying the allocations.
>
> If neither alloc-bottom-up or alloc-top-down are specified the previous
> implementation-defined allocation order is preserved.
>
> Signed-off-by: Stephan Gerhold <stephan-3XONVrnlUWDR7s880joybQ@public.gmane.org>
> ---
Acked-by: Konrad Dybcio <konrad.dybcio-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Konrad
> drivers/of/of_reserved_mem.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> index 948efa9f99e3..6443140deacf 100644
> --- a/drivers/of/of_reserved_mem.c
> +++ b/drivers/of/of_reserved_mem.c
> @@ -89,7 +89,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
> phys_addr_t base = 0, align = 0, size;
> int len;
> const __be32 *prop;
> - bool nomap;
> + bool nomap, prev_bottom_up;
> int ret;
>
> prop = of_get_flat_dt_prop(node, "size", &len);
> @@ -130,6 +130,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
> return -EINVAL;
> }
>
> + prev_bottom_up = memblock_bottom_up();
> + if (of_get_flat_dt_prop(node, "alloc-bottom-up", NULL))
> + memblock_set_bottom_up(true);
> + if (of_get_flat_dt_prop(node, "alloc-top-down", NULL))
> + memblock_set_bottom_up(false);
> +
> base = 0;
>
> while (len > 0) {
> @@ -148,6 +154,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
> len -= t_len;
> }
>
> + memblock_set_bottom_up(prev_bottom_up);
> } else {
> ret = early_init_dt_alloc_reserved_memory_arch(size, align,
> 0, 0, nomap, &base);
>
next prev parent reply other threads:[~2023-05-17 19:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 10:12 [PATCH 0/5] of: reserved_mem: Provide more control about allocation behavior Stephan Gerhold
[not found] ` <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed-3XONVrnlUWDR7s880joybQ@public.gmane.org>
2023-05-15 10:12 ` [PATCH 1/5] dt-bindings: reserved-memory: Add alloc-{bottom-up,top-down} Stephan Gerhold
[not found] ` <20230510-dt-resv-bottom-up-v1-1-3bf68873dbed-3XONVrnlUWDR7s880joybQ@public.gmane.org>
2023-06-08 14:02 ` Rob Herring
2023-06-09 9:16 ` Stephan Gerhold
[not found] ` <ZILt0X0uyIyUdxqH-3XONVrnlUWDR7s880joybQ@public.gmane.org>
2023-06-13 13:33 ` Rob Herring
2023-05-15 10:12 ` [PATCH 2/5] of: reserved_mem: Implement alloc-{bottom-up,top-down} Stephan Gerhold
[not found] ` <20230510-dt-resv-bottom-up-v1-2-3bf68873dbed-3XONVrnlUWDR7s880joybQ@public.gmane.org>
2023-05-17 19:28 ` Konrad Dybcio [this message]
2023-05-15 10:12 ` [PATCH 3/5] of: reserved_mem: Use stable allocation order Stephan Gerhold
2023-05-15 10:12 ` [PATCH RFC 5/5] arm64: dts: qcom: msm8916: Reserve firmware memory dynamically Stephan Gerhold
2023-05-17 19:25 ` [PATCH 0/5] of: reserved_mem: Provide more control about allocation behavior Konrad Dybcio
2023-05-15 10:12 ` [PATCH RFC 4/5] arm64: dts: qcom: msm8916: Enable modem on two phones Stephan Gerhold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15df78fc-c35b-aae0-fd64-917c9882c815@linaro.org \
--to=konrad.dybcio-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=agross-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=andersson-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=conor+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=krzysztof.kozlowski+dt-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=stephan-3XONVrnlUWDR7s880joybQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).