qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org, mst@redhat.com, pbonzini@redhat.com,
	cornelia.huck@de.ibm.com, wexu@redhat.com, vkaplans@redhat.com,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH V3 05/10] intel_iommu: support device iotlb descriptor
Date: Mon, 7 Nov 2016 18:35:49 -0500	[thread overview]
Message-ID: <20161107233549.GA2793@pxdev.xzpeter.org> (raw)
In-Reply-To: <1478502595-8484-6-git-send-email-jasowang@redhat.com>

On Mon, Nov 07, 2016 at 03:09:50PM +0800, Jason Wang wrote:

[...]

> +static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s,
> +                                          VTDInvDesc *inv_desc)
> +{
> +    VTDAddressSpace *vtd_dev_as;
> +    IOMMUTLBEntry entry;

Since "entry" is allocated on the stack...

[...]

> +    entry.target_as = &vtd_dev_as->as;
> +    entry.addr_mask = sz - 1;
> +    entry.iova = addr;
> +    memory_region_notify_iommu(entry.target_as->root, entry);

... here we need to assign entry.perm explicitly to IOMMU_NONE, right?

Also I think it'll be nice that we set all the fields even not used,
to avoid rubbish from the stack passed down to notifier handlers.

[...]

> +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);
> @@ -114,6 +126,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);

Again, a nit-pick here is to use Property for "device-iotlb":

    static Property vtd_properties[] = {
        DEFINE_PROP_UINT32("device-iotlb", X86IOMMUState, dt_supported, false),
        DEFINE_PROP_END_OF_LIST(),
    };

However not worth a repost.

Thanks,

-- peterx

  reply	other threads:[~2016-11-07 23:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07  7:09 [Qemu-devel] [PATCH V3 00/10] vhost device IOTLB support Jason Wang
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 01/10] virtio: convert to use DMA api Jason Wang
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 02/10] intel_iommu: name vtd address space with devfn Jason Wang
2016-12-16  2:53   ` Peter Xu
2016-12-16  3:53     ` Jason Wang
2016-12-30  8:19       ` Jason Wang
2016-12-30  9:22         ` Peter Xu
2016-12-30 10:06           ` Jason Wang
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 03/10] intel_iommu: allocate new key when creating new address space Jason Wang
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 04/10] exec: introduce address_space_get_iotlb_entry() Jason Wang
2016-11-07 17:07   ` Paolo Bonzini
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 05/10] intel_iommu: support device iotlb descriptor Jason Wang
2016-11-07 23:35   ` Peter Xu [this message]
2016-11-08  6:54     ` Jason Wang
2016-11-08 20:31       ` Michael S. Tsirkin
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 06/10] virtio-pci: address space translation service (ATS) support Jason Wang
2016-11-08 12:25   ` Greg Kurz
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 07/10] acpi: add ATSR for q35 Jason Wang
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 08/10] memory: handle alias for iommu notifier Jason Wang
2016-11-07 23:41   ` Peter Xu
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 09/10] memory: handle alias in memory_region_is_iommu() Jason Wang
2016-11-07 23:42   ` Peter Xu
2016-11-07  7:09 ` [Qemu-devel] [PATCH V3 10/10] vhost_net: device IOTLB support Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161107233549.GA2793@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=vkaplans@redhat.com \
    --cc=wexu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).