static void vhost_iommu_region_add(MemoryListener *listener,

                                   MemoryRegionSection *section)

{

    struct vhost_dev *dev = container_of(listener, struct vhost_dev,

                                         iommu_listener);

    struct vhost_iommu *iommu;



    if (!memory_region_is_iommu(section->mr)) {

        return;

    }



    iommu = g_malloc0(sizeof(*iommu));

    iommu->n.notify = vhost_iommu_unmap_notify;

    iommu->n.notifier_flags = IOMMU_NOTIFIER_UNMAP;

    iommu->mr = section->mr;

    iommu->iommu_offset = section->offset_within_address_space -

                          section->offset_within_region;

    iommu->hdev = dev;

    memory_region_register_iommu_notifier(section->mr, &iommu->n);

    QLIST_INSERT_HEAD(&dev->iommu_list, iommu, iommu_next);

    /* TODO: can replay help performance here? */

}

static void vhost_iommu_region_add(MemoryListener *listener,

                                   MemoryRegionSection *section)

{

    struct vhost_dev *dev = container_of(listener, struct vhost_dev,

                                         iommu_listener);

    struct vhost_iommu *iommu;



    if (!memory_region_is_iommu(section->mr)) {

        return;

    }



    iommu = g_malloc0(sizeof(*iommu));

    iommu->n.notify = vhost_iommu_unmap_notify;

    iommu->n.notifier_flags = IOMMU_NOTIFIER_UNMAP;

    iommu->mr = section->mr;

    iommu->iommu_offset = section->offset_within_address_space -

                          section->offset_within_region;

    iommu->hdev = dev;

    memory_region_register_iommu_notifier(section->mr, &iommu->n);

    QLIST_INSERT_HEAD(&dev->iommu_list, iommu, iommu_next);

    

}

static void FUNC_0(MemoryListener *VAR_0,

                                   MemoryRegionSection *VAR_1)

{

    struct vhost_dev *VAR_2 = container_of(VAR_0, struct vhost_dev,

                                         iommu_listener);

    struct vhost_iommu *VAR_3;



    if (!memory_region_is_iommu(VAR_1->mr)) {

        return;

    }



    VAR_3 = g_malloc0(sizeof(*VAR_3));

    VAR_3->n.notify = vhost_iommu_unmap_notify;

    VAR_3->n.notifier_flags = IOMMU_NOTIFIER_UNMAP;

    VAR_3->mr = VAR_1->mr;

    VAR_3->iommu_offset = VAR_1->offset_within_address_space -

                          VAR_1->offset_within_region;

    VAR_3->hdev = VAR_2;

    memory_region_register_iommu_notifier(VAR_1->mr, &VAR_3->n);

    QLIST_INSERT_HEAD(&VAR_2->iommu_list, VAR_3, iommu_next);

    

}

static void FUNC_0(MemoryListener *VAR_0,
MemoryRegionSection *VAR_1)
{ struct vhost_dev *VAR_2 = container_of(VAR_0, struct vhost_dev,
iommu_listener); struct vhost_iommu *VAR_3; if (!memory_region_is_iommu(VAR_1->mr)) { return; } VAR_3 = g_malloc0(sizeof(*VAR_3)); VAR_3->n.notify = vhost_iommu_unmap_notify; VAR_3->n.notifier_flags = IOMMU_NOTIFIER_UNMAP; VAR_3->mr = VAR_1->mr; VAR_3->iommu_offset = VAR_1->offset_within_address_space -
VAR_1->offset_within_region; VAR_3->hdev = VAR_2; memory_region_register_iommu_notifier(VAR_1->mr, &VAR_3->n); QLIST_INSERT_HEAD(&VAR_2->iommu_list, VAR_3, iommu_next); }