Skip to contentSkip to conversation

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

PATCH In review Marcin Juszkiewicz 3 participants 7 messages May 24, 2023 – May 25, 2023

lore
Share & tools
lore
#0 lore raw

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

Changes since v3:
- add Bochs display to pci_vga_init() list
- use pci_vga_init() to initialize graphics in sbsa-ref as this allows to run with other vga cards as well

Marcin Juszkiewicz (2):
Add Bochs to list of vga_interfaces
hw/arm/sbsa-ref: set default display to Bochs

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

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

PATCH v4 1/3 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
#2 lore raw

PATCH v4 2/3 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.

---
 hw/pci/pci.c            | 2 ++
 include/sysemu/sysemu.h | 2 +-
 softmmu/vl.c            | 6 ++++++
 3 files changed, 9 insertions(+), 1 deletion(-)
hw/pci/pci.c +2 -0
index 1cc7c89036..edac76ea15 100644
@@ -1937,6 +1937,8 @@ PCIDevice *pci_vga_init(PCIBus *bus)
         return pci_create_simple(bus, -1, "vmware-svga");
     case VGA_VIRTIO:
         return pci_create_simple(bus, -1, "virtio-vga");
+    case VGA_BOCHS:
+        return pci_create_simple(bus, -1, "bochs-display");
     case VGA_NONE:
     default: /* Other non-PCI types. Checking for unsupported types is already
                 done in vl.c. */
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
Reviewed-by on v4 2/3
#3 lore raw

Re: [PATCH v4 2/3] Add Bochs to list of vga_interfaces

Quoted 9 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.

---
  hw/pci/pci.c            | 2 ++
  include/sysemu/sysemu.h | 2 +-
  softmmu/vl.c            | 6 ++++++
  3 files changed, 9 insertions(+), 1 deletion(-)
#4 lore raw

Re: [PATCH v4 2/3] Add Bochs to list of vga_interfaces

In reply to Marcin Juszkiewicz
Quoted 29 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.

---
 hw/pci/pci.c            | 2 ++
 include/sysemu/sysemu.h | 2 +-
 softmmu/vl.c            | 6 ++++++
 3 files changed, 9 insertions(+), 1 deletion(-)
hw/pci/pci.c +2 -0
index 1cc7c89036..edac76ea15 100644
@@ -1937,6 +1937,8 @@ PCIDevice *pci_vga_init(PCIBus *bus)
         return pci_create_simple(bus, -1, "vmware-svga");
     case VGA_VIRTIO:
         return pci_create_simple(bus, -1, "virtio-vga");
+    case VGA_BOCHS:
+        return pci_create_simple(bus, -1, "bochs-display");
     case VGA_NONE:
     default: /* Other non-PCI types. Checking for unsupported types is already
                 done in vl.c. */
include/sysemu/sysemu.h +0 -0
index 25be2a692e..9713a1b470 100644

include/sysemu/sysemu.h extern int autostart; · line 34

Quoted 7 lines
include/sysemu/sysemu.h +1 -1
@@ -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;

Is it really right that we want to add more support to this legacy-command-line-option interface? We don't list every graphics device we support here...

-- PMM

#5 lore raw

PATCH v4 3/3 hw/arm/sbsa-ref: set default display to Bochs

In reply to Marcin Juszkiewicz

This way we can use pci_vga_init() and have Bochs by default while still have an option to run with other VGA cards.

---
 hw/arm/sbsa-ref.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/arm/sbsa-ref.c +3 -2
index 9c3e670ec6..ed7ed00b3d 100644
@@ -647,9 +647,9 @@ static void create_pcie(SBSAMachineState *sms)
 
             pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
         }
-    }
 
-    pci_create_simple(pci->bus, -1, "bochs-display");
+        pci_vga_init(pci->bus);
+    }
 
     create_smmu(sms, pci->bus);
 }
@@ -863,6 +863,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
Reviewed-by on v4 3/3
#6 lore raw

Re: [PATCH v4 3/3] hw/arm/sbsa-ref: set default display to Bochs

Quoted 25 lines · Marcin Juszkiewicz

This way we can use pci_vga_init() and have Bochs by default while still have an option to run with other VGA cards.

---
  hw/arm/sbsa-ref.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
hw/arm/sbsa-ref.c +2 -2
index 9c3e670ec6..ed7ed00b3d 100644
@@ -647,9 +647,9 @@ static void create_pcie(SBSAMachineState *sms)
 
              pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
          }
-    }
 
-    pci_create_simple(pci->bus, -1, "bochs-display");
+        pci_vga_init(pci->bus);
+    }
 
      create_smmu(sms, pci->bus);
  }

hw/arm/sbsa-ref.c static void sbsa_ref_class_init(ObjectClass *oc, void *data) · line 869

Quoted 7 lines
hw/arm/sbsa-ref.c +1 -0
@@ -863,6 +863,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;