qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts
@ 2021-08-24 20:11 matheus.ferst
  2021-08-24 20:11 ` [PATCH 1/2] include/qemu/int128.h: define struct Int128 according to the host endianness matheus.ferst
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: matheus.ferst @ 2021-08-24 20:11 UTC (permalink / raw)
  To: qemu-devel, qemu-ppc; +Cc: peter.maydell, Matheus Ferst, groug, david

From: Matheus Ferst <matheus.ferst@eldorado.org.br>

The definition of struct Int128 is currently independent of the host
endianness, causing different results when using the member s128 of
union ppc_vsr_t in big-endian builds with CONFIG_INT128 or
!CONFIG_INT128.

The only PPC instructions that seem to be affected by this issue are the
"Vector Extract Unsigned Byte/Halfword/Word to GPR using GPR-specified
Left/Right-Index." Even on builds with Int128 support, however, their
helpers give the wrong result on big-endian hosts.

The first patch in this series changes the definition of struct Int128
to allow its use in the ppc_vsr_t union. The second patch fixes the
helper definition.

Matheus Ferst (2):
  include/qemu/int128.h: define struct Int128 according to the host
    endianness
  target/ppc: fix vextu[bhw][lr]x helpers

 include/qemu/int128.h   | 19 ++++++++++++-------
 target/ppc/int_helper.c | 38 ++++++++++----------------------------
 2 files changed, 22 insertions(+), 35 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] include/qemu/int128.h: define struct Int128 according to the host endianness
  2021-08-24 20:11 [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts matheus.ferst
@ 2021-08-24 20:11 ` matheus.ferst
  2021-08-26 13:11   ` Peter Maydell
  2021-08-24 20:11 ` [PATCH 2/2] target/ppc: fix vextu[bhw][lr]x helpers matheus.ferst
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: matheus.ferst @ 2021-08-24 20:11 UTC (permalink / raw)
  To: qemu-devel, qemu-ppc; +Cc: peter.maydell, Matheus Ferst, groug, david

From: Matheus Ferst <matheus.ferst@eldorado.org.br>

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 include/qemu/int128.h | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/qemu/int128.h b/include/qemu/int128.h
index 64500385e3..e36c6e6db5 100644
--- a/include/qemu/int128.h
+++ b/include/qemu/int128.h
@@ -163,23 +163,28 @@ static inline Int128 bswap128(Int128 a)
 typedef struct Int128 Int128;
 
 struct Int128 {
+#ifdef HOST_WORDS_BIGENDIAN
+    int64_t hi;
+    uint64_t lo;
+#else
     uint64_t lo;
     int64_t hi;
+#endif
 };
 
 static inline Int128 int128_make64(uint64_t a)
 {
-    return (Int128) { a, 0 };
+    return (Int128) { .lo = a, .hi = 0 };
 }
 
 static inline Int128 int128_makes64(int64_t a)
 {
-    return (Int128) { a, a >> 63 };
+    return (Int128) { .lo = a, .hi = a >> 63 };
 }
 
 static inline Int128 int128_make128(uint64_t lo, uint64_t hi)
 {
-    return (Int128) { lo, hi };
+    return (Int128) { .lo = lo, .hi = hi };
 }
 
 static inline uint64_t int128_get64(Int128 a)
@@ -210,22 +215,22 @@ static inline Int128 int128_one(void)
 
 static inline Int128 int128_2_64(void)
 {
-    return (Int128) { 0, 1 };
+    return int128_make128(0, 1);
 }
 
 static inline Int128 int128_exts64(int64_t a)
 {
-    return (Int128) { .lo = a, .hi = (a < 0) ? -1 : 0 };
+    return int128_make128(a, (a < 0) ? -1 : 0);
 }
 
 static inline Int128 int128_and(Int128 a, Int128 b)
 {
-    return (Int128) { a.lo & b.lo, a.hi & b.hi };
+    return int128_make128(a.lo & b.lo, a.hi & b.hi);
 }
 
 static inline Int128 int128_or(Int128 a, Int128 b)
 {
-    return (Int128) { a.lo | b.lo, a.hi | b.hi };
+    return int128_make128(a.lo | b.lo, a.hi | b.hi);
 }
 
 static inline Int128 int128_rshift(Int128 a, int n)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] target/ppc: fix vextu[bhw][lr]x helpers
  2021-08-24 20:11 [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts matheus.ferst
  2021-08-24 20:11 ` [PATCH 1/2] include/qemu/int128.h: define struct Int128 according to the host endianness matheus.ferst
@ 2021-08-24 20:11 ` matheus.ferst
  2021-08-25  3:02   ` David Gibson
  2021-08-25  3:02 ` [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts David Gibson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: matheus.ferst @ 2021-08-24 20:11 UTC (permalink / raw)
  To: qemu-devel, qemu-ppc; +Cc: peter.maydell, Matheus Ferst, groug, david

From: Matheus Ferst <matheus.ferst@eldorado.org.br>

These helpers shouldn't depend on the host endianness, as they only use
shifts, &s, and int128_* methods.

Fixes: 60caf2216bf0 ("target-ppc: add vextu[bhw][lr]x instructions")
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 target/ppc/int_helper.c | 38 ++++++++++----------------------------
 1 file changed, 10 insertions(+), 28 deletions(-)

diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index efa833ef64..c2d3248d1e 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -1492,34 +1492,16 @@ void helper_vlogefp(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *b)
     }
 }
 
-#if defined(HOST_WORDS_BIGENDIAN)
-#define VEXTU_X_DO(name, size, left)                                \
-    target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b)  \
-    {                                                               \
-        int index;                                                  \
-        if (left) {                                                 \
-            index = (a & 0xf) * 8;                                  \
-        } else {                                                    \
-            index = ((15 - (a & 0xf) + 1) * 8) - size;              \
-        }                                                           \
-        return int128_getlo(int128_rshift(b->s128, index)) &        \
-            MAKE_64BIT_MASK(0, size);                               \
-    }
-#else
-#define VEXTU_X_DO(name, size, left)                                \
-    target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b)  \
-    {                                                               \
-        int index;                                                  \
-        if (left) {                                                 \
-            index = ((15 - (a & 0xf) + 1) * 8) - size;              \
-        } else {                                                    \
-            index = (a & 0xf) * 8;                                  \
-        }                                                           \
-        return int128_getlo(int128_rshift(b->s128, index)) &        \
-            MAKE_64BIT_MASK(0, size);                               \
-    }
-#endif
-
+#define VEXTU_X_DO(name, size, left)                            \
+target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b)  \
+{                                                               \
+    int index = (a & 0xf) * 8;                                  \
+    if (left) {                                                 \
+        index = 128 - index - size;                             \
+    }                                                           \
+    return int128_getlo(int128_rshift(b->s128, index)) &        \
+        MAKE_64BIT_MASK(0, size);                               \
+}
 VEXTU_X_DO(vextublx,  8, 1)
 VEXTU_X_DO(vextuhlx, 16, 1)
 VEXTU_X_DO(vextuwlx, 32, 1)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts
  2021-08-24 20:11 [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts matheus.ferst
  2021-08-24 20:11 ` [PATCH 1/2] include/qemu/int128.h: define struct Int128 according to the host endianness matheus.ferst
  2021-08-24 20:11 ` [PATCH 2/2] target/ppc: fix vextu[bhw][lr]x helpers matheus.ferst
@ 2021-08-25  3:02 ` David Gibson
  2021-08-25  5:32 ` Philippe Mathieu-Daudé
  2021-08-25 12:55 ` Mark Cave-Ayland
  4 siblings, 0 replies; 10+ messages in thread
From: David Gibson @ 2021-08-25  3:02 UTC (permalink / raw)
  To: matheus.ferst
  Cc: peter.maydell, richard.henderson, qemu-ppc, qemu-devel, groug

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

On Tue, Aug 24, 2021 at 05:11:03PM -0300, matheus.ferst@eldorado.org.br wrote:
> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> 
> The definition of struct Int128 is currently independent of the host
> endianness, causing different results when using the member s128 of
> union ppc_vsr_t in big-endian builds with CONFIG_INT128 or
> !CONFIG_INT128.
> 
> The only PPC instructions that seem to be affected by this issue are the
> "Vector Extract Unsigned Byte/Halfword/Word to GPR using GPR-specified
> Left/Right-Index." Even on builds with Int128 support, however, their
> helpers give the wrong result on big-endian hosts.
> 
> The first patch in this series changes the definition of struct Int128
> to allow its use in the ppc_vsr_t union. The second patch fixes the
> helper definition.

CCing Richard Henderson, who's probably the best qualified to review
these.

-- 
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 --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] target/ppc: fix vextu[bhw][lr]x helpers
  2021-08-24 20:11 ` [PATCH 2/2] target/ppc: fix vextu[bhw][lr]x helpers matheus.ferst
@ 2021-08-25  3:02   ` David Gibson
  0 siblings, 0 replies; 10+ messages in thread
From: David Gibson @ 2021-08-25  3:02 UTC (permalink / raw)
  To: matheus.ferst; +Cc: peter.maydell, qemu-ppc, qemu-devel, groug

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

On Tue, Aug 24, 2021 at 05:11:05PM -0300, matheus.ferst@eldorado.org.br wrote:
> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> 
> These helpers shouldn't depend on the host endianness, as they only use
> shifts, &s, and int128_* methods.
> 
> Fixes: 60caf2216bf0 ("target-ppc: add vextu[bhw][lr]x instructions")
> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  target/ppc/int_helper.c | 38 ++++++++++----------------------------
>  1 file changed, 10 insertions(+), 28 deletions(-)
> 
> diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
> index efa833ef64..c2d3248d1e 100644
> --- a/target/ppc/int_helper.c
> +++ b/target/ppc/int_helper.c
> @@ -1492,34 +1492,16 @@ void helper_vlogefp(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *b)
>      }
>  }
>  
> -#if defined(HOST_WORDS_BIGENDIAN)
> -#define VEXTU_X_DO(name, size, left)                                \
> -    target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b)  \
> -    {                                                               \
> -        int index;                                                  \
> -        if (left) {                                                 \
> -            index = (a & 0xf) * 8;                                  \
> -        } else {                                                    \
> -            index = ((15 - (a & 0xf) + 1) * 8) - size;              \
> -        }                                                           \
> -        return int128_getlo(int128_rshift(b->s128, index)) &        \
> -            MAKE_64BIT_MASK(0, size);                               \
> -    }
> -#else
> -#define VEXTU_X_DO(name, size, left)                                \
> -    target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b)  \
> -    {                                                               \
> -        int index;                                                  \
> -        if (left) {                                                 \
> -            index = ((15 - (a & 0xf) + 1) * 8) - size;              \
> -        } else {                                                    \
> -            index = (a & 0xf) * 8;                                  \
> -        }                                                           \
> -        return int128_getlo(int128_rshift(b->s128, index)) &        \
> -            MAKE_64BIT_MASK(0, size);                               \
> -    }
> -#endif
> -
> +#define VEXTU_X_DO(name, size, left)                            \
> +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b)  \
> +{                                                               \
> +    int index = (a & 0xf) * 8;                                  \
> +    if (left) {                                                 \
> +        index = 128 - index - size;                             \
> +    }                                                           \
> +    return int128_getlo(int128_rshift(b->s128, index)) &        \
> +        MAKE_64BIT_MASK(0, size);                               \
> +}
>  VEXTU_X_DO(vextublx,  8, 1)
>  VEXTU_X_DO(vextuhlx, 16, 1)
>  VEXTU_X_DO(vextuwlx, 32, 1)

-- 
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 --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts
  2021-08-24 20:11 [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts matheus.ferst
                   ` (2 preceding siblings ...)
  2021-08-25  3:02 ` [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts David Gibson
@ 2021-08-25  5:32 ` Philippe Mathieu-Daudé
  2021-08-25 12:55 ` Mark Cave-Ayland
  4 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-08-25  5:32 UTC (permalink / raw)
  To: matheus.ferst, qemu-devel, qemu-ppc; +Cc: peter.maydell, groug, david

On 8/24/21 10:11 PM, matheus.ferst@eldorado.org.br wrote:
> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> 
> The definition of struct Int128 is currently independent of the host
> endianness, causing different results when using the member s128 of
> union ppc_vsr_t in big-endian builds with CONFIG_INT128 or
> !CONFIG_INT128.
> 
> The only PPC instructions that seem to be affected by this issue are the
> "Vector Extract Unsigned Byte/Halfword/Word to GPR using GPR-specified
> Left/Right-Index." Even on builds with Int128 support, however, their
> helpers give the wrong result on big-endian hosts.
> 
> The first patch in this series changes the definition of struct Int128
> to allow its use in the ppc_vsr_t union. The second patch fixes the
> helper definition.
> 
> Matheus Ferst (2):
>   include/qemu/int128.h: define struct Int128 according to the host
>     endianness
>   target/ppc: fix vextu[bhw][lr]x helpers
> 
>  include/qemu/int128.h   | 19 ++++++++++++-------
>  target/ppc/int_helper.c | 38 ++++++++++----------------------------
>  2 files changed, 22 insertions(+), 35 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts
  2021-08-24 20:11 [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts matheus.ferst
                   ` (3 preceding siblings ...)
  2021-08-25  5:32 ` Philippe Mathieu-Daudé
@ 2021-08-25 12:55 ` Mark Cave-Ayland
  2021-08-26  1:28   ` Matheus K. Ferst
  4 siblings, 1 reply; 10+ messages in thread
From: Mark Cave-Ayland @ 2021-08-25 12:55 UTC (permalink / raw)
  To: matheus.ferst, qemu-devel, qemu-ppc; +Cc: peter.maydell, groug, david

On 24/08/2021 21:11, matheus.ferst@eldorado.org.br wrote:

> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> 
> The definition of struct Int128 is currently independent of the host
> endianness, causing different results when using the member s128 of
> union ppc_vsr_t in big-endian builds with CONFIG_INT128 or
> !CONFIG_INT128.
> 
> The only PPC instructions that seem to be affected by this issue are the
> "Vector Extract Unsigned Byte/Halfword/Word to GPR using GPR-specified
> Left/Right-Index." Even on builds with Int128 support, however, their
> helpers give the wrong result on big-endian hosts.
> 
> The first patch in this series changes the definition of struct Int128
> to allow its use in the ppc_vsr_t union. The second patch fixes the
> helper definition.
> 
> Matheus Ferst (2):
>    include/qemu/int128.h: define struct Int128 according to the host
>      endianness
>    target/ppc: fix vextu[bhw][lr]x helpers
> 
>   include/qemu/int128.h   | 19 ++++++++++++-------
>   target/ppc/int_helper.c | 38 ++++++++++----------------------------
>   2 files changed, 22 insertions(+), 35 deletions(-)

Hi Matheus,

Slightly unrelated to this patchset, however I see you've managed to make some good 
efforts in consolidating the functionality between big-endian and little-endian host 
systems.

When I first worked on adding host vector support for PPC I noticed there were some 
further places in target/ppc/int_helper.c that could be improved from accessing 
ppc_avr_t fields such as u64 directly and instead using the relevant Vsr*() macros.

If you feel suitably motivated, it would be amazing to see more patches to help this 
further along: basically look in target/ppc/int_helper.c for individual elements such 
as u64 (and also the VECTOR_FOR_INORDER_I macro) and determine which ones are better 
replaced by the relevant Vsr*() macro.


ATB,

Mark.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts
  2021-08-25 12:55 ` Mark Cave-Ayland
@ 2021-08-26  1:28   ` Matheus K. Ferst
  0 siblings, 0 replies; 10+ messages in thread
From: Matheus K. Ferst @ 2021-08-26  1:28 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel, qemu-ppc; +Cc: peter.maydell, groug, david

On 25/08/2021 09:55, Mark Cave-Ayland wrote:
> [E-MAIL EXTERNO] Não clique em links ou abra anexos, a menos que você 
> possa confirmar o remetente e saber que o conteúdo é seguro. Em caso de 
> e-mail suspeito entre imediatamente em contato com o DTI.
> 
> On 24/08/2021 21:11, matheus.ferst@eldorado.org.br wrote:
> 
>> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
>>
>> The definition of struct Int128 is currently independent of the host
>> endianness, causing different results when using the member s128 of
>> union ppc_vsr_t in big-endian builds with CONFIG_INT128 or
>> !CONFIG_INT128.
>>
>> The only PPC instructions that seem to be affected by this issue are the
>> "Vector Extract Unsigned Byte/Halfword/Word to GPR using GPR-specified
>> Left/Right-Index." Even on builds with Int128 support, however, their
>> helpers give the wrong result on big-endian hosts.
>>
>> The first patch in this series changes the definition of struct Int128
>> to allow its use in the ppc_vsr_t union. The second patch fixes the
>> helper definition.
>>
>> Matheus Ferst (2):
>>    include/qemu/int128.h: define struct Int128 according to the host
>>      endianness
>>    target/ppc: fix vextu[bhw][lr]x helpers
>>
>>   include/qemu/int128.h   | 19 ++++++++++++-------
>>   target/ppc/int_helper.c | 38 ++++++++++----------------------------
>>   2 files changed, 22 insertions(+), 35 deletions(-)
> 
> Hi Matheus,
> 
> Slightly unrelated to this patchset, however I see you've managed to 
> make some good
> efforts in consolidating the functionality between big-endian and 
> little-endian host
> systems.
> 
> When I first worked on adding host vector support for PPC I noticed 
> there were some
> further places in target/ppc/int_helper.c that could be improved from 
> accessing
> ppc_avr_t fields such as u64 directly and instead using the relevant 
> Vsr*() macros.
> 
> If you feel suitably motivated, it would be amazing to see more patches 
> to help this
> further along: basically look in target/ppc/int_helper.c for individual 
> elements such
> as u64 (and also the VECTOR_FOR_INORDER_I macro) and determine which 
> ones are better
> replaced by the relevant Vsr*() macro.
> 
> 
> ATB,
> 
> Mark.

Hi Mark,

That would be a nice change. Our efforts are currently on PowerISA v3.1 
instructions, but I'll try to change that in helpers of things we move 
to decodetree. After completing the new instructions, I can give a shot 
in a Vsr*() patchset.

-- 
Matheus K. Ferst
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br/>
Analista de Software Júnior
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] include/qemu/int128.h: define struct Int128 according to the host endianness
  2021-08-24 20:11 ` [PATCH 1/2] include/qemu/int128.h: define struct Int128 according to the host endianness matheus.ferst
@ 2021-08-26 13:11   ` Peter Maydell
  2021-08-26 13:14     ` Peter Maydell
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2021-08-26 13:11 UTC (permalink / raw)
  To: Matheus K. Ferst; +Cc: Greg Kurz, qemu-ppc, QEMU Developers, David Gibson

On Tue, 24 Aug 2021 at 21:12, <matheus.ferst@eldorado.org.br> wrote:
>
> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] include/qemu/int128.h: define struct Int128 according to the host endianness
  2021-08-26 13:11   ` Peter Maydell
@ 2021-08-26 13:14     ` Peter Maydell
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2021-08-26 13:14 UTC (permalink / raw)
  To: Matheus K. Ferst; +Cc: Greg Kurz, qemu-ppc, QEMU Developers, David Gibson

On Thu, 26 Aug 2021 at 14:11, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Tue, 24 Aug 2021 at 21:12, <matheus.ferst@eldorado.org.br> wrote:
> >
> > From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> >
> > Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
> > ---
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Oh, you could add a comment before the struct definition:

 /*
  * We guarantee that the in-memory byte representation of an
  * Int128 is that of a host-endian-order 128-bit integer
  * (whether using this struct or the __int128_t version of the type).
  * Some code using this type relies on this (eg when copying it into
  * guest memory or a gdb protocol buffer, or by using Int128 in
  * a union with other integer types).
  */
 struct Int128 {
     ....

so we don't forget why we put this ifdef in.

-- PMM


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-08-26 13:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 20:11 [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts matheus.ferst
2021-08-24 20:11 ` [PATCH 1/2] include/qemu/int128.h: define struct Int128 according to the host endianness matheus.ferst
2021-08-26 13:11   ` Peter Maydell
2021-08-26 13:14     ` Peter Maydell
2021-08-24 20:11 ` [PATCH 2/2] target/ppc: fix vextu[bhw][lr]x helpers matheus.ferst
2021-08-25  3:02   ` David Gibson
2021-08-25  3:02 ` [PATCH 0/2] target/ppc: Fix vextu[bhw][lr]x on big endian hosts David Gibson
2021-08-25  5:32 ` Philippe Mathieu-Daudé
2021-08-25 12:55 ` Mark Cave-Ayland
2021-08-26  1:28   ` Matheus K. Ferst

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).