|
From: | root artifice |
Subject: | Adding device support in aarch64 virt board |
Date: | Thu, 22 Oct 2020 00:17:50 +0000 |
Hi all, I’d like to add I2C support for aarch64 virt board. So I modified hw/arm/virt.c as follows.
dev = sysbus_create_simple(TYPE_VERSATILE_I2C, vms->memmap[VIRT_I2C].base, NULL); i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "sii9022", 0x39);
nodename = g_strdup_printf("/i2c@%" PRIx64, base); qemu_fdt_add_subnode(vms->fdt, nodename); qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "arm,versatile-i2c"); qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", 1, base, 1, size); After modification, QEMU can compile successfully. However, when I run it (qemu-system-aarch64 -M virt -m 2048 -cpu cortex-a53 -kernel ./Image -nographic -hda rootfs.ext2 --append "root=/dev/vda"), I got the following
error:
The assertion exists in qemu-5.1.0\softmmu\memory.c: memory_region_add_subregion_common() and is triggered by dev = sysbus_create_simple(TYPE_VERSATILE_I2C, vms->memmap[VIRT_I2C].base, NULL);. I think it means I’m
using a memory region that has been used. But I think the memory region in base_memap I’ve chosen is available. Besides, the assertion
“subregion->container” is derived from dev = qdev_new(name) (located in hw/core/sysbus.c), which I have no control over when calling sysbus_create_simple(). Could someone tell me which part is wrong? Any help is appreciated. Thanks in advance. Regards, Weiqi |
[Prev in Thread] | Current Thread | [Next in Thread] |