Skip to content
  • schspa's avatar
    819b3496
    virtio-mmio: improve virtio-mmio get_dev_path alog · 819b3496
    schspa authored
    
    
    At the moment the following QEMU command line triggers an assertion
    failure On xlnx-versal SOC:
      qemu-system-aarch64 \
          -machine xlnx-versal-virt -nographic -smp 2 -m 128 \
          -fsdev local,id=shareid,path=${HOME}/work,security_model=none \
          -device virtio-9p-device,fsdev=shareid,mount_tag=share \
          -fsdev local,id=shareid1,path=${HOME}/Music,security_model=none \
          -device virtio-9p-device,fsdev=shareid1,mount_tag=share1
    
      qemu-system-aarch64: ../migration/savevm.c:860:
      vmstate_register_with_alias_id:
      Assertion `!se->compat || se->instance_id == 0' failed.
    
    This problem was fixed on arm virt platform in commit f58b39d2
    ("virtio-mmio: format transport base address in BusClass.get_dev_path")
    
    It works perfectly on arm virt platform. but there is still there on
    xlnx-versal SOC.
    
    The main difference between arm virt and xlnx-versal is they use
    different way to create virtio-mmio qdev. on arm virt, it calls
    sysbus_create_simple("virtio-mmio", base, pic[irq]); which will call
    sysbus_mmio_map internally and assign base address to subsys device
    mmio correctly. but xlnx-versal's implements won't do this.
    
    However, xlnx-versal can't switch to sysbus_create_simple() to create
    virtio-mmio device. It's because xlnx-versal's cpu use
    VersalVirt.soc.fpd.apu.mr as it's memory. which is subregion of
    system_memory. sysbus_create_simple will add virtio to system_memory,
    which can't be accessed by cpu.
    
    Besides, xlnx-versal can't add sysbus_mmio_map api call too, because
    this will add memory region to system_memory, and it can't be added
    to VersalVirt.soc.fpd.apu.mr again.
    
    We can solve this by assign correct base address offset on dev_path.
    
    This path was test on aarch64 virt & xlnx-versal platform.
    
    Signed-off-by: default avatarschspa <schspa@gmail.com>
    Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    819b3496
    virtio-mmio: improve virtio-mmio get_dev_path alog
    schspa authored
    
    
    At the moment the following QEMU command line triggers an assertion
    failure On xlnx-versal SOC:
      qemu-system-aarch64 \
          -machine xlnx-versal-virt -nographic -smp 2 -m 128 \
          -fsdev local,id=shareid,path=${HOME}/work,security_model=none \
          -device virtio-9p-device,fsdev=shareid,mount_tag=share \
          -fsdev local,id=shareid1,path=${HOME}/Music,security_model=none \
          -device virtio-9p-device,fsdev=shareid1,mount_tag=share1
    
      qemu-system-aarch64: ../migration/savevm.c:860:
      vmstate_register_with_alias_id:
      Assertion `!se->compat || se->instance_id == 0' failed.
    
    This problem was fixed on arm virt platform in commit f58b39d2
    ("virtio-mmio: format transport base address in BusClass.get_dev_path")
    
    It works perfectly on arm virt platform. but there is still there on
    xlnx-versal SOC.
    
    The main difference between arm virt and xlnx-versal is they use
    different way to create virtio-mmio qdev. on arm virt, it calls
    sysbus_create_simple("virtio-mmio", base, pic[irq]); which will call
    sysbus_mmio_map internally and assign base address to subsys device
    mmio correctly. but xlnx-versal's implements won't do this.
    
    However, xlnx-versal can't switch to sysbus_create_simple() to create
    virtio-mmio device. It's because xlnx-versal's cpu use
    VersalVirt.soc.fpd.apu.mr as it's memory. which is subregion of
    system_memory. sysbus_create_simple will add virtio to system_memory,
    which can't be accessed by cpu.
    
    Besides, xlnx-versal can't add sysbus_mmio_map api call too, because
    this will add memory region to system_memory, and it can't be added
    to VersalVirt.soc.fpd.apu.mr again.
    
    We can solve this by assign correct base address offset on dev_path.
    
    This path was test on aarch64 virt & xlnx-versal platform.
    
    Signed-off-by: default avatarschspa <schspa@gmail.com>
    Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Loading