xen: do not return -EEXIST if iommu_add_dt_device is called twice
authorStefano Stabellini <sstabellini@kernel.org>
Tue, 3 Aug 2021 00:24:07 +0000 (17:24 -0700)
committerJulien Grall <jgrall@amazon.com>
Tue, 3 Aug 2021 09:38:55 +0000 (10:38 +0100)
commit3be443e726626913e328a9a7123cdd19f1c49edb
tree8c635068c6860ea5d1e592de8d0a90c4871ce6a2
parente066ca5acc2ee3b5db5c005e1a548b05e753e07d
xen: do not return -EEXIST if iommu_add_dt_device is called twice

iommu_add_dt_device() returns -EEXIST if the device was already
registered. At the moment, this can only happen if the device was
already assigned to a domain (either dom0 at boot or via
XEN_DOMCTL_assign_device).

In a follow-up patch, we will convert the SMMU driver to use the FW
spec. When the legacy bindings are used, all the devices will be
registered at probe. Therefore, iommu_add_dt_device() will always
returns -EEXIST.

Currently, one caller (XEN_DOMCTL_assign_device) will check the return
and ignore -EEXIST. All the other will fail because it was technically a
programming error.

However, there is no harm to call iommu_add_dt_device() twice, so we can
simply return 0.

With that in place the caller doesn't need to check -EEXIST anymore, so
remove the check.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/drivers/passthrough/device_tree.c