Message ID | 20240607185240.1892031-21-sughosh.ganu@linaro.org |
---|---|
State | New |
Headers | show |
Series | Make U-Boot memory reservations coherent | expand |
Hi Sughosh, On Fri, 7 Jun 2024 at 12:54, Sughosh Ganu <sughosh.ganu@linaro.org> wrote: > > Instead of a randomly selected address, use an LMB allocated one for > reading the file into memory. With the LMB map now being persistent > and global, the address used for reading the file might be already > allocated as non-overwritable, resulting in a failure. Get a valid > address from LMB and then read the file to that address. > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> > --- > test/boot/cedit.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/test/boot/cedit.c b/test/boot/cedit.c > index aa41719048..1f4147da89 100644 > --- a/test/boot/cedit.c > +++ b/test/boot/cedit.c > @@ -8,6 +8,7 @@ > #include <cedit.h> > #include <env.h> > #include <expo.h> > +#include <lmb.h> > #include <mapmem.h> > #include <dm/ofnode.h> > #include <test/ut.h> > @@ -62,7 +63,7 @@ static int cedit_fdt(struct unit_test_state *uts) > struct video_priv *vid_priv; > extern struct expo *cur_exp; > struct scene_obj_menu *menu; > - ulong addr = 0x1000; > + ulong addr; > struct ofprop prop; > struct scene *scn; > oftree tree; > @@ -87,6 +88,8 @@ static int cedit_fdt(struct unit_test_state *uts) > str = abuf_data(&tline->buf); > strcpy(str, "my-machine"); > > + addr = lmb_alloc(1024, 1024); > + ut_asserteq(!!addr, !0); > ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0)); > ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr)); > ut_assert_nextlinen("1024 bytes read"); > -- > 2.34.1 > This is a situation where we don't want to make changes. We know that address is valid for testing. We won't have LMB allocations that persist across tests...even if that were to happen we would want the test to reset the lmb state. That is how the sandbox test-system works. Regards, Simon
diff --git a/test/boot/cedit.c b/test/boot/cedit.c index aa41719048..1f4147da89 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -8,6 +8,7 @@ #include <cedit.h> #include <env.h> #include <expo.h> +#include <lmb.h> #include <mapmem.h> #include <dm/ofnode.h> #include <test/ut.h> @@ -62,7 +63,7 @@ static int cedit_fdt(struct unit_test_state *uts) struct video_priv *vid_priv; extern struct expo *cur_exp; struct scene_obj_menu *menu; - ulong addr = 0x1000; + ulong addr; struct ofprop prop; struct scene *scn; oftree tree; @@ -87,6 +88,8 @@ static int cedit_fdt(struct unit_test_state *uts) str = abuf_data(&tline->buf); strcpy(str, "my-machine"); + addr = lmb_alloc(1024, 1024); + ut_asserteq(!!addr, !0); ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0)); ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr)); ut_assert_nextlinen("1024 bytes read");
Instead of a randomly selected address, use an LMB allocated one for reading the file into memory. With the LMB map now being persistent and global, the address used for reading the file might be already allocated as non-overwritable, resulting in a failure. Get a valid address from LMB and then read the file to that address. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> --- test/boot/cedit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)