From patchwork Mon Jun 6 03:58:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9157193 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 AEEEF60467 for ; Mon, 6 Jun 2016 04:09:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5B8D27B13 for ; Mon, 6 Jun 2016 04:09:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A902281D2; Mon, 6 Jun 2016 04:09:52 +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 5901227B13 for ; Mon, 6 Jun 2016 04:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750764AbcFFEJW (ORCPT ); Mon, 6 Jun 2016 00:09:22 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33876 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150AbcFFEJT (ORCPT ); Mon, 6 Jun 2016 00:09:19 -0400 Received: by mail-pf0-f193.google.com with SMTP id l188so169558pfl.1; Sun, 05 Jun 2016 21:09:19 -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=WWrj8RWQU4Lq2HbmeWMfZ7s/f21OLFFYlplCcsxu2ms=; b=uFBMPdfrJY1WZhfmA1018o/uzGqTncvHW9XaiezvN6nynN3v8u6432ql3DsybEY5vZ sj+vVor90U/HLMAB83y70WCbpvdA3t1zMyAoFeLq7dfVL1+wvObr54hQ90h3RYcKoSUB aXsXWHK6Y+fE9s8ZiA8G7zPiZMLMsqnY5B6UdSX0TX/pq/efrJZhb1wt471SAF9es+S/ TT7t0mFDGvHjyWj1IGa+x/7C104gBDaTx5F3XzxtHl1QOWFNr6FIvw+xD/t+qjKAeQXG iCLfIhjUstFnSXlelCJE4AkjV72KWAe8H4dH9IarhiIVzsM2KYQBOtxOfiRmSeg13eeT cpdg== 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=WWrj8RWQU4Lq2HbmeWMfZ7s/f21OLFFYlplCcsxu2ms=; b=WJitqWU8+odhjw+TAfhHyeN/CfhslxjTMUUuOcEwhDYH5p6Q19Fh5wyMNGpTmcAMlp kivQ9ewqYprRFFQKECxlqN81CnSsC15M7SthpFCG9WMPovlLKmDZBhVGdfPfXZ9v2vqg 9PqPXzaeo4XBKoBnD2eIr79Mn/NvRUHyjPIplhH6MDQJov/ZHHs5G1xg5aa0FgvP4CjK 71N7qfXsMFlv5Rza68lu0Pzh2q0vzwdh7WYuh3QxPfDjtmja7+PAPy8+CJ3lR95PY3go vKD5zpaRDB0b94iNAxwausWdh3kdykXn1DYwaCwmhP8mlhA31cPZgsFLQywCPqUKiQ3R l2bA== X-Gm-Message-State: ALyK8tK4hMpcdjH6gR58X+CpyD2k7Vbw0ViqD0BbOT2eFtSvypQoNVnfnHaSOq671TbUdQ== X-Received: by 10.98.90.67 with SMTP id o64mr22778205pfb.150.1465186159126; Sun, 05 Jun 2016 21:09:19 -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 z12sm23491111pfj.1.2016.06.05.21.09.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jun 2016 21:09:18 -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:58 +0900 Message-Id: <20160606035858.31763.1660.sendpatchset@little-apple> In-Reply-To: <20160606035723.31763.66500.sendpatchset@little-apple> References: <20160606035723.31763.66500.sendpatchset@little-apple> Subject: [PATCH v2 10/11] iommu/ipmmu-vmsa: Allow two bit SL0 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 support for two bit SL0 bitfield in IMTTBCR by using a separate feature flag. Signed-off-by: Magnus Damm --- Changes since V1: - None drivers/iommu/ipmmu-vmsa.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- 0025/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2016-06-06 11:08:38.360607110 +0900 @@ -38,6 +38,7 @@ struct ipmmu_features { bool has_cache_leaf_nodes; bool has_eight_ctx; bool setup_imbuscr; + bool twobit_imttbcr_sl0; }; struct ipmmu_vmsa_device { @@ -146,6 +147,10 @@ static struct ipmmu_vmsa_domain *to_vmsa #define IMTTBCR_TSZ0_MASK (7 << 0) #define IMTTBCR_TSZ0_SHIFT O +#define IMTTBCR_SL0_TWOBIT_LVL_3 (0 << 6) +#define IMTTBCR_SL0_TWOBIT_LVL_2 (1 << 6) +#define IMTTBCR_SL0_TWOBIT_LVL_1 (2 << 6) + #define IMBUSCR 0x000c #define IMBUSCR_DVM (1 << 2) #define IMBUSCR_BUSSEL_SYS (0 << 0) @@ -381,6 +386,7 @@ static int ipmmu_domain_allocate_context static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain) { u64 ttbr; + u32 tmp; int ret; /* @@ -431,9 +437,15 @@ static int ipmmu_domain_init_context(str * We use long descriptors with inner-shareable WBWA tables and allocate * the whole 32-bit VA space to TTBR0. */ + + if (domain->root->features->twobit_imttbcr_sl0) + tmp = IMTTBCR_SL0_TWOBIT_LVL_1; + else + tmp = IMTTBCR_SL0_LVL_1; + ipmmu_ctx_write(domain, IMTTBCR, IMTTBCR_EAE | IMTTBCR_SH0_INNER_SHAREABLE | IMTTBCR_ORGN0_WB_WA | - IMTTBCR_IRGN0_WB_WA | IMTTBCR_SL0_LVL_1); + IMTTBCR_IRGN0_WB_WA | tmp); /* MAIR0 */ ipmmu_ctx_write(domain, IMMAIR0, domain->cfg.arm_lpae_s1_cfg.mair[0]); @@ -1059,6 +1071,7 @@ static const struct ipmmu_features ipmmu .has_cache_leaf_nodes = false, .has_eight_ctx = false, .setup_imbuscr = true, + .twobit_imttbcr_sl0 = false, }; static const struct of_device_id ipmmu_of_ids[] = {