Patchwork [7/8] audio: look for the ISA and PCI buses

login
register
mail settings
Submitter Paolo Bonzini
Date April 18, 2013, 4:44 p.m.
Message ID <1366303444-24620-8-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/237684/
State New
Headers show

Comments

Paolo Bonzini - April 18, 2013, 4:44 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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(-)
Andreas Färber - April 30, 2013, 12:16 p.m.
Am 18.04.2013 18:44, schrieb Paolo Bonzini:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  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(-)
> 
[...]
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 943758a..1953d8c 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -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
Alexander Graf - April 30, 2013, 12:52 p.m.
On 04/18/2013 06:44 PM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   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(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 88b74c0..cbcb3ed 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -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
Paolo Bonzini - April 30, 2013, 2 p.m.
Il 30/04/2013 14:16, Andreas Färber ha scritto:
> 
> 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.

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

> 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
Anthony Liguori - April 30, 2013, 2:39 p.m.
Paolo Bonzini <pbonzini@redhat.com> writes:

> Il 30/04/2013 14:16, Andreas Färber ha scritto:
>> 
>> 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.
>
> 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.


>
>> 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

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

Patch

diff --git a/arch_init.c b/arch_init.c
index 88b74c0..cbcb3ed 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -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);
             }
         }
     }
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 943758a..1953d8c 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -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);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 6ac1a89..76c378b 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -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);
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index fd3a5f9..822d300 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -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");
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 86f42b2..a2d01e1 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -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();
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index cceab3e..82bd27e 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -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 = {
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index f18de33..dece913 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -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);