Re: Linux fails on startup looking for SMC

Moshe Kravchik <[email protected]> Tue, 29 Apr 2025 05:50:37 +0000
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <DB3PR08MB87962F7F37ADA6F2AF2A892EA5802@DB3PR08MB8796.eurprd08.prod.outlook.com>
--===============4351293641457440007==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_DB3PR08MB87962F7F37ADA6F2AF2A892EA5802DB3PR08MB8796eurp_"

--_000_DB3PR08MB87962F7F37ADA6F2AF2A892EA5802DB3PR08MB8796eurp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

OK, that's great, I just commented out the range check in `fiasco/src/kern/=
arm/smc_user.cpp`, but even though I see the calls get through, they still =
return -1.
Should I load ATF or some other code first so that someone will respond to =
these SMC calls?
________________________________
From: Adam Lackorzynski <[email protected]>
Sent: Tuesday, April 29, 2025 12:04 AM
To: Moshe Kravchik <[email protected]>; [email protected]=
 <[email protected]>
Subject: Re: Linux fails on startup looking for SMC

Hi,

Could you tune ARM_SMC_USER_MIN/ARM_SMC_USER_MAX in the kernel? Seems
the SMC functions asked are 0x8200ff03U and 0xC2000xxx and that's not
covered by the default range, so increasing ARM_SMC_USER_MAX to
0xcfffffff or so.


Adam

On Mon Apr 28, 2025 at 15:00:04 +0000, Moshe Kravchik wrote:
> Thank you!
> This configuration indeed resulted in the capability present.
> However, I still get the error:
> `zynqmp_firmware firmware:zynqmp-firmware: probe with driver zynqmp_firmw=
are failed with error -22` and when I add prints I see that the SMC calls i=
n the Linux kernel return -1.
> Anything else I need to add to the device tree to initialize it or someth=
ing?
> When I boot into Ubuntu without L4 it works.
> Moshe
> ________________________________
> From: Adam Lackorzynski <[email protected]>
> Sent: Monday, April 28, 2025 2:53 PM
> To: Moshe Kravchik <[email protected]>; [email protected].=
de <[email protected]>
> Subject: Re: Linux fails on startup looking for SMC
>
>
> On Mon Apr 28, 2025 at 05:25:34 +0000, Moshe Kravchik wrote:
> > Thanks a lot, Adam!
> > I added both and rebuilt the device tree, but now I'm getting:
> > ```
> > vm-1    | VMM[smccc_proxy]: smccc_proxy
> > vm-1    | VMM: smccc_proxy.l4vmm,smccc_cap: capability smc is invalid.
> > vm-1    | VMM[vm]: Device creation for virtual device smccc_proxy faile=
d. Disabling device.
> > ```
>
> This tells that the 'smc' cap is not there in uvmm. Is it there in the
> 'caps' table with which uvmm is started? There, where "ram =3D ..." is
> as well: caps =3D { ram =3D ...., smc =3D L4.Env.arm_smc, }, ....
> Additionally, in the microkernel, the CONFIG_ARM_SMC_USER option must
> also be enabled.
>
>
> Adam
>
> > Moshe
> > ________________________________
> > From: Adam Lackorzynski <[email protected]>
> > Sent: Monday, April 28, 2025 12:07 AM
> > To: Moshe Kravchik <[email protected]>; [email protected]=
n.de <[email protected]>
> > Subject: Re: Linux fails on startup looking for SMC
> >
> > Hi Moshe,
> >
> > On Sun Apr 27, 2025 at 15:32:53 +0000, Moshe Kravchik wrote:
> > > Hi,
> > > I'm trying to set up a Linux running on uvmm with a HW passthrough.
> > > I added `zynqmp_firmware` to my DTS (it was required for the device I=
'm trying to pass).
> > > However, Linux fails to add the device and I see:
> > > vm-1 | [ 1.772078] ledtrig-cpu: registered to indicate activity on CP=
Us
> > > vm-1 | VMM[guest]: No handler for SMC call: imm=3D0 a0=3Dc200003f a1=
=3D3f ip=3Dffff800080026884 lr=3Dffff800080dcdb04
> > > vm-1 | VMM[guest]: No handler for SMC call: imm=3D0 a0=3Dc2000001 a1=
=3D0 ip=3Dffff800080026884 lr=3Dffff800080dcdb04
> > > vm-1 | [ 1.805957] zynqmp_firmware firmware:zynqmp-firmware: probe wi=
th driver zynqmp_firmware failed with error -22
> > >
> > > >From the traces I added, the failure is in `zynqmp_pm_get_api_versio=
n`.
> > >
> > > How do I add SMC handling?
> >
> > You give uvmm in the Ned script: smc =3D L4.Env.arm_smc
> >
> > And put this into you device tree:
> >    smccc_proxy {
> >        compatible =3D "l4vmm,smccc_proxy";
> >        l4vmm,smccc_cap =3D "smc";
> >        method =3D "smc";
> >    };
> >
> > Note that L4.Env.arm_smc gives access to the real interface with all th=
e
> > power that is behind it (the kernel only filters its range). So in a
> > longer run it might be necessary to have proxy for this interface, or
> > emulate the SMCs, or modify Linux to not use it, whatever fits best.
> >
> >
> >
> > Adam

Adam
--
Adam                 [email protected]
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

--_000_DB3PR08MB87962F7F37ADA6F2AF2A892EA5802DB3PR08MB8796eurp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div class=3D"elementToProof" style=3D"font-family: Calibri, Helvetica, san=
s-serif; font-size: 12pt; color: rgb(0, 0, 0);">
OK, that's great, I just commented out the range check in `fiasco/src/kern/=
arm/smc_user.cpp`, but even though I see the calls get through, they still =
return -1.<br>
Should I load ATF or some other code first so that someone will respond to =
these SMC calls?</div>
<div id=3D"appendonsend"></div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> Adam Lackorzynski &lt=
;[email protected]&gt;<br>
<b>Sent:</b> Tuesday, April 29, 2025 12:04 AM<br>
<b>To:</b> Moshe Kravchik &lt;[email protected]&gt;; [email protected].=
tu-dresden.de &lt;[email protected]&gt;<br>
<b>Subject:</b> Re: Linux fails on startup looking for SMC</font>
<div>&nbsp;</div>
</div>
<div class=3D"BodyFragment"><font size=3D"2"><span style=3D"font-size:11pt;=
">
<div class=3D"PlainText">Hi,<br>
<br>
Could you tune ARM_SMC_USER_MIN/ARM_SMC_USER_MAX in the kernel? Seems<br>
the SMC functions asked are 0x8200ff03U and 0xC2000xxx and that's not<br>
covered by the default range, so increasing ARM_SMC_USER_MAX to<br>
0xcfffffff or so.<br>
<br>
<br>
Adam<br>
<br>
On Mon Apr 28, 2025 at 15:00:04 +0000, Moshe Kravchik wrote:<br>
&gt; Thank you!<br>
&gt; This configuration indeed resulted in the capability present.<br>
&gt; However, I still get the error:<br>
&gt; `zynqmp_firmware firmware:zynqmp-firmware: probe with driver zynqmp_fi=
rmware failed with error -22` and when I add prints I see that the SMC call=
s in the Linux kernel return -1.<br>
&gt; Anything else I need to add to the device tree to initialize it or som=
ething?<br>
&gt; When I boot into Ubuntu without L4 it works.<br>
&gt; Moshe<br>
&gt; ________________________________<br>
&gt; From: Adam Lackorzynski &lt;[email protected]&gt;<br>
&gt; Sent: Monday, April 28, 2025 2:53 PM<br>
&gt; To: Moshe Kravchik &lt;[email protected]&gt;; [email protected]=
-dresden.de &lt;[email protected]&gt;<br>
&gt; Subject: Re: Linux fails on startup looking for SMC<br>
&gt; <br>
&gt; <br>
&gt; On Mon Apr 28, 2025 at 05:25:34 +0000, Moshe Kravchik wrote:<br>
&gt; &gt; Thanks a lot, Adam!<br>
&gt; &gt; I added both and rebuilt the device tree, but now I'm getting:<br=
>
&gt; &gt; ```<br>
&gt; &gt; vm-1&nbsp;&nbsp;&nbsp; | VMM[smccc_proxy]: smccc_proxy<br>
&gt; &gt; vm-1&nbsp;&nbsp;&nbsp; | VMM: smccc_proxy.l4vmm,smccc_cap: capabi=
lity smc is invalid.<br>
&gt; &gt; vm-1&nbsp;&nbsp;&nbsp; | VMM[vm]: Device creation for virtual dev=
ice smccc_proxy failed. Disabling device.<br>
&gt; &gt; ```<br>
&gt; <br>
&gt; This tells that the 'smc' cap is not there in uvmm. Is it there in the=
<br>
&gt; 'caps' table with which uvmm is started? There, where &quot;ram =3D ..=
.&quot; is<br>
&gt; as well: caps =3D { ram =3D ...., smc =3D L4.Env.arm_smc, }, ....<br>
&gt; Additionally, in the microkernel, the CONFIG_ARM_SMC_USER option must<=
br>
&gt; also be enabled.<br>
&gt; <br>
&gt; <br>
&gt; Adam<br>
&gt; <br>
&gt; &gt; Moshe<br>
&gt; &gt; ________________________________<br>
&gt; &gt; From: Adam Lackorzynski &lt;[email protected]&gt;<br>
&gt; &gt; Sent: Monday, April 28, 2025 12:07 AM<br>
&gt; &gt; To: Moshe Kravchik &lt;[email protected]&gt;; [email protected]=
nf.tu-dresden.de &lt;[email protected]&gt;<br>
&gt; &gt; Subject: Re: Linux fails on startup looking for SMC<br>
&gt; &gt;<br>
&gt; &gt; Hi Moshe,<br>
&gt; &gt;<br>
&gt; &gt; On Sun Apr 27, 2025 at 15:32:53 +0000, Moshe Kravchik wrote:<br>
&gt; &gt; &gt; Hi,<br>
&gt; &gt; &gt; I'm trying to set up a Linux running on uvmm with a HW passt=
hrough.<br>
&gt; &gt; &gt; I added `zynqmp_firmware` to my DTS (it was required for the=
 device I'm trying to pass).<br>
&gt; &gt; &gt; However, Linux fails to add the device and I see:<br>
&gt; &gt; &gt; vm-1 | [ 1.772078] ledtrig-cpu: registered to indicate activ=
ity on CPUs<br>
&gt; &gt; &gt; vm-1 | VMM[guest]: No handler for SMC call: imm=3D0 a0=3Dc20=
0003f a1=3D3f ip=3Dffff800080026884 lr=3Dffff800080dcdb04<br>
&gt; &gt; &gt; vm-1 | VMM[guest]: No handler for SMC call: imm=3D0 a0=3Dc20=
00001 a1=3D0 ip=3Dffff800080026884 lr=3Dffff800080dcdb04<br>
&gt; &gt; &gt; vm-1 | [ 1.805957] zynqmp_firmware firmware:zynqmp-firmware:=
 probe with driver zynqmp_firmware failed with error -22<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;From the traces I added, the failure is in `zynqmp_pm_ge=
t_api_version`.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; How do I add SMC handling?<br>
&gt; &gt;<br>
&gt; &gt; You give uvmm in the Ned script: smc =3D L4.Env.arm_smc<br>
&gt; &gt;<br>
&gt; &gt; And put this into you device tree:<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; smccc_proxy {<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; compatible =3D &quot;l4=
vmm,smccc_proxy&quot;;<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l4vmm,smccc_cap =3D &qu=
ot;smc&quot;;<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; method =3D &quot;smc&qu=
ot;;<br>
&gt; &gt;&nbsp;&nbsp;&nbsp; };<br>
&gt; &gt;<br>
&gt; &gt; Note that L4.Env.arm_smc gives access to the real interface with =
all the<br>
&gt; &gt; power that is behind it (the kernel only filters its range). So i=
n a<br>
&gt; &gt; longer run it might be necessary to have proxy for this interface=
, or<br>
&gt; &gt; emulate the SMCs, or modify Linux to not use it, whatever fits be=
st.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Adam<br>
<br>
Adam<br>
-- <br>
Adam&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; [email protected]<br>
&nbsp; Lackorzynski&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=
=3D"http://os.inf.tu-dresden.de/~adam/">http://os.inf.tu-dresden.de/~adam/<=
/a><br>
</div>
</span></font></div>
</body>
</html>

--_000_DB3PR08MB87962F7F37ADA6F2AF2A892EA5802DB3PR08MB8796eurp_--

--===============4351293641457440007==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
l4-hackers mailing list -- [email protected]
To unsubscribe send an email to [email protected]

--===============4351293641457440007==--