From patchwork Mon Jun 6 03:20:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Mills X-Patchwork-Id: 69356 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1283362qgf; Sun, 5 Jun 2016 20:22:39 -0700 (PDT) X-Received: by 10.98.111.137 with SMTP id k131mr20452877pfc.136.1465183359921; Sun, 05 Jun 2016 20:22:39 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id k4si23583279paa.181.2016.06.05.20.22.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jun 2016 20:22:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b9l6d-0006kv-IJ; Mon, 06 Jun 2016 03:21:35 +0000 Received: from arroyo.ext.ti.com ([198.47.19.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b9l6M-0006bW-HQ for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2016 03:21:19 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id u563KZ42003149; Sun, 5 Jun 2016 22:20:35 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u563KZDX007099; Sun, 5 Jun 2016 22:20:35 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Sun, 5 Jun 2016 22:20:35 -0500 Received: from gtwmills-t300.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u563KWqW004177; Sun, 5 Jun 2016 22:20:34 -0500 From: Bill Mills To: , , , , Subject: [RFC v2 3/4] ARM: mm: add inner/outer sharing value command line Date: Sun, 5 Jun 2016 23:20:28 -0400 Message-ID: <1465183229-24147-4-git-send-email-wmills@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465183229-24147-1-git-send-email-wmills@ti.com> References: <1465183229-24147-1-git-send-email-wmills@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160605_202118_673747_E1DB5808 X-CRM114-Status: GOOD ( 11.67 ) X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: r-woodruff2@ti.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bill Mills Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Adds defsharing=inner|outer as an early command line option. Any such command line option will override a platform's choice. Signed-off-by: Bill Mills --- arch/arm/include/asm/pgtable-hwdef.h | 1 + arch/arm/mm/mmu.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/include/asm/pgtable-hwdef.h b/arch/arm/include/asm/pgtable-hwdef.h index 27654a9..2a9e24b 100644 --- a/arch/arm/include/asm/pgtable-hwdef.h +++ b/arch/arm/include/asm/pgtable-hwdef.h @@ -31,6 +31,7 @@ struct attr_mod_entry { bool attr_mod_add(struct attr_mod_entry *pmod); bool use_outer_shared(void); +bool use_inner_shared(void); extern int num_attr_mods; extern struct attr_mod_entry attr_mod_table[MAX_ATTR_MOD_ENTRIES]; diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 8aaccf2..cc4a803 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1524,6 +1524,7 @@ typedef void pgtables_remap(long long offset, unsigned long pgd, void *bdata); pgtables_remap lpae_pgtables_remap_asm; int num_attr_mods; +static const char *defshared_seen; /* add an entry to the early page table attribute modification list */ bool __init attr_mod_add(struct attr_mod_entry *pmod) @@ -1547,15 +1548,50 @@ bool __init use_outer_shared(void) .set_mask = PTE_EXT_OSHARED }; + if (defshared_seen) { + pr_err("Default Sharing already set to %s\n", defshared_seen); + return false; + } + if (attr_mod_add(&mod) >= 0) { l_pte_shared = PTE_EXT_OSHARED; pmd_sect_s = PMD_SECT_OSHARED; + defshared_seen = "outer"; return true; } return false; } +/* explicitly use inner shared */ +bool __init use_inner_shared(void) +{ + if (defshared_seen) { + pr_err("Default Sharing already set to %s\n", defshared_seen); + return false; + } + + defshared_seen = "inner"; + return true; +} + +/* + * Allow sharing type to be set + */ +static int __init early_defshared(char *p) +{ + if (strcmp(p, "outer") == 0) + use_outer_shared(); + else if (strcmp(p, "inner") == 0) + use_inner_shared(); + else + pr_err("Unknown defshared mode %s\n", p); + + return 0; +} + +early_param("defshared", early_defshared); + /* * early_paging_init() recreates boot time page table setup, allowing machines * to switch over to a high (>4G) address space on LPAE systems