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

[xen master] xen/arm : smmuv3: Fix to handle multiple StreamIds per device.



commit 6794cdd08ea8b3512c53b8f162cb3f88fef54d0d
Author:     Rahul Singh <rahul.singh@xxxxxxx>
AuthorDate: Wed Feb 17 10:05:14 2021 +0000
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Fri Feb 19 14:55:54 2021 +0000

    xen/arm : smmuv3: Fix to handle multiple StreamIds per device.
    
    SMMUv3 driver does not handle multiple StreamId if the master device
    supports more than one StreamID.
    
    This bug was introduced when the driver was ported from Linux to XEN.
    dt_device_set_protected(..) should be called from add_device(..) not
    from the dt_xlate(..).
    
    Move dt_device_set_protected(..) from dt_xlate(..) to add_device().
    
    Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
b/xen/drivers/passthrough/arm/smmu-v3.c
index 914cdc1cf4..53d150cdb6 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -2207,24 +2207,6 @@ static int arm_smmu_add_device(u8 devfn, struct device 
*dev)
         */
        arm_smmu_enable_pasid(master);
 
-       return 0;
-
-err_free_master:
-       xfree(master);
-       dev_iommu_priv_set(dev, NULL);
-       return ret;
-}
-
-static int arm_smmu_dt_xlate(struct device *dev,
-                               const struct dt_phandle_args *args)
-{
-       int ret;
-       struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
-
-       ret = iommu_fwspec_add_ids(dev, args->args, 1);
-       if (ret)
-               return ret;
-
        if (dt_device_is_protected(dev_to_dt(dev))) {
                dev_err(dev, "Already added to SMMUv3\n");
                return -EEXIST;
@@ -2237,6 +2219,17 @@ static int arm_smmu_dt_xlate(struct device *dev,
                        dev_name(fwspec->iommu_dev), fwspec->num_ids);
 
        return 0;
+
+err_free_master:
+       xfree(master);
+       dev_iommu_priv_set(dev, NULL);
+       return ret;
+}
+
+static int arm_smmu_dt_xlate(struct device *dev,
+                               const struct dt_phandle_args *args)
+{
+       return iommu_fwspec_add_ids(dev, args->args, 1);
 }
 
 /* Probing and initialisation functions */
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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