Re: SMCCC v1.1 compliant HVC call

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 27 Jun 2022 16:29:05 UTC

> On 27 Jun 2022, at 09:57, Souradeep Chakrabarti <schakrabarti@microsoft.com> wrote:
> 
> Hi Andrew,
>  
> In Linux we have SMCCC v1.1 compliant HVC call arm_smccc_1_1_hvc(), which is used for SMCCC and HVC call convention.
> In FreeBSD do we have something similar?
>  
> I can arm_smccc_smc() in sys/dev/psci/smccc.h, but could not find the implementation details of it. If I need to use SMCCC compliant
> HVC call, what API should I use?
>  
> Thanks & Regards,
> Souradeep


You can use arm_smccc_hvc to hard code the type. Both the hvc and smc versions are implemented in sys/dev/psci/smccc_arm64.S. They depend on the arm64 ABI to put the arguments into the correct registers to be passed into the hypervisor.

If your code is running after the psci device has attached you can use psci_callfn. It is a function pointer to either of the arm_smccc_* functions depending on what is in ACPI/FDT.

Andrew