On Tue, Jun 1, 2021 at 8:38 AM Marc Zyngier <m...@kernel.org> wrote: > > On Thu, 27 May 2021 16:05:12 +0100, > Pavel Tatashin <pasha.tatas...@soleen.com> wrote: > > > > Replace places that contain logic like this: > > is_hyp_mode_available() && !is_kernel_in_hyp_mode() > > > > With a dedicated boolean function is_hyp_callable(). This will be needed > > later in kexec in order to sooner switch back to EL2. > > This looks like the very definition of "run in nVHE mode", so I'd > rather you call it like this, rather than "callable", which is > extremely ambiguous (if running at EL2, I call it any time I want, for > free).
Hi Marc, Naming is hard. Are you proposing s/is_hyp_callable/run_in_nvhe_mode/ ? This is also not a very good name because it does not sound like a boolean, but instead that we know that there is nvhe mode available and we can switch to it. > > > > > Suggested-by: James Morse <james.mo...@arm.com> > > > > [Fixed merging issues] > > > > Signed-off-by: Pavel Tatashin <pasha.tatas...@soleen.com> > > --- > > arch/arm64/include/asm/virt.h | 5 +++++ > > arch/arm64/kernel/cpu-reset.h | 3 +-- > > arch/arm64/kernel/hibernate.c | 9 +++------ > > arch/arm64/kernel/sdei.c | 2 +- > > 4 files changed, 10 insertions(+), 9 deletions(-) > > > > diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h > > index 7379f35ae2c6..4216c8623538 100644 > > --- a/arch/arm64/include/asm/virt.h > > +++ b/arch/arm64/include/asm/virt.h > > @@ -128,6 +128,11 @@ static __always_inline bool > > is_protected_kvm_enabled(void) > > return cpus_have_final_cap(ARM64_KVM_PROTECTED_MODE); > > } > > > > +static inline bool is_hyp_callable(void) > > +{ > > + return is_hyp_mode_available() && !is_kernel_in_hyp_mode(); > > +} > > nit: consider switching the two members of the expression so that you > don't have extra memory accesses when running at EL2. Sure, I will do that. > > -/* Do we need to reset el2? */ > > -#define el2_reset_needed() (is_hyp_mode_available() && > > !is_kernel_in_hyp_mode()) > > - > > Please keep the macro, as it explains *why* we're doing things (we > need to reset EL2), and replacing it with a generic macro drops the > documentation aspect. OK, I will keep the macro, and redefine it to use the common macro. Thank you, Pasha _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec