From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v3 20/24] xen/passthrough: Extend XEN_DOMCTL_assign_device to support DT device Date: Fri, 20 Feb 2015 17:17:23 +0000 Message-ID: <1424452643.30924.368.camel@citrix.com> References: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> <1421159133-31526-21-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YOrp8-000186-Kg for xen-devel@lists.xenproject.org; Fri, 20 Feb 2015 17:57:10 +0000 In-Reply-To: <1421159133-31526-21-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall , Daniel De Graaf Cc: Wei Liu , Ian Jackson , tim@xen.org, stefano.stabellini@citrix.com, Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Tue, 2015-01-13 at 14:25 +0000, Julien Grall wrote: > TODO: Update the commit message > > A device node is described by a path. It will be used to retrieved the > node in the device tree and assign the related device to the domain. > > Only device protected by an IOMMU can be assigned to a guest. > > Signed-off-by: Julien Grall > Cc: Ian Jackson > Cc: Wei Liu > Cc: Jan Beulich > > --- > Changes in v2: > - Use a different number for XEN_DOMCTL_assign_dt_device > --- > tools/libxc/include/xenctrl.h | 10 ++++ > tools/libxc/xc_domain.c | 95 ++++++++++++++++++++++++++++++++-- These bits all look fine. > +int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, > + XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) > +{ > + int ret; > + struct dt_device_node *dev; > + > + /* TODO: How to deal with XSM? */ Adding Daniel. It seems the PCI ones are protected by xsm_test_assign_device(XSM_HOOK, domctl->u.assign_device.machine_sbdf); So it seem that either this needs to become "test_assign_pci_device" and a similar "test_assign_dt_device" needs to be added and plumbed through or it needs to grow a type parameter and take the union for the identifier. The code to apply an XSM context to a DT node would need consideration too I suppose? > + /* TODO: Do we need to check is_dying? Mostly to protect against > + * hypercall trying to passthrough a device while we are > + * dying. FWIW the PCI case appears not to care... > + */ > + > + switch ( domctl->cmd ) > + { > + case XEN_DOMCTL_assign_device: > + ret = -ENOSYS; > + if ( domctl->u.assign_device.dev != XEN_DOMCTL_DEV_DT ) > + break; You added something similar to iommu_do_pci_domctl, would it not be preferable for the caller to switch on domctl->u.assign_device.dev and call the correct iommu_do_*_domctl? Ian.