On Tue, 17 Jan 2017 21:13:51 +0100 Alexander Graf <[email protected]> wrote:
> > > On 17/01/2017 16:50, Emmanuel Vadot wrote: > > From: Warner Losh <[email protected]> > > > > FreeBSD loader(8) just loaded code to some random location that may > > contain stale icache entries. > > FreeBSD Kernel needs the icache and dcache flushed. > > Before running either one of them, flush the icache and dcache. > > > > Signed-off-by: Emmanuel Vadot <[email protected]> > > Is there any downside to doing the flush always? I would prefer to not > conditionalize it on CONFIG_FREEBSD. I don't think there is any downside. > > --- > > api/api.c | 5 +++++ > > cmd/boot.c | 5 +++++ > > cmd/elf.c | 8 +++++++- > > 3 files changed, 17 insertions(+), 1 deletion(-) > > > > diff --git a/api/api.c b/api/api.c > > index 8a1433af78..cc25deca09 100644 > > --- a/api/api.c > > +++ b/api/api.c > > @@ -290,6 +290,11 @@ static int API_dev_close(va_list ap) > > if (!err) > > di->state = DEV_STA_CLOSED; > > > > +#ifdef CONFIG_FREEBSD > > + flush_dcache_all(); > > + invalidate_icache_all(); > > +#endif > > + > > return err; > > } > > > > diff --git a/cmd/boot.c b/cmd/boot.c > > index 72f2cf362d..a1a91fbf0a 100644 > > --- a/cmd/boot.c > > +++ b/cmd/boot.c > > @@ -19,6 +19,11 @@ __attribute__((weak)) > > unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, > > char * const argv[]) > > { > > +#ifdef CONFIG_FREEBSD > > + flush_dcache_all(); > > + invalidate_icache_all(); > > +#endif > > + > > return entry (argc, argv); > > } > > > > diff --git a/cmd/elf.c b/cmd/elf.c > > index 5190cc6c0f..b2827fa042 100644 > > --- a/cmd/elf.c > > +++ b/cmd/elf.c > > @@ -109,6 +109,7 @@ static unsigned long do_bootelf_exec(ulong > > (*entry)(int, char * const[]), > > { > > unsigned long ret; > > > > +#ifndef CONFIG_FREEBSD > > /* > > * QNX images require the data cache is disabled. > > * Data cache is already flushed, so just turn it off. > > @@ -116,15 +117,20 @@ static unsigned long do_bootelf_exec(ulong > > (*entry)(int, char * const[]), > > int dcache = dcache_status(); > > if (dcache) > > dcache_disable(); > > Can FreeBSD boot with dcache disabled? Is there some way we can > determine what payload we have from the elf header? > > > Alex FreeBSD can boot with dcache disabled (our loader and kernel can) I'm not sure I get your other question, sorry. -- Emmanuel Vadot <[email protected]> <[email protected]> _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

