xref: /openbmc/qemu/hw/vfio/container-base.c (revision b08501a9)
1*b08501a9SEric Auger /*
2*b08501a9SEric Auger  * VFIO BASE CONTAINER
3*b08501a9SEric Auger  *
4*b08501a9SEric Auger  * Copyright (C) 2023 Intel Corporation.
5*b08501a9SEric Auger  * Copyright Red Hat, Inc. 2023
6*b08501a9SEric Auger  *
7*b08501a9SEric Auger  * Authors: Yi Liu <yi.l.liu@intel.com>
8*b08501a9SEric Auger  *          Eric Auger <eric.auger@redhat.com>
9*b08501a9SEric Auger  *
10*b08501a9SEric Auger  * SPDX-License-Identifier: GPL-2.0-or-later
11*b08501a9SEric Auger  */
12*b08501a9SEric Auger 
13*b08501a9SEric Auger #include "qemu/osdep.h"
14*b08501a9SEric Auger #include "qapi/error.h"
15*b08501a9SEric Auger #include "qemu/error-report.h"
16*b08501a9SEric Auger #include "hw/vfio/vfio-container-base.h"
17*b08501a9SEric Auger 
18*b08501a9SEric Auger int vfio_container_dma_map(VFIOContainerBase *bcontainer,
19*b08501a9SEric Auger                            hwaddr iova, ram_addr_t size,
20*b08501a9SEric Auger                            void *vaddr, bool readonly)
21*b08501a9SEric Auger {
22*b08501a9SEric Auger     g_assert(bcontainer->ops->dma_map);
23*b08501a9SEric Auger     return bcontainer->ops->dma_map(bcontainer, iova, size, vaddr, readonly);
24*b08501a9SEric Auger }
25*b08501a9SEric Auger 
26*b08501a9SEric Auger int vfio_container_dma_unmap(VFIOContainerBase *bcontainer,
27*b08501a9SEric Auger                              hwaddr iova, ram_addr_t size,
28*b08501a9SEric Auger                              IOMMUTLBEntry *iotlb)
29*b08501a9SEric Auger {
30*b08501a9SEric Auger     g_assert(bcontainer->ops->dma_unmap);
31*b08501a9SEric Auger     return bcontainer->ops->dma_unmap(bcontainer, iova, size, iotlb);
32*b08501a9SEric Auger }
33