[RFC PATCH 02/12] target/m68k: introduce env->reset_pc

Alex Bennée posted 12 patches 1 month ago
Maintainers: Thomas Huth <huth@tuxfamily.org>, Laurent Vivier <laurent@vivier.eu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, Peter Maydell <peter.maydell@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <arikalo@gmail.com>, Yoshinori Sato <yoshinori.sato@nifty.com>, Bastian Koppelmann <kbastian@rumtueddeln.de>
[RFC PATCH 02/12] target/m68k: introduce env->reset_pc
Posted by Alex Bennée 1 month ago
To transition CPUs to use the multi-phase resettable logic we need to
stash some information for the reset handlers. Arm does this with
arm_boot_info but for m68k all we really need is the PC we should
reset to.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 target/m68k/cpu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
index d9db6a486a8..fda015c4b7b 100644
--- a/target/m68k/cpu.h
+++ b/target/m68k/cpu.h
@@ -155,6 +155,7 @@ typedef struct CPUArchState {
 
     /* Fields from here on are preserved across CPU reset. */
     uint64_t features;
+    uint32_t reset_pc;
 } CPUM68KState;
 
 /*
-- 
2.47.3


Re: [RFC PATCH 02/12] target/m68k: introduce env->reset_pc
Posted by Richard Henderson 1 month ago
On 1/9/26 01:34, Alex Bennée wrote:
> To transition CPUs to use the multi-phase resettable logic we need to
> stash some information for the reset handlers. Arm does this with
> arm_boot_info but for m68k all we really need is the PC we should
> reset to.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   target/m68k/cpu.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
> index d9db6a486a8..fda015c4b7b 100644
> --- a/target/m68k/cpu.h
> +++ b/target/m68k/cpu.h
> @@ -155,6 +155,7 @@ typedef struct CPUArchState {
>   
>       /* Fields from here on are preserved across CPU reset. */
>       uint64_t features;
> +    uint32_t reset_pc;
>   } CPUM68KState;
>   
>   /*

I think this ought to merge with something else.
Just adding the field is clearly incomplete.

r~

Re: [RFC PATCH 02/12] target/m68k: introduce env->reset_pc
Posted by Richard Henderson 4 weeks ago
On 1/11/26 18:52, Richard Henderson wrote:
> On 1/9/26 01:34, Alex Bennée wrote:
>> To transition CPUs to use the multi-phase resettable logic we need to
>> stash some information for the reset handlers. Arm does this with
>> arm_boot_info but for m68k all we really need is the PC we should
>> reset to.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>   target/m68k/cpu.h | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
>> index d9db6a486a8..fda015c4b7b 100644
>> --- a/target/m68k/cpu.h
>> +++ b/target/m68k/cpu.h
>> @@ -155,6 +155,7 @@ typedef struct CPUArchState {
>>       /* Fields from here on are preserved across CPU reset. */
>>       uint64_t features;
>> +    uint32_t reset_pc;
>>   } CPUM68KState;
>>   /*
> 
> I think this ought to merge with something else.
> Just adding the field is clearly incomplete.

Nevermind, I now see how it's used for the various m68k machines.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

Re: [RFC PATCH 02/12] target/m68k: introduce env->reset_pc
Posted by Thomas Huth 1 month ago
Am Thu,  8 Jan 2026 14:34:13 +0000
schrieb Alex Bennée <alex.bennee@linaro.org>:

> To transition CPUs to use the multi-phase resettable logic we need to
> stash some information for the reset handlers. Arm does this with
> arm_boot_info but for m68k all we really need is the PC we should
> reset to.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  target/m68k/cpu.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
> index d9db6a486a8..fda015c4b7b 100644
> --- a/target/m68k/cpu.h
> +++ b/target/m68k/cpu.h
> @@ -155,6 +155,7 @@ typedef struct CPUArchState {
>  
>      /* Fields from here on are preserved across CPU reset. */
>      uint64_t features;
> +    uint32_t reset_pc;
>  } CPUM68KState;

Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Re: [RFC PATCH 02/12] target/m68k: introduce env->reset_pc
Posted by BALATON Zoltan 1 month ago
On Thu, 8 Jan 2026, Alex Bennée wrote:
> To transition CPUs to use the multi-phase resettable logic we need to
> stash some information for the reset handlers. Arm does this with
> arm_boot_info but for m68k all we really need is the PC we should
> reset to.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> target/m68k/cpu.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
> index d9db6a486a8..fda015c4b7b 100644
> --- a/target/m68k/cpu.h
> +++ b/target/m68k/cpu.h
> @@ -155,6 +155,7 @@ typedef struct CPUArchState {
>
>     /* Fields from here on are preserved across CPU reset. */
>     uint64_t features;
> +    uint32_t reset_pc;

The m64k CPUs are 32 bit but should this better use some other type like 
vaddr or hwaddr here?

Regards.
BALATON Zoltan

> } CPUM68KState;
>
> /*
>
Re: [RFC PATCH 02/12] target/m68k: introduce env->reset_pc
Posted by Alex Bennée 1 month ago
BALATON Zoltan <balaton@eik.bme.hu> writes:

> On Thu, 8 Jan 2026, Alex Bennée wrote:
>> To transition CPUs to use the multi-phase resettable logic we need to
>> stash some information for the reset handlers. Arm does this with
>> arm_boot_info but for m68k all we really need is the PC we should
>> reset to.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>> target/m68k/cpu.h | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
>> index d9db6a486a8..fda015c4b7b 100644
>> --- a/target/m68k/cpu.h
>> +++ b/target/m68k/cpu.h
>> @@ -155,6 +155,7 @@ typedef struct CPUArchState {
>>
>>     /* Fields from here on are preserved across CPU reset. */
>>     uint64_t features;
>> +    uint32_t reset_pc;
>
> The m64k CPUs are 32 bit but should this better use some other type
> like vaddr or hwaddr here?

Possibly - but the underlying env->pc is also a unint32_t so I didn't
see the point of adding more churn.

>
> Regards.
> BALATON Zoltan
>
>> } CPUM68KState;
>>
>> /*
>>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [RFC PATCH 02/12] target/m68k: introduce env->reset_pc
Posted by BALATON Zoltan 1 month ago
On Thu, 8 Jan 2026, BALATON Zoltan wrote:
> On Thu, 8 Jan 2026, Alex Bennée wrote:
>> To transition CPUs to use the multi-phase resettable logic we need to
>> stash some information for the reset handlers. Arm does this with
>> arm_boot_info but for m68k all we really need is the PC we should
>> reset to.
>> 
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>> target/m68k/cpu.h | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
>> index d9db6a486a8..fda015c4b7b 100644
>> --- a/target/m68k/cpu.h
>> +++ b/target/m68k/cpu.h
>> @@ -155,6 +155,7 @@ typedef struct CPUArchState {
>>
>>     /* Fields from here on are preserved across CPU reset. */
>>     uint64_t features;
>> +    uint32_t reset_pc;
>
> The m64k CPUs are 32 bit but should this better use some other type like 
> vaddr or hwaddr here?

Nevermind. This is matching what pc is using so that makes sense.

Regards.
BALATON Zoltan

>> } CPUM68KState;
>> 
>> /*
>