Christian Svensson
2014-07-19 22:04:31 UTC
Hi,
I thought I would share this in case if anyone else wants to run Linux
workloads faster than or1ksim and not use qemu-user.
First, the virtio-mmio driver seems to be LE, so fix that and add the
device to the device tree*.
https://github.com/bluecmd/or1k-linux/commit/c458c4837e805973e2fd7092caf7da2d47c4fb6c
For qemu, you will need this patch:
https://github.com/bluecmd/or1k-qemu/commit/8bd5a11ec8f0f11849f8a14b9aa9ab5af77a12ff
Again, make sure to add the correct number of devices that you need
here and that you enable CONFIG_VIRTIO_MMIO, CONFIG_VIRTIO_BLK and/or
CONFIG_NET_9P_VIRTIO).
My config file for reference:
https://github.com/bluecmd/or1k-devel/blob/master/Linux-config
Now you can start this with:
qemu-system-or32 -drive if=none,file=$IMAGE,id=hda \
-device virtio-blk-device,drive=hda \
-m 128 -nographic \
-kernel vmlinux
If you want to use 9p resource sharing, called virtfs (think NFS/CIFS
but fast and done through virtio) - you can do so by adding this:
-fsdev local,id=devel,path=/tmp/mydir,security_model=passthrough \
-device virtio-9p-device,mount_tag=devel,fsdev=devel
Don't forget to mount it: mount -t 9p devel -o trans=virtio /mnt
Read more about virtfs here: http://wiki.qemu.org/Documentation/9psetup
And as always, a screencast of this in action: https://asciinema.org/a/10885
* Just add more devices if you need more drives. I have configured
mine for 4 devices where I use one for virtio-blk and one for 9p.
I thought I would share this in case if anyone else wants to run Linux
workloads faster than or1ksim and not use qemu-user.
First, the virtio-mmio driver seems to be LE, so fix that and add the
device to the device tree*.
https://github.com/bluecmd/or1k-linux/commit/c458c4837e805973e2fd7092caf7da2d47c4fb6c
For qemu, you will need this patch:
https://github.com/bluecmd/or1k-qemu/commit/8bd5a11ec8f0f11849f8a14b9aa9ab5af77a12ff
Again, make sure to add the correct number of devices that you need
here and that you enable CONFIG_VIRTIO_MMIO, CONFIG_VIRTIO_BLK and/or
CONFIG_NET_9P_VIRTIO).
My config file for reference:
https://github.com/bluecmd/or1k-devel/blob/master/Linux-config
Now you can start this with:
qemu-system-or32 -drive if=none,file=$IMAGE,id=hda \
-device virtio-blk-device,drive=hda \
-m 128 -nographic \
-kernel vmlinux
If you want to use 9p resource sharing, called virtfs (think NFS/CIFS
but fast and done through virtio) - you can do so by adding this:
-fsdev local,id=devel,path=/tmp/mydir,security_model=passthrough \
-device virtio-9p-device,mount_tag=devel,fsdev=devel
Don't forget to mount it: mount -t 9p devel -o trans=virtio /mnt
Read more about virtfs here: http://wiki.qemu.org/Documentation/9psetup
And as always, a screencast of this in action: https://asciinema.org/a/10885
* Just add more devices if you need more drives. I have configured
mine for 4 devices where I use one for virtio-blk and one for 9p.