Meng-Huan Yu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: mmu: Provide API to expose mmu memery ranges for all archs ......................................................................
mmu: Provide API to expose mmu memery ranges for all archs
Provide lib_get_mmu_ranges() to let payloads could get mmu information for all used memory regions.
* Move mmu related structure from arm64 mmu.h to new include/mmu_range.h * Provide empty API for x86 and arm.
BUG=b:171858277 TEST=Build in x86, arm, arm64. emerge-zork libpayload depthcharge emerge-nyan libpayload depthcharge emerge-asurada libpayload depthcharge
Signed-off-by: Meng-Huan Yu menghuan@google.com Change-Id: I39b24aefc9dbe530169b272e839d0e1e7c697742 --- M payloads/libpayload/arch/arm/Makefile.inc A payloads/libpayload/arch/arm/mmu.c M payloads/libpayload/arch/arm64/mmu.c M payloads/libpayload/arch/x86/Makefile.inc A payloads/libpayload/arch/x86/mmu.c M payloads/libpayload/include/arm64/arch/mmu.h M payloads/libpayload/include/libpayload.h A payloads/libpayload/include/mmu_range.h 8 files changed, 131 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/48113/1
diff --git a/payloads/libpayload/arch/arm/Makefile.inc b/payloads/libpayload/arch/arm/Makefile.inc index c973601..6287641 100644 --- a/payloads/libpayload/arch/arm/Makefile.inc +++ b/payloads/libpayload/arch/arm/Makefile.inc @@ -37,6 +37,7 @@ libc-y += exception_asm.S exception.c libc-y += cache.c cpu.S libc-y += selfboot.c +libc-y += mmu.c
# Will fall back to default_memXXX() in libc/memory.c if GPL not allowed. libc-$(CONFIG_LP_GPL) += memcpy.S memset.S memmove.S diff --git a/payloads/libpayload/arch/arm/mmu.c b/payloads/libpayload/arch/arm/mmu.c new file mode 100644 index 0000000..e90426a --- /dev/null +++ b/payloads/libpayload/arch/arm/mmu.c @@ -0,0 +1,34 @@ +/* + * + * Copyright 2020 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <libpayload.h> + +const struct mmu_ranges* lib_get_mmu_ranges(void) +{ + return NULL; +} diff --git a/payloads/libpayload/arch/arm64/mmu.c b/payloads/libpayload/arch/arm64/mmu.c index cb0081b..6caf912 100644 --- a/payloads/libpayload/arch/arm64/mmu.c +++ b/payloads/libpayload/arch/arm64/mmu.c @@ -705,3 +705,8 @@ mmu_init(&usedmem_ranges); mmu_enable(); } + +const struct mmu_ranges* lib_get_mmu_ranges(void) +{ + return &usedmem_ranges; +} diff --git a/payloads/libpayload/arch/x86/Makefile.inc b/payloads/libpayload/arch/x86/Makefile.inc index 41228f2..e373a2e 100644 --- a/payloads/libpayload/arch/x86/Makefile.inc +++ b/payloads/libpayload/arch/x86/Makefile.inc @@ -35,6 +35,7 @@ libc-y += selfboot.c libc-y += exception_asm.S exception.c libc-y += delay.c +libc-y += mmu.c
# Will fall back to default_memXXX() in libc/memory.c if GPL not allowed. libc-$(CONFIG_LP_GPL) += string.c diff --git a/payloads/libpayload/arch/x86/mmu.c b/payloads/libpayload/arch/x86/mmu.c new file mode 100644 index 0000000..e90426a --- /dev/null +++ b/payloads/libpayload/arch/x86/mmu.c @@ -0,0 +1,34 @@ +/* + * + * Copyright 2020 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <libpayload.h> + +const struct mmu_ranges* lib_get_mmu_ranges(void) +{ + return NULL; +} diff --git a/payloads/libpayload/include/arm64/arch/mmu.h b/payloads/libpayload/include/arm64/arch/mmu.h index 5a1dd98..273e6e4 100644 --- a/payloads/libpayload/include/arm64/arch/mmu.h +++ b/payloads/libpayload/include/arm64/arch/mmu.h @@ -31,31 +31,12 @@
#include <libpayload.h>
-struct mmu_memrange { - uint64_t base; - uint64_t size; - uint64_t type; -}; - -struct mmu_ranges { - struct mmu_memrange entries[SYSINFO_MAX_MEM_RANGES]; - size_t used; -}; - /* * Symbols taken from linker script * They mark the start and end of the region used by payload */ extern char _start[], _end[];
-/* Memory attributes for mmap regions - * These attributes act as tag values for memrange regions - */ - -#define TYPE_NORMAL_MEM 1 -#define TYPE_DEV_MEM 2 -#define TYPE_DMA_MEM 3 - /* Descriptor attributes */
#define INVALID_DESC 0x0 diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h index f206fea..83f3c25 100644 --- a/payloads/libpayload/include/libpayload.h +++ b/payloads/libpayload/include/libpayload.h @@ -64,6 +64,7 @@ #include <sysinfo.h> #include <pci.h> #include <archive.h> +#include <mmu_range.h>
/* Double-evaluation unsafe min/max, for bitfields and outside of functions */ #define __CMP_UNSAFE(a, b, op) ((a) op (b) ? (a) : (b)) @@ -526,6 +527,7 @@ int lib_get_sysinfo(void); void lib_sysinfo_get_memranges(struct memrange **ranges, uint64_t *nranges); +const struct mmu_ranges* lib_get_mmu_ranges(void);
/* Timer functions. */ /* Defined by each architecture. */ diff --git a/payloads/libpayload/include/mmu_range.h b/payloads/libpayload/include/mmu_range.h new file mode 100644 index 0000000..17aaec6 --- /dev/null +++ b/payloads/libpayload/include/mmu_range.h @@ -0,0 +1,54 @@ +/* + * + * Copyright 2020 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __MMU_MEMRANGE_H__ +#define __MMU_MEMRANGE_H__ + +#include <stddef.h> +#include <sysinfo.h> + +struct mmu_memrange { + uint64_t base; + uint64_t size; + uint64_t type; +}; + +struct mmu_ranges { + struct mmu_memrange entries[SYSINFO_MAX_MEM_RANGES]; + size_t used; +}; + +/* Memory attributes for mmap regions + * These attributes act as tag values for memrange regions + */ + +#define TYPE_NORMAL_MEM 1 +#define TYPE_DEV_MEM 2 +#define TYPE_DMA_MEM 3 + +#endif // __MMU_MEMRANGE_H__
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: mmu: Provide API to expose mmu memery ranges for all archs ......................................................................
Patch Set 1:
(4 comments)
https://review.coreboot.org/c/coreboot/+/48113/1/payloads/libpayload/arch/ar... File payloads/libpayload/arch/arm/mmu.c:
https://review.coreboot.org/c/coreboot/+/48113/1/payloads/libpayload/arch/ar... PS1, Line 31: const struct mmu_ranges* lib_get_mmu_ranges(void) "foo* bar" should be "foo *bar"
https://review.coreboot.org/c/coreboot/+/48113/1/payloads/libpayload/arch/ar... File payloads/libpayload/arch/arm64/mmu.c:
https://review.coreboot.org/c/coreboot/+/48113/1/payloads/libpayload/arch/ar... PS1, Line 709: const struct mmu_ranges* lib_get_mmu_ranges(void) "foo* bar" should be "foo *bar"
https://review.coreboot.org/c/coreboot/+/48113/1/payloads/libpayload/arch/x8... File payloads/libpayload/arch/x86/mmu.c:
https://review.coreboot.org/c/coreboot/+/48113/1/payloads/libpayload/arch/x8... PS1, Line 31: const struct mmu_ranges* lib_get_mmu_ranges(void) "foo* bar" should be "foo *bar"
https://review.coreboot.org/c/coreboot/+/48113/1/payloads/libpayload/include... File payloads/libpayload/include/libpayload.h:
https://review.coreboot.org/c/coreboot/+/48113/1/payloads/libpayload/include... PS1, Line 530: const struct mmu_ranges* lib_get_mmu_ranges(void); "foo* bar" should be "foo *bar"
Hello Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48113
to look at the new patch set (#2).
Change subject: libpayload: Provide API to expose mmu memery ranges for all archs ......................................................................
libpayload: Provide API to expose mmu memery ranges for all archs
Provide lib_get_mmu_ranges() to let payloads could get mmu information for all used memory regions.
* Move mmu related structure from arm64 mmu.h to new include/mmu_range.h * Provide empty API for x86 and arm.
BUG=b:171858277 TEST=Build in x86, arm, arm64. emerge-zork libpayload depthcharge emerge-nyan libpayload depthcharge emerge-asurada libpayload depthcharge
Signed-off-by: Meng-Huan Yu menghuan@google.com Change-Id: I39b24aefc9dbe530169b272e839d0e1e7c697742 --- M payloads/libpayload/arch/arm/Makefile.inc A payloads/libpayload/arch/arm/mmu.c M payloads/libpayload/arch/arm64/mmu.c M payloads/libpayload/arch/x86/Makefile.inc A payloads/libpayload/arch/x86/mmu.c M payloads/libpayload/include/arm64/arch/mmu.h M payloads/libpayload/include/libpayload.h A payloads/libpayload/include/mmu_range.h 8 files changed, 131 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/48113/2
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose mmu memery ranges for all archs ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/coreboot/+/48113/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/48113/2//COMMIT_MSG@13 PS2, Line 13: * Provide empty API for x86 and arm. Do we need this? I don't think it's useful to pretend that this API is universal, because MMU stuff works so different across architectures and that's likely always going to stay that way. I'd suggest to just keep this in arm64-specific headers and guard calls to it with CONFIG(LP_ARCH_ARM64) where necessary.
https://review.coreboot.org/c/coreboot/+/48113/2/payloads/libpayload/arch/ar... File payloads/libpayload/arch/arm64/mmu.c:
https://review.coreboot.org/c/coreboot/+/48113/2/payloads/libpayload/arch/ar... PS2, Line 709: const struct mmu_ranges *lib_get_mmu_ranges(void) The common prefix here is mmu_ so I'd just call this mmu_get_ranges() or something.
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Julius Werner, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48113
to look at the new patch set (#3).
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
libpayload: Provide API to expose MMU memery ranges for ARM64
Provide get_mmu_ranges() for ARM64 to let payloads could get MMU ranges for all used memory regions.
BUG=b:171858277 TEST=Build in x86, arm, arm64. emerge-zork libpayload depthcharge emerge-nyan libpayload depthcharge emerge-asurada libpayload depthcharge
Signed-off-by: Meng-Huan Yu menghuan@google.com Change-Id: I39b24aefc9dbe530169b272e839d0e1e7c697742 --- M payloads/libpayload/arch/arm64/mmu.c M payloads/libpayload/include/arm64/arch/mmu.h 2 files changed, 11 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/48113/3
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Julius Werner, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48113
to look at the new patch set (#4).
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
libpayload: Provide API to expose MMU memery ranges for ARM64
Provide get_mmu_ranges() for ARM64 to let payloads could get MMU ranges for all used memory regions.
BUG=b:171858277 TEST=Build in x86, arm, arm64. emerge-zork libpayload depthcharge emerge-nyan libpayload depthcharge emerge-asurada libpayload depthcharge
Signed-off-by: Meng-Huan Yu menghuan@google.com Change-Id: I39b24aefc9dbe530169b272e839d0e1e7c697742 --- M payloads/libpayload/arch/arm64/mmu.c M payloads/libpayload/include/arm64/arch/mmu.h 2 files changed, 11 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/48113/4
Meng-Huan Yu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 4:
(2 comments)
https://review.coreboot.org/c/coreboot/+/48113/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/48113/2//COMMIT_MSG@13 PS2, Line 13: * Provide empty API for x86 and arm.
Do we need this? I don't think it's useful to pretend that this API is universal, because MMU stuff […]
Got it. I simplified this CL, because if we keep get_mmu_ranges() in arm64-specific headers, we probably don't need to move mmu_range structure, given we will need "ifdef" when calling it. Do you intend to use "ifdef" at caller side? or any suggestion?
Depthcharge CL for reference: https://chromium-review.googlesource.com/c/chromiumos/platform/depthcharge/+...
https://review.coreboot.org/c/coreboot/+/48113/2/payloads/libpayload/arch/ar... File payloads/libpayload/arch/arm64/mmu.c:
https://review.coreboot.org/c/coreboot/+/48113/2/payloads/libpayload/arch/ar... PS2, Line 709: const struct mmu_ranges *lib_get_mmu_ranges(void)
The common prefix here is mmu_ so I'd just call this mmu_get_ranges() or something.
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 4: Code-Review+1
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 4:
(2 comments)
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... File payloads/libpayload/include/arm64/arch/mmu.h:
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... PS4, Line 199: includes include
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... PS4, Line 202: mmu_get_ranges How about mmu_get_used_ranges? Otherwise, please at least mention "used" in the function comment.
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Julius Werner, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48113
to look at the new patch set (#5).
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
libpayload: Provide API to expose MMU memery ranges for ARM64
Provide get_mmu_ranges() for ARM64 to let payloads could get MMU ranges for all used memory regions.
BUG=b:171858277 TEST=Build in x86, arm, arm64. emerge-zork libpayload depthcharge emerge-nyan libpayload depthcharge emerge-asurada libpayload depthcharge
Signed-off-by: Meng-Huan Yu menghuan@google.com Change-Id: I39b24aefc9dbe530169b272e839d0e1e7c697742 --- M payloads/libpayload/arch/arm64/mmu.c M payloads/libpayload/include/arm64/arch/mmu.h 2 files changed, 13 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/48113/5
Meng-Huan Yu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... File payloads/libpayload/include/arm64/arch/mmu.h:
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... PS4, Line 199: includes
include
Done
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... PS4, Line 202: mmu_get_ranges
How about mmu_get_used_ranges? Otherwise, please at least mention "used" in the function comment.
I feel the term "used" is a little bit ambiguous here. Do you mean a) it is a "valid" memory range or b) it is a "occupied" by someone?
For me, the ranges for MMU (mmu_get_ranges()) sounds like getting the mapped memory regions. The normal DRAM range will be mapped and stored in the structure, but they may be considered as "free" (can be used) memory in the perspective of payloads.
I update the comment message to describe more detail and give more examples. What do you think about this version?
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... File payloads/libpayload/include/arm64/arch/mmu.h:
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... PS4, Line 202: mmu_get_ranges
I feel the term "used" is a little bit ambiguous here. […]
I agree with Yu-Ping, these are really only the _used_ (occupied) memory ranges, not all valid DRAM. The point of being able to query these is that they're _not_ free from the payload perspective. So I think "used" is an appropriate name (and it would also match what it was already called in this file).
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Julius Werner, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48113
to look at the new patch set (#6).
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
libpayload: Provide API to expose MMU memery ranges for ARM64
Provide get_mmu_ranges() for ARM64 to let payloads could get MMU ranges for all used memory regions.
BUG=b:171858277 TEST=Build in x86, arm, arm64. emerge-zork libpayload depthcharge emerge-nyan libpayload depthcharge emerge-asurada libpayload depthcharge
Signed-off-by: Meng-Huan Yu menghuan@google.com Change-Id: I39b24aefc9dbe530169b272e839d0e1e7c697742 --- M payloads/libpayload/arch/arm64/mmu.c M payloads/libpayload/include/arm64/arch/mmu.h 2 files changed, 13 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/48113/6
Meng-Huan Yu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... File payloads/libpayload/include/arm64/arch/mmu.h:
https://review.coreboot.org/c/coreboot/+/48113/4/payloads/libpayload/include... PS4, Line 202: mmu_get_ranges
I agree with Yu-Ping, these are really only the _used_ (occupied) memory ranges, not all valid DRAM. […]
Oops. You are right. This structure only store occupied memory, not mapped. I was confused by other MMU functions. Then, I agree it is appropriate to have "used" in function name.
Done
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 6:
(2 comments)
https://review.coreboot.org/c/coreboot/+/48113/6/payloads/libpayload/include... File payloads/libpayload/include/arm64/arch/mmu.h:
https://review.coreboot.org/c/coreboot/+/48113/6/payloads/libpayload/include... PS6, Line 200: are used to describe Maybe simply "describe" or "contain".
https://review.coreboot.org/c/coreboot/+/48113/6/payloads/libpayload/include... PS6, Line 200: are actually are actually used
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, Julius Werner, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/48113
to look at the new patch set (#7).
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
libpayload: Provide API to expose MMU memery ranges for ARM64
Provide get_mmu_ranges() for ARM64 to let payloads could get MMU ranges for all used memory regions.
BUG=b:171858277 TEST=Build in x86, arm, arm64. emerge-zork libpayload depthcharge emerge-nyan libpayload depthcharge emerge-asurada libpayload depthcharge
Signed-off-by: Meng-Huan Yu menghuan@google.com Change-Id: I39b24aefc9dbe530169b272e839d0e1e7c697742 --- M payloads/libpayload/arch/arm64/mmu.c M payloads/libpayload/include/arm64/arch/mmu.h 2 files changed, 13 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/48113/7
Meng-Huan Yu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 7:
(2 comments)
https://review.coreboot.org/c/coreboot/+/48113/6/payloads/libpayload/include... File payloads/libpayload/include/arm64/arch/mmu.h:
https://review.coreboot.org/c/coreboot/+/48113/6/payloads/libpayload/include... PS6, Line 200: are used to describe
Maybe simply "describe" or "contain".
Done
https://review.coreboot.org/c/coreboot/+/48113/6/payloads/libpayload/include... PS6, Line 200: are actually
are actually used
Done
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 7: Code-Review+2
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 7: Code-Review+1
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/48113/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/48113/2//COMMIT_MSG@13 PS2, Line 13: * Provide empty API for x86 and arm.
Got it. […]
Ack
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/48113 )
Change subject: libpayload: Provide API to expose MMU memery ranges for ARM64 ......................................................................
libpayload: Provide API to expose MMU memery ranges for ARM64
Provide get_mmu_ranges() for ARM64 to let payloads could get MMU ranges for all used memory regions.
BUG=b:171858277 TEST=Build in x86, arm, arm64. emerge-zork libpayload depthcharge emerge-nyan libpayload depthcharge emerge-asurada libpayload depthcharge
Signed-off-by: Meng-Huan Yu menghuan@google.com Change-Id: I39b24aefc9dbe530169b272e839d0e1e7c697742 Reviewed-on: https://review.coreboot.org/c/coreboot/+/48113 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Julius Werner jwerner@chromium.org Reviewed-by: Yu-Ping Wu yupingso@google.com --- M payloads/libpayload/arch/arm64/mmu.c M payloads/libpayload/include/arm64/arch/mmu.h 2 files changed, 13 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved Yu-Ping Wu: Looks good to me, but someone else must approve
diff --git a/payloads/libpayload/arch/arm64/mmu.c b/payloads/libpayload/arch/arm64/mmu.c index cb0081b..bc4c233 100644 --- a/payloads/libpayload/arch/arm64/mmu.c +++ b/payloads/libpayload/arch/arm64/mmu.c @@ -705,3 +705,8 @@ mmu_init(&usedmem_ranges); mmu_enable(); } + +const struct mmu_ranges *mmu_get_used_ranges(void) +{ + return &usedmem_ranges; +} diff --git a/payloads/libpayload/include/arm64/arch/mmu.h b/payloads/libpayload/include/arm64/arch/mmu.h index 5a1dd98..2b1e9e1 100644 --- a/payloads/libpayload/include/arm64/arch/mmu.h +++ b/payloads/libpayload/include/arm64/arch/mmu.h @@ -194,4 +194,12 @@ */ void mmu_presysinfo_memory_used(uint64_t base, uint64_t size); void mmu_presysinfo_enable(void); + +/* + * Functions for exposing the used memory ranges to payloads. The ranges contain + * all used memory ranges that are actually used by payload. i.e. _start -> _end + * in linker script, the coreboot tables and framebuffer/DMA allocated in MMU + * initialization. + */ +const struct mmu_ranges *mmu_get_used_ranges(void); #endif // __ARCH_ARM64_MMU_H__