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


Groups > linux.kernel > #1360011

[PATCH 02/10] iommu/ipmmu-vmsa: Enable multi context support

From Magnus Damm <magnus.damm@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 02/10] iommu/ipmmu-vmsa: Enable multi context support
Date 2016-03-17 17:30 +0100
Message-ID <rdIYc-1i1-49@gated-at.bofh.it> (permalink)
References <rdIY9-1i1-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Add support for up to 4 contexts. Each context is mapped
to one domain. One domain is associated with each device,
however one or more uTLBs for a single device are kept
in the same domain.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 drivers/iommu/ipmmu-vmsa.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- 0015/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c	2016-03-18 00:15:49.180513000 +0900
@@ -31,7 +31,7 @@
 
 #include "io-pgtable.h"
 
-#define IPMMU_CTX_MAX 1
+#define IPMMU_CTX_MAX 4
 
 struct ipmmu_vmsa_device {
 	struct device *dev;
@@ -536,6 +536,13 @@ static int ipmmu_attach_device(struct io
 		/* The domain hasn't been used yet, initialize it. */
 		domain->mmu = mmu;
 		ret = ipmmu_domain_init_context(domain);
+		if (ret < 0) {
+			dev_err(dev, "Unable to initialize IPMMU context\n");
+			domain->mmu = NULL;
+		} else {
+			dev_info(dev, "Using IPMMU context %u\n",
+				 domain->context_id);
+		}
 	} else if (domain->mmu != mmu) {
 		/*
 		 * Something is wrong, we can't attach two devices using
@@ -915,7 +922,7 @@ static void ipmmu_device_reset(struct ip
 	unsigned int i;
 
 	/* Disable all contexts. */
-	for (i = 0; i < 4; ++i)
+	for (i = 0; i < IPMMU_CTX_MAX; ++i)
 		ipmmu_write(mmu, i * IM_CTX_SIZE + IMCTR, 0);
 }
 

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


Thread

[PATCH 00/10] iommu/ipmmu-vmsa: Initial r8a7795 support Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 09/10] iommu/ipmmu-vmsa: Allow two bit SL0 Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 06/10] iommu/ipmmu-vmsa: Add optional root device feature Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 05/10] iommu/ipmmu-vmsa: Introduce features, break out alias Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 10/10] iommu/ipmmu-vmsa: Hook up r8a7795 DT matching code Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 07/10] iommu/ipmmu-vmsa: Write IMCTR twice Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 01/10] iommu/ipmmu-vmsa: Make use of IOMMU_OF_DECLARE() Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 03/10] iommu/ipmmu-vmsa: Teach xlate() to skip disabled iommus Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
    Re: [PATCH 03/10] iommu/ipmmu-vmsa: Teach xlate() to skip disabled iommus Geert Uytterhoeven <geert@linux-m68k.org> - 2016-03-18 10:50 +0100
  [PATCH 08/10] iommu/ipmmu-vmsa: Make IMBUSCTR setup optional Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 04/10] iommu/ipmmu-vmsa: IPMMU device is 64-bit bus master Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100
  [PATCH 02/10] iommu/ipmmu-vmsa: Enable multi context support Magnus Damm <magnus.damm@gmail.com> - 2016-03-17 17:30 +0100

csiph-web