All of lore.kernel.org
 help / color / mirror / Atom feed
* Execute "SMC" instruction in Guest OS
@ 2021-09-25  6:45 Chenxu Wang
  2021-09-25 12:00 ` Marc Zyngier
  0 siblings, 1 reply; 2+ messages in thread
From: Chenxu Wang @ 2021-09-25  6:45 UTC (permalink / raw)
  To: kvmarm


[-- Attachment #1.1: Type: text/plain, Size: 557 bytes --]

Hi all,

I want the Guest OS to use the Arm-TF service in Host OS (It is the same as
using Trusted Application in OP-TEE). So I should provide some parameters
and call SMC instruction.

But it returns an "Undefined Instruction" in my Linux v4.9.51.
I find that KVM calls a " kvm_inject_undefined(vcpu);" when handling the
SMC instruction.

So, if I want the Guest OS to use the "Arm-TF service" or "TA", should I
simply change the kvm_inject_undefined() as "SMC #0", and carefully handle
the input parameters? What else should I do?

Sincerely,
Wang Chenxu

[-- Attachment #1.2: Type: text/html, Size: 751 bytes --]

[-- Attachment #2: Type: text/plain, Size: 151 bytes --]

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Execute "SMC" instruction in Guest OS
  2021-09-25  6:45 Execute "SMC" instruction in Guest OS Chenxu Wang
@ 2021-09-25 12:00 ` Marc Zyngier
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2021-09-25 12:00 UTC (permalink / raw)
  To: Chenxu Wang; +Cc: kvmarm

Hi Chenxu,

On 2021-09-25 07:45, Chenxu Wang wrote:
> Hi all,
> 
> I want the Guest OS to use the Arm-TF service in Host OS (It is the
> same as using Trusted Application in OP-TEE). So I should provide some
> parameters and call SMC instruction.

It is unlikely to work out of the box. For a start, the guest is a
different entity altogether, and it is unlikely that ATF can directly
deal with a request coming from the guest, specially if you are passing
any sort of memory reference.

> But it returns an "Undefined Instruction" in my Linux v4.9.51.
> I find that KVM calls a " kvm_inject_undefined(vcpu);" when handling
> the SMC instruction.

You should really get rid of this kernel and move to something more
recent. This UNDEF injection is a bug which has been fixed in more
recent versions of the kernel (by returning -1 instead).

> So, if I want the Guest OS to use the "Arm-TF service" or "TA", should
> I simply change the kvm_inject_undefined() as "SMC #0", and carefully
> handle the input parameters? What else should I do?

You should probably consider relaying the SMC to userspace, and then get
the VMM to do the talking with with the platform TEE driver.

         M.
-- 
Who you jivin' with that Cosmik Debris?
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-25 12:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25  6:45 Execute "SMC" instruction in Guest OS Chenxu Wang
2021-09-25 12:00 ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.