Skip to contentSkip to conversation

make audio card configuration uniform

PATCH Applied Paolo Bonzini 5 participants 17 messages Apr 18, 2013 – Apr 30, 2013

lore
Share & tools
lore
#0 lore raw

cover make audio card configuration uniform

These patches make audio card configuration the same as all other devices, and remove the need to explicitly enable -soundhw on boards that wish to support it.

I would like these in 1.5, malc didn't comment on the RFC. Patches 6-8 are new or different in the final series, everything else is mostly the same.

Paolo Bonzini (8):
adlib: qdev-ify
audio: remove the need for audio card CONFIG_* symbols
audio: remove HAS_AUDIO
audio: remove CONFIG_* symbols
audio: replace audio card configuration with default-configs
qom: do not return root for empty path
audio: look for the ISA and PCI buses
audio: enable PCI audio cards for all PCI-enabled targets

 arch_init.c                          | 169 ++++++++++-------------------------
 configure                            |  30 -------
 default-configs/i386-softmmu.mak     |   2 +-
 default-configs/mips-softmmu.mak     |   2 +-
 default-configs/mips64-softmmu.mak   |   2 +-
 default-configs/mips64el-softmmu.mak |   2 +-
 default-configs/mipsel-softmmu.mak   |   2 +-
 default-configs/pci.mak              |   3 +
 default-configs/ppc-softmmu.mak      |   2 +-
 default-configs/ppc64-softmmu.mak    |   2 +-
 default-configs/ppcemb-softmmu.mak   |   2 +-
 default-configs/sound.mak            |   4 +
 default-configs/x86_64-softmmu.mak   |   2 +-
 hmp-commands.hx                      |   4 -
 hw/audio/Makefile.objs               |  16 ++--
 hw/audio/ac97.c                      |   3 +-
 hw/audio/adlib.c                     |  84 +++++++++++++----
 hw/audio/cs4231a.c                   |   3 +-
 hw/audio/es1370.c                    |   3 +-
 hw/audio/gus.c                       |   3 +-
 hw/audio/intel-hda.c                 |  22 ++---
 hw/audio/pcspk.c                     |   4 +-
 hw/audio/sb16.c                      |   3 +-
 hw/i386/pc_piix.c                    |   2 -
 hw/i386/pc_q35.c                     |   1 -
 hw/mips/mips_jazz.c                  |   2 -
 hw/mips/mips_malta.c                 |   3 -
 hw/ppc/prep.c                        |   3 -
 hw/usb/dev-audio.c                   |   1 -
 include/hw/audio/audio.h             |  23 +----
 include/hw/audio/pcspk.h             |   2 -
 include/sysemu/arch_init.h           |   3 +-
 monitor.c                            |   2 -
 qom/object.c                         |  12 +--
 vl.c                                 |  10 +--
 35 files changed, 171 insertions(+), 262 deletions(-)
 create mode 100644 default-configs/sound.mak
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/8 adlib: qdev-ify

---

	RFC->v1: follow QOM guidelines (Andreas)
 hw/audio/adlib.c | 83 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 66 insertions(+), 17 deletions(-)
hw/audio/adlib.c +66 -17
index 4a58e6e..fb41f9d 100644
@@ -31,6 +31,12 @@
 
 #define ADLIB_KILL_TIMERS 1
 
+#ifdef HAS_YMF262
+#define ADLIB_DESC "Yamaha YMF262 (OPL3)"
+#else
+#define ADLIB_DESC "Yamaha YM3812 (OPL2)"
+#endif
+
 #ifdef DEBUG
 #include "qemu/timer.h"
 #endif
@@ -56,13 +62,15 @@ void YMF262UpdateOneQEMU (int which, INT16 *dst, int length);
 #define IO_WRITE_PROTO(name) \
     void name (void *opaque, uint32_t nport, uint32_t val)
 
-static struct {
-    int port;
-    int freq;
-} conf = {0x220, 44100};
+#define TYPE_ADLIB "adlib"
+#define ADLIB(obj) OBJECT_CHECK(AdlibState, (obj), TYPE_ADLIB)
 
 typedef struct {
+    ISADevice parent_obj;
+
     QEMUSoundCard card;
+    uint32_t freq;
+    uint32_t port;
     int ticking[2];
     int enabled;
     int active;
@@ -80,7 +88,7 @@ typedef struct {
 #endif
 } AdlibState;
 
-static AdlibState glob_adlib;
+static AdlibState *glob_adlib;
 
 static void adlib_stop_opl_timer (AdlibState *s, size_t n)
 {
@@ -150,7 +158,7 @@ static IO_READ_PROTO (adlib_read)
 
 static void timer_handler (int c, double interval_Sec)
 {
-    AdlibState *s = &glob_adlib;
+    AdlibState *s = glob_adlib;
     unsigned n = c & 1;
 #ifdef DEBUG
     double interval;
@@ -275,14 +283,20 @@ static void Adlib_fini (AdlibState *s)
     AUD_remove_card (&s->card);
 }
 
-int Adlib_init (ISABus *bus)
+static int Adlib_initfn (ISADevice *dev)
 {
-    AdlibState *s = &glob_adlib;
+    AdlibState *s = ADLIB(dev);
     struct audsettings as;
 
+    if (glob_adlib) {
+        dolog ("Cannot create more than 1 adlib device\n");
+        return -1;
+    }
+    glob_adlib = s;
+
 #ifdef HAS_YMF262
-    if (YMF262Init (1, 14318180, conf.freq)) {
-        dolog ("YMF262Init %d failed\n", conf.freq);
+    if (YMF262Init (1, 14318180, s->freq)) {
+        dolog ("YMF262Init %d failed\n", s->freq);
         return -1;
     }
     else {
@@ -290,9 +304,9 @@ int Adlib_init (ISABus *bus)
         s->enabled = 1;
     }
 #else
-    s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, conf.freq);
+    s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq);
     if (!s->opl) {
-        dolog ("OPLCreate %d failed\n", conf.freq);
+        dolog ("OPLCreate %d failed\n", s->freq);
         return -1;
     }
     else {
@@ -301,7 +315,7 @@ int Adlib_init (ISABus *bus)
     }
 #endif
 
-    as.freq = conf.freq;
+    as.freq = s->freq;
     as.nchannels = SHIFT;
     as.fmt = AUD_FMT_S16;
     as.endianness = AUDIO_HOST_ENDIANNESS;
@@ -327,11 +341,46 @@ int Adlib_init (ISABus *bus)
     register_ioport_read (0x388, 4, 1, adlib_read, s);
     register_ioport_write (0x388, 4, 1, adlib_write, s);
 
-    register_ioport_read (conf.port, 4, 1, adlib_read, s);
-    register_ioport_write (conf.port, 4, 1, adlib_write, s);
+    register_ioport_read (s->port, 4, 1, adlib_read, s);
+    register_ioport_write (s->port, 4, 1, adlib_write, s);
 
-    register_ioport_read (conf.port + 8, 2, 1, adlib_read, s);
-    register_ioport_write (conf.port + 8, 2, 1, adlib_write, s);
+    register_ioport_read (s->port + 8, 2, 1, adlib_read, s);
+    register_ioport_write (s->port + 8, 2, 1, adlib_write, s);
 
     return 0;
 }
+
+static Property adlib_properties[] = {
+    DEFINE_PROP_HEX32  ("iobase",  AdlibState, port, 0x220),
+    DEFINE_PROP_UINT32 ("freq",    AdlibState, freq,  44100),
+    DEFINE_PROP_END_OF_LIST (),
+};
+
+static void adlib_class_initfn (ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS (klass);
+    ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
+    ic->init = Adlib_initfn;
+    dc->desc = ADLIB_DESC;
+    dc->props = adlib_properties;
+}
+
+static const TypeInfo adlib_info = {
+    .name          = TYPE_ADLIB,
+    .parent        = TYPE_ISA_DEVICE,
+    .instance_size = sizeof (AdlibState),
+    .class_init    = adlib_class_initfn,
+};
+
+int Adlib_init (ISABus *bus)
+{
+    isa_create_simple (bus, TYPE_ADLIB);
+    return 0;
+}
+
+static void adlib_register_types (void)
+{
+    type_register_static (&adlib_info);
+}
+
+type_init (adlib_register_types)
Signature · 1 line
1.8.1.4
Reviewed-by on v1 1/8
#2 lore raw

Re: [Qemu-devel] [PATCH 1/8] adlib: qdev-ify

Am 18.04.2013 18:43, schrieb Paolo Bonzini:

Quoted 6 lines

---

	RFC->v1: follow QOM guidelines (Andreas)
 hw/audio/adlib.c | 83 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 66 insertions(+), 17 deletions(-)

Thanks,

At some point we should unify all the naming conventions of when, where or whether we use fn but no last-minute respins sensible for that.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw

PATCH 2/8 audio: remove the need for audio card CONFIG_* symbols

In reply to Paolo Bonzini

---

	RFC->v1: do not touch audio_available() here
 arch_init.c              | 130 ++++++++++++-----------------------------------
 configure                |   8 +--
 hw/audio/ac97.c          |   3 +-
 hw/audio/adlib.c         |   3 +-
 hw/audio/cs4231a.c       |   3 +-
 hw/audio/es1370.c        |   3 +-
 hw/audio/gus.c           |   3 +-
 hw/audio/intel-hda.c     |  22 ++++----
 hw/audio/pcspk.c         |   4 +-
 hw/audio/sb16.c          |   3 +-
 hw/usb/dev-audio.c       |   1 -
 include/hw/audio/audio.h |  23 ++-------
 include/hw/audio/pcspk.h |   2 -
 13 files changed, 63 insertions(+), 145 deletions(-)
arch_init.c +32 -98
index 92de1bd..8d26993 100644
@@ -899,97 +899,31 @@ struct soundhw {
     } init;
 };
 
-static struct soundhw soundhw[] = {
-#ifdef HAS_AUDIO_CHOICE
-#ifdef CONFIG_PCSPK
-    {
-        "pcspk",
-        "PC speaker",
-        0,
-        1,
-        { .init_isa = pcspk_audio_init }
-    },
-#endif
-
-#ifdef CONFIG_SB16
-    {
-        "sb16",
-        "Creative Sound Blaster 16",
-        0,
-        1,
-        { .init_isa = SB16_init }
-    },
-#endif
-
-#ifdef CONFIG_CS4231A
-    {
-        "cs4231a",
-        "CS4231A",
-        0,
-        1,
-        { .init_isa = cs4231a_init }
-    },
-#endif
-
-#ifdef CONFIG_ADLIB
-    {
-        "adlib",
-#ifdef HAS_YMF262
-        "Yamaha YMF262 (OPL3)",
-#else
-        "Yamaha YM3812 (OPL2)",
-#endif
-        0,
-        1,
-        { .init_isa = Adlib_init }
-    },
-#endif
-
-#ifdef CONFIG_GUS
-    {
-        "gus",
-        "Gravis Ultrasound GF1",
-        0,
-        1,
-        { .init_isa = GUS_init }
-    },
-#endif
-
-#ifdef CONFIG_AC97
-    {
-        "ac97",
-        "Intel 82801AA AC97 Audio",
-        0,
-        0,
-        { .init_pci = ac97_init }
-    },
-#endif
+static struct soundhw soundhw[9];
+static int soundhw_count;
 
-#ifdef CONFIG_ES1370
-    {
-        "es1370",
-        "ENSONIQ AudioPCI ES1370",
-        0,
-        0,
-        { .init_pci = es1370_init }
-    },
-#endif
-
-#ifdef CONFIG_HDA
-    {
-        "hda",
-        "Intel HD Audio",
-        0,
-        0,
-        { .init_pci = intel_hda_and_codec_init }
-    },
-#endif
-
-#endif /* HAS_AUDIO_CHOICE */
-
-    { NULL, NULL, 0, 0, { NULL } }
-};
+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 select_soundhw(const char *optarg)
 {
     struct soundhw *c;
@@ -997,16 +931,16 @@ void select_soundhw(const char *optarg)
     if (is_help_option(optarg)) {
     show_valid_cards:
 
-#ifdef HAS_AUDIO_CHOICE
-        printf("Valid sound card names (comma separated):\n");
-        for (c = soundhw; c->name; ++c) {
-            printf ("%-11s %s\n", c->name, c->descr);
+        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");
         }
-        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");
-#endif
         exit(!is_help_option(optarg));
     }
     else {
configure +1 -7
index ed49f91..7db1edb 100755
@@ -4455,15 +4455,9 @@ esac
 
 if test "$target_softmmu" = "yes" ; then
   case "$TARGET_BASE_ARCH" in
-  arm)
+  arm|lm32|i386|mips|ppc)
     cflags="-DHAS_AUDIO $cflags"
   ;;
-  lm32)
-    cflags="-DHAS_AUDIO $cflags"
-  ;;
-  i386|mips|ppc)
-    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
-  ;;
   esac
 fi
 
hw/audio/ac97.c +2 -1
index ab68ec6..baf138b 100644
@@ -1396,7 +1396,7 @@ static void ac97_exitfn (PCIDevice *dev)
     memory_region_destroy (&s->io_nabm);
 }
 
-int ac97_init (PCIBus *bus)
+static int ac97_init (PCIBus *bus)
 {
     pci_create_simple (bus, -1, "AC97");
     return 0;
@@ -1433,6 +1433,7 @@ 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);
 }
 
 type_init (ac97_register_types)
hw/audio/adlib.c +2 -1
index fb41f9d..fc20857 100644
@@ -372,7 +372,7 @@ static const TypeInfo adlib_info = {
     .class_init    = adlib_class_initfn,
 };
 
-int Adlib_init (ISABus *bus)
+static int Adlib_init (ISABus *bus)
 {
     isa_create_simple (bus, TYPE_ADLIB);
     return 0;
@@ -381,6 +381,7 @@ int Adlib_init (ISABus *bus)
 static void adlib_register_types (void)
 {
     type_register_static (&adlib_info);
+    isa_register_soundhw("adlib", ADLIB_DESC, Adlib_init);
 }
 
 type_init (adlib_register_types)
hw/audio/cs4231a.c +2 -1
index 5711b62..cc605e5 100644
@@ -659,7 +659,7 @@ static int cs4231a_initfn (ISADevice *dev)
     return 0;
 }
 
-int cs4231a_init (ISABus *bus)
+static int cs4231a_init (ISABus *bus)
 {
     isa_create_simple (bus, "cs4231a");
     return 0;
@@ -692,6 +692,7 @@ static const TypeInfo cs4231a_info = {
 static void cs4231a_register_types (void)
 {
     type_register_static (&cs4231a_info);
+    isa_register_soundhw("cs4231a", "CS4231A", cs4231a_init);
 }
 
 type_init (cs4231a_register_types)
hw/audio/es1370.c +2 -1
index 9fe5708..c1cd169 100644
@@ -1051,7 +1051,7 @@ static void es1370_exitfn (PCIDevice *dev)
     memory_region_destroy (&s->io);
 }
 
-int es1370_init (PCIBus *bus)
+static int es1370_init (PCIBus *bus)
 {
     pci_create_simple (bus, -1, "ES1370");
     return 0;
@@ -1083,6 +1083,7 @@ 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);
 }
 
 type_init (es1370_register_types)
hw/audio/gus.c +2 -1
index 0604d6e..a91921c 100644
@@ -293,7 +293,7 @@ static int gus_initfn (ISADevice *dev)
     return 0;
 }
 
-int GUS_init (ISABus *bus)
+static int GUS_init (ISABus *bus)
 {
     isa_create_simple (bus, "gus");
     return 0;
@@ -327,6 +327,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);
 }
 
 type_init (gus_register_types)
hw/audio/intel-hda.c +11 -11
index 3d8077a..1016af0 100644
@@ -1300,21 +1300,11 @@ static const TypeInfo hda_codec_device_type_info = {
     .class_init = hda_codec_device_class_init,
 };
 
-static void intel_hda_register_types(void)
-{
-    type_register_static(&hda_codec_bus_info);
-    type_register_static(&intel_hda_info_ich6);
-    type_register_static(&intel_hda_info_ich9);
-    type_register_static(&hda_codec_device_type_info);
-}
-
-type_init(intel_hda_register_types)
-
 /*
  * create intel hda controller with codec attached to it,
  * so '-soundhw hda' works.
  */
-int intel_hda_and_codec_init(PCIBus *bus)
+static int intel_hda_and_codec_init(PCIBus *bus)
 {
     PCIDevice *controller;
     BusState *hdabus;
@@ -1327,3 +1317,13 @@ int intel_hda_and_codec_init(PCIBus *bus)
     return 0;
 }
 
+static void intel_hda_register_types(void)
+{
+    type_register_static(&hda_codec_bus_info);
+    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)
hw/audio/pcspk.c +3 -1
index 34e0df7..bed1c86 100644
@@ -25,6 +25,7 @@
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
+#include "hw/audio/audio.h"
 #include "audio/audio.h"
 #include "qemu/timer.h"
 #include "hw/timer/i8254.h"
@@ -105,7 +106,7 @@ static void pcspk_callback(void *opaque, int free)
     }
 }
 
-int pcspk_audio_init(ISABus *bus)
+static int pcspk_audio_init(ISABus *bus)
 {
     PCSpkState *s = pcspk_state;
     struct audsettings as = {PCSPK_SAMPLE_RATE, 1, AUD_FMT_U8, 0};
@@ -197,5 +198,6 @@ static const TypeInfo pcspk_info = {
 static void pcspk_register(void)
 {
     type_register_static(&pcspk_info);
+    isa_register_soundhw("pcspk", "PC speaker", pcspk_audio_init);
 }
 type_init(pcspk_register)
hw/audio/sb16.c +2 -1
index 783b6b4..30bedf9 100644
@@ -1384,7 +1384,7 @@ static int sb16_initfn (ISADevice *dev)
     return 0;
 }
 
-int SB16_init (ISABus *bus)
+static int SB16_init (ISABus *bus)
 {
     isa_create_simple (bus, "sb16");
     return 0;
@@ -1419,6 +1419,7 @@ 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);
 }
 
 type_init (sb16_register_types)
hw/usb/dev-audio.c +0 -1
index 44fc43f..04933a9 100644
@@ -33,7 +33,6 @@
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
 #include "hw/hw.h"
-#include "hw/audio/audio.h"
 #include "audio/audio.h"
 
 #define USBAUDIO_VENDOR_NUM     0x46f4 /* CRC16() of "QEMU" */
include/hw/audio/audio.h +4 -19
index 428274f..b28abdd 100644
@@ -1,25 +1,10 @@
 #ifndef HW_AUDIODEV_H
 #define HW_AUDIODEV_H 1
 
-/* es1370.c */
-int es1370_init(PCIBus *bus);
+void isa_register_soundhw(const char *name, const char *descr,
+                          int (*init_isa)(ISABus *bus));
 
-/* sb16.c */
-int SB16_init(ISABus *bus);
-
-/* adlib.c */
-int Adlib_init(ISABus *bus);
-
-/* gus.c */
-int GUS_init(ISABus *bus);
-
-/* ac97.c */
-int ac97_init(PCIBus *bus);
-
-/* cs4231a.c */
-int cs4231a_init(ISABus *bus);
-
-/* intel-hda.c + hda-audio.c */
-int intel_hda_and_codec_init(PCIBus *bus);
+void pci_register_soundhw(const char *name, const char *descr,
+                          int (*init_pci)(PCIBus *bus));
 
 #endif
include/hw/audio/pcspk.h +0 -2
index ce8ef4f..aa6a9d3 100644
@@ -40,6 +40,4 @@ static inline ISADevice *pcspk_init(ISABus *bus, ISADevice *pit)
     return dev;
 }
 
-int pcspk_audio_init(ISABus *bus);
-
 #endif /* !HW_PCSPK_H */
Signature · 1 line
1.8.1.4
#4 lore raw

PATCH 3/8 audio: remove HAS_AUDIO

In reply to Paolo Bonzini

Several targets can have wavcapture/-soundhw support via PCI cards. HAS_AUDIO is a useless limitation, remove it.

---

	RFC->v1: remove audio_available()
 arch_init.c                | 23 +++++------------------
 configure                  |  8 --------
 hmp-commands.hx            |  4 ----
 include/sysemu/arch_init.h |  1 -
 monitor.c                  |  2 --
 vl.c                       |  8 --------
 6 files changed, 5 insertions(+), 41 deletions(-)
arch_init.c +0 -18
index 8d26993..88b74c0 100644
@@ -887,7 +887,6 @@ SaveVMHandlers savevm_ram_handlers = {
     .cancel = ram_migration_cancel,
 };
 
-#ifdef HAS_AUDIO
 struct soundhw {
     const char *name;
     const char *descr;
@@ -1006,14 +1010,6 @@ void audio_init(ISABus *isa_bus, PCIBus *pci_bus)
         }
     }
 }
-#else
-void select_soundhw(const char *optarg)
-{
-}
-void audio_init(ISABus *isa_bus, PCIBus *pci_bus)
-{
-}
-#endif
 
 int qemu_uuid_parse(const char *str, uint8_t *uuid)
 {
@@ -1069,15 +1065,6 @@ void cpudef_init(void)
 #endif
 }
 
-int audio_available(void)
-{
-#ifdef HAS_AUDIO
-    return 1;
-#else
-    return 0;
-#endif
-}
-
 int tcg_available(void)
 {
     return 1;
configure +0 -8
index 7db1edb..d24d6c6 100755
@@ -4453,14 +4453,6 @@ alpha)
 ;;
 esac
 
-if test "$target_softmmu" = "yes" ; then
-  case "$TARGET_BASE_ARCH" in
-  arm|lm32|i386|mips|ppc)
-    cflags="-DHAS_AUDIO $cflags"
-  ;;
-  esac
-fi
-
 if test "$gprof" = "yes" ; then
   echo "TARGET_GPROF=yes" >> $config_target_mak
   if test "$target_linux_user" = "yes" ; then
hmp-commands.hx +0 -4
index df44906..9cea415 100644
@@ -736,7 +736,6 @@ info mice
 @end example
 ETEXI
 
-#ifdef HAS_AUDIO
     {
         .name       = "wavcapture",
         .args_type  = "path:F,freq:i?,bits:i?,nchannels:i?",
@@ -744,7 +743,6 @@ ETEXI
         .help       = "capture audio to a wave file (default frequency=44100 bits=16 channels=2)",
         .mhandler.cmd = do_wav_capture,
     },
-#endif
 STEXI
 @item wavcapture @var{filename} [@var{frequency} [@var{bits} [@var{channels}]]]
 @findex wavcapture
@@ -759,7 +757,6 @@ Defaults:
 @end itemize
 ETEXI
 
-#ifdef HAS_AUDIO
     {
         .name       = "stopcapture",
         .args_type  = "n:i",
@@ -767,7 +764,6 @@ ETEXI
         .help       = "stop capture",
         .mhandler.cmd = do_stop_capture,
     },
-#endif
 STEXI
 @item stopcapture @var{index}
 @findex stopcapture
include/sysemu/arch_init.h +0 -1
index aed3d1d..f18de33 100644
@@ -30,7 +30,6 @@ void select_soundhw(const char *optarg);
 void do_acpitable_option(const QemuOpts *opts);
 void do_smbios_option(const char *optarg);
 void cpudef_init(void);
-int audio_available(void);
 void audio_init(ISABus *isa_bus, PCIBus *pci_bus);
 int tcg_available(void);
 int kvm_available(void);
monitor.c +0 -2
index 332abe7..8f828d4 100644
@@ -1862,7 +1862,6 @@ static void do_info_capture(Monitor *mon, const QDict *qdict)
     }
 }
 
-#ifdef HAS_AUDIO
 static void do_stop_capture(Monitor *mon, const QDict *qdict)
 {
     int i;
@@ -1903,7 +1902,6 @@ static void do_wav_capture(Monitor *mon, const QDict *qdict)
     }
     QLIST_INSERT_HEAD (&capture_head, s, entries);
 }
-#endif
 
 static qemu_acl *find_acl(Monitor *mon, const char *name)
 {
vl.c +0 -8
index 2ef00d8..9e56d77 100644
@@ -3201,18 +3201,10 @@ int main(int argc, char **argv, char **envp)
                 add_device_config(DEV_BT, optarg);
                 break;
             case QEMU_OPTION_audio_help:
-                if (!(audio_available())) {
-                    printf("Option %s not supported for this target\n", popt->name);
-                    exit(1);
-                }
                 AUD_help ();
                 exit (0);
                 break;
             case QEMU_OPTION_soundhw:
-                if (!(audio_available())) {
-                    printf("Option %s not supported for this target\n", popt->name);
-                    exit(1);
-                }
                 select_soundhw (optarg);
                 break;
             case QEMU_OPTION_h:
Signature · 1 line
1.8.1.4
#5 lore raw

PATCH 4/8 audio: remove CONFIG_* symbols

In reply to Paolo Bonzini
---
 configure | 9 ---------
 1 file changed, 9 deletions(-)
configure +0 -9
index d24d6c6..62b5758 100755
@@ -3678,10 +3678,6 @@ fi
 if test "$cap_ng" = "yes" ; then
   echo "CONFIG_LIBCAP=y" >> $config_host_mak
 fi
-for card in $audio_card_list; do
-    def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
-    echo "$def=y" >> $config_host_mak
-done
 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
 for drv in $audio_drv_list; do
     def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
@@ -4359,11 +4355,6 @@ if test "$target_bsd_user" = "yes" ; then
   echo "CONFIG_BSD_USER=y" >> $config_target_mak
 fi
 
-# the static way of configuring available audio cards requires this workaround
-if test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then
-  echo "CONFIG_PCSPK=y" >> $config_target_mak
-fi
-
 # generate QEMU_CFLAGS/LDFLAGS for targets
 
 cflags=""
Signature · 1 line
1.8.1.4
#6 lore raw

PATCH 5/8 audio: replace audio card configuration with default-configs

In reply to Paolo Bonzini
---
 configure                            |  7 -------
 default-configs/i386-softmmu.mak     |  2 +-
 default-configs/mips-softmmu.mak     |  2 +-
 default-configs/mips64-softmmu.mak   |  2 +-
 default-configs/mips64el-softmmu.mak |  2 +-
 default-configs/mipsel-softmmu.mak   |  2 +-
 default-configs/ppc-softmmu.mak      |  2 +-
 default-configs/ppc64-softmmu.mak    |  2 +-
 default-configs/ppcemb-softmmu.mak   |  2 +-
 default-configs/sound.mak            |  7 +++++++
 default-configs/x86_64-softmmu.mak   |  2 +-
 hw/audio/Makefile.objs               | 16 +++++++---------
 12 files changed, 23 insertions(+), 25 deletions(-)
 create mode 100644 default-configs/sound.mak
configure +0 -7
index 62b5758..f3bfa00 100755
@@ -123,8 +123,6 @@ interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
 cross_prefix=""
 audio_drv_list=""
-audio_card_list="ac97 es1370 sb16 hda"
-audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
 block_drv_whitelist=""
 host_cc="cc"
 libs_softmmu=""
@@ -702,8 +700,6 @@ for opt do
   ;;
   --oss-lib=*) oss_lib="$optarg"
   ;;
-  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
-  ;;
   --audio-drv-list=*) audio_drv_list="$optarg"
   ;;
   --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
@@ -1099,8 +1095,6 @@ echo "  --disable-cocoa          disable Cocoa (Mac OS X only)"
 echo "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
 echo "  --audio-drv-list=LIST    set audio drivers list:"
 echo "                           Available drivers: $audio_possible_drivers"
-echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
-echo "                           Available cards: $audio_possible_cards"
 echo "  --block-drv-whitelist=L  set block driver whitelist"
 echo "                           (affects only QEMU, not qemu-img)"
 echo "  --enable-mixemu          enable mixer emulation"
@@ -3514,7 +3508,6 @@ echo "curses support    $curses"
 echo "curl support      $curl"
 echo "mingw32 support   $mingw32"
 echo "Audio drivers     $audio_drv_list"
-echo "Extra audio cards $audio_card_list"
 echo "Block whitelist   $block_drv_whitelist"
 echo "Mixer emulation   $mixemu"
 echo "VirtFS support    $virtfs"
default-configs/i386-softmmu.mak +1 -1
index 368a776..bc716a0 100644
@@ -1,6 +1,7 @@
 # Default configuration for i386-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_VGA=y
 CONFIG_QXL=$(CONFIG_SPICE)
@@ -22,7 +23,6 @@ CONFIG_IDE_ISA=y
 CONFIG_IDE_PIIX=y
 CONFIG_NE2000_ISA=y
 CONFIG_PIIX_PCI=y
-CONFIG_SOUND=y
 CONFIG_HPET=y
 CONFIG_APPLESMC=y
 CONFIG_I8259=y
default-configs/mips-softmmu.mak +1 -1
index b764360..b443702 100644
@@ -1,6 +1,7 @@
 # Default configuration for mips-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_ESP=y
@@ -23,7 +24,6 @@ CONFIG_PIIX4=y
 CONFIG_IDE_ISA=y
 CONFIG_IDE_PIIX=y
 CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
 CONFIG_RC4030=y
 CONFIG_DP8393X=y
 CONFIG_DS1225Y=y
default-configs/mips64-softmmu.mak +1 -1
index 0e4e65d..d638957 100644
@@ -1,6 +1,7 @@
 # Default configuration for mips64-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_ESP=y
@@ -23,7 +24,6 @@ CONFIG_PIIX4=y
 CONFIG_IDE_ISA=y
 CONFIG_IDE_PIIX=y
 CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
 CONFIG_RC4030=y
 CONFIG_DP8393X=y
 CONFIG_DS1225Y=y
default-configs/mips64el-softmmu.mak +1 -1
index 0a6c4f7..c9be3f4 100644
@@ -1,6 +1,7 @@
 # Default configuration for mips64el-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_ESP=y
@@ -24,7 +25,6 @@ CONFIG_IDE_ISA=y
 CONFIG_IDE_PIIX=y
 CONFIG_IDE_VIA=y
 CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
 CONFIG_RC4030=y
 CONFIG_DP8393X=y
 CONFIG_DS1225Y=y
default-configs/mipsel-softmmu.mak +1 -1
index 9f9c6da..4f4a449 100644
@@ -1,6 +1,7 @@
 # Default configuration for mipsel-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_ISA_MMIO=y
 CONFIG_ESP=y
@@ -23,7 +24,6 @@ CONFIG_PIIX4=y
 CONFIG_IDE_ISA=y
 CONFIG_IDE_PIIX=y
 CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
 CONFIG_RC4030=y
 CONFIG_DP8393X=y
 CONFIG_DS1225Y=y
default-configs/ppc-softmmu.mak +1 -1
index 50034fc..cc3587f 100644
@@ -1,6 +1,7 @@
 # Default configuration for ppc-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_GDBSTUB_XML=y
 CONFIG_ISA_MMIO=y
@@ -34,7 +35,6 @@ CONFIG_IDE_ISA=y
 CONFIG_IDE_CMD646=y
 CONFIG_IDE_MACIO=y
 CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
default-configs/ppc64-softmmu.mak +1 -1
index 6398d60..884ea8a 100644
@@ -1,6 +1,7 @@
 # Default configuration for ppc64-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_GDBSTUB_XML=y
 CONFIG_ISA_MMIO=y
@@ -34,7 +35,6 @@ CONFIG_IDE_ISA=y
 CONFIG_IDE_CMD646=y
 CONFIG_IDE_MACIO=y
 CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
default-configs/ppcemb-softmmu.mak +1 -1
index 05b50d6..be93e03 100644
@@ -1,6 +1,7 @@
 # Default configuration for ppcemb-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_GDBSTUB_XML=y
 CONFIG_ISA_MMIO=y
@@ -29,7 +30,6 @@ CONFIG_IDE_ISA=y
 CONFIG_IDE_CMD646=y
 CONFIG_IDE_MACIO=y
 CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
default-configs/sound.mak new file +7 -0
new file mode 100644
index 0000000..ed20388
@@ -0,0 +1,7 @@
+CONFIG_SB16=y
+CONFIG_AC97=y
+CONFIG_HDA=y
+CONFIG_ES1370=y
+#CONFIG_ADLIB=y
+#CONFIG_GUS=y
+#CONFIG_CS4231A=y
default-configs/x86_64-softmmu.mak +1 -1
index 2711b83..e53f627 100644
@@ -1,6 +1,7 @@
 # Default configuration for x86_64-softmmu
 
 include pci.mak
+include sound.mak
 include usb.mak
 CONFIG_VGA=y
 CONFIG_QXL=$(CONFIG_SPICE)
@@ -22,7 +23,6 @@ CONFIG_IDE_ISA=y
 CONFIG_IDE_PIIX=y
 CONFIG_NE2000_ISA=y
 CONFIG_PIIX_PCI=y
-CONFIG_SOUND=y
 CONFIG_HPET=y
 CONFIG_APPLESMC=y
 CONFIG_I8259=y
hw/audio/Makefile.objs +7 -9
index 2375102..7ce85a2 100644
@@ -1,14 +1,12 @@
 # Sound
-sound-obj-y =
-sound-obj-$(CONFIG_SB16) += sb16.o
-sound-obj-$(CONFIG_ES1370) += es1370.o
-sound-obj-$(CONFIG_AC97) += ac97.o
-sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
-sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
-sound-obj-$(CONFIG_CS4231A) += cs4231a.o
-sound-obj-$(CONFIG_HDA) += intel-hda.o hda-codec.o
+common-obj-$(CONFIG_SB16) += sb16.o
+common-obj-$(CONFIG_ES1370) += es1370.o
+common-obj-$(CONFIG_AC97) += ac97.o
+common-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
+common-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
+common-obj-$(CONFIG_CS4231A) += cs4231a.o
+common-obj-$(CONFIG_HDA) += intel-hda.o hda-codec.o
 
-common-obj-$(CONFIG_SOUND) += $(sound-obj-y)
 common-obj-$(CONFIG_PCSPK) += pcspk.o
 common-obj-$(CONFIG_WM8750) += wm8750.o
 common-obj-$(CONFIG_PL041) += pl041.o lm4549.o
Signature · 1 line
1.8.1.4
#7 lore raw

PATCH 6/8 qom: do not return root for empty path

In reply to Paolo Bonzini

An empty path will return the sole object of that type in the QOM tree. This is different from "/", which returns the root.

---
 qom/object.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
qom/object.c +2 -10
index 093502e..dd53d24 100644
@@ -1113,21 +1113,13 @@ static Object *object_resolve_partial_path(Object *parent,
 Object *object_resolve_path_type(const char *path, const char *typename,
                                  bool *ambiguous)
 {
-    bool partial_path = true;
     Object *obj;
     gchar **parts;
 
     parts = g_strsplit(path, "/", 0);
-    if (parts == NULL || parts[0] == NULL) {
-        g_strfreev(parts);
-        return object_get_root();
-    }
-
-    if (strcmp(parts[0], "") == 0) {
-        partial_path = false;
-    }
+    assert(parts);
 
-    if (partial_path) {
+    if (parts[0] == NULL || strcmp(parts[0], "") != 0) {
         if (ambiguous) {
             *ambiguous = false;
         }
Signature · 1 line
1.8.1.4
#8 lore raw

Re: [Qemu-devel] [PATCH 6/8] qom: do not return root for empty path

Am 18.04.2013 18:44, schrieb Paolo Bonzini:

Quoted 4 lines

An empty path will return the sole object of that type in the QOM tree. This is different from "/", which returns the root.

Looks OK to me, but not confident about callers' expectations. Might this need a documentation update? CC'ing Mr. QOM.

Andreas

Quoted 33 lines
---
 qom/object.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
qom/object.c +2 -10
index 093502e..dd53d24 100644
@@ -1113,21 +1113,13 @@ static Object *object_resolve_partial_path(Object *parent,
 Object *object_resolve_path_type(const char *path, const char *typename,
                                  bool *ambiguous)
 {
-    bool partial_path = true;
     Object *obj;
     gchar **parts;
 
     parts = g_strsplit(path, "/", 0);
-    if (parts == NULL || parts[0] == NULL) {
-        g_strfreev(parts);
-        return object_get_root();
-    }
-
-    if (strcmp(parts[0], "") == 0) {
-        partial_path = false;
-    }
+    assert(parts);
 
-    if (partial_path) {
+    if (parts[0] == NULL || strcmp(parts[0], "") != 0) {
         if (ambiguous) {
             *ambiguous = false;
         }
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#9 lore raw

PATCH 7/8 audio: look for the ISA and PCI buses

In reply to Paolo Bonzini
---
 arch_init.c                | 16 +++++++++++-----
 hw/i386/pc_piix.c          |  2 +-
 hw/i386/pc_q35.c           |  2 +-
 hw/mips/mips_jazz.c        |  2 +-
 hw/mips/mips_malta.c       |  2 +-
 hw/ppc/prep.c              |  2 +-
 include/sysemu/arch_init.h |  2 +-
 7 files changed, 17 insertions(+), 11 deletions(-)
arch_init.c +11 -5
index 88b74c0..cbcb3ed 100644
@@ -992,20 +992,26 @@ void select_soundhw(const char *optarg)
     }
 }
 
-void audio_init(ISABus *isa_bus, PCIBus *pci_bus)
+void audio_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->isa) {
-                if (isa_bus) {
-                    c->init.init_isa(isa_bus);
+                if (!isa_bus) {
+                    fprintf(stderr, "ISA bus not available for %s\n", c->name);
+                    exit(1);
                 }
+                c->init.init_isa(isa_bus);
             } else {
-                if (pci_bus) {
-                    c->init.init_pci(pci_bus);
+                if (!pci_bus) {
+                    fprintf(stderr, "PCI bus not available for %s\n", c->name);
+                    exit(1);
                 }
+                c->init.init_pci(pci_bus);
             }
         }
     }
hw/i386/pc_piix.c +1 -1
index 943758a..1953d8c 100644
@@ -194,7 +194,7 @@ static void pc_init1(MemoryRegion *system_memory,
         }
     }
 
-    audio_init(isa_bus, pci_enabled ? pci_bus : NULL);
+    audio_init();
 
     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
                  floppy, idebus[0], idebus[1], rtc_state);
hw/i386/pc_q35.c +1 -1
index 6ac1a89..76c378b 100644
@@ -202,7 +202,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
 
     /* the rest devices to which pci devfn is automatically assigned */
     pc_vga_init(isa_bus, host_bus);
-    audio_init(isa_bus, host_bus);
+    audio_init();
     pc_nic_init(isa_bus, host_bus);
     if (pci_enabled) {
         pc_pci_device_init(host_bus);
hw/mips/mips_jazz.c +1 -1
index fd3a5f9..822d300 100644
@@ -290,7 +290,7 @@ static void mips_jazz_init(MemoryRegion *address_space,
 
     /* Sound card */
     /* FIXME: missing Jazz sound at 0x8000c000, rc4030[2] */
-    audio_init(isa_bus, NULL);
+    audio_init();
 
     /* NVRAM */
     dev = qdev_create(NULL, "ds1225y");
hw/mips/mips_malta.c +1 -1
index 86f42b2..a2d01e1 100644
@@ -986,7 +986,7 @@ void mips_malta_init(QEMUMachineInitArgs *args)
     fdctrl_init_isa(isa_bus, fd);
 
     /* Sound card */
-    audio_init(isa_bus, pci_bus);
+    audio_init();
 
     /* Network card */
     network_init();
hw/ppc/prep.c +1 -1
index cceab3e..82bd27e 100644
@@ -660,7 +660,7 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
     register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL);
 
     /* Initialize audio subsystem */
-    audio_init(isa_bus, pci_bus);
+    audio_init();
 }
 
 static QEMUMachine prep_machine = {
include/sysemu/arch_init.h +1 -1
index f18de33..dece913 100644
@@ -30,7 +30,7 @@ void select_soundhw(const char *optarg);
 void do_acpitable_option(const QemuOpts *opts);
 void do_smbios_option(const char *optarg);
 void cpudef_init(void);
-void audio_init(ISABus *isa_bus, PCIBus *pci_bus);
+void audio_init(void);
 int tcg_available(void);
 int kvm_available(void);
 int xen_available(void);
Signature · 1 line
1.8.1.4
#10 lore raw

Re: [Qemu-devel] [PATCH 7/8] audio: look for the ISA and PCI buses

Am 18.04.2013 18:44, schrieb Paolo Bonzini:

Quoted 11 lines
---
 arch_init.c                | 16 +++++++++++-----
 hw/i386/pc_piix.c          |  2 +-
 hw/i386/pc_q35.c           |  2 +-
 hw/mips/mips_jazz.c        |  2 +-
 hw/mips/mips_malta.c       |  2 +-
 hw/ppc/prep.c              |  2 +-
 include/sysemu/arch_init.h |  2 +-
 7 files changed, 17 insertions(+), 11 deletions(-)

[...]

hw/i386/pc_piix.c static void pc_init1(MemoryRegion *system_memory, · line 200

Quoted 13 lines
hw/i386/pc_piix.c +1 -1
index 943758a..1953d8c 100644
@@ -194,7 +194,7 @@ static void pc_init1(MemoryRegion *system_memory,
         }
     }
 
-    audio_init(isa_bus, pci_enabled ? pci_bus : NULL);
+    audio_init();
 
     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
                  floppy, idebus[0], idebus[1], rtc_state);

[snip]

The patch version committed has an additional change in this file:

@@ -88,7 +88,6 @@ static void pc_init1(MemoryRegion *system_memory,

     void *fw_cfg = NULL;

     pc_cpus_init(cpu_model);

- pc_acpi_init("acpi-dsdt.aml");

     if (kvmclock_enabled) {
         kvmclock_create();

Was that accidental? Noticed because of a conflict with Igor's patches.

Further, my Reviewed-by is missing on patch 1/8, so was maybe the previous RFC version committed accidentally instead of this one?

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#11 lore raw

Re: [Qemu-devel] [PATCH 7/8] audio: look for the ISA and PCI buses

Il 30/04/2013 14:16, Andreas Färber ha scritto:

Quoted 12 lines

The patch version committed has an additional change in this file:

(quoted diff) +0 -1
@@ -88,7 +88,6 @@ static void pc_init1(MemoryRegion *system_memory,
     void *fw_cfg = NULL;
 
     pc_cpus_init(cpu_model);
-    pc_acpi_init("acpi-dsdt.aml");
 
     if (kvmclock_enabled) {
         kvmclock_create();
Quoted 1 line

Was that accidental? Noticed because of a conflict with Igor's patches.

Yes, it must have been introduced when applying, because this wasn't a pull request. I'll send a patch to revert.

Quoted 2 lines

Further, my Reviewed-by is missing on patch 1/8, so was maybe the previous RFC version committed accidentally instead of this one?

No, the RFC only had 6 patches and patches 6-7-8 were completely different (and broken).

Paolo

#12 lore raw

Re: [Qemu-devel] [PATCH 7/8] audio: look for the ISA and PCI buses

Quoted 10 lines · Paolo Bonzini

Il 30/04/2013 14:16, Andreas Färber ha scritto:

Quoted 9 lines

The patch version committed has an additional change in this file:

(quoted diff) +0 -1
@@ -88,7 +88,6 @@ static void pc_init1(MemoryRegion *system_memory,
     void *fw_cfg = NULL;
 
     pc_cpus_init(cpu_model);
-    pc_acpi_init("acpi-dsdt.aml");
 
Quoted 7 lines
Quoted 4 lines
(quoted diff) +0 -0
     if (kvmclock_enabled) {
         kvmclock_create();

Was that accidental? Noticed because of a conflict with Igor's patches.

Yes, it must have been introduced when applying, because this wasn't a pull request. I'll send a patch to revert.

I had a dirty tree which normally doesn't create problems. However, in this case Paolo's patches no longer applied cleanly.

I have a script that will apply each patch allowing fuzz, and then analyses the patch to do git add for any file touched by the patch. This restriction normally prevents this type of problem from happening.

However, in this case, this patch touched the file containing the dirty bits so it got picked up by accident.

I'll modify patches apply to fail if the tree is dirty which will prevent this in the future.

Quoted 3 lines
Quoted 3 lines

Further, my Reviewed-by is missing on patch 1/8, so was maybe the previous RFC version committed accidentally instead of this one?

Your Reviewed-by is missing because I applied the series before you sent the Reviewed-by.

Regards,

Anthony Liguori

Quoted 5 lines

No, the RFC only had 6 patches and patches 6-7-8 were completely different (and broken).

Paolo

#13 lore raw

Re: [Qemu-devel] [PATCH 7/8] audio: look for the ISA and PCI buses

In reply to Paolo Bonzini
Quoted 16 lines · Paolo Bonzini
---
  arch_init.c                | 16 +++++++++++-----
  hw/i386/pc_piix.c          |  2 +-
  hw/i386/pc_q35.c           |  2 +-
  hw/mips/mips_jazz.c        |  2 +-
  hw/mips/mips_malta.c       |  2 +-
  hw/ppc/prep.c              |  2 +-
  include/sysemu/arch_init.h |  2 +-
  7 files changed, 17 insertions(+), 11 deletions(-)
arch_init.c +0 -0
index 88b74c0..cbcb3ed 100644

arch_init.c void select_soundhw(const char *optarg) · line 999

Quoted 9 lines
arch_init.c +3 -1
@@ -992,20 +992,26 @@ void select_soundhw(const char *optarg)
      }
  }
 
-void audio_init(ISABus *isa_bus, PCIBus *pci_bus)
+void audio_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);

We don't have PCI or ISA on s390. So with this patch applied, qemu-system-s390x breaks on init.

qemu-system-s390x: qom/object.c:190: type_is_ancestor: Assertion `target_type' failed.

Program received signal SIGABRT, Aborted. 0x000003fffd94287e in raise () from /lib64/libc.so.6 (gdb) bt

#0  0x000003fffd94287e in raise () from /lib64/libc.so.6
#1  0x000003fffd943ec8 in abort () from /lib64/libc.so.6
#2  0x000003fffd939aa0 in __assert_fail () from /lib64/libc.so.6
#3  0x00000000800cfdb2 in type_is_ancestor (type=<optimized out>, target_type=0x0) at qom/object.c:190
#4  0x00000000800cfeae in object_class_dynamic_cast (class=0x80b617d0, typename=<optimized out>) at qom/object.c:474
#5  0x00000000800cff90 in object_dynamic_cast (obj=0x80b91d40, typename=<optimized out>) at qom/object.c:427
#6  0x00000000800d0aea in object_resolve_partial_path (parent=<optimized out>, parts=<optimized out>,
    typename=<optimized out>, ambiguous=0x0) at qom/object.c:1084
#7  0x00000000800d1fca in object_resolve_path_type (path=<optimized out>, typename=0x801fa1a8 "PCI", ambiguous=0x0)
    at qom/object.c:1126

#8 0x0000000080110b28 in audio_init () at /temporaer/agraf/qemu/arch_init.c:994
#9 0x000000008010a6e0 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4297 (gdb) l /temporaer/agraf/qemu/arch_init.c:994
989
990 void audio_init(void)
991 {

992        struct soundhw *c;
993        ISABus *isa_bus = (ISABus *) object_resolve_path_type("", TYPE_ISA_BUS, NULL);
994        PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL);

995
996 for (c = soundhw; c->name; ++c) {
997 if (c->enabled) {
998 if (c->isa) {

Alex

#14 lore raw

PATCH 8/8 audio: enable PCI audio cards for all PCI-enabled targets

In reply to Paolo Bonzini

---

	RFC->v1: move audio_init() to vl.c
 default-configs/pci.mak   | 3 +++
 default-configs/sound.mak | 3 ---
 hw/i386/pc_piix.c         | 2 --
 hw/i386/pc_q35.c          | 1 -
 hw/mips/mips_jazz.c       | 2 --
 hw/mips/mips_malta.c      | 3 ---
 hw/ppc/prep.c             | 3 ---
 vl.c                      | 2 ++
 8 files changed, 5 insertions(+), 14 deletions(-)
default-configs/pci.mak +3 -0
index f5f100e..9506dbd 100644
@@ -9,6 +9,9 @@ CONFIG_NE2000_PCI=y
 CONFIG_EEPRO100_PCI=y
 CONFIG_PCNET_PCI=y
 CONFIG_PCNET_COMMON=y
+CONFIG_AC97=y
+CONFIG_HDA=y
+CONFIG_ES1370=y
 CONFIG_LSI_SCSI_PCI=y
 CONFIG_MEGASAS_SCSI_PCI=y
 CONFIG_RTL8139_PCI=y
default-configs/sound.mak +0 -3
index ed20388..ff69c4d 100644
@@ -1,7 +1,4 @@
 CONFIG_SB16=y
-CONFIG_AC97=y
-CONFIG_HDA=y
-CONFIG_ES1370=y
 #CONFIG_ADLIB=y
 #CONFIG_GUS=y
 #CONFIG_CS4231A=y
hw/i386/pc_piix.c +0 -2
index 1953d8c..8c1e05c 100644
@@ -194,8 +194,6 @@ static void pc_init1(MemoryRegion *system_memory,
         }
     }
 
-    audio_init();
-
     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
                  floppy, idebus[0], idebus[1], rtc_state);
 
hw/i386/pc_q35.c +0 -1
index 76c378b..73ba8ce 100644
@@ -202,7 +202,6 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
 
     /* the rest devices to which pci devfn is automatically assigned */
     pc_vga_init(isa_bus, host_bus);
-    audio_init();
     pc_nic_init(isa_bus, host_bus);
     if (pci_enabled) {
         pc_pci_device_init(host_bus);
hw/mips/mips_jazz.c +0 -2
index 822d300..94d9570 100644
@@ -288,9 +288,7 @@ static void mips_jazz_init(MemoryRegion *address_space,
         parallel_mm_init(address_space, 0x80008000, 0, rc4030[0],
                          parallel_hds[0]);
 
-    /* Sound card */
     /* FIXME: missing Jazz sound at 0x8000c000, rc4030[2] */
-    audio_init();
 
     /* NVRAM */
     dev = qdev_create(NULL, "ds1225y");
hw/mips/mips_malta.c +0 -3
index a2d01e1..9d521cc 100644
@@ -985,9 +985,6 @@ void mips_malta_init(QEMUMachineInitArgs *args)
     }
     fdctrl_init_isa(isa_bus, fd);
 
-    /* Sound card */
-    audio_init();
-
     /* Network card */
     network_init();
 
hw/ppc/prep.c +0 -3
index 82bd27e..59c7da3 100644
@@ -658,9 +658,6 @@ static void ppc_prep_init(QEMUMachineInitArgs *args)
 
     /* Special port to get debug messages from Open-Firmware */
     register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL);
-
-    /* Initialize audio subsystem */
-    audio_init();
 }
 
 static QEMUMachine prep_machine = {
vl.c +2 -0
index 9e56d77..6add2d8 100644
@@ -4256,6 +4256,8 @@ int main(int argc, char **argv, char **envp)
                                  .cpu_model = cpu_model };
     machine->init(&args);
 
+    audio_init();
+
     cpu_synchronize_all_post_init();
 
     set_numa_modes();
Signature · 1 line
1.8.1.4
#15 lore raw
In reply to Paolo Bonzini

Il 18/04/2013 18:43, Paolo Bonzini ha scritto:

Quoted 7 lines

These patches make audio card configuration the same as all other devices, and remove the need to explicitly enable -soundhw on boards that wish to support it.

I would like these in 1.5, malc didn't comment on the RFC. Patches 6-8 are new or different in the final series, everything else is mostly the same.

Ping.

Paolo

Quoted 48 lines

Paolo Bonzini (8):
adlib: qdev-ify
audio: remove the need for audio card CONFIG_* symbols
audio: remove HAS_AUDIO
audio: remove CONFIG_* symbols
audio: replace audio card configuration with default-configs
qom: do not return root for empty path
audio: look for the ISA and PCI buses
audio: enable PCI audio cards for all PCI-enabled targets

 arch_init.c                          | 169 ++++++++++-------------------------
 configure                            |  30 -------
 default-configs/i386-softmmu.mak     |   2 +-
 default-configs/mips-softmmu.mak     |   2 +-
 default-configs/mips64-softmmu.mak   |   2 +-
 default-configs/mips64el-softmmu.mak |   2 +-
 default-configs/mipsel-softmmu.mak   |   2 +-
 default-configs/pci.mak              |   3 +
 default-configs/ppc-softmmu.mak      |   2 +-
 default-configs/ppc64-softmmu.mak    |   2 +-
 default-configs/ppcemb-softmmu.mak   |   2 +-
 default-configs/sound.mak            |   4 +
 default-configs/x86_64-softmmu.mak   |   2 +-
 hmp-commands.hx                      |   4 -
 hw/audio/Makefile.objs               |  16 ++--
 hw/audio/ac97.c                      |   3 +-
 hw/audio/adlib.c                     |  84 +++++++++++++----
 hw/audio/cs4231a.c                   |   3 +-
 hw/audio/es1370.c                    |   3 +-
 hw/audio/gus.c                       |   3 +-
 hw/audio/intel-hda.c                 |  22 ++---
 hw/audio/pcspk.c                     |   4 +-
 hw/audio/sb16.c                      |   3 +-
 hw/i386/pc_piix.c                    |   2 -
 hw/i386/pc_q35.c                     |   1 -
 hw/mips/mips_jazz.c                  |   2 -
 hw/mips/mips_malta.c                 |   3 -
 hw/ppc/prep.c                        |   3 -
 hw/usb/dev-audio.c                   |   1 -
 include/hw/audio/audio.h             |  23 +----
 include/hw/audio/pcspk.h             |   2 -
 include/sysemu/arch_init.h           |   3 +-
 monitor.c                            |   2 -
 qom/object.c                         |  12 +--
 vl.c                                 |  10 +--
 35 files changed, 171 insertions(+), 262 deletions(-)
 create mode 100644 default-configs/sound.mak