[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V1 21/26] iommufd: change process ioctl
From: |
Steve Sistare |
Subject: |
[PATCH V1 21/26] iommufd: change process ioctl |
Date: |
Wed, 29 Jan 2025 06:43:17 -0800 |
Define the change process ioctl
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
backends/iommufd.c | 20 ++++++++++++++++++++
backends/trace-events | 1 +
include/system/iommufd.h | 2 ++
3 files changed, 23 insertions(+)
diff --git a/backends/iommufd.c b/backends/iommufd.c
index 6d29221..be5f6a3 100644
--- a/backends/iommufd.c
+++ b/backends/iommufd.c
@@ -73,6 +73,26 @@ static void iommufd_backend_class_init(ObjectClass *oc, void
*data)
object_class_property_add_str(oc, "fd", NULL, iommufd_backend_set_fd);
}
+bool iommufd_change_process_capable(IOMMUFDBackend *be)
+{
+ struct iommu_ioas_change_process args = {.size = sizeof(args)};
+
+ return !ioctl(be->fd, IOMMU_IOAS_CHANGE_PROCESS, &args);
+}
+
+int iommufd_change_process(IOMMUFDBackend *be)
+{
+ struct iommu_ioas_change_process args = {.size = sizeof(args)};
+ int ret = ioctl(be->fd, IOMMU_IOAS_CHANGE_PROCESS, &args);
+
+ if (ret) {
+ ret = -errno;
+ error_report("IOMMU_IOAS_CHANGE_PROCESS fd %d failed: %m", be->fd);
+ }
+ trace_iommufd_change_process(be->fd, ret);
+ return ret;
+}
+
bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp)
{
int fd;
diff --git a/backends/trace-events b/backends/trace-events
index f478e18..9b33dc3 100644
--- a/backends/trace-events
+++ b/backends/trace-events
@@ -7,6 +7,7 @@ dbus_vmstate_loading(const char *id) "id: %s"
dbus_vmstate_saving(const char *id) "id: %s"
# iommufd.c
+iommufd_change_process(int fd, int ret) "fd=%d (%d)"
iommufd_backend_connect(int fd, bool owned, uint32_t users) "fd=%d owned=%d
users=%d"
iommufd_backend_disconnect(int fd, uint32_t users) "fd=%d users=%d"
iommu_backend_set_fd(int fd) "pre-opened /dev/iommu fd=%d"
diff --git a/include/system/iommufd.h b/include/system/iommufd.h
index ac700b8..4e9c037 100644
--- a/include/system/iommufd.h
+++ b/include/system/iommufd.h
@@ -64,6 +64,8 @@ bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be,
uint32_t hwpt_id,
uint64_t iova, ram_addr_t size,
uint64_t page_size, uint64_t *data,
Error **errp);
+bool iommufd_change_process_capable(IOMMUFDBackend *be);
+int iommufd_change_process(IOMMUFDBackend *be);
#define TYPE_HOST_IOMMU_DEVICE_IOMMUFD TYPE_HOST_IOMMU_DEVICE "-iommufd"
#endif
--
1.8.3.1
- [PATCH V1 07/26] vfio/container: recover from unmap-all-vaddr failure, (continued)
- [PATCH V1 07/26] vfio/container: recover from unmap-all-vaddr failure, Steve Sistare, 2025/01/29
- [PATCH V1 11/26] vfio-pci: skip reset during cpr, Steve Sistare, 2025/01/29
- [PATCH V1 03/26] vfio: vfio_find_ram_discard_listener, Steve Sistare, 2025/01/29
- [PATCH V1 20/26] vfio/iommufd: export iommufd_cdev_get_info_iova_range, Steve Sistare, 2025/01/29
- [PATCH V1 08/26] pci: skip reset during cpr, Steve Sistare, 2025/01/29
- [PATCH V1 05/26] vfio/container: preserve descriptors, Steve Sistare, 2025/01/29
- [PATCH V1 09/26] pci: export msix_is_pending, Steve Sistare, 2025/01/29
- [PATCH V1 13/26] vfio-pci: preserve INTx, Steve Sistare, 2025/01/29
- [PATCH V1 14/26] migration: close kvm after cpr, Steve Sistare, 2025/01/29
- [PATCH V1 19/26] vfio/iommufd: use IOMMU_IOAS_MAP_FILE, Steve Sistare, 2025/01/29
- [PATCH V1 21/26] iommufd: change process ioctl,
Steve Sistare <=
- [PATCH V1 12/26] vfio-pci: preserve MSI, Steve Sistare, 2025/01/29
- [PATCH V1 16/26] vfio: return mr from vfio_get_xlat_addr, Steve Sistare, 2025/01/29
- [PATCH V1 17/26] vfio: pass ramblock to vfio_container_dma_map, Steve Sistare, 2025/01/29
- [PATCH V1 15/26] migration: cpr_get_fd_param helper, Steve Sistare, 2025/01/29
- [PATCH V1 18/26] vfio/iommufd: define iommufd_cdev_make_hwpt, Steve Sistare, 2025/01/29
- [PATCH V1 10/26] vfio-pci: refactor for cpr, Steve Sistare, 2025/01/29
- [PATCH V1 23/26] vfio/iommufd: register container for cpr, Steve Sistare, 2025/01/29
- [PATCH V1 22/26] vfio/iommufd: invariant device name, Steve Sistare, 2025/01/29
- [PATCH V1 24/26] vfio/iommufd: preserve descriptors, Steve Sistare, 2025/01/29
- [PATCH V1 25/26] vfio/iommufd: reconstruct device, Steve Sistare, 2025/01/29