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

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


  • To: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 17 Feb 2021 11:37:59 +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=RF+AlTdElpX6bajun38j3sEa2fmjFdgbKVXV1GWenE0=; b=R9HRWrpQVXQLEfUXwox5RRaqT8YL9hEg3aSfsqO2ssj2I4vevVDymlj0lYRprZU5w6PWH3LzgLZRjLJZ5bcCWSTXZIwa6HdTJeLJ4BbSZ5+qRFfazlUdchr00N/pp059ucftupKqNPiv8rdFgzdI6O9gEWvMEgjrCWHGpQghjK7UjDUdQhGzAy1fdcM3OMJTHYbRQgwzXoBceNrXItV7GNhaPEcstCSSUsQ4xCAZeX9SAq8DCuxEo4dgQSvKA4rKjXIlOowELywfdXs6jj1wM3bnpeNXlHNb3l9+d4A/aG7uKU2GzGUvonBAs4T9tVt+FVyBEk6njo01wsx7ahetSA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L3GdUuE5f7+B71rN25pnVpviZGtiqGMIHKBk5ePyhdvP7YY8dyhuXCt7F/GasRjdq0fJlfBAThXjSCK7ZAFJI1PYryIlPs8fOH81eXIBXAh1mGtR0nbzUPb/6alRL+wrSlnG6VgO6tkXR7Bj5SNdoyxFocIpqheZPzfBYYYNs5ZjlxGIV94a6whzIt7+4aod09aHDG+4/gIn8X1YiDAUTGUYkekf0u/5QAc4Vyj293xAM0kX+9tJWoplS3zpDTtmHIXVKWLWwp2bmilpcQdc7Z7wGVWbpeIqJqh6K8AfEyTrbcLbtFlHkZDlvosdNn4ajIggTIMetDkD1tVhYHAsqA==
  • 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 <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 17 Feb 2021 11:38:16 +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: AQHXBRR8dZBOnjHcyUSWoTi7lR9udKpcOIQA
  • Thread-topic: [PATCH] xen/arm : smmuv3: Fix to handle multiple StreamIds per device.

Hi Rahul,


> On 17 Feb 2021, at 10:05, Rahul Singh <Rahul.Singh@xxxxxxx> wrote:
> 
> 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>

Thanks a lot, this is fixing issues with multiple stream ids for one device :-)

Cheers
Bertrand

> ---
> This patch is a candidate for 4.15 as without this patch it is not possible to
> assign multiple StreamIds to the same device when device is protected behind
> SMMUv3.
> ---
> 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 */
> -- 
> 2.17.1
> 




 


Rackspace

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