From patchwork Mon Jun 6 03:58:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9157199 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AEFCF60467 for ; Mon, 6 Jun 2016 04:10:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A572027B13 for ; Mon, 6 Jun 2016 04:10:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A0C7281D2; Mon, 6 Jun 2016 04:10:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3848327B13 for ; Mon, 6 Jun 2016 04:10:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752863AbcFFEKC (ORCPT ); Mon, 6 Jun 2016 00:10:02 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34845 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbcFFEJB (ORCPT ); Mon, 6 Jun 2016 00:09:01 -0400 Received: by mail-pf0-f196.google.com with SMTP id z187so2594852pfz.2; Sun, 05 Jun 2016 21:09:01 -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=sqonWluZ/M2+x1FFitjMdw8fUz7c1KmhJxbDjw0B2W8=; b=kJhgcG4UnDePELzGWYhdZN0mGmIwL46ZxBIjVQhI4E8mx3tr/llrw635wtiLlU1EGX 9JOPapXnuPPZZ/VJc7kjvvBTurIlc6V3VvZg/gnSNrlGHfm+ehSs8/JkgFirJBx23O3c qqx80bdE48sdhibP5NR0Dr7+kc9uA3DSBg2jyztLetM4+nPmtZ/Xpuwl0ZZDvAyA6LIt K3O4FhyUQjBvU7nx9OaAteh068mZQU0TrhVfxYy0D2CNLlOYpHWkEkVPN1lYK+s1iJWF EkCkzRo1L87qRoUldL4yI4+H7JLmlFRLXgjqq6jrfMbrSgluP/k/D0trp9VvpJ/mVKuc FooQ== 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=sqonWluZ/M2+x1FFitjMdw8fUz7c1KmhJxbDjw0B2W8=; b=JTNPjFcgFIw3DJkqUnsHXmUiT/rjHh4eEAeIACZRMgAOwfARafX+OBw5QwTomyheE3 IXYTNcEEZeHh18z0HNN8Juo76wALrxD4ho0uCKqBVLyeTts7PIIn3QhhvK9Iimgh6sbN 8F8cqSy2To7n+huGtLhcbDmk11j1fDPfmX3cwWsb5ZP//1mljDwqaijoPlviRcapNldn 1+zL78ACr0dr0HEUcDfUx926PRaWuJkTIYIJmdAH5NkLIJrZo0CAZjnSs3vaElaaC+FU CFt0lZOShgX/XU6KtARg4+55cPo+eyO4/70nuWKQbXnsRVtAVWUHgq3oECNg9h2EnBxm CzOA== X-Gm-Message-State: ALyK8tJ9kfNlTIrq+F5xqY5NJ4QPvMeTW1aVShYXqwuIvnjJr9ogzloRIKVyz6dlaEJIlg== X-Received: by 10.98.4.195 with SMTP id 186mr23081955pfe.98.1465186141116; Sun, 05 Jun 2016 21:09:01 -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 22sm23352483pfw.92.2016.06.05.21.08.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jun 2016 21:09:00 -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: Mon, 06 Jun 2016 12:58:40 +0900 Message-Id: <20160606035840.31763.40773.sendpatchset@little-apple> In-Reply-To: <20160606035723.31763.66500.sendpatchset@little-apple> References: <20160606035723.31763.66500.sendpatchset@little-apple> Subject: [PATCH v2 08/11] 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-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Write IMCTR both in the root device and the leaf node. Signed-off-by: Magnus Damm --- Changes since V1: - None 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-06-06 11:03:22.610607110 +0900 @@ -261,6 +261,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 */ @@ -287,7 +297,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); } @@ -445,7 +455,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; } @@ -471,7 +482,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); ipmmu_domain_free_context(domain->root, domain->context_id); }