mos6522: fix linking error when CONFIG_MOS6522 is not set
PATCH 1/1 mos6522: fix linking error when CONFIG_MOS6522 is not set
When CONFIG_MOS6522 is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
Add CONFIG_MOS6522 check for hmp_info_via in hmp-commands-info.hx to fix such linking error.
--- hmp-commands-info.hx | 2 ++ 1 file changed, 2 insertions(+)
hmp-commands-info.hx +2 -0
@@ -881,6 +881,7 @@ SRST ERST #if defined(TARGET_M68K) || defined(TARGET_PPC) +#if defined(CONFIG_MOS6522) { .name = "via", .args_type = "",
@@ -889,6 +890,7 @@ ERST .cmd = hmp_info_via, }, #endif +#endif SRST ``info via``
Signature · 1 line
2.35.1
Quoted 29 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>--- hmp-commands-info.hx | 2 ++ 1 file changed, 2 insertions(+)hmp-commands-info.hx +1
-0@@ -881,6 +881,7 @@ SRST ERST #if defined(TARGET_M68K) || defined(TARGET_PPC) +#if defined(CONFIG_MOS6522) { .name = "via", .args_type = "",
hmp-commands-info.hx ERST · line 896
Quoted 7 lines
hmp-commands-info.hx +1
-0@@ -889,6 +890,7 @@ ERST .cmd = hmp_info_via, }, #endif +#endif SRST ``info via``
Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
Given that the g3beige and mac99 machines are included by default in qemu-system-ppc64 which both contain the MOS6522 device, I can't quite understand how CONFIG_MOS6522 isn't being selected.
Can you give more information about how you are building QEMU including your configure command line?
ATB,
Mark.
Hi, Mark.
Thanks for reviewing. Comments below.
Quoted 30 lines · Mark Cave-Ayland
Quoted 28 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>---
hmp-commands-info.hx | 2 ++1 file changed, 2 insertions(+)hmp-commands-info.hx +0
-0@@ -881,6 +881,7 @@ SRSTERST
#ifdefined(TARGET_M68K)||defined(TARGET_PPC)
+#ifdefined(CONFIG_MOS6522)
{
.name = "via",
.args_type = "",hmp-commands-info.hx +0
-0@@ -889,6 +890,7 @@ ERST
Quoted 8 lines
Quoted 6 lines
hmp-commands-info.hx +1
-0.cmd = hmp_info_via, }, #endif +#endifSRST
``info via``Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
So my proposed fix worked just by coincidence. Thanks for providing the background.
Quoted 4 lines
Given that the g3beige and mac99 machines are included by default in qemu-system-ppc64 which both contain the MOS6522 device, I can't quite understand how
CONFIG_MOS6522isn't being selected.Can you give more information about how you are building QEMU including your configure command line?
Here is a reproducer adapted from CentOS 9 Stream qemu-kvm[0] package
(build failed on c9s ppc64le with QEMU at commit f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65):
$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF
$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF
$ mkdir build $ cd build
$ ../configure --cc=clang --cxx=/bin/false --prefix=/usr --libdir=/usr/lib64 --datadir=/usr/share --sysconfdir=/etc --interp-prefix=/usr/qemu-%M --localstatedir=/var --docdir=/usr/share/doc --libexecdir=/usr/libexec '--extra-ldflags=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now ' '--extra-cflags=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -m64 -mcpu=power9 -mtune=power9 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-string-plus-int' --with-pkgversion=qemu-kvm-7.0.0-1.el9 --with-suffix=qemu-kvm --firmwarepath=/usr/share/qemu-firmware:/usr/share/ipxe/qemu:/usr/share/seavgabios:/usr/share/seabios --meson=internal --enable-trace-backend=dtrace --with-coroutine=ucontext --with-git=git --tls-priority=@QEMU,SYSTEM --audio-drv-list= --disable-alsa --disable-attr --disable-auth-pam --disable-avx2 --disable-avx512f --disable-block-drv-whitelist-in-tools --disable-bochs --disable-bpf --disable-brlapi --disable-bsd-user --disable-bzip2 --disable-cap-ng --disable-capstone --disable-cfi --disable-cfi-debug --disable-cloop --disable-cocoa --disable-coreaudio --disable-coroutine-pool --disable-crypto-afalg --disable-curl --disable-curses --disable-dbus-display --disable-debug-info --disable-debug-mutex --disable-debug-tcg --disable-dmg --disable-docs --disable-dsound --disable-fdt --disable-fuse --disable-fuse-lseek --disable-gcrypt --disable-gettext --disable-gio --disable-glusterfs --disable-gnutls --disable-gtk --disable-guest-agent --disable-guest-agent-msi --disable-hax --disable-hvf --disable-iconv --disable-jack --disable-kvm --disable-l2tpv3 --disable-libdaxctl --disable-libiscsi --disable-libnfs --disable-libpmem --disable-libssh --disable-libudev --disable-libusb --disable-linux-aio --disable-linux-io-uring --disable-linux-user --disable-live-block-migration --disable-lto --disable-lzfse --disable-lzo --disable-malloc-trim --disable-membarrier --disable-modules --disable-module-upgrades --disable-mpath --disable-multiprocess --disable-netmap --disable-nettle --disable-numa --disable-nvmm --disable-opengl --disable-oss --disable-pa --disable-parallels --disable-pie --disable-pvrdma --disable-qcow1 --disable-qed --disable-qga-vss --disable-qom-cast-debug --disable-rbd --disable-rdma --disable-replication --disable-rng-none --disable-safe-stack --disable-sanitizers --disable-sdl --disable-sdl-image --disable-seccomp --disable-selinux --disable-slirp --disable-slirp-smbd --disable-smartcard --disable-snappy --disable-sparse --disable-spice --disable-spice-protocol --disable-strip --disable-system --disable-tcg --disable-tools --disable-tpm --disable-u2f --disable-usb-redir --disable-user --disable-vde --disable-vdi --disable-vhost-crypto --disable-vhost-kernel --disable-vhost-net --disable-vhost-scsi --disable-vhost-user --disable-vhost-user-blk-server --disable-vhost-vdpa --disable-vhost-vsock --disable-virglrenderer --disable-virtfs --disable-virtiofsd --disable-vnc --disable-vnc-jpeg --disable-vnc-sasl --disable-vte --disable-vvfat --disable-werror --disable-whpx --disable-xen --disable-xen-pci-passthrough --disable-xkbcommon --disable-zstd --with-git-submodules=ignore --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress --block-drv-ro-whitelist=vdi,vmdk,vhdx,vpc,https --enable-attr --enable-cap-ng --enable-capstone=internal --enable-coroutine-pool --enable-curl --enable-debug-info --enable-docs --enable-fdt=system --enable-gnutls --enable-guest-agent --enable-iconv --enable-kvm --enable-libusb --enable-libudev --enable-linux-aio --enable-lzo --enable-malloc-trim --enable-modules --enable-mpath --enable-numa --enable-pa --enable-pie --enable-rbd --enable-rdma --enable-seccomp --enable-selinux --enable-slirp=system --enable-snappy --enable-spice-protocol --enable-system --enable-tcg --enable-tools --enable-tpm --enable-vdi --enable-virtiofsd --enable-vhost-kernel --enable-vhost-net --enable-vhost-user --enable-vhost-user-blk-server --enable-vhost-vdpa --enable-vhost-vsock --enable-vnc --enable-vnc-sasl --enable-werror --enable-xkbcommon
$ make -O -j$(nproc) V=1 VERBOSE=1 ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via' clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
I have figured that it also fails with this minimal set of configure options (in addition to the devices CONFIG_* options above):
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit status
Since TARGET_PPC is defined when building target ppc64-softmmu, the hmp_info_via will be referenced when processing the hmp-commands-info.hx. However, hmp_info_via implementation resides on hw/misc/mos6522.c, which is built only if CONFIG_MOS6522 is defined, as per hw/misc/meson.build.
If hmp_info_via is generic enough and not device-specific, it could be moved out of mos6522.c to somewhere else.
What do you think?
[0] https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/qemu-kvm.spec#L686
Signature · 1 line
Murilo
Quoted 53 lines · Murilo Opsfelder Araújo
$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build
<snip>
Quoted 8 lines
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit statusSince
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.
I think this particular problem you hit is due to the 64 bit devices file including 32 bit as well:
$ cat configs/devices/ppc64-softmmu/default.mak # Default configuration for ppc64-softmmu
# Include all 32-bit boards
include ../ppc-softmmu/default.mak <----- here
# For PowerNVCONFIG_POWERNV=y
# For pSeriesCONFIG_PSERIES=y
---
So ppc64-softmmu doesn't quite do what it says on the tin. I think in the long run we need to revisit the conversation about whether to keep the 32 & 64 bit builds separate. It is misleading that you're explicitly excluding ppc-softmmu from the --target-list, but a some 32 bit stuff still comes along implicitly.
Quoted 1 line
If
hmp_info_viais generic enough and not device-specific, it could be moved out ofmos6522.cto somewhere else.
Perhaps it would be easier to just have a stub for the 64 bits build? Do HMP commands get in any way enabled/disabled depending on the emulated hw that is available? It might be ok to have a hmp_info_via that is a noop in 64bit.
Quoted 83 lines · Fabiano Rosas
Quoted 53 lines · Murilo Opsfelder Araújo
$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build<snip>
Quoted 8 lines
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit statusSince
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.I think this particular problem you hit is due to the 64 bit devices file including 32 bit as well:
$ cat configs/devices/ppc64-softmmu/default.mak # Default configuration for ppc64-softmmu# Include all 32-bit boards
include ../ppc-softmmu/default.mak <----- here# For PowerNV
CONFIG_POWERNV=y# For pSeries
CONFIG_PSERIES=y
---
Quoted 5 lines
So ppc64-softmmu doesn't quite do what it says on the tin. I think in the long run we need to revisit the conversation about whether to keep the 32 & 64 bit builds separate. It is misleading that you're explicitly excluding ppc-softmmu from the
--target-list, but a some 32 bit stuff still comes along implicitly.
Unfortunately for historical reasons it isn't quite that simple: the mac99 machine in hw/ppc/mac_newworld.c is both a 32-bit and a 64-bit machine, but with a different PCI host bridge and a 970 CPU if run from qemu-system-ppc64. Unfortunately it pre-dates my time working on QEMU's PPC Mac machines but I believe it was (is?) capable of booting Linux, even though I doubt it accurately represents a real machine.
Quoted 6 lines
Quoted 1 line
If
hmp_info_viais generic enough and not device-specific, it could be moved out ofmos6522.cto somewhere else.Perhaps it would be easier to just have a stub for the 64 bits build? Do HMP commands get in any way enabled/disabled depending on the emulated hw that is available? It might be ok to have a
hmp_info_viathat is a noop in 64bit.
I've provided a pointer back to the original thread in my previous reply which I hope will give some background here.
ATB,
Mark.
Quoted 91 lines · Mark Cave-Ayland
Quoted 83 lines · Fabiano Rosas
Quoted 53 lines · Murilo Opsfelder Araújo
$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build<snip>
Quoted 8 lines
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit statusSince
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.I think this particular problem you hit is due to the 64 bit devices file including 32 bit as well:
$ cat configs/devices/ppc64-softmmu/default.mak # Default configuration for ppc64-softmmu# Include all 32-bit boards
include ../ppc-softmmu/default.mak <----- here# For PowerNV
CONFIG_POWERNV=y# For pSeries
CONFIG_PSERIES=y
---Quoted 5 lines
So ppc64-softmmu doesn't quite do what it says on the tin. I think in the long run we need to revisit the conversation about whether to keep the 32 & 64 bit builds separate. It is misleading that you're explicitly excluding ppc-softmmu from the
--target-list, but a some 32 bit stuff still comes along implicitly.
Quoted 5 lines
Unfortunately for historical reasons it isn't quite that simple: the mac99 machine in
hw/ppc/mac_newworld.cis both a 32-bit and a 64-bit machine, but with a different PCI host bridge and a 970 CPU if run from qemu-system-ppc64. Unfortunately it pre-dates my time working on QEMU's PPC Mac machines but I believe it was (is?) capable of booting Linux, even though I doubt it accurately represents a real machine.
Well, what you describe is fine in my view, the 64-bit machine uses qemu-system-ppc64. If there is shared code with 32-bit, that is ok.
What I would like to understand is what is the community's direction with this, do we want:
1) the 64-bit build to include all of the code and have it run all machines, or;
2) the 64-bit build to run only 64-bit machines and the 32-bit build to run only 32-bit machines.
There are things such as 'target_ulong' that go against #1, and this thread shows that we're not doing #2 as well.
I know there have been discussions about this in the past but I couldn't find them in the archives.
Quoted 108 lines · Fabiano Rosas
Quoted 91 lines · Mark Cave-Ayland
Quoted 83 lines · Fabiano Rosas
Quoted 53 lines · Murilo Opsfelder Araújo
$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build<snip>
Quoted 8 lines
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit statusSince
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.I think this particular problem you hit is due to the 64 bit devices file including 32 bit as well:
$ cat configs/devices/ppc64-softmmu/default.mak # Default configuration for ppc64-softmmu# Include all 32-bit boards
include ../ppc-softmmu/default.mak <----- here# For PowerNV
CONFIG_POWERNV=y# For pSeries
CONFIG_PSERIES=y
---Quoted 5 lines
So ppc64-softmmu doesn't quite do what it says on the tin. I think in the long run we need to revisit the conversation about whether to keep the 32 & 64 bit builds separate. It is misleading that you're explicitly excluding ppc-softmmu from the
--target-list, but a some 32 bit stuff still comes along implicitly.Quoted 5 lines
Unfortunately for historical reasons it isn't quite that simple: the mac99 machine in
hw/ppc/mac_newworld.cis both a 32-bit and a 64-bit machine, but with a different PCI host bridge and a 970 CPU if run from qemu-system-ppc64. Unfortunately it pre-dates my time working on QEMU's PPC Mac machines but I believe it was (is?) capable of booting Linux, even though I doubt it accurately represents a real machine.Well, what you describe is fine in my view, the 64-bit machine uses qemu-system-ppc64. If there is shared code with 32-bit, that is ok.
What I would like to understand is what is the community's direction with this, do we want:
1) the 64-bit build to include all of the code and have it run all
machines, or;
Quoted 8 lines
2) the 64-bit build to run only 64-bit machines and the 32-bit build to run only 32-bit machines.
There are things such as '
target_ulong' that go against #1, and this thread shows that we're not doing #2 as well.I know there have been discussions about this in the past but I couldn't find them in the archives.
Certainly if a 64-bit Mac machine were to be added today, I'd be inclined to copy mac_newworld.c into a separate file and give it a separate machine name for ppc64 to make a clear distinction between the two machines (and allow them to evolve separately). Unfortunately I have no idea as to what the reference machine for the PPC64 Mac machine was supposed to be which makes it harder to decide what to do :(
In my mind it feels like qemu-system-ppc is for 32-bit guests and qemu-system-ppc64 is for 64-bit guests which I believe is consistent with how it currently works with MIPS and ARM (someone feel free to correct me here).
ATB,
Mark.
QEMU 32-bit vs. 64-bit binaries (was: [PATCH] mos6522: fix linking error when CONFIG_MOS6522 is not set)
Quoted 7 lines · Mark Cave-Ayland
Quoted 5 lines · Fabiano Rosas
Quoted 3 lines · Mark Cave-Ayland
Quoted 1 line · Fabiano Rosas
Murilo Opsfelder Araújo <[email protected]> writes:
[...]
Quoted 27 lines
Quoted 27 lines
Quoted 11 lines
Quoted 5 lines
So ppc64-softmmu doesn't quite do what it says on the tin. I think in the long run we need to revisit the conversation about whether to keep the 32 & 64 bit builds separate. It is misleading that you're explicitly excluding ppc-softmmu from the
--target-list, but a some 32 bit stuff still comes along implicitly.Unfortunately for historical reasons it isn't quite that simple: the mac99 machine in
hw/ppc/mac_newworld.cis both a 32-bit and a 64-bit machine, but with a different PCI host bridge and a 970 CPU if run from qemu-system-ppc64. Unfortunately it pre-dates my time working on QEMU's PPC Mac machines but I believe it was (is?) capable of booting Linux, even though I doubt it accurately represents a real machine.Well, what you describe is fine in my view, the 64-bit machine uses qemu-system-ppc64. If there is shared code with 32-bit, that is ok.
What I would like to understand is what is the community's direction with this, do we want:
1) the 64-bit build to include all of the code and have it run all machines, or;
2) the 64-bit build to run only 64-bit machines and the 32-bit build to run only 32-bit machines.
There are things such as '
target_ulong' that go against #1, and this thread shows that we're not doing #2 as well.
Quoted 6 lines
Quoted 2 lines
I know there have been discussions about this in the past but I couldn't find them in the archives.
Certainly if a 64-bit Mac machine were to be added today, I'd be inclined to copy
mac_newworld.cinto a separate file and give it a separate machine name for ppc64 to make a clear distinction between the two machines (and allow them to evolve separately). Unfortunately I have no idea as to what the reference machine for the PPC64 Mac machine was supposed to be which makes it harder to decide what to do :(In my mind it feels like qemu-system-ppc is for 32-bit guests and qemu-system-ppc64 is for 64-bit guests which I believe is consistent with how it currently works with MIPS and ARM (someone feel free to correct me here).
For CPUs that have both, 32-bit and 64-bit variants, we have mixed approaches:
1) For x86_64/i386, aarch64/arm, mips64/mips and ppc64/ppc, the 64-bit variants are a superset of the 32-bit variants, i.e. if you build the 64-bit version, you normally don't need the 32-bit version anymore (see below for the KVM-case where you still might need it).
2) For sparc64/sparc and riscv64/riscv32, the set of machines is distinct between the 64-bit and 32-bit versions (well, riscv has some machines shared, and some machines are different).
I once suggested in the past already that we should maybe get rid of the 32-bit variants in case the 64-bit variant is a full superset, so we can save compile- and test times (which is quite a bit for QEMU), but I've been told that the 32-bit variants are mostly still required for supporting KVM on 32-bit host machines.
But in the long run, I think we rather want to converge everything into one binary (to decrease testing and compilation time) instead of separating stuff into multiple binaries, so IMHO we should not start separating the 32-bit machines into qemu-system-ppc and the 64-bit-only machines into qemu-system-ppc64 now.
Thomas
Re: QEMU 32-bit vs. 64-bit binaries (was: [PATCH] mos6522: fix linking error when CONFIG_MOS6522 is not set)
Quoted 58 lines · Thomas Huth
Quoted 7 lines · Mark Cave-Ayland
Quoted 5 lines · Fabiano Rosas
Quoted 3 lines · Mark Cave-Ayland
Quoted 1 line · Fabiano Rosas
Murilo Opsfelder Araújo <[email protected]> writes:
[...]
Quoted 41 lines
Quoted 25 lines
Quoted 6 lines
Quoted 5 lines
So ppc64-softmmu doesn't quite do what it says on the tin. I think in the long run we need to revisit the conversation about whether to keep the 32 & 64 bit builds separate. It is misleading that you're explicitly excluding ppc-softmmu from the
--target-list, but a some 32 bit stuff still comes along implicitly.Quoted 9 lines
Unfortunately for historical reasons it isn't quite that simple: the mac99 machine in
hw/ppc/mac_newworld.cis both a 32-bit and a 64-bit machine, but with a different PCI
host bridge and a 970 CPU if run from qemu-system-ppc64. Unfortunately it pre-dates
my time working on QEMU's PPC Mac machines but I believe it was (is?) capable of
booting Linux, even though I doubt it accurately represents a real machine.Well, what you describe is fine in my view, the 64-bit machine uses qemu-system-ppc64. If there is shared code with 32-bit, that is ok.
What I would like to understand is what is the community's direction with this, do we want:
1) the 64-bit build to include all of the code and have it run all
machines, or;Quoted 8 lines
2) the 64-bit build to run only 64-bit machines and the 32-bit build to run only 32-bit machines.
There are things such as '
target_ulong' that go against #1, and this thread shows that we're not doing #2 as well.I know there have been discussions about this in the past but I couldn't find them in the archives.
Certainly if a 64-bit Mac machine were to be added today, I'd be inclined to copy
mac_newworld.cinto a separate file and give it a separate machine name for ppc64 to make a clear distinction between the two machines (and allow them to evolve separately). Unfortunately I have no idea as to what the reference machine for the PPC64 Mac machine was supposed to be which makes it harder to decide what to do :(Quoted 4 lines
In my mind it feels like qemu-system-ppc is for 32-bit guests and qemu-system-ppc64 is for 64-bit guests which I believe is consistent with how it currently works with MIPS and ARM (someone feel free to correct me here).
For CPUs that have both, 32-bit and 64-bit variants, we have mixed approaches:
Quoted 8 lines
1) For x86_64/i386, aarch64/arm, mips64/mips and ppc64/ppc, the 64-bit variants are a superset of the 32-bit variants, i.e. if you build the 64-bit version, you normally don't need the 32-bit version anymore (see below for the KVM-case where you still might need it).
2) For sparc64/sparc and riscv64/riscv32, the set of machines is distinct between the 64-bit and 32-bit versions (well, riscv has some machines shared, and some machines are different).
For RISC-V we are slowly moving towards riscv64 being a superset of riscv32, similar to the other architectures
Quoted 6 lines
I once suggested in the past already that we should maybe get rid of the 32-bit variants in case the 64-bit variant is a full superset, so we can save compile- and test times (which is quite a bit for QEMU), but I've been told that the 32-bit variants are mostly still required for supporting KVM on 32-bit host machines.
That was the eventual long term plan for RISC-V, then we can have a single binary for everything
Quoted 6 lines
But in the long run, I think we rather want to converge everything into one binary (to decrease testing and compilation time) instead of separating stuff into multiple binaries, so IMHO we should not start separating the 32-bit machines into qemu-system-ppc and the 64-bit-only machines into qemu-system-ppc64 now.
Agreed!
Alistair
Quoted 4 lines
Thomas
Re: QEMU 32-bit vs. 64-bit binaries
In reply to Thomas HuthThomas Huth <[email protected]> writes:
[...]
Quoted 5 lines
I once suggested in the past already that we should maybe get rid of the 32-bit variants in case the 64-bit variant is a full superset, so we can save compile- and test times (which is quite a bit for QEMU), but I've been told that the 32-bit variants are mostly still required for supporting KVM on 32-bit host machines.
Do we still care for 32-bit host machines?
[...]
Re: QEMU 32-bit vs. 64-bit binaries
Quoted 11 lines · Markus Armbruster
Thomas Huth <[email protected]> writes:
[...]
Quoted 5 lines
I once suggested in the past already that we should maybe get rid of the 32-bit variants in case the 64-bit variant is a full superset, so we can save compile- and test times (which is quite a bit for QEMU), but I've been told that the 32-bit variants are mostly still required for supporting KVM on 32-bit host machines.
Do we still care for 32-bit host machines?
As long as the Linux kernel still supports 32-bit KVM virtualization, I think we have to keep the userspace around for that, too.
But I wonder why we're keeping qemu-system-arm around? 32-bit KVM support for ARM has been removed with Linux kernel 5.7 as far as I know, so I think we could likely drop the qemu-system-arm nowadays, too? Peter, Richard, what's your opinion on this?
Thomas
Re: QEMU 32-bit vs. 64-bit binaries
Quoted 14 lines · Thomas Huth
Quoted 11 lines · Markus Armbruster
Thomas Huth <[email protected]> writes:
[...]
Quoted 5 lines
I once suggested in the past already that we should maybe get rid of the 32-bit variants in case the 64-bit variant is a full superset, so we can save compile- and test times (which is quite a bit for QEMU), but I've been told that the 32-bit variants are mostly still required for supporting KVM on 32-bit host machines.
Do we still care for 32-bit host machines?
Quoted 7 lines
As long as the Linux kernel still supports 32-bit KVM virtualization, I think we have to keep the userspace around for that, too.
But I wonder why we're keeping qemu-system-arm around? 32-bit KVM support for ARM has been removed with Linux kernel 5.7 as far as I know, so I think we could likely drop the qemu-system-arm nowadays, too? Peter, Richard, what's your opinion on this?
Two main reasons, I think:
* command-line compatibility (ie there are lots of command lines out there using that binary name)
* nobody has yet cared enough to come up with a plan for what we want to do differently for these 32-bit architectures, so the default is "keep doing what we always have"
In particular, I don't want to get rid of qemu-system-arm as the *only* 32-bit target binary we drop. Either we stick with what we have or we have a larger plan for sorting this out consistently across target architectures.
-- PMM
Re: QEMU 32-bit vs. 64-bit binaries
Quoted 30 lines · * Peter Maydell ([email protected]) wrote:
Quoted 14 lines · Thomas Huth
Quoted 11 lines · Markus Armbruster
Thomas Huth <[email protected]> writes:
[...]
Quoted 5 lines
I once suggested in the past already that we should maybe get rid of the 32-bit variants in case the 64-bit variant is a full superset, so we can save compile- and test times (which is quite a bit for QEMU), but I've been told that the 32-bit variants are mostly still required for supporting KVM on 32-bit host machines.
Do we still care for 32-bit host machines?
Quoted 7 lines
As long as the Linux kernel still supports 32-bit KVM virtualization, I think we have to keep the userspace around for that, too.
But I wonder why we're keeping qemu-system-arm around? 32-bit KVM support for ARM has been removed with Linux kernel 5.7 as far as I know, so I think we could likely drop the qemu-system-arm nowadays, too? Peter, Richard, what's your opinion on this?
Two main reasons, I think:
* command-line compatibility (ie there are lots of command lines out there using that binary name)
* nobody has yet cared enough to come up with a plan for what we want to do differently for these 32-bit architectures, so the default is "keep doing what we always have"
Quoted 4 lines
In particular, I don't want to get rid of qemu-system-arm as the *only* 32-bit target binary we drop. Either we stick with what we have or we have a larger plan for sorting this out consistently across target architectures.
To my mind, qemu-system-arm makes a lot of sense, and I'd rather see the 32 bit guests disappear from qemu-system-aarch64.
It's difficult to justify to someone running their aarch virt stack why their binary has the security footprint that includes a camera or PDA.
ARM is a lot cleaner than x86; you don't suddenly find a little Cortex-M machine with a big 64 bit core in it; yet on x86 our machines are frankenstinian mixes with 25 year old chipsets and modern CPUs.
Dave
Quoted 2 lines
-- PMM
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: QEMU 32-bit vs. 64-bit binaries
Quoted 36 lines · Dr. David Alan Gilbert
Quoted 30 lines · * Peter Maydell ([email protected]) wrote:
Quoted 14 lines · Thomas Huth
Quoted 11 lines · Markus Armbruster
Thomas Huth <[email protected]> writes:
[...]
Quoted 5 lines
I once suggested in the past already that we should maybe get rid of the 32-bit variants in case the 64-bit variant is a full superset, so we can save compile- and test times (which is quite a bit for QEMU), but I've been told that the 32-bit variants are mostly still required for supporting KVM on 32-bit host machines.
Do we still care for 32-bit host machines?
Quoted 7 lines
As long as the Linux kernel still supports 32-bit KVM virtualization, I think we have to keep the userspace around for that, too.
But I wonder why we're keeping qemu-system-arm around? 32-bit KVM support for ARM has been removed with Linux kernel 5.7 as far as I know, so I think we could likely drop the qemu-system-arm nowadays, too? Peter, Richard, what's your opinion on this?
Two main reasons, I think:
* command-line compatibility (ie there are lots of command lines out there using that binary name)
* nobody has yet cared enough to come up with a plan for what we want to do differently for these 32-bit architectures, so the default is "keep doing what we always have"Quoted 4 lines
In particular, I don't want to get rid of qemu-system-arm as the *only* 32-bit target binary we drop. Either we stick with what we have or we have a larger plan for sorting this out consistently across target architectures.
Quoted 4 lines
To my mind, qemu-system-arm makes a lot of sense, and I'd rather see the 32 bit guests disappear from qemu-system-aarch64.
It's difficult to justify to someone running their aarch virt stack why their binary has the security footprint that includes a camera or PDA.
I'm not very familiar with KVM on ARM - but is it possible to use KVM there with an arbitrary machine? If that's the case, a user might want to use KVM on their 64-bit host to run a 32-bit guest machine, and then you need to keep the 32-bit machines in the -aarch64 binary.
Something like that is at least theoretically possible with ppc64, I think: Using KVM-PR, it should be possible to run a g3beige (i.e. 32-bit) machine on a 64-bit host. Not sure whether anybody has tried that in recent times (afaik KVM-PR is in a rather bad shape nowadays), but it might have been possible at one point in time in the past. (PPC folks, please correct me if I'm wrong)
Thomas
Re: QEMU 32-bit vs. 64-bit binaries
Quoted 5 lines · Thomas Huth
Quoted 4 lines · Dr. David Alan Gilbert
To my mind, qemu-system-arm makes a lot of sense, and I'd rather see the 32 bit guests disappear from qemu-system-aarch64.
It's difficult to justify to someone running their aarch virt stack why their binary has the security footprint that includes a camera or PDA.
There's a lot of stuff you would want to chop out if you want a stripped-down "just for KVM" binary, though, and not all of it is 32-bit-related. And unless you're chopping non-KVM machine types and devices out of qemu-system-aarch64 anyway, you need the 32-bit CPU support in there: we have a machine type which has both 64-bit and 32-bit CPUs in it.
Quoted 4 lines
I'm not very familiar with KVM on ARM - but is it possible to use KVM there with an arbitrary machine? If that's the case, a user might want to use KVM on their 64-bit host to run a 32-bit guest machine, and then you need to keep the 32-bit machines in the -aarch64 binary.
No, Arm KVM is pretty restrictive -- effectively you can only really use it with the 'virt' board. You can do a 32-bit guest, but you do that with qemu-system-aarch64 and telling the 64-bit vcpu "actually start with EL1 (guest kernel) in 32-bit mode".
thanks
-- PMM
Re: QEMU 32-bit vs. 64-bit binaries
In reply to Thomas HuthQuoted 37 lines · Thomas Huth
Quoted 36 lines · Dr. David Alan Gilbert
Quoted 34 lines · * Peter Maydell ([email protected]) wrote:
Quoted 14 lines · Thomas Huth
Quoted 11 lines · Markus Armbruster
Thomas Huth <[email protected]> writes:
[...]
Quoted 5 lines
I once suggested in the past already that we should maybe get rid of the 32-bit variants in case the 64-bit variant is a full superset, so we can save compile- and test times (which is quite a bit for QEMU), but I've been told that the 32-bit variants are mostly still required for supporting KVM on 32-bit host machines.
Do we still care for 32-bit host machines?
Quoted 7 lines
As long as the Linux kernel still supports 32-bit KVM virtualization, I think we have to keep the userspace around for that, too.
But I wonder why we're keeping qemu-system-arm around? 32-bit KVM support for ARM has been removed with Linux kernel 5.7 as far as I know, so I think we could likely drop the qemu-system-arm nowadays, too? Peter, Richard, what's your opinion on this?
Two main reasons, I think:
* command-line compatibility (ie there are lots of command lines out there using that binary name)
* nobody has yet cared enough to come up with a plan for what we want to do differently for these 32-bit architectures, so the default is "keep doing what we always have"In particular, I don't want to get rid of qemu-system-arm as the *only* 32-bit target binary we drop. Either we stick with what we have or we have a larger plan for sorting this out consistently across target architectures.
Quoted 8 lines
Quoted 4 lines
To my mind, qemu-system-arm makes a lot of sense, and I'd rather see the 32 bit guests disappear from qemu-system-aarch64.
It's difficult to justify to someone running their aarch virt stack why their binary has the security footprint that includes a camera or PDA.I'm not very familiar with KVM on ARM - but is it possible to use KVM there with an arbitrary machine? If that's the case, a user might want to use KVM on their 64-bit host to run a 32-bit guest machine, and then you need to keep the 32-bit machines in the -aarch64 binary.
Something like that is at least theoretically possible with ppc64, I think: Using KVM-PR, it should be possible to run a g3beige (i.e. 32-bit) machine on a 64-bit host. Not sure whether anybody has tried that in recent times (afaik KVM-PR is in a rather bad shape nowadays), but it might have been possible at one point in time in the past. (PPC folks, please correct me if I'm wrong)
https://www.talospace.com/2018/08/making-your-talos-ii-into-power-mac.html
Regards,
BALATON Zoltan
Re: QEMU 32-bit vs. 64-bit binaries
In reply to Thomas HuthHi,
Quoted 4 lines
I'm not very familiar with KVM on ARM - but is it possible to use KVM there with an arbitrary machine? If that's the case, a user might want to use KVM on their 64-bit host to run a 32-bit guest machine, and then you need to keep the 32-bit machines in the -aarch64 binary.
32-bit guest is 'qemu-system-aarch64 -machine virt -cpu host,aarch64=off' (and a aarch64 CPU which actually supports the armv7 instructions).
take care,
Gerd
Re: QEMU 32-bit vs. 64-bit binaries
Quoted 10 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
I'm not very familiar with KVM on ARM - but is it possible to use KVM there with an arbitrary machine? If that's the case, a user might want to use KVM on their 64-bit host to run a 32-bit guest machine, and then you need to keep the 32-bit machines in the -aarch64 binary.
32-bit guest is 'qemu-system-aarch64 -machine virt -cpu host,aarch64=off' (and a aarch64 CPU which actually supports the armv7 instructions).
It's still armv8 even when it's 32-bit :-) The requirement is AArch32 support at EL1. (Some hardware has AArch32 support at EL0 only, ie userspace but not kernel, which obviously isn't enough for 32-bit KVM guests.)
-- PMM
Quoted 179 lines · Murilo Opsfelder Araújo
Hi, Mark.
Thanks for reviewing. Comments below.
Quoted 30 lines · Mark Cave-Ayland
Quoted 28 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>---
hmp-commands-info.hx | 2 ++1 file changed, 2 insertions(+)hmp-commands-info.hx +0
-0@@ -881,6 +881,7 @@ SRSTERST
#ifdefined(TARGET_M68K)||defined(TARGET_PPC)
+#ifdefined(CONFIG_MOS6522)
{
.name = "via",
.args_type = "",hmp-commands-info.hx +0
-0@@ -889,6 +890,7 @@ ERSTQuoted 8 lines
Quoted 6 lines
hmp-commands-info.hx +1
-0.cmd = hmp_info_via, }, #endif +#endifSRST
``info via``Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
So my proposed fix worked just by coincidence. Thanks for providing the background.
Quoted 4 lines
Given that the g3beige and mac99 machines are included by default in qemu-system-ppc64 which both contain the MOS6522 device, I can't quite understand how
CONFIG_MOS6522isn't being selected.Can you give more information about how you are building QEMU including your configure command line?
Here is a reproducer adapted from CentOS 9 Stream qemu-kvm[0] package
(build failed on c9s ppc64le with QEMU at commitf5643914a9e8f79c606a76e6a9d7ea82a3fc3e65):$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build$ ../configure --cc=clang --cxx=/bin/false --prefix=/usr --libdir=/usr/lib64 --datadir=/usr/share --sysconfdir=/etc --interp-prefix=/usr/qemu-%M --localstatedir=/var --docdir=/usr/share/doc --libexecdir=/usr/libexec '--extra-ldflags=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now ' '--extra-cflags=-O2(quoted diff) +0
-2-fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config
/usr/lib/rpm/redhat/redhat-hardened-clang.cfg-fstack-protector-strong -m64(quoted diff) +0
-49-mcpu=power9 -mtune=power9 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-string-plus-int' --with-pkgversion=qemu-kvm-7.0.0-1.el9 --with-suffix=qemu-kvm --firmwarepath=/usr/share/qemu-firmware:/usr/share/ipxe/qemu:/usr/share/seavgabios:/usr/share/seabios --meson=internal --enable-trace-backend=dtrace --with-coroutine=ucontext --with-git=git --tls-priority=@QEMU,SYSTEM --audio-drv-list= --disable-alsa --disable-attr --disable-auth-pam --disable-avx2 --disable-avx512f --disable-block-drv-whitelist-in-tools --disable-bochs --disable-bpf --disable-brlapi --disable-bsd-user --disable-bzip2 --disable-cap-ng --disable-capstone --disable-cfi --disable-cfi-debug --disable-cloop --disable-cocoa --disable-coreaudio --disable-coroutine-pool --disable-crypto-afalg --disable-curl --disable-curses --disable-dbus-display --disable-debug-info --disable-debug-mutex --disable-debug-tcg --disable-dmg --disable-docs --disable-dsound --disable-fdt --disable-fuse --disable-fuse-lseek --disable-gcrypt --disable-gettext --disable-gio --disable-glusterfs --disable-gnutls --disable-gtk --disable-guest-agent --disable-guest-agent-msi --disable-hax --disable-hvf --disable-iconv --disable-jack --disable-kvm --disable-l2tpv3 --disable-libdaxctl --disable-libiscsi --disable-libnfs --disable-libpmem --disable-libssh --disable-libudev --disable-libusb --disable-linux-aio --disable-linux-io-uring --disable-linux-user --disable-live-block-migration --disable-lto --disable-lzfse --disable-lzo --disable-malloc-trim --disable-membarrier --disable-modules --disable-module-upgrades --disable-mpath --disable-multiprocess --disable-netmap --disable-nettle --disable-numa --disable-nvmm --disable-opengl --disable-oss --disable-pa --disable-parallels --disable-pie --disable-pvrdma --disable-qcow1 --disable-qed --disable-qga-vss --disable-qom-cast-debug --disable-rbd --disable-rdma --disable-replication --disable-rng-none --disable-safe-stack --disable-sanitizers --disable-sdl --disable-sdl-image --disable-seccomp --disable-selinux --disable-slirp --disable-slirp-smbd --disable-smartcard --disable-snappy --disable-sparse --disable-spice --disable-spice-protocol --disable-strip --disable-system --disable-tcg --disable-tools --disable-tpm --disable-u2f --disable-usb-redir --disable-user --disable-vde --disable-vdi --disable-vhost-crypto --disable-vhost-kernel --disable-vhost-net --disable-vhost-scsi --disable-vhost-user --disable-vhost-user-blk-server --disable-vhost-vdpa --disable-vhost-vsock --disable-virglrenderer --disable-virtfs --disable-virtiofsd --disable-vnc --disable-vnc-jpeg --disable-vnc-sasl --disable-vte --disable-vvfat --disable-werror --disable-whpx --disable-xen --disable-xen-pci-passthrough --disable-xkbcommon --disable-zstd --with-git-submodules=ignore --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress --block-drv-ro-whitelist=vdi,vmdk,vhdx,vpc,https --enable-attr --enable-cap-ng --enable-capstone=internal --enable-coroutine-pool --enable-curl --enable-debug-info --enable-docs --enable-fdt=system --enable-gnutls --enable-guest-agent --enable-iconv --enable-kvm --enable-libusb --enable-libudev --enable-linux-aio --enable-lzo --enable-malloc-trim --enable-modules --enable-mpath --enable-numa --enable-pa --enable-pie --enable-rbd --enable-rdma --enable-seccomp --enable-selinux --enable-slirp=system --enable-snappy --enable-spice-protocol --enable-system --enable-tcg --enable-tools --enable-tpm --enable-vdi --enable-virtiofsd --enable-vhost-kernel --enable-vhost-net --enable-vhost-user --enable-vhost-user-blk-server --enable-vhost-vdpa --enable-vhost-vsock --enable-vnc --enable-vnc-sasl --enable-werror --enable-xkbcommon$ make -O -j$(nproc) V=1 VERBOSE=1 ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via' clang-13: error: linker command failed with exit code 1 (use -v to see invocation)I have figured that it also fails with this minimal set of configure options (in addition to the devices CONFIG_* options above):
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit status
Quoted 8 lines
Since
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.If
hmp_info_viais generic enough and not device-specific, it could be moved out ofmos6522.cto somewhere else.What do you think?
[0] https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/qemu-kvm.spec#L686
It's probably easier if I post a link to the original thread at https://lore.kernel.org/all/[email protected]/ for reference but the main takeaway is:
- Device CONFIG_* defines aren't present when building hmp-commands-info.hx
- The TARGET_* defines are poisoned in qapi/qapi-commands-misc-target.h
- The long-term solution is to implement a DeviceClass function callback that allows "info debug <foo>" QMP-wrapped monitor commands to be registered dynamically by devices. But that needs someone with the time and ability to implement it.
The compromise was to accept the command wrapped by TARGET_ defines where it is used, but of course that won't work in this case where you're generating a custom configuration as above.
Certainly QEMU could do better here, but then if you are already patching the build to generate a custom configuration as above, you might as well just patch out the relevant part of hmp-commands-info.hx at the same time until proper per-device HMP/QMP support is added.
ATB,
Mark.
Hi, Mark.
Quoted 144 lines · Mark Cave-Ayland
Quoted 127 lines · Murilo Opsfelder Araújo
Hi, Mark.
Thanks for reviewing. Comments below.
Quoted 30 lines · Mark Cave-Ayland
Quoted 28 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>---
hmp-commands-info.hx | 2 ++1 file changed, 2 insertions(+)hmp-commands-info.hx +0
-0@@ -881,6 +881,7 @@ SRSTERST
#ifdefined(TARGET_M68K)||defined(TARGET_PPC)
+#ifdefined(CONFIG_MOS6522)
{
.name = "via",
.args_type = "",hmp-commands-info.hx +0
-0@@ -889,6 +890,7 @@ ERSTQuoted 8 lines
Quoted 6 lines
hmp-commands-info.hx +1
-0.cmd = hmp_info_via, }, #endif +#endifSRST
``info via``Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
So my proposed fix worked just by coincidence. Thanks for providing the background.
Quoted 4 lines
Given that the g3beige and mac99 machines are included by default in qemu-system-ppc64 which both contain the MOS6522 device, I can't quite understand how
CONFIG_MOS6522isn't being selected.Can you give more information about how you are building QEMU including your configure command line?
Here is a reproducer adapted from CentOS 9 Stream qemu-kvm[0] package
(build failed on c9s ppc64le with QEMU at commitf5643914a9e8f79c606a76e6a9d7ea82a3fc3e65):$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build$ ../configure --cc=clang --cxx=/bin/false --prefix=/usr --libdir=/usr/lib64 --datadir=/usr/share --sysconfdir=/etc --interp-prefix=/usr/qemu-%M --localstatedir=/var --docdir=/usr/share/doc --libexecdir=/usr/libexec '--extra-ldflags=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now ' '--extra-cflags=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -m64 -mcpu=power9 -mtune=power9 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-string-plus-int' --with-pkgversion=qemu-kvm-7.0.0-1.el9 --with-suffix=qemu-kvm --firmwarepath=/usr/share/qemu-firmware:/usr/share/ipxe/qemu:/usr/share/seavgabios:/usr/share/seabios --meson=internal --enable-trace-backend=dtrace --with-coroutine=ucontext --with-git=git --tls-priority=@QEMU,SYSTEM --audio-drv-list= --disable-alsa --disable-attr --disable-auth-pam --disable-avx2 --disable-avx512f --disable-block-drv-whitelist-in-tools --disable-bochs --disable-bpf --disable-brlapi --disable-bsd-user --disable-bzip2 --disable-cap-ng --disable-capstone --disable-cfi --disable-cfi-debug --disable-cloop --disable-cocoa --disable-coreaudio --disable-coroutine-pool --disable-crypto-afalg --disable-curl --disable-curses --disable-dbus-display --disable-debug-info --disable-debug-mutex --disable-debug-tcg --disable-dmg --disable-docs --disable-dsound --disable-fdt --disable-fuse --disable-fuse-lseek --disable-gcrypt --disable-gettext --disable-gio --disable-glusterfs --disable-gnutls --disable-gtk --disable-guest-agent --disable-guest-agent-msi --disable-hax --disable-hvf --disable-iconv --disable-jack --disable-kvm --disable-l2tpv3 --disable-libdaxctl --disable-libiscsi --disable-libnfs --disable-libpmem --disable-libssh --disable-libudev --disable-libusb --disable-linux-aio --disable-linux-io-uring --disable-linux-user --disable-live-block-migration --disable-lto --disable-lzfse --disable-lzo --disable-malloc-trim --disable-membarrier --disable-modules --disable-module-upgrades --disable-mpath --disable-multiprocess --disable-netmap --disable-nettle --disable-numa --disable-nvmm --disable-opengl --disable-oss --disable-pa --disable-parallels --disable-pie --disable-pvrdma --disable-qcow1 --disable-qed --disable-qga-vss --disable-qom-cast-debug --disable-rbd --disable-rdma --disable-replication --disable-rng-none --disable-safe-stack --disable-sanitizers --disable-sdl --disable-sdl-image --disable-seccomp --disable-selinux --disable-slirp --disable-slirp-smbd --disable-smartcard --disable-snappy --disable-sparse --disable-spice --disable-spice-protocol --disable-strip --disable-system --disable-tcg --disable-tools --disable-tpm --disable-u2f --disable-usb-redir --disable-user --disable-vde --disable-vdi --disable-vhost-crypto --disable-vhost-kernel --disable-vhost-net --disable-vhost-scsi --disable-vhost-user --disable-vhost-user-blk-server --disable-vhost-vdpa --disable-vhost-vsock --disable-virglrenderer --disable-virtfs --disable-virtiofsd --disable-vnc --disable-vnc-jpeg --disable-vnc-sasl --disable-vte --disable-vvfat --disable-werror --disable-whpx --disable-xen --disable-xen-pci-passthrough --disable-xkbcommon --disable-zstd --with-git-submodules=ignore --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress --block-drv-ro-whitelist=vdi,vmdk,vhdx,vpc,https --enable-attr --enable-cap-ng --enable-capstone=internal --enable-coroutine-pool --enable-curl --enable-debug-info --enable-docs --enable-fdt=system --enable-gnutls --enable-guest-agent --enable-iconv --enable-kvm --enable-libusb --enable-libudev --enable-linux-aio --enable-lzo --enable-malloc-trim --enable-modules --enable-mpath --enable-numa --enable-pa --enable-pie --enable-rbd --enable-rdma --enable-seccomp --enable-selinux --enable-slirp=system --enable-snappy --enable-spice-protocol --enable-system --enable-tcg --enable-tools --enable-tpm --enable-vdi --enable-virtiofsd --enable-vhost-kernel --enable-vhost-net --enable-vhost-user --enable-vhost-user-blk-server --enable-vhost-vdpa --enable-vhost-vsock --enable-vnc --enable-vnc-sasl --enable-werror --enable-xkbcommon$ make -O -j$(nproc) V=1 VERBOSE=1 ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via' clang-13: error: linker command failed with exit code 1 (use -v to see invocation)I have figured that it also fails with this minimal set of configure options (in addition to the devices CONFIG_* options above):
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit statusQuoted 8 lines
Since
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.If
hmp_info_viais generic enough and not device-specific, it could be moved out ofmos6522.cto somewhere else.What do you think?
[0] https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/qemu-kvm.spec#L686
It's probably easier if I post a link to the original thread at https://lore.kernel.org/all/[email protected]/ for reference but the main takeaway is:
- Device CONFIG_* defines aren't present when building hmp-commands-info.hx
- The TARGET_* defines are poisoned in
qapi/qapi-commands-misc-target.h
Quoted 7 lines
- The long-term solution is to implement a DeviceClass function callback that allows "info debug <foo>" QMP-wrapped monitor commands to be registered dynamically by devices. But that needs someone with the time and ability to implement it.
The compromise was to accept the command wrapped by
TARGET_defines where it is used, but of course that won't work in this case where you're generating a custom configuration as above.Certainly QEMU could do better here, but then if you are already patching the build to generate a custom configuration as above, you might as well just patch out the relevant part of hmp-commands-info.hx at the same time until proper per-device HMP/QMP support is added.
We are not patching the build. We are just configuring it.
QEMU at tag v6.2.0 works with the exact same configuration. QEMU 7.0.0 does not.
This is a regression in QEMU source code.
Is my ideia of moving the hmp_info_via implementation out of mos6522.c an acceptable way to have this fixed in the short-term?
Thank you!
Signature · 1 line
Murilo
Quoted 207 lines · Murilo Opsfelder Araújo
Hi, Mark.
Quoted 204 lines · Mark Cave-Ayland
Quoted 183 lines · Murilo Opsfelder Araújo
Hi, Mark.
Thanks for reviewing. Comments below.
Quoted 30 lines · Mark Cave-Ayland
Quoted 28 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>---
hmp-commands-info.hx | 2 ++1 file changed, 2 insertions(+)hmp-commands-info.hx +0
-0@@ -881,6 +881,7 @@ SRSTERST
#ifdefined(TARGET_M68K)||defined(TARGET_PPC)
+#ifdefined(CONFIG_MOS6522)
{
.name = "via",
.args_type = "",hmp-commands-info.hx +0
-0@@ -889,6 +890,7 @@ ERSTQuoted 8 lines
Quoted 6 lines
hmp-commands-info.hx +1
-0.cmd = hmp_info_via, }, #endif +#endifSRST
``info via``Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
So my proposed fix worked just by coincidence. Thanks for providing the background.
Quoted 4 lines
Given that the g3beige and mac99 machines are included by default in qemu-system-ppc64 which both contain the MOS6522 device, I can't quite understand how
CONFIG_MOS6522isn't being selected.Can you give more information about how you are building QEMU including your configure command line?
Here is a reproducer adapted from CentOS 9 Stream qemu-kvm[0] package
(build failed on c9s ppc64le with QEMU at commitf5643914a9e8f79c606a76e6a9d7ea82a3fc3e65):$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build$ ../configure --cc=clang --cxx=/bin/false --prefix=/usr --libdir=/usr/lib64 --datadir=/usr/share --sysconfdir=/etc --interp-prefix=/usr/qemu-%M --localstatedir=/var --docdir=/usr/share/doc --libexecdir=/usr/libexec '--extra-ldflags=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now ' '--extra-cflags=-O2(quoted diff) +0
-2-fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config
/usr/lib/rpm/redhat/redhat-hardened-clang.cfg-fstack-protector-strong -m64(quoted diff) +0
-53-mcpu=power9 -mtune=power9 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-string-plus-int' --with-pkgversion=qemu-kvm-7.0.0-1.el9 --with-suffix=qemu-kvm --firmwarepath=/usr/share/qemu-firmware:/usr/share/ipxe/qemu:/usr/share/seavgabios:/usr/share/seabios --meson=internal --enable-trace-backend=dtrace --with-coroutine=ucontext --with-git=git --tls-priority=@QEMU,SYSTEM --audio-drv-list= --disable-alsa --disable-attr --disable-auth-pam --disable-avx2 --disable-avx512f --disable-block-drv-whitelist-in-tools --disable-bochs --disable-bpf --disable-brlapi --disable-bsd-user --disable-bzip2 --disable-cap-ng --disable-capstone --disable-cfi --disable-cfi-debug --disable-cloop --disable-cocoa --disable-coreaudio --disable-coroutine-pool --disable-crypto-afalg --disable-curl --disable-curses --disable-dbus-display --disable-debug-info --disable-debug-mutex --disable-debug-tcg --disable-dmg --disable-docs --disable-dsound --disable-fdt --disable-fuse --disable-fuse-lseek --disable-gcrypt --disable-gettext --disable-gio --disable-glusterfs --disable-gnutls --disable-gtk --disable-guest-agent --disable-guest-agent-msi --disable-hax --disable-hvf --disable-iconv --disable-jack --disable-kvm --disable-l2tpv3 --disable-libdaxctl --disable-libiscsi --disable-libnfs --disable-libpmem --disable-libssh --disable-libudev --disable-libusb --disable-linux-aio --disable-linux-io-uring --disable-linux-user --disable-live-block-migration --disable-lto --disable-lzfse --disable-lzo --disable-malloc-trim --disable-membarrier --disable-modules --disable-module-upgrades --disable-mpath --disable-multiprocess --disable-netmap --disable-nettle --disable-numa --disable-nvmm --disable-opengl --disable-oss --disable-pa --disable-parallels --disable-pie --disable-pvrdma --disable-qcow1 --disable-qed --disable-qga-vss --disable-qom-cast-debug --disable-rbd --disable-rdma --disable-replication --disable-rng-none --disable-safe-stack --disable-sanitizers --disable-sdl --disable-sdl-image --disable-seccomp --disable-selinux --disable-slirp --disable-slirp-smbd --disable-smartcard --disable-snappy --disable-sparse --disable-spice --disable-spice-protocol --disable-strip --disable-system --disable-tcg --disable-tools --disable-tpm --disable-u2f --disable-usb-redir --disable-user --disable-vde --disable-vdi --disable-vhost-crypto --disable-vhost-kernel --disable-vhost-net --disable-vhost-scsi --disable-vhost-user --disable-vhost-user-blk-server --disable-vhost-vdpa --disable-vhost-vsock --disable-virglrenderer --disable-virtfs --disable-virtiofsd --disable-vnc --disable-vnc-jpeg --disable-vnc-sasl --disable-vte --disable-vvfat --disable-werror --disable-whpx --disable-xen --disable-xen-pci-passthrough --disable-xkbcommon --disable-zstd --with-git-submodules=ignore --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress --block-drv-ro-whitelist=vdi,vmdk,vhdx,vpc,https --enable-attr --enable-cap-ng --enable-capstone=internal --enable-coroutine-pool --enable-curl --enable-debug-info --enable-docs --enable-fdt=system --enable-gnutls --enable-guest-agent --enable-iconv --enable-kvm --enable-libusb --enable-libudev --enable-linux-aio --enable-lzo --enable-malloc-trim --enable-modules --enable-mpath --enable-numa --enable-pa --enable-pie --enable-rbd --enable-rdma --enable-seccomp --enable-selinux --enable-slirp=system --enable-snappy --enable-spice-protocol --enable-system --enable-tcg --enable-tools --enable-tpm --enable-vdi --enable-virtiofsd --enable-vhost-kernel --enable-vhost-net --enable-vhost-user --enable-vhost-user-blk-server --enable-vhost-vdpa --enable-vhost-vsock --enable-vnc --enable-vnc-sasl --enable-werror --enable-xkbcommon$ make -O -j$(nproc) V=1 VERBOSE=1 ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via' clang-13: error: linker command failed with exit code 1 (use -v to see invocation)I have figured that it also fails with this minimal set of configure options (in addition to the devices CONFIG_* options above):
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit statusQuoted 8 lines
Since
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.If
hmp_info_viais generic enough and not device-specific, it could be moved out ofmos6522.cto somewhere else.What do you think?
[0] https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/qemu-kvm.spec#L686
It's probably easier if I post a link to the original thread at https://lore.kernel.org/all/[email protected]/ for reference but the main takeaway is:
- Device CONFIG_* defines aren't present when building hmp-commands-info.hx
- The TARGET_* defines are poisoned in
qapi/qapi-commands-misc-target.h- The long-term solution is to implement a DeviceClass function callback that allows "info debug <foo>" QMP-wrapped monitor commands to be registered dynamically by devices. But that needs someone with the time and ability to implement it.
Quoted 5 lines
Quoted 3 lines
The compromise was to accept the command wrapped by
TARGET_defines where it is used, but of course that won't work in this case where you're generating a custom configuration as above.Certainly QEMU could do better here, but then if you are already patching the build to generate a custom configuration as above, you might as well just patch out the relevant part of hmp-commands-info.hx at the same time until proper per-device HMP/QMP support is added.
We are not patching the build. We are just configuring it.
That's not true though: the spec file linked above contains 20 patches to the vanilla QEMU source, including feeding custom device lists into the build system via https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/0005-Enable-disable-devices-for-RHEL.patch. Perhaps CONFIG_MOS6522 is missing from ppc64-rh-devices?
If you need to generate a build within a short timeframe then patching out the part of the build that fails for you is going to be the quickest solution.
Quoted 3 lines
QEMU at tag v6.2.0 works with the exact same configuration. QEMU 7.0.0 does not.
This is a regression in QEMU source code.
I've just tried a plain "./configure --target-list=ppc64-softmmu" build here on my x86_64 host using git master and everything builds fine, and of course it passes gitlab-CI since that is a pre-requisite for merging. The only thing I can think is that your RHEL ppc64 build is being patched to remove the Mac machines which is why you see the failure, in which case you should also update the patch to remove the part referencing hmp_info_via.
Quoted 1 line
Is my ideia of moving the
hmp_info_viaimplementation out ofmos6522.can acceptable way to have this fixed in the short-term?
The current solution was agreed after discussions with David and Daniel (the HMP and QMP maintainers) so they are the people who can advise you as to the best approach here. Unfortunately QEMU changes can involve testing an N x M matrix which gets even bigger when different accelerators are involved, so occassionally issues like this can still occur.
If you feel strongly that upstream should support this particular RHEL configuration then please consider adding it to gitlab-CI so that build issues like this can be detected before merge.
ATB,
Mark.
Hi, Mark.
Quoted 152 lines · Mark Cave-Ayland
Quoted 151 lines · Murilo Opsfelder Araújo
Hi, Mark.
Quoted 148 lines · Mark Cave-Ayland
Quoted 127 lines · Murilo Opsfelder Araújo
Hi, Mark.
Thanks for reviewing. Comments below.
Quoted 30 lines · Mark Cave-Ayland
Quoted 28 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>---
hmp-commands-info.hx | 2 ++1 file changed, 2 insertions(+)hmp-commands-info.hx +0
-0@@ -881,6 +881,7 @@ SRSTERST
#ifdefined(TARGET_M68K)||defined(TARGET_PPC)
+#ifdefined(CONFIG_MOS6522)
{
.name = "via",
.args_type = "",hmp-commands-info.hx +0
-0@@ -889,6 +890,7 @@ ERSTQuoted 8 lines
Quoted 6 lines
hmp-commands-info.hx +1
-0.cmd = hmp_info_via, }, #endif +#endifSRST
``info via``Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
So my proposed fix worked just by coincidence. Thanks for providing the background.
Quoted 4 lines
Given that the g3beige and mac99 machines are included by default in qemu-system-ppc64 which both contain the MOS6522 device, I can't quite understand how
CONFIG_MOS6522isn't being selected.Can you give more information about how you are building QEMU including your configure command line?
Here is a reproducer adapted from CentOS 9 Stream qemu-kvm[0] package
(build failed on c9s ppc64le with QEMU at commitf5643914a9e8f79c606a76e6a9d7ea82a3fc3e65):$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build$ ../configure --cc=clang --cxx=/bin/false --prefix=/usr --libdir=/usr/lib64 --datadir=/usr/share --sysconfdir=/etc --interp-prefix=/usr/qemu-%M --localstatedir=/var --docdir=/usr/share/doc --libexecdir=/usr/libexec '--extra-ldflags=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now ' '--extra-cflags=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -m64 -mcpu=power9 -mtune=power9 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-string-plus-int' --with-pkgversion=qemu-kvm-7.0.0-1.el9 --with-suffix=qemu-kvm --firmwarepath=/usr/share/qemu-firmware:/usr/share/ipxe/qemu:/usr/share/seavgabios:/usr/share/seabios --meson=internal --enable-trace-backend=dtrace --with-coroutine=ucontext --with-git=git --tls-priority=@QEMU,SYSTEM --audio-drv-list= --disable-alsa --disable-attr --disable-auth-pam --disable-avx2 --disable-avx512f --disable-block-drv-whitelist-in-tools --disable-bochs --disable-bpf --disable-brlapi --disable-bsd-user --disable-bzip2 --disable-cap-ng --disable-capstone --disable-cfi --disable-cfi-debug --disable-cloop --disable-cocoa --disable-coreaudio --disable-coroutine-pool --disable-crypto-afalg --disable-curl --disable-curses --disable-dbus-display --disable-debug-info --disable-debug-mutex --disable-debug-tcg --disable-dmg --disable-docs --disable-dsound --disable-fdt --disable-fuse --disable-fuse-lseek --disable-gcrypt --disable-gettext --disable-gio --disable-glusterfs --disable-gnutls --disable-gtk --disable-guest-agent --disable-guest-agent-msi --disable-hax --disable-hvf --disable-iconv --disable-jack --disable-kvm --disable-l2tpv3 --disable-libdaxctl --disable-libiscsi --disable-libnfs --disable-libpmem --disable-libssh --disable-libudev --disable-libusb --disable-linux-aio --disable-linux-io-uring --disable-linux-user --disable-live-block-migration --disable-lto --disable-lzfse --disable-lzo --disable-malloc-trim --disable-membarrier --disable-modules --disable-module-upgrades --disable-mpath --disable-multiprocess --disable-netmap --disable-nettle --disable-numa --disable-nvmm --disable-opengl --disable-oss --disable-pa --disable-parallels --disable-pie --disable-pvrdma --disable-qcow1 --disable-qed --disable-qga-vss --disable-qom-cast-debug --disable-rbd --disable-rdma --disable-replication --disable-rng-none --disable-safe-stack --disable-sanitizers --disable-sdl --disable-sdl-image --disable-seccomp --disable-selinux --disable-slirp --disable-slirp-smbd --disable-smartcard --disable-snappy --disable-sparse --disable-spice --disable-spice-protocol --disable-strip --disable-system --disable-tcg --disable-tools --disable-tpm --disable-u2f --disable-usb-redir --disable-user --disable-vde --disable-vdi --disable-vhost-crypto --disable-vhost-kernel --disable-vhost-net --disable-vhost-scsi --disable-vhost-user --disable-vhost-user-blk-server --disable-vhost-vdpa --disable-vhost-vsock --disable-virglrenderer --disable-virtfs --disable-virtiofsd --disable-vnc --disable-vnc-jpeg --disable-vnc-sasl --disable-vte --disable-vvfat --disable-werror --disable-whpx --disable-xen --disable-xen-pci-passthrough --disable-xkbcommon --disable-zstd --with-git-submodules=ignore --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress --block-drv-ro-whitelist=vdi,vmdk,vhdx,vpc,https --enable-attr --enable-cap-ng --enable-capstone=internal --enable-coroutine-pool --enable-curl --enable-debug-info --enable-docs --enable-fdt=system --enable-gnutls --enable-guest-agent --enable-iconv --enable-kvm --enable-libusb --enable-libudev --enable-linux-aio --enable-lzo --enable-malloc-trim --enable-modules --enable-mpath --enable-numa --enable-pa --enable-pie --enable-rbd --enable-rdma --enable-seccomp --enable-selinux --enable-slirp=system --enable-snappy --enable-spice-protocol --enable-system --enable-tcg --enable-tools --enable-tpm --enable-vdi --enable-virtiofsd --enable-vhost-kernel --enable-vhost-net --enable-vhost-user --enable-vhost-user-blk-server --enable-vhost-vdpa --enable-vhost-vsock --enable-vnc --enable-vnc-sasl --enable-werror --enable-xkbcommon$ make -O -j$(nproc) V=1 VERBOSE=1 ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via' clang-13: error: linker command failed with exit code 1 (use -v to see invocation)I have figured that it also fails with this minimal set of configure options (in addition to the devices CONFIG_* options above):
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit statusQuoted 8 lines
Since
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.If
hmp_info_viais generic enough and not device-specific, it could be moved out ofmos6522.cto somewhere else.What do you think?
[0] https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/qemu-kvm.spec#L686
It's probably easier if I post a link to the original thread at https://lore.kernel.org/all/[email protected]/ for reference but the main takeaway is:
- Device CONFIG_* defines aren't present when building hmp-commands-info.hx
- The TARGET_* defines are poisoned in
qapi/qapi-commands-misc-target.h- The long-term solution is to implement a DeviceClass function callback that allows "info debug <foo>" QMP-wrapped monitor commands to be registered dynamically by devices. But that needs someone with the time and ability to implement it.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
The compromise was to accept the command wrapped by
TARGET_defines where it is used, but of course that won't work in this case where you're generating a custom configuration as above.Certainly QEMU could do better here, but then if you are already patching the build to generate a custom configuration as above, you might as well just patch out the relevant part of hmp-commands-info.hx at the same time until proper per-device HMP/QMP support is added.
We are not patching the build. We are just configuring it.
That's not true though: the spec file linked above contains 20 patches to the vanilla QEMU source, including feeding custom device lists into the build system via https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/0005-Enable-disable-devices-for-RHEL.patch.
I'm sorry. I think I wasn't clear enough.
The reproducer I sent in the email was *adapted* from CentOS/RHEL qemu-kvm.spec.
Meaning that we configured the devices in the same way that the CentOS/RHEL package is configuring but used the unmodified QEMU source tree from upstream.
I did that because I wanted to mimic its configuration (devices and configure options) against the upstream code to determine if the failure was a downstream or upstream issue. It turns out it's an upstream regression.
Quoted 1 line
Perhaps
CONFIG_MOS6522is missing from ppc64-rh-devices?
I don't think so. Since the CONFIG_MOS6522 is available, one can build without it and code should cope with that.
Quoted 7 lines
If you need to generate a build within a short timeframe then patching out the part of the build that fails for you is going to be the quickest solution.
Quoted 3 lines
QEMU at tag v6.2.0 works with the exact same configuration. QEMU 7.0.0 does not.
This is a regression in QEMU source code.I've just tried a plain "./configure --target-list=ppc64-softmmu" build here on my
x86_64host using git master and everything builds fine, and of course it passes gitlab-CI since that is a pre-requisite for merging. The only thing I can think is that your RHEL ppc64 build is being patched to remove the Mac machines which is why you see the failure, in which case you should also update the patch to remove the part referencinghmp_info_via.
You need to configure the devices in order to reproduce the build issue.
Let me paste again the commands here in case you want to give them a try:
cat > configs/devices/rh-virtio.mak <<"EOF"CONFIG_VIRTIO=yCONFIG_VIRTIO_BALLOON=yCONFIG_VIRTIO_BLK=yCONFIG_VIRTIO_GPU=yCONFIG_VIRTIO_INPUT=yCONFIG_VIRTIO_INPUT_HOST=yCONFIG_VIRTIO_NET=yCONFIG_VIRTIO_RNG=yCONFIG_VIRTIO_SCSI=yCONFIG_VIRTIO_SERIAL=y
EOF
cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.makCONFIG_DIMM=yCONFIG_MEM_DEVICE=yCONFIG_NVDIMM=yCONFIG_PCI=yCONFIG_PCI_DEVICES=yCONFIG_PCI_TESTDEV=yCONFIG_PCI_EXPRESS=yCONFIG_PSERIES=yCONFIG_SCSI=yCONFIG_SPAPR_VSCSI=yCONFIG_TEST_DEVICES=yCONFIG_USB=yCONFIG_USB_OHCI=yCONFIG_USB_OHCI_PCI=yCONFIG_USB_SMARTCARD=yCONFIG_USB_STORAGE_CORE=yCONFIG_USB_STORAGE_CLASSIC=yCONFIG_USB_XHCI=yCONFIG_USB_XHCI_NEC=yCONFIG_USB_XHCI_PCI=yCONFIG_VFIO=yCONFIG_VFIO_PCI=yCONFIG_VGA=yCONFIG_VGA_PCI=yCONFIG_VHOST_USER=yCONFIG_VIRTIO_PCI=yCONFIG_VIRTIO_VGA=yCONFIG_WDT_IB6300ESB=yCONFIG_XICS=yCONFIG_XIVE=yCONFIG_TPM=yCONFIG_TPM_SPAPR=yCONFIG_TPM_EMULATOR=y
EOF
mkdir build && cd build
../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu make -j
Quoted 4 lines
Quoted 2 lines
Is my ideia of moving the
hmp_info_viaimplementation out ofmos6522.can acceptable way to have this fixed in the short-term?The current solution was agreed after discussions with David and Daniel (the HMP and QMP maintainers) so they are the people who can advise you as to the best approach here.
David, Daniel - any recommendation to fix this regression?
Quoted 1 line
Unfortunately QEMU changes can involve testing an N x M matrix which gets even bigger when different accelerators are involved, so occassionally issues like this can still occur.
Indeed. We can't predict what downstream or users will specify for device and configure options.
Quoted 2 lines
If you feel strongly that upstream should support this particular RHEL configuration then please consider adding it to gitlab-CI so that build issues like this can be detected before merge.
That's certainly a good idea.
Signature · 1 line
Murilo
Quoted 220 lines · Murilo Opsfelder Araújo
Hi, Mark.
Quoted 208 lines · Mark Cave-Ayland
Quoted 207 lines · Murilo Opsfelder Araújo
Hi, Mark.
Quoted 204 lines · Mark Cave-Ayland
Quoted 183 lines · Murilo Opsfelder Araújo
Hi, Mark.
Thanks for reviewing. Comments below.
Quoted 30 lines · Mark Cave-Ayland
Quoted 28 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>---
hmp-commands-info.hx | 2 ++1 file changed, 2 insertions(+)hmp-commands-info.hx +0
-0@@ -881,6 +881,7 @@ SRSTERST
#ifdefined(TARGET_M68K)||defined(TARGET_PPC)
+#ifdefined(CONFIG_MOS6522)
{
.name = "via",
.args_type = "",hmp-commands-info.hx +0
-0@@ -889,6 +890,7 @@ ERSTQuoted 8 lines
Quoted 6 lines
hmp-commands-info.hx +1
-0.cmd = hmp_info_via, }, #endif +#endifSRST
``info via``Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
So my proposed fix worked just by coincidence. Thanks for providing the background.
Quoted 4 lines
Given that the g3beige and mac99 machines are included by default in qemu-system-ppc64 which both contain the MOS6522 device, I can't quite understand how
CONFIG_MOS6522isn't being selected.Can you give more information about how you are building QEMU including your configure command line?
Here is a reproducer adapted from CentOS 9 Stream qemu-kvm[0] package
(build failed on c9s ppc64le with QEMU at commitf5643914a9e8f79c606a76e6a9d7ea82a3fc3e65):$ cat > configs/devices/rh-virtio.mak <<"EOF" CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_GPU=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_INPUT_HOST=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_RNG=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y EOF$ cat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak CONFIG_DIMM=y CONFIG_MEM_DEVICE=y CONFIG_NVDIMM=y CONFIG_PCI=y CONFIG_PCI_DEVICES=y CONFIG_PCI_TESTDEV=y CONFIG_PCI_EXPRESS=y CONFIG_PSERIES=y CONFIG_SCSI=y CONFIG_SPAPR_VSCSI=y CONFIG_TEST_DEVICES=y CONFIG_USB=y CONFIG_USB_OHCI=y CONFIG_USB_OHCI_PCI=y CONFIG_USB_SMARTCARD=y CONFIG_USB_STORAGE_CORE=y CONFIG_USB_STORAGE_CLASSIC=y CONFIG_USB_XHCI=y CONFIG_USB_XHCI_NEC=y CONFIG_USB_XHCI_PCI=y CONFIG_VFIO=y CONFIG_VFIO_PCI=y CONFIG_VGA=y CONFIG_VGA_PCI=y CONFIG_VHOST_USER=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_VGA=y CONFIG_WDT_IB6300ESB=y CONFIG_XICS=y CONFIG_XIVE=y CONFIG_TPM=y CONFIG_TPM_SPAPR=y CONFIG_TPM_EMULATOR=y EOF$ mkdir build $ cd build$ ../configure --cc=clang --cxx=/bin/false --prefix=/usr --libdir=/usr/lib64 --datadir=/usr/share --sysconfdir=/etc --interp-prefix=/usr/qemu-%M --localstatedir=/var --docdir=/usr/share/doc --libexecdir=/usr/libexec '--extra-ldflags=-Wl,-z,relro -Wl,--as-needed -Wl,-z,now ' '--extra-cflags=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall(quoted diff) +0
-56-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -m64 -mcpu=power9 -mtune=power9 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-string-plus-int' --with-pkgversion=qemu-kvm-7.0.0-1.el9 --with-suffix=qemu-kvm --firmwarepath=/usr/share/qemu-firmware:/usr/share/ipxe/qemu:/usr/share/seavgabios:/usr/share/seabios --meson=internal --enable-trace-backend=dtrace --with-coroutine=ucontext --with-git=git --tls-priority=@QEMU,SYSTEM --audio-drv-list= --disable-alsa --disable-attr --disable-auth-pam --disable-avx2 --disable-avx512f --disable-block-drv-whitelist-in-tools --disable-bochs --disable-bpf --disable-brlapi --disable-bsd-user --disable-bzip2 --disable-cap-ng --disable-capstone --disable-cfi --disable-cfi-debug --disable-cloop --disable-cocoa --disable-coreaudio --disable-coroutine-pool --disable-crypto-afalg --disable-curl --disable-curses --disable-dbus-display --disable-debug-info --disable-debug-mutex --disable-debug-tcg --disable-dmg --disable-docs --disable-dsound --disable-fdt --disable-fuse --disable-fuse-lseek --disable-gcrypt --disable-gettext --disable-gio --disable-glusterfs --disable-gnutls --disable-gtk --disable-guest-agent --disable-guest-agent-msi --disable-hax --disable-hvf --disable-iconv --disable-jack --disable-kvm --disable-l2tpv3 --disable-libdaxctl --disable-libiscsi --disable-libnfs --disable-libpmem --disable-libssh --disable-libudev --disable-libusb --disable-linux-aio --disable-linux-io-uring --disable-linux-user --disable-live-block-migration --disable-lto --disable-lzfse --disable-lzo --disable-malloc-trim --disable-membarrier --disable-modules --disable-module-upgrades --disable-mpath --disable-multiprocess --disable-netmap --disable-nettle --disable-numa --disable-nvmm --disable-opengl --disable-oss --disable-pa --disable-parallels --disable-pie --disable-pvrdma --disable-qcow1 --disable-qed --disable-qga-vss --disable-qom-cast-debug --disable-rbd --disable-rdma --disable-replication --disable-rng-none --disable-safe-stack --disable-sanitizers --disable-sdl --disable-sdl-image --disable-seccomp --disable-selinux --disable-slirp --disable-slirp-smbd --disable-smartcard --disable-snappy --disable-sparse --disable-spice --disable-spice-protocol --disable-strip --disable-system --disable-tcg --disable-tools --disable-tpm --disable-u2f --disable-usb-redir --disable-user --disable-vde --disable-vdi --disable-vhost-crypto --disable-vhost-kernel --disable-vhost-net --disable-vhost-scsi --disable-vhost-user --disable-vhost-user-blk-server --disable-vhost-vdpa --disable-vhost-vsock --disable-virglrenderer --disable-virtfs --disable-virtiofsd --disable-vnc --disable-vnc-jpeg --disable-vnc-sasl --disable-vte --disable-vvfat --disable-werror --disable-whpx --disable-xen --disable-xen-pci-passthrough --disable-xkbcommon --disable-zstd --with-git-submodules=ignore --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress --block-drv-ro-whitelist=vdi,vmdk,vhdx,vpc,https --enable-attr --enable-cap-ng --enable-capstone=internal --enable-coroutine-pool --enable-curl --enable-debug-info --enable-docs --enable-fdt=system --enable-gnutls --enable-guest-agent --enable-iconv --enable-kvm --enable-libusb --enable-libudev --enable-linux-aio --enable-lzo --enable-malloc-trim --enable-modules --enable-mpath --enable-numa --enable-pa --enable-pie --enable-rbd --enable-rdma --enable-seccomp --enable-selinux --enable-slirp=system --enable-snappy --enable-spice-protocol --enable-system --enable-tcg --enable-tools --enable-tpm --enable-vdi --enable-virtiofsd --enable-vhost-kernel --enable-vhost-net --enable-vhost-user --enable-vhost-user-blk-server --enable-vhost-vdpa --enable-vhost-vsock --enable-vnc --enable-vnc-sasl --enable-werror --enable-xkbcommon$ make -O -j$(nproc) V=1 VERBOSE=1 ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via' clang-13: error: linker command failed with exit code 1 (use -v to see invocation)I have figured that it also fails with this minimal set of configure options (in addition to the devices CONFIG_* options above):
$ ../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu $ make -j ... /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data.rel+0x3228): undefined reference to `hmp_info_via' collect2: error: ld returned 1 exit statusQuoted 8 lines
Since
TARGET_PPCis defined when building target ppc64-softmmu, thehmp_info_viawill be referenced when processing the hmp-commands-info.hx. However,hmp_info_viaimplementation resides onhw/misc/mos6522.c, which is built only ifCONFIG_MOS6522is defined, as per hw/misc/meson.build.If
hmp_info_viais generic enough and not device-specific, it could be moved out ofmos6522.cto somewhere else.What do you think?
[0] https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/qemu-kvm.spec#L686
It's probably easier if I post a link to the original thread at https://lore.kernel.org/all/[email protected]/ for reference but the main takeaway is:
- Device CONFIG_* defines aren't present when building hmp-commands-info.hx
- The TARGET_* defines are poisoned in
qapi/qapi-commands-misc-target.h- The long-term solution is to implement a DeviceClass function callback that allows "info debug <foo>" QMP-wrapped monitor commands to be registered dynamically by devices. But that needs someone with the time and ability to implement it.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
The compromise was to accept the command wrapped by
TARGET_defines where it is used, but of course that won't work in this case where you're generating a custom configuration as above.Certainly QEMU could do better here, but then if you are already patching the build to generate a custom configuration as above, you might as well just patch out the relevant part of hmp-commands-info.hx at the same time until proper per-device HMP/QMP support is added.
We are not patching the build. We are just configuring it.
That's not true though: the spec file linked above contains 20 patches to the vanilla QEMU source, including feeding custom device lists into the build system via https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/0005-Enable-disable-devices-for-RHEL.patch.
Quoted 7 lines
I'm sorry. I think I wasn't clear enough.
The reproducer I sent in the email was *adapted* from CentOS/RHEL qemu-kvm.spec.
Meaning that we configured the devices in the same way that the CentOS/RHEL package is configuring but used the unmodified QEMU source tree from upstream.I did that because I wanted to mimic its configuration (devices and configure options) against the upstream code to determine if the failure was a downstream or upstream issue. It turns out it's an upstream regression.
Ah so that's the problem then - you can't guarantee the configuration from a vendor-customised build will work with upstream, particularly when the build system itself has been patched. More explanation below.
Quoted 3 lines
Quoted 1 line
Perhaps
CONFIG_MOS6522is missing from ppc64-rh-devices?I don't think so. Since the
CONFIG_MOS6522is available, one can build without it and code should cope with that.
In an upstream build the default boards for each target are listed in the configs/ directory and Kconfig specifies the dependencies such that for ppc and ppc64 CONFIG_MOS6522 is **always** defined. However what happens in the .spec file you linked to is that the device lists **are being overridden** by the provided ppc64-rh-devices file which **doesn't** contain CONFIG_MOS6522. It seems to me that the .spec file can only work with that vendor-specific ppc64-rh-devices file if it also patches the build system to prevent this error occurring.
The question to ask is: what are you trying to do? If you want to test the latest and greatest code on a regular basis, then you want to be building from vanilla upstream to ensure that none of the vendor patches are responsible for any errors that you see.
If you're taking upstream and applying a vendor-specific configuration then equally that isn't a valid test, since your builds aren't integrating the vendor-specific patches which can potentially cause regressions/differences or different behaviours that don't exist in upstream.
Do you get a working build if you run rpmbuild on the SRPM containing the .spec file you linked to? Updating that .spec file to use a tarball of the latest code seems to be the only way to get a build that is as close as possible to RHEL/CentOS stream.
Quoted 75 lines
Quoted 7 lines
If you need to generate a build within a short timeframe then patching out the part of the build that fails for you is going to be the quickest solution.
Quoted 3 lines
QEMU at tag v6.2.0 works with the exact same configuration. QEMU 7.0.0 does not.
This is a regression in QEMU source code.I've just tried a plain "./configure --target-list=ppc64-softmmu" build here on my
x86_64host using git master and everything builds fine, and of course it passes gitlab-CI since that is a pre-requisite for merging. The only thing I can think is that your RHEL ppc64 build is being patched to remove the Mac machines which is why you see the failure, in which case you should also update the patch to remove the part referencinghmp_info_via.You need to configure the devices in order to reproduce the build issue.
Let me paste again the commands here in case you want to give them a try:
cat > configs/devices/rh-virtio.mak <<"EOF"
CONFIG_VIRTIO=yCONFIG_VIRTIO_BALLOON=yCONFIG_VIRTIO_BLK=yCONFIG_VIRTIO_GPU=yCONFIG_VIRTIO_INPUT=yCONFIG_VIRTIO_INPUT_HOST=yCONFIG_VIRTIO_NET=yCONFIG_VIRTIO_RNG=yCONFIG_VIRTIO_SCSI=yCONFIG_VIRTIO_SERIAL=y
EOFcat > configs/devices/ppc64-softmmu/ppc64-rh-devices.mak <<"EOF" include ../rh-virtio.mak
CONFIG_DIMM=yCONFIG_MEM_DEVICE=yCONFIG_NVDIMM=yCONFIG_PCI=yCONFIG_PCI_DEVICES=yCONFIG_PCI_TESTDEV=yCONFIG_PCI_EXPRESS=yCONFIG_PSERIES=yCONFIG_SCSI=yCONFIG_SPAPR_VSCSI=yCONFIG_TEST_DEVICES=yCONFIG_USB=yCONFIG_USB_OHCI=yCONFIG_USB_OHCI_PCI=yCONFIG_USB_SMARTCARD=yCONFIG_USB_STORAGE_CORE=yCONFIG_USB_STORAGE_CLASSIC=yCONFIG_USB_XHCI=yCONFIG_USB_XHCI_NEC=yCONFIG_USB_XHCI_PCI=yCONFIG_VFIO=yCONFIG_VFIO_PCI=yCONFIG_VGA=yCONFIG_VGA_PCI=yCONFIG_VHOST_USER=yCONFIG_VIRTIO_PCI=yCONFIG_VIRTIO_VGA=yCONFIG_WDT_IB6300ESB=yCONFIG_XICS=yCONFIG_XIVE=yCONFIG_TPM=yCONFIG_TPM_SPAPR=yCONFIG_TPM_EMULATOR=y
EOFmkdir build && cd build
../configure --without-default-devices --with-devices-ppc64=ppc64-rh-devices --target-list=ppc64-softmmu
make -jQuoted 4 lines
Quoted 2 lines
Is my ideia of moving the
hmp_info_viaimplementation out ofmos6522.can acceptable way to have this fixed in the short-term?The current solution was agreed after discussions with David and Daniel (the HMP and QMP maintainers) so they are the people who can advise you as to the best approach here.
David, Daniel - any recommendation to fix this regression?
Quoted 8 lines
Quoted 1 line
Unfortunately QEMU changes can involve testing an N x M matrix which gets even bigger when different accelerators are involved, so occassionally issues like this can still occur.
Indeed. We can't predict what downstream or users will specify for device and configure options.
Quoted 2 lines
If you feel strongly that upstream should support this particular RHEL configuration then please consider adding it to gitlab-CI so that build issues like this can be detected before merge.
That's certainly a good idea.
ATB,
Mark.
QEMU with reduced amount of machines in the config (was: [PATCH] mos6522: fix linking error when CONFIG_MOS6522 is not set)
Quoted 17 lines · Mark Cave-Ayland
Quoted 15 lines · Murilo Opsfelder Araújo
Hi, Mark.
Quoted 12 lines · Mark Cave-Ayland
Quoted 11 lines · Murilo Opsfelder Araújo
Hi, Mark.
Quoted 8 lines · Mark Cave-Ayland
Quoted 6 lines · Murilo Opsfelder Araújo
Hi, Mark.
Thanks for reviewing. Comments below.
Quoted 1 line · Mark Cave-Ayland
On 30/04/2022 00:31, Murilo Opsfelder Araujo wrote:
[...]
Quoted 14 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Certainly QEMU could do better here, but then if you are already patching the build to generate a custom configuration as above, you might as well just patch out the relevant part of hmp-commands-info.hx at the same time until proper per-device HMP/QMP support is added.
We are not patching the build. We are just configuring it.
That's not true though: the spec file linked above contains 20 patches to the vanilla QEMU source, including feeding custom device lists into the build system via https://gitlab.com/redhat/centos-stream/rpms/qemu-kvm/-/blob/c9s/0005-Enable-disable-devices-for-RHEL.patch.
Quoted 7 lines
I'm sorry. I think I wasn't clear enough.
The reproducer I sent in the email was *adapted* from CentOS/RHEL qemu-kvm.spec.
Meaning that we configured the devices in the same way that the CentOS/RHEL package is configuring but used the unmodified QEMU source tree from upstream.I did that because I wanted to mimic its configuration (devices and configure options) against the upstream code to determine if the failure was a downstream or upstream issue. It turns out it's an upstream regression.
Quoted 7 lines
Ah so that's the problem then - you can't guarantee the configuration from a vendor-customised build will work with upstream, particularly when the build system itself has been patched. More explanation below.
Quoted 3 lines
Quoted 1 line
Perhaps
CONFIG_MOS6522is missing from ppc64-rh-devices?I don't think so. Since the
CONFIG_MOS6522is available, one can build without it and code should cope with that.In an upstream build the default boards for each target are listed in the configs/ directory and
Kconfigspecifies the dependencies such that for ppc and ppc64CONFIG_MOS6522is **always** defined. However what happens in the .spec file you linked to is that the device lists **are being overridden** by the provided ppc64-rh-devices file which **doesn't** containCONFIG_MOS6522. It seems to me that the .spec file can only work with that vendor-specific ppc64-rh-devices file if it also patches the build system to prevent this error occurring.
Well, yes and no. QEMU was quite monolitic for many years (that's where most of these downstream patches have their origin from), but the Kconfig stuff that was introduced a while ago (which required quite a lot of patches to untangle many parts of the build) was indeed meant for giving more flexibility here, so that downstream vendors could build QEMU more easily with only a subset of the machines (which is not only a desire by Red Hat, by the way - do you remember the "nemu" fork a while ago for example?). We still have quite a bit on the TODO list for full flexibility (e.g. mips config has not been fully switched to Kconfig yet, I think), but for most architectures, it should already work that you only select a subset of the available machines.
However, as you already noticed the big downside is still that this is not tested automatically in the upstream CI environment, so regressions like this one here with the mos6522 are expected. In the long run, I think we certainly want to test e.g. this cut-down CentOS-stream configuration in the CI, too ... it's just a big bunch of work that nobody started to tangle with yet.
Thomas
Quoted 30 lines · Mark Cave-Ayland
Quoted 28 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>---
hmp-commands-info.hx | 2 ++1 file changed, 2 insertions(+)hmp-commands-info.hx +0
-0@@ -881,6 +881,7 @@ SRSTERST
#ifdefined(TARGET_M68K)||defined(TARGET_PPC)
+#ifdefined(CONFIG_MOS6522)
{
.name = "via",
.args_type = "",hmp-commands-info.hx +0
-0@@ -889,6 +890,7 @@ ERST
Quoted 8 lines
Quoted 6 lines
hmp-commands-info.hx +1
-0.cmd = hmp_info_via, }, #endif +#endifSRST
``info via``Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
I've sent a v2 of this patch that addresses this, i.e.: the CONFIG_* options are available in hmp-commands-info.hx:
https://lore.kernel.org/qemu-devel/[email protected]/
I hope it can resolve the build issue in the short-term. I'd appreciate if you or anyone on this thread could review it.
Thank you, Mark, for the discussion and knowledge sharing!
Cheers!
Signature · 1 line
Murilo
Quoted 40 lines · Murilo Opsfelder Araújo
Quoted 30 lines · Mark Cave-Ayland
Quoted 28 lines · Murilo Opsfelder Araujo
When
CONFIG_MOS6522is not set, building ppc64-softmmu target fails:
/usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)Add
CONFIG_MOS6522check forhmp_info_viain hmp-commands-info.hx to fix such linking error.Fixes 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)Signed-off-by Murilo Opsfelder Araujo <[email protected]>Cc Mark Cave-Ayland <[email protected]>Cc Fabiano Rosas <[email protected]>---
hmp-commands-info.hx | 2 ++1 file changed, 2 insertions(+)hmp-commands-info.hx +0
-0@@ -881,6 +881,7 @@ SRSTERST
#ifdefined(TARGET_M68K)||defined(TARGET_PPC)
+#ifdefined(CONFIG_MOS6522)
{
.name = "via",
.args_type = "",hmp-commands-info.hx +0
-0@@ -889,6 +890,7 @@ ERSTQuoted 8 lines
Quoted 6 lines
hmp-commands-info.hx +1
-0.cmd = hmp_info_via, }, #endif +#endifSRST
``info via``Hmmm. The patch in its proposed form isn't correct, since device CONFIG_* defines aren't declared when processing hmp-commands-info.hx. This was something that was discovered and discussed in the original thread for which the current workaround is to use the per-target TARGET_* defines instead.
Quoted 8 lines
I've sent a v2 of this patch that addresses this, i.e.: the CONFIG_* options are available in hmp-commands-info.hx:
https://lore.kernel.org/qemu-devel/[email protected]/
I hope it can resolve the build issue in the short-term. I'd appreciate if you or anyone on this thread could review it.
Thank you, Mark, for the discussion and knowledge sharing!
No worries. I suspect there must be a reason why this wasn't suggested when I submitted the original patch, but that knowledge would clearly lie with the HMP and QMP maintainers.
ATB,
Mark.