iommu/iova: Separate out rcache init
authorJohn Garry <john.garry@huawei.com>
Thu, 3 Feb 2022 09:59:20 +0000 (17:59 +0800)
committerJoerg Roedel <jroedel@suse.de>
Mon, 14 Feb 2022 14:43:15 +0000 (15:43 +0100)
commit32e92d9f6f876721cc4f565f8369d542b6266380
tree5bff28207f3a1b6108f3791914d8f2212d37f017
parent114a6f5015df8eda0cf37302914cb15a3da3f086
iommu/iova: Separate out rcache init

Currently the rcache structures are allocated for all IOVA domains, even if
they do not use "fast" alloc+free interface. This is wasteful of memory.

In addition, fails in init_iova_rcaches() are not handled safely, which is
less than ideal.

Make "fast" users call a separate rcache init explicitly, which includes
error checking.

Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/1643882360-241739-1-git-send-email-john.garry@huawei.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/dma-iommu.c
drivers/iommu/iova.c
drivers/vdpa/vdpa_user/iova_domain.c
include/linux/iova.h