Re: [PATCH v6 13/15] sh: cast away constness from the zero page when flushing it from the cache
Mike Rapoport <[email protected]>
| Newsgroups | gmane.linux.ports.ppc.embedded,gmane.linux.ports.arm.kernel,gmane.linux.kernel,gmane.linux.kernel.mm,gmane.linux.ports.sh.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, May 26, 2026 at 07:59:00PM +0200, Ard Biesheuvel wrote: > From: Ard Biesheuvel <[email protected]> > > SH performs cache maintenance on the zero page during boot, presumably > to ensure that any clearing of BSS that has occurred at startup is > visible to other CPUs and DMA devices. It flushes the cache there because before 6215d9f4470f ("arch, mm: consolidate empty_zero_page") empty_zero_page used was for boot parameters at the very early boot. I removed memset(empty_zero_page, 0, PAGE_SIZE) that was a line above but missed the cache flush. This whole "clear zero-page" can be removed IMO. > The __flush_wback_region() function takes a void* argument, which is > conceptually sound, but given that empty_zero_page[] must never be > modified, it is being repainted as const, making it incompatible with a > void* formal parameter. > > Given the above, and the fact that __flush_wback_region() is in fact a > function pointer variable with multiple implementations, take the easy > way out, and cast away the constness in this particular invocation. > > Cc: Yoshinori Sato <[email protected]> > Cc: Rich Felker <[email protected]> > Cc: John Paul Adrian Glaubitz <[email protected]> > Signed-off-by: Ard Biesheuvel <[email protected]> > --- > arch/sh/mm/init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c > index 4e40d5e96be9..acbb481cdbfe 100644 > --- a/arch/sh/mm/init.c > +++ b/arch/sh/mm/init.c > @@ -332,7 +332,7 @@ void __init mem_init(void) > cpu_cache_init(); > > /* clear the zero-page */ > - __flush_wback_region(empty_zero_page, PAGE_SIZE); > + __flush_wback_region((void *)empty_zero_page, PAGE_SIZE); > > vsyscall_init(); > > -- > 2.54.0.794.g4f17f83d09-goog > -- Sincerely yours, Mike.