[PATCH v3 1/7] lmb: Add support of flags for no-map properties

Simon Glass sjg at chromium.org
Thu Apr 29 18:10:40 CEST 2021


Hi Patrick,

On Wed, 28 Apr 2021 at 03:23, Patrick Delaunay
<patrick.delaunay at foss.st.com> wrote:
>
> Add "flags" in lmb_property to save the "no-map" property of
> reserved region and a new function lmb_reserve_flags() to check
> this flag.
>
> The default allocation use flags = LMB_NONE.
>
> The adjacent reserved memory region are merged only when they have
> the same flags value.
>
> This patch is partially based on flags support done in Linux kernel
> mm/memblock .c (previously lmb.c); it is why LMB_NOMAP = 0x4, it is
> aligned with MEMBLOCK_NOMAP value.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - remove unnecessary comments in lmb.h
> - rebase on latest lmb patches
>
>  include/lmb.h | 20 ++++++++++++++++++++
>  lib/lmb.c     | 52 ++++++++++++++++++++++++++++++++++++++++++---------
>  2 files changed, 63 insertions(+), 9 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

>
> diff --git a/include/lmb.h b/include/lmb.h
> index 541e17093c..aa196c63bf 100644
> --- a/include/lmb.h
> +++ b/include/lmb.h
> @@ -12,6 +12,16 @@
>   * Copyright (C) 2001 Peter Bergner, IBM Corp.
>   */
>
> +/**
> + * enum lmb_flags - definition of memory region attributes
> + * @LMB_NONE: no special request
> + * @LMB_NOMAP: don't add to mmu configuration
> + */
> +enum lmb_flags {
> +       LMB_NONE                = 0x0,
> +       LMB_NOMAP               = 0x4,
> +};
> +
>  /**
>   * struct lmb_property - Description of one region.
>   *
> @@ -21,6 +31,7 @@
>  struct lmb_property {
>         phys_addr_t base;
>         phys_size_t size;
> +       enum lmb_flags flags;
>  };
>
>  /**
> @@ -69,6 +80,8 @@ extern void lmb_init_and_reserve_range(struct lmb *lmb, phys_addr_t base,
>                                        phys_size_t size, void *fdt_blob);
>  extern long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size);
>  extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size);
> +extern long lmb_reserve_flags(struct lmb *lmb, phys_addr_t base,
> +                             phys_size_t size, enum lmb_flags flags);

Needs a comment

[..]

Regards,
Simon


More information about the U-Boot mailing list