Received: from eggs.gnu.org ([2001:4830:134:3::10]:58715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beitr-0006el-P1 for qemu-devel@nongnu.org; Tue, 30 Aug 2016 09:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1beitm-0002hT-5a for qemu-devel@nongnu.org; Tue, 30 Aug 2016 09:16:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beitl-0002hL-W8 for qemu-devel@nongnu.org; Tue, 30 Aug 2016 09:16:18 -0400 Date: Tue, 30 Aug 2016 21:16:11 +0800 From: Peter Xu Message-ID: <20160830131611.GB13644@pxdev.xzpeter.org> References: <1472526419-5900-1-git-send-email-jasowang@redhat.com> <1472526419-5900-7-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1472526419-5900-7-git-send-email-jasowang@redhat.com> Subject: Re: [Qemu-devel] [PATCH for 2.8 06/11] intel_iommu: support device iotlb descriptor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: mst@redhat.com, qemu-devel@nongnu.org, pbonzini@redhat.com, cornelia.huck@de.ibm.com, wexu@redhat.com, vkaplans@redhat.com, Richard Henderson , Eduardo Habkost On Tue, Aug 30, 2016 at 11:06:54AM +0800, Jason Wang wrote: > This patch enables device IOTLB support for intel iommu. The major > work is to implement QI device IOTLB descriptor processing and notify > the device through iommu notifier. IMHO it'll be nicer if we can mention the new bit in the commit message, like: One new property "device-iotlb" is introduced to enable device IOTLB capability for VT-d IOMMU device. By default, it is turned off. To enable it: -device intel-iommu,device-iotlb=on [...] > +static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s, > + VTDInvDesc *inv_desc) > +{ [...] > + entry.target_as = &vtd_dev_as->as; > + entry.addr_mask = sz - 1; > + entry.iova = addr; Do we need to setup translated_addr and perm fields as well? [...] > diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c > index ce26b2a..a70a363 100644 > --- a/hw/i386/x86-iommu.c > +++ b/hw/i386/x86-iommu.c > @@ -100,6 +100,18 @@ static void x86_iommu_intremap_prop_set(Object *o, bool value, Error **errp) > s->intr_supported = value; > } > > +static bool x86_iommu_device_iotlb_prop_get(Object *o, Error **errp) > +{ > + X86IOMMUState *s = X86_IOMMU_DEVICE(o); > + return s->dt_supported; > +} > + > +static void x86_iommu_device_iotlb_prop_set(Object *o, bool value, Error **errp) > +{ > + X86IOMMUState *s = X86_IOMMU_DEVICE(o); > + s->dt_supported = value; > +} > + > static void x86_iommu_instance_init(Object *o) > { > X86IOMMUState *s = X86_IOMMU_DEVICE(o); > @@ -108,6 +120,11 @@ static void x86_iommu_instance_init(Object *o) > s->intr_supported = false; > object_property_add_bool(o, "intremap", x86_iommu_intremap_prop_get, > x86_iommu_intremap_prop_set, NULL); > + s->dt_supported = false; > + object_property_add_bool(o, "device_iotlb", > + x86_iommu_device_iotlb_prop_get, > + x86_iommu_device_iotlb_prop_set, > + NULL); Nit 1: use "device-iotlb" instead of "device_iotlb"? Nit 2: use Property bit (like vtd_properties)? Thanks, -- peterx