lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 Jan 2022 19:31:39 +0100
From:   Eric Auger <eauger@...hat.com>
To:     Gavin Shan <gshan@...hat.com>,
        Shannon Zhao <shannon.zhaosl@...il.com>,
        kvmarm@...ts.cs.columbia.edu
Cc:     maz@...nel.org, pbonzini@...hat.com, will@...nel.org,
        linux-kernel@...r.kernel.org, Jonathan.Cameron@...wei.com
Subject: Re: [PATCH v4 06/21] KVM: arm64: Support SDEI_EVENT_CONTEXT hypercall

Hi Gavin,

On 1/13/22 8:02 AM, Gavin Shan wrote:
> Hi Shannon,
> 
> On 1/11/22 5:43 PM, Shannon Zhao wrote:
>> On 2021/8/15 8:13, Gavin Shan wrote:
>>> +static unsigned long kvm_sdei_hypercall_context(struct kvm_vcpu *vcpu)
>>> +{
>>> +    struct kvm *kvm = vcpu->kvm;
>>> +    struct kvm_sdei_kvm *ksdei = kvm->arch.sdei;
>>> +    struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei;
>>> +    struct kvm_sdei_vcpu_regs *regs;
>>> +    unsigned long index = smccc_get_arg1(vcpu);
>>> +    unsigned long ret = SDEI_SUCCESS;
>>> +
>>> +    /* Sanity check */
>>> +    if (!(ksdei && vsdei)) {
>>> +        ret = SDEI_NOT_SUPPORTED;
>>> +        goto out;
>>> +    }
>> Maybe we could move these common sanity check codes to
>> kvm_sdei_hypercall to save some lines.
>>
> 
> Not all hypercalls need this check. For example,
> COMPLETE/COMPLETE_RESUME/CONTEXT don't
> have SDEI event number as the argument. If we really want move this
> check into function
> kvm_sdei_hypercall(), we would have code like below. Too much duplicated
> snippets will
> be seen. I don't think it's better than what we have if I fully
> understand your comments.
> 
>       switch (...) {
>       case REGISTER:
>            if (!(ksdei && vsdei)) {
>                ret = SDEI_NOT_SUPPORTED;
>                break;
>            }
at least you can use an inline function taking the vcpu as param?

Thanks

Eric
> 
>            ret = kvm_sdei_hypercall_register(vcpu);
>            break;
>       case UNREGISTER:
>            if (!(ksdei && vsdei)) {
>                ret = SDEI_NOT_SUPPORTED;
>                break;
>            }
> 
>            ret = kvm_sdei_hypercall_unregister(vcpu);
>            break;
>      case CONTEXT:
>            ret = kvm_sdei_hypercall_context(vcpu);
>            break;
>        :
>     }
> 
> Thanks,
> Gavin
> 
> _______________________________________________
> kvmarm mailing list
> kvmarm@...ts.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ