From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJdOw-0007oj-Rl for qemu-devel@nongnu.org; Tue, 19 Aug 2014 03:00:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJdOp-000814-Bk for qemu-devel@nongnu.org; Tue, 19 Aug 2014 03:00:14 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:53202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJdOp-0007xE-5v for qemu-devel@nongnu.org; Tue, 19 Aug 2014 03:00:07 -0400 Received: by mail-wg0-f52.google.com with SMTP id a1so5922657wgh.35 for ; Tue, 19 Aug 2014 00:00:05 -0700 (PDT) Message-ID: <53F2F5E6.9020104@linaro.org> Date: Tue, 19 Aug 2014 08:59:50 +0200 From: Eric Auger MIME-Version: 1.0 References: <1407594349-9291-1-git-send-email-eric.auger@linaro.org> <1407594349-9291-11-git-send-email-eric.auger@linaro.org> <53F27627.4030401@amd.com> In-Reply-To: <53F27627.4030401@amd.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 10/10] hw/arm/dyn_sysbus_devtree: enable simple VFIO dynamic instantiation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Joel Schopp , eric.auger@st.com, christoffer.dall@linaro.org, qemu-devel@nongnu.org, kim.phillips@freescale.com, a.rigo@virtualopensystems.com Cc: peter.maydell@linaro.org, patches@linaro.org, will.deacon@arm.com, agraf@suse.de, stuart.yoder@freescale.com, Bharat.Bhushan@freescale.com, alex.williamson@redhat.com, a.motakis@virtualopensystems.com, kvmarm@lists.cs.columbia.edu On 08/18/2014 11:54 PM, Joel Schopp wrote: > > +static void vfio_fdt_add_device_node(SysBusDevice *sbdev, void *opaque) > +{ > + PlatformDevtreeData *data = opaque; > + void *fdt = data->fdt; > + const char *parent_node = data->node; > + int compat_str_len; > + char *nodename; > + int i, ret; > + uint32_t *irq_attr; > + uint64_t *reg_attr; > + uint64_t mmio_base; > + uint64_t irq_number; > + gchar mmio_base_prop[8]; > + gchar irq_number_prop[8]; > + VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev); > + VFIODevice *vbasedev = &vdev->vbasedev; > + Object *obj = OBJECT(sbdev); > + > + mmio_base = object_property_get_int(obj, "mmio[0]", NULL); > + > + nodename = g_strdup_printf("%s/%s@%" PRIx64, parent_node, > + vbasedev->name, > + mmio_base); > + > + qemu_fdt_add_subnode(fdt, nodename); > + > + compat_str_len = strlen(vdev->compat) + 1; > + qemu_fdt_setprop(fdt, nodename, "compatible", > + vdev->compat, compat_str_len); > + > + reg_attr = g_new(uint64_t, vbasedev->num_regions*4); > + > + for (i = 0; i < vbasedev->num_regions; i++) { > + snprintf(mmio_base_prop, sizeof(mmio_base_prop), "mmio[%d]", i); > + mmio_base = object_property_get_int(obj, mmio_base_prop, NULL); > + reg_attr[2*i] = 1; > + reg_attr[2*i+1] = mmio_base; > + reg_attr[2*i+2] = 1; > + reg_attr[2*i+3] = memory_region_size(&vdev->regions[i]->mem); > + } > > This should be 4 instead of 2. Hi Joel, Yes definitively! Forgot to restore the original value after trying different qemu_fdt_setprop_* functions. sorry for that. Best Regards Eric > Also, to support 64 bit systems I think this should be 2 instead of 1. >