Showta Ishizaki <[email protected]> writes:

> init_proc_745(), which the 755 shares, calls register_7xx_sprs() and
> then register_745_sprs().  Since HID0 and HID1 moved into
> register_7xx_sprs(), both functions register them the same way, and
> _spr_register() asserts that no SPR is registered twice, so the 745 and
> the 755 cannot be created at all:
>
>   $ qemu-system-ppc -M none -cpu 745
>   Assertion failed: (spr->name == NULL), function _spr_register,
>   file helper_regs.c, line 419.
>
> Leave the two to register_7xx_sprs().
>
> Fixes: 0301b39c78c8 ("target/ppc: cpu_init: Deduplicate 7xx SPR registration")
> Cc: [email protected]
> Signed-off-by: Showta Ishizaki <[email protected]>
> ---
>  target/ppc/cpu_init.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index 7f3036d903e..9fb05ff265d 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -86,17 +86,10 @@ static void register_745_sprs(CPUPPCState *env)
>                   &spr_read_generic, &spr_write_generic,
>                   0x00000000);
>  
> -    /* Hardware implementation registers */
> -    spr_register(env, SPR_HID0, "HID0",
> -                 SPR_NOACCESS, SPR_NOACCESS,
> -                 &spr_read_generic, &spr_write_generic,
> -                 0x00000000);
> -
> -    spr_register(env, SPR_HID1, "HID1",
> -                 SPR_NOACCESS, SPR_NOACCESS,
> -                 &spr_read_generic, &spr_write_generic,
> -                 0x00000000);
> -
> +    /*
> +     * Hardware implementation registers.  HID0 and HID1 are registered by
> +     * register_7xx_sprs(), which init_proc_745() calls first.
> +     */
>      spr_register(env, SPR_HID2, "HID2",
>                   SPR_NOACCESS, SPR_NOACCESS,
>                   &spr_read_generic, &spr_write_generic,
>
> base-commit: 73294d096cc591e122fde9e63db4739de6d84f2b

Reviewed-by: Fabiano Rosas <[email protected]>

Reply via email to