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: Peter Xu
Subject: Re: [Qemu-devel] [PATCH for 2.8 06/11] intel_iommu: support device iotlb descriptor
Date: Tue, 30 Aug 2016 21:16:11 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

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



reply via email to

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