LCOV - code coverage report
Current view: top level - lib/vhost - iotlb.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 8 0.0 %
Date: 2025-02-01 18:54:23 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 16 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright (c) 2017 Red Hat, Inc.
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef _VHOST_IOTLB_H_
       6                 :            : #define _VHOST_IOTLB_H_
       7                 :            : 
       8                 :            : #include <stdbool.h>
       9                 :            : 
      10                 :            : #include "vhost.h"
      11                 :            : 
      12                 :            : static __rte_always_inline void
      13                 :            : vhost_user_iotlb_rd_lock(struct vhost_virtqueue *vq)
      14                 :            :         __rte_shared_lock_function(&vq->iotlb_lock)
      15                 :            : {
      16                 :          0 :         rte_rwlock_read_lock(&vq->iotlb_lock);
      17                 :          0 : }
      18                 :            : 
      19                 :            : static __rte_always_inline void
      20                 :            : vhost_user_iotlb_rd_unlock(struct vhost_virtqueue *vq)
      21                 :            :         __rte_unlock_function(&vq->iotlb_lock)
      22                 :            : {
      23                 :          0 :         rte_rwlock_read_unlock(&vq->iotlb_lock);
      24                 :            : }
      25                 :            : 
      26                 :            : static __rte_always_inline void
      27                 :            : vhost_user_iotlb_wr_lock(struct vhost_virtqueue *vq)
      28                 :            :         __rte_exclusive_lock_function(&vq->iotlb_lock)
      29                 :            : {
      30                 :          0 :         rte_rwlock_write_lock(&vq->iotlb_lock);
      31                 :            : }
      32                 :            : 
      33                 :            : static __rte_always_inline void
      34                 :            : vhost_user_iotlb_wr_unlock(struct vhost_virtqueue *vq)
      35                 :            :         __rte_unlock_function(&vq->iotlb_lock)
      36                 :            : {
      37                 :            :         rte_rwlock_write_unlock(&vq->iotlb_lock);
      38                 :            : }
      39                 :            : 
      40                 :            : static __rte_always_inline void
      41                 :            : vhost_user_iotlb_wr_lock_all(struct virtio_net *dev)
      42                 :            :         __rte_no_thread_safety_analysis
      43                 :            : {
      44                 :            :         uint32_t i;
      45                 :            : 
      46   [ #  #  #  #  :          0 :         for (i = 0; i < dev->nr_vring; i++)
             #  #  #  # ]
      47                 :          0 :                 rte_rwlock_write_lock(&dev->virtqueue[i]->iotlb_lock);
      48                 :            : }
      49                 :            : 
      50                 :            : static __rte_always_inline void
      51                 :            : vhost_user_iotlb_wr_unlock_all(struct virtio_net *dev)
      52                 :            :         __rte_no_thread_safety_analysis
      53                 :            : {
      54                 :            :         uint32_t i;
      55                 :            : 
      56   [ #  #  #  #  :          0 :         for (i = 0; i < dev->nr_vring; i++)
             #  #  #  # ]
      57                 :          0 :                 rte_rwlock_write_unlock(&dev->virtqueue[i]->iotlb_lock);
      58                 :            : }
      59                 :            : 
      60                 :            : void vhost_user_iotlb_cache_insert(struct virtio_net *dev, uint64_t iova, uint64_t uaddr,
      61                 :            :                 uint64_t uoffset, uint64_t size, uint64_t page_size, uint8_t perm);
      62                 :            : void vhost_user_iotlb_cache_remove(struct virtio_net *dev, uint64_t iova, uint64_t size);
      63                 :            : uint64_t vhost_user_iotlb_cache_find(struct virtio_net *dev, uint64_t iova,
      64                 :            :                                         uint64_t *size, uint8_t perm);
      65                 :            : bool vhost_user_iotlb_pending_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm);
      66                 :            : void vhost_user_iotlb_pending_insert(struct virtio_net *dev, uint64_t iova, uint8_t perm);
      67                 :            : void vhost_user_iotlb_pending_remove(struct virtio_net *dev, uint64_t iova,
      68                 :            :                                                 uint64_t size, uint8_t perm);
      69                 :            : void vhost_user_iotlb_flush_all(struct virtio_net *dev);
      70                 :            : int vhost_user_iotlb_init(struct virtio_net *dev);
      71                 :            : void vhost_user_iotlb_destroy(struct virtio_net *dev);
      72                 :            : 
      73                 :            : #endif /* _VHOST_IOTLB_H_ */

Generated by: LCOV version 1.14