+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. Also, to support 64 bit systems I think this should be 2 instead of 1. _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm