qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] util/cpuinfo-ppc: Add FreeBSD support
@ 2024-06-28  1:53 Brad Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Brad Smith @ 2024-06-28  1:53 UTC (permalink / raw)
  To: Richard Henderson, Paolo Bonzini; +Cc: qemu-devel

util/cpuinfo-ppc: Add FreeBSD support

Signed-off-by: default avatarBrad Smith <brad@comstyle.com>
---
 util/cpuinfo-ppc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c
index 47af55aa0c..0ad634b46f 100644
--- a/util/cpuinfo-ppc.c
+++ b/util/cpuinfo-ppc.c
@@ -14,6 +14,11 @@
 #  include "elf.h"
 # endif
 #endif
+#ifdef __FreeBSD__
+# include <machine/cpu.h>
+# define PPC_FEATURE2_ARCH_3_1		0
+# define PPC_FEATURE2_VEC_CRYPTO	PPC_FEATURE2_HAS_VEC_CRYPTO
+#endif
 
 unsigned cpuinfo;
 
@@ -28,7 +33,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
 
     info = CPUINFO_ALWAYS;
 
-#ifdef CONFIG_LINUX
+#if defined(CONFIG_LINUX) || defined(__FreeBSD__)
     unsigned long hwcap = qemu_getauxval(AT_HWCAP);
     unsigned long hwcap2 = qemu_getauxval(AT_HWCAP2);
 
-- 
2.45.2



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

* [PATCH] util/cpuinfo-ppc: Add FreeBSD support
@ 2024-06-28  2:00 Brad Smith
  2024-06-28 16:19 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Brad Smith @ 2024-06-28  2:00 UTC (permalink / raw)
  To: Richard Henderson, Paolo Bonzini; +Cc: qemu-devel

util/cpuinfo-ppc: Add FreeBSD support

Signed-off-by: Brad Smith <brad@comstyle.com>
---
With corrected sign-off.

Also this was based on the tcg-next branch.

 util/cpuinfo-ppc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c
index 47af55aa0c..0ad634b46f 100644
--- a/util/cpuinfo-ppc.c
+++ b/util/cpuinfo-ppc.c
@@ -14,6 +14,11 @@
 #  include "elf.h"
 # endif
 #endif
+#ifdef __FreeBSD__
+# include <machine/cpu.h>
+# define PPC_FEATURE2_ARCH_3_1		0
+# define PPC_FEATURE2_VEC_CRYPTO	PPC_FEATURE2_HAS_VEC_CRYPTO
+#endif
 
 unsigned cpuinfo;
 
@@ -28,7 +33,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
 
     info = CPUINFO_ALWAYS;
 
-#ifdef CONFIG_LINUX
+#if defined(CONFIG_LINUX) || defined(__FreeBSD__)
     unsigned long hwcap = qemu_getauxval(AT_HWCAP);
     unsigned long hwcap2 = qemu_getauxval(AT_HWCAP2);
 
-- 
2.45.2



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

* Re: [PATCH] util/cpuinfo-ppc: Add FreeBSD support
  2024-06-28  2:00 [PATCH] util/cpuinfo-ppc: Add FreeBSD support Brad Smith
@ 2024-06-28 16:19 ` Richard Henderson
  2024-06-29  0:50   ` Brad Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2024-06-28 16:19 UTC (permalink / raw)
  To: Brad Smith, Paolo Bonzini; +Cc: qemu-devel, Warner Losh

On 6/27/24 19:00, Brad Smith wrote:
> util/cpuinfo-ppc: Add FreeBSD support
> 
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
> With corrected sign-off.
> 
> Also this was based on the tcg-next branch.
> 
>   util/cpuinfo-ppc.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c
> index 47af55aa0c..0ad634b46f 100644
> --- a/util/cpuinfo-ppc.c
> +++ b/util/cpuinfo-ppc.c
> @@ -14,6 +14,11 @@
>   #  include "elf.h"
>   # endif
>   #endif
> +#ifdef __FreeBSD__
> +# include <machine/cpu.h>
> +# define PPC_FEATURE2_ARCH_3_1		0

I assume freebsd will eventually add this bit.
Perhaps better with ifndef?


r~

> +# define PPC_FEATURE2_VEC_CRYPTO	PPC_FEATURE2_HAS_VEC_CRYPTO
> +#endif
>   
>   unsigned cpuinfo;
>   
> @@ -28,7 +33,7 @@ unsigned __attribute__((constructor)) cpuinfo_init(void)
>   
>       info = CPUINFO_ALWAYS;
>   
> -#ifdef CONFIG_LINUX
> +#if defined(CONFIG_LINUX) || defined(__FreeBSD__)
>       unsigned long hwcap = qemu_getauxval(AT_HWCAP);
>       unsigned long hwcap2 = qemu_getauxval(AT_HWCAP2);
>   



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

* Re: [PATCH] util/cpuinfo-ppc: Add FreeBSD support
  2024-06-28 16:19 ` Richard Henderson
@ 2024-06-29  0:50   ` Brad Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Brad Smith @ 2024-06-29  0:50 UTC (permalink / raw)
  To: Richard Henderson, Paolo Bonzini; +Cc: qemu-devel, Warner Losh

On 2024-06-28 12:19 p.m., Richard Henderson wrote:
> On 6/27/24 19:00, Brad Smith wrote:
>> util/cpuinfo-ppc: Add FreeBSD support
>>
>> Signed-off-by: Brad Smith <brad@comstyle.com>
>> ---
>> With corrected sign-off.
>>
>> Also this was based on the tcg-next branch.
>>
>>   util/cpuinfo-ppc.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c
>> index 47af55aa0c..0ad634b46f 100644
>> --- a/util/cpuinfo-ppc.c
>> +++ b/util/cpuinfo-ppc.c
>> @@ -14,6 +14,11 @@
>>   #  include "elf.h"
>>   # endif
>>   #endif
>> +#ifdef __FreeBSD__
>> +# include <machine/cpu.h>
>> +# define PPC_FEATURE2_ARCH_3_1        0
>
> I assume freebsd will eventually add this bit.

Possibly. The other flags are mostly in sync with the Linux flags.
There is no Power 10 support so far.

> Perhaps better with ifndef?
I'll do so just in case.
>
>
> r~
>
>> +# define PPC_FEATURE2_VEC_CRYPTO PPC_FEATURE2_HAS_VEC_CRYPTO
>> +#endif
>>     unsigned cpuinfo;
>>   @@ -28,7 +33,7 @@ unsigned __attribute__((constructor)) 
>> cpuinfo_init(void)
>>         info = CPUINFO_ALWAYS;
>>   -#ifdef CONFIG_LINUX
>> +#if defined(CONFIG_LINUX) || defined(__FreeBSD__)
>>       unsigned long hwcap = qemu_getauxval(AT_HWCAP);
>>       unsigned long hwcap2 = qemu_getauxval(AT_HWCAP2);
>
>


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

end of thread, other threads:[~2024-06-29  0:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28  2:00 [PATCH] util/cpuinfo-ppc: Add FreeBSD support Brad Smith
2024-06-28 16:19 ` Richard Henderson
2024-06-29  0:50   ` Brad Smith
  -- strict thread matches above, loose matches on Subject: below --
2024-06-28  1:53 Brad Smith

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