diff mbox series

[RFC,2/3] memory: add MemTxAttrs to IOMMUTLBEntry

Message ID 20180605131944.14649-3-peterx@redhat.com
State New
Headers show
Series memory: enhance IOMMU notifier to support USER bit | expand

Commit Message

Peter Xu June 5, 2018, 1:19 p.m. UTC
It should never be used for translate() calls since the caller should be
the one who passes in the MemTxAttrs.  However it could be used when we
want to generate an IOMMU translation notification with specific
translation attributes.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/exec/memory.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Peter Maydell June 5, 2018, 1:39 p.m. UTC | #1
On 5 June 2018 at 14:19, Peter Xu <peterx@redhat.com> wrote:
> It should never be used for translate() calls since the caller should be
> the one who passes in the MemTxAttrs.  However it could be used when we
> want to generate an IOMMU translation notification with specific
> translation attributes.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  include/exec/memory.h | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 6b0ced554d..12865a4890 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -72,6 +72,13 @@ struct IOMMUTLBEntry {
>      hwaddr           translated_addr;
>      hwaddr           addr_mask;  /* 0xfff = 4k translation */
>      IOMMUAccessFlags perm;
> +    /*
> +     * Attributes that were bound to the DMA translation.  Note that
> +     * this field is meaningless when the IOMMUTLBENtry is generated
> +     * by a translate() call.  It can be used as a hint when we want
> +     * to send IOMMU notifications with specific permission flags.
> +     */
> +    MemTxAttrs       attrs;
>  };

How do we say "this applies for more than just this set of
tx attrs" ? eg, if my IOMMU cares only about the secure/nonsecure
attribute, how do I express "this IOMMU TLB entry is valid for
both attrs.user = 1 and attrs.user = 0" ?

thanks
-- PMM
diff mbox series

Patch

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 6b0ced554d..12865a4890 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -72,6 +72,13 @@  struct IOMMUTLBEntry {
     hwaddr           translated_addr;
     hwaddr           addr_mask;  /* 0xfff = 4k translation */
     IOMMUAccessFlags perm;
+    /*
+     * Attributes that were bound to the DMA translation.  Note that
+     * this field is meaningless when the IOMMUTLBENtry is generated
+     * by a translate() call.  It can be used as a hint when we want
+     * to send IOMMU notifications with specific permission flags.
+     */
+    MemTxAttrs       attrs;
 };
 
 /*