Skip to contentSkip to conversation

buildsys: Do not use internal fdt library when asked for the system one

RFC PATCH In review Philippe Mathieu-Daudé 4 participants 32 messages May 11, 2021 – May 14, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover buildsys: Do not use internal fdt library when asked for the system one

Attempt to fix the issue reported by John when building with an outdated libfdt.

For now it changes:

hw/ppc/spapr_hcall.c: In function =E2=80=98h_update_dt=E2=80=99:
hw/ppc/spapr_hcall.c:1966:9: warning: implicit declaration of function =E2=
=80=98fdt_check_full=E2=80=99; did you mean =E2=80=98fdt_check_header=E2=80= =99? [-Wimplicit-function-declaration]

   1966 |     if (fdt_check_full(fdt, cb)) {
        |         ^~~~~~~~~~~~~~
        |         fdt_check_header

hw/ppc/spapr_hcall.c:1966:9: warning: nested extern declaration of =E2=80=
=98fdt_check_full=E2=80=99 [-Wnested-externs]
[...]
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_hcall.c.o: in function=
`h_update_dt':
hw/ppc/spapr_hcall.c:1966: undefined reference to `fdt_check_full'
collect2: error: ld returned 1 exit status

by:

qemu/meson.build:1352:4: ERROR: Running configure command failed. The following clauses were found for PSERIES

CONFIG_PSERIES=3Dy
config PSERIES depends on FDT

which is not better, but one step at a time...

John said: https://gitlab.com/qemu-project/qemu/-/issues/255#note_572421108

Distributions usually don't used embedded copies of libraries, so the configure script should require the correct minimum version.

Personally I'd rather allow users to build the most of QEMU with what is available, that is all possible machines except pSeries, making pSeries machine selected by default and deselected if not possible, with this change:

-- >8 --

default-configs/devi= renamed from default-configs/devices/ppc64-softmmu.mak +0 -0

ces/ppc64-softmmu.mak
index cca52665d90..62339661fca 100644

default-configs/devices/ppc64-softmmu.mak +0 -3
@@ -5,6 +5,3 @@ include ppc-softmmu.mak
 
 # For PowerNV
 CONFIG_POWERNV=3Dy
-
-# For pSeries
-CONFIG_PSERIES=3Dy
hw/ppc/Kconfig +1 -0
index 3935b73456f..706debd4fee 100644
@@ -1,5 +1,6 @@
 config PSERIES
     bool
+    default y
     depends on FDT
     imply PCI_DEVICES
     imply TEST_DEVICES

---

But I suppose it breaks user expectations.

Thoughts?

Regards,

Phil.

Philippe Mathieu-Daud=C3=A9 (5):
hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'
Kconfig: Declare 'FDT' host symbol
hw/ppc: Have pSeries depends on libfdt (via host Kconfig FDT symbol) hw/ppc/fdt: Drop dependency on libfdt
meson: Do not use internal fdt library if user asked for the system
one

 default-configs/devices/ppc64-softmmu.mak | 1 -
 meson.build                               | 2 +-
 Kconfig.host                              | 3 +++
 hw/arm/Kconfig                            | 1 +
 hw/i386/Kconfig                           | 1 +
 hw/mem/Kconfig                            | 2 --
 hw/ppc/Kconfig                            | 2 ++
 hw/ppc/meson.build                        | 8 ++++----
 8 files changed, 12 insertions(+), 8 deletions(-)

--=20
2.26.3

#1 lore raw

RFC PATCH 1/5 hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

Per the kconfig.rst:

A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or may not be started without it.

This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol.

---
 default-configs/devices/ppc64-softmmu.mak | 1 -
 hw/arm/Kconfig                            | 1 +
 hw/i386/Kconfig                           | 1 +
 hw/mem/Kconfig                            | 2 --
 hw/ppc/Kconfig                            | 1 +
 5 files changed, 3 insertions(+), 3 deletions(-)
default-configs/devices/ppc64-softmmu.mak +0 -1
index ae0841fa3a1..cca52665d90 100644
@@ -8,4 +8,3 @@ CONFIG_POWERNV=y
 
 # For pSeries
 CONFIG_PSERIES=y
-CONFIG_NVDIMM=y
hw/arm/Kconfig +1 -0
index b887f6a5b17..67723d9ea6a 100644
@@ -6,6 +6,7 @@ config ARM_VIRT
     imply VFIO_PLATFORM
     imply VFIO_XGMAC
     imply TPM_TIS_SYSBUS
+    imply NVDIMM
     select ARM_GIC
     select ACPI
     select ARM_SMMUV3
hw/i386/Kconfig +1 -0
index 7f91f30877f..66838fa397b 100644
@@ -23,6 +23,7 @@ config PC
     imply TPM_TIS_ISA
     imply VGA_PCI
     imply VIRTIO_VGA
+    imply NVDIMM
     select FDC
     select I8259
     select I8254
hw/mem/Kconfig +0 -2
index a0ef2cf648e..8b19fdc49f1 100644
@@ -7,6 +7,4 @@ config MEM_DEVICE
 
 config NVDIMM
     bool
-    default y
-    depends on (PC || PSERIES || ARM_VIRT)
     select MEM_DEVICE
hw/ppc/Kconfig +1 -0
index e51e0e5e5ac..66e0b15d9ef 100644
@@ -3,6 +3,7 @@ config PSERIES
     imply PCI_DEVICES
     imply TEST_DEVICES
     imply VIRTIO_VGA
+    imply NVDIMM
     select DIMM
     select PCI
     select SPAPR_VSCSI
Signature · 1 line
2.26.3
#2 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

Quoted 8 lines · Philippe Mathieu-Daudé

Per the kconfig.rst:

A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or may not be started without it.

This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol.

Uh.. It should definitely be possible to start a pseries machine without NVDIMM. I would have guessed the same for PC.

Quoted 66 lines
---
 default-configs/devices/ppc64-softmmu.mak | 1 -
 hw/arm/Kconfig                            | 1 +
 hw/i386/Kconfig                           | 1 +
 hw/mem/Kconfig                            | 2 --
 hw/ppc/Kconfig                            | 1 +
 5 files changed, 3 insertions(+), 3 deletions(-)
default-configs/devices/ppc64-softmmu.mak +0 -1
index ae0841fa3a1..cca52665d90 100644
@@ -8,4 +8,3 @@ CONFIG_POWERNV=y
 
 # For pSeries
 CONFIG_PSERIES=y
-CONFIG_NVDIMM=y
hw/arm/Kconfig +1 -0
index b887f6a5b17..67723d9ea6a 100644
@@ -6,6 +6,7 @@ config ARM_VIRT
     imply VFIO_PLATFORM
     imply VFIO_XGMAC
     imply TPM_TIS_SYSBUS
+    imply NVDIMM
     select ARM_GIC
     select ACPI
     select ARM_SMMUV3
hw/i386/Kconfig +1 -0
index 7f91f30877f..66838fa397b 100644
@@ -23,6 +23,7 @@ config PC
     imply TPM_TIS_ISA
     imply VGA_PCI
     imply VIRTIO_VGA
+    imply NVDIMM
     select FDC
     select I8259
     select I8254
hw/mem/Kconfig +0 -2
index a0ef2cf648e..8b19fdc49f1 100644
@@ -7,6 +7,4 @@ config MEM_DEVICE
 
 config NVDIMM
     bool
-    default y
-    depends on (PC || PSERIES || ARM_VIRT)
     select MEM_DEVICE
hw/ppc/Kconfig +1 -0
index e51e0e5e5ac..66e0b15d9ef 100644
@@ -3,6 +3,7 @@ config PSERIES
     imply PCI_DEVICES
     imply TEST_DEVICES
     imply VIRTIO_VGA
+    imply NVDIMM
     select DIMM
     select PCI
     select SPAPR_VSCSI
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

Quoted 7 lines · David Gibson
Quoted 6 lines · Philippe Mathieu-Daudé

Per the kconfig.rst:

A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or may not be started without it.

Quoted 5 lines
Quoted 2 lines

This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol.

Uh.. It should definitely be possible to start a pseries machine without NVDIMM. I would have guessed the same for PC.

Yes, this is what this patch does. With it we can build with:
CONFIG_NVDIMM=n

Quoted 68 lines
Quoted 67 lines
---
 default-configs/devices/ppc64-softmmu.mak | 1 -
 hw/arm/Kconfig                            | 1 +
 hw/i386/Kconfig                           | 1 +
 hw/mem/Kconfig                            | 2 --
 hw/ppc/Kconfig                            | 1 +
 5 files changed, 3 insertions(+), 3 deletions(-)
default-configs/devices/ppc64-softmmu.mak +0 -1
index ae0841fa3a1..cca52665d90 100644
@@ -8,4 +8,3 @@ CONFIG_POWERNV=y
 
 # For pSeries
 CONFIG_PSERIES=y
-CONFIG_NVDIMM=y
hw/arm/Kconfig +1 -0
index b887f6a5b17..67723d9ea6a 100644
@@ -6,6 +6,7 @@ config ARM_VIRT
     imply VFIO_PLATFORM
     imply VFIO_XGMAC
     imply TPM_TIS_SYSBUS
+    imply NVDIMM
     select ARM_GIC
     select ACPI
     select ARM_SMMUV3
hw/i386/Kconfig +1 -0
index 7f91f30877f..66838fa397b 100644
@@ -23,6 +23,7 @@ config PC
     imply TPM_TIS_ISA
     imply VGA_PCI
     imply VIRTIO_VGA
+    imply NVDIMM
     select FDC
     select I8259
     select I8254
hw/mem/Kconfig +0 -2
index a0ef2cf648e..8b19fdc49f1 100644
@@ -7,6 +7,4 @@ config MEM_DEVICE
 
 config NVDIMM
     bool
-    default y
-    depends on (PC || PSERIES || ARM_VIRT)
     select MEM_DEVICE
hw/ppc/Kconfig +1 -0
index e51e0e5e5ac..66e0b15d9ef 100644
@@ -3,6 +3,7 @@ config PSERIES
     imply PCI_DEVICES
     imply TEST_DEVICES
     imply VIRTIO_VGA
+    imply NVDIMM
     select DIMM
     select PCI
     select SPAPR_VSCSI
#4 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · David Gibson
Quoted 6 lines · Philippe Mathieu-Daudé

Per the kconfig.rst:

A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or may not be started without it.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol.

Uh.. It should definitely be possible to start a pseries machine without NVDIMM. I would have guessed the same for PC.

Yes, this is what this patch does. With it we can build with:
CONFIG_NVDIMM=n

But with "imply" you could end up with a PSERIES that does not have NVDIMM when also using --without-default-devices, couldn't you? Why don't you use "select" instead of "imply" ?

Thomas

#5 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

Quoted 12 lines · Thomas Huth
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · David Gibson
Quoted 8 lines · Philippe Mathieu-Daudé

Per the kconfig.rst:

   A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or  may not be started without it.

This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Uh.. It should definitely be possible to start a pseries machine without NVDIMM.  I would have guessed the same for PC.

Yes, this is what this patch does. With it we can build with:
CONFIG_NVDIMM=n

But with "imply" you could end up with a PSERIES that does not have NVDIMM when also using --without-default-devices, couldn't you?

Not currently, because of the CONFIG_NVDIMM=y.

Quoted 1 line

Why don't you use "select" instead of "imply" ?

Because as David said earlier:

"It should definitely be possible to start a pseries machine without NVDIMM."

Reviewed-by
#6 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 12 lines · Thomas Huth
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 10 lines · David Gibson
Quoted 8 lines · Philippe Mathieu-Daudé

Per the kconfig.rst:

   A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or  may not be started without it.

This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Uh.. It should definitely be possible to start a pseries machine without NVDIMM.  I would have guessed the same for PC.

Yes, this is what this patch does. With it we can build with:
CONFIG_NVDIMM=n

But with "imply" you could end up with a PSERIES that does not have NVDIMM when also using --without-default-devices, couldn't you?

Quoted 8 lines

Not currently, because of the CONFIG_NVDIMM=y.

Quoted 1 line

Why don't you use "select" instead of "imply" ?

Because as David said earlier:

"It should definitely be possible to start a pseries machine without NVDIMM."

Oops, sorry, looks like I did not have enough coffee yet and misread David's comment ... patch looks fine, indeed.

#7 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

In reply to Thomas Huth
Quoted 15 lines · Thomas Huth
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 12 lines · David Gibson
Quoted 8 lines · Philippe Mathieu-Daudé

Per the kconfig.rst:

A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or may not be started without it.

This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol.

Uh.. It should definitely be possible to start a pseries machine without NVDIMM. I would have guessed the same for PC.

Quoted 6 lines
Quoted 2 lines

Yes, this is what this patch does. With it we can build with:
CONFIG_NVDIMM=n

But with "imply" you could end up with a PSERIES that does not have NVDIMM when also using --without-default-devices, couldn't you? Why don't you use "select" instead of "imply" ?

Oh.. clearly I misunderstand the semantics of "imply". If we don't need NVDIMM for PSERIES, why does there need to be any Kconfig connection between them at all?

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#8 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

Quoted 6 lines · David Gibson
Quoted 3 lines

But with "imply" you could end up with a PSERIES that does not have NVDIMM when also using --without-default-devices, couldn't you? Why don't you use "select" instead of "imply" ?

Oh.. clearly I misunderstand the semantics of "imply". If we don't need NVDIMM for PSERIES, why does there need to be any Kconfig connection between them at all?

Because you still want it in the binary by default (i.e. unless --without-default-devices).

Basically,

config PSERIES
imply NVDIMM

is the same as

config NVDIMM
default y if PSERIES

Both of them are a way to say "PSERIES can work with NVDIMM so you want to include it unless you want some fine tuning". In Linux "imply" is very rarely used, while in QEMU it's quite common because it keeps the many per-board defaults close together.

Paolo

#9 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

Quoted 13 lines · Paolo Bonzini
Quoted 6 lines · David Gibson
Quoted 3 lines

But with "imply" you could end up with a PSERIES that does not have NVDIMM when also using --without-default-devices, couldn't you? Why don't you use "select" instead of "imply" ?

Oh.. clearly I misunderstand the semantics of "imply". If we don't need NVDIMM for PSERIES, why does there need to be any Kconfig connection between them at all?

Because you still want it in the binary by default (i.e. unless --without-default-devices).

Basically,

Quoted 7 lines

config PSERIES
imply NVDIMM

is the same as

config NVDIMM
default y if PSERIES

Ah, ok, I get it now. "imply" is a terrible word for this, but ok.

Quoted 7 lines

Both of them are a way to say "PSERIES can work with NVDIMM so you want to include it unless you want some fine tuning". In Linux "imply" is very rarely used, while in QEMU it's quite common because it keeps the many per-board defaults close together.

Paolo

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#10 lore raw

Re: [RFC PATCH 1/5] hw/mem/nvdimm: Use Kconfig 'imply' instead of 'depends on'

In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

Per the kconfig.rst:

A device should be listed [...] ``imply`` if (depending on the QEMU command line) the board may or may not be started without it.

This is the case with the NVDIMM device, so use the 'imply' weak reverse dependency to select the symbol.

Unrelated to the rest, so I've queued this one.

Paolo

Quoted 65 lines
---
  default-configs/devices/ppc64-softmmu.mak | 1 -
  hw/arm/Kconfig                            | 1 +
  hw/i386/Kconfig                           | 1 +
  hw/mem/Kconfig                            | 2 --
  hw/ppc/Kconfig                            | 1 +
  5 files changed, 3 insertions(+), 3 deletions(-)
default-configs/devices/ppc64-softmmu.mak +0 -1
index ae0841fa3a1..cca52665d90 100644
@@ -8,4 +8,3 @@ CONFIG_POWERNV=y
 
  # For pSeries
  CONFIG_PSERIES=y
-CONFIG_NVDIMM=y
hw/arm/Kconfig +1 -0
index b887f6a5b17..67723d9ea6a 100644
@@ -6,6 +6,7 @@ config ARM_VIRT
      imply VFIO_PLATFORM
      imply VFIO_XGMAC
      imply TPM_TIS_SYSBUS
+    imply NVDIMM
      select ARM_GIC
      select ACPI
      select ARM_SMMUV3
hw/i386/Kconfig +1 -0
index 7f91f30877f..66838fa397b 100644
@@ -23,6 +23,7 @@ config PC
      imply TPM_TIS_ISA
      imply VGA_PCI
      imply VIRTIO_VGA
+    imply NVDIMM
      select FDC
      select I8259
      select I8254
hw/mem/Kconfig +0 -2
index a0ef2cf648e..8b19fdc49f1 100644
@@ -7,6 +7,4 @@ config MEM_DEVICE
 
  config NVDIMM
      bool
-    default y
-    depends on (PC || PSERIES || ARM_VIRT)
      select MEM_DEVICE
hw/ppc/Kconfig +1 -0
index e51e0e5e5ac..66e0b15d9ef 100644
@@ -3,6 +3,7 @@ config PSERIES
      imply PCI_DEVICES
      imply TEST_DEVICES
      imply VIRTIO_VGA
+    imply NVDIMM
      select DIMM
      select PCI
      select SPAPR_VSCSI
#11 lore raw

RFC PATCH 2/5 Kconfig: Declare 'FDT' host symbol

In reply to Philippe Mathieu-Daudé

The CONFIG_FDT symbol depends on the availability of the fdt library on the host. To be able to have other symbols depends on it, declare it symbol in Kconfig.host.

---
 Kconfig.host | 3 +++
 1 file changed, 3 insertions(+)
Kconfig.host +3 -0
index 24255ef4419..0a512696865 100644
@@ -41,3 +41,6 @@ config PVRDMA
 config MULTIPROCESS_ALLOWED
     bool
     imply MULTIPROCESS
+
+config FDT
+    bool
Signature · 1 line
2.26.3
#12 lore raw

Re: [RFC PATCH 2/5] Kconfig: Declare 'FDT' host symbol

Quoted 15 lines · Philippe Mathieu-Daudé

The CONFIG_FDT symbol depends on the availability of the fdt library on the host. To be able to have other symbols depends on it, declare it symbol in Kconfig.host.

---
  Kconfig.host | 3 +++
  1 file changed, 3 insertions(+)
Kconfig.host +0 -0
index 24255ef4419..0a512696865 100644

Kconfig.host config PVRDMA · line 46

Quoted 6 lines
Kconfig.host +3 -0
@@ -41,3 +41,6 @@ config PVRDMA
  config MULTIPROCESS_ALLOWED
      bool
      imply MULTIPROCESS
+
+config FDT
+    bool

You need to add it to host_kconfig as well, don't you?

Paolo

#13 lore raw

RFC PATCH 3/5 hw/ppc: Have pSeries depends on libfdt (via host Kconfig FDT symbol)

In reply to Philippe Mathieu-Daudé

Since commit fea35ca4b8e ("ppc/spapr: Receive and store device tree blob from SLOF") the pSeries machine depends on the libfdt fdt_check_full() call, which is available in libfdt v1.4.7.

Add the corresponding Kconfig dependency.

---
 hw/ppc/Kconfig     | 1 +
 hw/ppc/meson.build | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
hw/ppc/Kconfig +1 -0
index 66e0b15d9ef..3935b73456f 100644
@@ -1,5 +1,6 @@
 config PSERIES
     bool
+    depends on FDT
     imply PCI_DEVICES
     imply TEST_DEVICES
     imply VIRTIO_VGA
hw/ppc/meson.build +2 -2
index 86d6f379d1c..e82a6b4105b 100644
@@ -9,7 +9,7 @@
 ppc_ss.add(when: 'CONFIG_FW_CFG_PPC', if_true: files('fw_cfg.c'))
 
 # IBM pSeries (sPAPR)
-ppc_ss.add(when: 'CONFIG_PSERIES', if_true: files(
+ppc_ss.add(when: 'CONFIG_PSERIES', if_true: [files(
   'spapr.c',
   'spapr_caps.c',
   'spapr_vio.c',
@@ -28,7 +28,7 @@
   'spapr_rtas_ddw.c',
   'spapr_numa.c',
   'pef.c',
-))
+), fdt])
 ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c'))
 ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files(
   'spapr_pci_vfio.c',
Signature · 1 line
2.26.3
#14 lore raw

Re: [RFC PATCH 3/5] hw/ppc: Have pSeries depends on libfdt (via host Kconfig FDT symbol)

Quoted 7 lines · Philippe Mathieu-Daudé

Since commit fea35ca4b8e ("ppc/spapr: Receive and store device tree blob from SLOF") the pSeries machine depends on the libfdt fdt_check_full() call, which is available in libfdt v1.4.7.

Add the corresponding Kconfig dependency.

I don't love making this conditional. Pseries is by far the best tested and most widely used ppc machine type, so it seems like it would break expectations to not compile this in rather than giving an error saying you need a newer libfdt.

Quoted 38 lines
---
 hw/ppc/Kconfig     | 1 +
 hw/ppc/meson.build | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
hw/ppc/Kconfig +1 -0
index 66e0b15d9ef..3935b73456f 100644
@@ -1,5 +1,6 @@
 config PSERIES
     bool
+    depends on FDT
     imply PCI_DEVICES
     imply TEST_DEVICES
     imply VIRTIO_VGA
hw/ppc/meson.build +2 -2
index 86d6f379d1c..e82a6b4105b 100644
@@ -9,7 +9,7 @@
 ppc_ss.add(when: 'CONFIG_FW_CFG_PPC', if_true: files('fw_cfg.c'))
 
 # IBM pSeries (sPAPR)
-ppc_ss.add(when: 'CONFIG_PSERIES', if_true: files(
+ppc_ss.add(when: 'CONFIG_PSERIES', if_true: [files(
   'spapr.c',
   'spapr_caps.c',
   'spapr_vio.c',
@@ -28,7 +28,7 @@
   'spapr_rtas_ddw.c',
   'spapr_numa.c',
   'pef.c',
-))
+), fdt])
 ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c'))
 ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files(
   'spapr_pci_vfio.c',
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#15 lore raw

Re: [RFC PATCH 3/5] hw/ppc: Have pSeries depends on libfdt (via host Kconfig FDT symbol)

Quoted 5 lines · David Gibson
Quoted 4 lines · Philippe Mathieu-Daudé

Since commit fea35ca4b8e ("ppc/spapr: Receive and store device tree blob from SLOF") the pSeries machine depends on the libfdt fdt_check_full() call, which is available in libfdt v1.4.7.

Quoted 7 lines
Quoted 3 lines

Add the corresponding Kconfig dependency.

I don't love making this conditional. Pseries is by far the best tested and most widely used ppc machine type, so it seems like it would break expectations to not compile this in rather than giving an error saying you need a newer libfdt.

It's not conditional; if libfdt is not found, scripts/minikconf.py will tell you about the contradiction between CONFIG_PSERIES=y and "CONFIG_PSERIES depends on FDT".

So we still have the same "fdt_required" logic that is already in meson.build, but expressed as Kconfig rules instead of a random line in default-configs/targets.

Paolo

#16 lore raw

Re: [RFC PATCH 3/5] hw/ppc: Have pSeries depends on libfdt (via host Kconfig FDT symbol)

Quoted 14 lines · Paolo Bonzini
Quoted 5 lines · David Gibson
Quoted 4 lines · Philippe Mathieu-Daudé

Since commit fea35ca4b8e ("ppc/spapr: Receive and store device tree blob from SLOF") the pSeries machine depends on the libfdt fdt_check_full() call, which is available in libfdt v1.4.7.

Quoted 7 lines
Quoted 3 lines

Add the corresponding Kconfig dependency.

I don't love making this conditional. Pseries is by far the best tested and most widely used ppc machine type, so it seems like it would break expectations to not compile this in rather than giving an error saying you need a newer libfdt.

Quoted 7 lines

It's not conditional; if libfdt is not found, scripts/minikconf.py will tell you about the contradiction between CONFIG_PSERIES=y and "CONFIG_PSERIES depends on FDT".

So we still have the same "fdt_required" logic that is already in meson.build, but expressed as Kconfig rules instead of a random line in default-configs/targets.

Oh, ok.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#17 lore raw

Re: [RFC PATCH 3/5] hw/ppc: Have pSeries depends on libfdt (via host Kconfig FDT symbol)

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

Since commit fea35ca4b8e ("ppc/spapr: Receive and store device tree blob from SLOF") the pSeries machine depends on the libfdt fdt_check_full() call, which is available in libfdt v1.4.7.

Add the corresponding Kconfig dependency.

This is not the only one though. In particular, there should be a "depends on" also for MIPS_BOSTON (hw/mips), E500 (hw/ppc), POWERNV, PPC440 (hw/ppc), (hw/ppc), SAM460EX (hw/ppc), VIRTEX (hw/ppc), RX_GDBSIM (hw/rx), XTENSA_XTFPGA (hw/xtensa).

Once you do this, TARGET_NEED_FDT can go away for PPC, MIPS and. The remaining ones use fdt functions in hw/*/boot.c so they need libfdt unconditionally RX (and TARGET_NEED_FDT should be added to default-configs/targets/nios2-softmmu.mak for the same reason).

Paolo

Quoted 39 lines
---
  hw/ppc/Kconfig     | 1 +
  hw/ppc/meson.build | 4 ++--
  2 files changed, 3 insertions(+), 2 deletions(-)
hw/ppc/Kconfig +1 -0
index 66e0b15d9ef..3935b73456f 100644
@@ -1,5 +1,6 @@
  config PSERIES
      bool
+    depends on FDT
      imply PCI_DEVICES
      imply TEST_DEVICES
      imply VIRTIO_VGA
hw/ppc/meson.build +2 -2
index 86d6f379d1c..e82a6b4105b 100644
@@ -9,7 +9,7 @@
  ppc_ss.add(when: 'CONFIG_FW_CFG_PPC', if_true: files('fw_cfg.c'))
 
  # IBM pSeries (sPAPR)
-ppc_ss.add(when: 'CONFIG_PSERIES', if_true: files(
+ppc_ss.add(when: 'CONFIG_PSERIES', if_true: [files(
    'spapr.c',
    'spapr_caps.c',
    'spapr_vio.c',
@@ -28,7 +28,7 @@
    'spapr_rtas_ddw.c',
    'spapr_numa.c',
    'pef.c',
-))
+), fdt])
  ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c'))
  ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files(
    'spapr_pci_vfio.c',
#18 lore raw

Re: [RFC PATCH 3/5] hw/ppc: Have pSeries depends on libfdt (via host Kconfig FDT symbol)

Quoted 14 lines · Paolo Bonzini
Quoted 7 lines · Philippe Mathieu-Daudé

Since commit fea35ca4b8e ("ppc/spapr: Receive and store device tree blob from SLOF") the pSeries machine depends on the libfdt fdt_check_full() call, which is available in libfdt v1.4.7.

Add the corresponding Kconfig dependency.

This is not the only one though.  In particular, there should be a "depends on" also for MIPS_BOSTON (hw/mips), E500 (hw/ppc), POWERNV, PPC440 (hw/ppc), (hw/ppc), SAM460EX (hw/ppc), VIRTEX (hw/ppc), RX_GDBSIM (hw/rx), XTENSA_XTFPGA (hw/xtensa).

Quoted 4 lines

Once you do this, TARGET_NEED_FDT can go away for PPC, MIPS and.  The remaining ones use fdt functions in hw/*/boot.c so they need libfdt unconditionally RX (and TARGET_NEED_FDT should be added to default-configs/targets/nios2-softmmu.mak for the same reason).

Got it, thanks!

#19 lore raw

RFC PATCH 4/5 hw/ppc/fdt: Drop dependency on libfdt

In reply to Philippe Mathieu-Daudé

hw/ppc/fdt.c defines the ppc_create_page_sizes_prop() function, which is unrelated to the libfdt. Remove the incorrect library dependency on the file.

---
 hw/ppc/meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/meson.build +2 -2
index e82a6b4105b..580e6e42c8a 100644
@@ -3,9 +3,9 @@
   'ppc.c',
   'ppc_booke.c',
 ))
-ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: [files(
+ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: files(
   'fdt.c',
-), fdt])
+))
 ppc_ss.add(when: 'CONFIG_FW_CFG_PPC', if_true: files('fw_cfg.c'))
 
 # IBM pSeries (sPAPR)
Signature · 1 line
2.26.3
#20 lore raw

Re: [RFC PATCH 4/5] hw/ppc/fdt: Drop dependency on libfdt

Quoted 5 lines · Philippe Mathieu-Daudé

hw/ppc/fdt.c defines the ppc_create_page_sizes_prop() function, which is unrelated to the libfdt. Remove the incorrect library dependency on the file.

This is definitely wrong as it stands. AFAICT this doesn't add a build of hw/ppc/fdt.c anywhere, but it is definitely needed by both pseries and powernv machine types, who select FDT_PPC for this exact reason.

I will grant you that it is badly named. It is in fact related to libfdt, just rather indirectly.

Quoted 20 lines
---
 hw/ppc/meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/meson.build +2 -2
index e82a6b4105b..580e6e42c8a 100644
@@ -3,9 +3,9 @@
   'ppc.c',
   'ppc_booke.c',
 ))
-ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: [files(
+ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: files(
   'fdt.c',
-), fdt])
+))
 ppc_ss.add(when: 'CONFIG_FW_CFG_PPC', if_true: files('fw_cfg.c'))
 
 # IBM pSeries (sPAPR)
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#21 lore raw

Re: [RFC PATCH 4/5] hw/ppc/fdt: Drop dependency on libfdt

Quoted 7 lines · David Gibson
Quoted 5 lines · Philippe Mathieu-Daudé

hw/ppc/fdt.c defines the ppc_create_page_sizes_prop() function, which is unrelated to the libfdt. Remove the incorrect library dependency on the file.

Quoted 7 lines

This is definitely wrong as it stands. AFAICT this doesn't add a build of hw/ppc/fdt.c anywhere, but it is definitely needed by both pseries and powernv machine types, who select FDT_PPC for this exact reason.

I will grant you that it is badly named. It is in fact related to libfdt, just rather indirectly.

The patch makes sense in general. The file is only needed for pseries and powernv, not for e.g. e500 which does need fdt.

I would get rid of FDT_PPC completely. First, before patch 3, you can move fdt.c to PSERIES and POWERNV (it's too small to need its own Kconfig symbol) and only leave

ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: fdt)

Since you are at it, remove the silly #ifdef TARGET_PPC64 in the hw/ppc/fdt.c file.

Then in patch 3:

- add to Kconfig.host

config FDT
bool

config LIBFDT
bool
depends on FDT

- for all the boards I listed in my review, add "select LIBFDT" in addition to "depends on FDT".

- add to meson.build

softmmu_ss.add(when: 'CONFIG_LIBFDT', if_true: fdt)

Paolo

Quoted 21 lines
Quoted 20 lines
---
  hw/ppc/meson.build | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/meson.build +2 -2
index e82a6b4105b..580e6e42c8a 100644
@@ -3,9 +3,9 @@
    'ppc.c',
    'ppc_booke.c',
  ))
-ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: [files(
+ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: files(
    'fdt.c',
-), fdt])
+))
  ppc_ss.add(when: 'CONFIG_FW_CFG_PPC', if_true: files('fw_cfg.c'))
 
  # IBM pSeries (sPAPR)
#22 lore raw

Re: [RFC PATCH 4/5] hw/ppc/fdt: Drop dependency on libfdt

Quoted 13 lines · Paolo Bonzini
Quoted 12 lines · David Gibson
Quoted 5 lines · Philippe Mathieu-Daudé

hw/ppc/fdt.c defines the ppc_create_page_sizes_prop() function, which is unrelated to the libfdt. Remove the incorrect library dependency on the file.

This is definitely wrong as it stands. AFAICT this doesn't add a build of hw/ppc/fdt.c anywhere, but it is definitely needed by both pseries and powernv machine types, who select FDT_PPC for this exact reason.

Quoted 5 lines
Quoted 2 lines

I will grant you that it is badly named. It is in fact related to libfdt, just rather indirectly.

The patch makes sense in general. The file is only needed for pseries and powernv, not for e.g. e500 which does need fdt.

Yes, agreed.

Quoted 5 lines

I would get rid of FDT_PPC completely. First, before patch 3, you can move fdt.c to PSERIES and POWERNV (it's too small to need its own Kconfig symbol) and only leave

ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: fdt)

Uh... why do we need even this?

Quoted 5 lines

Since you are at it, remove the silly #ifdef TARGET_PPC64 in the hw/ppc/fdt.c file.

Then in patch 3:

Quoted 8 lines

- add to Kconfig.host

config FDT
bool

config LIBFDT
bool
depends on FDT

Um.. I'm not sure what semantic difference you're envisaging between FDT and LIBFDT.

Quoted 30 lines

- for all the boards I listed in my review, add "select LIBFDT" in addition to "depends on FDT".

- add to meson.build

softmmu_ss.add(when: 'CONFIG_LIBFDT', if_true: fdt)

Paolo

Quoted 20 lines
Quoted 19 lines
---
  hw/ppc/meson.build | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/meson.build +2 -2
index e82a6b4105b..580e6e42c8a 100644
@@ -3,9 +3,9 @@
    'ppc.c',
    'ppc_booke.c',
  ))
-ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: [files(
+ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: files(
    'fdt.c',
-), fdt])
+))
  ppc_ss.add(when: 'CONFIG_FW_CFG_PPC', if_true: files('fw_cfg.c'))
  # IBM pSeries (sPAPR)
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#23 lore raw

Re: [RFC PATCH 4/5] hw/ppc/fdt: Drop dependency on libfdt

Quoted 5 lines · David Gibson
Quoted 2 lines

The patch makes sense in general. The file is only needed for pseries and powernv, not for e.g. e500 which does need fdt.

Yes, agreed.

Quoted 7 lines
Quoted 5 lines

I would get rid of FDT_PPC completely. First, before patch 3, you can move fdt.c to PSERIES and POWERNV (it's too small to need its own Kconfig symbol) and only leave

ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: fdt)

Uh... why do we need even this?

To tell Meson that a board requires QEMU to be linked with libfdt. This symbol is then renamed to CONFIG_LIBFDT once it can be used with all targets (rather than just hw/ppc).

Quoted 10 lines
Quoted 10 lines

Since you are at it, remove the silly #ifdef TARGET_PPC64 in the hw/ppc/fdt.c file.

Then in patch 3:

- add to Kconfig.host

config FDT
bool

Quoted 6 lines
Quoted 3 lines

config LIBFDT
bool
depends on FDT

Um.. I'm not sure what semantic difference you're envisaging between FDT and LIBFDT.

"FDT" is set by meson.build if the library is available, LIBFDT is set by the board to link with the library. In other words CONFIG_FDT is per-build, while CONFIG_LIBFDT is per-target.

If a board selects LIBFDT but the library is not available, minikconf will report a contradiction due to "CONFIG_PSERIES=y" -> "config PSERIES select LIBFDT" -> "config LIBFDT depends on FDT" -> "CONFIG_FDT=n".

Quoted 2 lines
Quoted 2 lines

- for all the boards I listed in my review, add "select LIBFDT" in addition to "depends on FDT".

This is actually unnecessary---"depends on FDT" is not needed in the boards because LIBFDT already has the dependency.

Paolo

#24 lore raw

Re: [RFC PATCH 4/5] hw/ppc/fdt: Drop dependency on libfdt

Quoted 10 lines · Paolo Bonzini
Quoted 9 lines · David Gibson
Quoted 2 lines

The patch makes sense in general. The file is only needed for pseries and powernv, not for e.g. e500 which does need fdt.

Yes, agreed.

Quoted 4 lines

I would get rid of FDT_PPC completely. First, before patch 3, you can move fdt.c to PSERIES and POWERNV (it's too small to need its own Kconfig symbol) and only leave

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

ppc_ss.add(when: 'CONFIG_FDT_PPC', if_true: fdt)

Uh... why do we need even this?

To tell Meson that a board requires QEMU to be linked with libfdt. This symbol is then renamed to CONFIG_LIBFDT once it can be used with all targets (rather than just hw/ppc).

Oh, I thought CONFIG_LIBFDT already did that.

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

Since you are at it, remove the silly #ifdef TARGET_PPC64 in the hw/ppc/fdt.c file.

Then in patch 3:

- add to Kconfig.host

config FDT
bool

config LIBFDT
bool
depends on FDT

Quoted 6 lines
Quoted 2 lines

Um.. I'm not sure what semantic difference you're envisaging between FDT and LIBFDT.

"FDT" is set by meson.build if the library is available, LIBFDT is set by the board to link with the library. In other words CONFIG_FDT is per-build, while CONFIG_LIBFDT is per-target.

Oof... that's highly non-obvious. Could we call it HAVE_LIBFDT and USE_LIBFDT instead?

Quoted 12 lines

If a board selects LIBFDT but the library is not available, minikconf will report a contradiction due to "CONFIG_PSERIES=y" -> "config PSERIES select LIBFDT" -> "config LIBFDT depends on FDT" -> "CONFIG_FDT=n".

Quoted 2 lines
Quoted 2 lines

- for all the boards I listed in my review, add "select LIBFDT" in addition to "depends on FDT".

This is actually unnecessary---"depends on FDT" is not needed in the boards because LIBFDT already has the dependency.

Paolo

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#25 lore raw

Re: [RFC PATCH 4/5] hw/ppc/fdt: Drop dependency on libfdt

Quoted 6 lines · David Gibson
Quoted 3 lines

"FDT" is set by meson.build if the library is available, LIBFDT is set by the board to link with the library. In other words CONFIG_FDT is per-build, while CONFIG_LIBFDT is per-target.

Oof... that's highly non-obvious. Could we call it HAVE_LIBFDT and USE_LIBFDT instead?

Certainly okay by me.

Paolo

#26 lore raw

Re: [RFC PATCH 4/5] hw/ppc/fdt: Drop dependency on libfdt

Quoted 8 lines · Paolo Bonzini
Quoted 7 lines · David Gibson
Quoted 5 lines

"FDT" is set by meson.build if the library is available, LIBFDT is set by
the board to link with the library.  In other words CONFIG_FDT is per-build,
while CONFIG_LIBFDT is per-target.

Oof... that's highly non-obvious.  Could we call it HAVE_LIBFDT and USE_LIBFDT instead?

Just to be sure I understood correctly, for the next version I'll use HAVE_LIBFDT for the build-related logic (Meson) and USE_LIBFDT for the per-target dependencies (Kconfig).
(Only reply if I misunderstood).

Quoted 4 lines

Certainly okay by me.

Paolo

#27 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 2 lines · Philippe Mathieu-Daudé

Attempt to fix the issue reported by John when building with an outdated libfdt.

Unencoded version of this cover:

For now it changes:

hw/ppc/spapr_hcall.c: In function ‘h_update_dt’:
hw/ppc/spapr_hcall.c:1966:9: warning: implicit declaration of function
‘fdt_check_full’; did you mean ‘fdt_check_header’? [-Wimplicit-function-declaration]

   1966 |     if (fdt_check_full(fdt, cb)) {
        |         ^~~~~~~~~~~~~~
        |         fdt_check_header

hw/ppc/spapr_hcall.c:1966:9: warning: nested extern declaration of
‘fdt_check_full’ [-Wnested-externs]
[...]
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_hcall.c.o: in
function `h_update_dt':
hw/ppc/spapr_hcall.c:1966: undefined reference to `fdt_check_full'
collect2: error: ld returned 1 exit status

by:

qemu/meson.build:1352:4: ERROR: Running configure command failed. The following clauses were found for PSERIES

CONFIG_PSERIES=y
config PSERIES depends on FDT

which is not better, but one step at a time...

John said: https://gitlab.com/qemu-project/qemu/-/issues/255#note_572421108

Distributions usually don't used embedded copies of libraries, so the configure script should require the correct minimum version.

Personally I'd rather allow users to build the most of QEMU with what is available, that is all possible machines except pSeries, making pSeries machine selected by default and deselected if not possible, with this change:

-- >8 --

(quoted diff) +0 -0

b/default-configs/devices/ppc64-softmmu.mak
index cca52665d90..62339661fca 100644

default-configs/devices/ppc64-softmmu.mak +0 -3
@@ -5,6 +5,3 @@ include ppc-softmmu.mak
 
 # For PowerNV
 CONFIG_POWERNV=y
-
-# For pSeries
-CONFIG_PSERIES=y
hw/ppc/Kconfig +1 -0
index 3935b73456f..706debd4fee 100644
@@ -1,5 +1,6 @@
 config PSERIES
     bool
+    default y
     depends on FDT
     imply PCI_DEVICES
     imply TEST_DEVICES

---

But I suppose it breaks user expectations.

Thoughts?

;)

#28 lore raw

Hi Paolo,

Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Philippe Mathieu-Daudé

Attempt to fix the issue reported by John when building with an outdated libfdt.

Unencoded version of this cover:

For now it changes:

hw/ppc/spapr_hcall.c: In function ‘h_update_dt’:
hw/ppc/spapr_hcall.c:1966:9: warning: implicit declaration of function
‘fdt_check_full’; did you mean ‘fdt_check_header’? [-Wimplicit-function-declaration]

   1966 |     if (fdt_check_full(fdt, cb)) {
        |         ^~~~~~~~~~~~~~
        |         fdt_check_header

hw/ppc/spapr_hcall.c:1966:9: warning: nested extern declaration of
‘fdt_check_full’ [-Wnested-externs]
[...]
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_hcall.c.o: in
function `h_update_dt':
hw/ppc/spapr_hcall.c:1966: undefined reference to `fdt_check_full'
collect2: error: ld returned 1 exit status

Quoted 8 lines

by:

qemu/meson.build:1352:4: ERROR: Running configure command failed. The following clauses were found for PSERIES

CONFIG_PSERIES=y
config PSERIES depends on FDT

This is triggered with:

fdt support: NO

having:

default-configs/targets/ppc64-softmmu.mak:6:TARGET_NEED_FDT=y

So this code doesn't seem to work:

if not fdt.found() and fdt_required.length() > 0
error('fdt not available but required by targets ' + ',
'.join(fdt_required))
endif

BTW I disagree FDT is target-dependent, it is machine-dependent IMO.

Quoted 44 lines

which is not better, but one step at a time...

John said: https://gitlab.com/qemu-project/qemu/-/issues/255#note_572421108

Distributions usually don't used embedded copies of libraries, so the configure script should require the correct minimum version.

Personally I'd rather allow users to build the most of QEMU with what is available, that is all possible machines except pSeries, making pSeries machine selected by default and deselected if not possible, with this change:

-- >8 --

default-configs/devices/ppc64-softmmu.mak +0 -3
index cca52665d90..62339661fca 100644
@@ -5,6 +5,3 @@ include ppc-softmmu.mak
 
 # For PowerNV
 CONFIG_POWERNV=y
-
-# For pSeries
-CONFIG_PSERIES=y
hw/ppc/Kconfig +1 -1
index 3935b73456f..706debd4fee 100644
@@ -1,5 +1,6 @@
 config PSERIES
     bool
+    default y
     depends on FDT
     imply PCI_DEVICES
     imply TEST_DEVICES
---

But I suppose it breaks user expectations.

Thoughts?

;)

#29 lore raw
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 6 lines

qemu/meson.build:1352:4: ERROR: Running configure command failed. The following clauses were found for PSERIES

CONFIG_PSERIES=y
config PSERIES depends on FDT

This is triggered with:

fdt support: NO

having:

default-configs/targets/ppc64-softmmu.mak:6:TARGET_NEED_FDT=y

Quoted 9 lines

So this code doesn't seem to work:

if not fdt.found() and fdt_required.length() > 0
error('fdt not available but required by targets ' + ',
'.join(fdt_required))
endif

BTW I disagree FDT is target-dependent, it is machine-dependent IMO.

I agree. It is much better to depend on FDT consistently for machines that require it.

Paolo

#30 lore raw

RFC PATCH 5/5 meson: Do not use internal fdt library if user asked for the system one

In reply to Philippe Mathieu-Daudé

If the user explicitly asked for the system libfdt library, but the library is not usable (usually too old), we should not silently default to the internal one.
Respect the user decision, and only default to 'internal' if in auto mode.

---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index 0b41ff41188..1ffb4bccdb2 100644
@@ -1612,7 +1612,7 @@
        int main(void) { fdt_check_full(NULL, 0); return 0; }''',
          dependencies: fdt)
       fdt_opt = 'system'
-    elif have_internal
+    elif have_internal and fdt_opt in ['enabled', 'auto']
       fdt_opt = 'internal'
     else
       fdt_opt = 'disabled'
Signature · 1 line
2.26.3
#31 lore raw

Re: [RFC PATCH 5/5] meson: Do not use internal fdt library if user asked for the system one

meson.build line 1617

Quoted 12 lines · Philippe Mathieu-Daudé
meson.build +1 -1
index 0b41ff41188..1ffb4bccdb2 100644
@@ -1612,7 +1612,7 @@
         int main(void) { fdt_check_full(NULL, 0); return 0; }''',
           dependencies: fdt)
        fdt_opt = 'system'
-    elif have_internal
+    elif have_internal and fdt_opt in ['enabled', 'auto']
        fdt_opt = 'internal'
      else

This will disable FDT silently for --enable-fdt=system instead of failing the build. What about:

meson.build +8 -1
index 60040cd7cf..efb38ca780 100644
@@ -1610,11 +1610,18 @@ if have_system
     fdt = cc.find_library('fdt', kwargs: static_kwargs,
                           required: fdt_opt == 'system' or
                                     fdt_opt == 'enabled' and not have_internal)
-    if fdt.found() and cc.links('''
+    if fdt.found() and not cc.links('''
        #include <libfdt.h>
        #include <libfdt_env.h>
        int main(void) { fdt_check_full(NULL, 0); return 0; }''',
          dependencies: fdt)
+      if fdt_opt == 'system' or
+         fdt_opt == 'enabled' and not have_internal then
+        error('libfdt is too old, version 1.5.1 required')
+      endif
+      fdt = not_found
+    endif
+    if fdt.found()
       fdt_opt = 'system'
     elif have_internal
       fdt_opt = 'internal'

Paolo