Lines Matching +full:qemu +full:- +full:kvm
11 * the COPYING file in the top-level directory.
13 * Based on qemu-kvm device-assignment:
14 * Adapted for KVM by Qumranet.
19 * Copyright (C) 2008, IBM, Muli Ben-Yehuda (muli@il.ibm.com)
22 #include "qemu/osdep.h"
25 #include "system/kvm.h"
26 #include "hw/vfio/vfio-device.h"
29 #include "vfio-helpers.h"
33 vbmap->pages = REAL_HOST_PAGE_ALIGN(size) / qemu_real_host_page_size(); in vfio_bitmap_alloc()
34 vbmap->size = ROUND_UP(vbmap->pages, sizeof(__u64) * BITS_PER_BYTE) / in vfio_bitmap_alloc()
36 vbmap->bitmap = g_try_malloc0(vbmap->size); in vfio_bitmap_alloc()
37 if (!vbmap->bitmap) { in vfio_bitmap_alloc()
38 return -ENOMEM; in vfio_bitmap_alloc()
49 for (hdr = ptr + cap_offset; hdr != ptr; hdr = ptr + hdr->next) { in vfio_get_cap()
50 if (hdr->id == id) { in vfio_get_cap()
61 if (!(info->flags & VFIO_REGION_INFO_FLAG_CAPS)) { in vfio_get_region_info_cap()
65 return vfio_get_cap((void *)info, info->cap_offset, id); in vfio_get_region_info_cap()
71 if (!(info->flags & VFIO_DEVICE_FLAGS_CAPS)) { in vfio_get_device_info_cap()
75 return vfio_get_cap((void *)info, info->cap_offset, id); in vfio_get_device_info_cap()
81 if (!(info->flags & VFIO_IOMMU_INFO_CAPS)) { in vfio_get_iommu_type1_info_cap()
85 return vfio_get_cap((void *)info, info->cap_offset, id); in vfio_get_iommu_type1_info_cap()
103 *avail = cap->avail; in vfio_get_info_dma_avail()
111 * We have a single VFIO pseudo device per KVM VM. Once created it lives
113 * reference to it and the device's reference to kvm. Therefore once
114 * initialized, this file descriptor is only released on QEMU exit and
115 * we'll re-use it should another vfio device be attached before then.
117 int vfio_kvm_device_fd = -1;
124 if (vfio_kvm_device_fd != -1) { in vfio_kvm_device_close()
126 vfio_kvm_device_fd = -1; in vfio_kvm_device_close()
150 error_setg_errno(errp, errno, "Failed to create KVM VFIO device"); in vfio_kvm_device_add_fd()
151 return -errno; in vfio_kvm_device_add_fd()
158 error_setg_errno(errp, errno, "Failed to add fd %d to KVM VFIO device", in vfio_kvm_device_add_fd()
160 return -errno; in vfio_kvm_device_add_fd()
176 error_setg(errp, "KVM VFIO device isn't created yet"); in vfio_kvm_device_del_fd()
177 return -EINVAL; in vfio_kvm_device_del_fd()
182 "Failed to remove fd %d from KVM VFIO device", fd); in vfio_kvm_device_del_fd()
183 return -errno; in vfio_kvm_device_del_fd()
197 info->argsz = argsz; in vfio_get_device_info()
204 if (info->argsz > argsz) { in vfio_get_device_info()
205 argsz = info->argsz; in vfio_get_device_info()