qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Sparc32/PPC: convert escc to qdev
@ 2009-07-13 19:32 Blue Swirl
       [not found] ` <m3k52c8evv.fsf@neno.mitica>
  0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2009-07-13 19:32 UTC (permalink / raw)
  To: Paul Brook, qemu-devel

Hi,

This patch would convert escc to qdev. Sparc32 works fine, but there
is a problem with PPC, it crashes when the device is remapped by
macio.c.

Any ideas?

(qemu)
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fc64110f700 (LWP 9719)]
subpage_register (mmio=0x2954020, start=<value optimized out>,
    end=<value optimized out>, memory=0x1024600, region_offset=0x0)
    at /src/qemu/exec.c:2946
2946                if (io_mem_read[memory][i]) {
(gdb) bt
#0  subpage_register (mmio=0x2954020, start=<value optimized out>,
    end=<value optimized out>, memory=0x1024600, region_offset=0x0)
    at /src/qemu/exec.c:2946
#1  0x00000000004b51a8 in subpage_init (base=0x80013000, phys=0x273b130,
    orig_memory=0x8123000, region_offset=0x0) at /src/qemu/exec.c:2977
#2  0x00000000004b5403 in cpu_register_physical_memory_offset (
    start_addr=0x80013000, size=0x40, phys_offset=0x10,
    region_offset=0x80013000) at /src/qemu/exec.c:2367
#3  0x0000000000597528 in sysbus_mmio_map (dev=0x266c010, n=0x0,
    addr=0x80813000) at /src/qemu/cpu-common.h:33
#4  0x0000000000445b54 in macio_map (pci_dev=<value optimized out>,
    region_num=<value optimized out>, addr=0x80800000, size=0x210eaa60,
    type=0x0) at /src/qemu/hw/macio.c:66
#5  0x00000000004141e7 in pci_update_mappings (d=0x2671010)
    at /src/qemu/hw/pci.c:495
#6  0x0000000000414373 in pci_default_write_config (d=0x2994048, addr=0x14,
    val=0x0, l=0x2974028) at /src/qemu/hw/pci.c:542
#7  0x0000000041aba675 in ?? ()
#8  0x00007fc600000000 in ?? ()
#9  0x00007fff4923b594 in ?? ()
#10 0x00000000fff0e4b4 in ?? ()
#11 0x0000000000000001 in ?? ()
#12 0x0000000000000000 in ?? ()

---
 hw/escc.c         |  156 ++++++++++++++++++++++++++++++++--------------------
 hw/escc.h         |    6 +-
 hw/macio.c        |   12 ++--
 hw/ppc_mac.h      |    4 +-
 hw/ppc_newworld.c |    9 ++--
 hw/ppc_oldworld.c |    9 ++--
 6 files changed, 118 insertions(+), 78 deletions(-)

diff --git a/hw/escc.c b/hw/escc.c
index 66afbb9..1e0fcb9 100644
--- a/hw/escc.c
+++ b/hw/escc.c
@@ -21,7 +21,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 #include "hw.h"
+#include "sysbus.h"
 #include "escc.h"
 #include "qemu-char.h"
 #include "console.h"
@@ -114,6 +116,7 @@ typedef struct ChannelState {
 } ChannelState;

 struct SerialState {
+    SysBusDevice busdev;
     struct ChannelState chn[2];
     int it_shift;
 };
@@ -719,48 +722,30 @@ static int escc_load(QEMUFile *f, void *opaque,
int version_id)

 }

-int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
-              CharDriverState *chrA, CharDriverState *chrB,
-              int clock, int it_shift)
+SysBusDevice *escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
+                        CharDriverState *chrA, CharDriverState *chrB,
+                        int clock, int it_shift)
 {
-    int escc_io_memory, i;
-    SerialState *s;
-
-    s = qemu_mallocz(sizeof(SerialState));
-
-    escc_io_memory = cpu_register_io_memory(escc_mem_read,
-                                            escc_mem_write,
-                                            s);
-    if (base)
-        cpu_register_physical_memory(base, ESCC_SIZE << it_shift,
-                                     escc_io_memory);
-
-    s->it_shift = it_shift;
-    s->chn[0].chr = chrB;
-    s->chn[1].chr = chrA;
-    s->chn[0].disabled = 0;
-    s->chn[1].disabled = 0;
-    s->chn[0].irq = irqB;
-    s->chn[1].irq = irqA;
-
-    for (i = 0; i < 2; i++) {
-        s->chn[i].chn = 1 - i;
-        s->chn[i].type = ser;
-        s->chn[i].clock = clock / 2;
-        if (s->chn[i].chr) {
-            qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
-                                  serial_receive1, serial_event, &s->chn[i]);
-        }
+    DeviceState *dev;
+    SysBusDevice *s;
+
+    dev = qdev_create(NULL, "escc");
+    qdev_set_prop_int(dev, "disabled", 0);
+    qdev_set_prop_int(dev, "frequency", clock);
+    qdev_set_prop_int(dev, "it_shift", it_shift);
+    qdev_set_prop_ptr(dev, "chrB", chrB);
+    qdev_set_prop_ptr(dev, "chrA", chrA);
+    qdev_set_prop_int(dev, "chnBtype", ser);
+    qdev_set_prop_int(dev, "chnAtype", ser);
+    qdev_init(dev);
+    s = sysbus_from_qdev(dev);
+    sysbus_connect_irq(s, 0, irqA);
+    sysbus_connect_irq(s, 1, irqB);
+    if (base) {
+        sysbus_mmio_map(s, 0, base);
     }
-    s->chn[0].otherchn = &s->chn[1];
-    s->chn[1].otherchn = &s->chn[0];
-    if (base)
-        register_savevm("escc", base, 2, escc_save, escc_load, s);
-    else
-        register_savevm("escc", -1, 2, escc_save, escc_load, s);
-    qemu_register_reset(escc_reset, s);
-    escc_reset(s);
-    return escc_io_memory;
+
+    return s;
 }

 static const uint8_t keycodes[128] = {
@@ -903,35 +888,86 @@ static void sunmouse_event(void *opaque,
 void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
                                int disabled, int clock, int it_shift)
 {
-    int slavio_serial_io_memory, i;
-    SerialState *s;
-
-    s = qemu_mallocz(sizeof(SerialState));
+    DeviceState *dev;
+    SysBusDevice *s;
+
+    dev = qdev_create(NULL, "escc");
+    qdev_set_prop_int(dev, "disabled", disabled);
+    qdev_set_prop_int(dev, "frequency", clock);
+    qdev_set_prop_int(dev, "it_shift", it_shift);
+    qdev_set_prop_ptr(dev, "chrB", NULL);
+    qdev_set_prop_ptr(dev, "chrA", NULL);
+    qdev_set_prop_int(dev, "chnBtype", mouse);
+    qdev_set_prop_int(dev, "chnAtype", kbd);
+    qdev_init(dev);
+    s = sysbus_from_qdev(dev);
+    sysbus_connect_irq(s, 0, irq);
+    sysbus_connect_irq(s, 1, irq);
+    sysbus_mmio_map(s, 0, base);
+}

-    s->it_shift = it_shift;
+static void escc_init1(SysBusDevice *dev)
+{
+    SerialState *s = FROM_SYSBUS(SerialState, dev);
+    int io;
+    unsigned int i;
+    uint32_t clock, disabled;
+
+    s->it_shift = qdev_get_prop_int(&dev->qdev, "it_shift", 0);
+    clock = qdev_get_prop_int(&dev->qdev, "clock", 0);
+    s->chn[0].chr = qdev_get_prop_ptr(&dev->qdev, "chrB");
+    s->chn[1].chr = qdev_get_prop_ptr(&dev->qdev, "chrA");
+    disabled = qdev_get_prop_int(&dev->qdev, "disabled", 0);
+    s->chn[0].disabled = disabled;
+    s->chn[1].disabled = disabled;
     for (i = 0; i < 2; i++) {
-        s->chn[i].irq = irq;
+        sysbus_init_irq(dev, &s->chn[i].irq);
         s->chn[i].chn = 1 - i;
-        s->chn[i].chr = NULL;
         s->chn[i].clock = clock / 2;
+        if (s->chn[i].chr) {
+            qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
+                                  serial_receive1, serial_event, &s->chn[i]);
+        }
     }
     s->chn[0].otherchn = &s->chn[1];
     s->chn[1].otherchn = &s->chn[0];
-    s->chn[0].type = mouse;
-    s->chn[1].type = kbd;
-    s->chn[0].disabled = disabled;
-    s->chn[1].disabled = disabled;
+    s->chn[0].type = qdev_get_prop_int(&dev->qdev, "chnBtype", 0);
+    s->chn[1].type = qdev_get_prop_int(&dev->qdev, "chnAtype", 0);

-    slavio_serial_io_memory = cpu_register_io_memory(escc_mem_read,
-                                                     escc_mem_write,
-                                                     s);
-    cpu_register_physical_memory(base, ESCC_SIZE << it_shift,
-                                 slavio_serial_io_memory);
+    io = cpu_register_io_memory(escc_mem_read, escc_mem_write, s);
+    sysbus_init_mmio(dev, ESCC_SIZE << s->it_shift, io);

-    qemu_add_mouse_event_handler(sunmouse_event, &s->chn[0], 0,
-                                 "QEMU Sun Mouse");
-    qemu_add_kbd_event_handler(sunkbd_event, &s->chn[1]);
-    register_savevm("slavio_serial_mouse", base, 2, escc_save, escc_load, s);
+    if (s->chn[0].type == mouse) {
+        qemu_add_mouse_event_handler(sunmouse_event, &s->chn[0], 0,
+                                     "QEMU Sun Mouse");
+    }
+    if (s->chn[1].type == kbd) {
+        qemu_add_kbd_event_handler(sunkbd_event, &s->chn[1]);
+    }
+    register_savevm("escc", -1, 2, escc_save, escc_load, s);
     qemu_register_reset(escc_reset, s);
     escc_reset(s);
 }
+
+static SysBusDeviceInfo escc_info = {
+    .init = escc_init1,
+    .qdev.name  = "escc",
+    .qdev.size  = sizeof(SerialState),
+    .qdev.props = (DevicePropList[]) {
+        {.name = "frequency", .type = PROP_TYPE_INT},
+        {.name = "it_shift", .type = PROP_TYPE_INT},
+        {.name = "disabled", .type = PROP_TYPE_INT},
+        {.name = "chrB", .type = PROP_TYPE_PTR},
+        {.name = "chrA", .type = PROP_TYPE_PTR},
+        {.name = "chnBtype", .type = PROP_TYPE_INT},
+        {.name = "chnAtype", .type = PROP_TYPE_INT},
+        {.name = NULL}
+    }
+};
+
+static void escc_register_devices(void)
+{
+    sysbus_register_withprop(&escc_info);
+}
+
+device_init(escc_register_devices)
diff --git a/hw/escc.h b/hw/escc.h
index 015b9d0..7d814a1 100644
--- a/hw/escc.h
+++ b/hw/escc.h
@@ -1,8 +1,8 @@
 /* escc.c */
 #define ESCC_SIZE 4
-int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
-              CharDriverState *chrA, CharDriverState *chrB,
-              int clock, int it_shift);
+SysBusDevice *escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
+                        CharDriverState *chrA, CharDriverState *chrB,
+                        int clock, int it_shift);

 void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
                                int disabled, int clock, int it_shift);
diff --git a/hw/macio.c b/hw/macio.c
index 8cfadfc..7db53ef 100644
--- a/hw/macio.c
+++ b/hw/macio.c
@@ -25,6 +25,7 @@
 #include "hw.h"
 #include "ppc_mac.h"
 #include "pci.h"
+#include "sysbus.h"
 #include "escc.h"

 typedef struct macio_state_t macio_state_t;
@@ -33,7 +34,7 @@ struct macio_state_t {
     int pic_mem_index;
     int dbdma_mem_index;
     int cuda_mem_index;
-    int escc_mem_index;
+    SysBusDevice *escc;
     void *nvram;
     int nb_ide;
     int ide_mem_index[4];
@@ -61,9 +62,8 @@ static void macio_map (PCIDevice *pci_dev, int region_num,
         cpu_register_physical_memory(addr + 0x08000, 0x1000,
                                      macio_state->dbdma_mem_index);
     }
-    if (macio_state->escc_mem_index >= 0) {
-        cpu_register_physical_memory(addr + 0x13000, ESCC_SIZE << 4,
-                                     macio_state->escc_mem_index);
+    if (macio_state->escc) {
+        sysbus_mmio_map(macio_state->escc, 0, addr + 0x13000);
     }
     if (macio_state->cuda_mem_index >= 0) {
         cpu_register_physical_memory(addr + 0x16000, 0x2000,
@@ -81,7 +81,7 @@ static void macio_map (PCIDevice *pci_dev, int region_num,

 void macio_init (PCIBus *bus, int device_id, int is_oldworld, int
pic_mem_index,
                  int dbdma_mem_index, int cuda_mem_index, void *nvram,
-                 int nb_ide, int *ide_mem_index, int escc_mem_index)
+                 int nb_ide, int *ide_mem_index, SysBusDevice *escc)
 {
     PCIDevice *d;
     macio_state_t *macio_state;
@@ -95,7 +95,7 @@ void macio_init (PCIBus *bus, int device_id, int
is_oldworld, int pic_mem_index,
     macio_state->pic_mem_index = pic_mem_index;
     macio_state->dbdma_mem_index = dbdma_mem_index;
     macio_state->cuda_mem_index = cuda_mem_index;
-    macio_state->escc_mem_index = escc_mem_index;
+    macio_state->escc = escc;
     macio_state->nvram = nvram;
     if (nb_ide > 4)
         nb_ide = 4;
diff --git a/hw/ppc_mac.h b/hw/ppc_mac.h
index dc39338..55d2f4a 100644
--- a/hw/ppc_mac.h
+++ b/hw/ppc_mac.h
@@ -25,6 +25,8 @@
 #if !defined(__PPC_MAC_H__)
 #define __PPC_MAC_H__

+#include "sysbus.h"
+
 /* SMP is not enabled, for now */
 #define MAX_CPUS 1

@@ -47,7 +49,7 @@ void cuda_init (int *cuda_mem_index, qemu_irq irq);
 /* MacIO */
 void macio_init (PCIBus *bus, int device_id, int is_oldworld, int
pic_mem_index,
                  int dbdma_mem_index, int cuda_mem_index, void *nvram,
-                 int nb_ide, int *ide_mem_index, int escc_mem_index);
+                 int nb_ide, int *ide_mem_index, SysBusDevice *escc);

 /* NewWorld PowerMac IDE */
 int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq,
diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index 4e5043c..e54a854 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -104,7 +104,8 @@ static void ppc_core99_init (ram_addr_t ram_size,
     int nvram_mem_index;
     int vga_bios_size, bios_size;
     qemu_irq *dummy_irq;
-    int pic_mem_index, dbdma_mem_index, cuda_mem_index, escc_mem_index;
+    int pic_mem_index, dbdma_mem_index, cuda_mem_index;
+    SysBusDevice *escc;
     int ppc_boot_device;
     int index;
     BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
@@ -300,8 +301,8 @@ static void ppc_core99_init (ram_addr_t ram_size,
     /* XXX: suppress that */
     dummy_irq = i8259_init(NULL);

-    escc_mem_index = escc_init(0x80013000, dummy_irq[4], dummy_irq[5],
-                               serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
+    escc = escc_init(0x80013000, dummy_irq[4], dummy_irq[5],
+                     serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);

     for(i = 0; i < nb_nics; i++)
         pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
@@ -329,7 +330,7 @@ static void ppc_core99_init (ram_addr_t ram_size,

     macio_init(pci_bus, PCI_DEVICE_ID_APPLE_UNI_N_KEYL, 0, pic_mem_index,
                dbdma_mem_index, cuda_mem_index, NULL, 0, NULL,
-               escc_mem_index);
+               escc);

     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index b26e407..26be95c 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -132,7 +132,8 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
     MacIONVRAMState *nvr;
     int vga_bios_size, bios_size;
     int pic_mem_index, nvram_mem_index, dbdma_mem_index, cuda_mem_index;
-    int escc_mem_index, ide_mem_index[2];
+    int ide_mem_index[2];
+    SysBusDevice *escc;
     uint16_t ppc_boot_device;
     BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     int index;
@@ -311,8 +312,8 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
     pci_bus = pci_grackle_init(0xfec00000, pic);
     pci_vga_init(pci_bus, vga_bios_offset, vga_bios_size);

-    escc_mem_index = escc_init(0x80013000, pic[0x0f], pic[0x10], serial_hds[0],
-                               serial_hds[1], ESCC_CLOCK, 4);
+    escc = escc_init(0x80013000, pic[0x0f], pic[0x10], serial_hds[0],
+                     serial_hds[1], ESCC_CLOCK, 4);

     for(i = 0; i < nb_nics; i++)
         pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
@@ -363,7 +364,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,

     macio_init(pci_bus, PCI_DEVICE_ID_APPLE_343S1201, 1, pic_mem_index,
                dbdma_mem_index, cuda_mem_index, nvr, 2, ide_mem_index,
-               escc_mem_index);
+               escc);

     if (usb_enabled) {
         usb_ohci_init_pci(pci_bus, 3, -1);
-- 
1.5.6.5

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

* [Qemu-devel] Re: [PATCH] Sparc32/PPC: convert escc to qdev
       [not found] ` <m3k52c8evv.fsf@neno.mitica>
@ 2009-07-14 18:54   ` Blue Swirl
  2009-07-14 22:03     ` Juan Quintela
  0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2009-07-14 18:54 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Paul Brook, qemu-devel

On 7/14/09, Juan Quintela <quintela@trasno.org> wrote:
> Blue Swirl <blauwirbel@gmail.com> wrote:
>  > Hi,
>  >
>  > This patch would convert escc to qdev. Sparc32 works fine, but there
>  > is a problem with PPC, it crashes when the device is remapped by
>  > macio.c.
>  > Any ideas?
>
>
> From my ignorance:
>
>
>  > -        s->chn[i].chn = 1 - i;
>  > -        s->chn[i].type = ser;
>  > -        s->chn[i].clock = clock / 2;
>
>  clock = clock /2
>
>  > -        if (s->chn[i].chr) {
>  > -            qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
>  > -                                  serial_receive1, serial_event, &s->chn[i]);
>  > -        }
>  > +    DeviceState *dev;
>  > +    SysBusDevice *s;
>  > +
>  > +    dev = qdev_create(NULL, "escc");
>  > +    qdev_set_prop_int(dev, "disabled", 0);
>  > +    qdev_set_prop_int(dev, "frequency", clock);
>
>
> we set frequency with clock value (notice not clock/2)
>
>
>  > +    qdev_set_prop_int(dev, "it_shift", it_shift);
>  > +    qdev_set_prop_ptr(dev, "chrB", chrB);
>  > +    qdev_set_prop_ptr(dev, "chrA", chrA);
>  > +    qdev_set_prop_int(dev, "chnBtype", ser);
>  > +    qdev_set_prop_int(dev, "chnAtype", ser);
>  > +    qdev_init(dev);
>  > +    s = sysbus_from_qdev(dev);
>  > +    sysbus_connect_irq(s, 0, irqA);
>  > +    sysbus_connect_irq(s, 1, irqB);
>  > +    if (base) {
>  > +        sysbus_mmio_map(s, 0, base);
>  >      }
>  > -    s->chn[0].otherchn = &s->chn[1];
>  > -    s->chn[1].otherchn = &s->chn[0];
>  > -    if (base)
>  > -        register_savevm("escc", base, 2, escc_save, escc_load, s);
>  > -    else
>  > -        register_savevm("escc", -1, 2, escc_save, escc_load, s);
>  > -    qemu_register_reset(escc_reset, s);
>  > -    escc_reset(s);
>  > -    return escc_io_memory;
>  > +
>  > +    return s;
>  >  }
>  >
>  >  static const uint8_t keycodes[128] = {
>  > @@ -903,35 +888,86 @@ static void sunmouse_event(void *opaque,
>  >  void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
>  >                                 int disabled, int clock, int it_shift)
>  >  {
>  > -    int slavio_serial_io_memory, i;
>  > -    SerialState *s;
>  > -
>  > -    s = qemu_mallocz(sizeof(SerialState));
>  > +    DeviceState *dev;
>  > +    SysBusDevice *s;
>  > +
>  > +    dev = qdev_create(NULL, "escc");
>  > +    qdev_set_prop_int(dev, "disabled", disabled);
>  > +    qdev_set_prop_int(dev, "frequency", clock);
>
>
> We set frequency with clock value (not clock/2 either)
>
>
>  > +    qdev_set_prop_int(dev, "it_shift", it_shift);
>  > +    qdev_set_prop_ptr(dev, "chrB", NULL);
>  > +    qdev_set_prop_ptr(dev, "chrA", NULL);
>  > +    qdev_set_prop_int(dev, "chnBtype", mouse);
>  > +    qdev_set_prop_int(dev, "chnAtype", kbd);
>  > +    qdev_init(dev);
>  > +    s = sysbus_from_qdev(dev);
>  > +    sysbus_connect_irq(s, 0, irq);
>  > +    sysbus_connect_irq(s, 1, irq);
>  > +    sysbus_mmio_map(s, 0, base);
>  > +}
>  >
>  > -    s->it_shift = it_shift;
>  > +static void escc_init1(SysBusDevice *dev)
>  > +{
>  > +    SerialState *s = FROM_SYSBUS(SerialState, dev);
>  > +    int io;
>  > +    unsigned int i;
>  > +    uint32_t clock, disabled;
>  > +
>  > +    s->it_shift = qdev_get_prop_int(&dev->qdev, "it_shift", 0);
>  > +    clock = qdev_get_prop_int(&dev->qdev, "clock", 0);
>
>
> We get in clock the "clock" value not the "frequency" one, and no hint
>  of the /2

The division is performed a few lines later. Actually we should do the
division in compile time, the numbers are fixed constants.

> > +    .qdev.props = (DevicePropList[]) {
>  > +        {.name = "frequency", .type = PROP_TYPE_INT},
>
>
> It is really called "frequency".

I don't know, it's the crystal frequency for serial baud rate
generator, different for PPC and Sparc. The property is not visible in
OpenFirmware tree so we can pick up any name. Timer speeds are often
exported with "clock-frequency" property, maybe that's more
consistent.

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

* [Qemu-devel] Re: [PATCH] Sparc32/PPC: convert escc to qdev
  2009-07-14 18:54   ` [Qemu-devel] " Blue Swirl
@ 2009-07-14 22:03     ` Juan Quintela
  2009-07-15 14:47       ` Blue Swirl
  0 siblings, 1 reply; 5+ messages in thread
From: Juan Quintela @ 2009-07-14 22:03 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Paul Brook, qemu-devel

Blue Swirl <blauwirbel@gmail.com> wrote:
> On 7/14/09, Juan Quintela <quintela@trasno.org> wrote:
>> Blue Swirl <blauwirbel@gmail.com> wrote:

I didn't explain myself enough, I guess.

>>  > +    qdev_set_prop_int(dev, "frequency", clock);
                                   ^^^^^^^^^
....
>>  > +    clock = qdev_get_prop_int(&dev->qdev, "clock", 0);
                                                  ^^^^^

You are setting a property named "frequency" and read a property named
"clock" :)  I just asked to use the same property in both places.

Later, Juan.

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

* [Qemu-devel] Re: [PATCH] Sparc32/PPC: convert escc to qdev
  2009-07-14 22:03     ` Juan Quintela
@ 2009-07-15 14:47       ` Blue Swirl
  2009-07-15 15:37         ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2009-07-15 14:47 UTC (permalink / raw)
  To: Juan Quintela; +Cc: Paul Brook, qemu-devel

On 7/15/09, Juan Quintela <quintela@redhat.com> wrote:
> Blue Swirl <blauwirbel@gmail.com> wrote:
>  > On 7/14/09, Juan Quintela <quintela@trasno.org> wrote:
>  >> Blue Swirl <blauwirbel@gmail.com> wrote:
>
>
> I didn't explain myself enough, I guess.
>
>
>  >>  > +    qdev_set_prop_int(dev, "frequency", clock);
>
>                                    ^^^^^^^^^
>  ....
>
> >>  > +    clock = qdev_get_prop_int(&dev->qdev, "clock", 0);
>
>                                                   ^^^^^
>
>  You are setting a property named "frequency" and read a property named
>  "clock" :)  I just asked to use the same property in both places.

I see, thanks. Maybe an attempt to use an undeclared property should
raise an abort().

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

* Re: [Qemu-devel] Re: [PATCH] Sparc32/PPC: convert escc to qdev
  2009-07-15 14:47       ` Blue Swirl
@ 2009-07-15 15:37         ` Gerd Hoffmann
  0 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2009-07-15 15:37 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel, Paul Brook, Juan Quintela

On 07/15/09 16:47, Blue Swirl wrote:
>>   >>   >  +    qdev_set_prop_int(dev, "frequency", clock);
>>>>   >  +    clock = qdev_get_prop_int(&dev->qdev, "clock", 0);

> I see, thanks. Maybe an attempt to use an undeclared property should
> raise an abort().

Once my qdev property monster patch is finally merged it all will be 
there.  get_prop() is not needed any more, and set_prop works only for 
explicitly defined properties.

cheers,
   Gerd

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

end of thread, other threads:[~2009-07-15 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-13 19:32 [Qemu-devel] [PATCH] Sparc32/PPC: convert escc to qdev Blue Swirl
     [not found] ` <m3k52c8evv.fsf@neno.mitica>
2009-07-14 18:54   ` [Qemu-devel] " Blue Swirl
2009-07-14 22:03     ` Juan Quintela
2009-07-15 14:47       ` Blue Swirl
2009-07-15 15:37         ` Gerd Hoffmann

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