[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] xen/arm: smmu: Set/clear IOMMU domain for device

commit c7669d3652b2fe927faa89fa1afc70a9bedd3bea
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
AuthorDate: Wed Aug 18 08:22:02 2021 +0300
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Tue Aug 24 10:08:25 2021 +0000

    xen/arm: smmu: Set/clear IOMMU domain for device
    When a device is assigned/de-assigned it is required to properly set
    IOMMU domain used to protect the device. This assignment was missing,
    thus it was not possible to de-assign the device:
    (XEN) Deassigning device 0000:03:00.0 from dom2
    (XEN) smmu: 0000:03:00.0:  not attached to domain 2
    (XEN) d2: deassign (0000:03:00.0) failed (-3)
    Fix this by assigning IOMMU domain on arm_smmu_assign_dev and reset it
    to NULL on arm_smmu_deassign_dev.
    Fixes: 06d1f7a278dd ("xen/arm: smmuv1: Keep track of S2CR state")
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
 xen/drivers/passthrough/arm/smmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/drivers/passthrough/arm/smmu.c 
index c234ad9c7f..c9dfc4caa0 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -2768,6 +2768,7 @@ static int arm_smmu_assign_dev(struct domain *d, u8 devfn,
        } else {
+               dev_iommu_domain(dev) = domain;
@@ -2791,6 +2792,7 @@ static int arm_smmu_deassign_dev(struct domain *d, struct 
device *dev)
        arm_smmu_detach_dev(domain, dev);
+       dev_iommu_domain(dev) = NULL;
        if (domain->ref.counter == 0)
generated by git-patchbot for /home/xen/git/xen.git#master



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.