From patchwork Sat Feb 14 09:55:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 439723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 3A2741402A9 for ; Sat, 14 Feb 2015 20:56:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id CAF7633D35; Sat, 14 Feb 2015 09:56:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BV0CyIoyVPk1; Sat, 14 Feb 2015 09:56:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id DD05233A55; Sat, 14 Feb 2015 09:56:16 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 6A9E21C22B5 for ; Sat, 14 Feb 2015 09:56:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6395A33A55 for ; Sat, 14 Feb 2015 09:56:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J9iNzNgv7Pmh for ; Sat, 14 Feb 2015 09:56:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by silver.osuosl.org (Postfix) with ESMTPS id E250433BAC for ; Sat, 14 Feb 2015 09:56:13 +0000 (UTC) Received: from us02secmta1.synopsys.com (us02secmta1.synopsys.com [10.12.235.96]) by smtprelay.synopsys.com (Postfix) with ESMTP id 7E35010C08F3 for ; Sat, 14 Feb 2015 01:56:13 -0800 (PST) Received: from us02secmta1.internal.synopsys.com (us02secmta1.internal.synopsys.com [127.0.0.1]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 709084E214 for ; Sat, 14 Feb 2015 01:56:13 -0800 (PST) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 4A6954E202 for ; Sat, 14 Feb 2015 01:56:13 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 3E713BE1 for ; Sat, 14 Feb 2015 01:56:13 -0800 (PST) Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id 38B0CBE0 for ; Sat, 14 Feb 2015 01:56:13 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 14 Feb 2015 01:56:13 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 14 Feb 2015 15:26:10 +0530 Received: from vineetg-E7440.internal.synopsys.com (10.12.196.223) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 14 Feb 2015 15:26:09 +0530 From: Vineet Gupta To: Subject: [PATCH 2/8] ARC: add configuration option for MMU page size Date: Sat, 14 Feb 2015 15:25:38 +0530 Message-ID: <1423907744-2394-3-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423907744-2394-1-git-send-email-vgupta@synopsys.com> References: <1423907744-2394-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.12.196.223] Cc: Vineet Gupta , Alexey.Brodkin@synopsys.com X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: uclibc-bounces@uclibc.org Sender: "uClibc" From: Alexey Brodkin ARC CPU may have MMU page size of 4/8(default)/16k. uClibc needs to have page size configured accodring to HW it will be run on. Signed-off-by: Alexey Brodkin Signed-off-by: Vineet Gupta --- extra/Configs/Config.arc | 17 +++++++++++++++++ libc/sysdeps/linux/arc/bits/uClibc_page.h | 17 +++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/extra/Configs/Config.arc b/extra/Configs/Config.arc index 40ff114cf5b5..dc32ba4fb2aa 100644 --- a/extra/Configs/Config.arc +++ b/extra/Configs/Config.arc @@ -21,3 +21,20 @@ config CONFIG_ARC_CPU_700 ARCompact ISA based ARC CPU endchoice + +choice + prompt "MMU Page Size" + default CONFIG_ARC_PAGE_SIZE_8K + +config CONFIG_ARC_PAGE_SIZE_8K + bool "8KB" + help + Choose between 4k, 8k (default) or 16k + +config CONFIG_ARC_PAGE_SIZE_16K + bool "16KB" + +config CONFIG_ARC_PAGE_SIZE_4K + bool "4KB" + +endchoice diff --git a/libc/sysdeps/linux/arc/bits/uClibc_page.h b/libc/sysdeps/linux/arc/bits/uClibc_page.h index 26cec54c961f..b05c57501375 100755 --- a/libc/sysdeps/linux/arc/bits/uClibc_page.h +++ b/libc/sysdeps/linux/arc/bits/uClibc_page.h @@ -9,16 +9,25 @@ /* * ARC700/linux supports 4k, 8k, 16k pages (build time). - * We rely on the kernel exported header (aka uapi headers since 3.8) - * for PAGE_SIZE and friends. This avoids hand-editing here when building - * toolchain. * * Although uClibc determines page size dynamically, from kernel's auxv which * ARC Linux does pass, still the generic code needs a fall back * _dl_pagesize = auxvt[AT_PAGESZ].a_un.a_val ? : PAGE_SIZE * */ -#include + +#include + +#if defined(__CONFIG_ARC_PAGE_SIZE_16K__) +#define PAGE_SHIFT 14 +#elif defined(__CONFIG_ARC_PAGE_SIZE_4K__) +#define PAGE_SHIFT 12 +#else +#define PAGE_SHIFT 13 +#endif + +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) /* TBD: fix this with runtime value for a PAGE_SIZE agnostic uClibc */ #define MMAP2_PAGE_SHIFT PAGE_SHIFT