On Tue, Dec 10, 2024 at 09:24:03PM +0000, Marc Zyngier wrote: > > +static int a6xx_switch_secure_mode(struct msm_gpu *gpu) > > +{ > > + int ret; > > + > > +#ifdef CONFIG_ARM64 > > + /* > > + * We can access SECVID_TRUST_CNTL register when kernel is booted in EL2 mode. So, use it > > + * to switch the secure mode to avoid the dependency on zap shader. > > + */ > > + if (is_kernel_in_hyp_mode()) > > + goto direct_switch; > > No, please. To check whether you are *booted* at EL2, you need to > check for is_hyp_available(). Whether the kernel runs at EL1 or EL2 is > none of the driver's business, really. This is still absolutely > disgusting from an abstraction perspective, but I guess we don't have > much choice here. > Thanks Marc. Any suggestions on how we can make is_hyp_mode_available() available for modules? Do you prefer exporting kvm_protected_mode_initialized and __boot_cpu_mode symbols directly or try something like [1]? [1] https://lore.kernel.org/lkml/1443649252-10702-1-git-send-email-ralf@xxxxxxxxxxxxxxxxxxxxxx/#t Thanks, Pavan