From patchwork Mon Oct 16 12:30:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 10008189 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 AB48160230 for ; Mon, 16 Oct 2017 12:32:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0BC02841C for ; Mon, 16 Oct 2017 12:32:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 952EA2845E; Mon, 16 Oct 2017 12:32:32 +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 1A7912841E for ; Mon, 16 Oct 2017 12:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281AbdJPMcb (ORCPT ); Mon, 16 Oct 2017 08:32:31 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:47138 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752160AbdJPMc3 (ORCPT ); Mon, 16 Oct 2017 08:32:29 -0400 Received: by mail-pf0-f196.google.com with SMTP id z11so15718908pfk.4; Mon, 16 Oct 2017 05:32:29 -0700 (PDT) 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=w7P1fVfA+KEkTIoAFbC3zyyK6en7yrt2Mz08I3YtgNg=; b=VOAaS+hWu+teUx2hlCtgDkR1qBkNusejOiN2hYJfJUPFxZ2RnZkEDr1mUJVhxmPgqD 2Kn6eMY0EawMRpEhxnmnkc8Gete2e+OhH3xHCV/UW8oc87d/+U87LnjQbJhDgehL7YlH 5Li62E3qBTaPSwVyDuvUuKiWarD3weRdJewWWpcAU8eKHbS/mYCpu8pYhiI6q7zwl0WT XbSOhLNAagJRUJVELtmoyIrvefbrJ4lD+t1mQxR4t7iATChDIdKJMPcQ27sS8ZNG3d2B DrdMLUz5QvPn6WyErP0ndiNVRH5Ia98zGYF+H6vSnM2blhC12lb30ujoKJum6l20DObY mMPQ== 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=w7P1fVfA+KEkTIoAFbC3zyyK6en7yrt2Mz08I3YtgNg=; b=PcOrbvRnIu09U5LSZoww4PgLWJdalWioSr1MAXf3E+4AvmRz/sNZlP+P135DqI+6oZ VghVZGnvF7HoqOfexYqXSuHp3Q63R5cRHXY1szZXfHH/6j4zgYbD02on6kuYDQzdH6Vt Og9w8e8l77bJv1KpH9hamlpLk/HU8IAvm+2hpANcFtW3qxj7LZpm2OVlc9KE94cn+CWW 7lfPs1De7TKM88Xw/ZWJv8BPbe6s4vsbWS1/6OrlUIOe2+8SgV6wPvcNWdjzkZgMXXB9 Ix0DNsmTIphwDnLWPqWHapP/LwpomFRbKhgP0tf5LMPAhupJCQoxRCzJ7gyyJLjJq/05 s64w== X-Gm-Message-State: AMCzsaXB2RAbsQY28q/4/yx4+/B3qxCeha/39KG2wHWKEH/3x/ZE6FhL 8Wc3hcmNMt/IKCDe7DPmVsg= X-Google-Smtp-Source: AOwi7QCLC7CJDchMPUwW8XVkpr8RbsE40x72iLAfV64K56ad1h47usywxwQOgKwltLsCOjw+Z+s/fw== X-Received: by 10.159.198.2 with SMTP id f2mr8644703plo.288.1508157149275; Mon, 16 Oct 2017 05:32:29 -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 q8sm14423929pfk.100.2017.10.16.05.32.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 05:32:28 -0700 (PDT) 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: Mon, 16 Oct 2017 21:30:28 +0900 Message-Id: <150815702889.32763.12033574748131141829.sendpatchset@little-apple> In-Reply-To: <150815695455.32763.1660214306749693609.sendpatchset@little-apple> References: <150815695455.32763.1660214306749693609.sendpatchset@little-apple> Subject: [PATCH v5 07/09] iommu/ipmmu-vmsa: Make IMBUSCTR setup optional 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 Introduce a feature to allow opt-out of setting up IMBUSCR. The default case is unchanged. Signed-off-by: Magnus Damm --- Changes since V4: - Use leaf node mmu instead of root Changes since V3: - None Changes since V2: - None Changes since V1: - Updated the commit message - Reworked patch to coexist with the multi context feature drivers/iommu/ipmmu-vmsa.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- 0018/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-10-16 20:20:30.860607110 +0900 @@ -39,6 +39,7 @@ struct ipmmu_features { bool use_ns_alias_offset; bool has_cache_leaf_nodes; unsigned int number_of_contexts; + bool setup_imbuscr; }; struct ipmmu_vmsa_device { @@ -457,9 +458,10 @@ static int ipmmu_domain_init_context(str domain->cfg.arm_lpae_s1_cfg.mair[0]); /* IMBUSCR */ - ipmmu_ctx_write_root(domain, IMBUSCR, - ipmmu_ctx_read_root(domain, IMBUSCR) & - ~(IMBUSCR_DVM | IMBUSCR_BUSSEL_MASK)); + if (domain->mmu->features->setup_imbuscr) + ipmmu_ctx_write_root(domain, IMBUSCR, + ipmmu_ctx_read_root(domain, IMBUSCR) & + ~(IMBUSCR_DVM | IMBUSCR_BUSSEL_MASK)); /* * IMSTR @@ -979,6 +981,7 @@ static const struct ipmmu_features ipmmu .use_ns_alias_offset = true, .has_cache_leaf_nodes = false, .number_of_contexts = 1, /* software only tested with one context */ + .setup_imbuscr = true, }; static const struct of_device_id ipmmu_of_ids[] = {