qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] hw/dma/pl330: Factor out pl330_init() from


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 2/3] hw/dma/pl330: Factor out pl330_init() from hw/arm/xilinx_zynq.c
Date: Tue, 30 Oct 2018 09:35:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 30/10/18 9:18, Richard Henderson wrote:
On 10/29/18 11:20 PM, Philippe Mathieu-Daudé wrote:
+static inline void pl330_init(uint32_t base, qemu_irq irq, int nreq)
+{
+    SysBusDevice *busdev;
+    DeviceState *dev;
+
+    dev = qdev_create(NULL, TYPE_PL330);
+    qdev_prop_set_uint8(dev, "num_chnls", 8);
+    qdev_prop_set_uint8(dev, "num_periph_req", nreq);
+    qdev_prop_set_uint8(dev, "num_events", 16);
+    qdev_prop_set_uint8(dev, "data_width", 64);
+    qdev_prop_set_uint8(dev, "wr_cap", 8);
+    qdev_prop_set_uint8(dev, "wr_q_dep", 16);
+    qdev_prop_set_uint8(dev, "rd_cap", 8);
+    qdev_prop_set_uint8(dev, "rd_q_dep", 16);
+    qdev_prop_set_uint16(dev, "data_buffer_dep", 256);
+    qdev_init_nofail(dev);
+
+    busdev = SYS_BUS_DEVICE(dev);
+    sysbus_mmio_map(busdev, 0, base);
+    sysbus_connect_irq(busdev, 0, irq);
+}

Why is this inline instead of in hw/dma/pl300.c?
There should be nothing performance sensative here...

Yeah I didn't like it much neither and wondered the same :)
I was looking a examples in hw/char:

address@hidden qemu]$ git grep -hA 2 'static inline' include/hw/char/
52:static inline DeviceState *cadence_uart_create(hwaddr addr,
53-                                        qemu_irq irq,
54-                                        Chardev *chr)
--
52:static inline DeviceState *cmsdk_apb_uart_create(hwaddr addr,
53-                                                 qemu_irq txint,
54-                                                 qemu_irq rxint,
--
18:static inline DeviceState *pl011_create(hwaddr addr,
19-                                        qemu_irq irq,
20-                                        Chardev *chr)
--
35:static inline DeviceState *pl011_luminary_create(hwaddr addr,
36-                                                 qemu_irq irq,
37-                                                 Chardev *chr)
--
18:static inline DeviceState *xilinx_uartlite_create(hwaddr addr,
19-                                        qemu_irq irq,
20-                                        Chardev *chr)

I'll clean it and add a docstring.

Thanks for the review,

Phil.



reply via email to

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