qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] util: fix build with musl libc on ppc64le
@ 2023-12-19 10:51 Natanael Copa
  2024-01-04 16:26 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Natanael Copa @ 2023-12-19 10:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, Natanael Copa, Richard Henderson, Paolo Bonzini

Use PPC_FEATURE2_ISEL and PPC_FEATURE2_VEC_CRYPTO from linux headers
instead of the GNU specific PPC_FEATURE2_HAS_ISEL and
PPC_FEATURE2_HAS_VEC_CRYPTO. This fixes build with musl libc.

Fixes: 623d7e3551a6 (util: Add cpuinfo-ppc.c)
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1861

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
 util/cpuinfo-ppc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c
index 1ea3db0ac8..b2d8893a06 100644
--- a/util/cpuinfo-ppc.c
+++ b/util/cpuinfo-ppc.c
@@ -6,10 +6,10 @@
 #include "qemu/osdep.h"
 #include "host/cpuinfo.h"
 
+#include <asm/cputable.h>
 #ifdef CONFIG_GETAUXVAL
 # include <sys/auxv.h>
 #else
-# include <asm/cputable.h>
 # include "elf.h"
 #endif
 
@@ -40,7 +40,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
         info |= CPUINFO_V2_06;
     }
 
-    if (hwcap2 & PPC_FEATURE2_HAS_ISEL) {
+    if (hwcap2 & PPC_FEATURE2_ISEL) {
         info |= CPUINFO_ISEL;
     }
     if (hwcap & PPC_FEATURE_HAS_ALTIVEC) {
@@ -53,7 +53,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
              * always have both anyway, since VSX came with Power7
              * and crypto came with Power8.
              */
-            if (hwcap2 & PPC_FEATURE2_HAS_VEC_CRYPTO) {
+            if (hwcap2 & PPC_FEATURE2_VEC_CRYPTO) {
                 info |= CPUINFO_CRYPTO;
             }
         }
-- 
2.43.0



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

* Re: [PATCH] util: fix build with musl libc on ppc64le
  2023-12-19 10:51 [PATCH] util: fix build with musl libc on ppc64le Natanael Copa
@ 2024-01-04 16:26 ` Philippe Mathieu-Daudé
  2024-01-08 21:13   ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-01-04 16:26 UTC (permalink / raw)
  To: Natanael Copa, qemu-devel; +Cc: qemu-ppc, Richard Henderson, Paolo Bonzini

Hi Natanael,

On 19/12/23 11:51, Natanael Copa wrote:
> Use PPC_FEATURE2_ISEL and PPC_FEATURE2_VEC_CRYPTO from linux headers
> instead of the GNU specific PPC_FEATURE2_HAS_ISEL and
> PPC_FEATURE2_HAS_VEC_CRYPTO. This fixes build with musl libc.
> 
> Fixes: 623d7e3551a6 (util: Add cpuinfo-ppc.c)

Hmm this commit barely moved the code. Maybe it revealed the
issue from the following commits?

Fixes: 63922f467a ("tcg/ppc: Replace HAVE_ISEL macro with a variable")
Fixes: 68f340d4cd ("tcg/ppc: Enable Altivec detection")

Anyhow, changes LGTM.

> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1861
> 
> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
> ---
>   util/cpuinfo-ppc.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c
> index 1ea3db0ac8..b2d8893a06 100644
> --- a/util/cpuinfo-ppc.c
> +++ b/util/cpuinfo-ppc.c
> @@ -6,10 +6,10 @@
>   #include "qemu/osdep.h"
>   #include "host/cpuinfo.h"
>   
> +#include <asm/cputable.h>
>   #ifdef CONFIG_GETAUXVAL
>   # include <sys/auxv.h>
>   #else
> -# include <asm/cputable.h>
>   # include "elf.h"
>   #endif
>   
> @@ -40,7 +40,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
>           info |= CPUINFO_V2_06;
>       }
>   
> -    if (hwcap2 & PPC_FEATURE2_HAS_ISEL) {
> +    if (hwcap2 & PPC_FEATURE2_ISEL) {
>           info |= CPUINFO_ISEL;
>       }
>       if (hwcap & PPC_FEATURE_HAS_ALTIVEC) {
> @@ -53,7 +53,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
>                * always have both anyway, since VSX came with Power7
>                * and crypto came with Power8.
>                */
> -            if (hwcap2 & PPC_FEATURE2_HAS_VEC_CRYPTO) {
> +            if (hwcap2 & PPC_FEATURE2_VEC_CRYPTO) {
>                   info |= CPUINFO_CRYPTO;
>               }
>           }



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

* Re: [PATCH] util: fix build with musl libc on ppc64le
  2024-01-04 16:26 ` Philippe Mathieu-Daudé
@ 2024-01-08 21:13   ` Richard Henderson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2024-01-08 21:13 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Natanael Copa, qemu-devel
  Cc: qemu-ppc, Paolo Bonzini

On 1/5/24 03:26, Philippe Mathieu-Daudé wrote:
> Hi Natanael,
> 
> On 19/12/23 11:51, Natanael Copa wrote:
>> Use PPC_FEATURE2_ISEL and PPC_FEATURE2_VEC_CRYPTO from linux headers
>> instead of the GNU specific PPC_FEATURE2_HAS_ISEL and
>> PPC_FEATURE2_HAS_VEC_CRYPTO. This fixes build with musl libc.
>>
>> Fixes: 623d7e3551a6 (util: Add cpuinfo-ppc.c)
> 
> Hmm this commit barely moved the code. Maybe it revealed the
> issue from the following commits?
> 
> Fixes: 63922f467a ("tcg/ppc: Replace HAVE_ISEL macro with a variable")
> Fixes: 68f340d4cd ("tcg/ppc: Enable Altivec detection")
> 
> Anyhow, changes LGTM.


Queued, thanks.


r~


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

end of thread, other threads:[~2024-01-08 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 10:51 [PATCH] util: fix build with musl libc on ppc64le Natanael Copa
2024-01-04 16:26 ` Philippe Mathieu-Daudé
2024-01-08 21:13   ` Richard Henderson

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