public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PATCH 0/2] hw/misc/allwinner-cpucfg: single-binary
@ 2026-03-12 22:47 Pierrick Bouvier
  2026-03-12 22:47 ` [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code Pierrick Bouvier
  2026-03-12 22:47 ` [PATCH 2/2] hw/misc/allwinner-cpucfg.c: make compilation unit common Pierrick Bouvier
  0 siblings, 2 replies; 8+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, Peter Maydell, philmd, Pierrick Bouvier

This short series changes hw/misc/allwinner-cpucfg.c to compile it only once.

Pierrick Bouvier (2):
  target/arm/cpu.h: restrict cpu-defs.h to target specific code
  hw/misc/allwinner-cpucfg.c: make compilation unit common

 target/arm/cpu.h    | 2 ++
 hw/misc/meson.build | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
2.47.3



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

* [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code
  2026-03-12 22:47 [PATCH 0/2] hw/misc/allwinner-cpucfg: single-binary Pierrick Bouvier
@ 2026-03-12 22:47 ` Pierrick Bouvier
  2026-03-13  3:48   ` Philippe Mathieu-Daudé
  2026-03-12 22:47 ` [PATCH 2/2] hw/misc/allwinner-cpucfg.c: make compilation unit common Pierrick Bouvier
  1 sibling, 1 reply; 8+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, Peter Maydell, philmd, Pierrick Bouvier

Allow to use this header from common code, which we do in next commit.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 target/arm/cpu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 657ff4ab20b..b8042f65bb4 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -25,7 +25,9 @@
 #include "hw/core/registerfields.h"
 #include "cpu-qom.h"
 #include "exec/cpu-common.h"
+#ifdef COMPILING_PER_TARGET
 #include "exec/cpu-defs.h"
+#endif
 #include "exec/cpu-interrupt.h"
 #include "exec/gdbstub.h"
 #include "exec/page-protection.h"
-- 
2.47.3



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

* [PATCH 2/2] hw/misc/allwinner-cpucfg.c: make compilation unit common
  2026-03-12 22:47 [PATCH 0/2] hw/misc/allwinner-cpucfg: single-binary Pierrick Bouvier
  2026-03-12 22:47 ` [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code Pierrick Bouvier
@ 2026-03-12 22:47 ` Pierrick Bouvier
  2026-03-13  5:19   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 8+ messages in thread
From: Pierrick Bouvier @ 2026-03-12 22:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, Peter Maydell, philmd, Pierrick Bouvier

include "target/arm/cpu.h" is needed because of:
bool target_aa64 = arm_feature(cpu_env(target_cpu), ARM_FEATURE_AARCH64);

This file is reused between various allwinner boards, including 32 and
64 bits cpus.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/misc/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/misc/meson.build b/hw/misc/meson.build
index 96b6705b7d0..392d30b1423 100644
--- a/hw/misc/meson.build
+++ b/hw/misc/meson.build
@@ -46,7 +46,7 @@ system_ss.add(when: 'CONFIG_ALLWINNER_SRAMC', if_true: files('allwinner-sramc.c'
 system_ss.add(when: 'CONFIG_ALLWINNER_A10_CCM', if_true: files('allwinner-a10-ccm.c'))
 system_ss.add(when: 'CONFIG_ALLWINNER_A10_DRAMC', if_true: files('allwinner-a10-dramc.c'))
 system_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-ccu.c'))
-specific_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-cpucfg.c'))
+system_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-cpucfg.c'))
 system_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-dramc.c'))
 system_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-sysctrl.c'))
 system_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-sid.c'))
-- 
2.47.3



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

* Re: [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code
  2026-03-12 22:47 ` [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code Pierrick Bouvier
@ 2026-03-13  3:48   ` Philippe Mathieu-Daudé
  2026-03-13  3:58     ` Philippe Mathieu-Daudé
  2026-03-13  5:52     ` Pierrick Bouvier
  0 siblings, 2 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:48 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel; +Cc: qemu-arm, Peter Maydell

On 12/3/26 23:47, Pierrick Bouvier wrote:
> Allow to use this header from common code, which we do in next commit.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   target/arm/cpu.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index 657ff4ab20b..b8042f65bb4 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -25,7 +25,9 @@
>   #include "hw/core/registerfields.h"
>   #include "cpu-qom.h"
>   #include "exec/cpu-common.h"
> +#ifdef COMPILING_PER_TARGET
>   #include "exec/cpu-defs.h"
> +#endif

Since there are no other uses of COMPILING_PER_TARGET in this
header, this clearly mean "exec/cpu-defs.h" isn't required here
at all but elsewhere:

-- >8 --
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 657ff4ab20b..445d5a8a31d 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -25,7 +25,6 @@
  #include "hw/core/registerfields.h"
  #include "cpu-qom.h"
  #include "exec/cpu-common.h"
-#include "exec/cpu-defs.h"
  #include "exec/cpu-interrupt.h"
  #include "exec/gdbstub.h"
  #include "exec/page-protection.h"
diff --git a/include/exec/helper-head.h.inc b/include/exec/helper-head.h.inc
index 5b248fd7138..5603c9941a7 100644
--- a/include/exec/helper-head.h.inc
+++ b/include/exec/helper-head.h.inc
@@ -46,6 +46,7 @@
  #define dh_ctype(t) dh_ctype_##t

  #ifdef COMPILING_PER_TARGET
+# include "exec/cpu-defs.h"
  # ifdef TARGET_LONG_BITS
  #  if TARGET_LONG_BITS == 32
  #   define dh_alias_tl i32
---


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

* Re: [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code
  2026-03-13  3:48   ` Philippe Mathieu-Daudé
@ 2026-03-13  3:58     ` Philippe Mathieu-Daudé
  2026-03-13  6:22       ` Philippe Mathieu-Daudé
  2026-03-13  5:52     ` Pierrick Bouvier
  1 sibling, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  3:58 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel; +Cc: qemu-arm, Peter Maydell

On 13/3/26 04:48, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:47, Pierrick Bouvier wrote:
>> Allow to use this header from common code, which we do in next commit.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>   target/arm/cpu.h | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
>> index 657ff4ab20b..b8042f65bb4 100644
>> --- a/target/arm/cpu.h
>> +++ b/target/arm/cpu.h
>> @@ -25,7 +25,9 @@
>>   #include "hw/core/registerfields.h"
>>   #include "cpu-qom.h"
>>   #include "exec/cpu-common.h"
>> +#ifdef COMPILING_PER_TARGET
>>   #include "exec/cpu-defs.h"
>> +#endif
> 
> Since there are no other uses of COMPILING_PER_TARGET in this
> header, this clearly mean "exec/cpu-defs.h" isn't required here
> at all but elsewhere:
> 
> -- >8 --
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index 657ff4ab20b..445d5a8a31d 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -25,7 +25,6 @@
>   #include "hw/core/registerfields.h"
>   #include "cpu-qom.h"
>   #include "exec/cpu-common.h"
> -#include "exec/cpu-defs.h"
>   #include "exec/cpu-interrupt.h"
>   #include "exec/gdbstub.h"
>   #include "exec/page-protection.h"
> diff --git a/include/exec/helper-head.h.inc b/include/exec/helper- 
> head.h.inc
> index 5b248fd7138..5603c9941a7 100644
> --- a/include/exec/helper-head.h.inc
> +++ b/include/exec/helper-head.h.inc
> @@ -46,6 +46,7 @@
>   #define dh_ctype(t) dh_ctype_##t
> 
>   #ifdef COMPILING_PER_TARGET
> +# include "exec/cpu-defs.h"
>   # ifdef TARGET_LONG_BITS
>   #  if TARGET_LONG_BITS == 32
>   #   define dh_alias_tl i32
> ---

I'll post patches for this.


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

* Re: [PATCH 2/2] hw/misc/allwinner-cpucfg.c: make compilation unit common
  2026-03-12 22:47 ` [PATCH 2/2] hw/misc/allwinner-cpucfg.c: make compilation unit common Pierrick Bouvier
@ 2026-03-13  5:19   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  5:19 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel; +Cc: qemu-arm, Peter Maydell

On 12/3/26 23:47, Pierrick Bouvier wrote:
> include "target/arm/cpu.h" is needed because of:

The link with "target/arm/cpu.h" is not obvious from the diff.

> bool target_aa64 = arm_feature(cpu_env(target_cpu), ARM_FEATURE_AARCH64);

This is indeed simpler than my proposal of arm_cpu_has_feature():
https://lore.kernel.org/qemu-devel/59b1ccbe-9ddb-43f0-98c4-8000a08d27b0@linaro.org/

> 
> This file is reused between various allwinner boards, including 32 and
> 64 bits cpus.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/misc/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/misc/meson.build b/hw/misc/meson.build
> index 96b6705b7d0..392d30b1423 100644
> --- a/hw/misc/meson.build
> +++ b/hw/misc/meson.build
> @@ -46,7 +46,7 @@ system_ss.add(when: 'CONFIG_ALLWINNER_SRAMC', if_true: files('allwinner-sramc.c'
>   system_ss.add(when: 'CONFIG_ALLWINNER_A10_CCM', if_true: files('allwinner-a10-ccm.c'))
>   system_ss.add(when: 'CONFIG_ALLWINNER_A10_DRAMC', if_true: files('allwinner-a10-dramc.c'))
>   system_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-ccu.c'))
> -specific_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-cpucfg.c'))
> +system_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-cpucfg.c'))

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code
  2026-03-13  3:48   ` Philippe Mathieu-Daudé
  2026-03-13  3:58     ` Philippe Mathieu-Daudé
@ 2026-03-13  5:52     ` Pierrick Bouvier
  1 sibling, 0 replies; 8+ messages in thread
From: Pierrick Bouvier @ 2026-03-13  5:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: qemu-arm, Peter Maydell

On 3/12/26 8:48 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:47, Pierrick Bouvier wrote:
>> Allow to use this header from common code, which we do in next commit.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    target/arm/cpu.h | 2 ++
>>    1 file changed, 2 insertions(+)
>>
>> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
>> index 657ff4ab20b..b8042f65bb4 100644
>> --- a/target/arm/cpu.h
>> +++ b/target/arm/cpu.h
>> @@ -25,7 +25,9 @@
>>    #include "hw/core/registerfields.h"
>>    #include "cpu-qom.h"
>>    #include "exec/cpu-common.h"
>> +#ifdef COMPILING_PER_TARGET
>>    #include "exec/cpu-defs.h"
>> +#endif
> 
> Since there are no other uses of COMPILING_PER_TARGET in this
> header, this clearly mean "exec/cpu-defs.h" isn't required here
> at all but elsewhere:
> 
> -- >8 --
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index 657ff4ab20b..445d5a8a31d 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -25,7 +25,6 @@
>    #include "hw/core/registerfields.h"
>    #include "cpu-qom.h"
>    #include "exec/cpu-common.h"
> -#include "exec/cpu-defs.h"
>    #include "exec/cpu-interrupt.h"
>    #include "exec/gdbstub.h"
>    #include "exec/page-protection.h"
> diff --git a/include/exec/helper-head.h.inc b/include/exec/helper-head.h.inc
> index 5b248fd7138..5603c9941a7 100644
> --- a/include/exec/helper-head.h.inc
> +++ b/include/exec/helper-head.h.inc
> @@ -46,6 +46,7 @@
>    #define dh_ctype(t) dh_ctype_##t
> 
>    #ifdef COMPILING_PER_TARGET
> +# include "exec/cpu-defs.h"
>    # ifdef TARGET_LONG_BITS
>    #  if TARGET_LONG_BITS == 32
>    #   define dh_alias_tl i32
> ---

Yes, that's the right place.
I was tempted to moved it there, but decided to stick to target/arm/cpu 
header instead. Your idea is probably better though, feel free to send 
patches for it!


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

* Re: [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code
  2026-03-13  3:58     ` Philippe Mathieu-Daudé
@ 2026-03-13  6:22       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-13  6:22 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel; +Cc: qemu-arm, Peter Maydell

On 13/3/26 04:58, Philippe Mathieu-Daudé wrote:
> On 13/3/26 04:48, Philippe Mathieu-Daudé wrote:
>> On 12/3/26 23:47, Pierrick Bouvier wrote:
>>> Allow to use this header from common code, which we do in next commit.
>>>
>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>> ---
>>>   target/arm/cpu.h | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
>>> index 657ff4ab20b..b8042f65bb4 100644
>>> --- a/target/arm/cpu.h
>>> +++ b/target/arm/cpu.h
>>> @@ -25,7 +25,9 @@
>>>   #include "hw/core/registerfields.h"
>>>   #include "cpu-qom.h"
>>>   #include "exec/cpu-common.h"
>>> +#ifdef COMPILING_PER_TARGET
>>>   #include "exec/cpu-defs.h"
>>> +#endif
>>
>> Since there are no other uses of COMPILING_PER_TARGET in this
>> header, this clearly mean "exec/cpu-defs.h" isn't required here
>> at all but elsewhere:
>>
>> -- >8 --
>> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
>> index 657ff4ab20b..445d5a8a31d 100644
>> --- a/target/arm/cpu.h
>> +++ b/target/arm/cpu.h
>> @@ -25,7 +25,6 @@
>>   #include "hw/core/registerfields.h"
>>   #include "cpu-qom.h"
>>   #include "exec/cpu-common.h"
>> -#include "exec/cpu-defs.h"
>>   #include "exec/cpu-interrupt.h"
>>   #include "exec/gdbstub.h"
>>   #include "exec/page-protection.h"
>> diff --git a/include/exec/helper-head.h.inc b/include/exec/helper- 
>> head.h.inc
>> index 5b248fd7138..5603c9941a7 100644
>> --- a/include/exec/helper-head.h.inc
>> +++ b/include/exec/helper-head.h.inc
>> @@ -46,6 +46,7 @@
>>   #define dh_ctype(t) dh_ctype_##t
>>
>>   #ifdef COMPILING_PER_TARGET
>> +# include "exec/cpu-defs.h"
>>   # ifdef TARGET_LONG_BITS
>>   #  if TARGET_LONG_BITS == 32
>>   #   define dh_alias_tl i32
>> ---
> 
> I'll post patches for this.

Posted as series v2:
https://lore.kernel.org/qemu-devel/20260313062055.2188-1-philmd@linaro.org/


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

end of thread, other threads:[~2026-03-13  6:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 22:47 [PATCH 0/2] hw/misc/allwinner-cpucfg: single-binary Pierrick Bouvier
2026-03-12 22:47 ` [PATCH 1/2] target/arm/cpu.h: restrict cpu-defs.h to target specific code Pierrick Bouvier
2026-03-13  3:48   ` Philippe Mathieu-Daudé
2026-03-13  3:58     ` Philippe Mathieu-Daudé
2026-03-13  6:22       ` Philippe Mathieu-Daudé
2026-03-13  5:52     ` Pierrick Bouvier
2026-03-12 22:47 ` [PATCH 2/2] hw/misc/allwinner-cpucfg.c: make compilation unit common Pierrick Bouvier
2026-03-13  5:19   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox