[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 1/3] memory: add MemTxAttrs to translate function
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [RFC 1/3] memory: add MemTxAttrs to translate function |
Date: |
Wed, 6 Jun 2018 10:11:18 +1000 |
User-agent: |
Mutt/1.9.5 (2018-04-13) |
On Tue, Jun 05, 2018 at 02:38:31PM +0100, Peter Maydell wrote:
> On 5 June 2018 at 14:19, Peter Xu <address@hidden> 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 <address@hidden>
> > ---
> > 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
signature.asc
Description: PGP signature