On 9.12.2024 9:19 AM, Akhil P Oommen wrote: > When kernel is booted in EL2, SECVID registers are accessible to the > KMD. So we can use that to switch GPU's secure mode to avoid dependency > on Zap firmware. Also, we can't load a secure firmware without a > hypervisor that supports it. > > Tested following configurations on sa8775p chipset (Adreno 663 gpu): > > 1. Gunyah (No KVM) - Loads zap shader based on DT > 2. KVM in VHE - Skips zap shader load and programs SECVID register > 3. KVM in nVHE - Loads zap shader based on DT > 4. Kernel in EL2 with CONFIG_KVM=n - Skips zap shader load and > programs SECVID register > > For (1) and (3) configuration, this patch doesn't have any impact. > Driver loads secure firmware based on other existing hints. > > Signed-off-by: Akhil P Oommen <quic_akhilpo@xxxxxxxxxxx> > --- [...] > + > +#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; So I suppose this would ideally be like hv_is_hyperv_initialized() but for QHEE/Gunyah, which is not going to happen, as we have millions of devices with old unupstreamable-ABI-Gunyah running.. This looks like the next best things then, so no objections, but.. [...] > + ret = a6xx_switch_secure_mode(gpu); > + if (!ret) this should definitely be a if (ret) Konrad