mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
backends/iommufd: change process ioctl
Define the change process ioctl Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Link: https://lore.kernel.org/qemu-devel/1751493538-202042-7-git-send-email-steven.sistare@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
e563dc88c2
commit
ab48cedc64
3 changed files with 28 additions and 0 deletions
|
@ -73,6 +73,30 @@ static void iommufd_backend_class_init(ObjectClass *oc, const void *data)
|
||||||
object_class_property_add_str(oc, "fd", NULL, iommufd_backend_set_fd);
|
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)};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Call IOMMU_IOAS_CHANGE_PROCESS to verify it is a recognized ioctl.
|
||||||
|
* This is a no-op if the process has not changed since DMA was mapped.
|
||||||
|
*/
|
||||||
|
return !ioctl(be->fd, IOMMU_IOAS_CHANGE_PROCESS, &args);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool iommufd_change_process(IOMMUFDBackend *be, Error **errp)
|
||||||
|
{
|
||||||
|
struct iommu_ioas_change_process args = {.size = sizeof(args)};
|
||||||
|
bool ret = !ioctl(be->fd, IOMMU_IOAS_CHANGE_PROCESS, &args);
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
error_setg_errno(errp, errno, "IOMMU_IOAS_CHANGE_PROCESS fd %d failed",
|
||||||
|
be->fd);
|
||||||
|
}
|
||||||
|
trace_iommufd_change_process(be->fd, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp)
|
bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
|
@ -7,6 +7,7 @@ dbus_vmstate_loading(const char *id) "id: %s"
|
||||||
dbus_vmstate_saving(const char *id) "id: %s"
|
dbus_vmstate_saving(const char *id) "id: %s"
|
||||||
|
|
||||||
# iommufd.c
|
# iommufd.c
|
||||||
|
iommufd_change_process(int fd, bool ret) "fd=%d (%d)"
|
||||||
iommufd_backend_connect(int fd, bool owned, uint32_t users) "fd=%d owned=%d users=%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"
|
iommufd_backend_disconnect(int fd, uint32_t users) "fd=%d users=%d"
|
||||||
iommu_backend_set_fd(int fd) "pre-opened /dev/iommu fd=%d"
|
iommu_backend_set_fd(int fd) "pre-opened /dev/iommu fd=%d"
|
||||||
|
|
|
@ -69,6 +69,9 @@ bool iommufd_backend_invalidate_cache(IOMMUFDBackend *be, uint32_t id,
|
||||||
uint32_t *entry_num, void *data,
|
uint32_t *entry_num, void *data,
|
||||||
Error **errp);
|
Error **errp);
|
||||||
|
|
||||||
|
bool iommufd_change_process_capable(IOMMUFDBackend *be);
|
||||||
|
bool iommufd_change_process(IOMMUFDBackend *be, Error **errp);
|
||||||
|
|
||||||
#define TYPE_HOST_IOMMU_DEVICE_IOMMUFD TYPE_HOST_IOMMU_DEVICE "-iommufd"
|
#define TYPE_HOST_IOMMU_DEVICE_IOMMUFD TYPE_HOST_IOMMU_DEVICE "-iommufd"
|
||||||
OBJECT_DECLARE_TYPE(HostIOMMUDeviceIOMMUFD, HostIOMMUDeviceIOMMUFDClass,
|
OBJECT_DECLARE_TYPE(HostIOMMUDeviceIOMMUFD, HostIOMMUDeviceIOMMUFDClass,
|
||||||
HOST_IOMMU_DEVICE_IOMMUFD)
|
HOST_IOMMU_DEVICE_IOMMUFD)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue