cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

virtio.h (1736B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef LINUX_VIRTIO_H
      3#define LINUX_VIRTIO_H
      4#include <linux/scatterlist.h>
      5#include <linux/kernel.h>
      6#include <linux/spinlock.h>
      7
      8struct device {
      9	void *parent;
     10};
     11
     12struct virtio_device {
     13	struct device dev;
     14	u64 features;
     15	struct list_head vqs;
     16	spinlock_t vqs_list_lock;
     17};
     18
     19struct virtqueue {
     20	struct list_head list;
     21	void (*callback)(struct virtqueue *vq);
     22	const char *name;
     23	struct virtio_device *vdev;
     24        unsigned int index;
     25        unsigned int num_free;
     26	void *priv;
     27};
     28
     29/* Interfaces exported by virtio_ring. */
     30int virtqueue_add_sgs(struct virtqueue *vq,
     31		      struct scatterlist *sgs[],
     32		      unsigned int out_sgs,
     33		      unsigned int in_sgs,
     34		      void *data,
     35		      gfp_t gfp);
     36
     37int virtqueue_add_outbuf(struct virtqueue *vq,
     38			 struct scatterlist sg[], unsigned int num,
     39			 void *data,
     40			 gfp_t gfp);
     41
     42int virtqueue_add_inbuf(struct virtqueue *vq,
     43			struct scatterlist sg[], unsigned int num,
     44			void *data,
     45			gfp_t gfp);
     46
     47bool virtqueue_kick(struct virtqueue *vq);
     48
     49void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
     50
     51void virtqueue_disable_cb(struct virtqueue *vq);
     52
     53bool virtqueue_enable_cb(struct virtqueue *vq);
     54bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
     55
     56void *virtqueue_detach_unused_buf(struct virtqueue *vq);
     57struct virtqueue *vring_new_virtqueue(unsigned int index,
     58				      unsigned int num,
     59				      unsigned int vring_align,
     60				      struct virtio_device *vdev,
     61				      bool weak_barriers,
     62				      bool ctx,
     63				      void *pages,
     64				      bool (*notify)(struct virtqueue *vq),
     65				      void (*callback)(struct virtqueue *vq),
     66				      const char *name);
     67void vring_del_virtqueue(struct virtqueue *vq);
     68
     69#endif