From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHCus-0000NN-6V for qemu-devel@nongnu.org; Thu, 07 Jan 2016 10:55:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aHCur-0007hZ-5V for qemu-devel@nongnu.org; Thu, 07 Jan 2016 10:55:58 -0500 Received: from mail-vk0-x22d.google.com ([2607:f8b0:400c:c05::22d]:35088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHCur-0007hR-1J for qemu-devel@nongnu.org; Thu, 07 Jan 2016 10:55:57 -0500 Received: by mail-vk0-x22d.google.com with SMTP id k1so176150289vkb.2 for ; Thu, 07 Jan 2016 07:55:56 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <27dea50e71d768db3752dcad34be0f4c4234fd21.1450570397.git.crosthwaite.peter@gmail.com> References: <27dea50e71d768db3752dcad34be0f4c4234fd21.1450570397.git.crosthwaite.peter@gmail.com> From: Peter Maydell Date: Thu, 7 Jan 2016 15:55:37 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v6 5/6] xlnx-zynqmp: Connect the SPI devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Paolo Bonzini , Peter Crosthwaite , qemu-arm , QEMU Developers , Alistair Francis On 20 December 2015 at 05:43, Peter Crosthwaite wrote: > From: Alistair Francis > > Connect the Xilinx SPI devices to the ZynqMP model. > > Signed-off-by: Alistair Francis > [ PC changes > * Use QOM alias for bus connectivity on SoC level > ] > Signed-off-by: Peter Crosthwaite > @@ -286,6 +300,22 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) > sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci[i]), 0, > gic_spi[sdhci_intr[i]]); > } > + > + for (i = 0; i < XLNX_ZYNQMP_NUM_SPIS; i++) { > + char bus_name[6]; > + > + object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err); > + > + sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_addr[i]); > + sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0, > + gic_spi[spi_intr[i]]); > + > + /* Alias controller SPI bus to the SoC itself */ > + snprintf(bus_name, 6, "spi%d", i); I don't much like these hard coded 6s. This is in init which isn't a hot path, so the simplest thing is to use g_strdup_printf() and then g_free() it when we're done. Similarly in patch 6. Otherwise I like this; I did a quick tweak to my sd card patchset to use this approach and it seems to at least compile and do the right thing in info qtree (I don't have a xilinx test image to do more). Haven't looked at the detail of how we're doing this in patch 1 yet. thanks -- PMM