qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"David Hildenbrand" <david@redhat.com>,
	qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
	"Thomas Weißschuh" <thomas@t-8ch.de>,
	"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [PATCH v3 1/2] tests/tcg/multiarch: Make the system memory test work on big-endian
Date: Thu, 11 May 2023 12:20:17 +0100	[thread overview]
Message-ID: <8735433yec.fsf@linaro.org> (raw)
In-Reply-To: <20230425224850.2116064-2-iii@linux.ibm.com>


Ilya Leoshkevich <iii@linux.ibm.com> writes:

> Store the bytes in descending order on big-endian.
> Invert the logic in the multi-byte signed tests on big-endian.
> Make the checks in the multi-byte signed tests stricter.
>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  tests/tcg/multiarch/system/memory.c | 64 +++++++++++++++++++----------
>  1 file changed, 42 insertions(+), 22 deletions(-)
>
> diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c
> index 214f7d4f54b..eaae6929cb3 100644
> --- a/tests/tcg/multiarch/system/memory.c
> +++ b/tests/tcg/multiarch/system/memory.c
> @@ -40,18 +40,21 @@ static void pdot(int count)
>  }
>  
>  /*
> - * Helper macros for shift/extract so we can keep our endian handling
> - * in one place.
> + * Helper macros for endian handling.
>   */
> -#define BYTE_SHIFT(b, pos) ((uint64_t)b << (pos * 8))
> -#define BYTE_EXTRACT(b, pos) ((b >> (pos * 8)) & 0xff)
> +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> +#define BYTE_SHIFT(b, pos) (b << (pos * 8))
> +#define BYTE_NEXT(b) ((b)++)
> +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> +#define BYTE_SHIFT(b, pos) (b << ((sizeof(b) - 1 - (pos)) * 8))
> +#define BYTE_NEXT(b) ((b)--)

I guess we don't want to start count high so we'll see:

255, 254, 253

instead of

0, 255, 254, 253?

> +#else
> +#error Unsupported __BYTE_ORDER__
> +#endif
>  
>  /*
> - * Fill the data with ascending value bytes.
> - *
> - * Currently we only support Little Endian machines so write in
> - * ascending address order. When we read higher address bytes should
> - * either be zero or higher than the lower bytes.
> + * Fill the data with ascending (for little-endian) or descending (for
> + * big-endian) value bytes.
>   */

There is also a comment later on that needs fixing:

  /*
   * Read the test data and verify at various offsets
   *
   * For everything except bytes all our reads should be either positive
   * or negative depending on what offset we are reading from. Currently
   * we only handle LE systems.
   */

Otherwise:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

Would you be able to re-base and respin v3 so I can pull it cleanly?


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-05-11 11:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25 22:48 [PATCH v3 0/2] tests/tcg/s390x: Enable the multiarch system tests Ilya Leoshkevich
2023-04-25 22:48 ` [PATCH v3 1/2] tests/tcg/multiarch: Make the system memory test work on big-endian Ilya Leoshkevich
2023-05-11 11:20   ` Alex Bennée [this message]
2023-04-25 22:48 ` [PATCH v3 2/2] tests/tcg/s390x: Enable the multiarch system tests Ilya Leoshkevich
2023-04-26 15:18   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735433yec.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=david@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thomas@t-8ch.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).