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

Re: [Xen-devel] [PATCH v4 12/12] x86/hvm/ioreq: add a new mappable resource type...



On Tue, Sep 05, 2017 at 12:37:16PM +0100, Paul Durrant wrote:
>  
> +mfn_t hvm_get_ioreq_server_frame(struct domain *d, ioservid_t id,
> +                                 unsigned int idx)
> +{
> +    struct hvm_ioreq_server *s;
> +    mfn_t mfn = INVALID_MFN;
> +
> +    spin_lock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
> +
> +    s = d->arch.hvm_domain.ioreq_server.server[id];
> +

Check id < MAX_NR_IOREQ_SERVERS before getting s?

> +    if ( id >= MAX_NR_IOREQ_SERVERS || !s || IS_DEFAULT(s) )
> +        goto out;
> +
> +    if ( hvm_ioreq_server_alloc_pages(s) )
> +        goto out;
> +
> +    if ( idx == 0 )
> +        mfn = _mfn(page_to_mfn(s->bufioreq.page));
> +    else if ( idx == 1 )
> +        mfn = _mfn(page_to_mfn(s->ioreq.page));

Does the caller care about the order? If so this should be documented?

The rest looks sensible but I haven't reviewed in detail.

> +
> + out:
> +    spin_unlock_recursive(&d->arch.hvm_domain.ioreq_server.lock);
> +
> +    return mfn;
> +}
> +

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.