Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Initialization order bug causes `arm_smccc_hypervisor_has_uuid()` to incorrectly fall back to standard SMC during early boot in a CCA Realm. --
commit 8e27a5d40fac36e0edcb6814624362e892694ac4 Author: Kameron Carr <[email protected]> firmware: smccc: Detect hypervisor via RSI host call in CCA Realms This commit modifies arm_smccc_hypervisor_has_uuid() to check is_realm_world() and use an RSI host call to query the hypervisor UUID inside a Realm. It adds a file-static RSI host call buffer serialized by a spinlock for ARM64. > diff --git a/drivers/firmware/smccc/smccc.c b/drivers/firmware/smccc/smccc.c > index bdee057db2fd3..a876b7aa2dc99 100644 > --- a/drivers/firmware/smccc/smccc.c > +++ b/drivers/firmware/smccc/smccc.c [ ... ] > @@ -67,12 +73,45 @@ s32 arm_smccc_get_soc_id_revision(void) > } > EXPORT_SYMBOL_GPL(arm_smccc_get_soc_id_revision); > [ ... ] > bool arm_smccc_hypervisor_has_uuid(const uuid_t *hyp_uuid) > { > struct arm_smccc_res res = {}; > uuid_t uuid; > > - arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID, &res); > +#ifdef CONFIG_ARM64 > + if (is_realm_world()) > + arm_smccc_realm_get_hypervisor_uuid(&res); > + else > +#endif [Severity: Medium] Will this check evaluate to false during early boot, causing the detection to incorrectly fall back to the standard SMC conduit? Looking at setup_arch(), psci_dt_init() executes before arm64_rsi_init() is called to set up the rsi_present static key used by is_realm_world(): setup_arch() { ... if (acpi_disabled) psci_dt_init(); else psci_acpi_init(); arm64_rsi_init(); ... } Because psci_dt_init() calls psci_probe(), which calls kvm_init_hyp_services(), this eventually reaches arm_smccc_hypervisor_has_uuid() before the static key is initialized. Does this sequence cause a silent failure to detect the KVM hypervisor inside an Arm CCA Realm? > + arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID, > + &res); > + > if (res.a0 == SMCCC_RET_NOT_SUPPORTED) > return false; -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=2
