From patchwork Wed Mar 8 11:02:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9610897 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 01ACD6046A for ; Wed, 8 Mar 2017 11:16:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09B9E28507 for ; Wed, 8 Mar 2017 11:16:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F23CF28567; Wed, 8 Mar 2017 11:16:39 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 64EBC28507 for ; Wed, 8 Mar 2017 11:16:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751465AbdCHLQj (ORCPT ); Wed, 8 Mar 2017 06:16:39 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34237 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752260AbdCHLQX (ORCPT ); Wed, 8 Mar 2017 06:16:23 -0500 Received: by mail-pg0-f66.google.com with SMTP id b5so3175634pgg.1; Wed, 08 Mar 2017 03:16:01 -0800 (PST) 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=8p6y92NfeThkNW8RO/H8omO7AwsNCJnOVpthYCm4Z3M=; b=JvNTBHGBEmYFpKxjAXpkkLbr2Gwg1skhsjN1dYH7rwZ7x7dRRApNdfUCUzyC/CF5fv iD51upl5YSHXkZP9j4JYr64Nx1qlC289OFFQlvbmMa0ZladBtb3KNyAsH1Q6AT3RA+fr kek9CptzHmEd1zdv9dACDmH0WTzW3g5y++tiOF5ePM7XCheAza2J+jWWbCmX8kjuJ/3c lt1XHaimPpZBeSrD59FWZPJtkfmvPxIJsTODp9IkLcyWqksS1Rh9FESTHIMbX1LQDhHl 8LhkEtEXTiBzULu8w2KYhvDxR/Lzp0r6BiEM+1ynt45bIbLM8EIqjWBLWO764qWyizjg q5PQ== 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=8p6y92NfeThkNW8RO/H8omO7AwsNCJnOVpthYCm4Z3M=; b=HVQoPPRISfhTsOGyU154dGq5YMY/uo8H63UB/iRd4KvakC9uTe0oRlmF6oMsuBX3UR /+yk1MX85MBnYbgNDukJeGW49jCoezS5yEOWFbINXZoBhEvgmidWcS+kbVFivrpdzTGB VBUD4uSx/wsMUJzK1IBOTwSqqsVW0uCi3i4abqcK+L6xAJXq8odNck2gmTCchImyNX2a yhwe+86zcHS6aMd0tvjNoT5L7CcQ+FfI1ySia3D5LDcIP6fQI6jesnnxEHHna24ar1Zv +s1O7CNWSGbYf7w2Je8KN3UNO0pzpqnqZ7UwAqf7x7SokpcWgJ4n7EAek7pB6XthZeZ6 X5ww== X-Gm-Message-State: AMke39ky39pg0T3aZ8D8ojePXTwiPx8hoDsTTZ7tdNMGfMvk7NpNDwKCaxg4NCZeVZk31w== X-Received: by 10.98.204.25 with SMTP id a25mr6356562pfg.6.1488971285339; Wed, 08 Mar 2017 03:08:05 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id a5sm5490646pfh.124.2017.03.08.03.08.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Mar 2017 03:08:04 -0800 (PST) From: Magnus Damm To: joro@8bytes.org 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 , robin.murphy@arm.com, m.szyprowski@samsung.com Date: Wed, 08 Mar 2017 20:02:23 +0900 Message-Id: <148897094380.16106.17145886836361556040.sendpatchset@little-apple> In-Reply-To: <148897088333.16106.13237004440297956899.sendpatchset@little-apple> References: <148897088333.16106.13237004440297956899.sendpatchset@little-apple> Subject: [PATCH v3 06/09] 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 V2: - None Changes since V1: - None drivers/iommu/ipmmu-vmsa.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) --- 0018/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-03-08 18:30:36.870607110 +0900 @@ -286,6 +286,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 */ @@ -312,7 +322,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); } @@ -472,7 +482,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; } @@ -498,7 +509,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); }