Path: csiph.com!news.freedyn.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod From: Magnus Damm Newsgroups: linux.kernel Subject: [PATCH 07/10] iommu/ipmmu-vmsa: Write IMCTR twice Date: Thu, 17 Mar 2016 17:30:03 +0100 Message-ID: References: X-Original-To: iommu@lists.linux-foundation.org Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=DjgYfgb72nnyrUnIu1LMbref/qG7Kqo6UBA0j6qj4NY=; b=VE6IiC1kHLRgs9QIdjJCpS26eQkPqclw6aDsk22OAgiIYUdhHiadDbbq8Nv02fxX22 Swpgqtgqkg52wG7KwSemAR31a1GaIpBx/HdT2zSoSCFVlLSOEsxZdCS5njWQEqPQDC0C KwFOMlVn0ztOVrclM7OyfZlT8tWHStHe82K1nhw15esQwi9+kmwmAVK5moFEpwlYwKH+ Lq6r2bAIwMBYbHN+blC2esmqKWF55Azcxy1wyUpj4cW+4sDlZsbkQLwVSAXDw181vREG efgiG+BotEZrhZtgvT0eKl8KCYsPXr7Z6VaAuvP4LDSveyx8i1t2zujPBFiU3vGkzTbI T1NA== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:date:message-id:in-reply-to :references:subject; bh=DjgYfgb72nnyrUnIu1LMbref/qG7Kqo6UBA0j6qj4NY=; b=PXfZo/J7xOVYcl5ESGkh+PqiqapHYDy7MJ/CP7IuaA37iVNuYTzY84HKfHZrchI2Sk DAWk6oZ96yjNn1C2LVYw7N/sZl9Y4wFLHABI04VT/h4CL2ja0HHCtT3Ldh9OK274lX6m zoloU6ib6u+5WmT/kk3ToZ8/W8ES3HHQGxehvwJ3CtHN2qIj8/1vwk7YiWX/VhIAff9B /pP8IrxcwTS5FJ+BYEPMpnpM8fKlD2otNwW3zC3N2872CYYohQCccCUpgT1EbWeU70Mq cAevTB5yB69394hAh/rpJnwERwpFgl/SdxVABgUZa08ahRBbNwQWHsaJojBT6Lff/QIF aZyQ== X-Gm-Message-State: AD7BkJKahO4hXWgNO0gSQPOURowJjOEbCMIsL09Vm4FFmWwKkcJIC1teSES/H0mnmadh7w== X-Received: by 10.98.42.150 with SMTP id q144mr16336764pfq.73.1458232011419; Thu, 17 Mar 2016 09:26:51 -0700 (PDT) Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 57 Organization: linux.* mail to news gateway X-Original-Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, joro@8bytes.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, horms+renesas@verge.net.au, Magnus Damm X-Original-Date: Fri, 18 Mar 2016 01:30:14 +0900 X-Original-Message-ID: <20160317163014.24104.93912.sendpatchset@little-apple> X-Original-References: <20160317162909.24104.31682.sendpatchset@little-apple> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1360006 From: Magnus Damm Write IMCTR both in the root device and the leaf node. Signed-off-by: Magnus Damm --- drivers/iommu/ipmmu-vmsa.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) --- 0021/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2016-03-18 00:31:24.250513000 +0900 @@ -256,6 +256,16 @@ static void ipmmu_ctx_write(struct ipmmu ipmmu_write(domain->root, domain->context_id * IM_CTX_SIZE + reg, data); } +static void ipmmu_ctx_write2(struct ipmmu_vmsa_domain *domain, unsigned int reg, + u32 data) +{ + if (domain->mmu != domain->root) + ipmmu_write(domain->mmu, + domain->context_id * IM_CTX_SIZE + reg, data); + + ipmmu_write(domain->root, domain->context_id * IM_CTX_SIZE + reg, data); +} + /* ----------------------------------------------------------------------------- * TLB and microTLB Management */ @@ -282,7 +292,7 @@ static void ipmmu_tlb_invalidate(struct reg = ipmmu_ctx_read(domain, IMCTR); reg |= IMCTR_FLUSH; - ipmmu_ctx_write(domain, IMCTR, reg); + ipmmu_ctx_write2(domain, IMCTR, reg); ipmmu_tlb_sync(domain); } @@ -422,7 +432,8 @@ static int ipmmu_domain_init_context(str * software management as we have no use for it. Flush the TLB as * required when modifying the context registers. */ - ipmmu_ctx_write(domain, IMCTR, IMCTR_INTEN | IMCTR_FLUSH | IMCTR_MMUEN); + ipmmu_ctx_write2(domain, IMCTR, + IMCTR_INTEN | IMCTR_FLUSH | IMCTR_MMUEN); return 0; } @@ -437,7 +448,7 @@ static void ipmmu_domain_destroy_context * * TODO: Is TLB flush really needed ? */ - ipmmu_ctx_write(domain, IMCTR, IMCTR_FLUSH); + ipmmu_ctx_write2(domain, IMCTR, IMCTR_FLUSH); ipmmu_tlb_sync(domain); }