Message ID | 20210520124406.2731873-8-tabba@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Tidy up cache.S | expand |
On Thu, May 20, 2021 at 01:43:55PM +0100, Fuad Tabba wrote: > Since __flush_dcache_area is called right before, > invalidate_icache_range is sufficient in this case. > > Rewrite the comment to better explain the rationale behind the > cache maintenance operations used here. > > No functional change intended. > Possible performance impact due to invalidating only the icache > rather than invalidating and cleaning both caches. > > Reported-by: Catalin Marinas <catalin.marinas@arm.com> > Reported-by: Will Deacon <will@kernel.org> > Link: https://lore.kernel.org/linux-arch/20200511110014.lb9PEahJ4hVOYrbwIb_qUHXyNy9KQzNFdb_I3YlzY6A@z/ > Signed-off-by: Fuad Tabba <tabba@google.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Mark. > --- > arch/arm64/kernel/machine_kexec.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c > index 90a335c74442..a03944fd0cd4 100644 > --- a/arch/arm64/kernel/machine_kexec.c > +++ b/arch/arm64/kernel/machine_kexec.c > @@ -68,10 +68,14 @@ int machine_kexec_post_load(struct kimage *kimage) > kimage->arch.kern_reloc = __pa(reloc_code); > kexec_image_info(kimage); > > - /* Flush the reloc_code in preparation for its execution. */ > + /* > + * For execution with the MMU off, reloc_code needs to be cleaned to the > + * PoC and invalidated from the I-cache. > + */ > __flush_dcache_area(reloc_code, arm64_relocate_new_kernel_size); > - flush_icache_range((uintptr_t)reloc_code, (uintptr_t)reloc_code + > - arm64_relocate_new_kernel_size); > + invalidate_icache_range((uintptr_t)reloc_code, > + (uintptr_t)reloc_code + > + arm64_relocate_new_kernel_size); > > return 0; > } > -- > 2.31.1.751.gd2f1c929bd-goog >
On Thu, May 20, 2021 at 01:43:55PM +0100, Fuad Tabba wrote: > Since __flush_dcache_area is called right before, > invalidate_icache_range is sufficient in this case. > > Rewrite the comment to better explain the rationale behind the > cache maintenance operations used here. > > No functional change intended. > Possible performance impact due to invalidating only the icache > rather than invalidating and cleaning both caches. > > Reported-by: Catalin Marinas <catalin.marinas@arm.com> > Reported-by: Will Deacon <will@kernel.org> > Link: https://lore.kernel.org/linux-arch/20200511110014.lb9PEahJ4hVOYrbwIb_qUHXyNy9KQzNFdb_I3YlzY6A@z/ > Signed-off-by: Fuad Tabba <tabba@google.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index 90a335c74442..a03944fd0cd4 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -68,10 +68,14 @@ int machine_kexec_post_load(struct kimage *kimage) kimage->arch.kern_reloc = __pa(reloc_code); kexec_image_info(kimage); - /* Flush the reloc_code in preparation for its execution. */ + /* + * For execution with the MMU off, reloc_code needs to be cleaned to the + * PoC and invalidated from the I-cache. + */ __flush_dcache_area(reloc_code, arm64_relocate_new_kernel_size); - flush_icache_range((uintptr_t)reloc_code, (uintptr_t)reloc_code + - arm64_relocate_new_kernel_size); + invalidate_icache_range((uintptr_t)reloc_code, + (uintptr_t)reloc_code + + arm64_relocate_new_kernel_size); return 0; }
Since __flush_dcache_area is called right before, invalidate_icache_range is sufficient in this case. Rewrite the comment to better explain the rationale behind the cache maintenance operations used here. No functional change intended. Possible performance impact due to invalidating only the icache rather than invalidating and cleaning both caches. Reported-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/linux-arch/20200511110014.lb9PEahJ4hVOYrbwIb_qUHXyNy9KQzNFdb_I3YlzY6A@z/ Signed-off-by: Fuad Tabba <tabba@google.com> --- arch/arm64/kernel/machine_kexec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)