qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Peter Xu" <peterx@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Eric Auger" <eric.auger@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Alex Williamson" <alex.williamson@redhat.com>
Subject: Re: [Qemu-devel] [RFC 1/3] memory: add MemTxAttrs to translate function
Date: Wed, 6 Jun 2018 10:11:18 +1000	[thread overview]
Message-ID: <20180606001118.GB17757@umbus.fritz.box> (raw)
In-Reply-To: <CAFEAcA9-O7B5h0ozAqLEUXR=YRS+s-X7A_m=xce-aLgR59EG1w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2238 bytes --]

On Tue, Jun 05, 2018 at 02:38:31PM +0100, Peter Maydell wrote:
> On 5 June 2018 at 14:19, Peter Xu <peterx@redhat.com> wrote:
> > Add a new MemTxAttrs parameter to the IOMMUMemoryRegionClass.translate()
> > function, which takes some extra context of the translation request.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >  include/exec/memory.h    | 5 ++++-
> >  exec.c                   | 2 +-
> >  hw/alpha/typhoon.c       | 3 ++-
> >  hw/arm/smmuv3.c          | 2 +-
> >  hw/dma/rc4030.c          | 6 ++++--
> >  hw/i386/amd_iommu.c      | 2 +-
> >  hw/i386/intel_iommu.c    | 6 ++++--
> >  hw/ppc/spapr_iommu.c     | 3 ++-
> >  hw/s390x/s390-pci-bus.c  | 6 ++++--
> >  hw/sparc/sun4m_iommu.c   | 3 ++-
> >  hw/sparc64/sun4u_iommu.c | 3 ++-
> >  memory.c                 | 3 ++-
> >  12 files changed, 29 insertions(+), 15 deletions(-)
> >
> > diff --git a/include/exec/memory.h b/include/exec/memory.h
> > index eb2ba06519..6b0ced554d 100644
> > --- a/include/exec/memory.h
> > +++ b/include/exec/memory.h
> > @@ -234,9 +234,12 @@ typedef struct IOMMUMemoryRegionClass {
> >       * @iommu: the IOMMUMemoryRegion
> >       * @hwaddr: address to be translated within the memory region
> >       * @flag: requested access permissions
> > +     * @attrs: MemTxAttrs that was bound to the translation
> > +     *         operation. If flag==IOMMU_NONE, this field is
> > +     *         meaningless
> >       */
> 
> This won't work, because the "allow TCG transactions to pass
> through an IOMMU" code needs to pass IOMMU_NONE. IOMMU_NONE
> means "give me all the permissions info, and don't shortcut it".
> For TCG we get the info, and then cache it and use it for
> subsequent transactions, both read and write, regardless of
> whether the first one was a read or a write.

Likewise the "replay" operations needed for hotplug use IOMMU_NONE.

It also seems like it's kind of abusing the meaning of "AddressSpace",
if other factors are influencing how the translation is done.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-06-06  0:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 13:19 [Qemu-devel] [RFC 0/3] memory: enhance IOMMU notifier to support USER bit Peter Xu
2018-06-05 13:19 ` [Qemu-devel] [RFC 1/3] memory: add MemTxAttrs to translate function Peter Xu
2018-06-05 13:38   ` Peter Maydell
2018-06-06  0:11     ` David Gibson [this message]
2018-06-05 13:19 ` [Qemu-devel] [RFC 2/3] memory: add MemTxAttrs to IOMMUTLBEntry Peter Xu
2018-06-05 13:39   ` Peter Maydell
2018-06-05 13:19 ` [Qemu-devel] [RFC 3/3] memory: introduce IOMMU_NOTIFIER_USER_[UN]SET Peter Xu
2018-06-05 13:54   ` Peter Maydell
2018-06-05 14:26     ` Peter Xu
2018-06-05 14:42       ` Peter Maydell
2018-06-06  6:56         ` Peter Xu
2018-06-06  7:09           ` Peter Xu

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=20180606001118.GB17757@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=alex.bennee@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).