[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60e72d4e-6002-eaac-783f-20a2cbe6f9aa@redhat.com>
Date: Wed, 12 Jan 2022 10:58:34 +0800
From: Gavin Shan <gshan@...hat.com>
To: Eric Auger <eauger@...hat.com>, kvmarm@...ts.cs.columbia.edu
Cc: maz@...nel.org, linux-kernel@...r.kernel.org,
Jonathan.Cameron@...wei.com, pbonzini@...hat.com, will@...nel.org
Subject: Re: [PATCH v4 11/21] KVM: arm64: Support SDEI_PE_{MASK, UNMASK}
hypercall
Hi Eric,
On 11/10/21 4:31 AM, Eric Auger wrote:
> On 8/15/21 2:13 AM, Gavin Shan wrote:
>> This supports SDEI_PE_{MASK, UNMASK} hypercall. They are used by
>> the guest to stop the specific vCPU from receiving SDEI events.
>>
>> Signed-off-by: Gavin Shan <gshan@...hat.com>
>> ---
>> arch/arm64/kvm/sdei.c | 35 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 35 insertions(+)
>>
>> diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c
>> index 458695c2394f..3fb33258b494 100644
>> --- a/arch/arm64/kvm/sdei.c
>> +++ b/arch/arm64/kvm/sdei.c
>> @@ -551,6 +551,37 @@ static unsigned long kvm_sdei_hypercall_route(struct kvm_vcpu *vcpu)
>> return ret;
>> }
>>
>> +static unsigned long kvm_sdei_hypercall_mask(struct kvm_vcpu *vcpu,
>> + bool mask)
>> +{
>> + struct kvm *kvm = vcpu->kvm;
>> + struct kvm_sdei_kvm *ksdei = kvm->arch.sdei;
>> + struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei;
>> + unsigned long ret = SDEI_SUCCESS;
>> +
>> + /* Sanity check */
>> + if (!(ksdei && vsdei)) {
>> + ret = SDEI_NOT_SUPPORTED;
>> + goto out;
>> + }
>> +
>> + spin_lock(&vsdei->lock);
>> +
>> + /* Check the state */
>> + if (mask == vsdei->state.masked) {
>> + ret = SDEI_DENIED;
> are you sure? I don't this error documented in 5.1.12?
>
> Besides the spec says:
> "
> This call can be invoked by the client to mask the PE, whether or not
> the PE is already masked."
Yep, I think this check can safely dropped.
>> + goto unlock;
>> + }
>> +
>> + /* Update the state */
>> + vsdei->state.masked = mask ? 1 : 0;
>> +
>> +unlock:
>> + spin_unlock(&vsdei->lock);
>> +out:
>> + return ret;
> In case of success the returned value is SUCESS for UNMASK but not for
> MASK (see table in 5.1.12).
>
> By the way I have just noticed there is a more recent of the spec than
> the A:
>
> ARM_DEN0054C
>
> You should update the cover letter and [PATCH v4 02/21] KVM: arm64: Add
> SDEI virtualization infrastructure commit msg
>
Thanks, Eric. You've looked into newer version of spec. I will update
the code and link to the spec accordingly :)
>
>> +}
>> +
>> int kvm_sdei_hypercall(struct kvm_vcpu *vcpu)
>> {
>> u32 func = smccc_get_function(vcpu);
>> @@ -588,7 +619,11 @@ int kvm_sdei_hypercall(struct kvm_vcpu *vcpu)
>> ret = kvm_sdei_hypercall_route(vcpu);
>> break;
>> case SDEI_1_0_FN_SDEI_PE_MASK:
>> + ret = kvm_sdei_hypercall_mask(vcpu, true);
>> + break;
>> case SDEI_1_0_FN_SDEI_PE_UNMASK:
>> + ret = kvm_sdei_hypercall_mask(vcpu, false);
>> + break;
>> case SDEI_1_0_FN_SDEI_INTERRUPT_BIND:
>> case SDEI_1_0_FN_SDEI_INTERRUPT_RELEASE:
>> case SDEI_1_0_FN_SDEI_PRIVATE_RESET:
>>
Thanks,
Gavin
Powered by blists - more mailing lists