[PATCH v2 09/13] accel/tcg: Include 'accel/tcg/getpc.h' in 'exec/helper-proto'

Philippe Mathieu-Daudé posted 13 patches 6 months, 3 weeks ago
There is a newer version of this series
[PATCH v2 09/13] accel/tcg: Include 'accel/tcg/getpc.h' in 'exec/helper-proto'
Posted by Philippe Mathieu-Daudé 6 months, 3 weeks ago
Most files including "exec/helper-proto.h" call GETPC().
Include it there (in the common part) instead of the
unspecific "exec/exec-all.h" header.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/exec/exec-all.h            | 1 -
 include/exec/helper-proto-common.h | 2 ++
 accel/tcg/translate-all.c          | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 4c5ad98c6a9..816274bf905 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -26,7 +26,6 @@
 #include "exec/vaddr.h"
 
 #if defined(CONFIG_TCG)
-#include "accel/tcg/getpc.h"
 
 /**
  * probe_access:
diff --git a/include/exec/helper-proto-common.h b/include/exec/helper-proto-common.h
index 16782ef46c8..76e6c25becb 100644
--- a/include/exec/helper-proto-common.h
+++ b/include/exec/helper-proto-common.h
@@ -13,4 +13,6 @@
 #include "exec/helper-proto.h.inc"
 #undef  HELPER_H
 
+#include "accel/tcg/getpc.h"
+
 #endif /* HELPER_PROTO_COMMON_H */
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 38819a507b2..0408e2522a8 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -61,6 +61,7 @@
 #include "system/tcg.h"
 #include "qapi/error.h"
 #include "accel/tcg/cpu-ops.h"
+#include "accel/tcg/getpc.h"
 #include "tb-jmp-cache.h"
 #include "tb-hash.h"
 #include "tb-context.h"
-- 
2.47.1


Re: [PATCH v2 09/13] accel/tcg: Include 'accel/tcg/getpc.h' in 'exec/helper-proto'
Posted by Mark Cave-Ayland 6 months, 3 weeks ago
On 24/04/2025 10:46, Philippe Mathieu-Daudé wrote:

> Most files including "exec/helper-proto.h" call GETPC().
> Include it there (in the common part) instead of the
> unspecific "exec/exec-all.h" header.

Aha!

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/exec/exec-all.h            | 1 -
>   include/exec/helper-proto-common.h | 2 ++
>   accel/tcg/translate-all.c          | 1 +
>   3 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> index 4c5ad98c6a9..816274bf905 100644
> --- a/include/exec/exec-all.h
> +++ b/include/exec/exec-all.h
> @@ -26,7 +26,6 @@
>   #include "exec/vaddr.h"
>   
>   #if defined(CONFIG_TCG)
> -#include "accel/tcg/getpc.h"
>   
>   /**
>    * probe_access:
> diff --git a/include/exec/helper-proto-common.h b/include/exec/helper-proto-common.h
> index 16782ef46c8..76e6c25becb 100644
> --- a/include/exec/helper-proto-common.h
> +++ b/include/exec/helper-proto-common.h
> @@ -13,4 +13,6 @@
>   #include "exec/helper-proto.h.inc"
>   #undef  HELPER_H
>   
> +#include "accel/tcg/getpc.h"
> +
>   #endif /* HELPER_PROTO_COMMON_H */
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 38819a507b2..0408e2522a8 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -61,6 +61,7 @@
>   #include "system/tcg.h"
>   #include "qapi/error.h"
>   #include "accel/tcg/cpu-ops.h"
> +#include "accel/tcg/getpc.h"
>   #include "tb-jmp-cache.h"
>   #include "tb-hash.h"
>   #include "tb-context.h"

Moving accel/tcg/getpc.h to a more commonly used TCG header seems like 
the right idea, but then shouldn't that mean the direct includes from 
targets added in the previous commits can now be removed?


ATB,

Mark.


Re: [PATCH v2 09/13] accel/tcg: Include 'accel/tcg/getpc.h' in 'exec/helper-proto'
Posted by Philippe Mathieu-Daudé 6 months, 3 weeks ago
On 24/4/25 12:21, Mark Cave-Ayland wrote:
> On 24/04/2025 10:46, Philippe Mathieu-Daudé wrote:
> 
>> Most files including "exec/helper-proto.h" call GETPC().
>> Include it there (in the common part) instead of the
>> unspecific "exec/exec-all.h" header.
> 
> Aha!
> 
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   include/exec/exec-all.h            | 1 -
>>   include/exec/helper-proto-common.h | 2 ++
>>   accel/tcg/translate-all.c          | 1 +
>>   3 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
>> index 4c5ad98c6a9..816274bf905 100644
>> --- a/include/exec/exec-all.h
>> +++ b/include/exec/exec-all.h
>> @@ -26,7 +26,6 @@
>>   #include "exec/vaddr.h"
>>   #if defined(CONFIG_TCG)
>> -#include "accel/tcg/getpc.h"
>>   /**
>>    * probe_access:
>> diff --git a/include/exec/helper-proto-common.h b/include/exec/helper- 
>> proto-common.h
>> index 16782ef46c8..76e6c25becb 100644
>> --- a/include/exec/helper-proto-common.h
>> +++ b/include/exec/helper-proto-common.h
>> @@ -13,4 +13,6 @@
>>   #include "exec/helper-proto.h.inc"
>>   #undef  HELPER_H
>> +#include "accel/tcg/getpc.h"
>> +
>>   #endif /* HELPER_PROTO_COMMON_H */
>> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
>> index 38819a507b2..0408e2522a8 100644
>> --- a/accel/tcg/translate-all.c
>> +++ b/accel/tcg/translate-all.c
>> @@ -61,6 +61,7 @@
>>   #include "system/tcg.h"
>>   #include "qapi/error.h"
>>   #include "accel/tcg/cpu-ops.h"
>> +#include "accel/tcg/getpc.h"
>>   #include "tb-jmp-cache.h"
>>   #include "tb-hash.h"
>>   #include "tb-context.h"
> 
> Moving accel/tcg/getpc.h to a more commonly used TCG header seems like 
> the right idea, but then shouldn't that mean the direct includes from 
> targets added in the previous commits can now be removed?

$ git grep -l exec/helper-proto $(git grep -l accel/tcg/getpc.h)
accel/tcg/tcg-runtime.c
target/avr/helper.c

OK, I'll remove it from these 2 files.

Re: [PATCH v2 09/13] accel/tcg: Include 'accel/tcg/getpc.h' in 'exec/helper-proto'
Posted by Philippe Mathieu-Daudé 6 months, 3 weeks ago
On 24/4/25 13:23, Philippe Mathieu-Daudé wrote:
> On 24/4/25 12:21, Mark Cave-Ayland wrote:
>> On 24/04/2025 10:46, Philippe Mathieu-Daudé wrote:
>>
>>> Most files including "exec/helper-proto.h" call GETPC().
>>> Include it there (in the common part) instead of the
>>> unspecific "exec/exec-all.h" header.
>>
>> Aha!
>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>>   include/exec/exec-all.h            | 1 -
>>>   include/exec/helper-proto-common.h | 2 ++
>>>   accel/tcg/translate-all.c          | 1 +
>>>   3 files changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
>>> index 4c5ad98c6a9..816274bf905 100644
>>> --- a/include/exec/exec-all.h
>>> +++ b/include/exec/exec-all.h
>>> @@ -26,7 +26,6 @@
>>>   #include "exec/vaddr.h"
>>>   #if defined(CONFIG_TCG)
>>> -#include "accel/tcg/getpc.h"
>>>   /**
>>>    * probe_access:
>>> diff --git a/include/exec/helper-proto-common.h b/include/exec/ 
>>> helper- proto-common.h
>>> index 16782ef46c8..76e6c25becb 100644
>>> --- a/include/exec/helper-proto-common.h
>>> +++ b/include/exec/helper-proto-common.h
>>> @@ -13,4 +13,6 @@
>>>   #include "exec/helper-proto.h.inc"
>>>   #undef  HELPER_H
>>> +#include "accel/tcg/getpc.h"
>>> +
>>>   #endif /* HELPER_PROTO_COMMON_H */
>>> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
>>> index 38819a507b2..0408e2522a8 100644
>>> --- a/accel/tcg/translate-all.c
>>> +++ b/accel/tcg/translate-all.c
>>> @@ -61,6 +61,7 @@
>>>   #include "system/tcg.h"
>>>   #include "qapi/error.h"
>>>   #include "accel/tcg/cpu-ops.h"
>>> +#include "accel/tcg/getpc.h"
>>>   #include "tb-jmp-cache.h"
>>>   #include "tb-hash.h"
>>>   #include "tb-context.h"
>>
>> Moving accel/tcg/getpc.h to a more commonly used TCG header seems like 
>> the right idea, but then shouldn't that mean the direct includes from 
>> targets added in the previous commits can now be removed?

The files from the previous patch don't include "exec/helper-proto*.h".

> $ git grep -l exec/helper-proto $(git grep -l accel/tcg/getpc.h)
> accel/tcg/tcg-runtime.c
> target/avr/helper.c
> 
> OK, I'll remove it from these 2 files.