From patchwork Tue Dec 1 13:02:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 550845 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9FDE41400DE for ; Wed, 2 Dec 2015 00:12:01 +1100 (AEDT) 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 1a3kit-0005E8-OT; Tue, 01 Dec 2015 13:11:59 +0000 Received: from mail-db3on0099.outbound.protection.outlook.com ([157.55.234.99] helo=emea01-db3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a3kfw-0000sl-Mt for linux-snps-arc@lists.infradead.org; Tue, 01 Dec 2015 13:09:00 +0000 Received: from VI1PR02CA0011.eurprd02.prod.outlook.com (10.162.7.149) by AM3PR02MB1140.eurprd02.prod.outlook.com (10.163.183.142) with Microsoft SMTP Server (TLS) id 15.1.331.20; Tue, 1 Dec 2015 13:08:33 +0000 Received: from AM1FFO11FD014.protection.gbl (2a01:111:f400:7e00::108) by VI1PR02CA0011.outlook.office365.com (2a01:111:e400:581f::21) with Microsoft SMTP Server (TLS) id 15.1.331.20 via Frontend Transport; Tue, 1 Dec 2015 13:08:33 +0000 Authentication-Results: spf=fail (sender IP is 212.179.42.66) smtp.mailfrom=ezchip.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=ezchip.com; Received-SPF: Fail (protection.outlook.com: domain of ezchip.com does not designate 212.179.42.66 as permitted sender) receiver=protection.outlook.com; client-ip=212.179.42.66; helo=ezex10.ezchip.com; Received: from ezex10.ezchip.com (212.179.42.66) by AM1FFO11FD014.mail.protection.outlook.com (10.174.64.92) with Microsoft SMTP Server (TLS) id 15.1.331.11 via Frontend Transport; Tue, 1 Dec 2015 13:08:32 +0000 Received: from localhost.localdomain (10.1.3.132) by ezex10.ezchip.com (10.1.1.4) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 1 Dec 2015 15:08:30 +0200 From: Noam Camus To: Subject: [PATCH v3 12/18] ARC: [plat-eznps] Use dedicated user stack top Date: Tue, 1 Dec 2015 15:02:59 +0200 Message-ID: <1448974985-11487-13-git-send-email-noamc@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1448974985-11487-1-git-send-email-noamc@ezchip.com> References: <1448974985-11487-1-git-send-email-noamc@ezchip.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-21974.007 X-TM-AS-Result: No--10.715100-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD014; 1:igzMSjJeVpjo+5g9GAhIPX55VY1LPAvx4HbTWyvH90emEC9Wb+BgtAkso2adwk2u+bRrpdgZivHnGmm4yaKloe7nM3Hv/dhxooPvP5zf82jPAxHETD7t3EKboDj1EvgS5GAkMMpFAJ13h1gBNCakDHMuCTfdcirNVe0GIStqaf/EF3ObXmsyILjbFvmsHlhwzQ/WuzTv35uuAJ/p7lYZGUpKSvoItFEaV6vsA1Cgp2c3zVu9+aqhwyyxqDbZjGm1eex+bJYImyI/IYkbbl7rLsW4VVYmgxmt/TVd1Mnys97qABT+DKa+LB0TQma9UsIspcX+kgYaAQEj4M+RHxW5ED6/IuFS/+bEgsU5NXUqJs6R1PTlJnNUj3cd3AO4X8iJcza4ZDEKKyzVC39XyJRpsA0ThBiiknK2ynm4edbyZ/g= X-Forefront-Antispam-Report: CIP:212.179.42.66; CTRY:IL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(189998001)(6806005)(104016004)(4001430100002)(105606002)(586003)(86362001)(5008740100001)(50986999)(19580405001)(5003940100001)(19580395003)(1220700001)(48376002)(2950100001)(5001970100001)(110136002)(47776003)(77096005)(85426001)(87936001)(106466001)(2351001)(76176999)(229853001)(92566002)(107886002)(49486002)(50466002)(1096002)(11100500001)(50226001)(36756003)(33646002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR02MB1140; H:ezex10.ezchip.com; FPR:; SPF:Fail; PTR:ezmail.ezchip.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 2:Op2XXxyrSHglC91jy8yxgp0Y/z6efnT14BIvASFkm7vH7qwh3A90eamDkN+ObxpsVwbIRRArkhx4O7qN0xEmuwz1mdpbh6I39yAG2eE9UL6/1NnG0VjyEDvYfUg4wuzsJmsO3XK5As8eRJ0EUq//OA==; 3:TBpNn6aFnfSP9bHCJXGcH0xs3IjMcMlWvVMIfZH1GC3kT2ePQKk/KJA4pvz1KAd37CWwAG5yWpDcIlB2qA1ZhE2ZLC/zPtT8lTubCbNhSLfg34vnYhzdk0z92bPg64bbFNt55joE6G3sIDAyOgFT7CIr81Sx7kUfrh8+47pAv4AFpU3D58FF4XHLrw3jZUFos78+TV9CNznkO0emWvgkve11NmzfWqgiXImWOq0JP8I=; 25:sY3OGRVOs265Zvuw2gGgEqdDlPbHkLIJuu4/BaBO9oFtUJgSmK43+UFe3IwfQEyz86nkAEk0DLVtKC1z5GnGNpVJuphV+lpD5Xr9LOkXHSTWSrW6IKDxdtqeQbzlUtdt0Lo288vILVYjA8pI3GRgrB8XQGdekEgRWvrqBZrvDUJ+hS9tD3R8oI6UD5V0rWfqFJYyb+TfFX3g6IC1Ve9QC1nJWA4WpbjQ5imZjWjcUIYDZ/ohtIHMKjz/31Ne6yZIwze+Yf8LjQ7JjN1FUEStFw==; 20:VaAWaED0SsYhWJsZxV7xIt7ZbtQJIKJ6Y/NXXAaARwD6m0+4RP9h4kfY8TC5atv0LEp7kQbYIi4BQyeLqW5j8NLw+zBZ4TuNYpE9uvXpRD+bQP9XmF0LoYw9ENhAmveZixl55RatdNa92reCkUpGUOVFEWp/pJ2RBgzQBScEZDo= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM3PR02MB1140; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:AM3PR02MB1140; BCL:0; PCL:0; RULEID:; SRVR:AM3PR02MB1140; X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 4:qgAL+OgUrs3ptrodx4i0OnIvkFszVdwaI8SgIUcORO/fgskF22UNfVYW8eCNL632mHj+Wn7y1S1xh/qP8cBy0T9aTun9GUb8oX3kokJ8XjiysKtls/syJSGYGCF0wNDYM9mmfTeMTuXYlGJrOHCQyBnAuJN/UaSkOuHUspfKvJb/8rwhzEPiXvoWu7q+QiMHDCuoJdNINaP7T+x8vEpn34+8RX0XBkoEd0m68anzTNv7VzbOIoJ0hFcUOJhaD5tyHjr5P/ErIEvkCoa9OgEDQrYGMUAjFPy8KGBhsg/rnIaliG0HRY0oKRamEbMZ/BxwjDjFfpZLQ+QvHwbf3uWpE/XBnmBQjSu0wi+COOBtFcWOoXBTpLV6dqH3VBwF4NqDk6rp1dumUQbAYATDRIsghy255Cxn4c+4qsajmj90ZRqd4iIOX+q/1eUadOWe3Zuo X-Forefront-PRVS: 07778E4001 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR02MB1140; 23:FRAIZaisNxd+r1udCI8Af1lSAG8pFAWcJM4FN6GDr?= =?us-ascii?Q?uvNGPByUXHmdPNTZX3/JCyqgIyytKhth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HTeCiCqJvn6sJXQfxjKLHTSltYqWVnv+vTcUWy0qfauAlZe8kNsK/5Y+ru?= =?us-ascii?Q?xsFdG68cgRzb4uaekfiki5FrmfBVKn+u3mCADtzX12fNTBIOSe1h6eH9M6oQ?= =?us-ascii?Q?B4Qx7OnEr3eKpgwd10YQ/SCcmMuSqvjNujUP+WDhXV2ViYHeg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 5:Ic6vNEWoFKnSwy+pMwIcty6jN+QTL1mogIc9bJCSHiSRqyK/tQtqW/DYi3qgYH9kbksr0LdGV/uLyouyNEd/aVObuXHvA4jPefMMzrSuNLzkhtmUKsNORRFV3AgzAHscQ0f7O7DWxQ0uqjFVG8LNBw==; 24:gxWSRxGOTb7C9O7tg5CMvZBqYzFa1QdlFKIGVPkAtjY10gasz0lIeiKmKeoG12IXIzNtzZgWPnjr1DlsfIjunCjo6eNW3dtZW2V0GwC8/o4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2015 13:08:32.3968 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3; Ip=[212.179.42.66]; Helo=[ezex10.ezchip.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR02MB1140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151201_050857_383020_4C794884 X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [157.55.234.99 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [157.55.234.99 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cmetcalf@ezchip.com, Noam Camus , linux-kernel@vger.kernel.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Noam Camus NPS use special mapping right below TASK_SIZE. Hence we need to lower STACK_TOP so that user stack won't overlap NPS special mapping. Signed-off-by: Noam Camus Acked-by: Vineet Gupta --- arch/arc/include/asm/processor.h | 17 +++++++++++++++++ arch/arc/mm/tlb.c | 6 ++++++ 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h index 8a77ccd..41142ab 100644 --- a/arch/arc/include/asm/processor.h +++ b/arch/arc/include/asm/processor.h @@ -122,7 +122,24 @@ extern unsigned int get_wchan(struct task_struct *p); #define USER_KERNEL_GUTTER (VMALLOC_START - TASK_SIZE) +#ifdef CONFIG_ARC_PLAT_EZNPS +/* NPS architecture defines special window of 129M in user address space for + * special memory areas, when accessing this window the MMU do not use TLB. + * Instead MMU direct the access to: + * 0x57f00000:0x57ffffff -- 1M of closely coupled memory (aka CMEM) + * 0x58000000:0x5fffffff -- 16 huge pages, 8M each, with fixed map (aka FMTs) + * + * CMEM - is the fastest memory we got and its size is 16K. + * FMT - is used to map either to internal/external memory. + * Internal memory is the second fast memory and its size is 16M + * External memory is the biggest memory (16G) and also the slowest. + * + * STACK_TOP need to be PMD align (21bit) that is why we supply 0x57e00000. + */ +#define STACK_TOP 0x57e00000 +#else /* CONFIG_ARC_PLAT_EZNPS */ #define STACK_TOP TASK_SIZE +#endif /* CONFIG_ARC_PLAT_EZNPS */ #define STACK_TOP_MAX STACK_TOP /* This decides where the kernel will search for a free chunk of vm diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c index 843e1a5..01f85e5 100644 --- a/arch/arc/mm/tlb.c +++ b/arch/arc/mm/tlb.c @@ -820,6 +820,12 @@ void arc_mmu_init(void) */ BUILD_BUG_ON(!IS_ALIGNED((CONFIG_ARC_VMALLOC_SIZE << 20), PMD_SIZE)); + /* + * stack top size sanity check, + * Can't be done in processor.h due to header include depenedencies + */ + BUILD_BUG_ON(!IS_ALIGNED(STACK_TOP, PMD_SIZE)); + /* For efficiency sake, kernel is compile time built for a MMU ver * This must match the hardware it is running on. * Linux built for MMU V2, if run on MMU V1 will break down because V1