mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 21:50:33 +00:00
backends/iommufd: Introduce iommufd_backend_alloc_veventq
Add a new helper for IOMMU_VEVENTQ_ALLOC ioctl to allocate a virtual event queue (vEVENTQ) for a vIOMMU object. Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Tested-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com> Message-id: 20260226084456.112142-2-skolothumtho@nvidia.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
committed by
Peter Maydell
parent
005b1d838b
commit
0885cd5504
@@ -504,6 +504,37 @@ bool iommufd_backend_alloc_vdev(IOMMUFDBackend *be, uint32_t dev_id,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool iommufd_backend_alloc_veventq(IOMMUFDBackend *be, uint32_t viommu_id,
|
||||
uint32_t type, uint32_t depth,
|
||||
uint32_t *out_veventq_id,
|
||||
uint32_t *out_veventq_fd, Error **errp)
|
||||
{
|
||||
int ret;
|
||||
struct iommu_veventq_alloc alloc_veventq = {
|
||||
.size = sizeof(alloc_veventq),
|
||||
.flags = 0,
|
||||
.type = type,
|
||||
.veventq_depth = depth,
|
||||
.viommu_id = viommu_id,
|
||||
};
|
||||
|
||||
ret = ioctl(be->fd, IOMMU_VEVENTQ_ALLOC, &alloc_veventq);
|
||||
|
||||
trace_iommufd_viommu_alloc_eventq(be->fd, viommu_id, type,
|
||||
alloc_veventq.out_veventq_id,
|
||||
alloc_veventq.out_veventq_fd, ret);
|
||||
if (ret) {
|
||||
error_setg_errno(errp, errno, "IOMMU_VEVENTQ_ALLOC failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
g_assert(out_veventq_id);
|
||||
g_assert(out_veventq_fd);
|
||||
*out_veventq_id = alloc_veventq.out_veventq_id;
|
||||
*out_veventq_fd = alloc_veventq.out_veventq_fd;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool host_iommu_device_iommufd_attach_hwpt(HostIOMMUDeviceIOMMUFD *idev,
|
||||
uint32_t hwpt_id, Error **errp)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ iommufd_backend_get_dirty_bitmap(int iommufd, uint32_t hwpt_id, uint64_t iova, u
|
||||
iommufd_backend_invalidate_cache(int iommufd, uint32_t id, uint32_t data_type, uint32_t entry_len, uint32_t entry_num, uint32_t done_num, uint64_t data_ptr, int ret) " iommufd=%d id=%u data_type=%u entry_len=%u entry_num=%u done_num=%u data_ptr=0x%"PRIx64" (%d)"
|
||||
iommufd_backend_alloc_viommu(int iommufd, uint32_t dev_id, uint32_t type, uint32_t hwpt_id, uint32_t viommu_id, int ret) " iommufd=%d type=%u dev_id=%u hwpt_id=%u viommu_id=%u (%d)"
|
||||
iommufd_backend_alloc_vdev(int iommufd, uint32_t dev_id, uint32_t viommu_id, uint64_t virt_id, uint32_t vdev_id, int ret) " iommufd=%d dev_id=%u viommu_id=%u virt_id=0x%"PRIx64" vdev_id=%u (%d)"
|
||||
iommufd_viommu_alloc_eventq(int iommufd, uint32_t viommu_id, uint32_t type, uint32_t veventq_id, uint32_t veventq_fd, int ret) " iommufd=%d viommu_id=%u type=%u veventq_id=%u veventq_fd=%u (%d)"
|
||||
|
||||
# igvm-cfg.c
|
||||
igvm_reset_enter(int type) "type=%u"
|
||||
|
||||
@@ -56,6 +56,15 @@ typedef struct IOMMUFDVdev {
|
||||
uint32_t virt_id; /* virtual device ID */
|
||||
} IOMMUFDVdev;
|
||||
|
||||
/* Virtual event queue interface for a vIOMMU */
|
||||
typedef struct IOMMUFDVeventq {
|
||||
IOMMUFDViommu *viommu;
|
||||
uint32_t veventq_id;
|
||||
uint32_t veventq_fd;
|
||||
uint32_t last_event_seq; /* Sequence number of last processed event */
|
||||
bool event_start; /* True after first valid event; cleared on overflow */
|
||||
} IOMMUFDVeventq;
|
||||
|
||||
bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp);
|
||||
void iommufd_backend_disconnect(IOMMUFDBackend *be);
|
||||
|
||||
@@ -86,6 +95,11 @@ bool iommufd_backend_alloc_vdev(IOMMUFDBackend *be, uint32_t dev_id,
|
||||
uint32_t viommu_id, uint64_t virt_id,
|
||||
uint32_t *out_vdev_id, Error **errp);
|
||||
|
||||
bool iommufd_backend_alloc_veventq(IOMMUFDBackend *be, uint32_t viommu_id,
|
||||
uint32_t type, uint32_t depth,
|
||||
uint32_t *out_veventq_id,
|
||||
uint32_t *out_veventq_fd, Error **errp);
|
||||
|
||||
bool iommufd_backend_set_dirty_tracking(IOMMUFDBackend *be, uint32_t hwpt_id,
|
||||
bool start, Error **errp);
|
||||
bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be, uint32_t hwpt_id,
|
||||
|
||||
Reference in New Issue
Block a user