Re: [EXTERNAL] Re: SMCCC v1.1 compliant HVC call

From: Souradeep Chakrabarti <schakrabarti_at_microsoft.com>
Date: Wed, 29 Jun 2022 16:47:13 UTC
Hi Andrew,

It will be really helpful if arm smccc hvc 1.2 version is implemented in FreeBSD. It is required for Hyper-V HvCallGetVpRegisters hypercall. Please let me know if there is any plan to implement smccc 1.2 version anytime soon or not.

Thanks & Regards,
 Souradeep

________________________________________
From: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sent: Tuesday, June 28, 2022 11:36 AM
To: Andrew Turner
Cc: freebsd-arm@FreeBSD.org; Wei Hu
Subject: Re: [EXTERNAL] Re: SMCCC v1.1 compliant HVC call


Hi Andrew,

Thanks for your response. While looking into the code, it looked to me we have smccc version till 1.1 implemented.
But for hyper-v hypercall implementation we need to read registers beyond X0 to X3, which is implemented in 1.2 version.

Is there any plan on version 1.2 implementation ?

Thanks & Regards,
 Souradeep



From: Andrew Turner <andrew@FreeBSD.org>
Sent: Monday, June 27, 2022 9:59 PM
To: Souradeep Chakrabarti <schakrabarti@microsoft.com>
Cc: freebsd-arm@FreeBSD.org <freebsd-arm@FreeBSD.org>; Wei Hu <weh@microsoft.com>
Subject: [EXTERNAL] Re: SMCCC v1.1 compliant HVC call



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