Date: Sat, 17 Mar 2018 20:37:02 +0000 (UTC) From: Bryan Venteicher <bryanv@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331112 - stable/11/sys/dev/virtio Message-ID: <201803172037.w2HKb2PG060520@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bryanv Date: Sat Mar 17 20:37:01 2018 New Revision: 331112 URL: https://svnweb.freebsd.org/changeset/base/331112 Log: MFC r327958, r329601, r329602: Sync VirtIO IDs with Linux Add VirtIO bus config_generation method Add more virtqueue getter methods Modified: stable/11/sys/dev/virtio/virtio.c stable/11/sys/dev/virtio/virtio.h stable/11/sys/dev/virtio/virtio_bus_if.m stable/11/sys/dev/virtio/virtio_ids.h stable/11/sys/dev/virtio/virtqueue.c stable/11/sys/dev/virtio/virtqueue.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/virtio/virtio.c ============================================================================== --- stable/11/sys/dev/virtio/virtio.c Sat Mar 17 20:20:29 2018 (r331111) +++ stable/11/sys/dev/virtio/virtio.c Sat Mar 17 20:37:01 2018 (r331112) @@ -54,14 +54,21 @@ static struct virtio_ident { uint16_t devid; const char *name; } virtio_ident_table[] = { - { VIRTIO_ID_NETWORK, "Network" }, - { VIRTIO_ID_BLOCK, "Block" }, - { VIRTIO_ID_CONSOLE, "Console" }, - { VIRTIO_ID_ENTROPY, "Entropy" }, - { VIRTIO_ID_BALLOON, "Balloon" }, - { VIRTIO_ID_IOMEMORY, "IOMemory" }, - { VIRTIO_ID_SCSI, "SCSI" }, - { VIRTIO_ID_9P, "9P Transport" }, + { VIRTIO_ID_NETWORK, "Network" }, + { VIRTIO_ID_BLOCK, "Block" }, + { VIRTIO_ID_CONSOLE, "Console" }, + { VIRTIO_ID_ENTROPY, "Entropy" }, + { VIRTIO_ID_BALLOON, "Balloon" }, + { VIRTIO_ID_IOMEMORY, "IOMemory" }, + { VIRTIO_ID_RPMSG, "Remote Processor Messaging" }, + { VIRTIO_ID_SCSI, "SCSI" }, + { VIRTIO_ID_9P, "9P Transport" }, + { VIRTIO_ID_RPROC_SERIAL, "Remote Processor Serial" }, + { VIRTIO_ID_CAIF, "CAIF" }, + { VIRTIO_ID_GPU, "GPU" }, + { VIRTIO_ID_INPUT, "Input" }, + { VIRTIO_ID_VSOCK, "VSOCK Transport" }, + { VIRTIO_ID_CRYPTO, "Crypto" }, { 0, NULL } }; @@ -231,6 +238,13 @@ virtio_reinit_complete(device_t dev) { VIRTIO_BUS_REINIT_COMPLETE(device_get_parent(dev)); +} + +int +virtio_config_generation(device_t dev) +{ + + return (VIRTIO_BUS_CONFIG_GENERATION(device_get_parent(dev))); } void Modified: stable/11/sys/dev/virtio/virtio.h ============================================================================== --- stable/11/sys/dev/virtio/virtio.h Sat Mar 17 20:20:29 2018 (r331111) +++ stable/11/sys/dev/virtio/virtio.h Sat Mar 17 20:37:01 2018 (r331112) @@ -78,6 +78,7 @@ int virtio_alloc_virtqueues(device_t dev, int flags, int virtio_setup_intr(device_t dev, enum intr_type type); int virtio_with_feature(device_t dev, uint64_t feature); void virtio_stop(device_t dev); +int virtio_config_generation(device_t dev); int virtio_reinit(device_t dev, uint64_t features); void virtio_reinit_complete(device_t dev); Modified: stable/11/sys/dev/virtio/virtio_bus_if.m ============================================================================== --- stable/11/sys/dev/virtio/virtio_bus_if.m Sat Mar 17 20:20:29 2018 (r331111) +++ stable/11/sys/dev/virtio/virtio_bus_if.m Sat Mar 17 20:37:01 2018 (r331112) @@ -34,6 +34,14 @@ HEADER { struct vq_alloc_info; }; +CODE { + static int + virtio_bus_default_config_generation(device_t dev) + { + return (0); + } +}; + METHOD uint64_t negotiate_features { device_t dev; uint64_t child_features; @@ -73,6 +81,10 @@ METHOD void notify_vq { device_t dev; uint16_t queue; }; + +METHOD int config_generation { + device_t dev; +} DEFAULT virtio_bus_default_config_generation; METHOD void read_device_config { device_t dev; Modified: stable/11/sys/dev/virtio/virtio_ids.h ============================================================================== --- stable/11/sys/dev/virtio/virtio_ids.h Sat Mar 17 20:20:29 2018 (r331111) +++ stable/11/sys/dev/virtio/virtio_ids.h Sat Mar 17 20:37:01 2018 (r331112) @@ -32,13 +32,20 @@ #define _VIRTIO_IDS_H_ /* VirtIO device IDs. */ -#define VIRTIO_ID_NETWORK 0x01 -#define VIRTIO_ID_BLOCK 0x02 -#define VIRTIO_ID_CONSOLE 0x03 -#define VIRTIO_ID_ENTROPY 0x04 -#define VIRTIO_ID_BALLOON 0x05 -#define VIRTIO_ID_IOMEMORY 0x06 -#define VIRTIO_ID_SCSI 0x08 -#define VIRTIO_ID_9P 0x09 +#define VIRTIO_ID_NETWORK 1 +#define VIRTIO_ID_BLOCK 2 +#define VIRTIO_ID_CONSOLE 3 +#define VIRTIO_ID_ENTROPY 4 +#define VIRTIO_ID_BALLOON 5 +#define VIRTIO_ID_IOMEMORY 6 +#define VIRTIO_ID_RPMSG 7 +#define VIRTIO_ID_SCSI 8 +#define VIRTIO_ID_9P 9 +#define VIRTIO_ID_RPROC_SERIAL 11 +#define VIRTIO_ID_CAIF 12 +#define VIRTIO_ID_GPU 16 +#define VIRTIO_ID_INPUT 18 +#define VIRTIO_ID_VSOCK 19 +#define VIRTIO_ID_CRYPTO 20 #endif /* _VIRTIO_IDS_H_ */ Modified: stable/11/sys/dev/virtio/virtqueue.c ============================================================================== --- stable/11/sys/dev/virtio/virtqueue.c Sat Mar 17 20:20:29 2018 (r331111) +++ stable/11/sys/dev/virtio/virtqueue.c Sat Mar 17 20:37:01 2018 (r331112) @@ -369,6 +369,33 @@ virtqueue_paddr(struct virtqueue *vq) return (vtophys(vq->vq_ring_mem)); } +vm_paddr_t +virtqueue_desc_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.desc)); +} + +vm_paddr_t +virtqueue_avail_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.avail)); +} + +vm_paddr_t +virtqueue_used_paddr(struct virtqueue *vq) +{ + + return (vtophys(vq->vq_ring.used)); +} + +uint16_t +virtqueue_index(struct virtqueue *vq) +{ + return (vq->vq_queue_index); +} + int virtqueue_size(struct virtqueue *vq) { Modified: stable/11/sys/dev/virtio/virtqueue.h ============================================================================== --- stable/11/sys/dev/virtio/virtqueue.h Sat Mar 17 20:20:29 2018 (r331111) +++ stable/11/sys/dev/virtio/virtqueue.h Sat Mar 17 20:37:01 2018 (r331112) @@ -84,7 +84,11 @@ void virtqueue_disable_intr(struct virtqueue *vq); /* Get physical address of the virtqueue ring. */ vm_paddr_t virtqueue_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_desc_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_avail_paddr(struct virtqueue *vq); +vm_paddr_t virtqueue_used_paddr(struct virtqueue *vq); +uint16_t virtqueue_index(struct virtqueue *vq); int virtqueue_full(struct virtqueue *vq); int virtqueue_empty(struct virtqueue *vq); int virtqueue_size(struct virtqueue *vq);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803172037.w2HKb2PG060520>