mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.63k stars 2.4k forks source link

port virtio_disk to virtio spec 1.0+ #90

Closed xiw closed 1 year ago

xiw commented 2 years ago

The virtio_disk driver currently implements the legacy interface, which is both confusing and outdated. The information about legacy interface is scattered in the spec (often in multiple places tagged "legacy interface"). This makes it hard to match the xv6 code with the virtio spec (or for students to extend xv6 with more virtio drivers).

This patch makes virtio_disk conform to the virtio spec (1.0+). This is supported in QEMU since 4.2.

For simplicity, this implementation allocates separate pages for desc/avail/used (one for each area). It also removes some alignment restrictions.

kaashoek commented 1 year ago

Thanks!

yodalee commented 1 year ago

I just have a look at this change, and I get some question about it. It seems that there are some legacy flag that is not supported in 1.0+, should we remove them also?