Skip to contentSkip to conversation

audio: deprecate -soundhw

PATCH Superseded Gerd Hoffmann 3 participants 19 messages Apr 29, 2020 – Apr 30, 2020

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover audio: deprecate -soundhw

Gerd Hoffmann (12):
stubs: add isa_create_simple
stubs: add pci_create_simple
audio: add deprecated_register_soundhw
audio: deprecate -soundhw ac97
audio: deprecate -soundhw es1370
audio: deprecate -soundhw adlib
audio: deprecate -soundhw cs4231a
audio: deprecate -soundhw gus
audio: deprecate -soundhw sb16
audio: deprecate -soundhw hda
audio: deprecate -soundhw pcspk
[RFC] audio: try use onboard audiodev for pcspk

 include/hw/audio/soundhw.h |  2 ++
 hw/audio/ac97.c            |  9 ++-------
 hw/audio/adlib.c           |  8 +-------
 hw/audio/cs4231a.c         |  8 +-------
 hw/audio/es1370.c          |  9 ++-------
 hw/audio/gus.c             |  8 +-------
 hw/audio/intel-hda.c       |  3 +++
 hw/audio/pcspk.c           | 27 ++++++++++++++++++++++++---
 hw/audio/sb16.c            |  9 ++-------
 hw/audio/soundhw.c         | 24 +++++++++++++++++++++++-
 qdev-monitor.c             |  2 ++
 stubs/isa-bus.c            |  7 +++++++
 stubs/pci-bus.c            |  7 +++++++
 stubs/Makefile.objs        |  2 ++
 14 files changed, 79 insertions(+), 46 deletions(-)
 create mode 100644 stubs/isa-bus.c
 create mode 100644 stubs/pci-bus.c
Signature · 1 line
2.18.2
#1 lore raw

PATCH 1/12 stubs: add isa_create_simple

Needed for -soundhw cleanup.

---
 stubs/isa-bus.c     | 7 +++++++
 stubs/Makefile.objs | 1 +
 2 files changed, 8 insertions(+)
 create mode 100644 stubs/isa-bus.c
stubs/isa-bus.c new file +7 -0
new file mode 100644
index 000000000000..cbebaed4ad04
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "hw/isa/isa.h"
+
+ISADevice *isa_create_simple(ISABus *bus, const char *name)
+{
+    return NULL;
+}
stubs/Makefile.objs +1 -0
index 45be5dc0ed78..c61ff38cc801 100644
@@ -13,6 +13,7 @@ stub-obj-y += get-vm-name.o
 stub-obj-y += iothread.o
 stub-obj-y += iothread-lock.o
 stub-obj-y += is-daemonized.o
+stub-obj-y += isa-bus.o
 stub-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
 stub-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o
 stub-obj-y += machine-init-done.o
Signature · 1 line
2.18.2
Reviewed-by Tested-by on v1 1/12
#2 lore raw

Re: [PATCH 01/12] stubs: add isa_create_simple

Quoted 15 lines · Gerd Hoffmann

Needed for -soundhw cleanup.

---
  stubs/isa-bus.c     | 7 +++++++
  stubs/Makefile.objs | 1 +
  2 files changed, 8 insertions(+)

create mode 100644 stubs/isa-bus.c

stubs/isa-bus.c new file +0 -0
new file mode 100644
index 000000000000..cbebaed4ad04

stubs/isa-bus.c line 6

Quoted 6 lines
stubs/isa-bus.c new file +6 -0
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "hw/isa/isa.h"
+
+ISADevice *isa_create_simple(ISABus *bus, const char *name)
+{
+    return NULL;

We want:

       g_assert_not_reached();

Otherwise:

Quoted 14 lines
stubs/isa-bus.c new file +1 -0
+}
stubs/Makefile.objs +1 -0
index 45be5dc0ed78..c61ff38cc801 100644
@@ -13,6 +13,7 @@ stub-obj-y += get-vm-name.o
  stub-obj-y += iothread.o
  stub-obj-y += iothread-lock.o
  stub-obj-y += is-daemonized.o
+stub-obj-y += isa-bus.o
  stub-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
  stub-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o
  stub-obj-y += machine-init-done.o
#3 lore raw

PATCH 2/12 stubs: add pci_create_simple

In reply to Gerd Hoffmann

Needed for -soundhw cleanup.

---
 stubs/pci-bus.c     | 7 +++++++
 stubs/Makefile.objs | 1 +
 2 files changed, 8 insertions(+)
 create mode 100644 stubs/pci-bus.c
stubs/pci-bus.c new file +7 -0
new file mode 100644
index 000000000000..e833947f1f41
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "hw/pci/pci.h"
+
+PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
+{
+    return NULL;
+}
stubs/Makefile.objs +1 -0
index c61ff38cc801..5e7f2b3f061e 100644
@@ -40,6 +40,7 @@ stub-obj-y += target-get-monitor-def.o
 stub-obj-y += vmgenid.o
 stub-obj-y += xen-common.o
 stub-obj-y += xen-hvm.o
+stub-obj-y += pci-bus.o
 stub-obj-y += pci-host-piix.o
 stub-obj-y += ram-block.o
 stub-obj-y += ramfb.o
Signature · 1 line
2.18.2
Reviewed-by Tested-by on v1 2/12
#4 lore raw

Re: [PATCH 02/12] stubs: add pci_create_simple

Quoted 15 lines · Gerd Hoffmann

Needed for -soundhw cleanup.

---
  stubs/pci-bus.c     | 7 +++++++
  stubs/Makefile.objs | 1 +
  2 files changed, 8 insertions(+)

create mode 100644 stubs/pci-bus.c

stubs/pci-bus.c new file +0 -0
new file mode 100644
index 000000000000..e833947f1f41

stubs/pci-bus.c line 6

Quoted 6 lines
stubs/pci-bus.c new file +6 -0
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "hw/pci/pci.h"
+
+PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
+{
+    return NULL;

We want:

       g_assert_not_reached();

Otherwise:

Quoted 14 lines
stubs/pci-bus.c new file +1 -0
+}
stubs/Makefile.objs +1 -0
index c61ff38cc801..5e7f2b3f061e 100644
@@ -40,6 +40,7 @@ stub-obj-y += target-get-monitor-def.o
  stub-obj-y += vmgenid.o
  stub-obj-y += xen-common.o
  stub-obj-y += xen-hvm.o
+stub-obj-y += pci-bus.o
  stub-obj-y += pci-host-piix.o
  stub-obj-y += ram-block.o
  stub-obj-y += ramfb.o
#5 lore raw

PATCH 3/12 audio: add deprecated_register_soundhw

In reply to Gerd Hoffmann

Add helper function for -soundhw deprecation. It can replace the simple init functions which just call {isa,pci}_create_simple() with a hardcoded type. It also prints a deprecation message.

---
 include/hw/audio/soundhw.h |  2 ++
 hw/audio/soundhw.c         | 24 +++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
include/hw/audio/soundhw.h +2 -0
index c8eef8241846..f09a297854af 100644
@@ -6,6 +6,8 @@ void isa_register_soundhw(const char *name, const char *descr,
 
 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);
hw/audio/soundhw.c +23 -1
index c750473c8f0c..173b674ff53a 100644
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu/option.h"
 #include "qemu/help_option.h"
 #include "qemu/error-report.h"
 #include "qom/object.h"
@@ -32,6 +33,7 @@
 struct soundhw {
     const char *name;
     const char *descr;
+    const char *typename;
     int enabled;
     int isa;
     union {
@@ -65,6 +67,17 @@ void pci_register_soundhw(const char *name, const char *descr,
     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;
@@ -136,7 +149,16 @@ void soundhw_init(void)
 
     for (c = soundhw; c->name; ++c) {
         if (c->enabled) {
-            if (c->isa) {
+            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);
Signature · 1 line
2.18.2
#6 lore raw

PATCH 4/12 audio: deprecate -soundhw ac97

In reply to Gerd Hoffmann

Switch to deprecated_register_soundhw(). Remove the now obsolete init function. Add an alias so both ac97 and AC97 are working with -device.

---
 hw/audio/ac97.c | 9 ++-------
 qdev-monitor.c  | 1 +
 2 files changed, 3 insertions(+), 7 deletions(-)
hw/audio/ac97.c +2 -7
index 1ec87feec0cb..f32eb46f7f4d 100644
@@ -1395,12 +1395,6 @@ static void ac97_exit(PCIDevice *dev)
     AUD_remove_card(&s->card);
 }
 
-static int ac97_init (PCIBus *bus)
-{
-    pci_create_simple(bus, -1, TYPE_AC97);
-    return 0;
-}
-
 static Property ac97_properties[] = {
     DEFINE_AUDIO_PROPERTIES(AC97LinkState, card),
     DEFINE_PROP_END_OF_LIST (),
@@ -1438,7 +1432,8 @@ static const TypeInfo ac97_info = {
 static void ac97_register_types (void)
 {
     type_register_static (&ac97_info);
-    pci_register_soundhw("ac97", "Intel 82801AA AC97 Audio", ac97_init);
+    deprecated_register_soundhw("ac97", "Intel 82801AA AC97 Audio",
+                                0, TYPE_AC97);
 }
 
 type_init (ac97_register_types)
qdev-monitor.c +1 -0
index 9833b3354969..ce45bcfa03f3 100644
@@ -52,6 +52,7 @@ typedef struct QDevAlias
 
 /* Please keep this table sorted by typename. */
 static const QDevAlias qdev_alias_table[] = {
+    { "AC97", "ac97" }, /* -soundhw name */
     { "e1000", "e1000-82540em" },
     { "ich9-ahci", "ahci" },
     { "lsi53c895a", "lsi" },
Signature · 1 line
2.18.2
#7 lore raw

PATCH 5/12 audio: deprecate -soundhw es1370

In reply to Gerd Hoffmann

Switch to deprecated_register_soundhw(). Remove the now obsolete init function. Add an alias so both es1370 and ES1370 are working with -device.

---
 hw/audio/es1370.c | 9 ++-------
 qdev-monitor.c    | 1 +
 2 files changed, 3 insertions(+), 7 deletions(-)
hw/audio/es1370.c +2 -7
index 89c4dabcd44f..f36ed95ac93f 100644
@@ -881,12 +881,6 @@ static void es1370_exit(PCIDevice *dev)
     AUD_remove_card(&s->card);
 }
 
-static int es1370_init (PCIBus *bus)
-{
-    pci_create_simple (bus, -1, TYPE_ES1370);
-    return 0;
-}
-
 static Property es1370_properties[] = {
     DEFINE_AUDIO_PROPERTIES(ES1370State, card),
     DEFINE_PROP_END_OF_LIST(),
@@ -925,7 +919,8 @@ static const TypeInfo es1370_info = {
 static void es1370_register_types (void)
 {
     type_register_static (&es1370_info);
-    pci_register_soundhw("es1370", "ENSONIQ AudioPCI ES1370", es1370_init);
+    deprecated_register_soundhw("es1370", "ENSONIQ AudioPCI ES1370",
+                                0, TYPE_ES1370);
 }
 
 type_init (es1370_register_types)
qdev-monitor.c +1 -0
index ce45bcfa03f3..f841821f3aa6 100644
@@ -54,6 +54,7 @@ typedef struct QDevAlias
 static const QDevAlias qdev_alias_table[] = {
     { "AC97", "ac97" }, /* -soundhw name */
     { "e1000", "e1000-82540em" },
+    { "ES1370", "es1370" }, /* -soundhw name */
     { "ich9-ahci", "ahci" },
     { "lsi53c895a", "lsi" },
     { "virtio-9p-ccw", "virtio-9p", QEMU_ARCH_S390X },
Signature · 1 line
2.18.2
#8 lore raw

PATCH 6/12 audio: deprecate -soundhw adlib

In reply to Gerd Hoffmann

Switch to deprecated_register_soundhw().
Remove the now obsolete init function.

---
 hw/audio/adlib.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
hw/audio/adlib.c +1 -7
index d6c1fb0586c6..f62fbd413169 100644
@@ -322,16 +322,10 @@ static const TypeInfo adlib_info = {
     .class_init    = adlib_class_initfn,
 };
 
-static int Adlib_init (ISABus *bus)
-{
-    isa_create_simple (bus, TYPE_ADLIB);
-    return 0;
-}
-
 static void adlib_register_types (void)
 {
     type_register_static (&adlib_info);
-    isa_register_soundhw("adlib", ADLIB_DESC, Adlib_init);
+    deprecated_register_soundhw("adlib", ADLIB_DESC, 1, TYPE_ADLIB);
 }
 
 type_init (adlib_register_types)
Signature · 1 line
2.18.2
#9 lore raw

PATCH 7/12 audio: deprecate -soundhw cs4231a

In reply to Gerd Hoffmann

Switch to deprecated_register_soundhw().
Remove the now obsolete init function.

---
 hw/audio/cs4231a.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
hw/audio/cs4231a.c +1 -7
index ffdbb58d6a11..59705a8d4701 100644
@@ -683,12 +683,6 @@ static void cs4231a_realizefn (DeviceState *dev, Error **errp)
     AUD_register_card ("cs4231a", &s->card);
 }
 
-static int cs4231a_init (ISABus *bus)
-{
-    isa_create_simple (bus, TYPE_CS4231A);
-    return 0;
-}
-
 static Property cs4231a_properties[] = {
     DEFINE_AUDIO_PROPERTIES(CSState, card),
     DEFINE_PROP_UINT32 ("iobase",  CSState, port, 0x534),
@@ -720,7 +714,7 @@ static const TypeInfo cs4231a_info = {
 static void cs4231a_register_types (void)
 {
     type_register_static (&cs4231a_info);
-    isa_register_soundhw("cs4231a", "CS4231A", cs4231a_init);
+    deprecated_register_soundhw("cs4231a", "CS4231A", 1, TYPE_CS4231A);
 }
 
 type_init (cs4231a_register_types)
Signature · 1 line
2.18.2
#10 lore raw

PATCH 8/12 audio: deprecate -soundhw gus

In reply to Gerd Hoffmann

Switch to deprecated_register_soundhw().
Remove the now obsolete init function.

---
 hw/audio/gus.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
hw/audio/gus.c +1 -7
index eb4a803fb53b..61d16fad9ffb 100644
@@ -292,12 +292,6 @@ static void gus_realizefn (DeviceState *dev, Error **errp)
     AUD_set_active_out (s->voice, 1);
 }
 
-static int GUS_init (ISABus *bus)
-{
-    isa_create_simple (bus, TYPE_GUS);
-    return 0;
-}
-
 static Property gus_properties[] = {
     DEFINE_AUDIO_PROPERTIES(GUSState, card),
     DEFINE_PROP_UINT32 ("freq",    GUSState, freq,        44100),
@@ -328,7 +322,7 @@ static const TypeInfo gus_info = {
 static void gus_register_types (void)
 {
     type_register_static (&gus_info);
-    isa_register_soundhw("gus", "Gravis Ultrasound GF1", GUS_init);
+    deprecated_register_soundhw("gus", "Gravis Ultrasound GF1", 1, TYPE_GUS);
 }
 
 type_init (gus_register_types)
Signature · 1 line
2.18.2
#11 lore raw
In reply to Gerd Hoffmann
Quoted 6 lines · Gerd Hoffmann
 include/hw/audio/soundhw.h |  2 ++
 hw/audio/ac97.c            |  9 ++-------
 hw/audio/adlib.c           |  8 +-------
 hw/audio/cs4231a.c         |  8 +-------
 hw/audio/es1370.c          |  9 ++-------
 hw/audio/gus.c             |  8 +-------
Quoted 8 lines
 hw/audio/intel-hda.c       |  3 +++
 hw/audio/pcspk.c           | 27 ++++++++++++++++++++++++---
 hw/audio/sb16.c            |  9 ++-------
 hw/audio/soundhw.c         | 24 +++++++++++++++++++++++-
 qdev-monitor.c             |  2 ++
 stubs/isa-bus.c            |  7 +++++++
 stubs/pci-bus.c            |  7 +++++++
 stubs/Makefile.objs        |  2 ++

There should also be an addition to docs/system/deprecated.rst to point users to the suggested replacement syntax.

Regards,
Daniel

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

PATCH 9/12 audio: deprecate -soundhw sb16

In reply to Gerd Hoffmann

Switch to deprecated_register_soundhw().
Remove the now obsolete init function.

---
 hw/audio/sb16.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
hw/audio/sb16.c +2 -7
index df6f755a37f8..2d9e50f99b5d 100644
@@ -1415,12 +1415,6 @@ static void sb16_realizefn (DeviceState *dev, Error **errp)
     AUD_register_card ("sb16", &s->card);
 }
 
-static int SB16_init (ISABus *bus)
-{
-    isa_create_simple (bus, TYPE_SB16);
-    return 0;
-}
-
 static Property sb16_properties[] = {
     DEFINE_AUDIO_PROPERTIES(SB16State, card),
     DEFINE_PROP_UINT32 ("version", SB16State, ver,  0x0405), /* 4.5 */
@@ -1453,7 +1447,8 @@ static const TypeInfo sb16_info = {
 static void sb16_register_types (void)
 {
     type_register_static (&sb16_info);
-    isa_register_soundhw("sb16", "Creative Sound Blaster 16", SB16_init);
+    deprecated_register_soundhw("sb16", "Creative Sound Blaster 16",
+                                1, TYPE_SB16);
 }
 
 type_init (sb16_register_types)
Signature · 1 line
2.18.2
#13 lore raw

PATCH 10/12 audio: deprecate -soundhw hda

In reply to Gerd Hoffmann

Add deprecation message to the audio init function.

---
 hw/audio/intel-hda.c | 3 +++
 1 file changed, 3 insertions(+)
hw/audio/intel-hda.c +3 -0
index e8d18b7c5887..df4f13157d44 100644
@@ -25,6 +25,7 @@
 #include "qemu/bitops.h"
 #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"
@@ -1307,6 +1308,8 @@ static int intel_hda_and_codec_init(PCIBus *bus)
     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_create(hdabus, "hda-duplex");
Signature · 1 line
2.18.2
#14 lore raw

PATCH 11/12 audio: deprecate -soundhw pcspk

In reply to Gerd Hoffmann

Add deprecation message to the audio init function.

Factor out audio initialization and call that from both audio init and realize, so setting audiodev via -global is enough to properly initialize pcspk.

---
 hw/audio/pcspk.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
hw/audio/pcspk.c +21 -3
index 29dc00bf8dc7..72e7234d5f65 100644
@@ -28,6 +28,7 @@
 #include "audio/audio.h"
 #include "qemu/module.h"
 #include "qemu/timer.h"
+#include "qemu/error-report.h"
 #include "hw/timer/i8254.h"
 #include "migration/vmstate.h"
 #include "hw/audio/pcspk.h"
@@ -112,11 +113,15 @@ static void pcspk_callback(void *opaque, int free)
     }
 }
 
-static int pcspk_audio_init(ISABus *bus)
+static int pcspk_audio_init(PCSpkState *s)
 {
-    PCSpkState *s = pcspk_state;
     struct audsettings as = {PCSPK_SAMPLE_RATE, 1, AUDIO_FORMAT_U8, 0};
 
+    if (s->voice) {
+        /* already initialized */
+        return 0;
+    }
+
     AUD_register_card(s_spk, &s->card);
 
     s->voice = AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback, &as);
@@ -185,6 +190,10 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
 
     isa_register_ioport(isadev, &s->ioport, s->iobase);
 
+    if (s->card.state) {
+        pcspk_audio_init(s);
+    }
+
     pcspk_state = s;
 }
 
@@ -236,9 +245,18 @@ 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 '-global isa-pcspk.audiodev=<name>' 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);
+    isa_register_soundhw("pcspk", "PC speaker", pcspk_audio_init_soundhw);
 }
 type_init(pcspk_register)
Signature · 1 line
2.18.2
#15 lore raw

RFC PATCH 12/12 audio: try use onboard audiodev for pcspk

In reply to Gerd Hoffmann

New naming convention: Use "onboard" audiodev for onboard audio devices.

This patchs implements it for pcspk. If we want go this route we should do the same for other onboard audio devices too (arm boards, ...).

---
 hw/audio/pcspk.c | 3 +++
 1 file changed, 3 insertions(+)
hw/audio/pcspk.c +3 -0
index 72e7234d5f65..102cac21b3be 100644
@@ -190,6 +190,9 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
 
     isa_register_ioport(isadev, &s->ioport, s->iobase);
 
+    if (!s->card.state) {
+        s->card.state = audio_state_by_name("onboard");
+    }
     if (s->card.state) {
         pcspk_audio_init(s);
     }
Signature · 1 line
2.18.2
#16 lore raw
In reply to Gerd Hoffmann

Hi Gerd,

Quoted 15 lines · Gerd Hoffmann

Gerd Hoffmann (12):
stubs: add isa_create_simple
stubs: add pci_create_simple
audio: add deprecated_register_soundhw
audio: deprecate -soundhw ac97
audio: deprecate -soundhw es1370
audio: deprecate -soundhw adlib
audio: deprecate -soundhw cs4231a
audio: deprecate -soundhw gus
audio: deprecate -soundhw sb16
audio: deprecate -soundhw hda
audio: deprecate -soundhw pcspk
[RFC] audio: try use onboard audiodev for pcspk

I don't understand what you are trying to fix with this series.

I suppose there is a problem with the pcspk, as I had a problem when I tried to make the soundhw more QOM-friendly. pcspk needs rethink and some work so I didn't finished. Also I had a problem with intel-hda. I see in your series both are handled differently. I'll send the patch with the broken code marked XXX, maybe you can it figure out.

Quoted 19 lines
  include/hw/audio/soundhw.h |  2 ++
  hw/audio/ac97.c            |  9 ++-------
  hw/audio/adlib.c           |  8 +-------
  hw/audio/cs4231a.c         |  8 +-------
  hw/audio/es1370.c          |  9 ++-------
  hw/audio/gus.c             |  8 +-------
  hw/audio/intel-hda.c       |  3 +++
  hw/audio/pcspk.c           | 27 ++++++++++++++++++++++++---
  hw/audio/sb16.c            |  9 ++-------
  hw/audio/soundhw.c         | 24 +++++++++++++++++++++++-
  qdev-monitor.c             |  2 ++
  stubs/isa-bus.c            |  7 +++++++
  stubs/pci-bus.c            |  7 +++++++
  stubs/Makefile.objs        |  2 ++
  14 files changed, 79 insertions(+), 46 deletions(-)

create mode 100644 stubs/isa-bus.c
create mode 100644 stubs/pci-bus.c

#17 lore raw
Quoted 19 lines · Philippe Mathieu-Daudé

Hi Gerd,

Quoted 15 lines · Gerd Hoffmann

Gerd Hoffmann (12):
stubs: add isa_create_simple
stubs: add pci_create_simple
audio: add deprecated_register_soundhw
audio: deprecate -soundhw ac97
audio: deprecate -soundhw es1370
audio: deprecate -soundhw adlib
audio: deprecate -soundhw cs4231a
audio: deprecate -soundhw gus
audio: deprecate -soundhw sb16
audio: deprecate -soundhw hda
audio: deprecate -soundhw pcspk
[RFC] audio: try use onboard audiodev for pcspk

Quoted 1 line

I don't understand what you are trying to fix with this series.

Almost nothing. I'm just deprecating -soundhw, and I don't feel like putting too much effort into code which I want remove anyway.

The new deprecated_register_soundhw() is there to allow removing the init callback for most hardware and have common code handle the simple cases. Alternatively I could leave things as-is and just copy&paste the deprecation warning into each init callback.

The only functional change (beside the added deprecation warnings) is that the pcspk realize function initializes audio in case audiodev is set, so "-global isa-pcspk.audiodev=<something>" is enough to activate the speaker. The need to also have "-soundhw pcspk" on the command line is gone.

Quoted 2 lines

I suppose there is a problem with the pcspk, as I had a problem when I tried to make the soundhw more QOM-friendly.

I see your patch adds a deprecation warning for -soundhw too. I'm wondering why you want convert this to QOM now just to throw away the code in a few months?

cheers,
Gerd

#18 lore raw
Quoted 36 lines · Gerd Hoffmann
Quoted 19 lines · Philippe Mathieu-Daudé

Hi Gerd,

Quoted 15 lines · Gerd Hoffmann

Gerd Hoffmann (12):
stubs: add isa_create_simple
stubs: add pci_create_simple
audio: add deprecated_register_soundhw
audio: deprecate -soundhw ac97
audio: deprecate -soundhw es1370
audio: deprecate -soundhw adlib
audio: deprecate -soundhw cs4231a
audio: deprecate -soundhw gus
audio: deprecate -soundhw sb16
audio: deprecate -soundhw hda
audio: deprecate -soundhw pcspk
[RFC] audio: try use onboard audiodev for pcspk

Quoted 1 line

I don't understand what you are trying to fix with this series.

Almost nothing. I'm just deprecating -soundhw, and I don't feel like putting too much effort into code which I want remove anyway.

The new deprecated_register_soundhw() is there to allow removing the init callback for most hardware and have common code handle the simple cases. Alternatively I could leave things as-is and just copy&paste the deprecation warning into each init callback.

The only functional change (beside the added deprecation warnings) is that the pcspk realize function initializes audio in case audiodev is set, so "-global isa-pcspk.audiodev=<something>" is enough to activate the speaker. The need to also have "-soundhw pcspk" on the command line is gone.

Quoted 6 lines
Quoted 2 lines

I suppose there is a problem with the pcspk, as I had a problem when I tried to make the soundhw more QOM-friendly.

I see your patch adds a deprecation warning for -soundhw too. I'm wondering why you want convert this to QOM now just to throw away the code in a few months?

Well I didn't know you planed to throw them away. I started looking at the hw/audio/ files for the Arduino GSoC project because we want the ADC to sample data from a stream of floats (then opposite with PWM). Using .wav file seemed to make things simpler, then I noticed the AUD API. Then I started to have a cleaner producer/consumer API (i.e. the 8042 PIT is a dsp stream producer, the pcspkr is a dsp stream consumer). To to that it was simpler to implement the producer/consumer interface split with the QOM API. The you know the NeverEnding Story... The -soundhw cleanup was part of it, as it was simple/contained I extracted it.

Quoted 4 lines

cheers,
Gerd