qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 20/22] i386/xen: HVMOP_set_param / HVM_PARAM_CALLBACK_


From: David Woodhouse
Subject: Re: [RFC PATCH v2 20/22] i386/xen: HVMOP_set_param / HVM_PARAM_CALLBACK_IRQ
Date: Wed, 21 Dec 2022 01:41:26 +0000
User-agent: Evolution 3.44.4-0ubuntu1

On Mon, 2022-12-12 at 16:16 +0000, Paul Durrant wrote:
> 
> > @@ -287,24 +289,53 @@ static bool kvm_xen_hcall_memory_op(struct 
> > kvm_xen_exit *exit,
> >       return true;
> >   }
> >   
> > +static int handle_set_param(struct kvm_xen_exit *exit, X86CPU *cpu,
> > +                            uint64_t arg)
> > +{
> > +    CPUState *cs = CPU(cpu);
> > +    struct xen_hvm_param hp;
> > +    int err = 0;
> > +
> > +    if (kvm_copy_from_gva(cs, arg, &hp, sizeof(hp))) {
> > +        err = -EFAULT;
> > +        goto out;
> > +    }
> > +
> > +    if (hp.domid != DOMID_SELF) {
> 
> Xen actually allows the domain's own id to be specified as well as the 
> magic DOMID_SELF.
> 
> > +        err = -EINVAL;
> 
> And this should be -ESRCH.
> 

Oops, fixed that after posting v4 series. Fixed in:

https://git.infradead.org/users/dwmw2/qemu.git/shortlog/refs/heads/xenfv

I fixed the similar -EPERM in evtchn_status_op() too.

> > +        goto out;
> > +    }
> > +
> > +    switch (hp.index) {
> > +    case HVM_PARAM_CALLBACK_IRQ:
> > +        err = xen_evtchn_set_callback_param(hp.value);
> > +        break;
> > +    default:
> > +        return false;
> > +    }
> > +
> > +out:
> > +    exit->u.hcall.result = err;
> 
> This is a bit on the ugly side isn't it? Why not return the err and have 
> kvm_xen_hcall_hvm_op() deal with passing it back?

Because 'return false' means qemu will whine about it being
unimplemented.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]