From patchwork Thu Mar 17 16:30:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 8613071 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22730C0553 for ; Thu, 17 Mar 2016 16:27:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77BDE20306 for ; Thu, 17 Mar 2016 16:27:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A1AB5202AE for ; Thu, 17 Mar 2016 16:27:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936270AbcCQQ0y (ORCPT ); Thu, 17 Mar 2016 12:26:54 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:32783 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030924AbcCQQ0w (ORCPT ); Thu, 17 Mar 2016 12:26:52 -0400 Received: by mail-pf0-f176.google.com with SMTP id 124so127587140pfg.0; Thu, 17 Mar 2016 09:26:51 -0700 (PDT) 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) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id qh8sm14500965pac.40.2016.03.17.09.26.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Mar 2016 09:26:50 -0700 (PDT) From: Magnus Damm To: iommu@lists.linux-foundation.org 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 Date: Fri, 18 Mar 2016 01:30:14 +0900 Message-Id: <20160317163014.24104.93912.sendpatchset@little-apple> In-Reply-To: <20160317162909.24104.31682.sendpatchset@little-apple> References: <20160317162909.24104.31682.sendpatchset@little-apple> Subject: [PATCH 07/10] iommu/ipmmu-vmsa: Write IMCTR twice Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }