Skip to contentSkip to conversation

Fix dependencies in arm machines and update OpenBSD to 7.7

PATCH RESEND In review Thomas Huth 3 participants 11 messages May 8, 2025 – Sep 9, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix dependencies in arm machines and update OpenBSD to 7.7

I accidentally only sent this to qemu-arm, not to the qemu-devel mailing list, so this is a resend, sorry if you've got it twice.
Note that there was already some discussion on the qemu-arm mailing list, see the archive here (i.e. I'll try to rework the third patch and postpone the last one):

https://lists.libreplanet.org/archive/html/qemu-arm/2025-05/msg00549.html

Original cover letter message follows:

At the end of April, OpenBSD 7.7 has been released, so we could update our test VM to that version now. However, I noticed that some arm machines now fail to compile since they fail to include the <epoxy/gl.h> header. This header resides in /usr/X11R6/include instead of /usr/include in OpenBSD, so we have to make sure that the machines are compiled with the right CFLAGS (or don't include the header at all if it is not really necessary). Thus the first patches of this series clean up this first before we can finally switch to OpenBSD 7.7. The last patch then also reverts a hack for OpenBSD in the main meson.build file since the related problem has finally been fixed there.

Thomas Huth (5):
include/hw/dma/xlnx_dpdma: Remove dependency on console.h hw/display/bcm2835_fb: Move inclusion of console.h to the .c file hw/arm: Compile musicpal and the xlnx machines with the right CFLAGS tests/vm: Update OpenBSD to 7.7
Revert "meson.build: Disable -fzero-call-used-regs on OpenBSD"

 meson.build                     | 6 +-----
 include/hw/display/bcm2835_fb.h | 1 -
 include/hw/dma/xlnx_dpdma.h     | 1 -
 hw/display/bcm2835_fb.c         | 1 +
 hw/arm/meson.build              | 4 ++--
 tests/vm/openbsd                | 4 ++--
 6 files changed, 6 insertions(+), 11 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/5 include/hw/dma/xlnx_dpdma: Remove dependency on console.h

From: Thomas Huth <[email protected]>

console.h brings a dependency on the <epoxy/opengl.h> and the pixman header file (if available), so we should avoid to include this file if it is not really necessary (otherwise we have to specify the dependency in the meson.build file, too, to get the right include paths everywhere). console.h does not seem to be necessary for the xlnx_dpdma code, so drop the include here.

---
 include/hw/dma/xlnx_dpdma.h | 1 -
 1 file changed, 1 deletion(-)
include/hw/dma/xlnx_dpdma.h +0 -1
index 1ec0d265be2..484b2e377f0 100644
@@ -26,7 +26,6 @@
 #define XLNX_DPDMA_H
 
 #include "hw/sysbus.h"
-#include "ui/console.h"
 #include "system/dma.h"
 #include "qom/object.h"
 
Signature · 1 line
2.49.0
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] include/hw/dma/xlnx_dpdma: Remove dependency on console.h

Quoted 9 lines · Thomas Huth

From: Thomas Huth <[email protected]>

console.h brings a dependency on the <epoxy/opengl.h> and the pixman header file (if available), so we should avoid to include this file if it is not really necessary (otherwise we have to specify the dependency in the meson.build file, too, to get the right include paths everywhere). console.h does not seem to be necessary for the xlnx_dpdma code, so drop the include here.

Quoted 4 lines
---
  include/hw/dma/xlnx_dpdma.h | 1 -
  1 file changed, 1 deletion(-)
#3 lore raw

PATCH 2/5 hw/display/bcm2835_fb: Move inclusion of console.h to the .c file

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

The definitions from console.h are not needed in the bcm2835_fb.h header file yet, so let's move it to the place that really needs its definitions, i.e. into the bcm2835_fb.c file.
This way the header can also be used by code that is not compiled with the CFLAGS that are required for pixman or OpenGL (in case their headers do not reside under /usr/include).

---
 include/hw/display/bcm2835_fb.h | 1 -
 hw/display/bcm2835_fb.c         | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
include/hw/display/bcm2835_fb.h +0 -1
index 49541bf08f4..acc9230b6a8 100644
@@ -13,7 +13,6 @@
 #define BCM2835_FB_H
 
 #include "hw/sysbus.h"
-#include "ui/console.h"
 #include "qom/object.h"
 
 #define UPPER_RAM_BASE 0x40000000
hw/display/bcm2835_fb.c +1 -0
index 820e67ac8bb..1bb2ee45a01 100644
@@ -27,6 +27,7 @@
 #include "hw/display/bcm2835_fb.h"
 #include "hw/hw.h"
 #include "hw/irq.h"
+#include "ui/console.h"
 #include "framebuffer.h"
 #include "ui/pixel_ops.h"
 #include "hw/misc/bcm2835_mbox_defs.h"
Signature · 1 line
2.49.0
Reviewed-by on v1 2/5
#4 lore raw

Re: [PATCH 2/5] hw/display/bcm2835_fb: Move inclusion of console.h to the .c file

Quoted 9 lines · Thomas Huth

From: Thomas Huth <[email protected]>

The definitions from console.h are not needed in the bcm2835_fb.h header file yet, so let's move it to the place that really needs its definitions, i.e. into the bcm2835_fb.c file.
This way the header can also be used by code that is not compiled with the CFLAGS that are required for pixman or OpenGL (in case their headers do not reside under /usr/include).

Quoted 5 lines
---
 include/hw/display/bcm2835_fb.h | 1 -
 hw/display/bcm2835_fb.c         | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

It references the QemuConsole type, but we get that from typedefs.h not console.h so

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#5 lore raw

RFC PATCH 3/5 hw/arm: Compile musicpal and the xlnx machines with the right CFLAGS

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

These machines include ui/console.h, which in turn includes the pixman headers and <epoxy/gl.h> via ui/surface.h. If these library headers are located outside of /usr/include (like gl.h on OpenBSD 7.7), we must make sure to compile this code with the right CFLAGS so that the headers can be found.

---
Note: Paolo had a better suggestion here:
https://lists.libreplanet.org/archive/html/qemu-arm/2025-05/msg00571.html

 hw/arm/meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/meson.build +2 -2
index 5098795f61d..51d0c055abf 100644
@@ -8,7 +8,7 @@ arm_common_ss.add(when: 'CONFIG_HIGHBANK', if_true: files('highbank.c'))
 arm_common_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c'))
 arm_common_ss.add(when: 'CONFIG_MICROBIT', if_true: files('microbit.c'))
 arm_common_ss.add(when: 'CONFIG_MPS3R', if_true: files('mps3r.c'))
-arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: [pixman, files('musicpal.c')])
+arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: [files('musicpal.c'), pixman, opengl])
 arm_common_ss.add(when: 'CONFIG_NETDUINOPLUS2', if_true: files('netduinoplus2.c'))
 arm_common_ss.add(when: 'CONFIG_OLIMEX_STM32_H405', if_true: files('olimex-stm32-h405.c'))
 arm_common_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx.c', 'npcm7xx_boards.c'))
@@ -34,7 +34,7 @@ arm_common_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c'
 arm_common_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c'))
 arm_common_ss.add(when: 'CONFIG_B_L475E_IOT01A', if_true: files('b-l475e-iot01a.c'))
 arm_common_ss.add(when: 'CONFIG_STM32L4X5_SOC', if_true: files('stm32l4x5_soc.c'))
-arm_common_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp.c', 'xlnx-zcu102.c'))
+arm_common_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: [files('xlnx-zynqmp.c', 'xlnx-zcu102.c'), pixman, opengl])
 arm_common_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal.c', 'xlnx-versal-virt.c'))
 arm_common_ss.add(when: 'CONFIG_FSL_IMX25', if_true: files('fsl-imx25.c', 'imx25_pdk.c'))
 arm_common_ss.add(when: 'CONFIG_FSL_IMX31', if_true: files('fsl-imx31.c', 'kzm.c'))
Signature · 1 line
2.49.0
#6 lore raw

PATCH 4/5 tests/vm: Update OpenBSD to 7.7

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

OpenBSD 7.7 has been released at the end of April 2025, so let's update to that version.

---
 tests/vm/openbsd | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/vm/openbsd +2 -2
index 5e4f76f3988..2ea86a01bad 100755
@@ -22,8 +22,8 @@ class OpenBSDVM(basevm.BaseVM):
     name = "openbsd"
     arch = "x86_64"
 
-    link = "https://cdn.openbsd.org/pub/OpenBSD/7.6/amd64/install76.iso"
-    csum = "60cba8cb391b50bba8fa10fc768bd0529636f5345d82133c93e22c798d8e5269"
+    link = "https://cdn.openbsd.org/pub/OpenBSD/7.7/amd64/install77.iso"
+    csum = "da0106e39463f015524dca806f407c37a9bdd17e6dfffe533b06a2dd2edd8a27"
     size = "20G"
     pkgs = [
         # tools
Signature · 1 line
2.49.0
Reviewed-by on v1 4/5
#7 lore raw

Re: [PATCH 4/5] tests/vm: Update OpenBSD to 7.7

Quoted 10 lines · Thomas Huth

From: Thomas Huth <[email protected]>

OpenBSD 7.7 has been released at the end of April 2025, so let's update to that version.

---
 tests/vm/openbsd | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#8 lore raw

RFC PATCH 5/5 Revert "meson.build: Disable -fzero-call-used-regs on OpenBSD"

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

This reverts commit 2d6d995709482cc8b6a76dbb5334a28001a14a9a.

OpenBSD 7.7 fixed the problem with the -fzero-call-used-regs on OpenBSD, see https://github.com/openbsd/src/commit/03eca72d1e030b7a542cd6aec1 for the fix there.

---
Note: Marked as RFC since we likely can include this only once OpenBSD 7.6 goes out of service, see:
https://lists.libreplanet.org/archive/html/qemu-arm/2025-05/msg00559.html

 meson.build | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
meson.build +1 -5
index 6c61e1dcaec..5f0e6a65cb0 100644
@@ -699,11 +699,7 @@ hardening_flags = [
 #
 # NB: Clang 17 is broken and SEGVs
 # https://github.com/llvm/llvm-project/issues/75168
-#
-# NB2: This clashes with the "retguard" extension of OpenBSD's Clang
-# https://gitlab.com/qemu-project/qemu/-/issues/2278
-if host_os != 'openbsd' and \
-   cc.compiles('extern struct { void (*cb)(void); } s; void f(void) { s.cb(); }',
+if cc.compiles('extern struct { void (*cb)(void); } s; void f(void) { s.cb(); }',
                name: '-fzero-call-used-regs=used-gpr',
                args: ['-O2', '-fzero-call-used-regs=used-gpr'])
     hardening_flags += '-fzero-call-used-regs=used-gpr'
Signature · 1 line
2.49.0
#9 lore raw

Re: [RFC PATCH 5/5] Revert "meson.build: Disable -fzero-call-used-regs on OpenBSD"

Quoted 8 lines · Thomas Huth

From: Thomas Huth <[email protected]>

This reverts commit 2d6d995709482cc8b6a76dbb5334a28001a14a9a.

OpenBSD 7.7 fixed the problem with the -fzero-call-used-regs on OpenBSD, see https://github.com/openbsd/src/commit/03eca72d1e030b7a542cd6aec1 for the fix there.

Quoted 6 lines

---
Note: Marked as RFC since we likely can include this only once OpenBSD 7.6 goes out of service, see:
https://lists.libreplanet.org/archive/html/qemu-arm/2025-05/msg00559.html

Yep, we have to wait a bit longer, unless someone can confirm the fix was backported to 7.6

Quoted 24 lines
 meson.build | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
meson.build +1 -5
index 6c61e1dcaec..5f0e6a65cb0 100644
@@ -699,11 +699,7 @@ hardening_flags = [
 #
 # NB: Clang 17 is broken and SEGVs
 # https://github.com/llvm/llvm-project/issues/75168
-#
-# NB2: This clashes with the "retguard" extension of OpenBSD's Clang
-# https://gitlab.com/qemu-project/qemu/-/issues/2278
-if host_os != 'openbsd' and \
-   cc.compiles('extern struct { void (*cb)(void); } s; void f(void) { s.cb(); }',
+if cc.compiles('extern struct { void (*cb)(void); } s; void f(void) { s.cb(); }',
                name: '-fzero-call-used-regs=used-gpr',
                args: ['-O2', '-fzero-call-used-regs=used-gpr'])
     hardening_flags += '-fzero-call-used-regs=used-gpr'
Signature · 1 line
2.49.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#10 lore raw

Re: [RFC PATCH 5/5] Revert "meson.build: Disable -fzero-call-used-regs on OpenBSD"

Quoted 16 lines · Daniel P. Berrangé
Quoted 8 lines · Thomas Huth

From: Thomas Huth <[email protected]>

This reverts commit 2d6d995709482cc8b6a76dbb5334a28001a14a9a.

OpenBSD 7.7 fixed the problem with the -fzero-call-used-regs on OpenBSD, see https://github.com/openbsd/src/commit/03eca72d1e030b7a542cd6aec1 for the fix there.

Quoted 6 lines

---
Note: Marked as RFC since we likely can include this only once OpenBSD 7.6 goes out of service, see:
https://lists.libreplanet.org/archive/html/qemu-arm/2025-05/msg00559.html

Quoted 2 lines

Yep, we have to wait a bit longer, unless someone can confirm the fix was backported to 7.6

Now that QEMU 10.1 has been released, I'm going to include this patch in my next pull request. OpenBSD 7.8 should get released in October, so 7.6 will go out of service at that point in time, and our next QEMU release is likely in December, so we should be fine. Or has anybody still concerns about including this now?

Thomas

Quoted 27 lines
Quoted 24 lines
  meson.build | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
meson.build +1 -5
index 6c61e1dcaec..5f0e6a65cb0 100644
@@ -699,11 +699,7 @@ hardening_flags = [
  #
  # NB: Clang 17 is broken and SEGVs
  # https://github.com/llvm/llvm-project/issues/75168
-#
-# NB2: This clashes with the "retguard" extension of OpenBSD's Clang
-# https://gitlab.com/qemu-project/qemu/-/issues/2278
-if host_os != 'openbsd' and \
-   cc.compiles('extern struct { void (*cb)(void); } s; void f(void) { s.cb(); }',
+if cc.compiles('extern struct { void (*cb)(void); } s; void f(void) { s.cb(); }',
                 name: '-fzero-call-used-regs=used-gpr',
                 args: ['-O2', '-fzero-call-used-regs=used-gpr'])
      hardening_flags += '-fzero-call-used-regs=used-gpr'
Signature · 1 line
2.49.0

With regards,
Daniel