qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Failed to execute "SMC" call on Guest OS.


From: Chenxu Wang
Subject: Re: Failed to execute "SMC" call on Guest OS.
Date: Thu, 23 Sep 2021 19:08:53 +0800

Hi all,

In my FVP, I want to write a Trusted Application (TA) and want my Guest OS to call the application. Therefore, I require Guest OS to use "SMC" instruction.

So if I want to provide a TA interface to Guest OS, what should I do?  Must I modify KVM, or QEMU, or both?

Sincerely
Wang Chenxu

PS: I Still do not know how to reply to the thread in the mailing list, maybe cc the mailing list is OK?


Peter Maydell <peter.maydell@linaro.org> 于2021年9月23日周四 下午5:16写道:
On Thu, 23 Sept 2021 at 08:38, Chenxu Wang <irakatz51@gmail.com> wrote:
>
> Hi all,
>
> In the Host OS, I make a smc call and get the correct return.
> Also, the Host OS enables KVM support. (specifically, it supports VHE, so Host is running on EL2)
>
> Then I run a qemu-system-aarch64 to run a guest OS, with KVM support. Here I use a QEMU v2.9. I pre-load a helloworld module in the ramdisk.img, in the module it contains a SMC call.
>
> My booting instructions are listed below.
>
> ./qemu-system-aarch64 -nographic -kernel Image -initrd ramdisk.img -m 512 -machine virt,accel=kvm -cpu host -append "console=ttyAMA0 init=/liunxrc root=/dev/ram0 rw rootfstype=ext4"
>
> Then I execute the module, it says
>
> insmod[1086]: undefined instruction: pc=ffff0000008b5060
> Code: 95e2c44a 580002e0 95e2c448 18000360 (d4000003)

This happens because your guest is making an SMC call, which
it should not be doing. Inside the VM, your guest is running
on the "virt" board. The DTB tells the guest that it should
use the HVC call to make PSCI calls. There is nothing that tells
the guest that SMC will do anything sensible.

I don't know what your guest code expects the SMC to do, but
QEMU and KVM are unlikely to be able to provide it. (The behaviour
of KVM has changed in this area for different host kernel versions:
older kernels made the SMC UNDEF; newer ones make it set X0 to -1
and advance the PC past the SMC. TCG QEMU currently still UNDEFs.)

thanks
-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]