diff mbox series

[3/3] hw/arm/sbsa-ref: use MachineClass->default_display

Message ID 20230524083913.696175-3-marcin.juszkiewicz@linaro.org
State New
Headers show
Series [1/3] hw/arm/sbsa-ref: honor "-vga none" argument | expand

Commit Message

Marcin Juszkiewicz May 24, 2023, 8:39 a.m. UTC
Mark the default graphica via the new MachineClass->default_display
setting so that the machine-defaults code in vl.c can decide whether the
default graphics is usable or not (for example when compiling with the
"--without-default-devices" configure switch).

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 hw/arm/sbsa-ref.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Thomas Huth May 24, 2023, 9:22 a.m. UTC | #1
On 24/05/2023 10.39, Marcin Juszkiewicz wrote:
> Mark the default graphica via the new MachineClass->default_display
> setting so that the machine-defaults code in vl.c can decide whether the
> default graphics is usable or not (for example when compiling with the
> "--without-default-devices" configure switch).
> 
> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> ---
>   hw/arm/sbsa-ref.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
> index 9a3d77d6b6..30ce7f7db4 100644
> --- a/hw/arm/sbsa-ref.c
> +++ b/hw/arm/sbsa-ref.c
> @@ -649,7 +649,7 @@ static void create_pcie(SBSAMachineState *sms)
>           }
>   
>           if (vga_interface_type != VGA_NONE) {
> -            pci_create_simple(pci->bus, -1, "bochs-display");
> +            pci_create_simple(pci->bus, -1, mc->default_display);

Based-on: <20230524082037.1620952-1-thuth@redhat.com>
(otherwise you don't have the "mc" variable available here)

>           }
>       }
>   
> @@ -865,6 +865,7 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *data)
>       mc->default_ram_size = 1 * GiB;
>       mc->default_ram_id = "sbsa-ref.ram";
>       mc->default_cpus = 4;
> +    mc->default_display = "bochs-display";

I guess this might not work as expected yet...

The code in vl.c looks through the vga_interfaces[] array and warns if it 
cannot find the default_display there... and since there is no entry for the 
bochs-display in that array, you likely now always get this warning message, 
even if it is available?

So I think you either have to drop this patch, or you've got to add an entry 
for the bochs-display to vga_interfaces[], too.

  Thomas
Thomas Huth May 24, 2023, 9:25 a.m. UTC | #2
On 24/05/2023 10.39, Marcin Juszkiewicz wrote:
> Mark the default graphica via the new MachineClass->default_display
> setting so that the machine-defaults code in vl.c can decide whether the
> default graphics is usable or not (for example when compiling with the
> "--without-default-devices" configure switch).
> 
> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
> ---
>   hw/arm/sbsa-ref.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
> index 9a3d77d6b6..30ce7f7db4 100644
> --- a/hw/arm/sbsa-ref.c
> +++ b/hw/arm/sbsa-ref.c
> @@ -649,7 +649,7 @@ static void create_pcie(SBSAMachineState *sms)
>           }
>   
>           if (vga_interface_type != VGA_NONE) {
> -            pci_create_simple(pci->bus, -1, "bochs-display");
> +            pci_create_simple(pci->bus, -1, mc->default_display);

Based-on: <20230524082037.1620952-1-thuth@redhat.com>
(otherwise you don't have the "mc" variable available here)

>           }
>       }
>   
> @@ -865,6 +865,7 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *data)
>       mc->default_ram_size = 1 * GiB;
>       mc->default_ram_id = "sbsa-ref.ram";
>       mc->default_cpus = 4;
> +    mc->default_display = "bochs-display";
>       mc->possible_cpu_arch_ids = sbsa_ref_possible_cpu_arch_ids;
>       mc->cpu_index_to_instance_props = sbsa_ref_cpu_index_to_props;
>       mc->get_default_cpu_node_id = sbsa_ref_get_default_cpu_node_id;

I guess this might not work as expected yet...

The code in vl.c looks through the vga_interfaces[] array and warns if it 
cannot find the default_display there... and since there is no entry for the 
bochs-display in that array, you likely now always get this warning message, 
even if it is available?

So I think you either have to drop this patch, or you've got to add an entry 
for the bochs-display to vga_interfaces[], too.

  Thomas
diff mbox series

Patch

diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index 9a3d77d6b6..30ce7f7db4 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -649,7 +649,7 @@  static void create_pcie(SBSAMachineState *sms)
         }
 
         if (vga_interface_type != VGA_NONE) {
-            pci_create_simple(pci->bus, -1, "bochs-display");
+            pci_create_simple(pci->bus, -1, mc->default_display);
         }
     }
 
@@ -865,6 +865,7 @@  static void sbsa_ref_class_init(ObjectClass *oc, void *data)
     mc->default_ram_size = 1 * GiB;
     mc->default_ram_id = "sbsa-ref.ram";
     mc->default_cpus = 4;
+    mc->default_display = "bochs-display";
     mc->possible_cpu_arch_ids = sbsa_ref_possible_cpu_arch_ids;
     mc->cpu_index_to_instance_props = sbsa_ref_cpu_index_to_props;
     mc->get_default_cpu_node_id = sbsa_ref_get_default_cpu_node_id;