qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/3] spapr: proper qdevification


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH v2 1/3] spapr: proper qdevification
Date: Thu, 07 Jul 2011 16:10:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Thunderbird/3.1.8

On 05/26/2011 11:52 AM, Paolo Bonzini wrote:
Right now the spapr devices cannot be instantiated with -device,
because the IRQs need to be passed to the spapr_*_create functions.
Do this instead in the bus's init wrapper.

This is particularly important with the conversion from scsi-disk
to scsi-{cd,hd} that Markus made.  After his patches, if you
specify a scsi-cd device attached to an if=none drive, the default
VSCSI controller will not be created and, without qdevification,
you will not be able to add yours.

Signed-off-by: Paolo Bonzini<address@hidden>
Cc: Alexander Graf<address@hidden>
Cc: David Gibson<address@hidden>
---
  hw/spapr.c       |   15 +++++----------
  hw/spapr.h       |    6 ++++++
  hw/spapr_llan.c  |    7 +------
  hw/spapr_vio.c   |    5 +++++
  hw/spapr_vio.h   |   13 ++++---------
  hw/spapr_vscsi.c |    8 +-------
  hw/spapr_vty.c   |    8 +-------
  7 files changed, 23 insertions(+), 39 deletions(-)

diff --git a/hw/spapr.c b/hw/spapr.c
index 109b774..07b2165 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -298,7 +298,6 @@ static void ppc_spapr_init(ram_addr_t ram_size,
      long kernel_size, initrd_size, fw_size;
      long pteg_shift = 17;
      char *filename;
-    int irq = 16;

      spapr = qemu_malloc(sizeof(*spapr));
      cpu_ppc_hypercall = emulate_spapr_hypercall;
@@ -360,15 +359,14 @@ static void ppc_spapr_init(ram_addr_t ram_size,
      /* Set up VIO bus */
      spapr->vio_bus = spapr_vio_bus_init();

-    for (i = 0; i<  MAX_SERIAL_PORTS; i++, irq++) {
+    for (i = 0; i<  MAX_SERIAL_PORTS; i++) {
          if (serial_hds[i]) {
              spapr_vty_create(spapr->vio_bus, SPAPR_VTY_BASE_ADDRESS + i,
-                             serial_hds[i], xics_find_qirq(spapr->icp, irq),
-                             irq);
+                             serial_hds[i]);
          }
      }

-    for (i = 0; i<  nb_nics; i++, irq++) {
+    for (i = 0; i<  nb_nics; i++) {
          NICInfo *nd =&nd_table[i];

          if (!nd->model) {
@@ -376,8 +374,7 @@ static void ppc_spapr_init(ram_addr_t ram_size,
          }

          if (strcmp(nd->model, "ibmveth") == 0) {
-            spapr_vlan_create(spapr->vio_bus, 0x1000 + i, nd,
-                              xics_find_qirq(spapr->icp, irq), irq);
+            spapr_vlan_create(spapr->vio_bus, 0x1000 + i, nd);
          } else {
              fprintf(stderr, "pSeries (sPAPR) platform does not support "
                      "NIC model '%s' (only ibmveth is supported)\n",
@@ -387,9 +384,7 @@ static void ppc_spapr_init(ram_addr_t ram_size,
      }

      for (i = 0; i<= drive_get_max_bus(IF_SCSI); i++) {
-        spapr_vscsi_create(spapr->vio_bus, 0x2000 + i,
-                           xics_find_qirq(spapr->icp, irq), irq);
-        irq++;
+        spapr_vscsi_create(spapr->vio_bus, 0x2000 + i);
      }

      if (kernel_filename) {
diff --git a/hw/spapr.h b/hw/spapr.h
index b52133a..4130c13 100644
--- a/hw/spapr.h
+++ b/hw/spapr.h
@@ -278,6 +278,12 @@ void spapr_register_hypercall(target_ulong opcode, 
spapr_hcall_fn fn);
  target_ulong spapr_hypercall(CPUState *env, target_ulong opcode,
                               target_ulong *args);

+static inline qemu_irq *spapr_find_qirq(sPAPREnvironment *spapr,
+                                        int irq_num)
+{
+    return xics_find_qirq(spapr->icp, irq_num);
+}
+

This breaks with current HEAD. I've added a fix to my tree:

diff --git a/hw/spapr.h b/hw/spapr.h
index 4130c13..a725d4a 100644
--- a/hw/spapr.h
+++ b/hw/spapr.h
@@ -1,6 +1,8 @@
 #if !defined(__HW_SPAPR_H__)
 #define __HW_SPAPR_H__

+#include "hw/xics.h"
+
 struct VIOsPAPRBus;
 struct icp_state;

@@ -278,7 +280,7 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn);
 target_ulong spapr_hypercall(CPUState *env, target_ulong opcode,
                              target_ulong *args);

-static inline qemu_irq *spapr_find_qirq(sPAPREnvironment *spapr,
+static inline qemu_irq spapr_find_qirq(sPAPREnvironment *spapr,
                                         int irq_num)
 {
     return xics_find_qirq(spapr->icp, irq_num);


Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]