Skip to content

Commit

Permalink
vfio/spapr: Make vfio_spapr_create/remove_window static
Browse files Browse the repository at this point in the history
vfio_spapr_create_window calls vfio_spapr_remove_window,
With reoder of definition of the two, we can make
vfio_spapr_create/remove_window static.

No functional changes intended.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
  • Loading branch information
duanzhenzhong authored and legoater committed Nov 6, 2023
1 parent 770c3b6 commit a17879f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 30 deletions.
48 changes: 24 additions & 24 deletions hw/vfio/spapr.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,30 @@ static const MemoryListener vfio_prereg_listener = {
.region_del = vfio_prereg_listener_region_del,
};

int vfio_spapr_create_window(VFIOContainer *container,
MemoryRegionSection *section,
hwaddr *pgsize)
static int vfio_spapr_remove_window(VFIOContainer *container,
hwaddr offset_within_address_space)
{
struct vfio_iommu_spapr_tce_remove remove = {
.argsz = sizeof(remove),
.start_addr = offset_within_address_space,
};
int ret;

ret = ioctl(container->fd, VFIO_IOMMU_SPAPR_TCE_REMOVE, &remove);
if (ret) {
error_report("Failed to remove window at %"PRIx64,
(uint64_t)remove.start_addr);
return -errno;
}

trace_vfio_spapr_remove_window(offset_within_address_space);

return 0;
}

static int vfio_spapr_create_window(VFIOContainer *container,
MemoryRegionSection *section,
hwaddr *pgsize)
{
int ret = 0;
IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
Expand Down Expand Up @@ -238,27 +259,6 @@ int vfio_spapr_create_window(VFIOContainer *container,
return 0;
}

int vfio_spapr_remove_window(VFIOContainer *container,
hwaddr offset_within_address_space)
{
struct vfio_iommu_spapr_tce_remove remove = {
.argsz = sizeof(remove),
.start_addr = offset_within_address_space,
};
int ret;

ret = ioctl(container->fd, VFIO_IOMMU_SPAPR_TCE_REMOVE, &remove);
if (ret) {
error_report("Failed to remove window at %"PRIx64,
(uint64_t)remove.start_addr);
return -errno;
}

trace_vfio_spapr_remove_window(offset_within_address_space);

return 0;
}

int vfio_container_add_section_window(VFIOContainer *container,
MemoryRegionSection *section,
Error **errp)
Expand Down
6 changes: 0 additions & 6 deletions include/hw/vfio/vfio-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,6 @@ struct vfio_info_cap_header *
vfio_get_cap(void *ptr, uint32_t cap_offset, uint16_t id);
#endif

int vfio_spapr_create_window(VFIOContainer *container,
MemoryRegionSection *section,
hwaddr *pgsize);
int vfio_spapr_remove_window(VFIOContainer *container,
hwaddr offset_within_address_space);

bool vfio_migration_realize(VFIODevice *vbasedev, Error **errp);
void vfio_migration_exit(VFIODevice *vbasedev);

Expand Down

0 comments on commit a17879f

Please sign in to comment.