lkml.org 
[lkml]   [2022]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v6 06/18] KVM: arm64: Support SDEI_EVENT_CONTEXT hypercall
    From
    Date
    Hi Oliver,

    On 4/30/22 11:03 PM, Oliver Upton wrote:
    > On Sun, Apr 03, 2022 at 11:38:59PM +0800, Gavin Shan wrote:
    >> This supports SDEI_EVENT_CONTEXT hypercall. It's used by the guest
    >> to retrieve the registers (x0 - x17) from the interrupted or preempted
    >> context in the event handler. The interrupted or preempted context
    >> is saved prior to handling the event by executing its handler and
    >> restored after that.
    >>
    >> Signed-off-by: Gavin Shan <gshan@redhat.com>
    >> ---
    >> arch/arm64/kvm/sdei.c | 34 ++++++++++++++++++++++++++++++++++
    >> 1 file changed, 34 insertions(+)
    >>
    >> diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c
    >> index 941263578b30..af5d11b8eb2f 100644
    >> --- a/arch/arm64/kvm/sdei.c
    >> +++ b/arch/arm64/kvm/sdei.c
    >> @@ -140,6 +140,37 @@ static unsigned long hypercall_enable(struct kvm_vcpu *vcpu, bool enable)
    >> return ret;
    >> }
    >>
    >> +static unsigned long hypercall_context(struct kvm_vcpu *vcpu)
    >> +{
    >> + struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei;
    >> + struct kvm_sdei_vcpu_context *context;
    >> + unsigned long param_id = smccc_get_arg(vcpu, 1);
    >> + unsigned long ret = SDEI_SUCCESS;
    >> +
    >> + spin_lock(&vsdei->lock);
    >> +
    >> + /* Check if we have events are being handled */
    >> + context = &vsdei->context[SDEI_EVENT_PRIORITY_CRITICAL];
    >> + context = context->event ? context : NULL;
    >> + context = context ? : &vsdei->context[SDEI_EVENT_PRIORITY_NORMAL];
    >> + context = context->event ? context : NULL;
    >> + if (!context) {
    >> + ret = SDEI_DENIED;
    >> + goto unlock;
    >> + }
    >
    > Eek! You'll probably be able to drop all of this and just check the SDEI
    > active flag.
    >

    Yep, the event's active state will be checked instead in next respin :)

    Thanks,
    Gavin


    \
     
     \ /
      Last update: 2022-05-02 04:58    [W:4.107 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site