iommu/virtio: Return size mapped for a detached domain
authorJean-Philippe Brucker <jean-philippe@linaro.org>
Mon, 15 May 2023 11:39:50 +0000 (12:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:20 +0000 (16:21 +0200)
commit2128318c91303d07689d47414c129dd7976129f0
treeaa6bc24e160f9c3680a0f66a70efde0bbcf4f170
parent0f2c11ccfdcc97b42b78bf407176d220cb990ada
iommu/virtio: Return size mapped for a detached domain

[ Upstream commit 7061b6af34686e7e2364b7240cfb061293218f2d ]

When map() is called on a detached domain, the domain does not exist in
the device so we do not send a MAP request, but we do update the
internal mapping tree, to be replayed on the next attach. Since this
constitutes a successful iommu_map() call, return *mapped in this case
too.

Fixes: 7e62edd7a33a ("iommu/virtio: Add map/unmap_pages() callbacks implementation")
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20230515113946.1017624-3-jean-philippe@linaro.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/virtio-iommu.c