[RFC PATCH 3/5] memattrs: Add user-defined attribute

Joe Komlodi posted 5 patches 9 months ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Peter Maydell <peter.maydell@linaro.org>
[RFC PATCH 3/5] memattrs: Add user-defined attribute
Posted by Joe Komlodi 9 months ago
These are used to represent implementation-specific data.
These are based off of AMBA-AXI user signals, but can be used in any
implementation.

The length of 4-bits is arbitrary.

Signed-off-by: Joe Komlodi <komlodi@google.com>
---
 include/exec/memattrs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
index 942b721be8..a38645f881 100644
--- a/include/exec/memattrs.h
+++ b/include/exec/memattrs.h
@@ -64,6 +64,8 @@ typedef struct MemTxAttrs {
     unsigned int target_tlb_bit0:1;
     unsigned int target_tlb_bit1:1;
     unsigned int target_tlb_bit2:1;
+    /* User-defined bits represent data that is implementation defined. */
+    unsigned int user_defined:4;
 } MemTxAttrs;
 
 /* Bus masters which don't specify any attributes will get this,
-- 
2.44.0.rc0.258.g7320e95886-goog
Re: [RFC PATCH 3/5] memattrs: Add user-defined attribute
Posted by Alex Bennée 9 months ago
Joe Komlodi <komlodi@google.com> writes:

> These are used to represent implementation-specific data.
> These are based off of AMBA-AXI user signals, but can be used in any
> implementation.
>
> The length of 4-bits is arbitrary.
>
> Signed-off-by: Joe Komlodi <komlodi@google.com>
> ---
>  include/exec/memattrs.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
> index 942b721be8..a38645f881 100644
> --- a/include/exec/memattrs.h
> +++ b/include/exec/memattrs.h
> @@ -64,6 +64,8 @@ typedef struct MemTxAttrs {
>      unsigned int target_tlb_bit0:1;
>      unsigned int target_tlb_bit1:1;
>      unsigned int target_tlb_bit2:1;
> +    /* User-defined bits represent data that is implementation defined. */
> +    unsigned int user_defined:4;
>  } MemTxAttrs;
>  
>  /* Bus masters which don't specify any attributes will get this,

This reminds me of the concept of MACHINE for impdef bits I proposed in:

  Message-Id: <20221111182535.64844-1-alex.bennee@linaro.org>
  Date: Fri, 11 Nov 2022 18:25:15 +0000
  Subject: [PATCH for 8.0 v5 00/20] use MemTxAttrs to avoid current_cpu in hw/
  From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>

which I unfortunately ran out of steam on. Surveying the list I see
there are other patches for MemTxAttrs for IOMMU ids so I wonder if we
are going to run out of bits soon.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro