mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
drm/virtio: move mapping teardown to virtio_gpu_cleanup_object()
Stop sending DETACH_BACKING commands, that will happening anyway when releasing resources via UNREF. Handle guest-side cleanup in virtio_gpu_cleanup_object(), called when the host finished processing the UNREF command. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Link: http://patchwork.freedesktop.org/patch/msgid/20200207074638.26386-4-kraxel@redhat.com Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
This commit is contained in:
parent
1ed5f698ad
commit
2fe4ca9d0e
3 changed files with 12 additions and 50 deletions
|
@ -23,6 +23,7 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/moduleparam.h>
|
||||
|
||||
#include "virtgpu_drv.h"
|
||||
|
@ -65,6 +66,17 @@ void virtio_gpu_cleanup_object(struct virtio_gpu_object *bo)
|
|||
{
|
||||
struct virtio_gpu_device *vgdev = bo->base.base.dev->dev_private;
|
||||
|
||||
if (bo->pages) {
|
||||
if (bo->mapped) {
|
||||
dma_unmap_sg(vgdev->vdev->dev.parent,
|
||||
bo->pages->sgl, bo->mapped,
|
||||
DMA_TO_DEVICE);
|
||||
bo->mapped = 0;
|
||||
}
|
||||
sg_free_table(bo->pages);
|
||||
bo->pages = NULL;
|
||||
drm_gem_shmem_unpin(&bo->base.base);
|
||||
}
|
||||
virtio_gpu_resource_id_put(vgdev, bo->hw_res_handle);
|
||||
drm_gem_shmem_free_object(&bo->base.base);
|
||||
}
|
||||
|
@ -74,8 +86,6 @@ static void virtio_gpu_free_object(struct drm_gem_object *obj)
|
|||
struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj);
|
||||
struct virtio_gpu_device *vgdev = bo->base.base.dev->dev_private;
|
||||
|
||||
if (bo->pages)
|
||||
virtio_gpu_object_detach(vgdev, bo);
|
||||
if (bo->created) {
|
||||
virtio_gpu_cmd_unref_resource(vgdev, bo);
|
||||
/* completion handler calls virtio_gpu_cleanup_object() */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue