* [PULL 00/12] Audio, i386 patches for 2022-09-22
@ 2023-09-22 9:31 Paolo Bonzini
2023-09-22 9:31 ` [PULL 01/12] target/i386: enumerate bit 56 of MSR_IA32_VMX_BASIC Paolo Bonzini
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel
The following changes since commit 005ad32358f12fe9313a4a01918a55e60d4f39e5:
Merge tag 'pull-tpm-2023-09-12-3' of https://github.com/stefanberger/qemu-tpm into staging (2023-09-13 13:41:57 -0400)
are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to 5930ce1943065b3d7b2687da0b53c1cd1da86cf7:
audio: Require AudioState in AUD_add_capture (2023-09-21 10:42:43 +0200)
----------------------------------------------------------------
* add host ticks function for RISC-V
* target/i386: Export GDS_NO bit
* target/i386: add support for bit 56 of MSR_IA32_VMX_BASIC
* drop -audiodev-help and QEMU_AUDIO_* environment variables
* require -audiodev for VNC audio
----------------------------------------------------------------
LIU Zhiwei (1):
qemu/timer: Add host ticks function for RISC-V
Martin Kletzander (8):
hw/input/tsc210x: Extract common init code into new function
hw/audio: Simplify hda audio init
hw/audio/lm4549: Add errp error reporting to init function
hw/display/xlnx_dp.c: Add audiodev property
tests/qtest: Specify audiodev= and -audiodev
audio/spiceaudio: Fail initialisation when not using spice
ui/vnc: Require audiodev= to enable audio
audio: Require AudioState in AUD_add_capture
Paolo Bonzini (2):
target/i386: enumerate bit 56 of MSR_IA32_VMX_BASIC
audio: remove QEMU_AUDIO_* and -audio-help support
Pawan Gupta (1):
target/i386: Export GDS_NO bit to guests
audio/alsaaudio.c | 1 -
audio/audio.c | 63 ++--
audio/audio.h | 1 -
audio/audio_int.h | 3 -
audio/audio_legacy.c | 591 --------------------------------
audio/coreaudio.m | 1 -
audio/dbusaudio.c | 1 -
audio/dsoundaudio.c | 1 -
audio/jackaudio.c | 1 -
audio/meson.build | 1 -
audio/noaudio.c | 1 -
audio/ossaudio.c | 1 -
audio/paaudio.c | 1 -
audio/pwaudio.c | 1 -
audio/sdlaudio.c | 1 -
audio/sndioaudio.c | 1 -
audio/spiceaudio.c | 3 +-
audio/wavaudio.c | 1 -
docs/about/deprecated.rst | 16 +-
docs/about/removed-features.rst | 12 +
hw/audio/hda-codec.c | 32 +-
hw/audio/intel-hda.c | 4 +-
hw/audio/intel-hda.h | 2 +-
hw/audio/lm4549.c | 3 +-
hw/audio/lm4549.h | 3 +-
hw/audio/pl041.c | 2 +-
hw/display/xlnx_dp.c | 6 +
hw/input/tsc210x.c | 68 ++--
include/qemu/timer.h | 22 ++
qemu-options.hx | 10 -
scripts/kvm/vmxcap | 1 +
softmmu/vl.c | 4 -
target/i386/cpu.c | 3 +-
target/i386/cpu.h | 1 +
tests/qtest/es1370-test.c | 3 +-
tests/qtest/fuzz/generic_fuzz_configs.h | 6 +-
tests/qtest/intel-hda-test.c | 15 +-
ui/vnc.c | 10 +-
38 files changed, 142 insertions(+), 755 deletions(-)
delete mode 100644 audio/audio_legacy.c
--
2.41.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PULL 01/12] target/i386: enumerate bit 56 of MSR_IA32_VMX_BASIC
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 02/12] target/i386: Export GDS_NO bit to guests Paolo Bonzini
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel
On parts that enumerate IA32_VMX_BASIC MSR bit as 1, any exception vector
can be delivered with or without an error code if the other consistency
checks are satisfied.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/kvm/vmxcap | 1 +
target/i386/cpu.c | 1 +
target/i386/cpu.h | 1 +
3 files changed, 3 insertions(+)
diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap
index ce27f5e635a..3fb4d5b3425 100755
--- a/scripts/kvm/vmxcap
+++ b/scripts/kvm/vmxcap
@@ -115,6 +115,7 @@ controls = [
(50, 53): 'VMCS memory type',
54: 'INS/OUTS instruction information',
55: 'IA32_VMX_TRUE_*_CTLS support',
+ 56: 'Skip checks on event error code',
},
msr = MSR_IA32_VMX_BASIC,
),
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b2a20365e10..d48607b4e1e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1340,6 +1340,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
.feat_names = {
[54] = "vmx-ins-outs",
[55] = "vmx-true-ctls",
+ [56] = "vmx-any-errcode",
},
.msr = {
.index = MSR_IA32_VMX_BASIC,
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index fbb05eace57..d1ffadd78be 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1039,6 +1039,7 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
#define MSR_VMX_BASIC_DUAL_MONITOR (1ULL << 49)
#define MSR_VMX_BASIC_INS_OUTS (1ULL << 54)
#define MSR_VMX_BASIC_TRUE_CTLS (1ULL << 55)
+#define MSR_VMX_BASIC_ANY_ERRCODE (1ULL << 56)
#define MSR_VMX_MISC_PREEMPTION_TIMER_SHIFT_MASK 0x1Full
#define MSR_VMX_MISC_STORE_LMA (1ULL << 5)
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 02/12] target/i386: Export GDS_NO bit to guests
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
2023-09-22 9:31 ` [PULL 01/12] target/i386: enumerate bit 56 of MSR_IA32_VMX_BASIC Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 03/12] qemu/timer: Add host ticks function for RISC-V Paolo Bonzini
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Pawan Gupta, Jack Wang, Daniel Sneddon
From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Gather Data Sampling (GDS) is a side-channel attack using Gather
instructions. Some Intel processors will set ARCH_CAP_GDS_NO bit in
MSR IA32_ARCH_CAPABILITIES to report that they are not vulnerable to
GDS.
Make this bit available to guests.
Closes: https://lore.kernel.org/qemu-devel/CAMGffEmG6TNq0n3+4OJAgXc8J0OevY60KHZekXCBs3LoK9vehA@mail.gmail.com/
Reported-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Tested-by: Jack Wang <jinpu.wang@ionos.com>
Tested-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>
Message-ID: <fde42d81ce454477ca8e27d5429a190b7366fe86.1692074650.git.pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index d48607b4e1e..f9e51a9d87e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1155,7 +1155,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
NULL, "sbdr-ssdp-no", "fbsdp-no", "psdp-no",
NULL, "fb-clear", NULL, NULL,
NULL, NULL, NULL, NULL,
- "pbrsb-no", NULL, NULL, NULL,
+ "pbrsb-no", NULL, "gds-no", NULL,
NULL, NULL, NULL, NULL,
},
.msr = {
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 03/12] qemu/timer: Add host ticks function for RISC-V
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
2023-09-22 9:31 ` [PULL 01/12] target/i386: enumerate bit 56 of MSR_IA32_VMX_BASIC Paolo Bonzini
2023-09-22 9:31 ` [PULL 02/12] target/i386: Export GDS_NO bit to guests Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 04/12] audio: remove QEMU_AUDIO_* and -audio-help support Paolo Bonzini
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: LIU Zhiwei
From: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230911063223.742-1-zhiwei_liu@linux.alibaba.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/timer.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 9a91cb1248a..9a366e551fb 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -979,6 +979,28 @@ static inline int64_t cpu_get_host_ticks(void)
return cur - ofs;
}
+#elif defined(__riscv) && __riscv_xlen == 32
+static inline int64_t cpu_get_host_ticks(void)
+{
+ uint32_t lo, hi, tmph;
+ do {
+ asm volatile("RDTIMEH %0\n\t"
+ "RDTIME %1\n\t"
+ "RDTIMEH %2"
+ : "=r"(hi), "=r"(lo), "=r"(tmph));
+ } while (unlikely(tmph != hi));
+ return lo | (uint64_t)hi << 32;
+}
+
+#elif defined(__riscv) && __riscv_xlen > 32
+static inline int64_t cpu_get_host_ticks(void)
+{
+ int64_t val;
+
+ asm volatile("RDTIME %0" : "=r"(val));
+ return val;
+}
+
#else
/* The host CPU doesn't have an easily accessible cycle counter.
Just return a monotonically increasing value. This will be
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 04/12] audio: remove QEMU_AUDIO_* and -audio-help support
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (2 preceding siblings ...)
2023-09-22 9:31 ` [PULL 03/12] qemu/timer: Add host ticks function for RISC-V Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 05/12] hw/input/tsc210x: Extract common init code into new function Paolo Bonzini
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel
These have been deprecated for a long time, and the introduction
of -audio in 7.1.0 has cemented the new way of specifying an
audio backend. Remove all the associated baggage, including the
concept of "can_be_default" audio drivers.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
audio/alsaaudio.c | 1 -
audio/audio.c | 60 +---
audio/audio.h | 1 -
audio/audio_int.h | 3 -
audio/audio_legacy.c | 591 --------------------------------
audio/coreaudio.m | 1 -
audio/dbusaudio.c | 1 -
audio/dsoundaudio.c | 1 -
audio/jackaudio.c | 1 -
audio/meson.build | 1 -
audio/noaudio.c | 1 -
audio/ossaudio.c | 1 -
audio/paaudio.c | 1 -
audio/pwaudio.c | 1 -
audio/sdlaudio.c | 1 -
audio/sndioaudio.c | 1 -
audio/wavaudio.c | 1 -
docs/about/deprecated.rst | 8 -
docs/about/removed-features.rst | 6 +
qemu-options.hx | 10 -
softmmu/vl.c | 4 -
21 files changed, 24 insertions(+), 672 deletions(-)
delete mode 100644 audio/audio_legacy.c
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 057571dd1e0..5ffb39c4182 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -960,7 +960,6 @@ static struct audio_driver alsa_audio_driver = {
.init = alsa_audio_init,
.fini = alsa_audio_fini,
.pcm_ops = &alsa_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof (ALSAVoiceOut),
diff --git a/audio/audio.c b/audio/audio.c
index 90c7c49d116..666ef4237dd 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -73,7 +73,7 @@ void audio_driver_register(audio_driver *drv)
QLIST_INSERT_HEAD(&audio_drivers, drv, next);
}
-audio_driver *audio_driver_lookup(const char *name)
+static audio_driver *audio_driver_lookup(const char *name)
{
struct audio_driver *d;
Error *local_err = NULL;
@@ -111,8 +111,6 @@ const struct mixeng_volume nominal_volume = {
#endif
};
-static bool legacy_config = true;
-
int audio_bug (const char *funcname, int cond)
{
if (cond) {
@@ -1712,46 +1710,26 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
/* silence gcc warning about uninitialized variable */
AudiodevListHead head = QSIMPLEQ_HEAD_INITIALIZER(head);
- if (using_spice) {
- /*
- * When using spice allow the spice audio driver being picked
- * as default.
- *
- * Temporary hack. Using audio devices without explicit
- * audiodev= property is already deprecated. Same goes for
- * the -soundhw switch. Once this support gets finally
- * removed we can also drop the concept of a default audio
- * backend and this can go away.
- */
- driver = audio_driver_lookup("spice");
- if (driver) {
- driver->can_be_default = 1;
- }
- }
-
if (dev) {
/* -audiodev option */
- legacy_config = false;
drvname = AudiodevDriver_str(dev->driver);
- } else if (!QTAILQ_EMPTY(&audio_states)) {
- if (!legacy_config) {
- dolog("Device %s: audiodev default parameter is deprecated, please "
- "specify audiodev=%s\n", name,
- QTAILQ_FIRST(&audio_states)->dev->id);
- }
- return QTAILQ_FIRST(&audio_states);
} else {
- /* legacy implicit initialization */
- head = audio_handle_legacy_opts();
- /*
- * In case of legacy initialization, all Audiodevs in the list will have
- * the same configuration (except the driver), so it doesn't matter which
- * one we chose. We need an Audiodev to set up AudioState before we can
- * init a driver. Also note that dev at this point is still in the
- * list.
- */
- dev = QSIMPLEQ_FIRST(&head)->dev;
- audio_validate_opts(dev, &error_abort);
+ if (!QTAILQ_EMPTY(&audio_states)) {
+ dev = QTAILQ_FIRST(&audio_states)->dev;
+ if (!g_str_equal(dev->id, "#none")) {
+ dolog("Device %s: audiodev default parameter is deprecated, please "
+ "specify audiodev=%s\n", name,
+ dev->id);
+ }
+ return QTAILQ_FIRST(&audio_states);
+ }
+
+ dolog("No audio device specified\n");
+ dev = g_new0(Audiodev, 1);
+ dev->id = g_strdup("#none");
+ dev->driver = AUDIODEV_DRIVER_NONE;
+ dev->u.none.in = g_new0(AudiodevPerDirectionOptions, 1);
+ dev->u.none.out = g_new0(AudiodevPerDirectionOptions, 1);
}
s = g_new0(AudioState, 1);
@@ -1876,9 +1854,7 @@ CaptureVoiceOut *AUD_add_capture(
struct capture_callback *cb;
if (!s) {
- if (!legacy_config) {
- dolog("Capturing without setting an audiodev is deprecated\n");
- }
+ dolog("Capturing without setting an audiodev is deprecated\n");
s = audio_init(NULL, NULL);
}
diff --git a/audio/audio.h b/audio/audio.h
index 01bdc567fb1..a276ec13eba 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -172,7 +172,6 @@ void audio_define(Audiodev *audio);
void audio_parse_option(const char *opt);
bool audio_init_audiodevs(void);
void audio_help(void);
-void audio_legacy_help(void);
AudioState *audio_state_by_name(const char *name);
const char *audio_get_id(QEMUSoundCard *card);
diff --git a/audio/audio_int.h b/audio/audio_int.h
index e57ff50155a..381c31ee0df 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -146,7 +146,6 @@ struct audio_driver {
void (*set_dbus_server) (AudioState *s, GDBusObjectManagerServer *manager, bool p2p);
#endif
struct audio_pcm_ops *pcm_ops;
- int can_be_default;
int max_voices_out;
int max_voices_in;
size_t voice_size_out;
@@ -243,7 +242,6 @@ extern const struct mixeng_volume nominal_volume;
extern const char *audio_prio_list[];
void audio_driver_register(audio_driver *drv);
-audio_driver *audio_driver_lookup(const char *name);
void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as);
void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len);
@@ -297,7 +295,6 @@ typedef struct AudiodevListEntry {
} AudiodevListEntry;
typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead;
-AudiodevListHead audio_handle_legacy_opts(void);
void audio_free_audiodev_list(AudiodevListHead *head);
diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c
deleted file mode 100644
index dc72ba55e9a..00000000000
--- a/audio/audio_legacy.c
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- * QEMU Audio subsystem: legacy configuration handling
- *
- * Copyright (c) 2015-2019 Zoltán Kővágó <DirtY.iCE.hu@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#include "qemu/osdep.h"
-#include "audio.h"
-#include "audio_int.h"
-#include "qemu/cutils.h"
-#include "qemu/timer.h"
-#include "qapi/error.h"
-#include "qapi/qapi-visit-audio.h"
-#include "qapi/visitor-impl.h"
-
-#define AUDIO_CAP "audio-legacy"
-#include "audio_int.h"
-
-static uint32_t toui32(const char *str)
-{
- uint64_t ret;
- if (parse_uint_full(str, 10, &ret) || ret > UINT32_MAX) {
- dolog("Invalid integer value `%s'\n", str);
- exit(1);
- }
- return ret;
-}
-
-/* helper functions to convert env variables */
-static void get_bool(const char *env, bool *dst, bool *has_dst)
-{
- const char *val = getenv(env);
- if (val) {
- *dst = toui32(val) != 0;
- *has_dst = true;
- }
-}
-
-static void get_int(const char *env, uint32_t *dst, bool *has_dst)
-{
- const char *val = getenv(env);
- if (val) {
- *dst = toui32(val);
- *has_dst = true;
- }
-}
-
-static void get_str(const char *env, char **dst)
-{
- const char *val = getenv(env);
- if (val) {
- g_free(*dst);
- *dst = g_strdup(val);
- }
-}
-
-static void get_fmt(const char *env, AudioFormat *dst, bool *has_dst)
-{
- const char *val = getenv(env);
- if (val) {
- size_t i;
- for (i = 0; AudioFormat_lookup.size; ++i) {
- if (strcasecmp(val, AudioFormat_lookup.array[i]) == 0) {
- *dst = i;
- *has_dst = true;
- return;
- }
- }
-
- dolog("Invalid audio format `%s'\n", val);
- exit(1);
- }
-}
-
-
-#if defined(CONFIG_AUDIO_ALSA) || defined(CONFIG_AUDIO_DSOUND)
-static void get_millis_to_usecs(const char *env, uint32_t *dst, bool *has_dst)
-{
- const char *val = getenv(env);
- if (val) {
- *dst = toui32(val) * 1000;
- *has_dst = true;
- }
-}
-#endif
-
-#if defined(CONFIG_AUDIO_ALSA) || defined(CONFIG_AUDIO_COREAUDIO) || \
- defined(CONFIG_AUDIO_PA) || defined(CONFIG_AUDIO_SDL) || \
- defined(CONFIG_AUDIO_DSOUND) || defined(CONFIG_AUDIO_OSS)
-static uint32_t frames_to_usecs(uint32_t frames,
- AudiodevPerDirectionOptions *pdo)
-{
- uint32_t freq = pdo->has_frequency ? pdo->frequency : 44100;
- return (frames * 1000000 + freq / 2) / freq;
-}
-#endif
-
-#ifdef CONFIG_AUDIO_COREAUDIO
-static void get_frames_to_usecs(const char *env, uint32_t *dst, bool *has_dst,
- AudiodevPerDirectionOptions *pdo)
-{
- const char *val = getenv(env);
- if (val) {
- *dst = frames_to_usecs(toui32(val), pdo);
- *has_dst = true;
- }
-}
-#endif
-
-#if defined(CONFIG_AUDIO_PA) || defined(CONFIG_AUDIO_SDL) || \
- defined(CONFIG_AUDIO_DSOUND) || defined(CONFIG_AUDIO_OSS)
-static uint32_t samples_to_usecs(uint32_t samples,
- AudiodevPerDirectionOptions *pdo)
-{
- uint32_t channels = pdo->has_channels ? pdo->channels : 2;
- return frames_to_usecs(samples / channels, pdo);
-}
-#endif
-
-#if defined(CONFIG_AUDIO_PA) || defined(CONFIG_AUDIO_SDL)
-static void get_samples_to_usecs(const char *env, uint32_t *dst, bool *has_dst,
- AudiodevPerDirectionOptions *pdo)
-{
- const char *val = getenv(env);
- if (val) {
- *dst = samples_to_usecs(toui32(val), pdo);
- *has_dst = true;
- }
-}
-#endif
-
-#if defined(CONFIG_AUDIO_DSOUND) || defined(CONFIG_AUDIO_OSS)
-static uint32_t bytes_to_usecs(uint32_t bytes, AudiodevPerDirectionOptions *pdo)
-{
- AudioFormat fmt = pdo->has_format ? pdo->format : AUDIO_FORMAT_S16;
- uint32_t bytes_per_sample = audioformat_bytes_per_sample(fmt);
- return samples_to_usecs(bytes / bytes_per_sample, pdo);
-}
-
-static void get_bytes_to_usecs(const char *env, uint32_t *dst, bool *has_dst,
- AudiodevPerDirectionOptions *pdo)
-{
- const char *val = getenv(env);
- if (val) {
- *dst = bytes_to_usecs(toui32(val), pdo);
- *has_dst = true;
- }
-}
-#endif
-
-/* backend specific functions */
-
-#ifdef CONFIG_AUDIO_ALSA
-/* ALSA */
-static void handle_alsa_per_direction(
- AudiodevAlsaPerDirectionOptions *apdo, const char *prefix)
-{
- char buf[64];
- size_t len = strlen(prefix);
- bool size_in_usecs = false;
- bool dummy;
-
- memcpy(buf, prefix, len);
- strcpy(buf + len, "TRY_POLL");
- get_bool(buf, &apdo->try_poll, &apdo->has_try_poll);
-
- strcpy(buf + len, "DEV");
- get_str(buf, &apdo->dev);
-
- strcpy(buf + len, "SIZE_IN_USEC");
- get_bool(buf, &size_in_usecs, &dummy);
-
- strcpy(buf + len, "PERIOD_SIZE");
- get_int(buf, &apdo->period_length, &apdo->has_period_length);
- if (apdo->has_period_length && !size_in_usecs) {
- apdo->period_length = frames_to_usecs(
- apdo->period_length,
- qapi_AudiodevAlsaPerDirectionOptions_base(apdo));
- }
-
- strcpy(buf + len, "BUFFER_SIZE");
- get_int(buf, &apdo->buffer_length, &apdo->has_buffer_length);
- if (apdo->has_buffer_length && !size_in_usecs) {
- apdo->buffer_length = frames_to_usecs(
- apdo->buffer_length,
- qapi_AudiodevAlsaPerDirectionOptions_base(apdo));
- }
-}
-
-static void handle_alsa(Audiodev *dev)
-{
- AudiodevAlsaOptions *aopt = &dev->u.alsa;
- handle_alsa_per_direction(aopt->in, "QEMU_ALSA_ADC_");
- handle_alsa_per_direction(aopt->out, "QEMU_ALSA_DAC_");
-
- get_millis_to_usecs("QEMU_ALSA_THRESHOLD",
- &aopt->threshold, &aopt->has_threshold);
-}
-#endif
-
-#ifdef CONFIG_AUDIO_COREAUDIO
-/* coreaudio */
-static void handle_coreaudio(Audiodev *dev)
-{
- get_frames_to_usecs(
- "QEMU_COREAUDIO_BUFFER_SIZE",
- &dev->u.coreaudio.out->buffer_length,
- &dev->u.coreaudio.out->has_buffer_length,
- qapi_AudiodevCoreaudioPerDirectionOptions_base(dev->u.coreaudio.out));
- get_int("QEMU_COREAUDIO_BUFFER_COUNT",
- &dev->u.coreaudio.out->buffer_count,
- &dev->u.coreaudio.out->has_buffer_count);
-}
-#endif
-
-#ifdef CONFIG_AUDIO_DSOUND
-/* dsound */
-static void handle_dsound(Audiodev *dev)
-{
- get_millis_to_usecs("QEMU_DSOUND_LATENCY_MILLIS",
- &dev->u.dsound.latency, &dev->u.dsound.has_latency);
- get_bytes_to_usecs("QEMU_DSOUND_BUFSIZE_OUT",
- &dev->u.dsound.out->buffer_length,
- &dev->u.dsound.out->has_buffer_length,
- dev->u.dsound.out);
- get_bytes_to_usecs("QEMU_DSOUND_BUFSIZE_IN",
- &dev->u.dsound.in->buffer_length,
- &dev->u.dsound.in->has_buffer_length,
- dev->u.dsound.in);
-}
-#endif
-
-#ifdef CONFIG_AUDIO_OSS
-/* OSS */
-static void handle_oss_per_direction(
- AudiodevOssPerDirectionOptions *opdo, const char *try_poll_env,
- const char *dev_env)
-{
- get_bool(try_poll_env, &opdo->try_poll, &opdo->has_try_poll);
- get_str(dev_env, &opdo->dev);
-
- get_bytes_to_usecs("QEMU_OSS_FRAGSIZE",
- &opdo->buffer_length, &opdo->has_buffer_length,
- qapi_AudiodevOssPerDirectionOptions_base(opdo));
- get_int("QEMU_OSS_NFRAGS", &opdo->buffer_count,
- &opdo->has_buffer_count);
-}
-
-static void handle_oss(Audiodev *dev)
-{
- AudiodevOssOptions *oopt = &dev->u.oss;
- handle_oss_per_direction(oopt->in, "QEMU_AUDIO_ADC_TRY_POLL",
- "QEMU_OSS_ADC_DEV");
- handle_oss_per_direction(oopt->out, "QEMU_AUDIO_DAC_TRY_POLL",
- "QEMU_OSS_DAC_DEV");
-
- get_bool("QEMU_OSS_MMAP", &oopt->try_mmap, &oopt->has_try_mmap);
- get_bool("QEMU_OSS_EXCLUSIVE", &oopt->exclusive, &oopt->has_exclusive);
- get_int("QEMU_OSS_POLICY", &oopt->dsp_policy, &oopt->has_dsp_policy);
-}
-#endif
-
-#ifdef CONFIG_AUDIO_PA
-/* pulseaudio */
-static void handle_pa_per_direction(
- AudiodevPaPerDirectionOptions *ppdo, const char *env)
-{
- get_str(env, &ppdo->name);
-}
-
-static void handle_pa(Audiodev *dev)
-{
- handle_pa_per_direction(dev->u.pa.in, "QEMU_PA_SOURCE");
- handle_pa_per_direction(dev->u.pa.out, "QEMU_PA_SINK");
-
- get_samples_to_usecs(
- "QEMU_PA_SAMPLES", &dev->u.pa.in->buffer_length,
- &dev->u.pa.in->has_buffer_length,
- qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.in));
- get_samples_to_usecs(
- "QEMU_PA_SAMPLES", &dev->u.pa.out->buffer_length,
- &dev->u.pa.out->has_buffer_length,
- qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.out));
-
- get_str("QEMU_PA_SERVER", &dev->u.pa.server);
-}
-#endif
-
-#ifdef CONFIG_AUDIO_SDL
-/* SDL */
-static void handle_sdl(Audiodev *dev)
-{
- /* SDL is output only */
- get_samples_to_usecs("QEMU_SDL_SAMPLES", &dev->u.sdl.out->buffer_length,
- &dev->u.sdl.out->has_buffer_length,
- qapi_AudiodevSdlPerDirectionOptions_base(dev->u.sdl.out));
-}
-#endif
-
-/* wav */
-static void handle_wav(Audiodev *dev)
-{
- get_int("QEMU_WAV_FREQUENCY",
- &dev->u.wav.out->frequency, &dev->u.wav.out->has_frequency);
- get_fmt("QEMU_WAV_FORMAT", &dev->u.wav.out->format,
- &dev->u.wav.out->has_format);
- get_int("QEMU_WAV_DAC_FIXED_CHANNELS",
- &dev->u.wav.out->channels, &dev->u.wav.out->has_channels);
- get_str("QEMU_WAV_PATH", &dev->u.wav.path);
-}
-
-/* general */
-static void handle_per_direction(
- AudiodevPerDirectionOptions *pdo, const char *prefix)
-{
- char buf[64];
- size_t len = strlen(prefix);
-
- memcpy(buf, prefix, len);
- strcpy(buf + len, "FIXED_SETTINGS");
- get_bool(buf, &pdo->fixed_settings, &pdo->has_fixed_settings);
-
- strcpy(buf + len, "FIXED_FREQ");
- get_int(buf, &pdo->frequency, &pdo->has_frequency);
-
- strcpy(buf + len, "FIXED_FMT");
- get_fmt(buf, &pdo->format, &pdo->has_format);
-
- strcpy(buf + len, "FIXED_CHANNELS");
- get_int(buf, &pdo->channels, &pdo->has_channels);
-
- strcpy(buf + len, "VOICES");
- get_int(buf, &pdo->voices, &pdo->has_voices);
-}
-
-static AudiodevListEntry *legacy_opt(const char *drvname)
-{
- AudiodevListEntry *e = g_new0(AudiodevListEntry, 1);
- e->dev = g_new0(Audiodev, 1);
- e->dev->id = g_strdup(drvname);
- e->dev->driver = qapi_enum_parse(
- &AudiodevDriver_lookup, drvname, -1, &error_abort);
-
- audio_create_pdos(e->dev);
-
- handle_per_direction(audio_get_pdo_in(e->dev), "QEMU_AUDIO_ADC_");
- handle_per_direction(audio_get_pdo_out(e->dev), "QEMU_AUDIO_DAC_");
-
- /* Original description: Timer period in HZ (0 - use lowest possible) */
- get_int("QEMU_AUDIO_TIMER_PERIOD",
- &e->dev->timer_period, &e->dev->has_timer_period);
- if (e->dev->has_timer_period && e->dev->timer_period) {
- e->dev->timer_period = NANOSECONDS_PER_SECOND / 1000 /
- e->dev->timer_period;
- }
-
- switch (e->dev->driver) {
-#ifdef CONFIG_AUDIO_ALSA
- case AUDIODEV_DRIVER_ALSA:
- handle_alsa(e->dev);
- break;
-#endif
-
-#ifdef CONFIG_AUDIO_COREAUDIO
- case AUDIODEV_DRIVER_COREAUDIO:
- handle_coreaudio(e->dev);
- break;
-#endif
-
-#ifdef CONFIG_AUDIO_DSOUND
- case AUDIODEV_DRIVER_DSOUND:
- handle_dsound(e->dev);
- break;
-#endif
-
-#ifdef CONFIG_AUDIO_OSS
- case AUDIODEV_DRIVER_OSS:
- handle_oss(e->dev);
- break;
-#endif
-
-#ifdef CONFIG_AUDIO_PA
- case AUDIODEV_DRIVER_PA:
- handle_pa(e->dev);
- break;
-#endif
-
-#ifdef CONFIG_AUDIO_SDL
- case AUDIODEV_DRIVER_SDL:
- handle_sdl(e->dev);
- break;
-#endif
-
- case AUDIODEV_DRIVER_WAV:
- handle_wav(e->dev);
- break;
-
- default:
- break;
- }
-
- return e;
-}
-
-AudiodevListHead audio_handle_legacy_opts(void)
-{
- const char *drvname = getenv("QEMU_AUDIO_DRV");
- AudiodevListHead head = QSIMPLEQ_HEAD_INITIALIZER(head);
-
- if (drvname) {
- AudiodevListEntry *e;
- audio_driver *driver = audio_driver_lookup(drvname);
- if (!driver) {
- dolog("Unknown audio driver `%s'\n", drvname);
- exit(1);
- }
- e = legacy_opt(drvname);
- QSIMPLEQ_INSERT_TAIL(&head, e, next);
- } else {
- for (int i = 0; audio_prio_list[i]; i++) {
- audio_driver *driver = audio_driver_lookup(audio_prio_list[i]);
- if (driver && driver->can_be_default) {
- AudiodevListEntry *e = legacy_opt(driver->name);
- QSIMPLEQ_INSERT_TAIL(&head, e, next);
- }
- }
- if (QSIMPLEQ_EMPTY(&head)) {
- dolog("Internal error: no default audio driver available\n");
- exit(1);
- }
- }
-
- return head;
-}
-
-/* visitor to print -audiodev option */
-typedef struct {
- Visitor visitor;
-
- bool comma;
- GList *path;
-} LegacyPrintVisitor;
-
-static bool lv_start_struct(Visitor *v, const char *name, void **obj,
- size_t size, Error **errp)
-{
- LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v;
- lv->path = g_list_append(lv->path, g_strdup(name));
- return true;
-}
-
-static void lv_end_struct(Visitor *v, void **obj)
-{
- LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v;
- lv->path = g_list_delete_link(lv->path, g_list_last(lv->path));
-}
-
-static void lv_print_key(Visitor *v, const char *name)
-{
- GList *e;
- LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v;
- if (lv->comma) {
- putchar(',');
- } else {
- lv->comma = true;
- }
-
- for (e = lv->path; e; e = e->next) {
- if (e->data) {
- printf("%s.", (const char *) e->data);
- }
- }
-
- printf("%s=", name);
-}
-
-static bool lv_type_int64(Visitor *v, const char *name, int64_t *obj,
- Error **errp)
-{
- lv_print_key(v, name);
- printf("%" PRIi64, *obj);
- return true;
-}
-
-static bool lv_type_uint64(Visitor *v, const char *name, uint64_t *obj,
- Error **errp)
-{
- lv_print_key(v, name);
- printf("%" PRIu64, *obj);
- return true;
-}
-
-static bool lv_type_bool(Visitor *v, const char *name, bool *obj, Error **errp)
-{
- lv_print_key(v, name);
- printf("%s", *obj ? "on" : "off");
- return true;
-}
-
-static bool lv_type_str(Visitor *v, const char *name, char **obj, Error **errp)
-{
- const char *str = *obj;
- lv_print_key(v, name);
-
- while (*str) {
- if (*str == ',') {
- putchar(',');
- }
- putchar(*str++);
- }
- return true;
-}
-
-static void lv_complete(Visitor *v, void *opaque)
-{
- LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v;
- assert(lv->path == NULL);
-}
-
-static void lv_free(Visitor *v)
-{
- LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v;
-
- g_list_free_full(lv->path, g_free);
- g_free(lv);
-}
-
-static Visitor *legacy_visitor_new(void)
-{
- LegacyPrintVisitor *lv = g_new0(LegacyPrintVisitor, 1);
-
- lv->visitor.start_struct = lv_start_struct;
- lv->visitor.end_struct = lv_end_struct;
- /* lists not supported */
- lv->visitor.type_int64 = lv_type_int64;
- lv->visitor.type_uint64 = lv_type_uint64;
- lv->visitor.type_bool = lv_type_bool;
- lv->visitor.type_str = lv_type_str;
-
- lv->visitor.type = VISITOR_OUTPUT;
- lv->visitor.complete = lv_complete;
- lv->visitor.free = lv_free;
-
- return &lv->visitor;
-}
-
-void audio_legacy_help(void)
-{
- AudiodevListHead head;
- AudiodevListEntry *e;
-
- printf("Environment variable based configuration deprecated.\n");
- printf("Please use the new -audiodev option.\n");
-
- head = audio_handle_legacy_opts();
- printf("\nEquivalent -audiodev to your current environment variables:\n");
- if (!getenv("QEMU_AUDIO_DRV")) {
- printf("(Since you didn't specify QEMU_AUDIO_DRV, I'll list all "
- "possibilities)\n");
- }
-
- QSIMPLEQ_FOREACH(e, &head, next) {
- Visitor *v;
- Audiodev *dev = e->dev;
- printf("-audiodev ");
-
- v = legacy_visitor_new();
- visit_type_Audiodev(v, NULL, &dev, &error_abort);
- visit_free(v);
-
- printf("\n");
- }
- audio_free_audiodev_list(&head);
-}
diff --git a/audio/coreaudio.m b/audio/coreaudio.m
index 4695291621a..e5612138a74 100644
--- a/audio/coreaudio.m
+++ b/audio/coreaudio.m
@@ -673,7 +673,6 @@ static void coreaudio_audio_fini (void *opaque)
.init = coreaudio_audio_init,
.fini = coreaudio_audio_fini,
.pcm_ops = &coreaudio_pcm_ops,
- .can_be_default = 1,
.max_voices_out = 1,
.max_voices_in = 0,
.voice_size_out = sizeof (coreaudioVoiceOut),
diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c
index 7a11fbfb420..df81e6d9f0b 100644
--- a/audio/dbusaudio.c
+++ b/audio/dbusaudio.c
@@ -676,7 +676,6 @@ static struct audio_driver dbus_audio_driver = {
.fini = dbus_audio_fini,
.set_dbus_server = dbus_audio_set_server,
.pcm_ops = &dbus_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof(DBusVoiceOut),
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index 3fb67ec3eed..311e3421846 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -721,7 +721,6 @@ static struct audio_driver dsound_audio_driver = {
.init = dsound_audio_init,
.fini = dsound_audio_fini,
.pcm_ops = &dsound_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = 1,
.voice_size_out = sizeof (DSoundVoiceOut),
diff --git a/audio/jackaudio.c b/audio/jackaudio.c
index 5bdf3d7a78d..fd2d2fd5acb 100644
--- a/audio/jackaudio.c
+++ b/audio/jackaudio.c
@@ -669,7 +669,6 @@ static struct audio_driver jack_driver = {
.init = qjack_init,
.fini = qjack_fini,
.pcm_ops = &jack_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof(QJackOut),
diff --git a/audio/meson.build b/audio/meson.build
index df4d968c0fe..c8f658611f4 100644
--- a/audio/meson.build
+++ b/audio/meson.build
@@ -1,7 +1,6 @@
system_ss.add([spice_headers, files('audio.c')])
system_ss.add(files(
'audio-hmp-cmds.c',
- 'audio_legacy.c',
'mixeng.c',
'noaudio.c',
'wavaudio.c',
diff --git a/audio/noaudio.c b/audio/noaudio.c
index 4fdee5adecf..81570bfa962 100644
--- a/audio/noaudio.c
+++ b/audio/noaudio.c
@@ -135,7 +135,6 @@ static struct audio_driver no_audio_driver = {
.init = no_audio_init,
.fini = no_audio_fini,
.pcm_ops = &no_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof (NoVoiceOut),
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index e8d732b612c..5a4094af707 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -779,7 +779,6 @@ static struct audio_driver oss_audio_driver = {
.init = oss_audio_init,
.fini = oss_audio_fini,
.pcm_ops = &oss_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof (OSSVoiceOut),
diff --git a/audio/paaudio.c b/audio/paaudio.c
index 529b39daacc..02d18eabf50 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -928,7 +928,6 @@ static struct audio_driver pa_audio_driver = {
.init = qpa_audio_init,
.fini = qpa_audio_fini,
.pcm_ops = &qpa_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof (PAVoiceOut),
diff --git a/audio/pwaudio.c b/audio/pwaudio.c
index b6a38738ee9..6044c9ebe50 100644
--- a/audio/pwaudio.c
+++ b/audio/pwaudio.c
@@ -841,7 +841,6 @@ static struct audio_driver pw_audio_driver = {
.init = qpw_audio_init,
.fini = qpw_audio_fini,
.pcm_ops = &qpw_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof(PWVoiceOut),
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 68a237b76b4..5177e31d9b4 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -493,7 +493,6 @@ static struct audio_driver sdl_audio_driver = {
.init = sdl_audio_init,
.fini = sdl_audio_fini,
.pcm_ops = &sdl_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof(SDLVoiceOut),
diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c
index 3fde01fdbd5..61260361ad6 100644
--- a/audio/sndioaudio.c
+++ b/audio/sndioaudio.c
@@ -550,7 +550,6 @@ static struct audio_driver sndio_audio_driver = {
.init = sndio_audio_init,
.fini = sndio_audio_fini,
.pcm_ops = &sndio_pcm_ops,
- .can_be_default = 1,
.max_voices_out = INT_MAX,
.max_voices_in = INT_MAX,
.voice_size_out = sizeof(SndioVoice),
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index 6445a2cb90c..57435c23e58 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -208,7 +208,6 @@ static struct audio_driver wav_audio_driver = {
.init = wav_audio_init,
.fini = wav_audio_fini,
.pcm_ops = &wav_pcm_ops,
- .can_be_default = 0,
.max_voices_out = 1,
.max_voices_in = 0,
.voice_size_out = sizeof (WAVVoiceOut),
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index dc4da95329e..b9cdd2dd03b 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -37,14 +37,6 @@ coverage.
System emulator command line arguments
--------------------------------------
-``QEMU_AUDIO_`` environment variables and ``-audio-help`` (since 4.0)
-'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-The ``-audiodev`` argument is now the preferred way to specify audio
-backend settings instead of environment variables. To ease migration to
-the new format, the ``-audiodev-help`` option can be used to convert
-the current values of the environment variables to ``-audiodev`` options.
-
Creating sound card devices and vnc without ``audiodev=`` property (since 4.2)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index c2043fd415d..63458736ee1 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -436,6 +436,12 @@ the process listing. This was replaced by the new ``password-secret``
option which lets the password be securely provided on the command
line using a ``secret`` object instance.
+``QEMU_AUDIO_`` environment variables and ``-audio-help`` (removed in 8.2)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``-audiodev`` and ``-audio`` command line options are now the only
+way to specify audio backend settings.
+
QEMU Machine Protocol (QMP) commands
------------------------------------
diff --git a/qemu-options.hx b/qemu-options.hx
index 6be621c2324..c0c5304474c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -727,16 +727,6 @@ SRST
ERST
-HXCOMM Deprecated by -audiodev
-DEF("audio-help", 0, QEMU_OPTION_audio_help,
- "-audio-help show -audiodev equivalent of the currently specified audio settings\n",
- QEMU_ARCH_ALL)
-SRST
-``-audio-help``
- Will show the -audiodev equivalent of the currently specified
- (deprecated) environment variables.
-ERST
-
DEF("audio", HAS_ARG, QEMU_OPTION_audio,
"-audio [driver=]driver,model=value[,prop[=value][,...]]\n"
" specifies the audio backend and device to use;\n"
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 3db4fd26808..5a1413da2aa 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2916,10 +2916,6 @@ void qemu_init(int argc, char **argv)
}
break;
#endif
- case QEMU_OPTION_audio_help:
- audio_legacy_help();
- exit (0);
- break;
case QEMU_OPTION_audiodev:
audio_parse_option(optarg);
break;
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 05/12] hw/input/tsc210x: Extract common init code into new function
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (3 preceding siblings ...)
2023-09-22 9:31 ` [PULL 04/12] audio: remove QEMU_AUDIO_* and -audio-help support Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 06/12] hw/audio: Simplify hda audio init Paolo Bonzini
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Martin Kletzander, Daniel P . Berrangé
From: Martin Kletzander <mkletzan@redhat.com>
This deduplicates several lines and will make future changes more
concise.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <1d75877cf4cc2a38f87633ff16f9fea3e1bb0c03.1650874791.git.mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/input/tsc210x.c | 68 ++++++++++++++++------------------------------
1 file changed, 24 insertions(+), 44 deletions(-)
diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c
index 7eae5989f76..f568759e05a 100644
--- a/hw/input/tsc210x.c
+++ b/hw/input/tsc210x.c
@@ -30,6 +30,7 @@
#include "hw/input/tsc2xxx.h"
#include "hw/irq.h"
#include "migration/vmstate.h"
+#include "qapi/error.h"
#define TSC_DATA_REGISTERS_PAGE 0x0
#define TSC_CONTROL_REGISTERS_PAGE 0x1
@@ -1069,20 +1070,10 @@ static const VMStateDescription vmstate_tsc2301 = {
.fields = vmstatefields_tsc210x,
};
-uWireSlave *tsc2102_init(qemu_irq pint)
+static void tsc210x_init(TSC210xState *s,
+ const char *name,
+ const VMStateDescription *vmsd)
{
- TSC210xState *s;
-
- s = g_new0(TSC210xState, 1);
- s->x = 160;
- s->y = 160;
- s->pressure = 0;
- s->precision = s->nextprecision = 0;
- s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tsc210x_timer_tick, s);
- s->pint = pint;
- s->model = 0x2102;
- s->name = "tsc2102";
-
s->tr[0] = 0;
s->tr[1] = 1;
s->tr[2] = 1;
@@ -1104,13 +1095,29 @@ uWireSlave *tsc2102_init(qemu_irq pint)
tsc210x_reset(s);
- qemu_add_mouse_event_handler(tsc210x_touchscreen_event, s, 1,
- "QEMU TSC2102-driven Touchscreen");
+ qemu_add_mouse_event_handler(tsc210x_touchscreen_event, s, 1, name);
AUD_register_card(s->name, &s->card);
qemu_register_reset((void *) tsc210x_reset, s);
- vmstate_register(NULL, 0, &vmstate_tsc2102, s);
+ vmstate_register(NULL, 0, vmsd, s);
+}
+
+uWireSlave *tsc2102_init(qemu_irq pint)
+{
+ TSC210xState *s;
+
+ s = g_new0(TSC210xState, 1);
+ s->x = 160;
+ s->y = 160;
+ s->pressure = 0;
+ s->precision = s->nextprecision = 0;
+ s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tsc210x_timer_tick, s);
+ s->pint = pint;
+ s->model = 0x2102;
+ s->name = "tsc2102";
+
+ tsc210x_init(s, "QEMU TSC2102-driven Touchscreen", &vmstate_tsc2102);
return &s->chip;
}
@@ -1131,34 +1138,7 @@ uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav)
s->model = 0x2301;
s->name = "tsc2301";
- s->tr[0] = 0;
- s->tr[1] = 1;
- s->tr[2] = 1;
- s->tr[3] = 0;
- s->tr[4] = 1;
- s->tr[5] = 0;
- s->tr[6] = 1;
- s->tr[7] = 0;
-
- s->chip.opaque = s;
- s->chip.send = (void *) tsc210x_write;
- s->chip.receive = (void *) tsc210x_read;
-
- s->codec.opaque = s;
- s->codec.tx_swallow = (void *) tsc210x_i2s_swallow;
- s->codec.set_rate = (void *) tsc210x_i2s_set_rate;
- s->codec.in.fifo = s->in_fifo;
- s->codec.out.fifo = s->out_fifo;
-
- tsc210x_reset(s);
-
- qemu_add_mouse_event_handler(tsc210x_touchscreen_event, s, 1,
- "QEMU TSC2301-driven Touchscreen");
-
- AUD_register_card(s->name, &s->card);
-
- qemu_register_reset((void *) tsc210x_reset, s);
- vmstate_register(NULL, 0, &vmstate_tsc2301, s);
+ tsc210x_init(s, "QEMU TSC2301-driven Touchscreen", &vmstate_tsc2301);
return &s->chip;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 06/12] hw/audio: Simplify hda audio init
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (4 preceding siblings ...)
2023-09-22 9:31 ` [PULL 05/12] hw/input/tsc210x: Extract common init code into new function Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 07/12] hw/audio/lm4549: Add errp error reporting to init function Paolo Bonzini
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Martin Kletzander, Daniel P . Berrangé
From: Martin Kletzander <mkletzan@redhat.com>
No return values are used anywhere, so switch the functions to be void
and add support for error reporting using errp for use in next patches.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <cd1df4ad2a6fae969c4a02a77955c4a8c0d430b6.1650874791.git.mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/audio/hda-codec.c | 32 ++++++++++++++++++--------------
hw/audio/intel-hda.c | 4 +---
hw/audio/intel-hda.h | 2 +-
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index c51d8ba6177..a26048cf15e 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -675,7 +675,9 @@ static void hda_audio_stream(HDACodecDevice *hda, uint32_t stnr, bool running, b
}
}
-static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc)
+static void hda_audio_init(HDACodecDevice *hda,
+ const struct desc_codec *desc,
+ Error **errp)
{
HDAAudioState *a = HDA_AUDIO(hda);
HDAAudioStream *st;
@@ -718,7 +720,6 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc)
break;
}
}
- return 0;
}
static void hda_audio_exit(HDACodecDevice *hda)
@@ -848,37 +849,40 @@ static Property hda_audio_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
-static int hda_audio_init_output(HDACodecDevice *hda)
+static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
{
HDAAudioState *a = HDA_AUDIO(hda);
+ const struct desc_codec *desc = &output_nomixemu;
if (!a->mixer) {
- return hda_audio_init(hda, &output_nomixemu);
- } else {
- return hda_audio_init(hda, &output_mixemu);
+ desc = &output_mixemu;
}
+
+ hda_audio_init(hda, desc, errp);
}
-static int hda_audio_init_duplex(HDACodecDevice *hda)
+static void hda_audio_init_duplex(HDACodecDevice *hda, Error **errp)
{
HDAAudioState *a = HDA_AUDIO(hda);
+ const struct desc_codec *desc = &duplex_nomixemu;
if (!a->mixer) {
- return hda_audio_init(hda, &duplex_nomixemu);
- } else {
- return hda_audio_init(hda, &duplex_mixemu);
+ desc = &duplex_mixemu;
}
+
+ hda_audio_init(hda, desc, errp);
}
-static int hda_audio_init_micro(HDACodecDevice *hda)
+static void hda_audio_init_micro(HDACodecDevice *hda, Error **errp)
{
HDAAudioState *a = HDA_AUDIO(hda);
+ const struct desc_codec *desc = µ_nomixemu;
if (!a->mixer) {
- return hda_audio_init(hda, µ_nomixemu);
- } else {
- return hda_audio_init(hda, µ_mixemu);
+ desc = µ_mixemu;
}
+
+ hda_audio_init(hda, desc, errp);
}
static void hda_audio_base_class_init(ObjectClass *klass, void *data)
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index b9ed231fe84..78ff9f9a680 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -71,9 +71,7 @@ static void hda_codec_dev_realize(DeviceState *qdev, Error **errp)
return;
}
bus->next_cad = dev->cad + 1;
- if (cdc->init(dev) != 0) {
- error_setg(errp, "HDA audio init failed");
- }
+ cdc->init(dev, errp);
}
static void hda_codec_dev_unrealize(DeviceState *qdev)
diff --git a/hw/audio/intel-hda.h b/hw/audio/intel-hda.h
index f78c1833e34..8d710eee5d6 100644
--- a/hw/audio/intel-hda.h
+++ b/hw/audio/intel-hda.h
@@ -31,7 +31,7 @@ struct HDACodecBus {
struct HDACodecDeviceClass {
DeviceClass parent_class;
- int (*init)(HDACodecDevice *dev);
+ void (*init)(HDACodecDevice *dev, Error **errp);
void (*exit)(HDACodecDevice *dev);
void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data);
void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running, bool output);
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 07/12] hw/audio/lm4549: Add errp error reporting to init function
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (5 preceding siblings ...)
2023-09-22 9:31 ` [PULL 06/12] hw/audio: Simplify hda audio init Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 08/12] hw/display/xlnx_dp.c: Add audiodev property Paolo Bonzini
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Martin Kletzander, Daniel P . Berrangé
From: Martin Kletzander <mkletzan@redhat.com>
This will be used in future commit.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <be1bf295b3c6a3dee272b4b4e8115e37c2a772b5.1650874791.git.mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/audio/lm4549.c | 3 ++-
hw/audio/lm4549.h | 3 ++-
hw/audio/pl041.c | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c
index 32b1481b561..418041bc9c6 100644
--- a/hw/audio/lm4549.c
+++ b/hw/audio/lm4549.c
@@ -276,7 +276,8 @@ static int lm4549_post_load(void *opaque, int version_id)
return 0;
}
-void lm4549_init(lm4549_state *s, lm4549_callback data_req_cb, void* opaque)
+void lm4549_init(lm4549_state *s, lm4549_callback data_req_cb, void* opaque,
+ Error **errp)
{
struct audsettings as;
diff --git a/hw/audio/lm4549.h b/hw/audio/lm4549.h
index aba9bb5b077..61c3ab12dd3 100644
--- a/hw/audio/lm4549.h
+++ b/hw/audio/lm4549.h
@@ -36,7 +36,8 @@ typedef struct {
extern const VMStateDescription vmstate_lm4549_state;
-void lm4549_init(lm4549_state *s, lm4549_callback data_req, void *opaque);
+void lm4549_init(lm4549_state *s, lm4549_callback data_req, void *opaque,
+ Error **errp);
uint32_t lm4549_read(lm4549_state *s, hwaddr offset);
void lm4549_write(lm4549_state *s, hwaddr offset, uint32_t value);
uint32_t lm4549_write_samples(lm4549_state *s, uint32_t left, uint32_t right);
diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c
index 03acd4fe344..868dffbfd32 100644
--- a/hw/audio/pl041.c
+++ b/hw/audio/pl041.c
@@ -564,7 +564,7 @@ static void pl041_realize(DeviceState *dev, Error **errp)
}
/* Init the codec */
- lm4549_init(&s->codec, &pl041_request_data, (void *)s);
+ lm4549_init(&s->codec, &pl041_request_data, (void *)s, errp);
}
static const VMStateDescription vmstate_pl041_regfile = {
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 08/12] hw/display/xlnx_dp.c: Add audiodev property
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (6 preceding siblings ...)
2023-09-22 9:31 ` [PULL 07/12] hw/audio/lm4549: Add errp error reporting to init function Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 09/12] tests/qtest: Specify audiodev= and -audiodev Paolo Bonzini
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Martin Kletzander
From: Martin Kletzander <mkletzan@redhat.com>
There was no way to set this and we need that for it to be able to properly
initialise.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Message-ID: <16963256573fcbfa7720aa2fd000ba74a4055222.1650874791.git.mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/display/xlnx_dp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index 43c7dd8e9cd..341e91e886f 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -1385,6 +1385,11 @@ static void xlnx_dp_reset(DeviceState *dev)
xlnx_dp_update_irq(s);
}
+static Property xlnx_dp_device_properties[] = {
+ DEFINE_AUDIO_PROPERTIES(XlnxDPState, aud_card),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void xlnx_dp_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
@@ -1392,6 +1397,7 @@ static void xlnx_dp_class_init(ObjectClass *oc, void *data)
dc->realize = xlnx_dp_realize;
dc->vmsd = &vmstate_dp;
dc->reset = xlnx_dp_reset;
+ device_class_set_props(dc, xlnx_dp_device_properties);
}
static const TypeInfo xlnx_dp_info = {
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 09/12] tests/qtest: Specify audiodev= and -audiodev
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (7 preceding siblings ...)
2023-09-22 9:31 ` [PULL 08/12] hw/display/xlnx_dp.c: Add audiodev property Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 10/12] audio/spiceaudio: Fail initialisation when not using spice Paolo Bonzini
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Martin Kletzander, Daniel P . Berrangé
From: Martin Kletzander <mkletzan@redhat.com>
This will enable removing deprecated default audiodev support.
I did not figure out how to make the audiodev represented as an
interface node, so this is a workaround. I am not sure what would be
the proper way.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <6e7f2808dd40679a415812767b88f2a411fc137f.1650874791.git.mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/qtest/es1370-test.c | 3 ++-
tests/qtest/fuzz/generic_fuzz_configs.h | 6 ++++--
tests/qtest/intel-hda-test.c | 15 ++++++++++-----
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/tests/qtest/es1370-test.c b/tests/qtest/es1370-test.c
index 97ab65c4357..8387e74193b 100644
--- a/tests/qtest/es1370-test.c
+++ b/tests/qtest/es1370-test.c
@@ -46,7 +46,8 @@ static void *es1370_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
static void es1370_register_nodes(void)
{
QOSGraphEdgeOptions opts = {
- .extra_device_opts = "addr=04.0",
+ .extra_device_opts = "addr=04.0,audiodev=audio0",
+ .before_cmd_line = "-audiodev driver=none,id=audio0",
};
add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/generic_fuzz_configs.h
index 50689da6539..4d7c8ca4ece 100644
--- a/tests/qtest/fuzz/generic_fuzz_configs.h
+++ b/tests/qtest/fuzz/generic_fuzz_configs.h
@@ -106,8 +106,10 @@ const generic_fuzz_config predefined_configs[] = {
},{
.name = "intel-hda",
.args = "-machine q35 -nodefaults -device intel-hda,id=hda0 "
- "-device hda-output,bus=hda0.0 -device hda-micro,bus=hda0.0 "
- "-device hda-duplex,bus=hda0.0",
+ "-audiodev driver=none,id=audio0",
+ "-device hda-output,bus=hda0.0,audiodev=audio0 "
+ "-device hda-micro,bus=hda0.0,audiodev=audio0 "
+ "-device hda-duplex,bus=hda0.0,audiodev=audio0",
.objects = "intel-hda",
},{
.name = "ide-hd",
diff --git a/tests/qtest/intel-hda-test.c b/tests/qtest/intel-hda-test.c
index d4a8db6fd60..663bb6c4854 100644
--- a/tests/qtest/intel-hda-test.c
+++ b/tests/qtest/intel-hda-test.c
@@ -11,20 +11,24 @@
#include "libqtest-single.h"
#define HDA_ID "hda0"
-#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0" \
- " -device hda-micro,bus=" HDA_ID ".0" \
- " -device hda-duplex,bus=" HDA_ID ".0"
+#define AUDIODEV " -audiodev driver=none,id=audio0 "
+#define AUDIODEV_REF "audiodev=audio0"
+#define CODEC_DEVICES " -device hda-output,bus=" HDA_ID ".0," AUDIODEV_REF \
+ " -device hda-micro,bus=" HDA_ID ".0," AUDIODEV_REF \
+ " -device hda-duplex,bus=" HDA_ID ".0," AUDIODEV_REF
/* Tests only initialization so far. TODO: Replace with functional tests */
static void ich6_test(void)
{
- qtest_start("-machine pc -device intel-hda,id=" HDA_ID CODEC_DEVICES);
+ qtest_start(AUDIODEV "-machine pc -device intel-hda,id=" HDA_ID CODEC_DEVICES);
qtest_end();
}
static void ich9_test(void)
{
- qtest_start("-machine q35 -device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
+ qtest_start("-machine q35"
+ AUDIODEV
+ "-device ich9-intel-hda,bus=pcie.0,addr=1b.0,id="
HDA_ID CODEC_DEVICES);
qtest_end();
}
@@ -39,6 +43,7 @@ static void test_issue542_ich6(void)
QTestState *s;
s = qtest_init("-nographic -nodefaults -M pc-q35-6.2 "
+ AUDIODEV
"-device intel-hda,id=" HDA_ID CODEC_DEVICES);
qtest_outl(s, 0xcf8, 0x80000804);
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 10/12] audio/spiceaudio: Fail initialisation when not using spice
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (8 preceding siblings ...)
2023-09-22 9:31 ` [PULL 09/12] tests/qtest: Specify audiodev= and -audiodev Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 11/12] ui/vnc: Require audiodev= to enable audio Paolo Bonzini
2023-09-22 9:31 ` [PULL 12/12] audio: Require AudioState in AUD_add_capture Paolo Bonzini
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Martin Kletzander
From: Martin Kletzander <mkletzan@redhat.com>
The caller would already fail, but this way the message can better
express the reason for the failure.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2043498
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Message-ID: <5db1fdef0330f20ed6ae306b5a71dad1b5e9b44c.1650874791.git.mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
audio/spiceaudio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c
index d17ef1a25ef..af9bd7d54c9 100644
--- a/audio/spiceaudio.c
+++ b/audio/spiceaudio.c
@@ -74,8 +74,9 @@ static const SpiceRecordInterface record_sif = {
static void *spice_audio_init(Audiodev *dev)
{
if (!using_spice) {
- return NULL;
+ error_setg(&error_fatal, "Cannot use spice audio without -spice");
}
+
return &spice_audio_init;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 11/12] ui/vnc: Require audiodev= to enable audio
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (9 preceding siblings ...)
2023-09-22 9:31 ` [PULL 10/12] audio/spiceaudio: Fail initialisation when not using spice Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
2023-09-22 9:31 ` [PULL 12/12] audio: Require AudioState in AUD_add_capture Paolo Bonzini
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Martin Kletzander
From: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Message-ID: <a07513f1bf6123fef52ff5e7943f5704746b376b.1650874791.git.mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
docs/about/deprecated.rst | 8 +++-----
docs/about/removed-features.rst | 6 ++++++
ui/vnc.c | 10 ++++++++--
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index b9cdd2dd03b..40845b3fcb7 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -37,13 +37,11 @@ coverage.
System emulator command line arguments
--------------------------------------
-Creating sound card devices and vnc without ``audiodev=`` property (since 4.2)
-''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+Creating sound card devices without ``audiodev=`` property (since 4.2)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
When not using the deprecated legacy audio config, each sound card
-should specify an ``audiodev=`` property. Additionally, when using
-vnc, you should specify an ``audiodev=`` property if you plan to
-transmit audio through the VNC protocol.
+should specify an ``audiodev=`` property.
Short-form boolean options (since 6.0)
''''''''''''''''''''''''''''''''''''''
diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst
index 63458736ee1..7668ddef178 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -442,6 +442,12 @@ line using a ``secret`` object instance.
The ``-audiodev`` and ``-audio`` command line options are now the only
way to specify audio backend settings.
+Creating vnc without ``audiodev=`` property (removed in 8.2)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+When using vnc, you should specify an ``audiodev=`` property if
+you plan to transmit audio through the VNC protocol.
+
QEMU Machine Protocol (QMP) commands
------------------------------------
diff --git a/ui/vnc.c b/ui/vnc.c
index 6fd86996a54..cfa18bbd3e1 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2508,11 +2508,17 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
switch (read_u16 (data, 2)) {
case VNC_MSG_CLIENT_QEMU_AUDIO_ENABLE:
trace_vnc_msg_client_audio_enable(vs, vs->ioc);
- audio_add(vs);
+ if (vs->vd->audio_state) {
+ audio_add(vs);
+ } else {
+ error_report("audio not available, use audiodev= option for vnc");
+ }
break;
case VNC_MSG_CLIENT_QEMU_AUDIO_DISABLE:
trace_vnc_msg_client_audio_disable(vs, vs->ioc);
- audio_del(vs);
+ if (vs->vd->audio_state) {
+ audio_del(vs);
+ }
break;
case VNC_MSG_CLIENT_QEMU_AUDIO_SET_FORMAT:
if (len == 4)
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL 12/12] audio: Require AudioState in AUD_add_capture
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
` (10 preceding siblings ...)
2023-09-22 9:31 ` [PULL 11/12] ui/vnc: Require audiodev= to enable audio Paolo Bonzini
@ 2023-09-22 9:31 ` Paolo Bonzini
11 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2023-09-22 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Martin Kletzander
From: Martin Kletzander <mkletzan@redhat.com>
Since all callers require a valid audiodev this function can now safely
abort in case of missing AudioState.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Message-ID: <c6e87e678e914df0f59da2145c2753cdb4a16f63.1650874791.git.mkletzan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
audio/audio.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/audio/audio.c b/audio/audio.c
index 666ef4237dd..d72e7db7fb9 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1854,8 +1854,9 @@ CaptureVoiceOut *AUD_add_capture(
struct capture_callback *cb;
if (!s) {
- dolog("Capturing without setting an audiodev is deprecated\n");
- s = audio_init(NULL, NULL);
+ error_setg(&error_abort,
+ "Capturing without setting an audiodev is not supported");
+ abort();
}
if (!audio_get_pdo_out(s->dev)->mixing_engine) {
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-09-22 9:34 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22 9:31 [PULL 00/12] Audio, i386 patches for 2022-09-22 Paolo Bonzini
2023-09-22 9:31 ` [PULL 01/12] target/i386: enumerate bit 56 of MSR_IA32_VMX_BASIC Paolo Bonzini
2023-09-22 9:31 ` [PULL 02/12] target/i386: Export GDS_NO bit to guests Paolo Bonzini
2023-09-22 9:31 ` [PULL 03/12] qemu/timer: Add host ticks function for RISC-V Paolo Bonzini
2023-09-22 9:31 ` [PULL 04/12] audio: remove QEMU_AUDIO_* and -audio-help support Paolo Bonzini
2023-09-22 9:31 ` [PULL 05/12] hw/input/tsc210x: Extract common init code into new function Paolo Bonzini
2023-09-22 9:31 ` [PULL 06/12] hw/audio: Simplify hda audio init Paolo Bonzini
2023-09-22 9:31 ` [PULL 07/12] hw/audio/lm4549: Add errp error reporting to init function Paolo Bonzini
2023-09-22 9:31 ` [PULL 08/12] hw/display/xlnx_dp.c: Add audiodev property Paolo Bonzini
2023-09-22 9:31 ` [PULL 09/12] tests/qtest: Specify audiodev= and -audiodev Paolo Bonzini
2023-09-22 9:31 ` [PULL 10/12] audio/spiceaudio: Fail initialisation when not using spice Paolo Bonzini
2023-09-22 9:31 ` [PULL 11/12] ui/vnc: Require audiodev= to enable audio Paolo Bonzini
2023-09-22 9:31 ` [PULL 12/12] audio: Require AudioState in AUD_add_capture Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).