All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: qemu-devel@nongnu.org,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Peter Xu" <peterx@redhat.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH qemu v9 2/2] memory/iommu: introduce IOMMUMemoryRegionClass
Date: Wed, 12 Jul 2017 15:18:21 +0200	[thread overview]
Message-ID: <20170712151821.5237af0a@dhcp-192-215.str.redhat.com> (raw)
In-Reply-To: <20170711035620.4232-3-aik@ozlabs.ru>

On Tue, 11 Jul 2017 13:56:20 +1000
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> This finishes QOM'fication of IOMMUMemoryRegion by introducing
> a IOMMUMemoryRegionClass. This also provides a fastpath analog for
> IOMMU_MEMORY_REGION_GET_CLASS().
> 
> This makes IOMMUMemoryRegion an abstract class.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> Changes:
> v9:
> * moved IOMMU MR typenames next to respective IOMMU device typenames
> * renamed few definitions and functions to match the rest of the code
> (for example intel_vtd_iommu_memory_region_class_init -> vtd_iommu_memory_region_class_init
> as the rest of that file uses "vtd_" as a prefix)
> 
> v8:
> * first appearance
> ---
>  hw/i386/amd_iommu.h           |  5 ++---
>  hw/s390x/s390-pci-bus.h       |  1 +
>  include/exec/memory.h         | 45 +++++++++++++++++++++++++++++++++----------
>  include/hw/i386/intel_iommu.h |  3 ++-
>  include/hw/ppc/spapr.h        |  4 ++++
>  exec.c                        |  6 ++++--
>  hw/alpha/typhoon.c            | 23 +++++++++++++++++-----
>  hw/dma/rc4030.c               | 26 +++++++++++++++++++------
>  hw/i386/amd_iommu.c           | 24 +++++++++++++++++++----
>  hw/i386/intel_iommu.c         | 25 +++++++++++++++++++-----
>  hw/pci-host/apb.c             | 23 +++++++++++++++++-----
>  hw/ppc/spapr_iommu.c          | 26 ++++++++++++++++++-------
>  hw/s390x/s390-pci-bus.c       | 23 ++++++++++++++++------
>  hw/s390x/s390-pci-inst.c      |  5 ++++-
>  memory.c                      | 36 +++++++++++++++++++---------------
>  15 files changed, 205 insertions(+), 70 deletions(-)

(...)

> diff --git a/memory.c b/memory.c
> index 45e10e2e3b..69f697c20e 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1506,19 +1506,20 @@ void memory_region_init_rom_device(MemoryRegion *mr,
>      mr->ram_block = qemu_ram_alloc(size, mr, errp);
>  }
>  
> -void memory_region_init_iommu(IOMMUMemoryRegion *iommu_mr,
> +void memory_region_init_iommu(void *_iommu_mr,
> +                              size_t instance_size,
> +                              const char *mrtypename,
>                                Object *owner,
> -                              const MemoryRegionIOMMUOps *ops,
>                                const char *name,
>                                uint64_t size)
>  {
> +    struct IOMMUMemoryRegion *iommu_mr;
>      struct MemoryRegion *mr;
>  
> -    object_initialize(iommu_mr, sizeof(*iommu_mr), TYPE_IOMMU_MEMORY_REGION);
> -    mr = MEMORY_REGION(iommu_mr);
> +    object_initialize(_iommu_mr, instance_size, mrtypename);
> +    mr = MEMORY_REGION(_iommu_mr);
>      memory_region_do_init(mr, owner, name, size);
>      iommu_mr = IOMMU_MEMORY_REGION(mr);
> -    iommu_mr->iommu_ops = ops,

Ah, here the comma is gone anyway :)

>      mr->terminates = true;  /* then re-forwards */
>      QLIST_INIT(&iommu_mr->iommu_notify);
>      iommu_mr->iommu_notify_flags = IOMMU_NOTIFIER_NONE;

(...)

> @@ -1655,8 +1656,10 @@ void memory_region_register_iommu_notifier(MemoryRegion *mr,
>  
>  uint64_t memory_region_iommu_get_min_page_size(IOMMUMemoryRegion *iommu_mr)
>  {
> -    if (iommu_mr->iommu_ops && iommu_mr->iommu_ops->get_min_page_size) {
> -        return iommu_mr->iommu_ops->get_min_page_size(iommu_mr);
> +    IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_GET_CLASS(iommu_mr);
> +
> +    if (imrc->get_min_page_size) {
> +        return imrc->get_min_page_size(iommu_mr);

And this voids my other complaint for the previous patch as well.

>      }
>      return TARGET_PAGE_SIZE;
>  }

s390 parts look fine.

  reply	other threads:[~2017-07-12 13:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11  3:56 [Qemu-devel] [PATCH qemu v9 0/2] memory/iommu: QOM'fy IOMMU MemoryRegion Alexey Kardashevskiy
2017-07-11  3:56 ` [Qemu-devel] [PATCH qemu v9 1/2] " Alexey Kardashevskiy
2017-07-12 10:22   ` Cornelia Huck
2017-07-12 12:07     ` Greg Kurz
2017-07-11  3:56 ` [Qemu-devel] [PATCH qemu v9 2/2] memory/iommu: introduce IOMMUMemoryRegionClass Alexey Kardashevskiy
2017-07-12 13:18   ` Cornelia Huck [this message]
2017-07-16  6:45   ` David Gibson
2017-07-12 13:20 ` [Qemu-devel] [PATCH qemu v9 0/2] memory/iommu: QOM'fy IOMMU MemoryRegion Cornelia Huck

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=20170712151821.5237af0a@dhcp-192-215.str.redhat.com \
    --to=cohuck@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=f4bug@amsat.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.