[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: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [RFC 1/3] memory: add MemTxAttrs to translate function |
Date: |
Tue, 5 Jun 2018 14:38:31 +0100 |
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.
thanks
-- PMM