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

Re: [PATCH] xen/arm: smmuv1: Revert associating the group pointer with the S2CR


  • To: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 16 Apr 2021 14:28:49 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rLoCrhU05SB41bqOWVg+Hxm8NldNj2WvUXUJiMRpR+4=; b=SxyWiKb2240cV7TgZ1G+8KbR7CCcCzzOYFENen5o9MUoM7giKQJrjdJSqChB2l6m8ine5A7RKoYbYhTzuM+22/MgaJjzPuwlV9si37N9+QxwIYO5BdNUj0TS7QAzRBEdzc0umfhfWnjjNg5T2Ds1d2Mx2iefQNEDWKwJ4J9zshqGSzpFYY7TbthL5utGNA0ocXNYi+nCv/MJsLE1E1SzbB+ouDXFgz6fYehGRDg8NqDRApYkiqMWvxk/1zT0rmIdGMS7GInh6iDWoEO2cfdDkGG3CF2jBO/NJaGAi4U/pb4kBAcJuXMoaHNsxjB1pzka8K6BjXNN9oIiS8NPYr+gdg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=noKrk6kzsHxfzer6buoUC/gATjQCWqfdrww5JgOgS7K63tQQEtsMmtYpDJviZ3NRPZV0zTt+U+62Kgh4bzvNaDVjlDEucaug8qZC/oaXfGuAO2Z80HKR6KEkhAiDqA7pB8oysmNWjZBKWAJFD1Wxc171FMKY/ZxBn+XT9O66tH4VFOFMf4/eQgheCKZ0QcbF2u9DM8bkGBR6X7GgVQyc22b5IEKFH7PBUgOcGysA6DAomxxsdChtBKP9R7LFOGzJAmD9UKnz9Jvl4TEY+NdOHYnHUC/QOwZbv7I+yXWEtTRpdO7luMZE9ZLuJmxqMZ3BZk+dDq+Co0Pgtw5E3vBpSw==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 16 Apr 2021 14:29:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXMrMxWiLHM7/9fEaAK+771/NYWqq3NDuA
  • Thread-topic: [PATCH] xen/arm: smmuv1: Revert associating the group pointer with the S2CR

Hi Rahul,

> On 16 Apr 2021, at 12:25, Rahul Singh <rahul.singh@xxxxxxx> wrote:
> 
> Revert the code that associates the group pointer with the S2CR as this
> code causing an issue when the SMMU device has more than one master
> device.
> 
> This code is merged with the commit  "xen/arm: smmuv1: Intelligent
> SMR allocation”.
> 
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers,
Bertrand

> ---
> xen/drivers/passthrough/arm/smmu.c | 44 +++---------------------------
> 1 file changed, 4 insertions(+), 40 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu.c 
> b/xen/drivers/passthrough/arm/smmu.c
> index 24ac4f3a80..1a68c2ab3b 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -597,7 +597,6 @@ enum arm_smmu_arch_version {
> };
> 
> struct arm_smmu_s2cr {
> -     struct iommu_group              *group;
>       int                             count;
>       enum arm_smmu_s2cr_type         type;
>       enum arm_smmu_s2cr_privcfg      privcfg;
> @@ -1498,7 +1497,6 @@ static int arm_smmu_master_alloc_smes(struct device 
> *dev)
>       struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
>       struct arm_smmu_device *smmu = cfg->smmu;
>       struct arm_smmu_smr *smrs = smmu->smrs;
> -     struct iommu_group *group;
>       int i, idx, ret;
> 
>       spin_lock(&smmu->stream_map_lock);
> @@ -1523,19 +1521,9 @@ static int arm_smmu_master_alloc_smes(struct device 
> *dev)
>               cfg->smendx[i] = (s16)idx;
>       }
> 
> -     group = iommu_group_get(dev);
> -     if (!group)
> -             group = ERR_PTR(-ENOMEM);
> -     if (IS_ERR(group)) {
> -             ret = PTR_ERR(group);
> -             goto out_err;
> -     }
> -     iommu_group_put(group);
> -
>       /* It worked! Now, poke the actual hardware */
>       for_each_cfg_sme(cfg, i, idx) {
>               arm_smmu_write_sme(smmu, idx);
> -             smmu->s2crs[idx].group = group;
>       }
> 
>       spin_unlock(&smmu->stream_map_lock);
> @@ -1966,27 +1954,6 @@ static void __arm_smmu_release_pci_iommudata(void 
> *data)
>       kfree(data);
> }
> 
> -static struct iommu_group *arm_smmu_device_group(struct
> -                                             arm_smmu_master_cfg *cfg)
> -{
> -     struct arm_smmu_device *smmu = cfg->smmu;
> -     struct iommu_group *group = NULL;
> -     int i, idx;
> -
> -     for_each_cfg_sme(cfg, i, idx) {
> -             if (group && smmu->s2crs[idx].group &&
> -                 group != smmu->s2crs[idx].group)
> -                     return ERR_PTR(-EINVAL);
> -
> -             group = smmu->s2crs[idx].group;
> -     }
> -
> -     if (group)
> -             return group;
> -
> -     return NULL;
> -}
> -
> static int arm_smmu_add_device(struct device *dev)
> {
>       struct arm_smmu_device *smmu;
> @@ -2027,13 +1994,10 @@ static int arm_smmu_add_device(struct device *dev)
>               cfg->smmu = smmu;
>       }
> 
> -     group = arm_smmu_device_group(cfg);
> -     if (!group) {
> -             group = iommu_group_alloc();
> -             if (IS_ERR(group)) {
> -                     dev_err(dev, "Failed to allocate IOMMU group\n");
> -                     return PTR_ERR(group);
> -             }
> +     group = iommu_group_alloc();
> +     if (IS_ERR(group)) {
> +             dev_err(dev, "Failed to allocate IOMMU group\n");
> +             return PTR_ERR(group);
>       }
> 
>       iommu_group_set_iommudata(group, cfg, releasefn);
> -- 
> 2.17.1
> 


 


Rackspace

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