Message ID | 20200612124121.13846-2-t-kristo@ti.com |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
Series | Some reserved memory hardenings | expand |
On Fri, Jun 12, 2020 at 03:41:18PM +0300, Tero Kristo wrote: > Dump lmb status from the bdinfo command. This is useful for seeing the > reserved memory regions from the u-boot cmdline. > > Signed-off-by: Tero Kristo <t-kristo@ti.com> > --- > cmd/bdinfo.c | 8 +++++++- > include/lmb.h | 1 + > lib/lmb.c | 42 +++++++++++++++++++++++------------------- > 3 files changed, 31 insertions(+), 20 deletions(-) > > diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c > index dba552b03f..05e1b27de0 100644 > --- a/cmd/bdinfo.c > +++ b/cmd/bdinfo.c > @@ -10,6 +10,7 @@ > #include <common.h> > #include <command.h> > #include <env.h> > +#include <lmb.h> > #include <net.h> > #include <vsprintf.h> > #include <asm/cache.h> > @@ -365,8 +366,13 @@ static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, > #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) > print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit); > #endif > - if (gd->fdt_blob) > + if (gd->fdt_blob) { > + struct lmb lmb; > print_num("fdt_blob", (ulong)gd->fdt_blob); > + lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob); > + lmb_dump_all_force(&lmb); > + } > + > print_cpu_word_size(); > > return 0; Can you please rebase this on top of master? Simon's series to cleanup bdinfo stuff has been applied, thanks. The rest of your changes are fine and under test now.
On 17/07/2020 16:29, Tom Rini wrote: > On Fri, Jun 12, 2020 at 03:41:18PM +0300, Tero Kristo wrote: > >> Dump lmb status from the bdinfo command. This is useful for seeing the >> reserved memory regions from the u-boot cmdline. >> >> Signed-off-by: Tero Kristo <t-kristo@ti.com> >> --- >> cmd/bdinfo.c | 8 +++++++- >> include/lmb.h | 1 + >> lib/lmb.c | 42 +++++++++++++++++++++++------------------- >> 3 files changed, 31 insertions(+), 20 deletions(-) >> >> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c >> index dba552b03f..05e1b27de0 100644 >> --- a/cmd/bdinfo.c >> +++ b/cmd/bdinfo.c >> @@ -10,6 +10,7 @@ >> #include <common.h> >> #include <command.h> >> #include <env.h> >> +#include <lmb.h> >> #include <net.h> >> #include <vsprintf.h> >> #include <asm/cache.h> >> @@ -365,8 +366,13 @@ static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, >> #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) >> print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit); >> #endif >> - if (gd->fdt_blob) >> + if (gd->fdt_blob) { >> + struct lmb lmb; >> print_num("fdt_blob", (ulong)gd->fdt_blob); >> + lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob); >> + lmb_dump_all_force(&lmb); >> + } >> + >> print_cpu_word_size(); >> >> return 0; > > Can you please rebase this on top of master? Simon's series to cleanup > bdinfo stuff has been applied, thanks. The rest of your changes are > fine and under test now. Yeah, I can repost this single patch. Thanks for the heads-up. -Tero -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index dba552b03f..05e1b27de0 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -10,6 +10,7 @@ #include <common.h> #include <command.h> #include <env.h> +#include <lmb.h> #include <net.h> #include <vsprintf.h> #include <asm/cache.h> @@ -365,8 +366,13 @@ static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit); #endif - if (gd->fdt_blob) + if (gd->fdt_blob) { + struct lmb lmb; print_num("fdt_blob", (ulong)gd->fdt_blob); + lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob); + lmb_dump_all_force(&lmb); + } + print_cpu_word_size(); return 0; diff --git a/include/lmb.h b/include/lmb.h index 3b338dfee0..0d90ab1d65 100644 --- a/include/lmb.h +++ b/include/lmb.h @@ -48,6 +48,7 @@ extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr); extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size); extern void lmb_dump_all(struct lmb *lmb); +extern void lmb_dump_all_force(struct lmb *lmb); static inline phys_size_t lmb_size_bytes(struct lmb_region *type, unsigned long region_nr) diff --git a/lib/lmb.c b/lib/lmb.c index 008bcc7930..d62f25f9de 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -14,33 +14,37 @@ #define LMB_ALLOC_ANYWHERE 0 -void lmb_dump_all(struct lmb *lmb) +void lmb_dump_all_force(struct lmb *lmb) { -#ifdef DEBUG unsigned long i; - debug("lmb_dump_all:\n"); - debug(" memory.cnt = 0x%lx\n", lmb->memory.cnt); - debug(" memory.size = 0x%llx\n", - (unsigned long long)lmb->memory.size); + printf("lmb_dump_all:\n"); + printf(" memory.cnt = 0x%lx\n", lmb->memory.cnt); + printf(" memory.size = 0x%llx\n", + (unsigned long long)lmb->memory.size); for (i = 0; i < lmb->memory.cnt; i++) { - debug(" memory.reg[0x%lx].base = 0x%llx\n", i, - (unsigned long long)lmb->memory.region[i].base); - debug(" .size = 0x%llx\n", - (unsigned long long)lmb->memory.region[i].size); + printf(" memory.reg[0x%lx].base = 0x%llx\n", i, + (unsigned long long)lmb->memory.region[i].base); + printf(" .size = 0x%llx\n", + (unsigned long long)lmb->memory.region[i].size); } - debug("\n reserved.cnt = 0x%lx\n", - lmb->reserved.cnt); - debug(" reserved.size = 0x%llx\n", - (unsigned long long)lmb->reserved.size); + printf("\n reserved.cnt = 0x%lx\n", lmb->reserved.cnt); + printf(" reserved.size = 0x%llx\n", + (unsigned long long)lmb->reserved.size); for (i = 0; i < lmb->reserved.cnt; i++) { - debug(" reserved.reg[0x%lx].base = 0x%llx\n", i, - (unsigned long long)lmb->reserved.region[i].base); - debug(" .size = 0x%llx\n", - (unsigned long long)lmb->reserved.region[i].size); + printf(" reserved.reg[0x%lx].base = 0x%llx\n", i, + (unsigned long long)lmb->reserved.region[i].base); + printf(" .size = 0x%llx\n", + (unsigned long long)lmb->reserved.region[i].size); } -#endif /* DEBUG */ +} + +void lmb_dump_all(struct lmb *lmb) +{ +#ifdef DEBUG + lmb_dump_all_force(lmb); +#endif } static long lmb_addrs_overlap(phys_addr_t base1, phys_size_t size1,
Dump lmb status from the bdinfo command. This is useful for seeing the reserved memory regions from the u-boot cmdline. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- cmd/bdinfo.c | 8 +++++++- include/lmb.h | 1 + lib/lmb.c | 42 +++++++++++++++++++++++------------------- 3 files changed, 31 insertions(+), 20 deletions(-)