cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

pvrdma_dev_ring.h (1266B)


      1/*
      2 * QEMU VMWARE paravirtual RDMA ring utilities
      3 *
      4 * Copyright (C) 2018 Oracle
      5 * Copyright (C) 2018 Red Hat Inc
      6 *
      7 * Authors:
      8 *     Yuval Shaia <yuval.shaia@oracle.com>
      9 *     Marcel Apfelbaum <marcel@redhat.com>
     10 *
     11 * This work is licensed under the terms of the GNU GPL, version 2 or later.
     12 * See the COPYING file in the top-level directory.
     13 *
     14 */
     15
     16#ifndef PVRDMA_DEV_RING_H
     17#define PVRDMA_DEV_RING_H
     18
     19
     20#define MAX_RING_NAME_SZ 32
     21
     22typedef struct PvrdmaRingState {
     23    int prod_tail; /* producer tail */
     24    int cons_head; /* consumer head */
     25} PvrdmaRingState;
     26
     27typedef struct PvrdmaRing {
     28    char name[MAX_RING_NAME_SZ];
     29    PCIDevice *dev;
     30    uint32_t max_elems;
     31    size_t elem_sz;
     32    PvrdmaRingState *ring_state; /* used only for unmap */
     33    int npages;
     34    void **pages;
     35} PvrdmaRing;
     36
     37int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev,
     38                     PvrdmaRingState *ring_state, uint32_t max_elems,
     39                     size_t elem_sz, dma_addr_t *tbl, uint32_t npages);
     40void *pvrdma_ring_next_elem_read(PvrdmaRing *ring);
     41void pvrdma_ring_read_inc(PvrdmaRing *ring);
     42void *pvrdma_ring_next_elem_write(PvrdmaRing *ring);
     43void pvrdma_ring_write_inc(PvrdmaRing *ring);
     44void pvrdma_ring_free(PvrdmaRing *ring);
     45
     46#endif