diff mbox series

virt: set the CPU type in BOOTINFO

Message ID 20240223155742.2790252-1-laurent@vivier.eu (mailing list archive)
State New, archived
Headers show
Series virt: set the CPU type in BOOTINFO | expand

Commit Message

Laurent Vivier Feb. 23, 2024, 3:57 p.m. UTC
BI_CPUTYPE/BI_MMUTYPE/BI_FPUTYPE were statically assigned to the
68040 information.
This patch changes the code to set in bootinfo the information
provided by the command line '-cpu' parameter.

Bug: https://gitlab.com/qemu-project/qemu/-/issues/2091
Reported-by: Daniel Palmer <daniel@0x0f.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/m68k/virt.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Mark Cave-Ayland March 7, 2024, 10:19 p.m. UTC | #1
On 23/02/2024 15:57, Laurent Vivier wrote:

> BI_CPUTYPE/BI_MMUTYPE/BI_FPUTYPE were statically assigned to the
> 68040 information.
> This patch changes the code to set in bootinfo the information
> provided by the command line '-cpu' parameter.
> 
> Bug: https://gitlab.com/qemu-project/qemu/-/issues/2091
> Reported-by: Daniel Palmer <daniel@0x0f.com>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>   hw/m68k/virt.c | 17 ++++++++++++++---
>   1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
> index e2792ef46d93..b8e5e102e6b9 100644
> --- a/hw/m68k/virt.c
> +++ b/hw/m68k/virt.c
> @@ -239,9 +239,20 @@ static void virt_init(MachineState *machine)
>           param_ptr = param_blob;
>   
>           BOOTINFO1(param_ptr, BI_MACHTYPE, MACH_VIRT);
> -        BOOTINFO1(param_ptr, BI_FPUTYPE, FPU_68040);
> -        BOOTINFO1(param_ptr, BI_MMUTYPE, MMU_68040);
> -        BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68040);
> +        if (m68k_feature(&cpu->env, M68K_FEATURE_M68020)) {
> +            BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68020);
> +        } else if (m68k_feature(&cpu->env, M68K_FEATURE_M68030)) {
> +            BOOTINFO1(param_ptr, BI_MMUTYPE, MMU_68030);
> +            BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68030);
> +        } else if (m68k_feature(&cpu->env, M68K_FEATURE_M68040)) {
> +            BOOTINFO1(param_ptr, BI_FPUTYPE, FPU_68040);
> +            BOOTINFO1(param_ptr, BI_MMUTYPE, MMU_68040);
> +            BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68040);
> +        } else if (m68k_feature(&cpu->env, M68K_FEATURE_M68060)) {
> +            BOOTINFO1(param_ptr, BI_FPUTYPE, FPU_68060);
> +            BOOTINFO1(param_ptr, BI_MMUTYPE, MMU_68060);
> +            BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68060);
> +        }
>           BOOTINFO2(param_ptr, BI_MEMCHUNK, 0, ram_size);
>   
>           BOOTINFO1(param_ptr, BI_VIRT_QEMU_VERSION,

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
Philippe Mathieu-Daudé March 26, 2024, 11:59 a.m. UTC | #2
On 23/2/24 16:57, Laurent Vivier wrote:
> BI_CPUTYPE/BI_MMUTYPE/BI_FPUTYPE were statically assigned to the
> 68040 information.
> This patch changes the code to set in bootinfo the information
> provided by the command line '-cpu' parameter.
> 
> Bug: https://gitlab.com/qemu-project/qemu/-/issues/2091
> Reported-by: Daniel Palmer <daniel@0x0f.com>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>   hw/m68k/virt.c | 17 ++++++++++++++---
>   1 file changed, 14 insertions(+), 3 deletions(-)

Merged as e39a0809b9.
diff mbox series

Patch

diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index e2792ef46d93..b8e5e102e6b9 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -239,9 +239,20 @@  static void virt_init(MachineState *machine)
         param_ptr = param_blob;
 
         BOOTINFO1(param_ptr, BI_MACHTYPE, MACH_VIRT);
-        BOOTINFO1(param_ptr, BI_FPUTYPE, FPU_68040);
-        BOOTINFO1(param_ptr, BI_MMUTYPE, MMU_68040);
-        BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68040);
+        if (m68k_feature(&cpu->env, M68K_FEATURE_M68020)) {
+            BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68020);
+        } else if (m68k_feature(&cpu->env, M68K_FEATURE_M68030)) {
+            BOOTINFO1(param_ptr, BI_MMUTYPE, MMU_68030);
+            BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68030);
+        } else if (m68k_feature(&cpu->env, M68K_FEATURE_M68040)) {
+            BOOTINFO1(param_ptr, BI_FPUTYPE, FPU_68040);
+            BOOTINFO1(param_ptr, BI_MMUTYPE, MMU_68040);
+            BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68040);
+        } else if (m68k_feature(&cpu->env, M68K_FEATURE_M68060)) {
+            BOOTINFO1(param_ptr, BI_FPUTYPE, FPU_68060);
+            BOOTINFO1(param_ptr, BI_MMUTYPE, MMU_68060);
+            BOOTINFO1(param_ptr, BI_CPUTYPE, CPU_68060);
+        }
         BOOTINFO2(param_ptr, BI_MEMCHUNK, 0, ram_size);
 
         BOOTINFO1(param_ptr, BI_VIRT_QEMU_VERSION,