|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 06/10] ioreq: allow registering internal ioreq server handler
On 30.09.2019 15:32, Roger Pau Monne wrote:
> --- a/xen/arch/x86/hvm/ioreq.c
> +++ b/xen/arch/x86/hvm/ioreq.c
> @@ -485,6 +485,38 @@ static int hvm_add_ioreq_gfn(struct hvm_ioreq_server *s,
> bool buf)
> return rc;
> }
>
> +int hvm_set_ioreq_handler(struct domain *d, ioservid_t id,
> + int (*handler)(ioreq_t *, void *),
> + void *data)
> +{
> + struct hvm_ioreq_server *s;
> + int rc = 0;
> +
> + if ( !hvm_ioreq_is_internal(id) )
> + return -EINVAL;
Isn't BUG_ON() more applicable here?
> + spin_lock_recursive(&d->arch.hvm.ioreq_server.lock);
> + s = get_ioreq_server(d, id);
> + if ( !s )
> + {
> + rc = -ENOENT;
> + goto out;
> + }
> + if ( s->enabled )
> + {
> + rc = -EBUSY;
> + goto out;
> + }
> +
> + s->handler = handler;
> + s->data = data;
Is it really intended to blindly replace a disabled handler?
Wouldn't the s->enabled check better be evaluating s->handler?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |