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

RE: [PATCH 09/10] iommu/ipmmu-vmsa: Use refcount for the micro-TLBs


  • To: Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
  • Date: Thu, 16 Dec 2021 13:20:54 +0000
  • Accept-language: ja-JP, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nlyheXEXQjyolMa/KTrQIsnDMzW4nqwVgdNxyAfoyYQ=; b=bgyEtwZouTDsy2rCKAF64vUOArUODIw25RTQYJofOq8EKW+wWNY2JTZzeF5DDnUB0mcBIsnmqDmY07AoVmqWNf9whXxgPSlNyXDhyun2dK3+0jNvPMSi8iTaQVMDALUv8v3xNKjzFDdB7m9AtZviD9e9v2Sqr4k5cxpzBt7ZSuO6JGEcZZl4hoUKMTC1zha9+t4fY4HSOqriCxTPJVOBFdaanPR+AMDmdmNbH484vN+W8FUU++4B4BXnKImKNDRiEFPoU3GR3mJSJ4WuhBhqV+YpBCCgBJnCsRosWd0pA6JwVsu4hJc5RzxQItlipPJWy1FfEO6t5XtVudlYk+7DiA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OCo5nAUS9xeHwaxZPLGDfiuLEwJEhHsTnXJ+IZaifHkyu7K6sNCYlpqj05WGcQ/4yKmhQrbnDZxH5AmRG9tlhbF5QKTpUZKun9iAHXk9BTBIMO+gHSixEpqOmsRfzjxmEEZhAvnmJwF0H7cz0QkTHY5+u2+S8ZlhaYl/y9Hs+RpTaCJQhkjlUSeq+Vmj99vs4r9OYyi4sX/O6nsxgmmB+YNNwtMiF3nxdgEb9LgEho2Y7qOl51Bodo3HU0+lWflFlkqzvO13VjAqqz2lYtfdrjdDvCwjzAendjUddwXRS80O5fTkovNUWTO5ef3HN8OmX/uah6uP77CoQTEYwi3RZw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com;
  • Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Thu, 16 Dec 2021 13:21:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHX47d7s26TeYK9j0qz+isKX7yf4Kw1N4gQ
  • Thread-topic: [PATCH 09/10] iommu/ipmmu-vmsa: Use refcount for the micro-TLBs

Hello Oleksandr-san,

Thank you for the patch!

> From: Oleksandr Tyshchenko, Sent: Sunday, November 28, 2021 2:52 AM
> 
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> 
> Reference-count the micro-TLBs as several bus masters can be
> connected to the same micro-TLB (and drop TODO comment).
> This wasn't an issue so far, since the platform devices
> (this driver deals with) get assigned/deassigned together during
> domain creation/destruction. But, in order to support PCI devices
> (which are hot-pluggable) in the near future we will need to
> take care of.
> 
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> ---
>  xen/drivers/passthrough/arm/ipmmu-vmsa.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c 
> b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> index 22dd84e..32609f8 100644
> --- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> +++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> @@ -134,6 +134,7 @@ struct ipmmu_vmsa_device {
>      spinlock_t lock;    /* Protects ctx and domains[] */
>      DECLARE_BITMAP(ctx, IPMMU_CTX_MAX);
>      struct ipmmu_vmsa_domain *domains[IPMMU_CTX_MAX];
> +    unsigned int utlb_refcount[IPMMU_UTLB_MAX];
>      const struct ipmmu_features *features;
>  };
> 
> @@ -477,13 +478,12 @@ static int ipmmu_utlb_enable(struct ipmmu_vmsa_domain 
> *domain,
>          }
>      }
> 
> -    /*
> -     * TODO: Reference-count the micro-TLB as several bus masters can be
> -     * connected to the same micro-TLB.
> -     */
> -    ipmmu_imuasid_write(mmu, utlb, 0);
> -    ipmmu_imuctr_write(mmu, utlb, imuctr |
> -                       IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_MMUEN);
> +    if ( mmu->utlb_refcount[utlb]++ == 0 )
> +    {
> +        ipmmu_imuasid_write(mmu, utlb, 0);
> +        ipmmu_imuctr_write(mmu, utlb, imuctr |
> +                           IMUCTR_TTSEL_MMU(domain->context_id) | 
> IMUCTR_MMUEN);
> +    }
> 
>      return 0;
>  }
> @@ -494,7 +494,8 @@ static void ipmmu_utlb_disable(struct ipmmu_vmsa_domain 
> *domain,
>  {
>      struct ipmmu_vmsa_device *mmu = domain->mmu;
> 
> -    ipmmu_imuctr_write(mmu, utlb, 0);

As Volodymyr-san mentioned before, after we added ASSERT(),

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>

Best regards,
Yoshihiro Shimoda




 


Rackspace

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