aboutsummaryrefslogtreecommitdiff
path: root/lib/libvirtio/virtio.h
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2016-02-01 11:18:10 +0530
committerAlexey Kardashevskiy <aik@ozlabs.ru>2016-02-08 16:40:39 +1100
commitf83299621cde03cd406cbb665fc5eb1f348afc9b (patch)
tree0fa0c612e57f74bbbe15490a560888dc0563ccb0 /lib/libvirtio/virtio.h
parent69a2f9ae1a191743acb3f68e6e0514eb65beb576 (diff)
downloadSLOF-f83299621cde03cd406cbb665fc5eb1f348afc9b.zip
SLOF-f83299621cde03cd406cbb665fc5eb1f348afc9b.tar.gz
SLOF-f83299621cde03cd406cbb665fc5eb1f348afc9b.tar.bz2
virtio: add and enable 1.0 device setup
Introduce parsing routines for virtio capabilities. This would also determine whether we need to function in legacy mode or virtio 1.0. Update routine to start using the base address from the updated legacy structure. With the removal for base address setting in the Forth code and most of the device setup happening in C code, code in virtio.fs is redundant. Remove virtio.fs and move the allocation of the virtio_device structure to the C code instead of the Forth code in individual files. Also, drop the packed attribute for the virtio_{device,cap} structure. The structure is not shared anymore. Drivers need to negotiate the 1.0 feature capability before starting to use 1.0. Disable it in all the drivers until 1.0 is enabled. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'lib/libvirtio/virtio.h')
-rw-r--r--lib/libvirtio/virtio.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libvirtio/virtio.h b/lib/libvirtio/virtio.h
index 3ff2bac..0fee4ba 100644
--- a/lib/libvirtio/virtio.h
+++ b/lib/libvirtio/virtio.h
@@ -76,11 +76,9 @@ struct virtio_cap {
uint8_t bar;
uint8_t is_io;
uint8_t cap_id;
- uint8_t pad[5];
-} __attribute__ ((packed));
+};
struct virtio_device {
- void *base; /* base address */
uint32_t is_modern; /* Indicates whether to use virtio 1.0 */
struct virtio_cap legacy;
struct virtio_cap common;
@@ -89,7 +87,7 @@ struct virtio_device {
struct virtio_cap device;
struct virtio_cap pci;
uint32_t notify_off_mul;
-} __attribute__ ((packed));
+};
struct vqs {
uint64_t id; /* Queue ID */
@@ -113,6 +111,7 @@ extern void virtio_fill_desc(struct vring_desc *desc, bool is_modern,
uint16_t flags, uint16_t next);
extern int virtio_queue_init_vq(struct virtio_device *dev, struct vqs *vq, unsigned int id);
+extern struct virtio_device *virtio_setup_vd(void);
extern void virtio_reset_device(struct virtio_device *dev);
extern void virtio_queue_notify(struct virtio_device *dev, int queue);
extern void virtio_set_status(struct virtio_device *dev, int status);