qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for 2.8 06/11] intel_iommu: support device iotlb


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH for 2.8 06/11] intel_iommu: support device iotlb descriptor
Date: Wed, 31 Aug 2016 10:54:36 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0



On 2016年08月30日 21:16, Peter Xu wrote:
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

[...]

Yes, this looks better.


+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?

[...]

Good question, tough vhost does not care about those two fileds now (we only care about invalidation). But I think it's better to add them, it may be used in the future (e.g CM which may also depends on notifier).


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"?

Yes.

Nit 2: use Property bit (like vtd_properties)?

Not sure, I thought this may be reused by AMD IOMMU but maybe I was wrong.


Thanks,

-- peterx




reply via email to

[Prev in Thread] Current Thread [Next in Thread]