Re: [PATCH 04/18] arm64: kernel: add helper for booted at EL2 and not VHE

From: Marc Zyngier
Date: Wed Jun 02 2021 - 04:21:02 EST


On Wed, 02 Jun 2021 02:33:52 +0100,
Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> wrote:
>
> On Tue, Jun 1, 2021 at 8:38 AM Marc Zyngier <maz@xxxxxxxxxx> wrote:
> >
> > On Thu, 27 May 2021 16:05:12 +0100,
> > Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> 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.

News flash!

> 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.

No, what I suggest is "is_hyp_nvhe()", or something along those
lines. It clearly identifies that we are in control of EL2, and which
mode it is in.

M.

--
Without deviation from the norm, progress is not possible.