[Stable-8.0.4 44/63] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-08-04 Thread Michael Tokarev
From: Helge Deller Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects words to be stored

[Stable-7.2.5 19/36] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-08-04 Thread Michael Tokarev
From: Helge Deller Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects words to be stored

[PULL 09/10] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-31 Thread Richard Henderson
From: Helge Deller Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects words to be stored

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-31 Thread Philippe Mathieu-Daudé
On 28/7/23 21:23, Helge Deller wrote: Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects

Re: linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-31 Thread Michael Tokarev
31.07.2023 12:26, Philippe Mathieu-Daudé wrote: On 27/7/23 23:19, Helge Deller wrote: Words are stored in big endian in the guest memory for armeb. .. Reviewed-by: Philippe Mathieu-Daudé There was a v3 of this patch already, fwiw. /mjt

Re: linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-31 Thread Philippe Mathieu-Daudé
On 27/7/23 23:19, Helge Deller wrote: Words are stored in big endian in the guest memory for armeb. Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldv

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Helge Deller
On 7/28/23 22:57, Richard Henderson wrote: On 7/28/23 13:51, Richard Henderson wrote: On 7/28/23 12:23, Helge Deller wrote: +    /* endianess-swap if emulating armeb */ +    oldval = tswap64(oldval); +    newval = tswap64(newval); Oh btw, it's not about arm vs armeb, but guest vs host. This a

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Richard Henderson
On 7/28/23 12:23, Helge Deller wrote: Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Richard Henderson
On 7/28/23 13:51, Richard Henderson wrote: On 7/28/23 12:23, Helge Deller wrote: +    /* endianess-swap if emulating armeb */ +    oldval = tswap64(oldval); +    newval = tswap64(newval); Oh btw, it's not about arm vs armeb, but guest vs host. This also fixes armel on big-endian hosts. Anywa

Re: [PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Richard Henderson
On 7/28/23 12:23, Helge Deller wrote: +/* endianess-swap if emulating armeb */ +oldval = tswap64(oldval); +newval = tswap64(newval); Oh btw, it's not about arm vs armeb, but guest vs host. This also fixes armel on big-endian hosts. r~

Re: [PATCH v2] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Helge Deller
On 7/28/23 17:35, Richard Henderson wrote: On 7/27/23 21:54, Helge Deller wrote: @@ -174,6 +175,10 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env)   return;   } +    /* endianess-swap if emulating armeb */ +    oldval = tswap32(oldval); +    newval = tswap32(newval);

[PATCH v3] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Helge Deller
Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects words to be stored in big endian in the

Re: [PATCH v2] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Richard Henderson
On 7/27/23 21:54, Helge Deller wrote: @@ -174,6 +175,10 @@ static void arm_kernel_cmpxchg64_helper(CPUARMState *env) return; } +/* endianess-swap if emulating armeb */ +oldval = tswap32(oldval); +newval = tswap32(newval); Must be tswap64. r~

Re: [PATCH v2] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Markus F.X.J. Oberhumer
Nitpick: the bug was introduced between 6.2.0 and 7.0.0, so "qemu >= v7.0.0" ~Markus On 2023-07-28 06:54, Helge Deller wrote: > Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host > atomics") switched to use qatomic_cmpxchg() to swap a word with the memory > content, but mi

Re: [PATCH v2] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-28 Thread Markus F.X.J. Oberhumer
The fix in arm_kernel_cmpxchg64_helper probably should use tswap64() instead of tswap32(). ~Markus On 2023-07-28 06:54, Helge Deller wrote: > Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host > atomics") switched to use qatomic_cmpxchg() to swap a word with the memory > c

[PATCH v2] linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-27 Thread Helge Deller
Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an armeb CPU, which expects words to be stored in big endian in the

Re: linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-27 Thread Richard Henderson
On 7/27/23 14:19, Helge Deller wrote: Words are stored in big endian in the guest memory for armeb. Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldv

linux-user/armeb: Fix __kernel_cmpxchg() for armeb

2023-07-27 Thread Helge Deller
Words are stored in big endian in the guest memory for armeb. Commit 7f4f0d9ea870 ("linux-user/arm: Implement __kernel_cmpxchg with host atomics") switched to use qatomic_cmpxchg() to swap a word with the memory content, but missed to endianess-swap the oldval and newval values when emulating an a