diff options
author | Xi Wang <[email protected]> | 2021-10-17 22:33:39 -0700 |
---|---|---|
committer | Xi Wang <[email protected]> | 2021-10-17 23:05:09 -0700 |
commit | cd00a8233ad43be269908db5bdc28c5961a9dce9 (patch) | |
tree | 2a0f10fd40586bbfb3f057610d5d710c4938ff9a /kernel/virtio.h | |
parent | a1da53a5a12e21b44a2c79d962a437fa2107627c (diff) | |
download | xv6-labs-cd00a8233ad43be269908db5bdc28c5961a9dce9.tar.gz xv6-labs-cd00a8233ad43be269908db5bdc28c5961a9dce9.tar.bz2 xv6-labs-cd00a8233ad43be269908db5bdc28c5961a9dce9.zip |
port virtio_disk to virtio spec 1.0+
The legacy interface is confusing. It's better to make virtio_disk
conform to the virtio spec. This is supported in QEMU since 4.2 by
disabling force-legacy for virtio-mmio.
Diffstat (limited to 'kernel/virtio.h')
-rw-r--r-- | kernel/virtio.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/virtio.h b/kernel/virtio.h index f1dc520..3d85583 100644 --- a/kernel/virtio.h +++ b/kernel/virtio.h @@ -2,7 +2,6 @@ // virtio device definitions. // for both the mmio interface, and virtio descriptors. // only tested with qemu. -// this is the "legacy" virtio interface. // // the virtio spec: // https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.pdf @@ -16,17 +15,20 @@ #define VIRTIO_MMIO_VENDOR_ID 0x00c // 0x554d4551 #define VIRTIO_MMIO_DEVICE_FEATURES 0x010 #define VIRTIO_MMIO_DRIVER_FEATURES 0x020 -#define VIRTIO_MMIO_GUEST_PAGE_SIZE 0x028 // page size for PFN, write-only #define VIRTIO_MMIO_QUEUE_SEL 0x030 // select queue, write-only #define VIRTIO_MMIO_QUEUE_NUM_MAX 0x034 // max size of current queue, read-only #define VIRTIO_MMIO_QUEUE_NUM 0x038 // size of current queue, write-only -#define VIRTIO_MMIO_QUEUE_ALIGN 0x03c // used ring alignment, write-only -#define VIRTIO_MMIO_QUEUE_PFN 0x040 // physical page number for queue, read/write #define VIRTIO_MMIO_QUEUE_READY 0x044 // ready bit #define VIRTIO_MMIO_QUEUE_NOTIFY 0x050 // write-only #define VIRTIO_MMIO_INTERRUPT_STATUS 0x060 // read-only #define VIRTIO_MMIO_INTERRUPT_ACK 0x064 // write-only #define VIRTIO_MMIO_STATUS 0x070 // read/write +#define VIRTIO_MMIO_QUEUE_DESC_LOW 0x080 // physical address for descriptor table, write-only +#define VIRTIO_MMIO_QUEUE_DESC_HIGH 0x084 +#define VIRTIO_MMIO_DRIVER_DESC_LOW 0x090 // physical address for available ring, write-only +#define VIRTIO_MMIO_DRIVER_DESC_HIGH 0x094 +#define VIRTIO_MMIO_DEVICE_DESC_LOW 0x0a0 // physical address for used ring, write-only +#define VIRTIO_MMIO_DEVICE_DESC_HIGH 0x0a4 // status register bits, from qemu virtio_config.h #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 |