From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756578AbbLANOo (ORCPT ); Tue, 1 Dec 2015 08:14:44 -0500 Received: from mail-db3on0053.outbound.protection.outlook.com ([157.55.234.53]:12096 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756446AbbLANIg (ORCPT ); Tue, 1 Dec 2015 08:08:36 -0500 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; From: Noam Camus To: CC: , , Noam Camus 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 Content-Type: text/plain 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/JCyqgIyytKhthiqzoWlkMVXr+C064t3CuqBnI4MJP?= =?us-ascii?Q?84iqvgosodTlabvcoaospWCmSOE2/R/w17oaf1kpqNmG3P+WBWTxTtLYRm5c?= =?us-ascii?Q?uNNL2bkGLAA6Cm55rvRqZOWCGGZWUhQtmmNUmogCMe7lfbpcYrCyzieVU4tU?= =?us-ascii?Q?F9zx8AP8ZhgIQt82Bn+AjHcd2T/h2+yXvVB/R2OXCoTVaYtiiN9TUcC4Iffm?= =?us-ascii?Q?mwhjxDVX9AazX8DZTVAc0WunjTru0J5iag+GWAkBeLFU95QXc+BW/GXMBb9X?= =?us-ascii?Q?xZ8kcRbRKa3r2FSDqGdpTgKcZxgKmi4HO36/BOo05iW5MTtU3XQKOEZ61BrT?= =?us-ascii?Q?3zjTtm0R8SRBq6TYijNtCVKrbyAdxmjEHLwA8tDdbSs1IsN2S23eN6arnemr?= =?us-ascii?Q?KcVeLLzF5YF56CmI+uZ7ocuZFXMmKWhsvMLh28JFwGZbxroM1cycV7JidJ66?= =?us-ascii?Q?pfTe65XQzbBSp3zK8prNh8lL/GsVCr+rdVSjtfAcORsLLtpkNFDuyEsgZ0N1?= =?us-ascii?Q?5SXy7zFCkSV3bdEJlrdxrj//S7osU5I6oGOPNczwHb7cxndfRdBH1ez3Z6d4?= =?us-ascii?Q?Tj8s42I4IACeOrIqp0cLIMjrHlbUXAhOWZ6FPAtWTLaO0F7+EzL3LTy8iFyW?= =?us-ascii?Q?j1294fJBZRrt5Fqs07FHiAYsBWl6ruUd0NBdayROM/PZ9R2fT2N8qfpwuNUA?= =?us-ascii?Q?TSSphnBoW3YBX2SHrTAHcsh3tUwp/9SDb1PcnZ24OQa13vOfNei0vKV0vidB?= =?us-ascii?Q?nxD83FElNXsc3Nq3BoKtl+PGGTBqofn/LSg/0QYeqsCpqvjoPyvRaUuL25yJ?= =?us-ascii?Q?irtKXcebuTlEewWRQZfmVuF7wWq09UXKMeDhqIqdvKbzKWmC4MD2w9/TVDZ4?= =?us-ascii?Q?3DHTeCiCqJvn6sJXQfxjKLHTSltYqWVnv+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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: noamc@ezchip.com (Noam Camus) Date: Tue, 1 Dec 2015 15:02:59 +0200 Subject: [PATCH v3 12/18] ARC: [plat-eznps] Use dedicated user stack top In-Reply-To: <1448974985-11487-1-git-send-email-noamc@ezchip.com> References: <1448974985-11487-1-git-send-email-noamc@ezchip.com> List-ID: Message-ID: <1448974985-11487-13-git-send-email-noamc@ezchip.com> To: linux-snps-arc@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 -- 1.7.1