Skip to contentSkip to conversation

hw/arm/sbsa-ref: sort out graphics a bit

PATCH Superseded Marcin Juszkiewicz 3 participants 11 messages May 24, 2023

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover hw/arm/sbsa-ref: sort out graphics a bit

Thomas Huth gave me some hints on how to improve sbsa-ref configuration when it comes to graphics.

With this patchset we are able to start sbsa-ref if qemu is build with "--without-default-devices" argument given to configure script.

Marcin Juszkiewicz (4):
Add Bochs to list of vga_interfaces hw/arm/sbsa-ref: honor "-vga none" argument hw/arm/sbsa-ref: add gfx card only if we have pci hw/arm/sbsa-ref: use MachineClass->default_display

Thomas Huth (1):
hw/arm: Use MachineClass->default_nic in the sbsa-ref machine

 hw/arm/sbsa-ref.c       | 11 ++++++++---
 include/sysemu/sysemu.h |  2 +-
 softmmu/vl.c            |  6 ++++++
 3 files changed, 15 insertions(+), 4 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH v3 1/5 hw/arm: Use MachineClass->default_nic in the sbsa-ref machine

From: Thomas Huth <[email protected]>

Mark the default NIC via the new MachineClass->default_nic setting so that the machine-defaults code in vl.c can decide whether the default NIC is usable or not (for example when compiling with the "--without-default-devices" configure switch).

---
 hw/arm/sbsa-ref.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/arm/sbsa-ref.c +3 -1
index 792371fdce..9c3e670ec6 100644
@@ -596,6 +596,7 @@ static void create_pcie(SBSAMachineState *sms)
     hwaddr size_mmio_high = sbsa_ref_memmap[SBSA_PCIE_MMIO_HIGH].size;
     hwaddr base_pio = sbsa_ref_memmap[SBSA_PCIE_PIO].base;
     int irq = sbsa_ref_irqmap[SBSA_PCIE];
+    MachineClass *mc = MACHINE_GET_CLASS(sms);
     MemoryRegion *mmio_alias, *mmio_alias_high, *mmio_reg;
     MemoryRegion *ecam_alias, *ecam_reg;
     DeviceState *dev;
@@ -641,7 +642,7 @@ static void create_pcie(SBSAMachineState *sms)
             NICInfo *nd = &nd_table[i];
 
             if (!nd->model) {
-                nd->model = g_strdup("e1000e");
+                nd->model = g_strdup(mc->default_nic);
             }
 
             pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
@@ -858,6 +859,7 @@ static void sbsa_ref_class_init(ObjectClass *oc, void *data)
     mc->minimum_page_bits = 12;
     mc->block_default_type = IF_IDE;
     mc->no_cdrom = 1;
+    mc->default_nic = "e1000e";
     mc->default_ram_size = 1 * GiB;
     mc->default_ram_id = "sbsa-ref.ram";
     mc->default_cpus = 4;
Signature · 1 line
2.40.1
Reviewed-by on v3 1/5
#2 lore raw

Re: [PATCH v3 1/5] hw/arm: Use MachineClass->default_nic in the sbsa-ref machine

Quoted 11 lines · Marcin Juszkiewicz

From: Thomas Huth<[email protected]>

Mark the default NIC via the new MachineClass->default_nic setting so that the machine-defaults code in vl.c can decide whether the default NIC is usable or not (for example when compiling with the "--without-default-devices" configure switch).

---
  hw/arm/sbsa-ref.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

r~

#3 lore raw

PATCH v3 2/5 Add Bochs to list of vga_interfaces

In reply to Marcin Juszkiewicz

arm/sbsa-ref uses Bochs-display graphics card and without it being present in vga_interfaces "-vga none" argument handling cannot be added.

---
 include/sysemu/sysemu.h | 2 +-
 softmmu/vl.c            | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
include/sysemu/sysemu.h +1 -1
index 25be2a692e..9713a1b470 100644
@@ -29,7 +29,7 @@ extern int autostart;
 
 typedef enum {
     VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
-    VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO,
+    VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO, VGA_BOCHS,
     VGA_TYPE_MAX,
 } VGAInterfaceType;
 
softmmu/vl.c +6 -0
index b0b96f67fa..07e6030875 100644
@@ -216,6 +216,7 @@ static struct {
     { .driver = "ati-vga",              .flag = &default_vga       },
     { .driver = "vhost-user-vga",       .flag = &default_vga       },
     { .driver = "virtio-vga-gl",        .flag = &default_vga       },
+    { .driver = "bochs-display",        .flag = &default_vga       },
 };
 
 static QemuOptsList qemu_rtc_opts = {
@@ -935,6 +936,11 @@ static const VGAInterfaceInfo vga_interfaces[VGA_TYPE_MAX] = {
         .name = "CG3 framebuffer",
         .class_names = { "cgthree" },
     },
+    [VGA_BOCHS] = {
+        .opt_name = "bochs-display",
+        .name = "Bochs framebuffer",
+        .class_names = { "bochs-display" },
+    },
 #ifdef CONFIG_XEN_BACKEND
     [VGA_XENFB] = {
         .opt_name = "xenfb",
Signature · 1 line
2.40.1
#4 lore raw

Re: [PATCH v3 2/5] Add Bochs to list of vga_interfaces

Quoted 8 lines · Marcin Juszkiewicz

arm/sbsa-ref uses Bochs-display graphics card and without it being present in vga_interfaces "-vga none" argument handling cannot be added.

---
  include/sysemu/sysemu.h | 2 +-
  softmmu/vl.c            | 6 ++++++
  2 files changed, 7 insertions(+), 1 deletion(-)

Sorry for not noticing it earlier ... but while you're at it, please also add an entry for VGA_BOCHS to pci_vga_init(), so that other machines could benefit from this automatically, too.

Thomas

Reviewed-by on v3 2/5
#5 lore raw

Re: [PATCH v3 2/5] Add Bochs to list of vga_interfaces

In reply to Marcin Juszkiewicz
Quoted 8 lines · Marcin Juszkiewicz

arm/sbsa-ref uses Bochs-display graphics card and without it being present in vga_interfaces "-vga none" argument handling cannot be added.

---
  include/sysemu/sysemu.h | 2 +-
  softmmu/vl.c            | 6 ++++++
  2 files changed, 7 insertions(+), 1 deletion(-)

r~

#6 lore raw

PATCH v3 3/5 hw/arm/sbsa-ref: honor "-vga none" argument

In reply to Marcin Juszkiewicz

In case someone wants to run without graphics card.

---
 hw/arm/sbsa-ref.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/arm/sbsa-ref.c +3 -1
index 9c3e670ec6..c540b2f1ba 100644
@@ -649,7 +649,9 @@ static void create_pcie(SBSAMachineState *sms)
         }
     }
 
-    pci_create_simple(pci->bus, -1, "bochs-display");
+    if (vga_interface_type != VGA_NONE) {
+        pci_create_simple(pci->bus, -1, "bochs-display");
+    }
 
     create_smmu(sms, pci->bus);
 }
Signature · 1 line
2.40.1
#7 lore raw

Re: [PATCH v3 3/5] hw/arm/sbsa-ref: honor "-vga none" argument

Quoted 12 lines · Marcin Juszkiewicz

In case someone wants to run without graphics card.

---
  hw/arm/sbsa-ref.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/arm/sbsa-ref.c +0 -0
index 9c3e670ec6..c540b2f1ba 100644

hw/arm/sbsa-ref.c static void create_pcie(SBSAMachineState *sms) · line 654

Quoted 7 lines
hw/arm/sbsa-ref.c +3 -1
@@ -649,7 +649,9 @@ static void create_pcie(SBSAMachineState *sms)
          }
      }
 
-    pci_create_simple(pci->bus, -1, "bochs-display");
+    if (vga_interface_type != VGA_NONE) {
+        pci_create_simple(pci->bus, -1, "bochs-display");
+    }

Once you extended pci_vga_init(), I think you should simply replace this line with pci_vga_init(pci->bus) - then you get the handling for VGA_NONE and other graphic adapters automatically (especially one could use "-vga std" to switch back to the normal VGA card that was used in former times).

Thomas

#9 lore raw

PATCH v3 4/5 hw/arm/sbsa-ref: add gfx card only if we have pci

In reply to Marcin Juszkiewicz

Creation of network card is guarded with check do we have pci bus. Do the same with graphics card.

---
 hw/arm/sbsa-ref.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/arm/sbsa-ref.c +3 -3
index c540b2f1ba..9a3d77d6b6 100644
@@ -647,10 +647,10 @@ static void create_pcie(SBSAMachineState *sms)
 
             pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
         }
-    }
 
-    if (vga_interface_type != VGA_NONE) {
-        pci_create_simple(pci->bus, -1, "bochs-display");
+        if (vga_interface_type != VGA_NONE) {
+            pci_create_simple(pci->bus, -1, "bochs-display");
+        }
     }
 
     create_smmu(sms, pci->bus);
Signature · 1 line
2.40.1
#10 lore raw

PATCH v3 5/5 hw/arm/sbsa-ref: use MachineClass->default_display

In reply to Marcin Juszkiewicz

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).

---
 hw/arm/sbsa-ref.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/sbsa-ref.c +2 -1
index 9a3d77d6b6..30ce7f7db4 100644
@@ -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;
Signature · 1 line
2.40.1