From patchwork Tue Dec 15 13:05:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 7854621 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 A7F2EBEEE1 for ; Tue, 15 Dec 2015 13:06:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BEBFB20304 for ; Tue, 15 Dec 2015 13:06:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA676201F5 for ; Tue, 15 Dec 2015 13:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932733AbbLONES (ORCPT ); Tue, 15 Dec 2015 08:04:18 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:36199 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932176AbbLONEQ (ORCPT ); Tue, 15 Dec 2015 08:04:16 -0500 Received: by mail-pa0-f41.google.com with SMTP id dm15so4553335pac.3; Tue, 15 Dec 2015 05:04:16 -0800 (PST) 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=b4q5WqkvFJCtiFpIb+GCQfwXP3MNP3RFOGAVC3ushCw=; b=DZsF5T8Euj90whWd07wq3IDw51/4vDdX+7pxJ3ubQHKyoDW2XvJBhBJoe2pl/zsqOJ s6h117C5cucmauRCKPC5WKQbr2/05KFdagLccv/idzQEV5W39m9+t4kRwRy4+E4/hGsY pQWOb9TNwB9AvyqFemYdrrsYPTXKKtdjpQxcxE9Dd3D0Y3y/p5zrt4v9IthtGhLc6E5D BKLJ1UzZeh7YIT7VQGNw0lXHs57Vc/YK0z/X58Zbfcg0QlAZysdJIfvEuKzmfN7yMftx gzgLkC6QcJdIhTzB71uccQq2AwKVrXpHPqPRi46keH1iH7iWAJ19RFtrBwNrsPS4q8fF lTFA== X-Received: by 10.66.160.100 with SMTP id xj4mr54460058pab.14.1450184656213; Tue, 15 Dec 2015 05:04:16 -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 hw7sm2370503pac.12.2015.12.15.05.04.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Dec 2015 05:04:15 -0800 (PST) From: Magnus Damm To: iommu@lists.linux-foundation.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, linux-sh@vger.kernel.org, joro@8bytes.org, linux-kernel@vger.kernel.org, horms+renesas@verge.net.au, Magnus Damm Date: Tue, 15 Dec 2015 22:05:55 +0900 Message-Id: <20151215130555.13535.39164.sendpatchset@little-apple> In-Reply-To: <20151215130508.13535.26186.sendpatchset@little-apple> References: <20151215130508.13535.26186.sendpatchset@little-apple> Subject: [PATCH/RFC 05/10] iommu/ipmmu-vmsa: Allow two bit SL0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@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, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Introduce support for two bit SL0 bitfield in IMTTBCR by using a separate feature flag. Signed-off-by: Magnus Damm --- drivers/iommu/ipmmu-vmsa.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0014/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2015-12-15 21:17:55.110513000 +0900 @@ -35,6 +35,7 @@ struct ipmmu_features { bool use_ns_alias_offset; bool has_cache_leaf_nodes; bool setup_imbuscr; + bool twobit_imttbcr_sl0; }; struct ipmmu_vmsa_device { @@ -139,6 +140,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) @@ -377,6 +382,7 @@ static struct iommu_gather_ops ipmmu_gat static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain) { phys_addr_t ttbr; + u32 tmp; int ret; /* @@ -428,9 +434,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]); @@ -878,6 +890,7 @@ static const struct ipmmu_features ipmmu .use_ns_alias_offset = true, .has_cache_leaf_nodes = false, .setup_imbuscr = true, + .twobit_imttbcr_sl0 = false, }; static const struct of_device_id ipmmu_of_ids[] = {