John Snow [Wed, 18 Feb 2026 21:34:10 +0000 (16:34 -0500)]
configure: unconditionally install "tooling" group
Alongside meson, always ensure our in-tree tooling group and its
out-of-tree dependency, qemu.qmp, is always installed.
As a result, several "check-venv" invocations can be removed from
various testing scripts.
Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260218213416.674483-16-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:34:09 +0000 (16:34 -0500)]
meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
Add the local python package group into pythondeps.toml for the tooling
group. This makes qemu.qmp, qemu.machine and qemu.utils packages
unconditionally available for tests and scripts.
Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260218213416.674483-15-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:34:08 +0000 (16:34 -0500)]
meson, mkvenv: make functional tests depend on functests group
Note that only the thorough group requires the extra testing
dependencies; the quick group will run with just the "tooling" group,
which we intend to install by default at configure time in a forthcoming
commit.
Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260218213416.674483-14-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 29 Oct 2025 18:22:06 +0000 (14:22 -0400)]
python: add vendored qemu.qmp package
In anticipation of deleting the python/qemu/qmp source from the tree,
add a vendored version of the qemu.qmp package to ensure that "make
check" can be run in isolated build environments, offline.
Acked-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-13-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
Peter Maydell [Tue, 24 Feb 2026 11:33:01 +0000 (11:33 +0000)]
Merge tag 'pull-fpu-20260224' of https://gitlab.com/rth7680/qemu into staging
- Reformat NaN classification to share code
- Fix pseudo-NaN handling in FPATAN/FYL2XP1/FYL2X helpers
- Add conversion routines for OCP FP8 and FP4 formats
* tag 'pull-fpu-20260224' of https://gitlab.com/rth7680/qemu:
fpu: Add conversion routines for OCP FP4 E2M1
fpu: Add conversion routines for OCP FP8 E4M3
fpu: Add conversion routines for OCP FP8 E5M2
fpu: Add saturate parameter to parts_uncanon
fpu: Add overflow_raises_invalid to FloatFmt
fpu: Introduce FloatFmtExpMaxKind
target/i386: Fix pseudo-NaN handling in FPATAN/FYL2XP1/FYL2X helpers
fpu/softfloat: Refactor floatx80 format NaN classification to share code
fpu/softfloat: Refactor IEEE format NaN classification to share code
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
fdmon-io_uring: check CQ ring directly in gsource_check
aio-posix: notify main loop when SQEs are queued
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Max Chou [Thu, 5 Feb 2026 11:10:46 +0000 (21:10 +1000)]
fpu: Add conversion routines for OCP FP4 E2M1
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Max Chou <max.chou@sifive.com>
[rth: Update for exp_max_kind] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Max Chou [Thu, 5 Feb 2026 10:45:25 +0000 (20:45 +1000)]
fpu: Add conversion routines for OCP FP8 E4M3
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Max Chou <max.chou@sifive.com>
[rth: Split out of a larger patch; adjust overflow detection.] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Max Chou [Thu, 5 Feb 2026 07:35:56 +0000 (17:35 +1000)]
fpu: Add conversion routines for OCP FP8 E5M2
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Max Chou <max.chou@sifive.com>
[rth: Split out of a larger patch] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Max Chou [Thu, 5 Feb 2026 06:29:28 +0000 (16:29 +1000)]
fpu: Add saturate parameter to parts_uncanon
The OCP FP8 conversion operations have a parameter to control
saturate vs overflow. Add a parameter, currently always false.
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Max Chou <max.chou@sifive.com>
[rth: Split out of a larger patch] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Max Chou [Thu, 5 Feb 2026 05:37:37 +0000 (15:37 +1000)]
fpu: Add overflow_raises_invalid to FloatFmt
ARM Alt HP raises different exceptions on overflow than is
standard for IEEE when saturating a value. Add a flag to
control this effect.
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Max Chou <max.chou@sifive.com>
[rth: Split out of a larger patch] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Generalize arm_althp to indicate how exp==max should
be handled for the format. Reorganize canonicalize
and uncanon_normal to use a switch statement, allowing
more cases to be added trivially.
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Max Chou [Wed, 4 Feb 2026 05:17:40 +0000 (13:17 +0800)]
target/i386: Fix pseudo-NaN handling in FPATAN/FYL2XP1/FYL2X helpers
According to Intel's x87 FPU specification (Table 8-10, Vol. 1), arithmetic
operations on operands in unsupported formats (including pseudo-NaNs) must
return the QNaN floating-point indefinite value.
The helper functions for FPATAN, FYL2XP1, and FYL2X incorrectly check for
signaling NaN before checking for invalid encodings. This causes pseudo-NaNs
to be treated as valid signaling NaNs and silenced, rather than being
rejected as unsupported formats.
Reorder the checks to test floatx80_invalid_encoding before
floatx80_is_signaling_nan, matching the correct behavior already
implemented in helper_fscale.
Signed-off-by: Max Chou <max.chou@sifive.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260204051756.667397-5-max.chou@sifive.com>
Max Chou [Wed, 4 Feb 2026 05:17:39 +0000 (13:17 +0800)]
fpu/softfloat: Refactor floatx80 format NaN classification to share code
The floatx80_is_[quiet|signaling]_nan functions contain duplicated
logic that should be shared.
This commit introduces floatx80_nan_is_snan helper function that
determine if a NaN is signaling and change the return type of
floatx80_is_[signaling|quiet]_nan to bool.
Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Max Chou <max.chou@sifive.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260204051756.667397-4-max.chou@sifive.com>
Max Chou [Wed, 4 Feb 2026 05:17:38 +0000 (13:17 +0800)]
fpu/softfloat: Refactor IEEE format NaN classification to share code
The floatN_is_[quiet|signaling]_nan functions for following formats
(float16, bfloat16, float32, float64, float128) contain duplicated
logic that should be shared.
This commit introduces
[float16|bfloat16|float32|float64|float128]_nan_is_snan that determine
if a NaN is signaling.
Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Max Chou <max.chou@sifive.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260204051756.667397-3-max.chou@sifive.com>
Pierrick Bouvier [Wed, 18 Feb 2026 17:23:56 +0000 (09:23 -0800)]
contrib/plugins/uftrace_symbols.py: filter out some addr2line error messages
This was found when tracing Hafnium and SLOF binaries, and it's probably
related to a bug in toolchain used. It's safe to ignore those entries,
and related symbols will still be present in output, whether they can be
found or not.
John Snow [Wed, 18 Feb 2026 21:34:06 +0000 (16:34 -0500)]
tests/lcitool: add python3 wheel and setuptools deps for qemu
Installing local dependencies while offline, without PyPI access,
requires the python3-setuptools and python3-wheel packages. Most
distributions have these available anyway for one reason or another, but
not all of them.
If you are asking yourself "Wait, aren't these packages guaranteed via
installation of pip, via the ensurepip module, which mkvenv takes
immense pains to provide for us?" - Well... since Python 3.13, "pip"
does not actually come with "setuptools" or "wheel" anymore, and so if
we want to build and install a python package, we actually need these
available in the host environment.
(Note that you don't need these packages just to install a pre-built
package, you only need them to *build* a package. With cutting edge
setuptools and pip, all locally installed packages, even in editable
mode, must be "built" first before being installed. Thus, these
dependencies are being added specifically to facilitate installing
qemu.git/python/qemu to the configure-time venv.)
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-12-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:34:05 +0000 (16:34 -0500)]
tests/lcitool: update lcitool to latest version
Update to latest lcitool master and refresh tests. Fedora is upgraded to
Fedora 43 and Alpine from 3.21 to 3.23 as a result.
This is being done in this series primarily to ensure that MacOS
installs python-setuptools, which is now separate from the core python
package, and which is needed for this series to work correctly.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-11-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:34:04 +0000 (16:34 -0500)]
tests: use "run" script to execute device-crash-test
Instead of invoking python from the configure venv manually, instruct
developers to use the "run" script instead. Change the test invocation
to be a good example going forward.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-10-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:34:03 +0000 (16:34 -0500)]
iotests: tolerate being run outside of pyvenv
Modify the iotests environment preparation so that it can detect when it
is being run outside of the configure-time virtual environment and give
a warning to the user, suggesting the use of the meson run script
instead.
As a bonus, since the test executor itself does not actually rely on
anything in the configure-time venv in and of itself, it is possible to
just modify the python executable it uses for launching tests to be the
correct, configured venv that has access to qemu.qmp and other test
dependencies.
Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-9-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:34:02 +0000 (16:34 -0500)]
tests: Use configured python to run GitLab iotests
use the configured python (and the pyvenv) to run iotests instead of the
system default python3 interpreter. Use the new "run" script in the
build directory to execute the command inside the meson developer
environment, templated in qemu.git/run.in.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-8-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:34:01 +0000 (16:34 -0500)]
meson, mkvenv: add functests custom target
add the "pyvenv_functests_group" target to meson. This target will
invoke mkvenv.py to install the associated dependency group to the
build/pyvenv directory.
A "pyvenv_tooling_group" is not included here as it is the plan to
always install this group by default, so it will not need an on-demand
trigger.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-7-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:34:00 +0000 (16:34 -0500)]
python/mkvenv: add mechanism to install local package(s)
Currently, we "implicitly" install the local 'qemu' python package for
'make check-venv' with some logic inside tests/Makefile.include. I would
like to make this installation explicit in pythondeps.toml instead.
This patch adds a path constraint that can be used in lieu of version
constraints to specify that a package should be installed from the
source tree instead of from PyPI or vendored packages. This is done to
allow us to install the python packages hosted inside of the tree while
also processing dependencies; i.e. so that our "qemu" package can
specify that it needs "qemu.qmp", which soon will not be included in
qemu.git.
This also has the benefit of being able to specify in a declarative
configuration file that our pyvenv environment *will* have our local
python packages installed and available without any PYTHONPATH hacks,
which should simplify iotests, device-crash-test and functional tests
without needing to manage local inclusion paths in environment
variables.
On the downsides, installing packages through mkvenv/ensuregroup means
that there are extra steps we need to take in order to install a local
package *offline*; namely we must disable build isolation (so we have
access to setuptools) and we must also include python3-wheel in QEMU's
build dependencies in order for "make check" to run successfully when in
an offline, isolated environment. These extra dependencies are handled
in a forthcoming commit; for now, nothing is utilizing this new pathway.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-6-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:33:59 +0000 (16:33 -0500)]
python/mkvenv: add 'tooling' and 'functests' dependency groups
'tooling' contains depedencies required to run various tools (like
qmp-shell) as well as dependencies required to run "make check", and as
such, we promise that these dependencies can be sourced from the user's
distribution repository or from vendored packages so that "make check"
can be executed offline in an isolated build environment.
In contrast, pygdbmi is only needed for functional tests and not tests
in general; we do not make the same offline/isolated guarantees for
functional tests, and this dependency group is allowed to fetch
dependencies from PyPI at runtime.
For the time being, amend the "check-venv" target to install both
dependency groups, to avoid a duplicate dependency between them. By the
end of this series, however, "check-venv" will be eliminated in favor of
always installing "tooling" at configure time and allowing "functests"
to be installed on-demand as needed by meson/ninja.
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260218213416.674483-5-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
John Snow [Wed, 18 Feb 2026 21:33:57 +0000 (16:33 -0500)]
python/mkvenv: create timestamp file for each group "ensured"
Each group ensured by the mkvenv script will create an empty timestamp
file named {groupname}.group which can be used to conditionally trigger
dependency installation from various scripts and build machinery.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260218213416.674483-3-jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
Jens Axboe [Fri, 13 Feb 2026 14:26:37 +0000 (07:26 -0700)]
fdmon-io_uring: check CQ ring directly in gsource_check
gsource_check() only looks at the ppoll revents for the io_uring fd,
but CQEs can be posted during gsource_prepare()'s io_uring_submit()
call via kernel task_work processing on syscall exit. These completions
are already sitting in the CQ ring but the ring fd may not be signaled
yet, causing gsource_check() to return false.
Add a fallback io_uring_cq_ready() check so completions that arrive
during submission are dispatched immediately rather than waiting for
the next ppoll() cycle.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Message-ID: <20260213143225.161043-3-axboe@kernel.dk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Jens Axboe [Wed, 18 Feb 2026 20:09:58 +0000 (15:09 -0500)]
aio-posix: notify main loop when SQEs are queued
When a vCPU thread handles MMIO (holding BQL), aio_co_enter() runs the
block I/O coroutine inline on the vCPU thread because
qemu_get_current_aio_context() returns the main AioContext when BQL is
held. The coroutine calls luring_co_submit() which queues an SQE via
fdmon_io_uring_add_sqe(), but the actual io_uring_submit() only happens
in gsource_prepare() on the main loop thread.
Since the coroutine ran inline (not via aio_co_schedule()), no BH is
scheduled and aio_notify() is never called. The main loop remains asleep
in ppoll() with up to a 499ms timeout, leaving the SQE unsubmitted until
the next timer fires.
Fix this by calling aio_notify() after queuing the SQE. This wakes the
main loop via the eventfd so it can run gsource_prepare() and submit the
pending SQE promptly.
This is a generic fix that benefits all devices using aio=io_uring.
Without it, AHCI/SATA devices see MUCH worse I/O latency since they use
MMIO (not ioeventfd like virtio) and have no other mechanism to wake the
main loop after queuing block I/O.
This is usually a bit hard to detect, as it also relies on the ppoll
loop not waking up for other activity, and micro benchmarks tend not to
see it because they don't have any real processing time. With a
synthetic test case that has a few usleep() to simulate processing of
read data, it's very noticeable. The below example reads 128MB with
O_DIRECT in 128KB chunks in batches of 16, and has a 1ms delay before
each batch submit, and a 1ms delay after processing each completion.
Running it on /dev/sda yields:
time sudo ./iotest /dev/sda
________________________________________________________
Executed in 25.76 secs fish external
usr time 6.19 millis 783.00 micros 5.41 millis
sys time 12.43 millis 642.00 micros 11.79 millis
while on a virtio-blk or NVMe device we get:
time sudo ./iotest /dev/vdb
________________________________________________________
Executed in 1.25 secs fish external
usr time 1.40 millis 0.30 millis 1.10 millis
sys time 17.61 millis 1.43 millis 16.18 millis
time sudo ./iotest /dev/nvme0n1
________________________________________________________
Executed in 1.26 secs fish external
usr time 6.11 millis 0.52 millis 5.59 millis
sys time 13.94 millis 1.50 millis 12.43 millis
where the latter are consistent. If we run the same test but keep the
socket for the ssh connection active by having activity there, then
the sda test looks as follows:
time sudo ./iotest /dev/sda
________________________________________________________
Executed in 1.23 secs fish external
usr time 2.70 millis 39.00 micros 2.66 millis
sys time 4.97 millis 977.00 micros 3.99 millis
as now the ppoll loop is woken all the time anyway.
After this fix, on an idle system:
time sudo ./iotest /dev/sda
________________________________________________________
Executed in 1.30 secs fish external
usr time 2.14 millis 0.14 millis 2.00 millis
sys time 16.93 millis 1.16 millis 15.76 millis
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Message-Id: <07d701b9-3039-4f9b-99a2-abeae51146a5@kernel.dk> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
[Generalize the comment since this applies to all vCPU thread activity,
not just coroutines, as suggested by Kevin Wolf <kwolf@redhat.com>.
--Stefan] Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
audio_bug() is a bit unconventional, it is meant to be used as a
condition expression, passing the actual condition as second argument
(and __func__ as first argument).
If the condition is true, it uses AUD_log() to print to stderr, and has
some dubious recommendations printed only once.
This change:
- clears the control flow, and make the condition directly visible in
the 'if' statement.
- uses standard QEMU error_report()
- audio_bug() now captures __func__
- remove the "Save all your work and restart..." once hint
Currently, when given invalid settings, QEMU will print to stderr:
A bug was just triggered in audio_mixeng_backend_open_out
Save all your work and restart without audio
I am sorry
Context:
audio: frequency=44100 nchannels=0 fmt=S16 endianness=little
Now it will use error_report() and simply report:
audio: Invalid audio settings: frequency=44100 nchannels=0 fmt=s16 endian=little
Replace the ldebug macro calls with proper trace events:
- audio_get_avail: traces available samples in capture stream
- audio_open_out/audio_open_in: traces stream open parameters
This provides structured tracing that can be enabled at runtime
without requiring debug builds.
audio: replace int endianness with bool big_endian in audsettings
The endianness field used an int to represent a boolean concept, with
0 meaning little-endian and 1 meaning big-endian. This required runtime
validation to reject invalid values and made the code less readable.
Replace with a bool big_endian field that is self-documenting and
type-safe. The compiler now enforces valid values, eliminating the
need for the validation check in audio_validate_settings().
Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
audio/mixeng: replace redundant pcm_info fields with AudioFormat
The audio_pcm_info structure stored three fields (bits, is_signed,
is_float) that were always derived from the AudioFormat enum. This
redundancy meant the same information was represented twice, with no
type-level guarantee that they stayed in sync.
Replace these fields with a single AudioFormat field, and add helper
functions to extract the derived properties when needed:
- audio_format_bits()
- audio_format_is_signed()
- audio_format_is_float()
This improves type safety by making AudioFormat the single source of
truth, eliminating the possibility of inconsistent state between the
format enum and its derived boolean/integer representations.
audio/sdl: replace custom logging with error_report
Replace the custom audio logging infrastructure (dolog macro and
AUD_log/AUD_vlog) with standard QEMU error reporting (error_report,
error_printf, error_vprintf).
Note that we also dropped the abort() call in DEBUG_AUDIO, as it is not
usually compiled with, doesn't help much, and can easily be added back
when doing development as needed.
Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
audio/dsound: replace custom logging with error_report & trace
The DirectSound audio backend uses its own logging infrastructure
(AUD_log, AUD_vlog, dolog) and the AUDIO_CAP macro. This approach is
inconsistent with the rest of QEMU and makes the output harder to
filter and configure.
Replace the custom logging with standard QEMU error reporting.
The DBus audio backend already uses error_report() for error logging.
Remove the unused AUDIO_CAP macro which was left over from the old
logging infrastructure.
audio/coreaudio: replace custom logging with error_report
The CoreAudio backend uses its own logging infrastructure (AUD_log,
AUD_vlog, dolog) and the AUDIO_CAP macro. This approach is inconsistent
with the rest of QEMU and makes the output harder to filter and
configure.
Replace the custom logging with standard QEMU error reporting:
- Use error_report() / error_printf() for errors
- Use warn_report() for non-fatal warnings (buffer frame size
adjustments)
audio/alsa: replace custom logging with error_report and trace events
The ALSA audio backend uses its own logging infrastructure (AUD_log,
AUD_vlog, dolog, ldebug) and a custom alsa_dump_info() debug helper.
This approach is inconsistent with the rest of QEMU and makes the
output harder to filter and configure.
Replace the custom logging with standard QEMU error reporting:
- Use error_report() / error_printf() for errors
- Use warn_report() for non-fatal warnings (invalid formats,
rejected parameters, unexpected states)
- Convert ldebug() calls and alsa_dump_info() to trace events
Remove DEBUG_ALSA and AUDIO_CAP macros which are no longer needed.
Remove the separate audio_pcm_ops structure and move its function
pointers directly into AudioMixengBackendClass. This is a cleaner
QOM-style design where the PCM operations are part of the class
vtable rather than a separate indirection through hw->pcm_ops.
The HWVoiceOut and HWVoiceIn structures no longer need to store
a pcm_ops pointer, as the operations are now accessed through
the class with AUDIO_MIXENG_BACKEND_GET_CLASS().
Move all fields from audio_driver directly into AudioMixengBackendClass,
eliminating an unnecessary extra struct. Drivers now set class
fields directly in class_init instead of creating a static audio_driver
instance.
Migrate the DirectSound audio backend from the legacy driver init/fini
callbacks to proper QOM realize and finalize methods.
The dsound struct fields are now embedded directly in the AudioDsound
QOM object instead of being allocated separately as drv_opaque. This
allows accessing the backend state through proper QOM type casting
with AUDIO_DSOUND() rather than casting drv_opaque pointers.
The DirectSound and DirectSoundCapture COM objects are now managed
through the QOM lifecycle, with initialization in realize and cleanup
in finalize.
Remove the legacy driver init/fini callbacks from the CoreAudio backend.
Both coreaudio_audio_init() and coreaudio_audio_fini() were no-ops that
performed no real initialization or cleanup work. Access to the
Audiodev is now through hw->s->dev instead of the drv_opaque pointer.
Remove the legacy driver init/fini callbacks from the sndio audio backend.
Both sndio_audio_init() and sndio_audio_fini() were no-ops that
performed no real initialization or cleanup work. Access to the
Audiodev is now through hw->s->dev instead of the drv_opaque pointer.
Remove the legacy driver init/fini callbacks from the JACK audio backend.
Both qjack_init() and qjack_fini() were no-ops that performed no real
initialization or cleanup work. Access to the Audiodev is now through
hw->s->dev instead of the drv_opaque pointer.
Migrate the PipeWire audio backend from the legacy driver init/fini
callbacks to proper QOM realize and finalize methods.
The pwaudio struct fields are now embedded directly in the AudioPw
QOM object instead of being allocated separately as drv_opaque. This
allows accessing the backend state through proper QOM type casting
with AUDIO_PW() rather than casting drv_opaque pointers.
The PipeWire thread loop and context are now managed through the QOM
lifecycle, with initialization in realize and cleanup in finalize.
Migrate the SDL audio backend from the legacy driver init/fini
callbacks to proper QOM realize and finalize methods.
The sdl_audio_init() function is replaced with audio_sdl_realize(),
which initializes the SDL audio subsystem before delegating to the
parent class realize method. The sdl_audio_fini() is replaced with
audio_sdl_finalize() to properly clean up the SDL audio subsystem.
Access to the Audiodev is now through hw->s->dev instead of the
drv_opaque pointer.
Migrate the PulseAudio backend from the legacy driver init/fini
callbacks to proper QOM realize and finalize methods.
The paaudio struct fields are now embedded directly in the AudioPa
QOM object instead of being allocated separately as drv_opaque. This
allows accessing the backend state through proper QOM type casting
with AUDIO_PA() rather than casting drv_opaque pointers.
The PulseAudio connection is now managed through the QOM lifecycle,
with the connection reference acquired in realize and released in
finalize.
Migrate the OSS audio backend from the legacy driver init/fini
callbacks to proper QOM realize method.
The oss_audio_init() function is replaced with audio_oss_realize(),
which performs the same device accessibility check before delegating
to the parent class realize method. The empty oss_audio_fini() is
removed.
Access to the Audiodev is now through hw->s->dev instead of the
drv_opaque pointer.
Migrate the ALSA audio backend from the legacy driver init/fini
callbacks to proper QOM realize method.
The alsa_audio_init() function is replaced with audio_alsa_realize(),
which performs the same ALSA option initialization before delegating
to the parent class realize method. The empty alsa_audio_fini() is
removed.
The Audiodev pointer stored in ALSAVoiceOut and ALSAVoiceIn is removed
as it can now be accessed through hw->s->dev.
Remove the legacy driver init/fini callbacks from the WAV audio backend.
The wav_audio_init() just returned the Audiodev pointer and
wav_audio_fini() only logged a debug message. Access to the Audiodev
is now through hw->s->dev instead of the drv_opaque pointer.
Migrate the SPICE audio backend from the legacy driver init/fini
callbacks to proper QOM realize method.
The spice_audio_init() function is replaced with spice_audio_realize(),
which validates that SPICE is enabled before delegating to the parent
class realize method. The empty spice_audio_fini() is removed as no
cleanup is needed.
Migrate the D-Bus audio backend from the legacy driver init/fini
callbacks to proper QOM realize and finalize methods.
The DBusAudio struct fields are now embedded directly in the AudioDbus
QOM object instead of being allocated separately as drv_opaque. This
allows accessing the backend state through proper QOM type casting
with AUDIO_DBUS() rather than casting drv_opaque pointers.
assert() on valid values, and handle acceptable NULL arguments
gracefully.
Note audio_driver_write() and audio_driver_read() used to return
size (with a "XXX: Consider options") when sw was NULL. Imho, it is more
correct to not pretend to have read/written anything by default in the
AudioBackend base abstract class.
Since we are going to convert audio_driver-based backends, we need to
properly handle reference counting to allow for a different order of
class finalization (for example, pulse class before base driver class).
audio: move object creation to audio_driver_init()
As we will allow other kind of AudioBackend objects to be instantiated,
move the object allocation to a audio_driver_init() and rename it
audio_be_new().
Introduce a sub-class for current "audio_driver" based implementations.
Future AudioBackend implementations can do without it.
Next cleanup will actually remove "audio_driver" struct altogether and
make the subclass proper QOM objects.
Public APIs still rely on backend being an AudioMixeng. They will
assert() if not. This will be addressed later to allow other backends.
Note that the initial naming proposed for this object was AudioDriver,
however the semantics for "driver" is already overloaded and leads to
confusion, in particular with the QAPI AudiodevDriver. The defining
characteristic is of using QEMU's software mixing engine, so
AudioMixengBackend.
Start a simple test program that will exercise the QEMU audio APIs.
It is meant to run manually for now, as it accesses the sound system and
produces sound by default, and also runs for a few seconds. We may want
to make it silent or use the "none" (noaudio) backend by default though,
so it can run as part of the automated test suite.