Skip to contentSkip to conversation

Kconfig vs. default devices

PATCH In review Fabiano Rosas 4 participants 25 messages Feb 6, 2023 – Feb 7, 2023

lore
Share & tools
lore
#0 lore raw

cover Kconfig vs. default devices

We currently have a situation where disabling a Kconfig might result in a runtime error when QEMU selects the corresponding device as a default value for an option. But first a disambiguation:

Kconfig default::
a device "Foo" for which there's "config FOO default y" or "config X imply FOO" in Kconfig.

QEMU hardcoded default::
a fallback; a device "Foo" that is chosen in case no corresponding option is given in the command line.

The issue I'm trying to solve is that there is no link between the two "defaults" above, which means that when the user at build time de-selects a Kconfig default, either via configs/devices/*/*.mak or --without-default-devices, the subsequent invocation at runtime might continue to try to create the missing device due to QEMU defaults.

Even a experienced user that tweaks the build via .mak files is not required to know about what QEMU developers chose to use as fallbacks in the code. Moreover, the person/entity that builds the code might not be the same that runs it, which makes it even more confusing.

We do have -nodefaults in the command line, but that doesn't include all types of fallbacks that might be set in the code. It also does not cover individual CONFIGs and their respective use as a fallback in the code.

So my proposal here is actually simple: Let's make sure every fallback device creation *without* a validation check gets a hard dependency in Kconfig. A validation check being something like:

if (has_defaults && object_get_class("foo") {
create_foo();
}

Fabiano Rosas (10):
vl.c: Do not add isa-parallel if it's not present hw/i386: Select E1000E for q35
hw/i386: Select VGA_PCI in Kconfig
hw/i386: Select E1000_PCI for i440fx
hw/arm: Select VIRTIO_NET for virt machine hw/arm: Select VIRTIO_BLK for virt machine hw/arm: Select XLNX_USB_SUBSYS for xlnx-zcu102 machine hw/arm: Select GICV3_TCG for sbsa-ref machine hw/arm: Select e1000e for sbsa-ref machine hw/arm: Select VGA_PCI for sbsa-ref machine

 hw/arm/Kconfig  | 7 +++++++
 hw/i386/Kconfig | 6 +++---
 softmmu/vl.c    | 3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/10 vl.c: Do not add isa-parallel if it's not present

Currently the isa-parallel driver is always added by default regardless of the presence of the actual code in the build, which can lead to a crash:

qemu-system-i386: unknown type 'isa-parallel'
Aborted (core dumped)

Check for the presence of the QOM class and do not include isa-parallel by default if it's not found.

---
 softmmu/vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
softmmu/vl.c +2 -1
index 9177d95d4e..614e6cf66e 100644
@@ -1269,7 +1269,8 @@ static void qemu_disable_default_devices(void)
     if (!has_defaults || machine_class->no_serial) {
         default_serial = 0;
     }
-    if (!has_defaults || machine_class->no_parallel) {
+    if (!has_defaults || machine_class->no_parallel ||
+        !object_class_by_name("isa-parallel")) {
         default_parallel = 0;
     }
     if (!has_defaults || machine_class->no_floppy) {
Signature · 1 line
2.35.3
#2 lore raw

Re: [PATCH 01/10] vl.c: Do not add isa-parallel if it's not present

Quoted 20 lines · Fabiano Rosas

Currently the isa-parallel driver is always added by default regardless of the presence of the actual code in the build, which can lead to a crash:

qemu-system-i386: unknown type 'isa-parallel'
Aborted (core dumped)

Check for the presence of the QOM class and do not include isa-parallel by default if it's not found.

---
  softmmu/vl.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
softmmu/vl.c +0 -0
index 9177d95d4e..614e6cf66e 100644

softmmu/vl.c static void qemu_disable_default_devices(void) · line 1276

Quoted 9 lines
softmmu/vl.c +2 -1
@@ -1269,7 +1269,8 @@ static void qemu_disable_default_devices(void)
      if (!has_defaults || machine_class->no_serial) {
          default_serial = 0;
      }
-    if (!has_defaults || machine_class->no_parallel) {
+    if (!has_defaults || machine_class->no_parallel ||
+        !object_class_by_name("isa-parallel")) {
          default_parallel = 0;
      }
      if (!has_defaults || machine_class->no_floppy) {

How is isa-parallel different, why not the other defaults?

#3 lore raw

Re: [PATCH 01/10] vl.c: Do not add isa-parallel if it's not present

Quoted 16 lines · Philippe Mathieu-Daudé
Quoted 15 lines · Fabiano Rosas

Currently the isa-parallel driver is always added by default regardless of the presence of the actual code in the build, which can lead to a crash:

qemu-system-i386: unknown type 'isa-parallel'
Aborted (core dumped)

Check for the presence of the QOM class and do not include isa-parallel by default if it's not found.

---
  softmmu/vl.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines
Quoted 5 lines
softmmu/vl.c +0 -0
index 9177d95d4e..614e6cf66e 100644

softmmu/vl.c static void qemu_disable_default_devices(void) · line 1276

Quoted 9 lines
softmmu/vl.c +2 -1
@@ -1269,7 +1269,8 @@ static void qemu_disable_default_devices(void)
      if (!has_defaults || machine_class->no_serial) {
          default_serial = 0;
      }
-    if (!has_defaults || machine_class->no_parallel) {
+    if (!has_defaults || machine_class->no_parallel ||
+        !object_class_by_name("isa-parallel")) {
          default_parallel = 0;
      }
      if (!has_defaults || machine_class->no_floppy) {

How is isa-parallel different, why not the other defaults?

I doesn't need to be different, I did it like this because I expected to solve the others in the same way. Peter also flagged the inconsistency, I'll add a Kconfig dependence like the others.

As to why the other defaults don't have this issue:

serial - for x86, already selected by CONFIG_PC;

         not used on arm;
parallel - for x86, should be selected by CONFIG_PC, I'll fix that on v2;
           not used on arm;

monitor - built in with char.c;
floppy - built in with blockdev.c;
sdcard - built in with blockdev.c;

cdrom - uses mc->block_default_type, so the CONFIG corresponding to that
device should be selected.
net - verification is only done later during machine init, so the

      machine will need to provide a fallback;

vga - uses mc->default_display, so the CONFIG corresponding to that device
should be selected.

These last three are addressed in other patches in this series (VGA_PCI, VIRTIO_*).

#4 lore raw

PATCH 2/10 hw/i386: Select E1000E for q35

In reply to Fabiano Rosas

The e1000e network adapter is the default network card for the q35 machine. Make sure that CONFIG is always selected for that machine.

---
 hw/i386/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/Kconfig +1 -1
index 1bf47b0b0b..527b95df81 100644
@@ -93,7 +93,6 @@ config Q35
     bool
     imply VTD
     imply AMD_IOMMU
-    imply E1000E_PCI_EXPRESS
     imply VMPORT
     imply VMMOUSE
     select PC_PCI
@@ -104,6 +103,7 @@ config Q35
     select DIMM
     select SMBIOS
     select FW_CFG_DMA
+    select E1000E_PCI_EXPRESS
 
 config MICROVM
     bool
Signature · 1 line
2.35.3
Reviewed-by on v1 2/10
#5 lore raw

Re: [PATCH 02/10] hw/i386: Select E1000E for q35

Quoted 21 lines · Fabiano Rosas

The e1000e network adapter is the default network card for the q35 machine. Make sure that CONFIG is always selected for that machine.

---
  hw/i386/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/Kconfig +0 -1
index 1bf47b0b0b..527b95df81 100644
@@ -93,7 +93,6 @@ config Q35
      bool
      imply VTD
      imply AMD_IOMMU
-    imply E1000E_PCI_EXPRESS
      imply VMPORT
      imply VMMOUSE
      select PC_PCI

hw/i386/Kconfig config Q35 · line 106

Quoted 4 lines
hw/i386/Kconfig +1 -0
@@ -104,6 +103,7 @@ config Q35
      select DIMM
      select SMBIOS
      select FW_CFG_DMA
+    select E1000E_PCI_EXPRESS
#6 lore raw

PATCH 3/10 hw/i386: Select VGA_PCI in Kconfig

In reply to Fabiano Rosas

Machines that have "std" as default VGA display need to always build vga-pci.c, otherwise we get a crash when CONFIG_PCI_DEVICES=n:

$ ./qemu-system-x86_64 -M q35 -vga std
qemu-system-x86_64: unknown type 'VGA'
Aborted (core dumped)
---
 hw/i386/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/Kconfig +1 -1
index 527b95df81..8e59cb6634 100644
@@ -30,9 +30,9 @@ config PC
     imply TEST_DEVICES
     imply TPM_CRB
     imply TPM_TIS_ISA
-    imply VGA_PCI
     imply VIRTIO_VGA
     imply NVDIMM
+    select VGA_PCI
     select FDC_ISA
     select I8259
     select I8254
Signature · 1 line
2.35.3
#7 lore raw

Re: [PATCH 03/10] hw/i386: Select VGA_PCI in Kconfig

Quoted 4 lines · Fabiano Rosas

Machines that have "std" as default VGA display need to always build vga-pci.c, otherwise we get a crash when CONFIG_PCI_DEVICES=n:

$ ./qemu-system-x86_64 -M q35 -vga std

I'd remove the "-vga std" in above example to show that it also crashed "by default".

Quoted 13 lines

qemu-system-x86_64: unknown type 'VGA'
Aborted (core dumped)

---
  hw/i386/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/Kconfig +0 -0
index 527b95df81..8e59cb6634 100644

hw/i386/Kconfig config PC · line 38

Quoted 10 lines
hw/i386/Kconfig +1 -1
@@ -30,9 +30,9 @@ config PC
      imply TEST_DEVICES
      imply TPM_CRB
      imply TPM_TIS_ISA
-    imply VGA_PCI
      imply VIRTIO_VGA
      imply NVDIMM
+    select VGA_PCI
      select FDC_ISA
      select I8259
      select I8254

Maybe it would be better to add it to the i440fx and the q35 machine only, so that you could still compile the isapc machine without it?

Thomas

#8 lore raw

Re: [PATCH 03/10] hw/i386: Select VGA_PCI in Kconfig

Quoted 27 lines · Thomas Huth
Quoted 4 lines · Fabiano Rosas

Machines that have "std" as default VGA display need to always build vga-pci.c, otherwise we get a crash when CONFIG_PCI_DEVICES=n:

$ ./qemu-system-x86_64 -M q35 -vga std

I'd remove the "-vga std" in above example to show that it also crashed "by default".

Quoted 18 lines

qemu-system-x86_64: unknown type 'VGA'
Aborted (core dumped)

---
  hw/i386/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/Kconfig +0 -1
index 527b95df81..8e59cb6634 100644
@@ -30,9 +30,9 @@ config PC
      imply TEST_DEVICES
      imply TPM_CRB
      imply TPM_TIS_ISA
-    imply VGA_PCI
      imply VIRTIO_VGA
Quoted 8 lines

hw/i386/Kconfig config PC · line 38

Quoted 5 lines
hw/i386/Kconfig +1 -0
      imply NVDIMM
+    select VGA_PCI
      select FDC_ISA
      select I8259
      select I8254

Maybe it would be better to add it to the i440fx and the q35 machine only, so that you could still compile the isapc machine without it?

isapc depends on i440fx, so it's will bring VGA_PCI into the build anyway.

#9 lore raw

PATCH 4/10 hw/i386: Select E1000_PCI for i440fx

In reply to Fabiano Rosas

The i440fx machines uses the e1000 adapter as the default when no other network card is configured.

Move the E1000_PCI entry in Kconfig from 'imply' to 'select' to avoid the following situation:

./qemu-system-i386 -machine pc-i440fx-8.0
qemu-system-i386: Unsupported NIC model: e1000

---
 hw/i386/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/Kconfig +1 -1
index 8e59cb6634..343783ea3e 100644
@@ -66,7 +66,6 @@ config PC_ACPI
 
 config I440FX
     bool
-    imply E1000_PCI
     imply VMPORT
     imply VMMOUSE
     select ACPI_PIIX4
@@ -78,6 +77,7 @@ config I440FX
     select DIMM
     select SMBIOS
     select FW_CFG_DMA
+    select E1000_PCI
 
 config ISAPC
     bool
Signature · 1 line
2.35.3
Reviewed-by on v1 4/10
#10 lore raw

Re: [PATCH 04/10] hw/i386: Select E1000_PCI for i440fx

Quoted 27 lines · Fabiano Rosas

The i440fx machines uses the e1000 adapter as the default when no other network card is configured.

Move the E1000_PCI entry in Kconfig from 'imply' to 'select' to avoid the following situation:

./qemu-system-i386 -machine pc-i440fx-8.0
qemu-system-i386: Unsupported NIC model: e1000

---
  hw/i386/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/Kconfig +0 -1
index 8e59cb6634..343783ea3e 100644
@@ -66,7 +66,6 @@ config PC_ACPI
 
  config I440FX
      bool
-    imply E1000_PCI
      imply VMPORT
      imply VMMOUSE
      select ACPI_PIIX4

hw/i386/Kconfig config I440FX · line 80

Quoted 4 lines
hw/i386/Kconfig +1 -0
@@ -78,6 +77,7 @@ config I440FX
      select DIMM
      select SMBIOS
      select FW_CFG_DMA
+    select E1000_PCI
#11 lore raw

PATCH 5/10 hw/arm: Select VIRTIO_NET for virt machine

In reply to Fabiano Rosas

The 'virt' machine uses virtio-net-pci as a fallback when no other network driver has been selected via command line. Select VIRTIO_NET and VIRTIO_PCI from CONFIG_ARM_VIRT to avoid errors when PCI_DEVICES=n (due to e.g. --without-default-devices):

$ ./qemu-system-aarch64 -M virt -accel tcg -cpu max
qemu-system-aarch64: Unsupported NIC model: virtio-net-pci
---
 hw/arm/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
hw/arm/Kconfig +2 -0
index 2d157de9b8..8dcc08b7ec 100644
@@ -31,6 +31,8 @@ config ARM_VIRT
     select VIRTIO_MEM_SUPPORTED
     select ACPI_CXL
     select ACPI_HMAT
+    select VIRTIO_PCI
+    select VIRTIO_NET
 
 config CHEETAH
     bool
Signature · 1 line
2.35.3
Reviewed-by on v1 5/10
#12 lore raw

Re: [PATCH 05/10] hw/arm: Select VIRTIO_NET for virt machine

Quoted 18 lines · Fabiano Rosas

The 'virt' machine uses virtio-net-pci as a fallback when no other network driver has been selected via command line. Select VIRTIO_NET and VIRTIO_PCI from CONFIG_ARM_VIRT to avoid errors when PCI_DEVICES=n (due to e.g. --without-default-devices):

$ ./qemu-system-aarch64 -M virt -accel tcg -cpu max
qemu-system-aarch64: Unsupported NIC model: virtio-net-pci
---
  hw/arm/Kconfig | 2 ++
  1 file changed, 2 insertions(+)
hw/arm/Kconfig +0 -0
index 2d157de9b8..8dcc08b7ec 100644

hw/arm/Kconfig config ARM_VIRT · line 35

Quoted 5 lines
hw/arm/Kconfig +2 -0
@@ -31,6 +31,8 @@ config ARM_VIRT
      select VIRTIO_MEM_SUPPORTED
      select ACPI_CXL
      select ACPI_HMAT
+    select VIRTIO_PCI
+    select VIRTIO_NET
#13 lore raw

PATCH 6/10 hw/arm: Select VIRTIO_BLK for virt machine

In reply to Fabiano Rosas

The virt machine has IF_VIRTIO as block_default_type, which causes the generic code to try to create a virtio-blk-pci device pair at configure_blockdev()/qemu_create_cli_devices().

Select VIRTIO_BLK and VIRTIO_PCI from CONFIG_ARM_VIRT to avoid errors when PCI_DEVICES=n (due to e.g. --without-default-devices):

$ ./qemu-system-aarch64 -M virt -accel tcg -cpu max -nodefaults -cdrom foo.qcow2
qemu-system-aarch64: -cdrom foo.qcow2: 'virtio-blk' (alias
'virtio-blk-pci') is not a valid device model name
---
 hw/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
hw/arm/Kconfig +1 -0
index 8dcc08b7ec..296d4f5176 100644
@@ -33,6 +33,7 @@ config ARM_VIRT
     select ACPI_HMAT
     select VIRTIO_PCI
     select VIRTIO_NET
+    select VIRTIO_BLK
 
 config CHEETAH
     bool
Signature · 1 line
2.35.3
#14 lore raw

Re: [PATCH 06/10] hw/arm: Select VIRTIO_BLK for virt machine

Quoted 21 lines · Fabiano Rosas

The virt machine has IF_VIRTIO as block_default_type, which causes the generic code to try to create a virtio-blk-pci device pair at configure_blockdev()/qemu_create_cli_devices().

Select VIRTIO_BLK and VIRTIO_PCI from CONFIG_ARM_VIRT to avoid errors when PCI_DEVICES=n (due to e.g. --without-default-devices):

$ ./qemu-system-aarch64 -M virt -accel tcg -cpu max -nodefaults -cdrom foo.qcow2
qemu-system-aarch64: -cdrom foo.qcow2: 'virtio-blk' (alias
'virtio-blk-pci') is not a valid device model name
---
  hw/arm/Kconfig | 1 +
  1 file changed, 1 insertion(+)
hw/arm/Kconfig +0 -0
index 8dcc08b7ec..296d4f5176 100644

hw/arm/Kconfig config ARM_VIRT · line 36

Quoted 4 lines
hw/arm/Kconfig +1 -0
@@ -33,6 +33,7 @@ config ARM_VIRT
      select ACPI_HMAT
      select VIRTIO_PCI
      select VIRTIO_NET
+    select VIRTIO_BLK

I'm a little bit torn here ... while it makes sense for me to add VIRTIO_NET so that you can run "qemu-system-aarch64 -M virt" without any additional arguments, this is now about fixing additional (convenience) CLI options that are optional ...

I assume we need those for some qtests? What about checking for virtio-blk in those tests instead?

Thomas

#15 lore raw

Re: [PATCH 06/10] hw/arm: Select VIRTIO_BLK for virt machine

Quoted 32 lines · Thomas Huth
Quoted 21 lines · Fabiano Rosas

The virt machine has IF_VIRTIO as block_default_type, which causes the generic code to try to create a virtio-blk-pci device pair at configure_blockdev()/qemu_create_cli_devices().

Select VIRTIO_BLK and VIRTIO_PCI from CONFIG_ARM_VIRT to avoid errors when PCI_DEVICES=n (due to e.g. --without-default-devices):

$ ./qemu-system-aarch64 -M virt -accel tcg -cpu max -nodefaults -cdrom foo.qcow2
qemu-system-aarch64: -cdrom foo.qcow2: 'virtio-blk' (alias
'virtio-blk-pci') is not a valid device model name
---
  hw/arm/Kconfig | 1 +
  1 file changed, 1 insertion(+)
hw/arm/Kconfig +0 -0
index 8dcc08b7ec..296d4f5176 100644

hw/arm/Kconfig config ARM_VIRT · line 36

Quoted 4 lines
hw/arm/Kconfig +1 -0
@@ -33,6 +33,7 @@ config ARM_VIRT
      select ACPI_HMAT
      select VIRTIO_PCI
      select VIRTIO_NET
+    select VIRTIO_BLK

I'm a little bit torn here ... while it makes sense for me to add VIRTIO_NET so that you can run "qemu-system-aarch64 -M virt" without any additional arguments, this is now about fixing additional (convenience) CLI options that are optional ...

Quoted 2 lines

I assume we need those for some qtests? What about checking for virtio-blk in those tests instead?

Yes, from bios-tables-test.c.

I tried hard to avoid this kind of scenario, but ultimately it's the -cdrom option that's broken, not the test.

That's just how the code was written. The -cdrom option can use virtio-blk as a backend because the virt machine has IF_VIRTIO as block_default_type. So virtio-blk is a dependency as long as -cdrom is present in the build. Unless we change something else or guard against it in the code somehow.

#16 lore raw

PATCH 7/10 hw/arm: Select XLNX_USB_SUBSYS for xlnx-zcu102 machine

In reply to Fabiano Rosas

This machine hardcodes initialization of the USB device, so select the corresponding Kconfig. It is not enough to have it as "default y if XLNX_VERSAL" at usb/Kconfig because building --without-default-devices disables the default selection resulting in:

$ ./qemu-system-aarch64 -M xlnx-zcu102
qemu-system-aarch64: missing object type 'usb_dwc3'
Aborted (core dumped)
---
 hw/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
hw/arm/Kconfig +1 -0
index 296d4f5176..552e3d04ee 100644
@@ -405,6 +405,7 @@ config XLNX_VERSAL
     select OR_IRQ
     select XLNX_BBRAM
     select XLNX_EFUSE_VERSAL
+    select XLNX_USB_SUBSYS
 
 config NPCM7XX
     bool
Signature · 1 line
2.35.3
#17 lore raw

Re: [PATCH 07/10] hw/arm: Select XLNX_USB_SUBSYS for xlnx-zcu102 machine

Quoted 20 lines · Fabiano Rosas

This machine hardcodes initialization of the USB device, so select the corresponding Kconfig. It is not enough to have it as "default y if XLNX_VERSAL" at usb/Kconfig because building --without-default-devices disables the default selection resulting in:

$ ./qemu-system-aarch64 -M xlnx-zcu102
qemu-system-aarch64: missing object type 'usb_dwc3'
Aborted (core dumped)
---
 hw/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
hw/arm/Kconfig +0 -0
index 296d4f5176..552e3d04ee 100644

hw/arm/Kconfig config XLNX_VERSAL · line 411

Quoted 7 lines
hw/arm/Kconfig +1 -0
@@ -405,6 +405,7 @@ config XLNX_VERSAL
     select OR_IRQ
     select XLNX_BBRAM
     select XLNX_EFUSE_VERSAL
+    select XLNX_USB_SUBSYS
 
 config NPCM7XX
     bool

Shouldn't we also remove the now-useless "default y if XNLX_VERSAL" line from the XLNX_USB_SUBSYS stanza ?

thanks
-- PMM

#18 lore raw

PATCH 8/10 hw/arm: Select GICV3_TCG for sbsa-ref machine

In reply to Fabiano Rosas

This machine hardcodes the creation of the interrupt controller, so make sure the dependency is explicitly described in the Kconfig.

---
 hw/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
hw/arm/Kconfig +1 -0
index 552e3d04ee..823f8b11f1 100644
@@ -232,6 +232,7 @@ config SBSA_REF
     select PL061 # GPIO
     select USB_EHCI_SYSBUS
     select WDT_SBSA
+    select ARM_GICV3_TCG
 
 config SABRELITE
     bool
Signature · 1 line
2.35.3
Reviewed-by on v1 8/10
#19 lore raw

Re: [PATCH 08/10] hw/arm: Select GICV3_TCG for sbsa-ref machine

Quoted 22 lines · Fabiano Rosas

This machine hardcodes the creation of the interrupt controller, so make sure the dependency is explicitly described in the Kconfig.

---
 hw/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
hw/arm/Kconfig +1 -1
index 552e3d04ee..823f8b11f1 100644
@@ -232,6 +232,7 @@ config SBSA_REF
     select PL061 # GPIO
     select USB_EHCI_SYSBUS
     select WDT_SBSA
+    select ARM_GICV3_TCG
 
 config SABRELITE
     bool
--
Quoted 1 line

2.35.3

thanks
-- PMM

#20 lore raw

PATCH 9/10 hw/arm: Select e1000e for sbsa-ref machine

In reply to Fabiano Rosas

This machine explicitly selects the e1000e network adapter if no other option was given in the command line. Make sure e1000e is present in the build.

---
 hw/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
hw/arm/Kconfig +1 -0
index 823f8b11f1..5022d519ea 100644
@@ -233,6 +233,7 @@ config SBSA_REF
     select USB_EHCI_SYSBUS
     select WDT_SBSA
     select ARM_GICV3_TCG
+    select E1000E_PCI_EXPRESS
 
 config SABRELITE
     bool
Signature · 1 line
2.35.3
#21 lore raw

PATCH 10/10 hw/arm: Select VGA_PCI for sbsa-ref machine

In reply to Fabiano Rosas

The sbsa-ref machine explicitly creates a VGA PCI device, so make sure vga-pci.c is included in the build.

---
 hw/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
hw/arm/Kconfig +1 -0
index 5022d519ea..74fceb419d 100644
@@ -234,6 +234,7 @@ config SBSA_REF
     select WDT_SBSA
     select ARM_GICV3_TCG
     select E1000E_PCI_EXPRESS
+    select VGA_PCI
 
 config SABRELITE
     bool
Signature · 1 line
2.35.3
Reviewed-by on v1 10/10
#22 lore raw

Re: [PATCH 10/10] hw/arm: Select VGA_PCI for sbsa-ref machine

Quoted 14 lines · Fabiano Rosas

The sbsa-ref machine explicitly creates a VGA PCI device, so make sure vga-pci.c is included in the build.

---
 hw/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
hw/arm/Kconfig +0 -0
index 5022d519ea..74fceb419d 100644

hw/arm/Kconfig config SBSA_REF · line 240

Quoted 7 lines
hw/arm/Kconfig +1 -0
@@ -234,6 +234,7 @@ config SBSA_REF
     select WDT_SBSA
     select ARM_GICV3_TCG
     select E1000E_PCI_EXPRESS
+    select VGA_PCI
 
 config SABRELITE
     bool

thanks
-- PMM

#23 lore raw
In reply to Fabiano Rosas
Quoted 29 lines · Fabiano Rosas

We currently have a situation where disabling a Kconfig might result in a runtime error when QEMU selects the corresponding device as a default value for an option. But first a disambiguation:

Kconfig default::
a device "Foo" for which there's "config FOO default y" or "config X imply FOO" in Kconfig.

QEMU hardcoded default::
a fallback; a device "Foo" that is chosen in case no corresponding option is given in the command line.

The issue I'm trying to solve is that there is no link between the two "defaults" above, which means that when the user at build time de-selects a Kconfig default, either via configs/devices/*/*.mak or --without-default-devices, the subsequent invocation at runtime might continue to try to create the missing device due to QEMU defaults.

Even a experienced user that tweaks the build via .mak files is not required to know about what QEMU developers chose to use as fallbacks in the code. Moreover, the person/entity that builds the code might not be the same that runs it, which makes it even more confusing.

We do have -nodefaults in the command line, but that doesn't include all types of fallbacks that might be set in the code. It also does not cover individual CONFIGs and their respective use as a fallback in the code.

Quoted 7 lines

So my proposal here is actually simple: Let's make sure every fallback device creation *without* a validation check gets a hard dependency in Kconfig. A validation check being something like:

if (has_defaults && object_get_class("foo") {
   create_foo();
}

So we could do one of several things to resolve any particular one of these:
(1) make the Kconfig force the device to be compiled in
(2) make QEMU silently fall back to "don't provide device" rather than "provide this default device" if the device isn't compiled in
(3) make QEMU emit an error message saying that the command line implies that the machine should have (default) device X but X support wasn't compiled in

I don't strongly care which approach we take, but shouldn't we be consistent about what we do? AFAICT your patch 1 here takes approach (2) but the others take approach (1).

thanks
-- PMM

#24 lore raw
Quoted 48 lines · Peter Maydell
Quoted 29 lines · Fabiano Rosas

We currently have a situation where disabling a Kconfig might result in a runtime error when QEMU selects the corresponding device as a default value for an option. But first a disambiguation:

Kconfig default::
a device "Foo" for which there's "config FOO default y" or "config X imply FOO" in Kconfig.

QEMU hardcoded default::
a fallback; a device "Foo" that is chosen in case no corresponding option is given in the command line.

The issue I'm trying to solve is that there is no link between the two "defaults" above, which means that when the user at build time de-selects a Kconfig default, either via configs/devices/*/*.mak or --without-default-devices, the subsequent invocation at runtime might continue to try to create the missing device due to QEMU defaults.

Even a experienced user that tweaks the build via .mak files is not required to know about what QEMU developers chose to use as fallbacks in the code. Moreover, the person/entity that builds the code might not be the same that runs it, which makes it even more confusing.

We do have -nodefaults in the command line, but that doesn't include all types of fallbacks that might be set in the code. It also does not cover individual CONFIGs and their respective use as a fallback in the code.

Quoted 7 lines

So my proposal here is actually simple: Let's make sure every fallback device creation *without* a validation check gets a hard dependency in Kconfig. A validation check being something like:

if (has_defaults && object_get_class("foo") {
   create_foo();
}

So we could do one of several things to resolve any particular one of these:
(1) make the Kconfig force the device to be compiled in
(2) make QEMU silently fall back to "don't provide device" rather than "provide this default device" if the device isn't compiled in
(3) make QEMU emit an error message saying that the command line implies that the machine should have (default) device X but X support wasn't compiled in

Quoted 3 lines

I don't strongly care which approach we take, but shouldn't we be consistent about what we do? AFAICT your patch 1 here takes approach (2) but the others take approach (1).

Good point. The one from patch 1 (isa-parallel) is a bit different since it is used in the -nodefaults logic, but I could probably use the (1) approach with it as well, let me give it a try.