2022-04-04 22:01:04

by Gavin Shan

[permalink] [raw]
Subject: [PATCH v6 15/18] KVM: arm64: Support SDEI_FEATURES hypercall

This supports SDEI_FEATURES hypercall. It's used by guest to
retrieve the supported features, which are number of slots for
the interrupt binding events and relative mode for the event
handler. Currently, none of them is supported.

Signed-off-by: Gavin Shan <[email protected]>
---
arch/arm64/kvm/sdei.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c
index e1f6ab9800ee..ab0b7b5e3191 100644
--- a/arch/arm64/kvm/sdei.c
+++ b/arch/arm64/kvm/sdei.c
@@ -527,6 +527,23 @@ static unsigned long hypercall_reset(struct kvm_vcpu *vcpu, bool private)
return ret;
}

+static unsigned long hypercall_features(struct kvm_vcpu *vcpu)
+{
+ unsigned long feature = smccc_get_arg(vcpu, 1);
+ unsigned long ret;
+
+ switch (feature) {
+ case 0: /* BIND_SLOTS */
+ case 1: /* RELATIVE_MODE */
+ ret = 0;
+ break;
+ default:
+ ret = SDEI_INVALID_PARAMETERS;
+ }
+
+ return ret;
+}
+
int kvm_sdei_call(struct kvm_vcpu *vcpu)
{
struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei;
@@ -590,6 +607,9 @@ int kvm_sdei_call(struct kvm_vcpu *vcpu)
case SDEI_1_0_FN_SDEI_SHARED_RESET:
ret = hypercall_reset(vcpu, false);
break;
+ case SDEI_1_1_FN_SDEI_FEATURES:
+ ret = hypercall_features(vcpu);
+ break;
default:
ret = SDEI_NOT_SUPPORTED;
}
--
2.23.0


2022-05-01 17:10:58

by Oliver Upton

[permalink] [raw]
Subject: Re: [PATCH v6 15/18] KVM: arm64: Support SDEI_FEATURES hypercall

On Sun, Apr 03, 2022 at 11:39:08PM +0800, Gavin Shan wrote:
> This supports SDEI_FEATURES hypercall. It's used by guest to
> retrieve the supported features, which are number of slots for
> the interrupt binding events and relative mode for the event
> handler. Currently, none of them is supported.
>
> Signed-off-by: Gavin Shan <[email protected]>
> ---
> arch/arm64/kvm/sdei.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c
> index e1f6ab9800ee..ab0b7b5e3191 100644
> --- a/arch/arm64/kvm/sdei.c
> +++ b/arch/arm64/kvm/sdei.c
> @@ -527,6 +527,23 @@ static unsigned long hypercall_reset(struct kvm_vcpu *vcpu, bool private)
> return ret;
> }
>
> +static unsigned long hypercall_features(struct kvm_vcpu *vcpu)
> +{
> + unsigned long feature = smccc_get_arg(vcpu, 1);
> + unsigned long ret;
> +
> + switch (feature) {
> + case 0: /* BIND_SLOTS */
> + case 1: /* RELATIVE_MODE */

Can you create macros for these?

--
Thanks,
Oliver

2022-05-02 14:07:28

by Gavin Shan

[permalink] [raw]
Subject: Re: [PATCH v6 15/18] KVM: arm64: Support SDEI_FEATURES hypercall

Hi Oliver,

On 5/1/22 2:55 PM, Oliver Upton wrote:
> On Sun, Apr 03, 2022 at 11:39:08PM +0800, Gavin Shan wrote:
>> This supports SDEI_FEATURES hypercall. It's used by guest to
>> retrieve the supported features, which are number of slots for
>> the interrupt binding events and relative mode for the event
>> handler. Currently, none of them is supported.
>>
>> Signed-off-by: Gavin Shan <[email protected]>
>> ---
>> arch/arm64/kvm/sdei.c | 20 ++++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>>
>> diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c
>> index e1f6ab9800ee..ab0b7b5e3191 100644
>> --- a/arch/arm64/kvm/sdei.c
>> +++ b/arch/arm64/kvm/sdei.c
>> @@ -527,6 +527,23 @@ static unsigned long hypercall_reset(struct kvm_vcpu *vcpu, bool private)
>> return ret;
>> }
>>
>> +static unsigned long hypercall_features(struct kvm_vcpu *vcpu)
>> +{
>> + unsigned long feature = smccc_get_arg(vcpu, 1);
>> + unsigned long ret;
>> +
>> + switch (feature) {
>> + case 0: /* BIND_SLOTS */
>> + case 1: /* RELATIVE_MODE */
>
> Can you create macros for these?
>

Surely I will do. Thanks for your review and comments :)

Thanks,
Gavin