qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] hw/audio: Remove legacy code related to '-soundhw hda'
@ 2025-10-21 13:18 Philippe Mathieu-Daudé
  2025-10-21 13:18 ` [PATCH 1/3] docs: Update mentions of removed '-soundhw' command line option Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21 13:18 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel
  Cc: Gerd Hoffmann, Paolo Bonzini, Eduardo Habkost,
	Daniel P. Berrangé, Philippe Mathieu-Daudé

Few more patches following Marc-André cleanups, allowing
to remove audio_register_model_with_cb().

Based-on: <20251021090317.425409-1-marcandre.lureau@redhat.com>

Philippe Mathieu-Daudé (3):
  docs: Update mentions of removed '-soundhw' command line option
  hw/audio: Remove intel_hda_and_codec_init()
  hw/audio: Remove unused audio_register_model_with_cb()

 docs/qdev-device-use.txt |  4 ++--
 include/hw/audio/model.h |  2 --
 hw/audio/intel-hda.c     | 23 -----------------------
 hw/audio/model.c         | 26 +++++++-------------------
 system/qdev-monitor.c    |  4 ++--
 5 files changed, 11 insertions(+), 48 deletions(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] docs: Update mentions of removed '-soundhw' command line option
  2025-10-21 13:18 [PATCH 0/3] hw/audio: Remove legacy code related to '-soundhw hda' Philippe Mathieu-Daudé
@ 2025-10-21 13:18 ` Philippe Mathieu-Daudé
  2025-10-21 13:26   ` Marc-André Lureau
  2025-10-21 13:18 ` [PATCH 2/3] hw/audio: Remove intel_hda_and_codec_init() Philippe Mathieu-Daudé
  2025-10-21 13:18 ` [PATCH 3/3] hw/audio: Remove unused audio_register_model_with_cb() Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21 13:18 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel
  Cc: Gerd Hoffmann, Paolo Bonzini, Eduardo Habkost,
	Daniel P. Berrangé, Philippe Mathieu-Daudé

The `-soundhw` CLI was removed in commit 039a68373c4 ("introduce
-audio as a replacement for -soundhw"). Remove outdated comments
and update the document mentioning the old usage.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 docs/qdev-device-use.txt | 4 ++--
 system/qdev-monitor.c    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt
index 043ae461140..fb420da2a9e 100644
--- a/docs/qdev-device-use.txt
+++ b/docs/qdev-device-use.txt
@@ -311,9 +311,9 @@ constraints.
 
 Host and guest part of audio devices have always been separate.
 
-The old way to define guest audio devices is -soundhw C1,...
+The old way to define guest audio devices was -soundhw C1,...
 
-The new way is to define each guest audio device separately with
+The current way is to define each guest audio device separately with
 -device.
 
 Map from -soundhw sound card name to -device:
diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index 4b732f579ad..5c95926aadd 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -73,9 +73,9 @@ typedef struct QDevAlias
 
 /* Please keep this table sorted by typename. */
 static const QDevAlias qdev_alias_table[] = {
-    { "AC97", "ac97" }, /* -soundhw name */
+    { "AC97", "ac97" },
     { "e1000", "e1000-82540em" },
-    { "ES1370", "es1370" }, /* -soundhw name */
+    { "ES1370", "es1370" },
     { "ich9-ahci", "ahci" },
     { "lsi53c895a", "lsi" },
     { "virtio-9p-device", "virtio-9p", QEMU_ARCH_VIRTIO_MMIO },
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] hw/audio: Remove intel_hda_and_codec_init()
  2025-10-21 13:18 [PATCH 0/3] hw/audio: Remove legacy code related to '-soundhw hda' Philippe Mathieu-Daudé
  2025-10-21 13:18 ` [PATCH 1/3] docs: Update mentions of removed '-soundhw' command line option Philippe Mathieu-Daudé
@ 2025-10-21 13:18 ` Philippe Mathieu-Daudé
  2025-10-21 13:24   ` Marc-André Lureau
  2025-10-21 13:18 ` [PATCH 3/3] hw/audio: Remove unused audio_register_model_with_cb() Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21 13:18 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel
  Cc: Gerd Hoffmann, Paolo Bonzini, Eduardo Habkost,
	Daniel P. Berrangé, Philippe Mathieu-Daudé

`-soundhw hda` was removed in commit 039a68373c4 ("introduce -audio
as a replacement for -soundhw").

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/audio/intel-hda.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index 0d35afa4ab4..83bb7e597db 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -1301,28 +1301,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(const char *audiodev)
-{
-    g_autoptr(QDict) props = qdict_new();
-    DeviceState *intel_hda, *codec;
-    BusState *hdabus;
-
-    qdict_put_str(props, "driver", "intel-hda");
-    intel_hda = qdev_device_add_from_qdict(props, false, &error_fatal);
-    hdabus = QLIST_FIRST(&intel_hda->child_bus);
-
-    codec = qdev_new("hda-duplex");
-    qdev_prop_set_string(codec, "audiodev", audiodev);
-    qdev_realize_and_unref(codec, hdabus, &error_fatal);
-    object_unref(intel_hda);
-
-    return 0;
-}
-
 static void intel_hda_register_types(void)
 {
     type_register_static(&hda_codec_bus_info);
@@ -1330,7 +1308,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);
-    audio_register_model_with_cb("hda", "Intel HD Audio", intel_hda_and_codec_init);
 }
 
 type_init(intel_hda_register_types)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] hw/audio: Remove unused audio_register_model_with_cb()
  2025-10-21 13:18 [PATCH 0/3] hw/audio: Remove legacy code related to '-soundhw hda' Philippe Mathieu-Daudé
  2025-10-21 13:18 ` [PATCH 1/3] docs: Update mentions of removed '-soundhw' command line option Philippe Mathieu-Daudé
  2025-10-21 13:18 ` [PATCH 2/3] hw/audio: Remove intel_hda_and_codec_init() Philippe Mathieu-Daudé
@ 2025-10-21 13:18 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21 13:18 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel
  Cc: Gerd Hoffmann, Paolo Bonzini, Eduardo Habkost,
	Daniel P. Berrangé, Philippe Mathieu-Daudé

We remove the last use of audio_register_model_with_cb(),
remove it as not needed anymore, simplifying audio_model_init().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/audio/model.h |  2 --
 hw/audio/model.c         | 26 +++++++-------------------
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/include/hw/audio/model.h b/include/hw/audio/model.h
index ebe456c22ff..b812c9211a0 100644
--- a/include/hw/audio/model.h
+++ b/include/hw/audio/model.h
@@ -1,8 +1,6 @@
 #ifndef HW_AUDIO_MODEL_H
 #define HW_AUDIO_MODEL_H
 
-void audio_register_model_with_cb(const char *name, const char *descr,
-                                  int (*init_audio_model)(const char *audiodev));
 void audio_register_model(const char *name, const char *descr,
                           const char *typename);
 
diff --git a/hw/audio/model.c b/hw/audio/model.c
index 924a41e0ac9..d1e00b4eaa4 100644
--- a/hw/audio/model.c
+++ b/hw/audio/model.c
@@ -34,22 +34,11 @@ struct audio_model {
     const char *name;
     const char *descr;
     const char *typename;
-    int (*init)(const char *audiodev);
 };
 
 static struct audio_model audio_models[9];
 static int audio_models_count;
 
-void audio_register_model_with_cb(const char *name, const char *descr,
-                                  int (*init_audio_model)(const char *audiodev))
-{
-    assert(audio_models_count < ARRAY_SIZE(audio_models) - 1);
-    audio_models[audio_models_count].name = name;
-    audio_models[audio_models_count].descr = descr;
-    audio_models[audio_models_count].init = init_audio_model;
-    audio_models_count++;
-}
-
 void audio_register_model(const char *name, const char *descr,
                           const char *typename)
 {
@@ -105,17 +94,16 @@ void audio_set_model(const char *name, const char *audiodev)
 void audio_model_init(void)
 {
     struct audio_model *c = selected;
+    DeviceState *dev;
+    BusState *bus;
 
     if (!c) {
         return;
     }
 
-    if (c->typename) {
-        DeviceState *dev = qdev_new(c->typename);
-        BusState *bus = qdev_find_default_bus(DEVICE_GET_CLASS(dev), &error_fatal);
-        qdev_prop_set_string(dev, "audiodev", audiodev_id);
-        qdev_realize_and_unref(dev, bus, &error_fatal);
-    } else {
-        c->init(audiodev_id);
-    }
+    g_assert(c->typename);
+    dev = qdev_new(c->typename);
+    bus = qdev_find_default_bus(DEVICE_GET_CLASS(dev), &error_fatal);
+    qdev_prop_set_string(dev, "audiodev", audiodev_id);
+    qdev_realize_and_unref(dev, bus, &error_fatal);
 }
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] hw/audio: Remove intel_hda_and_codec_init()
  2025-10-21 13:18 ` [PATCH 2/3] hw/audio: Remove intel_hda_and_codec_init() Philippe Mathieu-Daudé
@ 2025-10-21 13:24   ` Marc-André Lureau
  2025-10-21 14:17     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: Marc-André Lureau @ 2025-10-21 13:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Gerd Hoffmann, Paolo Bonzini, Eduardo Habkost,
	Daniel P. Berrangé

[-- Attachment #1: Type: text/plain, Size: 1957 bytes --]

Hi

On Tue, Oct 21, 2025 at 5:18 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> `-soundhw hda` was removed in commit 039a68373c4 ("introduce -audio
> as a replacement for -soundhw").
>
>
Sorry, that "hda" (= intel-hda + hda-duplex) short form is used by -audio.


> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/audio/intel-hda.c | 23 -----------------------
>  1 file changed, 23 deletions(-)
>
> diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
> index 0d35afa4ab4..83bb7e597db 100644
> --- a/hw/audio/intel-hda.c
> +++ b/hw/audio/intel-hda.c
> @@ -1301,28 +1301,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(const char *audiodev)
> -{
> -    g_autoptr(QDict) props = qdict_new();
> -    DeviceState *intel_hda, *codec;
> -    BusState *hdabus;
> -
> -    qdict_put_str(props, "driver", "intel-hda");
> -    intel_hda = qdev_device_add_from_qdict(props, false, &error_fatal);
> -    hdabus = QLIST_FIRST(&intel_hda->child_bus);
> -
> -    codec = qdev_new("hda-duplex");
> -    qdev_prop_set_string(codec, "audiodev", audiodev);
> -    qdev_realize_and_unref(codec, hdabus, &error_fatal);
> -    object_unref(intel_hda);
> -
> -    return 0;
> -}
> -
>  static void intel_hda_register_types(void)
>  {
>      type_register_static(&hda_codec_bus_info);
> @@ -1330,7 +1308,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);
> -    audio_register_model_with_cb("hda", "Intel HD Audio",
> intel_hda_and_codec_init);
>  }
>
>  type_init(intel_hda_register_types)
> --
> 2.51.0
>
>

[-- Attachment #2: Type: text/html, Size: 2768 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] docs: Update mentions of removed '-soundhw' command line option
  2025-10-21 13:18 ` [PATCH 1/3] docs: Update mentions of removed '-soundhw' command line option Philippe Mathieu-Daudé
@ 2025-10-21 13:26   ` Marc-André Lureau
  0 siblings, 0 replies; 7+ messages in thread
From: Marc-André Lureau @ 2025-10-21 13:26 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Gerd Hoffmann, Paolo Bonzini, Eduardo Habkost,
	Daniel P. Berrangé

[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]

Hi

On Tue, Oct 21, 2025 at 5:18 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> The `-soundhw` CLI was removed in commit 039a68373c4 ("introduce
> -audio as a replacement for -soundhw"). Remove outdated comments
> and update the document mentioning the old usage.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
I'll take it in my v2.


> ---
>  docs/qdev-device-use.txt | 4 ++--
>  system/qdev-monitor.c    | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt
> index 043ae461140..fb420da2a9e 100644
> --- a/docs/qdev-device-use.txt
> +++ b/docs/qdev-device-use.txt
> @@ -311,9 +311,9 @@ constraints.
>
>  Host and guest part of audio devices have always been separate.
>
> -The old way to define guest audio devices is -soundhw C1,...
> +The old way to define guest audio devices was -soundhw C1,...
>
> -The new way is to define each guest audio device separately with
> +The current way is to define each guest audio device separately with
>  -device.
>
>  Map from -soundhw sound card name to -device:
> diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
> index 4b732f579ad..5c95926aadd 100644
> --- a/system/qdev-monitor.c
> +++ b/system/qdev-monitor.c
> @@ -73,9 +73,9 @@ typedef struct QDevAlias
>
>  /* Please keep this table sorted by typename. */
>  static const QDevAlias qdev_alias_table[] = {
> -    { "AC97", "ac97" }, /* -soundhw name */
> +    { "AC97", "ac97" },
>      { "e1000", "e1000-82540em" },
> -    { "ES1370", "es1370" }, /* -soundhw name */
> +    { "ES1370", "es1370" },
>      { "ich9-ahci", "ahci" },
>      { "lsi53c895a", "lsi" },
>      { "virtio-9p-device", "virtio-9p", QEMU_ARCH_VIRTIO_MMIO },
> --
> 2.51.0
>
>

[-- Attachment #2: Type: text/html, Size: 2786 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] hw/audio: Remove intel_hda_and_codec_init()
  2025-10-21 13:24   ` Marc-André Lureau
@ 2025-10-21 14:17     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-21 14:17 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: qemu-devel, Gerd Hoffmann, Paolo Bonzini, Eduardo Habkost,
	Daniel P. Berrangé

On 21/10/25 15:24, Marc-André Lureau wrote:
> Hi
> 
> On Tue, Oct 21, 2025 at 5:18 PM Philippe Mathieu-Daudé 
> <philmd@linaro.org <mailto:philmd@linaro.org>> wrote:
> 
>     `-soundhw hda` was removed in commit 039a68373c4 ("introduce -audio
>     as a replacement for -soundhw").
> 
> 
> Sorry, that "hda" (= intel-hda + hda-duplex) short form is used by -audio.

Yes, it was deprecated for 2 releases but we missed to remove it
in commit 039a68373c4:

-- >8 --
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index bc77e3d8c9d..f38117057b9 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -1311,17 +1311,16 @@ static const TypeInfo hda_codec_device_type_info = {
   * create intel hda controller with codec attached to it,
   * so '-soundhw hda' works.
   */
-static int intel_hda_and_codec_init(PCIBus *bus)
+static int intel_hda_and_codec_init(PCIBus *bus, const char *audiodev)
  {
      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_prop_set_string(codec, "audiodev", audiodev);
      qdev_realize_and_unref(codec, hdabus, &error_fatal);
      return 0;
  }
---

Users should be now using "-device intel-hda -device hda-duplex"
instead of "-audio hda".


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-10-21 14:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21 13:18 [PATCH 0/3] hw/audio: Remove legacy code related to '-soundhw hda' Philippe Mathieu-Daudé
2025-10-21 13:18 ` [PATCH 1/3] docs: Update mentions of removed '-soundhw' command line option Philippe Mathieu-Daudé
2025-10-21 13:26   ` Marc-André Lureau
2025-10-21 13:18 ` [PATCH 2/3] hw/audio: Remove intel_hda_and_codec_init() Philippe Mathieu-Daudé
2025-10-21 13:24   ` Marc-André Lureau
2025-10-21 14:17     ` Philippe Mathieu-Daudé
2025-10-21 13:18 ` [PATCH 3/3] hw/audio: Remove unused audio_register_model_with_cb() Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).