Replace places that contain logic like this:
	is_hyp_mode_available() && !is_kernel_in_hyp_mode()
With a dedicated boolean function  is_hyp_nvhe(). This will be needed
later in kexec in order to sooner switch back to EL2.
Suggested-by: James Morse <james.morse@arm.com>
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20210930143113.1502553-2-pasha.tatashin@soleen.com
Signed-off-by: Will Deacon <will@kernel.org>
 
                return cpus_have_final_cap(ARM64_KVM_PROTECTED_MODE);
 }
 
+static inline bool is_hyp_nvhe(void)
+{
+       return is_hyp_mode_available() && !is_kernel_in_hyp_mode();
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* ! __ASM__VIRT_H */
 
 {
        typeof(__cpu_soft_restart) *restart;
 
-       unsigned long el2_switch = !is_kernel_in_hyp_mode() &&
-               is_hyp_mode_available();
+       unsigned long el2_switch = is_hyp_nvhe();
        restart = (void *)__pa_symbol(function_nocfi(__cpu_soft_restart));
 
        cpu_install_idmap();
 
 extern int in_suspend;
 
 /* Do we need to reset el2? */
-#define el2_reset_needed() (is_hyp_mode_available() && !is_kernel_in_hyp_mode())
+#define el2_reset_needed() (is_hyp_nvhe())
 
 /* temporary el2 vectors in the __hibernate_exit_text section. */
 extern char hibernate_el2_vectors[];
 
         * dropped to EL1 because we don't support VHE, then we can't support
         * SDEI.
         */
-       if (is_hyp_mode_available() && !is_kernel_in_hyp_mode()) {
+       if (is_hyp_nvhe()) {
                pr_err("Not supported on this hardware/boot configuration\n");
                goto out_err;
        }