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