From patchwork Mon Apr 25 08:21:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eYUJjFom; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmyjc34r9z9s5V for ; Mon, 25 Apr 2022 18:24:35 +1000 (AEST) Received: from localhost ([::1]:43190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niu1J-0006Wb-Az for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:24:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu06-0006UN-4e for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:28797) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu01-0002ez-Nf for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CCG6lGxpSFBkTA/SRjKupJwKzVuo/aed5sg+24tDo9Y=; b=eYUJjFomUJ+noMS4sdTawLJGoaL9+4XvXKqHeAkqJtURHIlvWLa1ua9sVm2TPV46B4yWre j7jJbf4ttFysCHx6Vue3PgmGYP6l4LBEaEnPCb+M91BC5D95HB/21IIW09jo/bl3R15gJz TrppubIEJI+gwPMs7QLx/U5pNCpE/F4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-266-9gy9kMOjOAu57NWLtiFpeQ-1; Mon, 25 Apr 2022 04:22:05 -0400 X-MC-Unique: 9gy9kMOjOAu57NWLtiFpeQ-1 Received: by mail-wr1-f69.google.com with SMTP id l7-20020adfa387000000b0020acc61dbaeso1628974wrb.7 for ; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CCG6lGxpSFBkTA/SRjKupJwKzVuo/aed5sg+24tDo9Y=; b=tLTYe6EmUJg5pyeNabpGc9Oa1CXPhezqdOVZuPVJU3GwECClMHxXjROCnBmN6W+6J2 AZz8IB+LHwsqil2tmmDFJxbTCjX5C8kMr77LYhiGZ7oAjqwW8Fs40TT7zK0Gk7wgL1b1 Ds8Dj8odNWDP0CzfR50SQ+n80UiRFP6V+noyq4LFzBZXy5aOWxX6lEdzwGK/4cKeyKYL YU5+Un8/zvn+6eVLlXgcdWsQQaeyOi3E4w3jgXFiGQ2D0XnraxO9nnSNTQdnLXP+EzCe jlUI/9bLx1KenD5DJDsY4nS6NbhfTGGfa9jhkd9lHzk0qiVo16W+l9BhZ3PgQbHQ3edv jLTg== X-Gm-Message-State: AOAM533cU5jtRlKkgGtPWuVIiGC5hQGijBnbR3fZV4WDMh5tWWYKHwC3 t/WSnaCw9Mdkx7hNg0rNnhzItEYU1Fte5Fq6MXUE3GDf2NdzG5cpq1YvGxvzvQkH7XPivkhGS1O rQ3kLWLD6GnQ4/fI= X-Received: by 2002:a05:6000:502:b0:20a:d9d2:ccea with SMTP id a2-20020a056000050200b0020ad9d2cceamr3777304wrf.128.1650874924279; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztKBtML27ZuiUtmzFLfKd6O/K6tVFp8geq/7fMHO15eeahyGft38H6PnhGczSO8d9R+GOhaQ== X-Received: by 2002:a05:6000:502:b0:20a:d9d2:ccea with SMTP id a2-20020a056000050200b0020ad9d2cceamr3777285wrf.128.1650874923912; Mon, 25 Apr 2022 01:22:03 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id d5-20020a056000186500b0020a8688963bsm9893771wri.89.2022.04.25.01.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:03 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 0A1C167B1B56; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 01/18] hw/audio: Remove -soundhw support Date: Mon, 25 Apr 2022 10:21:44 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" One thing I am not sure about is whether to keep the aliases of ac97 and es1370 in the qdev_alias_table. Signed-off-by: Martin Kletzander Reviewed-by: Stefan Hajnoczi --- docs/about/deprecated.rst | 9 - docs/about/removed-features.rst | 10 + docs/qdev-device-use.txt | 21 +-- docs/replay.txt | 2 +- hw/audio/ac97.c | 3 - hw/audio/adlib.c | 2 - hw/audio/cs4231a.c | 2 - hw/audio/es1370.c | 3 - hw/audio/gus.c | 2 - hw/audio/intel-hda.c | 21 --- hw/audio/meson.build | 1 - hw/audio/pcspk.c | 11 -- hw/audio/sb16.c | 3 - hw/audio/soundhw.c | 177 ------------------ include/hw/audio/soundhw.h | 15 -- qemu-options.hx | 27 --- .../codeconverter/test_regexps.py | 1 - softmmu/qdev-monitor.c | 2 - softmmu/vl.c | 6 - 19 files changed, 19 insertions(+), 299 deletions(-) delete mode 100644 hw/audio/soundhw.c delete mode 100644 include/hw/audio/soundhw.h diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index cf02ef6821e4..7ba71ebd3435 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -39,15 +39,6 @@ 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. -Creating sound card devices using ``-soundhw`` (since 5.1) -'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -Sound card devices should be created using ``-device`` instead. The -names are the same for most devices. The exceptions are ``hda`` which -needs two devices (``-device intel-hda -device hda-duplex``) and -``pcspk`` which can be activated using ``-machine -pcspk-audiodev=``. - ``-chardev`` backend aliases ``tty`` and ``parport`` (since 6.0) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst index 4b831ea29176..086ba3edb042 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -336,6 +336,16 @@ for the RISC-V ``virt`` machine and ``sifive_u`` machine. The ``-no-quit`` was a synonym for ``-display ...,window-close=off`` which should be used instead. +Creating sound card devices using ``-soundhw`` (removed in 7.1) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +Sound card devices should be created using ``-device`` instead. The +names are the same for most devices. The exceptions are ``hda`` which +needs two devices (``-device intel-hda -device hda-duplex``) and +``pcspk`` which can be activated using ``-machine +pcspk-audiodev=``. And ``AC97`` and ``ES1370`` now have to be +specified in uppercase. + QEMU Machine Protocol (QMP) commands ------------------------------------ diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt index 240888933482..30e7eaa3e66d 100644 --- a/docs/qdev-device-use.txt +++ b/docs/qdev-device-use.txt @@ -311,21 +311,16 @@ constraints. Host and guest part of audio devices have always been separate. -The old way to define guest audio devices is -soundhw C1,... +Host side (backend) is defined using -audiodev with a specific driver: -The new way is to define each guest audio device separately with --device. + spice + pa + none -Map from -soundhw sound card name to -device: - - ac97 -device AC97 - cs4231a -device cs4231a,iobase=IOADDR,irq=IRQ,dma=DMA - es1370 -device ES1370 - gus -device gus,iobase=IOADDR,irq=IRQ,dma=DMA,freq=F - hda -device intel-hda,msi=MSI -device hda-duplex - sb16 -device sb16,iobase=IOADDR,irq=IRQ,dma=DMA,dma16=DMA16,version=V - adlib not yet available with -device - pcspk not yet available with -device +And each guest audio device is then defined with -device with +audiodev=AUDIODEV_ID that refers to the audio backend above. Exceptions are +pcspk and adlib which are note yet available with -device and are part of a +machine type. For PCI devices, you can add bus=PCI-BUS,addr=DEVFN to control the PCI device address, as usual. diff --git a/docs/replay.txt b/docs/replay.txt index 5b008ca4911f..c329767c148a 100644 --- a/docs/replay.txt +++ b/docs/replay.txt @@ -294,7 +294,7 @@ Audio devices Audio data is recorded and replay automatically. The command line for recording and replaying must contain identical specifications of audio hardware, e.g.: - -soundhw ac97 + -audiodev driver=pa -device ac97,audiodev=audio0 Serial ports ------------ diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 3cb81310607f..fd0b3b97d5b5 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -18,7 +18,6 @@ */ #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" @@ -1430,8 +1429,6 @@ static const TypeInfo ac97_info = { static void ac97_register_types (void) { type_register_static (&ac97_info); - deprecated_register_soundhw("ac97", "Intel 82801AA AC97 Audio", - 0, TYPE_AC97); } type_init (ac97_register_types) diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 5f979b1487d1..ba1be6c8378d 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" @@ -322,7 +321,6 @@ static const TypeInfo adlib_info = { static void adlib_register_types (void) { type_register_static (&adlib_info); - deprecated_register_soundhw("adlib", ADLIB_DESC, 1, TYPE_ADLIB); } type_init (adlib_register_types) diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 0723e3943044..f510b862efbe 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" @@ -717,7 +716,6 @@ static const TypeInfo cs4231a_info = { static void cs4231a_register_types (void) { type_register_static (&cs4231a_info); - deprecated_register_soundhw("cs4231a", "CS4231A", 1, TYPE_CS4231A); } type_init (cs4231a_register_types) diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 690458981471..62359b84f279 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -27,7 +27,6 @@ #define SILENT_ES1370 #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "hw/pci/pci.h" #include "migration/vmstate.h" @@ -923,8 +922,6 @@ static const TypeInfo es1370_info = { static void es1370_register_types (void) { type_register_static (&es1370_info); - deprecated_register_soundhw("es1370", "ENSONIQ AudioPCI ES1370", - 0, TYPE_ES1370); } type_init (es1370_register_types) diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 42f010b67193..c7710a684b88 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" @@ -317,7 +316,6 @@ static const TypeInfo gus_info = { static void gus_register_types (void) { type_register_static (&gus_info); - deprecated_register_soundhw("gus", "Gravis Ultrasound GF1", 1, TYPE_GUS); } type_init (gus_register_types) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index bc77e3d8c9dc..e77552363a4c 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -26,7 +26,6 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qemu/error-report.h" -#include "hw/audio/soundhw.h" #include "intel-hda.h" #include "migration/vmstate.h" #include "intel-hda-defs.h" @@ -1307,25 +1306,6 @@ static const TypeInfo hda_codec_device_type_info = { .class_init = hda_codec_device_class_init, }; -/* - * create intel hda controller with codec attached to it, - * so '-soundhw hda' works. - */ -static int intel_hda_and_codec_init(PCIBus *bus) -{ - DeviceState *controller; - BusState *hdabus; - DeviceState *codec; - - warn_report("'-soundhw hda' is deprecated, " - "please use '-device intel-hda -device hda-duplex' instead"); - controller = DEVICE(pci_create_simple(bus, -1, "intel-hda")); - hdabus = QLIST_FIRST(&controller->child_bus); - codec = qdev_new("hda-duplex"); - qdev_realize_and_unref(codec, hdabus, &error_fatal); - return 0; -} - static void intel_hda_register_types(void) { type_register_static(&hda_codec_bus_info); @@ -1333,7 +1313,6 @@ static void intel_hda_register_types(void) type_register_static(&intel_hda_info_ich6); type_register_static(&intel_hda_info_ich9); type_register_static(&hda_codec_device_type_info); - pci_register_soundhw("hda", "Intel HD Audio", intel_hda_and_codec_init); } type_init(intel_hda_register_types) diff --git a/hw/audio/meson.build b/hw/audio/meson.build index e48a9fc73d57..746b5b98d198 100644 --- a/hw/audio/meson.build +++ b/hw/audio/meson.build @@ -1,4 +1,3 @@ -softmmu_ss.add(files('soundhw.c')) softmmu_ss.add(when: 'CONFIG_AC97', if_true: files('ac97.c')) softmmu_ss.add(when: 'CONFIG_ADLIB', if_true: files('fmopl.c', 'adlib.c')) softmmu_ss.add(when: 'CONFIG_CS4231', if_true: files('cs4231.c')) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index dfc7ebca4e17..72bea5fb202a 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" #include "hw/isa/isa.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "qemu/module.h" #include "qemu/timer.h" @@ -245,18 +244,8 @@ static const TypeInfo pcspk_info = { .class_init = pcspk_class_initfn, }; -static int pcspk_audio_init_soundhw(ISABus *bus) -{ - PCSpkState *s = pcspk_state; - - warn_report("'-soundhw pcspk' is deprecated, " - "please set a backend using '-machine pcspk-audiodev=' instead"); - return pcspk_audio_init(s); -} - static void pcspk_register(void) { type_register_static(&pcspk_info); - isa_register_soundhw("pcspk", "PC speaker", pcspk_audio_init_soundhw); } type_init(pcspk_register) diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 2215386ddb2e..593da2478c14 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "hw/irq.h" #include "hw/isa/isa.h" @@ -1469,8 +1468,6 @@ static const TypeInfo sb16_info = { static void sb16_register_types (void) { type_register_static (&sb16_info); - deprecated_register_soundhw("sb16", "Creative Sound Blaster 16", - 1, TYPE_SB16); } type_init (sb16_register_types) diff --git a/hw/audio/soundhw.c b/hw/audio/soundhw.c deleted file mode 100644 index 173b674ff53a..000000000000 --- a/hw/audio/soundhw.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * 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 "qemu/option.h" -#include "qemu/help_option.h" -#include "qemu/error-report.h" -#include "qom/object.h" -#include "hw/isa/isa.h" -#include "hw/pci/pci.h" -#include "hw/audio/soundhw.h" - -struct soundhw { - const char *name; - const char *descr; - const char *typename; - int enabled; - int isa; - union { - int (*init_isa) (ISABus *bus); - int (*init_pci) (PCIBus *bus); - } init; -}; - -static struct soundhw soundhw[9]; -static int soundhw_count; - -void isa_register_soundhw(const char *name, const char *descr, - int (*init_isa)(ISABus *bus)) -{ - assert(soundhw_count < ARRAY_SIZE(soundhw) - 1); - soundhw[soundhw_count].name = name; - soundhw[soundhw_count].descr = descr; - soundhw[soundhw_count].isa = 1; - soundhw[soundhw_count].init.init_isa = init_isa; - soundhw_count++; -} - -void pci_register_soundhw(const char *name, const char *descr, - int (*init_pci)(PCIBus *bus)) -{ - assert(soundhw_count < ARRAY_SIZE(soundhw) - 1); - soundhw[soundhw_count].name = name; - soundhw[soundhw_count].descr = descr; - soundhw[soundhw_count].isa = 0; - soundhw[soundhw_count].init.init_pci = init_pci; - soundhw_count++; -} - -void deprecated_register_soundhw(const char *name, const char *descr, - int isa, const char *typename) -{ - assert(soundhw_count < ARRAY_SIZE(soundhw) - 1); - soundhw[soundhw_count].name = name; - soundhw[soundhw_count].descr = descr; - soundhw[soundhw_count].isa = isa; - soundhw[soundhw_count].typename = typename; - soundhw_count++; -} - -void select_soundhw(const char *optarg) -{ - struct soundhw *c; - - if (is_help_option(optarg)) { - show_valid_cards: - - if (soundhw_count) { - printf("Valid sound card names (comma separated):\n"); - for (c = soundhw; c->name; ++c) { - printf ("%-11s %s\n", c->name, c->descr); - } - printf("\n-soundhw all will enable all of the above\n"); - } else { - printf("Machine has no user-selectable audio hardware " - "(it may or may not have always-present audio hardware).\n"); - } - exit(!is_help_option(optarg)); - } - else { - size_t l; - const char *p; - char *e; - int bad_card = 0; - - if (!strcmp(optarg, "all")) { - for (c = soundhw; c->name; ++c) { - c->enabled = 1; - } - return; - } - - p = optarg; - while (*p) { - e = strchr(p, ','); - l = !e ? strlen(p) : (size_t) (e - p); - - for (c = soundhw; c->name; ++c) { - if (!strncmp(c->name, p, l) && !c->name[l]) { - c->enabled = 1; - break; - } - } - - if (!c->name) { - if (l > 80) { - error_report("Unknown sound card name (too big to show)"); - } - else { - error_report("Unknown sound card name `%.*s'", - (int) l, p); - } - bad_card = 1; - } - p += l + (e != NULL); - } - - if (bad_card) { - goto show_valid_cards; - } - } -} - -void soundhw_init(void) -{ - struct soundhw *c; - ISABus *isa_bus = (ISABus *) object_resolve_path_type("", TYPE_ISA_BUS, NULL); - PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL); - - for (c = soundhw; c->name; ++c) { - if (c->enabled) { - if (c->typename) { - warn_report("'-soundhw %s' is deprecated, " - "please use '-device %s' instead", - c->name, c->typename); - if (c->isa) { - isa_create_simple(isa_bus, c->typename); - } else { - pci_create_simple(pci_bus, -1, c->typename); - } - } else if (c->isa) { - if (!isa_bus) { - error_report("ISA bus not available for %s", c->name); - exit(1); - } - c->init.init_isa(isa_bus); - } else { - if (!pci_bus) { - error_report("PCI bus not available for %s", c->name); - exit(1); - } - c->init.init_pci(pci_bus); - } - } - } -} - diff --git a/include/hw/audio/soundhw.h b/include/hw/audio/soundhw.h deleted file mode 100644 index f09a297854af..000000000000 --- a/include/hw/audio/soundhw.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef HW_SOUNDHW_H -#define HW_SOUNDHW_H - -void isa_register_soundhw(const char *name, const char *descr, - int (*init_isa)(ISABus *bus)); - -void pci_register_soundhw(const char *name, const char *descr, - int (*init_pci)(PCIBus *bus)); -void deprecated_register_soundhw(const char *name, const char *descr, - int isa, const char *typename); - -void soundhw_init(void); -void select_soundhw(const char *optarg); - -#endif diff --git a/qemu-options.hx b/qemu-options.hx index 34e9b32a5c00..47bbd86a4533 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -892,33 +892,6 @@ SRST ``qemu.wav``. ERST -DEF("soundhw", HAS_ARG, QEMU_OPTION_soundhw, - "-soundhw c1,... enable audio support\n" - " and only specified sound cards (comma separated list)\n" - " use '-soundhw help' to get the list of supported cards\n" - " use '-soundhw all' to enable all of them\n", QEMU_ARCH_ALL) -SRST -``-soundhw card1[,card2,...] or -soundhw all`` - Enable audio and selected sound hardware. Use 'help' to print all - available sound hardware. For example: - - .. parsed-literal:: - - |qemu_system_x86| -soundhw sb16,adlib disk.img - |qemu_system_x86| -soundhw es1370 disk.img - |qemu_system_x86| -soundhw ac97 disk.img - |qemu_system_x86| -soundhw hda disk.img - |qemu_system_x86| -soundhw all disk.img - |qemu_system_x86| -soundhw help - - Note that Linux's i810\_audio OSS kernel (for AC97) module might - require manually specifying clocking. - - :: - - modprobe i810_audio clocking=48000 -ERST - DEF("device", HAS_ARG, QEMU_OPTION_device, "-device driver[,prop[=value][,...]]\n" " add device (based on driver)\n" diff --git a/scripts/codeconverter/codeconverter/test_regexps.py b/scripts/codeconverter/codeconverter/test_regexps.py index a445634d88ac..0161cadffee6 100644 --- a/scripts/codeconverter/codeconverter/test_regexps.py +++ b/scripts/codeconverter/codeconverter/test_regexps.py @@ -264,7 +264,6 @@ def test_initial_includes(): #define SILENT_ES1370 #include "qemu/osdep.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "hw/pci/pci.h" #include "migration/vmstate.h" diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 12fe60c4670d..5c80d135ebf0 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -66,9 +66,7 @@ typedef struct QDevAlias /* Please keep this table sorted by typename. */ static const QDevAlias qdev_alias_table[] = { - { "AC97", "ac97" }, /* -soundhw name */ { "e1000", "e1000-82540em" }, - { "ES1370", "es1370" }, /* -soundhw name */ { "ich9-ahci", "ahci" }, { "lsi53c895a", "lsi" }, { "virtio-9p-device", "virtio-9p", QEMU_ARCH_VIRTIO_MMIO }, diff --git a/softmmu/vl.c b/softmmu/vl.c index 06a0e342fe9e..2f7158574e4f 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -80,7 +80,6 @@ #include "migration/snapshot.h" #include "sysemu/tpm.h" #include "sysemu/dma.h" -#include "hw/audio/soundhw.h" #include "audio/audio.h" #include "sysemu/cpus.h" #include "sysemu/cpu-timers.h" @@ -2669,8 +2668,6 @@ static void qemu_create_cli_devices(void) { DeviceOption *opt; - soundhw_init(); - qemu_opts_foreach(qemu_find_opts("fw_cfg"), parse_fw_cfg, fw_cfg_find(), &error_fatal); @@ -3018,9 +3015,6 @@ void qemu_init(int argc, char **argv, char **envp) case QEMU_OPTION_audiodev: audio_parse_option(optarg); break; - case QEMU_OPTION_soundhw: - select_soundhw (optarg); - break; case QEMU_OPTION_h: help(0); break; From patchwork Mon Apr 25 08:21:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621771 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UVfZBd+h; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmyvw4Y2Mz9s0B for ; Mon, 25 Apr 2022 18:33:32 +1000 (AEST) Received: from localhost ([::1]:52180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niu9v-0004NB-Tg for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:33:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0p-0007Hh-EI for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:24:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0n-0002qh-Ff for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:24:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650875040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lGr5ZYYCfBjIhbaCs5pjlimDwxXJN466WQPA6PrOrAg=; b=UVfZBd+hFXf7yBA8qF6Fj2M94zJat09hKaZOh+j8suNNpu+WmLke+OukDaC2HfKUoqAXYX alXBcxVkPtvhUUMLNAIJ36Y23Pm3Xy9kDpqWWjIZXytWKqNEjCGihN1YzGvxaQrVSjUIvM NwUkRK4tg4baZyfwoWA/c6KJzH6LB4o= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-523-Q3VfF7yzNLuhd0q3ew4maw-1; Mon, 25 Apr 2022 04:22:05 -0400 X-MC-Unique: Q3VfF7yzNLuhd0q3ew4maw-1 Received: by mail-wm1-f69.google.com with SMTP id q6-20020a1cf306000000b0038c5726365aso6872717wmq.3 for ; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lGr5ZYYCfBjIhbaCs5pjlimDwxXJN466WQPA6PrOrAg=; b=jKazsCdPTPk6pfjyjFTxfToxd2tqc8kwpgHyxGGyTwCw2zeLaTjuYA8WlfZoRuIpoh PRiIpENY7kZIIQF4liPZWrO+8Ck/fa4NOttR4Lts0lYLNMTu09wL0isfwyEJdt/1DDCK RluI2lFz1s0RtJW/5gz98kl4iszVgTvwKV6VvuAty1rskaT/bF5i9q1XG/V9TaammibS ujX3Mv1mmJ34vKpt2D9iVnbSNLeC89wVbPdAG42PaOGd2E/KyMUENe/uo+9qum5gi4Jm EInnT9hn1ueT1fV/7x/z5ql4P+foFuErvEqHoH4MzcwTMZoKitiBD8YCGMi2YH51SIfA HfYg== X-Gm-Message-State: AOAM531esxwTxwlwPLsFKgdj5saxrlGG7KQ9io/9cvMzNoO1dVRyFhDE 9EaB4R91RUSUq43uFbqaX7tAycC8hDMyiC2m5IDmRjw232PT3hwmvHgDgpfwz/LOIoDo7V+qJ3F zjE1Lsg90nRCh2JA= X-Received: by 2002:a05:600c:1552:b0:38e:c7a4:f056 with SMTP id f18-20020a05600c155200b0038ec7a4f056mr24931337wmg.183.1650874923828; Mon, 25 Apr 2022 01:22:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcPaXQaRYsRK7kFr7dw0OP7er2x/iw/gGtxg/5rbUQrr/TshLfhpO+Mel3UMnOji0xaPOGxg== X-Received: by 2002:a05:600c:1552:b0:38e:c7a4:f056 with SMTP id f18-20020a05600c155200b0038ec7a4f056mr24931297wmg.183.1650874923619; Mon, 25 Apr 2022 01:22:03 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id r17-20020a0560001b9100b00207afaa8987sm9545597wru.27.2022.04.25.01.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:02 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 15F3967B1B57; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 02/18] hw/input/tsc210x: Extract common init code into new function Date: Mon, 25 Apr 2022 10:21:45 +0200 Message-Id: <1d75877cf4cc2a38f87633ff16f9fea3e1bb0c03.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This deduplicates several lines and will make future changes more concise. Signed-off-by: Martin Kletzander Reviewed-by: Daniel P. Berrangé --- 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 df7313db5d7f..f16a8090b7c7 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -31,6 +31,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 @@ -1070,20 +1071,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; @@ -1105,13 +1096,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; } @@ -1132,34 +1139,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; } From patchwork Mon Apr 25 08:21:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621778 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gxCq92Nd; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmzBR43M9z9s0B for ; Mon, 25 Apr 2022 18:46:06 +1000 (AEST) Received: from localhost ([::1]:41448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuM6-00089W-Tb for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:46:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu07-0006V1-Hh for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu01-0002f8-R2 for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O++t1zATSSDRwugsXR7Q5IVUhnhLz0oadJiOZXGBQI8=; b=gxCq92NdSZCVw3Kj9Xxakla3B+v/m6rod9eq5YJsQCnloG3WylVNRefh8211wryzZMAVYz 10ktplgcipIN9lHH9VjJNIuTNPEb5D45/JiwzKrkgMPeHpGmv4fYcdVTUbH9zE13t9ca4B pLEqq1yKHgo9gAB1FzBwLyirwgKGuno= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-262--F27XBhVMRWAv_Uy1Bpo_Q-1; Mon, 25 Apr 2022 04:22:05 -0400 X-MC-Unique: -F27XBhVMRWAv_Uy1Bpo_Q-1 Received: by mail-wr1-f70.google.com with SMTP id h61-20020adf9043000000b002079bbaa5d3so3076404wrh.16 for ; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O++t1zATSSDRwugsXR7Q5IVUhnhLz0oadJiOZXGBQI8=; b=PSQyiO3w3IApHtf0WI43vNnNw/ck+AShYIf6xdFbsRlKdBoxZyS95TPbwMzKsIUyp4 QRHBCsvsPCZiP/+XFIhOgtci8Et+m6vwG7S5sCihtzC6TFXp7FmCJhdc4a27iX8j4QIF cvpLW4xlysCTmqzkpnXnqRMHDM9K6P7LGtCHkQAdhx5vBk6VOL/RuNqsUyLXVwfsWYZz 4JyQNn2fpkuBQ09sbhSRqkeKrgCrAYTeKltZF/iH+vfknh2O4tFuj/CnVsoVEgi+LjwP 8H7ehbpNp8yT0McN+PB9ZebQCj6zpn6e9IZGxM+keaMRUSp+qz1JIwBahGeUlKZsiv3J PT+Q== X-Gm-Message-State: AOAM532bo1Y0HZuOAOc55gAqL+JrbCzh/koQjvZfbWaTBdZLpvoUC1z9 87+DSQWi65rrsCEK4wd0N2f2Zk7x86tg3Z6NIDsUIb+DjcUBi7ZLCFaxZ15wOa3bBtxeIaXCFkj RJtkAxz2gZUlINf8= X-Received: by 2002:a05:600c:34c4:b0:38e:b628:da95 with SMTP id d4-20020a05600c34c400b0038eb628da95mr15717853wmq.150.1650874924305; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6ppccZBgA9uskRcnwRbeAZSUgXdhxq0J4Qj9y/UaMbfOl3mTT83uTPV77spRbZYTUOCkj3g== X-Received: by 2002:a05:600c:34c4:b0:38e:b628:da95 with SMTP id d4-20020a05600c34c400b0038eb628da95mr15717824wmq.150.1650874924044; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id g5-20020adfd1e5000000b0020a97e7ba9fsm9606190wrd.92.2022.04.25.01.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:02 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 17F0967B1B58; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 03/18] hw/audio: Simplify hda audio init Date: Mon, 25 Apr 2022 10:21:46 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Daniel P. Berrangé --- 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 feb8f9e2bb7a..e86a2adf31a0 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -676,7 +676,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; @@ -719,7 +721,6 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc) break; } } - return 0; } static void hda_audio_exit(HDACodecDevice *hda) @@ -849,37 +850,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 e77552363a4c..a17002812240 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -70,9 +70,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 f78c1833e341..8d710eee5d66 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); From patchwork Mon Apr 25 08:21:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621765 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=W2X4SkT9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmyjc2sn5z9s0r for ; Mon, 25 Apr 2022 18:24:35 +1000 (AEST) Received: from localhost ([::1]:43186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niu1I-0006WY-1a for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:24:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu06-0006Uj-NL for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60331) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu01-0002f2-QP for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LP+dkidDrA7cfJYHAisZQeWSrGU9PlpHAtpMlIl/SfU=; b=W2X4SkT9/CzP9Ljv4Et/cXO+X0Y3bcBkk5HS82pe8HatLJQ303SNCEUOdtnwL6ziky8t+p sT2ocww2LDe9UA76NCdetLX+9uAkTTUtW1eZb4irsvsn1l9iqHF0/AMUS+C1hqDPQD9tgI 4Ne5p/DbUUGHoJNvru3LY9cww8nr7TY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-523-3NzVTrl8OZGt-HCW4NULiw-1; Mon, 25 Apr 2022 04:22:04 -0400 X-MC-Unique: 3NzVTrl8OZGt-HCW4NULiw-1 Received: by mail-wr1-f70.google.com with SMTP id l11-20020adfc78b000000b0020abc1ce7e4so2424172wrg.1 for ; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LP+dkidDrA7cfJYHAisZQeWSrGU9PlpHAtpMlIl/SfU=; b=WtPykElShU14/3s1gBk17dDYCmkLFMwQUx+Y9XouimehN5t1SzwKx3zq3ltPfLTEHC qPVfWRSR/3ivgLCgtwKq5bONfvPQvQHrnNfSdOyxzzDK4PO3aTvGBUoyB0U+GLVMj8er bRcfUSBB1WYnKEKGnPW5/v7YZtWYRLmLciFvO3eYPyJoR5YHDLR5opWLfDM5kC2Yecoo 0KzJAT7aWlqbIG2K4YFAdM09dV300tP+HlicFTrEzWG2bXycyzDNwI0gxLjwEqv0tQQa VLE+0fZ4WfdDfEGvqOVaMqyFqTI2xM3LdM1AUkshpZRH6TTb8XubB6iMPvnCzCJ5Dber OGTg== X-Gm-Message-State: AOAM531WgdaCgqoGkSPTe4v8awbhyWB36GzfBKqBYobxkwa4ql10+MDr dTwmnQep7IQLySzlkbZVVM1DIHesqdsTdOToTHEYbS/T5a70Q37IOp7fOV5SQtPHENLckeTqtCt 0Wf/rdc5VdStn+go= X-Received: by 2002:a7b:c155:0:b0:38e:b840:c99e with SMTP id z21-20020a7bc155000000b0038eb840c99emr24205908wmi.201.1650874923791; Mon, 25 Apr 2022 01:22:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF3yOmquu6AEfkG27LCAoxXCxRyK/bmeHLHRzKzd33HzQgGq5KPLwi+gafnv2wUQux0kat3w== X-Received: by 2002:a7b:c155:0:b0:38e:b840:c99e with SMTP id z21-20020a7bc155000000b0038eb840c99emr24205866wmi.201.1650874923491; Mon, 25 Apr 2022 01:22:03 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id s2-20020adfa282000000b0020ad9c40555sm2790490wra.94.2022.04.25.01.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:02 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 23B7667B1B59; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 04/18] hw/audio/lm4549: Add errp error reporting to init function Date: Mon, 25 Apr 2022 10:21:47 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will be used in future commit. Signed-off-by: Martin Kletzander Reviewed-by: Daniel P. Berrangé --- 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 32b1481b5614..418041bc9c6c 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 aba9bb5b077c..61c3ab12dd33 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 03acd4fe344b..868dffbfd321 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 = { From patchwork Mon Apr 25 08:21:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621790 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HH5C9eQn; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmzV51fsRz9s5V for ; Mon, 25 Apr 2022 18:59:41 +1000 (AEST) Received: from localhost ([::1]:34792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuZH-0006Es-6b for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:59:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0p-0007Hi-HH for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:24:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25930) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0n-0002qj-FF for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:24:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650875040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CxH74JGUW7ryvtn4xS8i28T7ZhqNwBVbzuWMzVW6NKE=; b=HH5C9eQnhTmuP/XEUD6i8rOP2VueUriwqFEoPeJLsoOG0oy/9/SDMVMZ0ExBOfuTE/0H33 LU207QKQARjWA+ly6Auuz2qCtHU9Csa517bkj8/f5Lw57mTuCr0oa+XkKEjo2TalPA7bYf /DUgEc2G0fSp4CgVp4WTB/+a0Aos3vI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-3yt6W30-N8OvRT4UKBU43g-1; Mon, 25 Apr 2022 04:22:05 -0400 X-MC-Unique: 3yt6W30-N8OvRT4UKBU43g-1 Received: by mail-wm1-f71.google.com with SMTP id h65-20020a1c2144000000b0038e9ce3b29cso9970920wmh.2 for ; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CxH74JGUW7ryvtn4xS8i28T7ZhqNwBVbzuWMzVW6NKE=; b=pEcmCAmLVmTY0ih2mm9cqFtC6ASqLvNJbpYIUVV8cQkvXb/hPtE/ugV++CAGcbr6IR lrXJM6f27gc8xypwNEvbouGwDaYmtLHCNW1ZhiL0+pS3HT64auO6bAb/55QReLA7ZeDy YtH/68kTJhXe6PC+6q47HPaduWK1FYOOJG/j+DqYtUtqk6cYr6L1a7Dz70+SJPBI+gEr ILav5j5ucSe5lm73m6kntgYL89yRciM2jkiQRix1NtLfu4wfXHFsu/LDk91LkyQ8giiP 26n71Wg7wyqoff7B+VPBb5FcNsnrB3LwSXMafVaHTm5R0mpG2KCzpKtn/tpp4jstYnG/ 62Rg== X-Gm-Message-State: AOAM533eBS+GDpDXTElDPuX9QRTgK1Fb+G6LeIBbJLsZGCsvJGzZIkwM iVgLlT4fye5+J7TCFmEXSxRYErOFNzvYBrbszC7ZVkGdjRAGlu62Qi+11S4vnfbaLVXSq9by4Jv yohOq3Wu3dPyiKyM= X-Received: by 2002:a5d:598c:0:b0:20a:9194:22d4 with SMTP id n12-20020a5d598c000000b0020a919422d4mr13194369wri.124.1650874924651; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXaqOa3YGloOuHdu9I/QDfXPNlBvXS0NM2gTP8aPnZlIrHdCUbxL8fl4ZTH69w0ylU0Ngz2g== X-Received: by 2002:a5d:598c:0:b0:20a:9194:22d4 with SMTP id n12-20020a5d598c000000b0020a919422d4mr13194350wri.124.1650874924450; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id h9-20020a05600c350900b00393f01c8f00sm77266wmq.47.2022.04.25.01.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 2FFDE67B1B5A; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 05/18] tests/qtest: Specify audiodev= and -audiodev Date: Mon, 25 Apr 2022 10:21:48 +0200 Message-Id: <6e7f2808dd40679a415812767b88f2a411fc137f.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Daniel P. Berrangé --- tests/qtest/ac97-test.c | 3 ++- tests/qtest/es1370-test.c | 3 ++- tests/qtest/fuzz/generic_fuzz_configs.h | 6 ++++-- tests/qtest/intel-hda-test.c | 15 ++++++++++----- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/qtest/ac97-test.c b/tests/qtest/ac97-test.c index e09f2495d24d..9711f1f6d966 100644 --- a/tests/qtest/ac97-test.c +++ b/tests/qtest/ac97-test.c @@ -45,7 +45,8 @@ static void *ac97_create(void *pci_bus, QGuestAllocator *alloc, void *addr) static void ac97_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/es1370-test.c b/tests/qtest/es1370-test.c index 2fd7fd2d3d30..5facda8d0d8d 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 004c701915e1..84a93b3c350b 100644 --- a/tests/qtest/fuzz/generic_fuzz_configs.h +++ b/tests/qtest/fuzz/generic_fuzz_configs.h @@ -101,8 +101,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 a58c98e4d11b..39ced2bc6ac6 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("-device intel-hda,id=" HDA_ID CODEC_DEVICES); + qtest_start(AUDIODEV "-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); From patchwork Mon Apr 25 08:21:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621770 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=D0SbXmk2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmyvl6pG0z9s0B for ; Mon, 25 Apr 2022 18:33:22 +1000 (AEST) Received: from localhost ([::1]:52128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niu9l-0004L9-Ew for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:33:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu03-0006TD-6P for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu01-0002ex-DZ for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/07G+KOnjwzPWs5gbVSF2lCzR4/Df0FQ6EC3Xytgne8=; b=D0SbXmk22P32dFepvZGi6TdCFU3cH5Ep6mKDpDkLxb2ubKEHPm8E61wg3lGaE4lp1a5R21 0DTQCirRlM+E62SMdS2bWpvEtCwlnpFl5CzVcxa9t6eEGSKFfFezstbQIX0zu/FnSWzPKB q07MfNBw/50UJ8L4bLwpiaFSim+c5Mw= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-300-mQtdEsG8O2ajILQKGn5DcQ-1; Mon, 25 Apr 2022 04:22:05 -0400 X-MC-Unique: mQtdEsG8O2ajILQKGn5DcQ-1 Received: by mail-wm1-f72.google.com with SMTP id d6-20020a05600c34c600b0039296a2ac7cso6875586wmq.1 for ; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/07G+KOnjwzPWs5gbVSF2lCzR4/Df0FQ6EC3Xytgne8=; b=z7aQpdkWH4XfJnyT29zmIVnTvIfxTrUNVIJPtMaiGd2iC8iio8JqaQJSD8BjoGzhgR oRqV7w2LIlUROx6D4gg4bi92vkLU2/WKg0J05BMBipCROBKcUBsml8IgppcOXUMVjB9a Dd/BVjmoZcHeBpExuu20FzLC9smsKmG933QjN4/Dm/CWahyOYE2AXQZ+s1KGdz17B6yt T8kI56On3fTu5uquWNgsIsPIY81Xy+48cQ5MZxfcBGMKu3SOGAb18JaK99xhVk+Qpnmj KcMCKPEvwCMkKsJALpLMcEDFqIY4kTqCyFH8utLQiRkiLy+0LKCRDwFCzgog0LdawPw+ xbYA== X-Gm-Message-State: AOAM533r9cIFGNDgb67U3pEq3Ym+VhGvz3n6LComijxVB49kSLIex1Qi rg3U2tTPJk2V7TzPj3KBlSaBNQSCSLPxEwDqaxJ2x6i/cZItNgbX5sOXSAxL+rL8zhefohsoOaO jz47dKeoqtZZhbYg= X-Received: by 2002:a05:600c:3b97:b0:393:ea66:77ef with SMTP id n23-20020a05600c3b9700b00393ea6677efmr5295096wms.120.1650874924770; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwVF3dK0i9vOzAY/PYvnp5i5lQER5yvkUNth9GcfEFLwk+oH+Lrsa2v9IyXQkqINxFUFcY9g== X-Received: by 2002:a05:600c:3b97:b0:393:ea66:77ef with SMTP id n23-20020a05600c3b9700b00393ea6677efmr5295078wms.120.1650874924601; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id az20-20020a05600c601400b0038ffb253bb3sm12904265wmb.36.2022.04.25.01.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 31F3C67B1B5B; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 06/18] ui/vnc: Require audiodev= Date: Mon, 25 Apr 2022 10:21:49 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Martin Kletzander --- ui/vnc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index badf1d7664fe..2e7af139b030 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -4188,12 +4188,15 @@ void vnc_display_open(const char *id, Error **errp) vd->ledstate = 0; audiodev = qemu_opt_get(opts, "audiodev"); - if (audiodev) { - vd->audio_state = audio_state_by_name(audiodev); - if (!vd->audio_state) { - error_setg(errp, "Audiodev '%s' not found", audiodev); - goto fail; - } + if (!audiodev) { + error_setg(errp, "Audiodev parameter for vnc required"); + goto fail; + } + + vd->audio_state = audio_state_by_name(audiodev); + if (!vd->audio_state) { + error_setg(errp, "Audiodev '%s' not found", audiodev); + goto fail; } device_id = qemu_opt_get(opts, "display"); From patchwork Mon Apr 25 08:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621774 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cIkucddE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmz3N3M3Fz9s0B for ; Mon, 25 Apr 2022 18:39:58 +1000 (AEST) Received: from localhost ([::1]:60828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuGB-00027A-Hi for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:39:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu08-0006V5-2G for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu03-0002gU-8n for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UZepi0m5BVgKJx/HPDJyrJ5ZvGt/JKxiUh6H4LwnwPg=; b=cIkucddEBbYJaLLYHnt96ElDY1qprhm8qXvpPbFL4Qqlv2iEcRcE527oEx/ZlXAfOz0udJ aSbmTy+dGDMH6DJWqlBUY3oTb2ztLXB2S0M98iSQzfEW7eGtg6upOaFAHU1Zg0/9GpIolF FHGpkBTRALSQUJC9/ksxqNEMsuUtdm8= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-jisiurINOx-zymX68PMyXQ-1; Mon, 25 Apr 2022 04:22:06 -0400 X-MC-Unique: jisiurINOx-zymX68PMyXQ-1 Received: by mail-wr1-f72.google.com with SMTP id l7-20020adfbd87000000b0020ac0a4d23dso2389288wrh.17 for ; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UZepi0m5BVgKJx/HPDJyrJ5ZvGt/JKxiUh6H4LwnwPg=; b=DpC2u4sNdyLLs8xPc/hQsasKRj8YzhdOwyp5QbjyreeMV8wNU86uFRe0sya+ZxEaHa mb57aQHkZJaZ1lhC9q/dF+icpKEQAelwRYyvxeo+LpRh0WszZuZS9hZcBqGZ7EZCmv9D 3qhSAipy1zztuh+i5b1QkTXMiXtkzBjcq2/HUlQf0cqfpVR7SmJyWycSvdRTmW8Gq5zs gdV71UCBMrAa6wOS47ODo6qEN7+doDflHk8RJkcKbdt0iqRdMhje4RJkFuppOW7aVsTP HGLRFbvPjBfHhuKuCBA+Rq7HF3QM6bJPq3CtLLA4nvZHlrhMOt4hhldCehnYKHD3wPul qhkQ== X-Gm-Message-State: AOAM531frBFnfryKFPvBNNai2pX3z3U7OJtkNcmT+X26xjwoz684fShg +MDiyxkrv2SFQ3XjmbaikoVRHe0ORQ7KPUeG37UKQhLXnIekig1f8ftApYYwQzA9Rmi8mV6J/lp AD4sALg4+OQsjbTM= X-Received: by 2002:a7b:c8d5:0:b0:392:b12e:fd11 with SMTP id f21-20020a7bc8d5000000b00392b12efd11mr15517517wml.96.1650874925077; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUahLQt6GhA+0msQeYylE6Fv6b6MYTVsGx0uQ2lBLi4J52QheCVTnDPzDtU109D1faST8FXQ== X-Received: by 2002:a7b:c8d5:0:b0:392:b12e:fd11 with SMTP id f21-20020a7bc8d5000000b00392b12efd11mr15517503wml.96.1650874924883; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id g13-20020a05600c4ecd00b00393ec8be5cfsm1755054wmq.24.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 3F2DC67B1B5C; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 07/18] Introduce machine's default-audiodev property Date: Mon, 25 Apr 2022 10:21:50 +0200 Message-Id: <49192ccd62fc98c474bb0b627a22cc28a634e8b8.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Many machine types have default audio devices with no way to set the underlying audiodev. Instead of adding an option for each and every one of them this new property can be used as a default during machine initialisation when creating such devices. Signed-off-by: Martin Kletzander --- hw/core/machine.c | 23 +++++++++++++++++++++++ include/hw/boards.h | 1 + 2 files changed, 24 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index cb9bbc844d24..d055a126d398 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -596,6 +596,22 @@ static void machine_set_memdev(Object *obj, const char *value, Error **errp) ms->ram_memdev_id = g_strdup(value); } +static char *machine_get_default_audiodev(Object *obj, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + return g_strdup(ms->default_audiodev); +} + +static void machine_set_default_audiodev(Object *obj, const char *value, + Error **errp) +{ + MachineState *ms = MACHINE(obj); + + g_free(ms->default_audiodev); + ms->default_audiodev = g_strdup(value); +} + HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine) { int i; @@ -867,6 +883,12 @@ static void machine_class_init(ObjectClass *oc, void *data) object_class_property_set_description(oc, "confidential-guest-support", "Set confidential guest scheme to support"); + object_class_property_add_str(oc, "default-audiodev", + machine_get_default_audiodev, + machine_set_default_audiodev); + object_class_property_set_description(oc, "default-audiodev", + "Audiodev to use for default machine devices"); + /* For compatibility */ object_class_property_add_str(oc, "memory-encryption", machine_get_memory_encryption, machine_set_memory_encryption); @@ -961,6 +983,7 @@ static void machine_finalize(Object *obj) g_free(ms->device_memory); g_free(ms->nvdimms_state); g_free(ms->numa_state); + g_free(ms->default_audiodev); } bool machine_usb(MachineState *machine) diff --git a/include/hw/boards.h b/include/hw/boards.h index d64b5481e834..5be1de50af03 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -346,6 +346,7 @@ struct MachineState { */ MemoryRegion *ram; DeviceMemoryState *device_memory; + char *default_audiodev; ram_addr_t ram_size; ram_addr_t maxram_size; From patchwork Mon Apr 25 08:21:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jAYYJXBG; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmz3c0Snfz9s0r for ; Mon, 25 Apr 2022 18:40:12 +1000 (AEST) Received: from localhost ([::1]:32788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuGQ-0002Es-1S for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:40:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu06-0006UM-4p for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:50477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu01-0002fN-PY for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PAZUwc5ZqVj8eUHH2Oe1Tiz0RIqORJb8+QvvQ1BqMLI=; b=jAYYJXBGl122yd0XGTPw9V7yOwWFSd5E7izCyvYir/FWPma+Nm5ckxdHax2kvHLWLf5uRC RsftVp0oq/v/Ol+4dP0AfYfIJ1Rr2fcuhgFuHfnUNm8wHCw+OVN4j5Pc0nHzz8BV0mzbCZ wgVUYB0iVl4hjKq0sZZgERDHXT55UHQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-0UY_C6VnMN2ClcYZDI0MJQ-1; Mon, 25 Apr 2022 04:22:06 -0400 X-MC-Unique: 0UY_C6VnMN2ClcYZDI0MJQ-1 Received: by mail-wm1-f72.google.com with SMTP id az27-20020a05600c601b00b0038ff021c8a4so9975318wmb.1 for ; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PAZUwc5ZqVj8eUHH2Oe1Tiz0RIqORJb8+QvvQ1BqMLI=; b=5cHvV5n2817EDUTC8Xne/dDUB1Qjqb2IslrErDXQHpX2Bdwj9DbxP25YArEDG/p87y QAMAK1UH67UQ60MnbBHRa0Q0ozHk+KNePEGe0YPlPikUHWlKC8JR4jOIWAKQ/SoC8DR+ VAeC9jIruSitHiAYWB+p4uhRHgaWWHlNvy4ag3GXads9RE59N95HPigHsY+lU9e/r1fE Gd5v8uxYYc06bi3YXJ4jcNJlwx05Z+67jHG63eXebrNdBJqPYlDe0GwtXKVOvCxLcDZ5 Y7ahniiSOj1pc2/IXY5hsLqU7RYT6mbTgf6ZbIY3U43tTmGo5YN3cUUDPHd4TsXr/BoQ RMPA== X-Gm-Message-State: AOAM533Z84RuRkY/quADWVDCzesLioF/G6NnTVqNFZCl7NmR42tp6R+q 9S8D/2IE75L6N1HsVgn5DiRF0P0/RG+ZfMdkWS4uwSx3ZfUDR3u+fr/EPk91z/dGu5trf4PUDiu qW1UiSKJUXeWZb4I= X-Received: by 2002:a5d:47a4:0:b0:20a:c95e:b3f3 with SMTP id 4-20020a5d47a4000000b0020ac95eb3f3mr12086549wrb.663.1650874924928; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9AN3DTpD4mNyWicCScIo/ePV7PEwSCtTlMYdcy2N7R8rIsAaI7dxGdpvi0OKSlN4jAW/JFA== X-Received: by 2002:a5d:47a4:0:b0:20a:c95e:b3f3 with SMTP id 4-20020a5d47a4000000b0020ac95eb3f3mr12086529wrb.663.1650874924731; Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id g13-20020a5d64ed000000b0020a9e488976sm8952474wri.25.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 40E2E67B1B5D; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 08/18] audio: Add easy dummy audio initialiser Date: Mon, 25 Apr 2022 10:21:51 +0200 Message-Id: <7b0a067b8b0a32ef7ec7c040d1e79d40a9a6b0de.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In case of sound devices which are created by default (some of them even with -nodefaults) it would not be nice to users if qemu required explicit: -audiodev driver=none,id=audio0 -machine default-audiodev=audio0 when they just want to run a VM and not care about any audio output. Instead this little helper makes it easy to create a dummy audiodev (driver=none) in case there is no default-audiodev specified for the machine. To make sure users are not surprised by no sound output a helping message is also printed out. Signed-off-by: Martin Kletzander --- audio/audio.c | 34 ++++++++++++++++++++++++++++++++++ audio/audio.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/audio/audio.c b/audio/audio.c index 9e91a5a4f2b8..671845c65d18 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -37,6 +37,7 @@ #include "sysemu/runstate.h" #include "ui/qemu-spice.h" #include "trace.h" +#include "hw/boards.h" #define AUDIO_CAP "audio" #include "audio_int.h" @@ -2122,6 +2123,39 @@ void audio_init_audiodevs(void) } } +static void audio_init_dummy(const char *id) +{ + Audiodev *dev = g_new0(Audiodev, 1); + AudiodevListEntry *e = g_new0(AudiodevListEntry, 1); + + dev->driver = AUDIODEV_DRIVER_NONE; + dev->id = g_strdup(id); + + audio_validate_opts(dev, &error_abort); + audio_init(dev, NULL); + + e->dev = dev; + QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next); +} + +const char *audio_maybe_init_dummy(const char *default_id) +{ + MachineState *ms = MACHINE(qdev_get_machine()); + + if (ms->default_audiodev) { + return ms->default_audiodev; + } + + dolog("warning: No audiodev specified for implicit machine devices, " + "no audio output will be available for these. " + "For setting a backend audiodev for such devices try using " + "the default-audiodev machine option.\n"); + + audio_init_dummy(default_id); + + return default_id; +} + audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo) { return (audsettings) { diff --git a/audio/audio.h b/audio/audio.h index 3d5ecdecd5c1..335704a4ddb1 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -175,6 +175,8 @@ void audio_legacy_help(void); AudioState *audio_state_by_name(const char *name); const char *audio_get_id(QEMUSoundCard *card); +const char *audio_maybe_init_dummy(const char *default_id); + #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ DEFINE_PROP_AUDIODEV("audiodev", _s, _f) From patchwork Mon Apr 25 08:21:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621773 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QplVIMD0; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmyyR5K3jz9s0B for ; Mon, 25 Apr 2022 18:35:43 +1000 (AEST) Received: from localhost ([::1]:55308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuC5-0006fQ-A5 for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:35:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0B-0006am-Ja for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:59037) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu04-0002hJ-Lc for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gedXaEU9mdSzLcQUY6OVe9Xoeu9dbw5uLfUiFLxMZHc=; b=QplVIMD0JjH8T+FGu6+Q8ozaqnyYcz/yvg4IbvFYo8phlm4gSdG0Ne8UOEq+Y5cyzm3wkF hfFPugtMtdUMNmuMg5/L7fAH7/ZJ+OX2b9R5ytiWZqGChSDvZ5kkvzQfu+LAEcQCDvoRUw /r9N0eQl1ScCBzNg11KrObhbwcU2hyE= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-356-37EaWVsUPfSusEPoxx2Hng-1; Mon, 25 Apr 2022 04:22:06 -0400 X-MC-Unique: 37EaWVsUPfSusEPoxx2Hng-1 Received: by mail-wr1-f71.google.com with SMTP id s14-20020adfa28e000000b0020ac7532f08so1766541wra.15 for ; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gedXaEU9mdSzLcQUY6OVe9Xoeu9dbw5uLfUiFLxMZHc=; b=NCo8vIUiCPjJauPJ5OtFyFaloKTNqn7iUO1KYKsiagIwHc6yMdcGU4yUggJmMdE2tG oOB1h2diOQSuSIgz7EFhKIFV5ye/YHdKj7dUv05h0dn8pN4nEUzdQxsFnfkIJdCzDcZD lRrjK+e9GinNWawdL+q2q849VgAmgunUnLjYgMY7c7MyRtk6Wz0+7OV2aYQhlhq3Pk1D 3WWaU09B8hbeHIpOq/HhPthIOSl6zKWdqUezjQIdAruTXq7fwEDRVU4+IGWb9Jaw3gKP UtHTGLXKVIZEuHwAoLnM4Wps9DGNT7z2UEFgfKwDIz/eKRWOLsNtn2FJpAqPQFJSHxPm Ne+A== X-Gm-Message-State: AOAM532RLkw3L9BL4o34DkMBcIJLjPUOentQWNVGaJstuqFQp1vS280z xRb7d7aj3Ewmim6iPBwY3YPdgqWivgyGSzMHPz3sXlUEAe1ucj4BOpkSVb/4ajxOkFHHSUeA95+ 0k6w4ZPV1DK5VFdY= X-Received: by 2002:a5d:64e4:0:b0:20a:e005:cc96 with SMTP id g4-20020a5d64e4000000b0020ae005cc96mr708538wri.402.1650874925637; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvgkO0CivWwDJyQNO38wTOSZhz/sNkJZgmhGnuOhQaqju/u9/FUPpSUw0KbbYEt3haVP9WCA== X-Received: by 2002:a5d:64e4:0:b0:20a:e005:cc96 with SMTP id g4-20020a5d64e4000000b0020ae005cc96mr708518wri.402.1650874925442; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id e9-20020a056000178900b0020a9f995a3csm8466324wrg.24.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 4D44467B1B5E; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 09/18] hw/display/xlnx_dp.c: Add audiodev property Date: Mon, 25 Apr 2022 10:21:52 +0200 Message-Id: <16963256573fcbfa7720aa2fd000ba74a4055222.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There was no way to set this and we need that for it to be able to properly initialise. Signed-off-by: Martin Kletzander --- 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 9bb781e31254..b16d6be2b5cc 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1357,6 +1357,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); @@ -1364,6 +1369,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 = { From patchwork Mon Apr 25 08:21:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621783 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GeHAeYS6; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmzH86T5tz9s0B for ; Mon, 25 Apr 2022 18:50:12 +1000 (AEST) Received: from localhost ([::1]:48370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuQ6-0004UU-Rq for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:50:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu09-0006W8-H9 for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34495) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu04-0002h6-Eu for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u73kz9B6wJ0lq4eD98kOBj7vDwMC85uO0URBzEu5tl8=; b=GeHAeYS62WVWVUA2VMN0rfxETT67hqkldbWJd505bjpET3fBV8C86szc9i++nRwz/VL+v4 cr1/mTUzP6EkL8UC9cNnXobn9rsUukOyLq+WJcN+56hU9UjLv/LtrfYXS7VCz1K2JdBV6H cWEWopm5s9rqP+u6q1PR0vDGCBj2aog= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-73-JB4t6AnTNt-X2zfiR6q5oQ-1; Mon, 25 Apr 2022 04:22:06 -0400 X-MC-Unique: JB4t6AnTNt-X2zfiR6q5oQ-1 Received: by mail-wm1-f72.google.com with SMTP id i66-20020a1c3b45000000b0038eab4e0feaso6451929wma.9 for ; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u73kz9B6wJ0lq4eD98kOBj7vDwMC85uO0URBzEu5tl8=; b=GoCdWPmyxKUgDFdqJWRUffwgcjvtcUyk4RVT4s/d7FJzduhelP8j4/mxIBUspRBKWi +f4kcYVa+/SCVL97dtFiHd2bOtpxv7oUr9yNwSP6MuNLuiLamQxv+Lv46J7ivpQHwYLQ mAVueww53yHeXH0eSJQOWbQ9vj58qrazMbRijggH4ecm4V1K9Yfw72ktWe9Q+SvPHnkA xu6YRHnwo0hkkbD3ay0TRC5WxfEeOkkpnVu6f0GGlzWMyXewPquDWvsm9bqCKzjn9CXQ tp0W51yrM+CRfYErdf5npMhSXIIcq5ojPmfX6JSl8HA9ItdhZXvb8SeIxLEhs61NJ7J2 fSXA== X-Gm-Message-State: AOAM531Xlu0WW6DBzx5mDLZbz85lY5Q/3riwfR8oy40rG78GwI6rmFLQ +eCMGLv8Epl+o2/BEzi6kV8nSJc5WaAfuUhjL9Xu8YrG8ilyEoHxrIRkqTEXMm756yMweKEBN10 7Qs0OYS/l3VEVNMQ= X-Received: by 2002:a5d:50c4:0:b0:20a:c547:454a with SMTP id f4-20020a5d50c4000000b0020ac547454amr13706719wrt.16.1650874925383; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw0bKELAkGu9TNA01Os1ZFg2LxKt8OV9BWwBE3Cl1xW/eNTb5Mc+/9jUvoF2QleRh8GiV/AA== X-Received: by 2002:a5d:50c4:0:b0:20a:c547:454a with SMTP id f4-20020a5d50c4000000b0020ac547454amr13706690wrt.16.1650874925184; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id d6-20020a5d5386000000b0020a79c74bedsm8138594wrv.79.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 4EDAE67B1B5F; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 10/18] hw/input/tsc210x.c: Support machine-default audiodev with fallback Date: Mon, 25 Apr 2022 10:21:53 +0200 Message-Id: <0b13f27f5389d0a75b9e3046830f88fd37de54f2.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Martin Kletzander --- hw/input/tsc210x.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index f16a8090b7c7..f0b02bc72280 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -1098,6 +1098,14 @@ static void tsc210x_init(TSC210xState *s, qemu_add_mouse_event_handler(tsc210x_touchscreen_event, s, 1, name); + const char *audiodev_id = audio_maybe_init_dummy("tsc.defaudio"); + s->card.name = g_strdup(audiodev_id); + s->card.state = audio_state_by_name(s->card.name); + if (!s->card.state) { + error_setg(&error_fatal, "Cannot find audiodev with id '%s'", + s->card.name); + } + AUD_register_card(s->name, &s->card); qemu_register_reset((void *) tsc210x_reset, s); From patchwork Mon Apr 25 08:21:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621787 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XpKMl5Vj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmzNk1Ry7z9s0B for ; Mon, 25 Apr 2022 18:55:00 +1000 (AEST) Received: from localhost ([::1]:57302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuUj-00027q-R2 for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:54:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0B-0006aF-Db for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu04-0002h9-Jr for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oyMfkcUILkmpK1r/qqI5Brm2uf6KpBJ8gcX2dxLTNQQ=; b=XpKMl5VjfeBMX7Idi7sw8JpiEdekYiue7fHf1nfBrlgsELeEM6SdFsHOlBAfRoVWlAUb2k Sz/ktDaIqN3UH06dgr+woUYULSa01bU3tpS5uQFjuGoZlb30PF4UjMa7+SEMt4szkH4vI6 IWNcueDA11BDj52FeadD2ilKepVE8T0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-WnaiqzQPO-KTKV8yZNXCsg-1; Mon, 25 Apr 2022 04:22:07 -0400 X-MC-Unique: WnaiqzQPO-KTKV8yZNXCsg-1 Received: by mail-wm1-f72.google.com with SMTP id g13-20020a1c4e0d000000b0038eba16aa46so6862127wmh.7 for ; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oyMfkcUILkmpK1r/qqI5Brm2uf6KpBJ8gcX2dxLTNQQ=; b=SMS6iBFtWoIAzjMCy4bE8HPu+hxWHCQL7tYfVCraUUFaSoOGm/HoTIRtxE/E+OXQzW 19ZrT3LpEMdeHAbBU+gy4u7rCE4/WvY7Y/eCaX/Oct5N5FZnDy1iTzFoQDpK/aW6Krh6 MRdTGeNVC7Gv94tEZpUr0iKFSdlyvzVB44fYuRcPtKoOivouJvrz1GRaKMCwrN+N1SMT PgRY1pzDw6T8gvNgL7ftTqBeg22lx8x9o9F05GzhhDeXDa8/PZlitzQWkOpbXRzcXUeH H7F35gZrlwgresDBo4dMe71stMuFrglEZVRoZQT3XSuEJUS8LB6d5SevAOiL1C4A0d9M 7ILA== X-Gm-Message-State: AOAM5329biz3Hersa2xKEDpTVN5IEKq+IJsjqWfwLi7qOmhBxfymSHuo EiF1PZRQjGb5/6ZNWkAESnSIojA1h9d3fewGv/+Sd5F/lt65RMO15SiZF25ShQMiFSMoLMFV1p+ yeP5NZPk2CuAV2dY= X-Received: by 2002:a05:600c:1f0f:b0:38e:c9c8:9983 with SMTP id bd15-20020a05600c1f0f00b0038ec9c89983mr15260376wmb.105.1650874925592; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfD48BjcAECR06YOf9cPKRyTCroqPF2jgrk5q5uvbVqvWjFeT6iIsEtGTyaM6j9J+f1w4xow== X-Received: by 2002:a05:600c:1f0f:b0:38e:c9c8:9983 with SMTP id bd15-20020a05600c1f0f00b0038ec9c89983mr15260357wmb.105.1650874925311; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id f14-20020a0560001a8e00b0020aaf034e59sm10200944wry.90.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:04 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 5B24167B1B60; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 11/18] hw/arm: Support machine-default audiodev with fallback Date: Mon, 25 Apr 2022 10:21:54 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Martin Kletzander --- hw/arm/integratorcp.c | 8 +++++++- hw/arm/musicpal.c | 8 +++++++- hw/arm/omap2.c | 8 ++++++++ hw/arm/realview.c | 3 +++ hw/arm/spitz.c | 10 +++++++--- hw/arm/versatilepb.c | 3 +++ hw/arm/vexpress.c | 3 +++ hw/arm/xlnx-zcu102.c | 4 ++++ hw/arm/z2.c | 12 +++++++++++- 9 files changed, 53 insertions(+), 6 deletions(-) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index b109ece3ae02..0a6d4186dad6 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -27,6 +27,7 @@ #include "hw/irq.h" #include "hw/sd/sd.h" #include "qom/object.h" +#include "audio/audio.h" #define TYPE_INTEGRATOR_CM "integrator_core" OBJECT_DECLARE_SIMPLE_TYPE(IntegratorCMState, INTEGRATOR_CM) @@ -660,7 +661,12 @@ static void integratorcp_init(MachineState *machine) &error_fatal); } - sysbus_create_varargs("pl041", 0x1d000000, pic[25], NULL); + dev = qdev_new("pl041"); + qdev_prop_set_string(dev, "audiodev", + audio_maybe_init_dummy("integrator.defaudio")); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x1d000000); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[25]); if (nd_table[0].used) smc91c111_init(&nd_table[0], 0xc8000000, pic[27]); diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 7c840fb4283e..5d53ed3a8709 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -35,6 +35,7 @@ #include "qemu/cutils.h" #include "qom/object.h" #include "hw/net/mv88w8618_eth.h" +#include "audio/audio.h" #define MP_MISC_BASE 0x80002000 #define MP_MISC_SIZE 0x00001000 @@ -1324,7 +1325,12 @@ static void musicpal_init(MachineState *machine) qdev_connect_gpio_out(key_dev, i, qdev_get_gpio_in(dev, i + 15)); } - wm8750_dev = i2c_slave_create_simple(i2c, TYPE_WM8750, MP_WM_ADDR); + wm8750_dev = i2c_slave_new(TYPE_WM8750, MP_WM_ADDR); + + qdev_prop_set_string(DEVICE(wm8750_dev), "audiodev", + audio_maybe_init_dummy("musicpal.defaudio")); + i2c_slave_realize_and_unref(wm8750_dev, i2c, &error_abort); + dev = qdev_new(TYPE_MV88W8618_AUDIO); s = SYS_BUS_DEVICE(dev); object_property_set_link(OBJECT(dev), "wm8750", OBJECT(wm8750_dev), diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 02b1aa8c974b..4ae524a1a1a6 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -604,12 +604,20 @@ static struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta, qemu_irq irq, qemu_irq *drq, omap_clk fclk, omap_clk iclk) { struct omap_eac_s *s = g_new0(struct omap_eac_s, 1); + const char *audiodev_id = audio_maybe_init_dummy("eac.defaudio"); s->irq = irq; s->codec.rxdrq = *drq ++; s->codec.txdrq = *drq; omap_eac_reset(s); + s->codec.card.name = g_strdup(audiodev_id); + s->codec.card.state = audio_state_by_name(s->codec.card.name); + if (!s->codec.card.state) { + error_setg(&error_fatal, "Cannot find audiodev with id '%s'", + s->codec.card.name); + } + AUD_register_card("OMAP EAC", &s->codec.card); memory_region_init_io(&s->iomem, NULL, &omap_eac_ops, s, "omap.eac", diff --git a/hw/arm/realview.c b/hw/arm/realview.c index d2dc8a895258..4fcdd821789a 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -29,6 +29,7 @@ #include "hw/irq.h" #include "hw/i2c/arm_sbcon_i2c.h" #include "hw/sd/sd.h" +#include "audio/audio.h" #define SMP_BOOT_ADDR 0xe0000000 #define SMP_BOOTREG_ADDR 0x10000030 @@ -207,6 +208,8 @@ static void realview_init(MachineState *machine, pl041 = qdev_new("pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); + qdev_prop_set_string(pl041, "audiodev", + audio_maybe_init_dummy("realview.defaudio")); sysbus_realize_and_unref(SYS_BUS_DEVICE(pl041), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, 0x10004000); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[19]); diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 5aab0b856574..94fff2f460ca 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -35,6 +35,7 @@ #include "exec/address-spaces.h" #include "cpu.h" #include "qom/object.h" +#include "audio/audio.h" enum spitz_model_e { spitz, akita, borzoi, terrier }; @@ -779,10 +780,13 @@ static void spitz_i2c_setup(PXA2xxState *cpu) /* Attach the CPU on one end of our I2C bus. */ I2CBus *bus = pxa2xx_i2c_bus(cpu->i2c[0]); - DeviceState *wm; - /* Attach a WM8750 to the bus */ - wm = DEVICE(i2c_slave_create_simple(bus, TYPE_WM8750, 0)); + I2CSlave *i2c_dev = i2c_slave_new(TYPE_WM8750, 0); + DeviceState *wm = DEVICE(i2c_dev); + + qdev_prop_set_string(wm, "audiodev", + audio_maybe_init_dummy("spitz.defaudio")); + i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort); spitz_wm8750_addr(wm, 0, 0); qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_WM, diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index ecc1f6cf74ff..e068f592b134 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -26,6 +26,7 @@ #include "hw/char/pl011.h" #include "hw/sd/sd.h" #include "qom/object.h" +#include "audio/audio.h" #define VERSATILE_FLASH_ADDR 0x34000000 #define VERSATILE_FLASH_SIZE (64 * 1024 * 1024) @@ -343,6 +344,8 @@ static void versatile_init(MachineState *machine, int board_id) /* Add PL041 AACI Interface to the LM4549 codec */ pl041 = qdev_new("pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); + qdev_prop_set_string(pl041, "audiodev", + audio_maybe_init_dummy("versatilepb.defaudio")); sysbus_realize_and_unref(SYS_BUS_DEVICE(pl041), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, 0x10004000); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, sic[24]); diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index e1d1983ae657..f312a4d5315e 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -44,6 +44,7 @@ #include "hw/i2c/arm_sbcon_i2c.h" #include "hw/sd/sd.h" #include "qom/object.h" +#include "audio/audio.h" #define VEXPRESS_BOARD_ID 0x8e0 #define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024) @@ -614,6 +615,8 @@ static void vexpress_common_init(MachineState *machine) pl041 = qdev_new("pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); + qdev_prop_set_string(pl041, "audiodev", + audio_maybe_init_dummy("vexpress.defaudio")); sysbus_realize_and_unref(SYS_BUS_DEVICE(pl041), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, map[VE_PL041]); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[11]); diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 4c84bb932aa0..e4c32e158b61 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -24,6 +24,7 @@ #include "sysemu/device_tree.h" #include "qom/object.h" #include "net/can_emu.h" +#include "audio/audio.h" struct XlnxZCU102 { MachineState parent_obj; @@ -143,6 +144,9 @@ static void xlnx_zcu102_init(MachineState *machine) object_initialize_child(OBJECT(machine), "soc", &s->soc, TYPE_XLNX_ZYNQMP); + qdev_prop_set_string(DEVICE(&s->soc.dp), "audiodev", + audio_maybe_init_dummy("zcu102.defaudio")); + object_property_set_link(OBJECT(&s->soc), "ddr-ram", OBJECT(machine->ram), &error_abort); object_property_set_bool(OBJECT(&s->soc), "secure", s->secure, diff --git a/hw/arm/z2.c b/hw/arm/z2.c index 9c1e876207b3..8d9141998870 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -26,6 +26,7 @@ #include "exec/address-spaces.h" #include "cpu.h" #include "qom/object.h" +#include "qapi/error.h" #ifdef DEBUG_Z2 #define DPRINTF(fmt, ...) \ @@ -306,6 +307,7 @@ static void z2_init(MachineState *machine) void *z2_lcd; I2CBus *bus; DeviceState *wm; + I2CSlave *i2c_dev; /* Setup CPU & memory */ mpu = pxa270_init(address_space_mem, z2_binfo.ram_size, machine->cpu_type); @@ -330,8 +332,16 @@ static void z2_init(MachineState *machine) type_register_static(&aer915_info); z2_lcd = ssi_create_peripheral(mpu->ssp[1], TYPE_ZIPIT_LCD); bus = pxa2xx_i2c_bus(mpu->i2c[0]); + i2c_slave_create_simple(bus, TYPE_AER915, 0x55); - wm = DEVICE(i2c_slave_create_simple(bus, TYPE_WM8750, 0x1b)); + + i2c_dev = i2c_slave_new(TYPE_WM8750, 0x1b); + wm = DEVICE(i2c_dev); + + qdev_prop_set_string(wm, "audiodev", + audio_maybe_init_dummy("z2.defaudio")); + i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort); + mpu->i2s->opaque = wm; mpu->i2s->codec_out = wm8750_dac_dat; mpu->i2s->codec_in = wm8750_adc_dat; From patchwork Mon Apr 25 08:21:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ivDUtsSj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmzTW0nptz9s0r for ; Mon, 25 Apr 2022 18:59:10 +1000 (AEST) Received: from localhost ([::1]:34514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuYm-00063E-RH for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:59:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0C-0006cu-IC for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu04-0002hH-ML for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bwBj2TaBRASZZSGjsc9HqXLMt7MyjxjnAoNllDw6MNM=; b=ivDUtsSj4RGYuO5Jr2+pwV45Ad6aeEGWZrHVmMdm/hN3cOJKuuaphJjV9pPUM9ncaZ8GAo U/nOxGN1Hpuqpf/EpeU5hWc5eqcjmbB95lKxMld5I1EVq6ahdcXMwpvn+5zqF471a3VzJq 7RuBmLNwS+CK1MI6FBK+exmPipkc7zg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-230-4xOGewTgNxSelzXytBFgYQ-1; Mon, 25 Apr 2022 04:22:07 -0400 X-MC-Unique: 4xOGewTgNxSelzXytBFgYQ-1 Received: by mail-wr1-f69.google.com with SMTP id p18-20020adf9592000000b00207bc12decbso3072211wrp.21 for ; Mon, 25 Apr 2022 01:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bwBj2TaBRASZZSGjsc9HqXLMt7MyjxjnAoNllDw6MNM=; b=0DJSR5sNsfzAVpW7G6E6H2REufVbLdOAf0Wo5Q38YF+aH4YffbgqhBt+zqg4r9q+bb qBGZd9uLyAjy8PgWYXpWwMHvy0D06e6FTHrDRe9mCS5Nvl3iHCzjE2FXZyHSwBvveSc2 1msMSsJC/9rBRg/ZELgocPj8XOdRv8uX1IxN16WvkBNhJEB4aylTAkRiAqcxF0dQKDa6 ZoHXgKcQ1pUcdmqiMnkybh3Z8i9W2+7IkZx+zJ5FWmKobhAJhixE8PrPFZwPjJU9KJjy xvDzZ18jUAI6a3btp29VeL2f1K4phZ4vAKKhnfQCq2o38AiqoSq+3KnhihpNhl8VogV7 wfIA== X-Gm-Message-State: AOAM533wBmwQPdOV+OnSwCZBaAQJuVpATreZ7PcOlQKOEMTAc9oo43F7 b26LRHknP3R6dTuveRdneFs+pMLuNaTTLyDaUSQSO+DIx7oSGOb/EijwAptjAYqi6Jq0kE2UOGK ocL/pelMmKRR3qOI= X-Received: by 2002:a05:6000:1686:b0:20a:96e0:9bbe with SMTP id y6-20020a056000168600b0020a96e09bbemr13086396wrd.635.1650874926176; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw86C2gO2mMfKjeVrOKrDA/Qz/F6XRAJwprg6q1Fd+mFJa4HUgm+acUIsw2U/W4vncKhcrY0w== X-Received: by 2002:a05:6000:1686:b0:20a:96e0:9bbe with SMTP id y6-20020a056000168600b0020a96e09bbemr13086362wrd.635.1650874925990; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id v6-20020a056000144600b0020a9a1627e2sm8374495wrx.15.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 6890067B1B61; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 12/18] hw/ppc: Support machine-default audiodev with fallback Date: Mon, 25 Apr 2022 10:21:55 +0200 Message-Id: <9e9864dfe1cea988e7fdca14a1425d80e5895094.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Martin Kletzander --- hw/ppc/prep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index bf622aa38fab..52d801afb307 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -46,6 +46,7 @@ #include "elf.h" #include "qemu/units.h" #include "kvm_ppc.h" +#include "audio/audio.h" /* SMP is not enabled, for now */ #define MAX_CPUS 1 @@ -304,6 +305,9 @@ static void ibm_40p_init(MachineState *machine) dev = DEVICE(isa_dev); qdev_prop_set_uint32(dev, "iobase", 0x830); qdev_prop_set_uint32(dev, "irq", 10); + + qdev_prop_set_string(dev, "audiodev", + audio_maybe_init_dummy("ppc.defaudio")); isa_realize_and_unref(isa_dev, isa_bus, &error_fatal); isa_dev = isa_new("pc87312"); From patchwork Mon Apr 25 08:21:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gl2BsEyC; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmzBV2lS6z9s0B for ; Mon, 25 Apr 2022 18:46:10 +1000 (AEST) Received: from localhost ([::1]:41800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuMC-0008NR-43 for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:46:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0E-0006gM-HN for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu07-0002ix-9T for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874998; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=djWLap2ip9TeVgEs3MLYUVyamfKL3oD+pQvj2lMaBx8=; b=gl2BsEyC3vO+zCSBBWEUV8ZWRtuHuQaIiYUncCtsWeoek/wZ1CqUIykzzIMhwlSVClVeRi 6/OAn4J01JZJVwGvuRVIgaeqT4xRKLHs/wYI0g0UZ+7bzlF0gm0pO937P31ssLUGsB856Y laZJOfP2JWDRUIu6Us0tPNlHvu34m7M= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-438-w0NTe48bPh2CHBc7ed6I1A-1; Mon, 25 Apr 2022 04:22:07 -0400 X-MC-Unique: w0NTe48bPh2CHBc7ed6I1A-1 Received: by mail-wm1-f69.google.com with SMTP id t2-20020a7bc3c2000000b003528fe59cb9so6872357wmj.5 for ; Mon, 25 Apr 2022 01:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=djWLap2ip9TeVgEs3MLYUVyamfKL3oD+pQvj2lMaBx8=; b=1nSRmY4m4/6g6EJXagh+aUK5BtKPCv7wzF2eKiYvhAh+QlS411r6LBl+CwcusQ36eA cruIDrgPvf6jmTtpjfRlwOS8wZaZnD0541IPoctTB7xg5HMjV5MQLY++pgRxn4bXoyTa lEDn9FKXF1VGKPzpeWNWJZ8U+nbETdAdg1k/7wKfXsOiFt2rVtgWTaJZ9sDWZ6eTorKB tKIBEf1JswzbxTR7bRhKgLi/ARj8V43DaRBqG8QcHNO/hLzPasOV/A4IUFomX7AXMa/H PLPmAzQK6EzZjnuOgpdakKc4XYGb44e/k4ba9EP/5g0F7KDeS7pLUquckHp4+0XHq5Zy VPfA== X-Gm-Message-State: AOAM531q0zf0+1G7YE1M+LCr74AwQBJ9sUvIFL/XHHe9HXhslgvNU6oq 9MMCUATuWwbDBeth7bBWNAEoqbunhPrW9Op6qigW7//koefhr4uHIINzmVxjGdVLZXaG67TXPhM NzR6SbEGDB+mpv0Q= X-Received: by 2002:a05:600c:3548:b0:393:ecaa:d7ae with SMTP id i8-20020a05600c354800b00393ecaad7aemr2568977wmq.86.1650874926020; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSpUPPGaj+xMe6KY5CZvzkGY6Wv6xc3xHTYv5gfb5J122ujfuQZRQfwFQCPnAmuoxcSEng6g== X-Received: by 2002:a05:600c:3548:b0:393:ecaa:d7ae with SMTP id i8-20020a05600c354800b00393ecaad7aemr2568947wmq.86.1650874925705; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id p125-20020a1c2983000000b0038e5ca446bcsm11127092wmp.5.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 6A5FE67B1B62; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 13/18] audio: Make AUD_register_card fallible and require audiodev= Date: Mon, 25 Apr 2022 10:21:56 +0200 Message-Id: <92b31c6af268b8f2a4cc4ed5b20ee8d0e19f614d.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now that all callers support error reporting with errp and all machine-default devices use an explicit audiodev, this can be changed. To make the detection easier make AUD_register_card() return false on error. Signed-off-by: Martin Kletzander --- audio/audio.c | 7 +++++-- audio/audio.h | 2 +- hw/arm/omap2.c | 3 ++- hw/audio/ac97.c | 6 +++++- hw/audio/adlib.c | 7 +++++-- hw/audio/cs4231a.c | 6 ++++-- hw/audio/es1370.c | 5 ++++- hw/audio/gus.c | 4 +++- hw/audio/hda-codec.c | 5 ++++- hw/audio/lm4549.c | 4 +++- hw/audio/pcspk.c | 4 +++- hw/audio/sb16.c | 6 ++++-- hw/audio/wm8750.c | 5 ++++- hw/display/xlnx_dp.c | 6 ++++-- hw/input/tsc210x.c | 3 ++- hw/usb/dev-audio.c | 5 ++++- 16 files changed, 57 insertions(+), 21 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 671845c65d18..b95aca444382 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1822,15 +1822,18 @@ void audio_free_audiodev_list(AudiodevListHead *head) } } -void AUD_register_card (const char *name, QEMUSoundCard *card) +bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp) { if (!card->state) { - card->state = audio_init(NULL, name); + error_setg(errp, "No audiodev specified for %s", name); + return false; } card->name = g_strdup (name); memset (&card->entries, 0, sizeof (card->entries)); QLIST_INSERT_HEAD(&card->state->card_head, card, entries); + + return true; } void AUD_remove_card (QEMUSoundCard *card) diff --git a/audio/audio.h b/audio/audio.h index 335704a4ddb1..9deed8ed6830 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -94,7 +94,7 @@ typedef struct QEMUAudioTimeStamp { void AUD_vlog (const char *cap, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); void AUD_log (const char *cap, const char *fmt, ...) G_GNUC_PRINTF(2, 3); -void AUD_register_card (const char *name, QEMUSoundCard *card); +bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp); void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture( AudioState *s, diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 4ae524a1a1a6..407c24551c84 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -618,7 +618,8 @@ static struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta, s->codec.card.name); } - AUD_register_card("OMAP EAC", &s->codec.card); + /* We can quit here because this only gets called from machine class init */ + AUD_register_card("OMAP EAC", &s->codec.card, &error_fatal); memory_region_init_io(&s->iomem, NULL, &omap_eac_ops, s, "omap.eac", omap_l4_region_size(ta, 0)); diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index fd0b3b97d5b5..8242ddb0f93d 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -1345,6 +1345,10 @@ static void ac97_realize(PCIDevice *dev, Error **errp) AC97LinkState *s = AC97(dev); uint8_t *c = s->dev.config; + if (!AUD_register_card ("ac97", &s->card, errp)) { + return; + } + /* TODO: no need to override */ c[PCI_COMMAND] = 0x00; /* pcicmd pci command rw, ro */ c[PCI_COMMAND + 1] = 0x00; @@ -1378,7 +1382,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp) "ac97-nabm", 256); pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam); pci_register_bar (&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm); - AUD_register_card ("ac97", &s->card); + ac97_on_reset(DEVICE(s)); } diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index ba1be6c8378d..39932654f7f5 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -269,8 +269,6 @@ static void adlib_realizefn (DeviceState *dev, Error **errp) as.fmt = AUDIO_FORMAT_S16; as.endianness = AUDIO_HOST_ENDIANNESS; - AUD_register_card ("adlib", &s->card); - s->voice = AUD_open_out ( &s->card, s->voice, @@ -285,6 +283,11 @@ static void adlib_realizefn (DeviceState *dev, Error **errp) return; } + if (!AUD_register_card ("adlib", &s->card, errp)) { + Adlib_fini (s); + return; + } + s->samples = AUD_get_buffer_size_out (s->voice) >> SHIFT; s->mixbuf = g_malloc0 (s->samples << SHIFT); diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index f510b862efbe..d9353a51ec66 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -676,13 +676,15 @@ static void cs4231a_realizefn (DeviceState *dev, Error **errp) return; } + if (!AUD_register_card ("cs4231a", &s->card, errp)) { + return; + } + s->pic = isa_get_irq(d, s->irq); k = ISADMA_GET_CLASS(s->isa_dma); k->register_channel(s->isa_dma, s->dma, cs_dma_read, s); isa_register_ioport (d, &s->ioports, s->port); - - AUD_register_card ("cs4231a", &s->card); } static Property cs4231a_properties[] = { diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 62359b84f279..77a84f83060b 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -867,7 +867,10 @@ static void es1370_realize(PCIDevice *dev, Error **errp) memory_region_init_io (&s->io, OBJECT(s), &es1370_io_ops, s, "es1370", 256); pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io); - AUD_register_card ("es1370", &s->card); + if (!AUD_register_card ("es1370", &s->card, errp)) { + return; + } + es1370_reset (s); } diff --git a/hw/audio/gus.c b/hw/audio/gus.c index c7710a684b88..f890042baa97 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -245,7 +245,9 @@ static void gus_realizefn (DeviceState *dev, Error **errp) return; } - AUD_register_card ("gus", &s->card); + if (!AUD_register_card ("gus", &s->card, errp)) { + return; + } as.freq = s->freq; as.nchannels = 2; diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index e86a2adf31a0..7f8a7fa7ca1b 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -690,7 +690,10 @@ static void hda_audio_init(HDACodecDevice *hda, a->name = object_get_typename(OBJECT(a)); dprint(a, 1, "%s: cad %d\n", __func__, a->hda.cad); - AUD_register_card("hda", &a->card); + if (!AUD_register_card("hda", &a->card, errp)) { + return; + } + for (i = 0; i < a->desc->nnodes; i++) { node = a->desc->nodes + i; param = hda_codec_find_param(node, AC_PAR_AUDIO_WIDGET_CAP); diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index 418041bc9c6c..9afb81517e8f 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -289,7 +289,9 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_req_cb, void* opaque, lm4549_reset(s); /* Register an audio card */ - AUD_register_card("lm4549", &s->card); + if (!AUD_register_card("lm4549", &s->card, errp)) { + return; + } /* Open a default voice */ as.freq = 48000; diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 72bea5fb202a..41bf6a5cfdb3 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -122,7 +122,9 @@ static int pcspk_audio_init(PCSpkState *s) return 0; } - AUD_register_card(s_spk, &s->card); + if (!AUD_register_card(s_spk, &s->card, NULL)) { + return -1; + } s->voice = AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback, &as); if (!s->voice) { diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 593da2478c14..dd2131426cd3 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -1400,6 +1400,10 @@ static void sb16_realizefn (DeviceState *dev, Error **errp) SB16State *s = SB16 (dev); IsaDmaClass *k; + if (!AUD_register_card ("sb16", &s->card, errp)) { + return; + } + s->isa_hdma = isa_get_dma(isa_bus_from_device(isadev), s->hdma); s->isa_dma = isa_get_dma(isa_bus_from_device(isadev), s->dma); if (!s->isa_dma || !s->isa_hdma) { @@ -1432,8 +1436,6 @@ static void sb16_realizefn (DeviceState *dev, Error **errp) k->register_channel(s->isa_dma, s->dma, SB_read_DMA, s); s->can_write = 1; - - AUD_register_card ("sb16", &s->card); } static Property sb16_properties[] = { diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index b5722b37c36b..57954a631442 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -624,7 +624,10 @@ static void wm8750_realize(DeviceState *dev, Error **errp) { WM8750State *s = WM8750(dev); - AUD_register_card(CODEC, &s->card); + if (!AUD_register_card(CODEC, &s->card, errp)) { + return; + } + wm8750_reset(I2C_SLAVE(s)); } diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index b16d6be2b5cc..d6699f00d89e 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1278,6 +1278,10 @@ static void xlnx_dp_realize(DeviceState *dev, Error **errp) DisplaySurface *surface; struct audsettings as; + if (!AUD_register_card("xlnx_dp.audio", &s->aud_card, errp)) { + return; + } + aux_bus_realize(s->aux_bus); qdev_realize(DEVICE(s->dpcd), BUS(s->aux_bus), &error_fatal); @@ -1296,8 +1300,6 @@ static void xlnx_dp_realize(DeviceState *dev, Error **errp) as.fmt = AUDIO_FORMAT_S16; as.endianness = 0; - AUD_register_card("xlnx_dp.audio", &s->aud_card); - s->amixer_output_stream = AUD_open_out(&s->aud_card, s->amixer_output_stream, "xlnx_dp.audio.out", diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index f0b02bc72280..1ebf0199bfc7 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -1106,7 +1106,8 @@ static void tsc210x_init(TSC210xState *s, s->card.name); } - AUD_register_card(s->name, &s->card); + /* We can quit here because this only gets called from machine class init */ + AUD_register_card(s->name, &s->card, &error_fatal); qemu_register_reset((void *) tsc210x_reset, s); vmstate_register(NULL, 0, vmsd, s); diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 8748c1ba0401..d5ac1f8962e3 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -944,12 +944,15 @@ static void usb_audio_realize(USBDevice *dev, Error **errp) USBAudioState *s = USB_AUDIO(dev); int i; + if (!AUD_register_card(TYPE_USB_AUDIO, &s->card, errp)) { + return; + } + dev->usb_desc = s->multi ? &desc_audio_multi : &desc_audio; usb_desc_create_serial(dev); usb_desc_init(dev); s->dev.opaque = s; - AUD_register_card(TYPE_USB_AUDIO, &s->card); s->out.altset = ALTSET_OFF; s->out.vol.mute = false; From patchwork Mon Apr 25 08:21:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ii7wxs3a; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmyjs1Cctz9s0B for ; Mon, 25 Apr 2022 18:24:49 +1000 (AEST) Received: from localhost ([::1]:43442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niu1S-0006jB-GE for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:24:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu07-0006Uv-1S for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu01-0002f6-RF for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uSjZ4QBWRDNWG4JCXGIx/l5GdZP0dmWgbGQwE/eNVLc=; b=ii7wxs3auKd/VMGjuiC5O2/C8wmbpXUNDCabWbPdFK1jzIQIPxYnQdDJNg1Vdb3TeodOk8 sxuIgF/goo00xjXD8BiDphepmhKsOv4Vxw/zUa6Hg4Qw51mDdAKduN9GysFRlba6Xj3ZDe eV1JOyoIFifa3BAXptiejzALAUNFDd4= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-595-0BZ8KRkyO-eVP8GcnBWEBA-1; Mon, 25 Apr 2022 04:22:07 -0400 X-MC-Unique: 0BZ8KRkyO-eVP8GcnBWEBA-1 Received: by mail-wr1-f71.google.com with SMTP id k20-20020adfc714000000b001e305cd1597so3073953wrg.19 for ; Mon, 25 Apr 2022 01:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uSjZ4QBWRDNWG4JCXGIx/l5GdZP0dmWgbGQwE/eNVLc=; b=GhLoR2qlKnoNFcLCsI8MIeOssOcNp645VWa6KZOLOTyca76ZC+aVhSzLP/mTLzQOBi YCgB8OSPMIeguN5bo7dabrgeLoxURGBS7LZKCZJEhR6cpQ4SRHqWRFT1sECltDdIpyTd Etvw8to1AHqVpvoZrGK0saL2fGhsZzCGs38cXsu8BNCX1FcLcs7/vVXtT7cW2GM3xfqc b1jaSH+G9N/wEMzT+MCo5dDpRywAKF7+HUNGdD/Uvny9TYbwyO9S9NWd/13Dw7tolkWr IOVxou9hMJArPBf0FOQtmA60qBbv0+GJCwVSVMLwIgkuEzSufA63jCBluIyOwee/NOpg 2wTA== X-Gm-Message-State: AOAM530l19gCUGn/qxBSBhXLnMoSBP6cyhVBj19z3eCsZGB9wuN4kY3g uJ8AvrdBgE1RutXb1GdYA4O0am/tU0vqCUMOU6LDoQ4A+PduaqOJqMzZ29kIkazW2P/FQiAyXgY wP7S7tx2/Vs5OQc0= X-Received: by 2002:a5d:414b:0:b0:20a:dc15:bd00 with SMTP id c11-20020a5d414b000000b0020adc15bd00mr2725008wrq.136.1650874926087; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8qC2lx1GQUGbLcuVMC7CuPZAW1FwOhnYZSanHQlE+T8VWSG0vRNi3RnDUInHu9vI2cxEZng== X-Received: by 2002:a5d:414b:0:b0:20a:dc15:bd00 with SMTP id c11-20020a5d414b000000b0020adc15bd00mr2724989wrq.136.1650874925839; Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id w5-20020a7bc105000000b0038eb9932dacsm7960786wmi.48.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 783A667B1B63; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 14/18] audio: Require AudioState in AUD_add_capture Date: Mon, 25 Apr 2022 10:21:57 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since all callers require a valid audiodev this function can now safely abort in case of missing AudioState. Signed-off-by: Martin Kletzander --- audio/audio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index b95aca444382..97eb645764c1 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1855,10 +1855,8 @@ CaptureVoiceOut *AUD_add_capture( struct capture_callback *cb; if (!s) { - if (!legacy_config) { - 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"); } if (!audio_get_pdo_out(s->dev)->mixing_engine) { From patchwork Mon Apr 25 08:21:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UQh/XdTv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmz3b4vNvz9s0B for ; Mon, 25 Apr 2022 18:40:11 +1000 (AEST) Received: from localhost ([::1]:32822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuGP-0002G8-6B for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:40:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0s-0007Li-Nh for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:24:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:39686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0p-0002rN-3O for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:24:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650875042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FhQkwseUjLTHOIhK75umw1DiZK4WT0Kj4VwxUvLlvB0=; b=UQh/XdTv7LZr8nL08xhLVFE/zBqJjPlXjOCDgCiQwRwKmAxGNbzTwxnt9xXCbXBDwomjoo RieNtfAOUcXw4UmZy7qnXaoRkYb3vKzHxStZHfb5KzHt8F+QdFpu5vT4Ad9dY9frIt9ch3 81Yp/yAUTWeLc6+rxnbHjwL5LRZunu4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-231-eSoNJ_fMOP2m9gfKt_Yyfg-1; Mon, 25 Apr 2022 04:22:07 -0400 X-MC-Unique: eSoNJ_fMOP2m9gfKt_Yyfg-1 Received: by mail-wr1-f70.google.com with SMTP id e21-20020adfa455000000b0020ae075cf35so88991wra.11 for ; Mon, 25 Apr 2022 01:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FhQkwseUjLTHOIhK75umw1DiZK4WT0Kj4VwxUvLlvB0=; b=721brlw9+8aCBsKCft32504CZbDqrZ9UH6Hy1SfUbjmp5/pku6KvuyHDc07P3XhH46 f/ZI8H+atHoT+7yQf8kd6GiqKNRCwX536QDtCbP3kQPiRm9oa9jKr8PnIZH6xtgUkLGQ mHYNXzXxYn2ctVd72oNz2HPgmj+AEYAVwoMg0egxX5+fnP5ODPG18RK65Rl1TaORjtFB aWjTV85TS66OHu0mTGaZKjdDi6cULA47BrBy29URt/xaW5/3ICb7xcoYNf+9lpfjtn7q PgmVayeNKm10HQkll9/nXtLpacDFUjWldu2dDJu1d/oqi1dp1aRlwGWitMnI7hColgKC ce1A== X-Gm-Message-State: AOAM5316O+5morU9JDLzAmm99oAzt65cUSAJTLXMZjDvQfHpFfdKg7qJ IoooxF/Ga9Mw3SK5s5pzvbGHjFaAK7J0M07U7s0harMl88FQpmgcrl81KnN4XzKmitAhAsMUwQP QSc2BEoIhmUUIbZo= X-Received: by 2002:a05:600c:21d1:b0:381:4fed:159a with SMTP id x17-20020a05600c21d100b003814fed159amr15601984wmj.143.1650874926493; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/3dRybdDZDRPKfC75dqpdz6R++AejA2+IGjo2roCm92HFyDce4aP6XDzA5ArkFmkvTb/YyA== X-Received: by 2002:a05:600c:21d1:b0:381:4fed:159a with SMTP id x17-20020a05600c21d100b003814fed159amr15601961wmj.143.1650874926243; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id i6-20020a0560001ac600b0020a93f75030sm8609662wry.48.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 84EB767B1B64; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 15/18] audio: Be more strict during audio backend initialisation Date: Mon, 25 Apr 2022 10:21:58 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Now that audiodev= is required and audio_init() will not be called without and AudioDev we can remove the fallback functionality and error out in case audio drivers fail initialisation or when the driver does not exist. Signed-off-by: Martin Kletzander --- audio/audio.c | 146 ++++++-------------------------- docs/about/deprecated.rst | 8 -- docs/about/removed-features.rst | 8 ++ 3 files changed, 34 insertions(+), 128 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 97eb645764c1..c944cf817cf9 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -87,6 +87,8 @@ audio_driver *audio_driver_lookup(const char *name) } } + error_setg(&error_fatal, "Unknown audio driver `%s'", name); + /* Avoid compiler complaining that we do not return in non-void function */ return NULL; } @@ -104,8 +106,6 @@ const struct mixeng_volume nominal_volume = { #endif }; -static bool legacy_config = true; - int audio_bug (const char *funcname, int cond) { if (cond) { @@ -1532,31 +1532,27 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size) return total; } -static int audio_driver_init(AudioState *s, struct audio_driver *drv, - bool msg, Audiodev *dev) +static void audio_driver_init(AudioState *s, struct audio_driver *drv, + Audiodev *dev) { s->drv_opaque = drv->init(dev); - if (s->drv_opaque) { - if (!drv->pcm_ops->get_buffer_in) { - drv->pcm_ops->get_buffer_in = audio_generic_get_buffer_in; - drv->pcm_ops->put_buffer_in = audio_generic_put_buffer_in; - } - if (!drv->pcm_ops->get_buffer_out) { - drv->pcm_ops->get_buffer_out = audio_generic_get_buffer_out; - drv->pcm_ops->put_buffer_out = audio_generic_put_buffer_out; - } + if (!s->drv_opaque) { + error_setg(&error_fatal, "Could not init `%s' audio driver", drv->name); + } - audio_init_nb_voices_out(s, drv); - audio_init_nb_voices_in(s, drv); - s->drv = drv; - return 0; - } else { - if (msg) { - dolog("Could not init `%s' audio driver\n", drv->name); - } - return -1; + if (!drv->pcm_ops->get_buffer_in) { + drv->pcm_ops->get_buffer_in = audio_generic_get_buffer_in; + drv->pcm_ops->put_buffer_in = audio_generic_put_buffer_in; } + if (!drv->pcm_ops->get_buffer_out) { + drv->pcm_ops->get_buffer_out = audio_generic_get_buffer_out; + drv->pcm_ops->put_buffer_out = audio_generic_put_buffer_out; + } + + audio_init_nb_voices_out(s, drv); + audio_init_nb_voices_in(s, drv); + s->drv = drv; } static void audio_vm_change_state_handler (void *opaque, bool running, @@ -1661,79 +1657,19 @@ static const VMStateDescription vmstate_audio = { static void audio_validate_opts(Audiodev *dev, Error **errp); -static AudiodevListEntry *audiodev_find( - AudiodevListHead *head, const char *drvname) -{ - AudiodevListEntry *e; - QSIMPLEQ_FOREACH(e, head, next) { - if (strcmp(AudiodevDriver_str(e->dev->driver), drvname) == 0) { - return e; - } - } - - return NULL; -} - -/* - * if we have dev, this function was called because of an -audiodev argument => - * initialize a new state with it - * if dev == NULL => legacy implicit initialization, return the already created - * state or create a new one - */ -static AudioState *audio_init(Audiodev *dev, const char *name) +static AudioState *audio_init(Audiodev *dev) { static bool atexit_registered; - size_t i; - int done = 0; const char *drvname = NULL; VMChangeStateEntry *e; AudioState *s; - struct audio_driver *driver; - /* 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 (!dev) { + error_setg(&error_abort, "Mandatory audiodev parameter required"); } + drvname = AudiodevDriver_str(dev->driver); + s = g_new0(AudioState, 1); s->dev = dev; @@ -1763,37 +1699,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name) s->nb_hw_voices_in = 0; } - if (drvname) { - driver = audio_driver_lookup(drvname); - if (driver) { - done = !audio_driver_init(s, driver, true, dev); - } else { - dolog ("Unknown audio driver `%s'\n", drvname); - } - } else { - for (i = 0; audio_prio_list[i]; i++) { - AudiodevListEntry *e = audiodev_find(&head, audio_prio_list[i]); - driver = audio_driver_lookup(audio_prio_list[i]); - - if (e && driver) { - s->dev = dev = e->dev; - audio_validate_opts(dev, &error_abort); - done = !audio_driver_init(s, driver, false, dev); - if (done) { - e->dev = NULL; - break; - } - } - } - } - audio_free_audiodev_list(&head); - - if (!done) { - driver = audio_driver_lookup("none"); - done = !audio_driver_init(s, driver, false, dev); - assert(done); - dolog("warning: Using timer based audio emulation\n"); - } + audio_driver_init(s, audio_driver_lookup(drvname), dev); if (dev->timer_period <= 0) { s->period_ticks = 1; @@ -2120,7 +2026,7 @@ void audio_init_audiodevs(void) AudiodevListEntry *e; QSIMPLEQ_FOREACH(e, &audiodevs, next) { - audio_init(e->dev, NULL); + audio_init(e->dev); } } @@ -2133,7 +2039,7 @@ static void audio_init_dummy(const char *id) dev->id = g_strdup(id); audio_validate_opts(dev, &error_abort); - audio_init(dev, NULL); + audio_init(dev); e->dev = dev; QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next); diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 7ba71ebd3435..b2255319e347 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -31,14 +31,6 @@ 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) -'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -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. - ``-chardev`` backend aliases ``tty`` and ``parport`` (since 6.0) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst index 086ba3edb042..f9eea4dda327 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -346,6 +346,14 @@ needs two devices (``-device intel-hda -device hda-duplex``) and pcspk-audiodev=``. And ``AC97`` and ``ES1370`` now have to be specified in uppercase. +Creating sound card devices and vnc without ``audiodev=`` property (removed in 7.1) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +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. + QEMU Machine Protocol (QMP) commands ------------------------------------ From patchwork Mon Apr 25 08:21:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621788 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CjtelYpu; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmzPn5GkGz9s0B for ; Mon, 25 Apr 2022 18:55:57 +1000 (AEST) Received: from localhost ([::1]:57606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuVf-0002K2-NI for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:55:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0H-0006m1-2x for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32229) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0A-0002kC-4C for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650875001; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RNMCFsdt1DfVphZXSznWDAJKRd268N5F4URsC76WAsg=; b=CjtelYpu9DYapbzsI7BNxKPdDRNC626t9YcG1ytujj3v8sXU6F68wEClrEE4/jfRTNh9OM cpMRaGqqt5G+0Pabr8ksL4rDeYipe8R29i86YihYGbg2AbsZ2mE1DnNYFVvb9rL1PQI8tc gezSgjeJNXnOMTZUPT4ArAkUyhMv81g= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-653-JpLUWNKGOoiqgu3X6PcqQw-1; Mon, 25 Apr 2022 04:22:08 -0400 X-MC-Unique: JpLUWNKGOoiqgu3X6PcqQw-1 Received: by mail-wr1-f70.google.com with SMTP id t15-20020adfdc0f000000b001ef93643476so3063398wri.2 for ; Mon, 25 Apr 2022 01:22:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RNMCFsdt1DfVphZXSznWDAJKRd268N5F4URsC76WAsg=; b=Q2vMnfhP7cp53eg3mjI5AxLAQTUka2nc8+I4E7i0W3FnCti84qVMb7lFxcqRWQR7ed +el0tUD4HLI43N0ItJlUHYCNaezHGU44EQe9NCSxTJqb1jDIF6SBoIG7Lh0CczwFmz+X /mDnKGMGldXIWPZTztasq0hs1IvMz79nDv4GshqhmD4rGTmIzPPRXAOQGqFF+qkzv3pO FDWy6wHWF9mPi30DqEj5V9YDdzyUHoDqGuci4M101iQ7AYvL0tubSd95lP4GRwt0000H qciOnJcmBfvVMUexuN8zoSgzd+rr5Wp+RTcAq7H1BhsZOQmHN8ojLpl96ixDOW1AGQOG 31DQ== X-Gm-Message-State: AOAM532R/+S82Fvtt+doWpiEwzrWcyqfebWB+DH9OMrzzZkAVLkxOa4F gL8dwQ0+w9dc+yaekzX8mMwaNmMA/54zCbEtUbE0AjO2UscKHtHkVzjPWqLUJioTq+cqyedOmt5 glyltQ+D8dKYECgQ= X-Received: by 2002:a5d:4fca:0:b0:20a:cf56:a894 with SMTP id h10-20020a5d4fca000000b0020acf56a894mr9298191wrw.528.1650874926947; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+f/2SVdHUly0vy5r/Hl7JL7WORn5lIVFTyZ0TioUZEj7Zl6cNy8EfBhjEkf0JCtk+xrBUqg== X-Received: by 2002:a5d:4fca:0:b0:20a:cf56:a894 with SMTP id h10-20020a5d4fca000000b0020acf56a894mr9298165wrw.528.1650874926539; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id o2-20020a5d6482000000b0020a96536fcdsm8850332wri.57.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 87D8D67B1B65; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 16/18] audio: Remove legacy audio environment variables and options Date: Mon, 25 Apr 2022 10:21:59 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Martin Kletzander Reviewed-by: Daniel P. Berrangé --- audio/audio.c | 13 - audio/audio.h | 1 - audio/audio_legacy.c | 555 -------------------------------- audio/meson.build | 1 - docs/about/deprecated.rst | 7 - docs/about/removed-features.rst | 9 + qemu-options.hx | 10 - softmmu/vl.c | 4 - 8 files changed, 9 insertions(+), 591 deletions(-) delete mode 100644 audio/audio_legacy.c diff --git a/audio/audio.c b/audio/audio.c index c944cf817cf9..b3ecc8fa6508 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -49,19 +49,6 @@ #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" - -/* Order of CONFIG_AUDIO_DRIVERS is import. - The 1st one is the one used by default, that is the reason - that we generate the list. -*/ -const char *audio_prio_list[] = { - "spice", - CONFIG_AUDIO_DRIVERS - "none", - "wav", - NULL -}; - static QLIST_HEAD(, audio_driver) audio_drivers; static AudiodevListHead audiodevs = QSIMPLEQ_HEAD_INITIALIZER(audiodevs); diff --git a/audio/audio.h b/audio/audio.h index 9deed8ed6830..ae10a7f0fa81 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -170,7 +170,6 @@ void audio_sample_from_uint64(void *samples, int pos, void audio_parse_option(const char *opt); void audio_init_audiodevs(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_legacy.c b/audio/audio_legacy.c deleted file mode 100644 index 595949f52cd4..000000000000 --- a/audio/audio_legacy.c +++ /dev/null @@ -1,555 +0,0 @@ -/* - * QEMU Audio subsystem: legacy configuration handling - * - * Copyright (c) 2015-2019 Zoltán Kővágó - * - * 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) -{ - unsigned long long ret; - if (parse_uint_full(str, &ret, 10) || 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, bool *has_dst) -{ - const char *val = getenv(env); - if (val) { - if (*has_dst) { - g_free(*dst); - } - *dst = g_strdup(val); - *has_dst = true; - } -} - -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); - } -} - - -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; - } -} - -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; -} - - -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; - } -} - -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); -} - -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; - } -} - -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; - } -} - -/* backend specific functions */ -/* 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, &apdo->has_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); -} - -/* 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); -} - -/* 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); -} - -/* 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, &opdo->has_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); -} - -/* pulseaudio */ -static void handle_pa_per_direction( - AudiodevPaPerDirectionOptions *ppdo, const char *env) -{ - get_str(env, &ppdo->name, &ppdo->has_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, &dev->u.pa.has_server); -} - -/* 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)); -} - -/* 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, &dev->u.wav.has_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) { - case AUDIODEV_DRIVER_ALSA: - handle_alsa(e->dev); - break; - - case AUDIODEV_DRIVER_COREAUDIO: - handle_coreaudio(e->dev); - break; - - case AUDIODEV_DRIVER_DSOUND: - handle_dsound(e->dev); - break; - - case AUDIODEV_DRIVER_OSS: - handle_oss(e->dev); - break; - - case AUDIODEV_DRIVER_PA: - handle_pa(e->dev); - break; - - case AUDIODEV_DRIVER_SDL: - handle_sdl(e->dev); - break; - - 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/meson.build b/audio/meson.build index 94dab16891d5..d73155d2f2ae 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -1,6 +1,5 @@ softmmu_ss.add([spice_headers, files('audio.c')]) softmmu_ss.add(files( - 'audio_legacy.c', 'mixeng.c', 'noaudio.c', 'wavaudio.c', diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index b2255319e347..7cc44e611ebe 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -23,13 +23,6 @@ deprecated. 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. ``-chardev`` backend aliases ``tty`` and ``parport`` (since 6.0) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst index f9eea4dda327..e2a95baf9031 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -354,6 +354,15 @@ 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. +``QEMU_AUDIO_`` environment variables and ``-audio-help`` (removed in 7.1) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +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 ``-audio-help`` option can be used with older QEMU +binaries to convert some of the old values of the environment variables +to new ``-audiodev`` options. + QEMU Machine Protocol (QMP) commands ------------------------------------ diff --git a/qemu-options.hx b/qemu-options.hx index 47bbd86a4533..b45d488440fc 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -651,16 +651,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("audiodev", HAS_ARG, QEMU_OPTION_audiodev, "-audiodev [driver=]driver,id=id[,prop[=value][,...]]\n" " specifies the audio backend to use\n" diff --git a/softmmu/vl.c b/softmmu/vl.c index 2f7158574e4f..248bf8f66c4c 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3008,10 +3008,6 @@ void qemu_init(int argc, char **argv, char **envp) } break; #endif - case QEMU_OPTION_audio_help: - audio_legacy_help(); - exit (0); - break; case QEMU_OPTION_audiodev: audio_parse_option(optarg); break; From patchwork Mon Apr 25 08:22:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621766 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E1AmNwP1; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmyjc2qvSz9s0B for ; Mon, 25 Apr 2022 18:24:34 +1000 (AEST) Received: from localhost ([::1]:43194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niu1H-0006Wv-4x for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 04:24:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu06-0006UP-FW for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53231) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu01-0002fM-PX for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:23:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650874992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hI7bzsmky1WaiM9g+64rTyViI5OA6WYELvRET0z3sHg=; b=E1AmNwP1bR58CRtLy4uMz/ni+1rgsUQwTcIC4xTDIuCzoI98+Jb8zHAJrtO4GZe1DoM+Yn SF9CDd8WzZ0sxpHxhQbwlqJWH64ZprCcr0vOCEwb+z2+SQIcSijthVY5wT/kOUc09/8Zz/ MW5Hpl1ey/dM5TgPHt5EiZEv+rzsNAA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-49-S4_3_mvePVOx_-zZ9fpZNA-1; Mon, 25 Apr 2022 04:22:07 -0400 X-MC-Unique: S4_3_mvePVOx_-zZ9fpZNA-1 Received: by mail-wm1-f69.google.com with SMTP id m125-20020a1c2683000000b00391893a2febso6461316wmm.4 for ; Mon, 25 Apr 2022 01:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hI7bzsmky1WaiM9g+64rTyViI5OA6WYELvRET0z3sHg=; b=rN476h4TpC7ATqFfm7kyibfCV4wcqUzXFvA0Qc8UaXbLcBbUTPuDiGIZ3HpQbw1L+M scVu0lQG5kum9M2j2+iq7LZZ/WPXcDX1lT9jm/J/dviENq1xZ1JLGp2KbH4yJKFGuZGG Jp9pX8bdlQDoXlBkFTOKTBEAwfarpbImQiGg3WRp/yq1kOCTf7TB0xxzomWNDswG2dP1 Cjb/zzWLpnKjkuTLsxfbXvKKqroNAhaygjsBt/8lu/4T1rszsQ0mwPT6SvVM2RD5EPmJ ynkpz/N8SXpFypctv23ZAUaZuZ6zz+p3TP5G0USL4HRgMpWtfrnAk7rVJ6oAz6Zy901V 9TsA== X-Gm-Message-State: AOAM530Xd7WjO2PvfneSD0c3J9KGl1cg2Nl2Nb/3Nn0WHYgEtvKV80ZL a5s6sETV+WV7m/j3YnTwXXcaeC/dd18CCgnrOYparMm9Ft6UxBuHwsrudsnqM0ZlJ3SsOYoZgzB i582nWiFov9Z5GfI= X-Received: by 2002:a05:6000:1e0a:b0:20a:be21:a20 with SMTP id bj10-20020a0560001e0a00b0020abe210a20mr13322002wrb.214.1650874926593; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHxLb1ml4Gw6ml6BSzUinBuwuxXjCE8aateQTla9rtNcglW4bqzlgWY0sQ5Y0KtT9KHds1jw== X-Received: by 2002:a05:6000:1e0a:b0:20a:be21:a20 with SMTP id bj10-20020a0560001e0a00b0020abe210a20mr13321970wrb.214.1650874926384; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id z7-20020a7bc7c7000000b0038eaf85b0absm8065953wmk.20.2022.04.25.01.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 99E2967B1B66; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 17/18] audio: Remove unused can_be_default Date: Mon, 25 Apr 2022 10:22:00 +0200 Message-Id: <31616bc6be45ba26e96beb54f7278d618f15a5fe.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since there is no fallback mechanism and default-guessing this is now not used and can be safely removed. Signed-off-by: Martin Kletzander Reviewed-by: Daniel P. Berrangé --- audio/alsaaudio.c | 1 - audio/audio_int.h | 1 - audio/coreaudio.m | 1 - audio/dbusaudio.c | 1 - audio/dsoundaudio.c | 1 - audio/jackaudio.c | 1 - audio/noaudio.c | 1 - audio/ossaudio.c | 1 - audio/paaudio.c | 1 - audio/sdlaudio.c | 1 - audio/wavaudio.c | 1 - 11 files changed, 11 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 4a61378cd757..edbee63f97c5 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -933,7 +933,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_int.h b/audio/audio_int.h index 2a6914d2aa65..082b13247657 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -148,7 +148,6 @@ struct audio_driver { void (*set_dbus_server) (AudioState *s, GDBusObjectManagerServer *manager); #endif struct audio_pcm_ops *pcm_ops; - int can_be_default; int max_voices_out; int max_voices_in; int voice_size_out; diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 4695291621a3..e5612138a74b 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 a3d656d3b017..bbcad7051413 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -638,7 +638,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 3fb67ec3eed4..311e34218465 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 5bdf3d7a78d6..fd2d2fd5acb7 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/noaudio.c b/audio/noaudio.c index 84a6bfbb1c87..111aef4a24ce 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 8e075edb70d6..31b582e8e4b5 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -781,7 +781,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 e91116f2396c..38f09017eb96 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/sdlaudio.c b/audio/sdlaudio.c index 68a237b76b45..5177e31d9b4a 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/wavaudio.c b/audio/wavaudio.c index ac666335c783..4e176500fc92 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), From patchwork Mon Apr 25 08:22:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kletzander X-Patchwork-Id: 1621792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WSX/WBoy; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kmzch5L9lz9s0r for ; Mon, 25 Apr 2022 19:05:23 +1000 (AEST) Received: from localhost ([::1]:39056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niuem-0000ub-Bx for incoming@patchwork.ozlabs.org; Mon, 25 Apr 2022 05:05:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0r-0007KX-3P for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:24:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niu0p-0002rL-32 for qemu-devel@nongnu.org; Mon, 25 Apr 2022 04:24:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650875042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s9HfXFFqm8XD3sd/B71lxNFxNbf5q88arJTDKzK7o3M=; b=WSX/WBoyT49aM7NxGWaYTwWRcCKJn0Hsu8VNQz3oFBcTox2mhtg/6l4INFWnNeaceXPAQB NQhBRU6Iu4DJ8f/KtvkG5hZTX9XyK8da7FA7hR4yJKdd3i78ulq7TN6ETE0QfBaYTQ6rRU In0QEOpnDjCKflcwK4W6gwUqiKvJ/zU= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-hED7U5QHNemqZWm8fXi9OA-1; Mon, 25 Apr 2022 04:22:08 -0400 X-MC-Unique: hED7U5QHNemqZWm8fXi9OA-1 Received: by mail-wm1-f69.google.com with SMTP id g13-20020a1c4e0d000000b0038eba16aa46so6862150wmh.7 for ; Mon, 25 Apr 2022 01:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s9HfXFFqm8XD3sd/B71lxNFxNbf5q88arJTDKzK7o3M=; b=CPM7/6+1AdlV9KdMDHW1/x5YxM0YC1nZmKoQFMZ97xT5pF2qmAqnC15nogF4Gierzg +BNpuPgjizVtQ8nBfY1AqeNN+LGWqI/I/EfNbReFhwIHOatebBYP86i0dbjgFNoezlDf cqNO4QiYok+TkGS4e9MEPhR+Pj2cjJQ3NaF13cG181Un9pyfe4BNlSPsuH4MUEXortIz si3W3E4NtU3EKValZp37qpFTLsEOh/yTpaJ8Mn+i1bxAUK4QAdVTU6XX8RDRBKWQUU5o QRmzZh+H3HwV9rjxlwwyCbNPxTePtAX8mdQqKZMowswcQRum+XK7N7dekNK9I4Z0i4VK CX0w== X-Gm-Message-State: AOAM530SQVp87RYT9Buj/hvCrDQn1rD1rXB2bepeQwoMQrt6oZVwWYo0 k+bvairX15e0iLPt2H17smam9T9CvNmPGN4zfiOBi6gcNQlS5hxadrAP2bLyhbbDPIHsW1GD2ig BhJn/MX/SSBSrmFA= X-Received: by 2002:a05:600c:500c:b0:392:b12f:40a with SMTP id n12-20020a05600c500c00b00392b12f040amr15318845wmr.122.1650874926858; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLFvk5nzTaC2g1M8XY2wI8/zxlrWzXYrheN/6UUX0J7RkRiN+T145v3db5tf+iW6dHFnb7Eg== X-Received: by 2002:a05:600c:500c:b0:392:b12f:40a with SMTP id n12-20020a05600c500c00b00392b12f040amr15318821wmr.122.1650874926684; Mon, 25 Apr 2022 01:22:06 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id d2-20020a056000186200b0020a7be3f1d2sm9949427wri.53.2022.04.25.01.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 01:22:05 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 9C2A067B1B67; Mon, 25 Apr 2022 10:22:02 +0200 (CEST) From: Martin Kletzander To: qemu-devel@nongnu.org Subject: [PATCH 18/18] audio/spiceaudio: Fail initialisation when not using spice Date: Mon, 25 Apr 2022 10:22:01 +0200 Message-Id: <5db1fdef0330f20ed6ae306b5a71dad1b5e9b44c.1650874791.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=mkletzan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , libvir-list@redhat.com, Christian Schoenebeck , Yanan Wang , Gerd Hoffmann , "Edgar E. Iglesias" , Qiuhao Li , =?utf-8?q?Herv=C3=A9_Poussineau?= , =?utf-8?q?Marc-An?= =?utf-8?q?dr=C3=A9_Lureau?= , Laurent Vivier , Thomas Huth , Alistair Francis , Alexander Bulekov , Bandan Das , qemu-arm@nongnu.org, Jan Kiszka , Pavel Dovgalyuk , Eduardo Habkost , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Darren Kenny , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- audio/spiceaudio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index a8d370fe6f31..fdbd7dc285ad 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; }