Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jun 2022 17:29:05 +0100
From:      Andrew Turner <andrew@FreeBSD.org>
To:        Souradeep Chakrabarti <schakrabarti@microsoft.com>
Cc:        "freebsd-arm@FreeBSD.org" <freebsd-arm@FreeBSD.org>, Wei Hu <weh@microsoft.com>
Subject:   Re: SMCCC v1.1 compliant HVC call
Message-ID:  <F752FD4D-66DA-4513-B493-3F2281FC3FA9@FreeBSD.org>
In-Reply-To: <PSAP153MB05364B5DEC6F1379B71C3758CCB99@PSAP153MB0536.APCP153.PROD.OUTLOOK.COM>
References:  <PSAP153MB05364B5DEC6F1379B71C3758CCB99@PSAP153MB0536.APCP153.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_5E6DBBF9-54AB-482F-A909-36108AC2442A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii



> On 27 Jun 2022, at 09:57, Souradeep Chakrabarti =
<schakrabarti@microsoft.com> wrote:
>=20
> Hi Andrew,
> =20
> 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?
> =20
> 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?
> =20
> 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=

--Apple-Mail=_5E6DBBF9-54AB-482F-A909-36108AC2442A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On 27 Jun 2022, at 09:57, Souradeep Chakrabarti &lt;<a =
href=3D"mailto:schakrabarti@microsoft.com" =
class=3D"">schakrabarti@microsoft.com</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><meta =
charset=3D"UTF-8" class=3D""><font face=3D"Calibri" size=3D"2" =
style=3D"caret-color: rgb(0, 0, 0); font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;" class=3D""><span style=3D"font-size: 11pt;" =
class=3D""><div class=3D"">Hi Andrew,</div><div =
class=3D"">&nbsp;</div><div class=3D"">In Linux we have SMCCC v1.1 =
compliant HVC call arm_smccc_1_1_hvc(), which is used for SMCCC and HVC =
call convention.</div><div class=3D"">In FreeBSD do we have something =
similar?</div><div class=3D"">&nbsp;</div><div class=3D"">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</div><div =
class=3D"">HVC call, what API should I use?</div><div =
class=3D"">&nbsp;</div><div class=3D"">Thanks &amp; Regards,</div><div =
class=3D"">Souradeep</div></span></font></div></blockquote></div><div =
class=3D""><br class=3D""></div>You can use&nbsp;arm_smccc_hvc to hard =
code the type. Both the hvc and smc versions are implemented =
in&nbsp;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.<div class=3D""><br class=3D""></div><div class=3D"">If your =
code is running after the psci device has attached you can =
use&nbsp;psci_callfn. It is a function pointer to either of =
the&nbsp;arm_smccc_* functions depending on what is in ACPI/FDT.<br =
class=3D""><div class=3D""><br class=3D""></div></div><div =
class=3D"">Andrew</div></body></html>=

--Apple-Mail=_5E6DBBF9-54AB-482F-A909-36108AC2442A--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F752FD4D-66DA-4513-B493-3F2281FC3FA9>