Re: [PATCH v6 04/18] KVM: arm64: Support SDEI_EVENT_REGISTER hypercall

From: Gavin Shan
Date: Mon May 02 2022 - 03:28:54 EST


Hi Oliver,

On 5/2/22 11:43 AM, Oliver Upton wrote:
On Mon, May 02, 2022 at 10:55:51AM +0800, Gavin Shan wrote:
+ unsigned long route_mode = smccc_get_arg(vcpu, 4);

This is really 'flags'. route_mode is bit[0]. I imagine we don't want to
support relative mode, so bit[1] is useless for us in that case too.

The spec is somewhat imprecise on what happens for reserved flags. The
prototype in section 5.1.2 of [1] suggests that reserved bits must be
zero, but 5.1.2.3 'Client responsibilities' does not state that invalid
flags result in an error.

Arm TF certainly rejects unexpected flags [2].

[1]: DEN0054C https://developer.arm.com/documentation/den0054/latest
[2]: https://github.com/ARM-software/arm-trusted-firmware/blob/66c3906e4c32d675eb06bd081de8a3359f76b84c/services/std_svc/sdei/sdei_main.c#L260


Yes, This chunk of code is still stick to old specification. Lets
improve in next respin:

- Rename @route_mode to @flags
- Reject if the reserved bits are set.
- Reject if relative mode (bit#1) is selected.
- Reject if routing mode (bit#0) isn't RM_ANY (0).

Bit[0] is ignored for private events, actually. So we really just reject
if any of bit[63:1] are set.


It makes sense to me. Thanks for your confirm :)

Thanks,
Gavin