Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1669007

[PATCH v4 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Magnus Damm <magnus.damm@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v4 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
Date Mon, 19 Jun 2017 13:10:01 +0200
Message-ID <tU2Jb-1RM-9@gated-at.bofh.it> (permalink)
References <tU2Jb-1RM-11@gated-at.bofh.it>
X-Original-To joro@8bytes.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=r1r9+yeyxNpZukflAX18/VebNWM1Y8lEIuTpHMYkv3I=; b=QzjjogOkHCEiSZxx/ok2xyHlOGzNGHQsG4AYcfpRdU/ERCsccDvbNZc8IVeh5cObUY sSXU9Jc3a+fKfkKa7d+YNKXqeaQ101RNnG3rV5XVHW2eSFdwhSlFwiLEPC7GrDa1ptOQ FZsRufP92Xj/QHTRgn9w8xN/MHYQTYw2L740ymB7siVkqgs2d7IbxIv8eb5AFNkAde1k Ilhatv3PPY8U9L/EDSGErAKP6gTHfC1oEoIVVLTSpTql3TvSTRr3+mPcCrBMNxmDUovJ U+hYKdHM8ijXCveREBMAB64a/Q33MP3IhUvyJo/x+BNbLSyXeVRw3U4AuJCWW0p8+Pmj XDig==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:date:message-id:in-reply-to :references:subject; bh=r1r9+yeyxNpZukflAX18/VebNWM1Y8lEIuTpHMYkv3I=; b=dxP5u2jLIw7qtHhhbjx2Sll3Dj5DnCV8Wk5l1NmP/YGfCCDWePRLA6V3iF2sUTTkX1 3AAOPu0S/bxsCoh7mJhGPJYM1XRJx+tKOuzD5ycSpoUwe7F9aFQyRL+nYlVaLZE8yggI d92JviaUXGXRBg/DMgeV4rcC2tCt7j4YFevhqymH+la1LLnDCYoMNKBkC7LXUUvTX3vm Wrrm9IopR+x+JwjKGKDw3TOJ/8NYQUqAvcbTPLFXOnzoIAZylqeQyAkCjETEcgXqHHGb ut9moCiaL7ubv22U9nLbFLbi6OdDehHyVyPMyhjs4N/u3vAlowVXWq8U9OXgdBEc85QA X0KA==
X-Gm-Message-State AKS2vOxGY6BE8AdCFE+F7MQ5UHA+Qbm5smFXYtUkFfdD+fkriV3q5qzP E7WESaydnA4sHQ==
X-Received by 10.98.212.73 with SMTP id u9mr24936634pfl.101.1497870504495; Mon, 19 Jun 2017 04:08:24 -0700 (PDT)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 69
Organization linux.* mail to news gateway
X-Original-Cc laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, iommu@lists.linux-foundation.org, horms+renesas@verge.net.au, Magnus Damm <magnus.damm@gmail.com>, robin.murphy@arm.com, m.szyprowski@samsung.com
X-Original-Date Mon, 19 Jun 2017 20:04:37 +0900
X-Original-Message-ID <149787027730.32495.785135660592328553.sendpatchset@little-apple>
X-Original-References <149787025647.32495.1584960416060100962.sendpatchset@little-apple>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1669007

Show key headers only | View raw


From: Magnus Damm <damm+renesas@opensource.se>

Bump up the maximum numbers of micro-TLBS to 48.

Each IPMMU device instance get micro-TLB assignment via
the "iommus" property in DT. Older SoCs tend to use a
maximum number of 32 micro-TLBs per IPMMU instance however
newer SoCs such as r8a7796 make use of up to 48 micro-TLBs.

At this point no SoC specific handling is done to validate
the maximum number of micro-TLBs, and because of that the
DT information is assumed to be within correct range for
each particular SoC.

If needed in the future SoC specific feature flags can be
added to handle the maximum number of micro-TLBs without
requiring DT changes, however at this point this does not
seem necessary.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---

 Changes since V3:
 - None

 Changes since V2:
 - Added outer set of () to IMUASID() and IMUCTR() - thanks Ramesh!
 - Added Reviewed-by from Geert - thanks!

 Changes since V1:
 - Added support for the second I/O range at 0x600.

 drivers/iommu/ipmmu-vmsa.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- 0015/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c	2017-06-19 19:47:28.950607110 +0900
@@ -199,7 +199,9 @@ static struct ipmmu_vmsa_iommu_priv *to_
 #define IMPMBA(n)			(0x0280 + ((n) * 4))
 #define IMPMBD(n)			(0x02c0 + ((n) * 4))
 
-#define IMUCTR(n)			(0x0300 + ((n) * 16))
+#define IMUCTR(n)			((n) < 32 ? IMUCTR0(n) : IMUCTR32(n))
+#define IMUCTR0(n)			(0x0300 + ((n) * 16))
+#define IMUCTR32(n)			(0x0600 + (((n) - 32) * 16))
 #define IMUCTR_FIXADDEN			(1 << 31)
 #define IMUCTR_FIXADD_MASK		(0xff << 16)
 #define IMUCTR_FIXADD_SHIFT		16
@@ -209,7 +211,9 @@ static struct ipmmu_vmsa_iommu_priv *to_
 #define IMUCTR_FLUSH			(1 << 1)
 #define IMUCTR_MMUEN			(1 << 0)
 
-#define IMUASID(n)			(0x0308 + ((n) * 16))
+#define IMUASID(n)			((n) < 32 ? IMUASID0(n) : IMUASID32(n))
+#define IMUASID0(n)			(0x0308 + ((n) * 16))
+#define IMUASID32(n)			(0x0608 + (((n) - 32) * 16))
 #define IMUASID_ASID8_MASK		(0xff << 8)
 #define IMUASID_ASID8_SHIFT		8
 #define IMUASID_ASID0_MASK		(0xff << 0)
@@ -1066,7 +1070,7 @@ static int ipmmu_probe(struct platform_d
 	}
 
 	mmu->dev = &pdev->dev;
-	mmu->num_utlbs = 32;
+	mmu->num_utlbs = 48;
 	spin_lock_init(&mmu->lock);
 	bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
 	mmu->features = of_device_get_match_data(&pdev->dev);

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/3] iommu/ipmmu-vmsa: r8a7796 support V4 Magnus Damm <magnus.damm@gmail.com> - 2017-06-19 13:10 +0200
  [PATCH v4 2/3] iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48 Magnus Damm <magnus.damm@gmail.com> - 2017-06-19 13:10 +0200
  [PATCH v4 1/3] iommu/ipmmu-vmsa: Add r8a7796 DT binding Magnus Damm <magnus.damm@gmail.com> - 2017-06-19 13:10 +0200
  [PATCH v4 3/3] iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code Magnus Damm <magnus.damm@gmail.com> - 2017-06-19 13:10 +0200

csiph-web