• Si-Wei Liu's avatar
    vdpa_sim: implement .reset_map support · 86f6c224
    Si-Wei Liu authored
    In order to reduce excessive memory mapping cost in live migration and
    VM reboot, it is desirable to decouple the vhost-vdpa IOTLB abstraction
    from the virtio device life cycle, i.e. mappings can be kept intact
    across virtio device reset. Leverage the .reset_map callback, which is
    meant to destroy the iotlb on the given ASID and recreate the 1:1
    passthrough/identity mapping. To be consistent, the mapping on device
    creation is initiailized to passthrough/identity with PA 1:1 mapped as
    IOVA. With this the device .reset op doesn't have to maintain and clean
    up memory mappings by itself.
    
    Additionally, implement .compat_reset to cater for older userspace,
    which may wish to see mapping to be cleared during reset.
    Signed-off-by: default avatarSi-Wei Liu <si-wei.liu@oracle.com>
    Tested-by: default avatarStefano Garzarella <sgarzare@redhat.com>
    Message-Id: <1697880319-4937-8-git-send-email-si-wei.liu@oracle.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Tested-by: default avatarLei Yang <leiyang@redhat.com>
    86f6c224
vdpa_sim.c 21.5 KB