From: "Jan Beulich" Subject: Re: [v3][PATCH 04/16] xen/passthrough: extend hypercall to support rdm reservation policy Date: Wed, 17 Jun 2015 11:11:35 +0100 Message-ID: <558163F70200007800086058@mail.emea.novell.com> References: <1433985325-16676-1-git-send-email-tiejun.chen@intel.com> <1433985325-16676-5-git-send-email-tiejun.chen@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1433985325-16676-5-git-send-email-tiejun.chen@intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tiejun Chen Cc: yang.z.zhang@intel.com, andrew.cooper3@citrix.com, kevin.tian@intel.com, tim@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 11.06.15 at 03:15, wrote: > @@ -899,7 +899,7 @@ int set_mmio_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, > } > > int set_identity_p2m_entry(struct domain *d, unsigned long gfn, > - p2m_access_t p2ma) > + p2m_access_t p2ma, u32 flag) Please avoid using fixed width types unless really needed. Using uint32_t in the public interface is the right thing to do, but in all internal parts affected this can simply be (unsigned) int. > --- a/xen/drivers/passthrough/device_tree.c > +++ b/xen/drivers/passthrough/device_tree.c > @@ -52,7 +52,8 @@ int iommu_assign_dt_device(struct domain *d, struct dt_device_node *dev) > goto fail; > } > > - rc = hd->platform_ops->assign_device(d, 0, dt_to_dev(dev)); > + rc = hd->platform_ops->assign_device(d, 0, dt_to_dev(dev), > + XEN_DOMCTL_DEV_NO_RDM); > > if ( rc ) > goto fail; > @@ -148,6 +149,14 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d, > if ( domctl->u.assign_device.dev != XEN_DOMCTL_DEV_DT ) > break; > > + if ( domctl->u.assign_device.flag == XEN_DOMCTL_DEV_NO_RDM ) > + { > + printk(XENLOG_G_ERR "XEN_DOMCTL_assign_device: assign \"%s\"" > + " to dom%u failed (%d) since we don't support RDM.\n", > + dt_node_full_name(dev), d->domain_id, ret); > + break; > + } Isn't the condition inverted, i.e. don't you mean != there? > @@ -1577,9 +1578,10 @@ int iommu_do_pci_domctl( > seg = machine_sbdf >> 16; > bus = PCI_BUS(machine_sbdf); > devfn = PCI_DEVFN2(machine_sbdf); > + flag = domctl->u.assign_device.flag; > > ret = device_assigned(seg, bus, devfn) ?: > - assign_device(d, seg, bus, devfn); > + assign_device(d, seg, bus, devfn, flag); I think you should range check the flag passed to make future extensions possible (and to avoid ambiguity on what out of range values would mean). Jan