From patchwork Tue Feb 12 14:00:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10807973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24D391575 for ; Tue, 12 Feb 2019 14:00:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 132292B56B for ; Tue, 12 Feb 2019 14:00:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 110852B7CE; Tue, 12 Feb 2019 14:00:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D9A82B56B for ; Tue, 12 Feb 2019 14:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nCnPItQSkzZYH3nfhujgICZ9tIxh2BnKHSE4GtCJRpc=; b=kBE17+VNOZSJ6W Q687bfzekbIumngTB9xAVGInURdn5xGt4RBaxutJqRB3bar2ruTH3WIPAvdmtlvIZneFG+mykmKtw TW/7PTsNLTvo7O5IjHh3xBFYJlPEGWM1dihUbld22GMaO0QiUTMQxpUOSyvdq/liwLQoz6JPkr4iN 96J6+SwgWNDD1FJQc4wXLMol+u75wueJZTg2REDjLO72HNiqappfdmnFYMDhQSLMFq0Vc5iCw4CT8 Cp2lglJ5m0OEiNGReodzihSzzQH/AOGvYdYNhieGqTzhv7MnUSKqOQdEZ00fgQIPtdWQU+9J6n8SK VQp8N2xkzIaPfsx7gIIQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYbm-0002yK-32; Tue, 12 Feb 2019 14:00:22 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYbe-0002wG-MQ for linux-riscv@lists.infradead.org; Tue, 12 Feb 2019 14:00:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549980015; x=1581516015; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=peWHjgeJOcMs/VI6T5c3UHJM4S2Ufl+OBhS24TMyuHU=; b=fI8+ZH6DumvacDuo9mOHV/mH9otWm0r8grlw8zTdwZwjZnG+zR6DV857 pQTmQ4I2Wqij/qdYgdu5MKlRQG5BBpNU6+V/hZftEh3T6ISoQ553hizm+ F4R9lPr+XgD+ZqDx3v46CTs0Vuvf5MQODDU+AiP1orYBfICFW2rfzpJA2 coSbs7UB/78o9OVck4L2RBZBs3at6F1q85hYmSxHsDWwBRNHSSM0bL57h kJcJKQASM63ieR9DpPnJHW0lqh1VPz3bPEf4vv59I0F58ZVBeoYeJBF7u HqpWFTx7Wc8yAqkDJ56JnWYjKewYniJfMPFVzNc/jVXAFwCFT4XuQ5DkY Q==; X-IronPort-AV: E=Sophos;i="5.58,362,1544457600"; d="scan'208";a="106025549" Received: from mail-bn3nam01lp2053.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.53]) by ob1.hgst.iphmx.com with ESMTP; 12 Feb 2019 22:00:14 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eE7cuLCrwqeCI2GErviQj8ukoOuFeD6pf7McpNqny80=; b=PnsjftTUhZYNtf2Qzp0sFq5RlHfPS0XYC+J00NL1zOzTowrlIDdw57q6Dj7111CUj0MMOFabbLPw2FqjIwPPt2B+492J5LlF9PdlMJfSRkO+424Kji4PRY8+4zNQrOH02hbyOh/+CaxzUiSJz7a4lkOFpxRtnjQOe0Fl+vUQvLI= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB6062.namprd04.prod.outlook.com (20.178.247.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Tue, 12 Feb 2019 14:00:12 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1%7]) with mapi id 15.20.1601.023; Tue, 12 Feb 2019 14:00:12 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v3 1/6] RISC-V: Move free_initrd_mem() to kernel/setup.c Thread-Topic: [PATCH v3 1/6] RISC-V: Move free_initrd_mem() to kernel/setup.c Thread-Index: AQHUwttFxrDRYApwwUmalY3+4syPHQ== Date: Tue, 12 Feb 2019 14:00:12 +0000 Message-ID: <20190212135942.105008-2-anup.patel@wdc.com> References: <20190212135942.105008-1-anup.patel@wdc.com> In-Reply-To: <20190212135942.105008-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0126.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::20) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:de::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [49.207.48.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 246676c1-51ca-4d7e-bdbf-08d690f267b6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:MN2PR04MB6062; x-ms-traffictypediagnostic: MN2PR04MB6062: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MN2PR04MB6062; 23:ahieP0LQNL3ngaItGn/lMOAjVLyaqc6cnv/WtIE?= =?iso-8859-1?q?NHlLlfaG0R6sO+C?= =?iso-8859-1?q?nMddHrmcKGfAhIeMOKeQJy0pkJz0KjP17v0e/AA1Q5YoTkzDW8/v0HGszd/v?= =?iso-8859-1?q?HEL3a/v37wtoyyFsLn+oqT1NStZwxDbpzBLcL7dMdu6LZVIbXl8WKP7E0tCq?= =?iso-8859-1?q?AkB+Clxy+DR4s4VYfbQqteUSbxo2AQhldFExU8vjcDIYXQh6a4Z5T0SuKUlu?= =?iso-8859-1?q?bX/hDE6137Usi5mFUW/LNqy43moKLQUrUuUbUX8qzPDFJX04GdR57hAZfSjK?= =?iso-8859-1?q?miHFdfLzqdux8/79tCA0LHOFZXPLsyPZXh7oOT5u6Y4EWObiP2rvx+JDJLDV?= =?iso-8859-1?q?Y4Xj+nPRMzYe78xUKdQ4/VkX34mAooh0dkK10wUd6SbpDKyKPLpNGyxplhOR?= =?iso-8859-1?q?FPPRWrXu0k+92uv3mekMR88cTo/Xf49Z6+4q6ZTRZjrqhp0dJ75+j1XOjcFC?= =?iso-8859-1?q?7h36wiZrh1rYU5OiqNGW4//lxmeOn/P3V0EccNjaJIWq7e60PivEiagPzii0?= =?iso-8859-1?q?w5pyDshuNp1nELXJSmODXItDgfJFwroPFu8Qgzsi8cKaMPyUdrwpiAIrNf42?= =?iso-8859-1?q?Q+vXWGWMSUObfmLqgQwAYAhjHqQbUJ/AVsgT/UcPyymRDvuPT85UQG9klSwF?= =?iso-8859-1?q?9TCInmg9rEZnCU/BoX6ckvTYeMQsgif0WswNqGh3GGCOmA6ebUX28b+fYIBp?= =?iso-8859-1?q?JNl046VSvPw8GxMGcWlLsg1SA3pgSbCSx3m2YEKopw0R2td3qbdb4zpP5CLw?= =?iso-8859-1?q?20g9Ieh2U6Fn2i2V63P/2VcmzlSmR0n83nFDMLWryuW9mFeT49l5PoH6rcrC?= =?iso-8859-1?q?2JMBIyA7XBjzluuY9eLkcnpydOgmoxk2TnquET3JJEm4Y/TewVy0GVNLP80J?= =?iso-8859-1?q?67EmP/3fOPhu0rt+JO0VpSdTLbxEfB/GFriWvxkjVN6TmXEJLKn5ge0XnD9C?= =?iso-8859-1?q?xkqv2JHIIDopO09S/11eGyxPJeHSvv4qEeTSfKcPn6Cr9wrWtWHeiKbfRkIm?= =?iso-8859-1?q?mVJYhdus61voFcprcWoIZlLQ/0Q0FNWIPLSm3nRgQ5ufpw4fAbC4KiKAo7/k?= =?iso-8859-1?q?SNmrWlKuxPCgWsSBJA3D6K6qM4XS3+uVpB3reBzaWbp66ch7kwTWHqzBr+m8?= =?iso-8859-1?q?HRxtXrulc0SlIMHmD/9Qigm591kJBxE+0xDH4w9DqDpCCHuUDX/bpkMUzLhD?= =?iso-8859-1?q?X1Z0WJUHGD2ngjNU/Z4HoEjiVwCpe5ExWlw2am6b/bVkhmy2C8opuBculgLu?= =?iso-8859-1?q?b9IZlsYWs7ubzskmbmR89xq910?= x-microsoft-antispam-prvs: x-forefront-prvs: 0946DC87A1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(346002)(136003)(366004)(396003)(199004)(189003)(8676002)(2906002)(81166006)(86362001)(44832011)(50226002)(2616005)(11346002)(106356001)(446003)(68736007)(316002)(53936002)(476003)(81156014)(76176011)(105586002)(25786009)(486006)(8936002)(55236004)(14454004)(6116002)(256004)(4326008)(36756003)(3846002)(71200400001)(71190400001)(102836004)(66066001)(386003)(52116002)(6506007)(99286004)(1076003)(186003)(6512007)(2171002)(54906003)(110136005)(6436002)(7736002)(26005)(72206003)(478600001)(305945005)(6486002)(97736004); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB6062; H:MN2PR04MB6061.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: xin1Qd57C4u8AhARWRLcm1/CfZlNIqdCc++l6wv//0AtyB98DBQUWIIfQHu/OiURVoeXhDkHRuTASPNd0Y9nkS7IwDAC97Pn+qidYLehSszUCgk/dh4xgY4A0NQ7YmCPIPpcWq6apjcs6mln0iEv0Vsa7wXH9V8UWkPgpiAeqpoF79yN2hpSE5s0MJEPEglyp03j9mVw1UyqKvpZCYjDLy5hrF88eCpiaPdiieTjf2xowbZOQ6tQBumYxvGHh5h9pWQNzbIe70YOvzmPKGczLXeATFcmlxQtoUAoYzypTSC11KAkd0RuJ64X5Tf4LtuWJ909FE2OI1SnrEV0gwEK4QguVEN3I6Z37NOVpnikHnFGr+dL3tXWHg6LXJ3vBeZXEfvt96FPlBCE2vOhICNoeu22ApHmZhPJus7hwtKqgQM= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 246676c1-51ca-4d7e-bdbf-08d690f267b6 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Feb 2019 14:00:09.1711 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6062 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_060014_853194_26EED224 X-CRM114-Status: GOOD ( 13.68 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Atish Patra , Paul Walmsley , "linux-riscv@lists.infradead.org" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We move free_initrd_mem() to kernel/setup.c so that all initrd related functions are in one place. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig --- arch/riscv/kernel/setup.c | 4 ++++ arch/riscv/mm/init.c | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 77564310235f..36f60b4d2147 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -96,6 +96,10 @@ static void __init setup_initrd(void) initrd_start = 0; initrd_end = 0; } + +void free_initrd_mem(unsigned long start, unsigned long end) +{ +} #endif /* CONFIG_BLK_DEV_INITRD */ pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss; diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 658ebf645f42..504a5e491f5a 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -64,9 +63,3 @@ void free_initmem(void) { free_initmem_default(0); } - -#ifdef CONFIG_BLK_DEV_INITRD -void free_initrd_mem(unsigned long start, unsigned long end) -{ -} -#endif /* CONFIG_BLK_DEV_INITRD */ From patchwork Tue Feb 12 14:00:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10807975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5E0E746 for ; Tue, 12 Feb 2019 14:00:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D28D52B575 for ; Tue, 12 Feb 2019 14:00:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0BDC2B89F; Tue, 12 Feb 2019 14:00:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E1AE2B575 for ; Tue, 12 Feb 2019 14:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=te71LRaICoBsCF/X9TJksPj7oS66vcrsZ9X3ukjTrOQ=; b=YJi1NbFC/JpfBn sy1Xvia3w9ArwAKFDztcyvbiQZ+PvqpRgZ3Iz7ySeyQRJEyvjS4vLb7aos+RjbHWb3H8pCbE5Pp70 rN3WWtejvuDvId5rVm1wWJafkqHd8brXzEkNy+FwbCXUHtPTIeW5P3Q/E54k9FMKH6VbrZZ1F28wc 3sWityCaswHCzI/l5QUhJUDe940rhTptPPevuIhCy7mQXK+Y75z2mA9cm4k+TO3ZY3/+AzomGc22q 4CeCEuW0oTljsNu+uJUQDd+FJqr1b6Vm2F2RJP1A4rH02YTaawOlhrtRGydjwk8NH7Y3EKeZ5nzlA bnvdwn80vFYN1M2ONJQg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYbw-00033Y-UA; Tue, 12 Feb 2019 14:00:32 +0000 Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYbp-000304-1V for linux-riscv@lists.infradead.org; Tue, 12 Feb 2019 14:00:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549980025; x=1581516025; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=vN8txHa9eKbHp7FQJ7smEDvEdJGYAGARBV8FGwbfewQ=; b=Ofiw/jq5fFA6AnE9yfPJzTV/93HlRAPaj8z58vj7LxIe9fyqB8XCJWXu SS/E9ueDArWfDLR2cYdZ3Ird3f1MyHvTmlrJw3OLOpTZG+zjoB0XNR8EM Gr4UU17DtJUnJ7KgWJ/t070SSiUk0XF+bm6cnwh4NXopRXQ6FBosWEHyc AWGuY7vOuS8zvNRM5uyI5xJQy5UADZlpZFLdF+hwzOb+KVnyRzbtbRiY9 t66Hqy3XJ0wu/UgYdHSKeMD1PEceGCqGDmCPKx8TGDv+tUwcVw3xIwszb YGXdnEaxkaZSVi34n6zb57paQR3x5F2LFOWkWyO9NQd7/dEiXWMOgovXa w==; X-IronPort-AV: E=Sophos;i="5.58,362,1544457600"; d="scan'208";a="206165797" Received: from mail-bn3nam01lp2058.outbound.protection.outlook.com (HELO NAM01-BN3-obe.outbound.protection.outlook.com) ([104.47.33.58]) by ob1.hgst.iphmx.com with ESMTP; 12 Feb 2019 22:00:22 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=71ZzPWQxZILvR2Jm5FIM90PuiFR9mOI/0ZWkIZRe7aU=; b=P41l3QNJma5HOGnCl+oa+w5DYqAUo83pl0rWHo4VQQBNOQMzXmwlK6CxvHbRclh4zxEJG/ultCCNlzZtvHWqvSJUs6untuAIP7ra/1H/48LcPVJUN9/O/Sci8c1IJE1vKMOCeDFWi/bWQbUxI943M3E+lodjZZOn20uORg5N5aQ= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB6062.namprd04.prod.outlook.com (20.178.247.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Tue, 12 Feb 2019 14:00:21 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1%7]) with mapi id 15.20.1601.023; Tue, 12 Feb 2019 14:00:21 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v3 2/6] RISC-V: Setup init_mm before parse_early_param() Thread-Topic: [PATCH v3 2/6] RISC-V: Setup init_mm before parse_early_param() Thread-Index: AQHUwttKwXHCxLSmn0+7Lx/MnaLB8w== Date: Tue, 12 Feb 2019 14:00:21 +0000 Message-ID: <20190212135942.105008-3-anup.patel@wdc.com> References: <20190212135942.105008-1-anup.patel@wdc.com> In-Reply-To: <20190212135942.105008-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0126.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::20) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:de::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [49.207.48.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7e34f63d-4bd2-4034-54ab-08d690f26cff x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:MN2PR04MB6062; x-ms-traffictypediagnostic: MN2PR04MB6062: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MN2PR04MB6062; 23:0mhnT2oxJraaEGSbckte0tnsxgNj3NBsEqN/1+E?= =?iso-8859-1?q?WLmilUOy9PuO8NL?= =?iso-8859-1?q?rO9TQrUgQiyHOyiHxHS/+1mT10luB+udrmLFtqktOF7ovyk1UtBuvx8KKS1q?= =?iso-8859-1?q?b9Mjp4vJHgqfyHXKQsmPLJCZc50gKi2cdJsqphGknVz020/4KqChYf9mS9M1?= =?iso-8859-1?q?6hLdMqsEw5KeZzsNdOEtDp6Dl0l/dSkRPHAXemUmdT0QUDmw2bapXmx/2SYd?= =?iso-8859-1?q?+CN3AA2qStGBVWOC4iNy9qWosqxreX72QVDGQeaZebWgKFksv9re/nCAOvfh?= =?iso-8859-1?q?GPzGttwn2Z9kgHB/H0EpyWKBKXQgrA6zKeTZNkUmLNMr48Je4LzgRTQzPtiz?= =?iso-8859-1?q?gID0L4oZmwlO6XFivsuPSOL6ni7kswDIYnOHsCiTC8hGC5ZsHWUmSIM65CLQ?= =?iso-8859-1?q?M1ePv+oZd2sx9EH57rerCi/eLBSHXnlgr+HcK56Oa9Gtm+FqBGPlf+ZNjWRl?= =?iso-8859-1?q?UJNjc05M8W/bTuf2Tmj7ntMivX2I32wGh9DU/ZTeGhEvm7dO+SYRLPo8pXzA?= =?iso-8859-1?q?DhWKI5CO7dI2PFuoXKtymr3lHpWAOkWRSQNOc3hFg9J3mnGqHoqLwhDyc0JQ?= =?iso-8859-1?q?ogym3ImvqowvGaAS3cYxjcoss6gZmcNFgvlRFiKYt6nmCqvpT50MPNJoYod6?= =?iso-8859-1?q?elB2epnInJZXlCQoTkCY5FsxYcKQ6yt3n+GLTJIc6LsVGsbb1uJAYKKGRCZO?= =?iso-8859-1?q?T1QZff+VQ9QL6Ehr8PucKjividrThrKAr9E3fgFnl112eOAy6tLuK27KFy65?= =?iso-8859-1?q?bb9oMF4FMKcEj8yOHDQJ8VT7M2zV15pB60mPfrFz/ecj8Uuo0tMP+TmQiI0/?= =?iso-8859-1?q?p1syOlKSQnAFOLzBr06wMnXtfBv9EybGyu3ButLZe4sg9z7iSdbNu7sDDibD?= =?iso-8859-1?q?YXyR7ABaSd0GIo95+Ru74JTx6mah+7UnJ8uGh2STXDGi2V1d0kI29HB1qJVl?= =?iso-8859-1?q?msQTSzphR1fyhmXDmTA2fck5KouEsrzynESufdxugEMrnsTNmHBvN5ph5712?= =?iso-8859-1?q?kT6uvhOJTxZX+FLOaIZs79BIOcFm+jqgGXiFEmX+6iRGmvX0Q54sMmWVGhQk?= =?iso-8859-1?q?sT+M4ZpBSvsRNeV6+1BQldMd72AVUHhKJZ1K0zGD0zf89+xzsXX7JDG971QA?= =?iso-8859-1?q?gs4cE8F8sY54WfTh1u/Fl6UbfHwzfKrnmJCZJFXgSUoVg4uf6GWW6rW/SQvJ?= =?iso-8859-1?q?sK6Z/tboY8jKHtH5wKVROsiLxumdPz3sLP2/24lD3vXlkQbXNCBlNWjjxhji?= =?iso-8859-1?q?YxY51LOTpGx6MxtBsrXmei3yTN?= x-microsoft-antispam-prvs: x-forefront-prvs: 0946DC87A1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(346002)(136003)(366004)(396003)(199004)(189003)(8676002)(2906002)(81166006)(86362001)(44832011)(50226002)(2616005)(11346002)(106356001)(446003)(68736007)(316002)(53936002)(476003)(81156014)(76176011)(105586002)(25786009)(486006)(8936002)(55236004)(14454004)(6116002)(256004)(4326008)(36756003)(3846002)(71200400001)(71190400001)(102836004)(66066001)(386003)(52116002)(6506007)(99286004)(1076003)(186003)(6512007)(2171002)(54906003)(110136005)(6436002)(7736002)(26005)(72206003)(478600001)(305945005)(6486002)(97736004); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB6062; H:MN2PR04MB6061.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ZGGqylWD8RZ1iXaZc4a4DAmj1PbmlI6yPb0TYqTsikxjR1Otl9ClG5UdiNqxeu4CSu/FEdTDP5HR+WaIHVnQcY4j6q8b7RJOG1vX+n8KKh/95EkyoCGGwPwxK3d0DOrM1ShFvrawRiY1M40BPjD3fro0/xhKkZOvUgKxyeaEd0x9rtxQ0QePqJGoBOyZxfofxZFv22xDxcuTFYf63YnQ7V7nnzoSgIo7jNDS0sfYvOKKWJ37BGnR8XwbqDIxlH/RbPCYzIGfhaKnGXeoAjk939288Ruz3zmHscAqYmCnIjOAP14NejqoUYRWh25kldPSKoSnmn5d5HnvPt2+ytx2gi9XlE4C8hD1fIuEqe1ekvvB8IRe7ejC+OQ1zJw9rVDFHBmBTOmrLGxkF857n8Ho0YDO3yv/XESzOWeSm0yqEWQ= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e34f63d-4bd2-4034-54ab-08d690f26cff X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Feb 2019 14:00:18.0284 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6062 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_060025_214252_3BE755C8 X-CRM114-Status: GOOD ( 13.28 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Atish Patra , Paul Walmsley , "linux-riscv@lists.infradead.org" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We should setup init_mm before doing parse_early_param() in setup_arch() to be consistent with setup_arch() of other architectures such as x86, ARM, and ARM64. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig --- arch/riscv/kernel/setup.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 36f60b4d2147..9e6395b7d409 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -208,15 +208,15 @@ static void __init setup_bootmem(void) void __init setup_arch(char **cmdline_p) { - *cmdline_p = boot_command_line; - - parse_early_param(); - init_mm.start_code = (unsigned long) _stext; init_mm.end_code = (unsigned long) _etext; init_mm.end_data = (unsigned long) _edata; init_mm.brk = (unsigned long) _end; + *cmdline_p = boot_command_line; + + parse_early_param(); + setup_bootmem(); paging_init(); unflatten_device_tree(); @@ -235,4 +235,3 @@ void __init setup_arch(char **cmdline_p) riscv_fill_hwcap(); } - From patchwork Tue Feb 12 14:00:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10807977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC5E91575 for ; Tue, 12 Feb 2019 14:00:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA960292A0 for ; Tue, 12 Feb 2019 14:00:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEB9C2B66A; Tue, 12 Feb 2019 14:00:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C15722B55F for ; Tue, 12 Feb 2019 14:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vxIyz+hHOEAlTz9sHRJDAPNylcCpy/O6VKUzTobl2qA=; b=EeMFFUmEe1D5oC xB44WZVMcQhpnfHJzPCuUKNQVvF7vkb+STUSpw5KZy3O3cDMgph0CcAbHXNIK7p+4zDV13ofZim++ 8OXdXTy+fH9fSjW+UlDzjrTj7easQRhSSHfQzeJgIQoT+vEmVkXR1KtSfni6wK8mRKIsK5Ly9ZPoO DTkI1zDez9WTNGcTNt6WKLsUT1eNELuI6OKkwLxkcSJD+3a5ajvsyf0butsHZIaKDJZsFyI/B9W7o NENMyv0eKNGdKn51Iv/ru7kwk7N1zfxD12UdiCsowjdJ86RS6+MqckIiNl0EyxnvWPbTYIFtng7cx HwMp04vWc2uHqAIWZqKA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYc1-00036C-IV; Tue, 12 Feb 2019 14:00:37 +0000 Received: from esa4.hgst.iphmx.com ([216.71.154.42]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYbt-00032e-VQ for linux-riscv@lists.infradead.org; Tue, 12 Feb 2019 14:00:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549980030; x=1581516030; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=MMaSjPVSOs1KuGPAIVXOULMT9o2j1tPbTgBb8+q2ItQ=; b=aZGtgtpIl1LnUjA3w104qjv9wJXxZbIlA9QA6yh7xAhTxFYI6+s4nxHH YAVsukAXIxMRs6ET3l0FJFdFhIXRhitVJQhLIlIWJMLenuL7iXbFOjlXv taRUH8mL5qVfhB9ZMbWbx0h1L+LkKQEEqvCZ2p3Pje1vMTRN6WKNruWzh b0Fr+Y+vpT+P5k+4xU5vmqaK+ZfwqF647v4t8PnxcApyZ++OtDFYiePKc 6B1/+QOVtGfPEYvECqLMnFxMV/U0wBRAvjF5fUzEQngHq3dUWH7G3868d Hifk9Yj/NcoaWDWmiirJHqoFR8VMdIa6J0sI2sdQX6hvCCWc1HhQKFJrY g==; X-IronPort-AV: E=Sophos;i="5.58,362,1544457600"; d="scan'208";a="101010259" Received: from mail-bn3nam04lp2055.outbound.protection.outlook.com (HELO NAM04-BN3-obe.outbound.protection.outlook.com) ([104.47.46.55]) by ob1.hgst.iphmx.com with ESMTP; 12 Feb 2019 22:00:28 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lL6B39zTRMesFFycvJsi7f9wzh2NABawCwlr1Qo+OTc=; b=nzz5qKs8CZYupXh34LRzcvbUuUlJ+lUMKWHPKRYwAFx9HDMCc/61tBCM66jlsUALnfVo+anRlu8W/VdxoGB+e7cFXtOucZfw8+7fL+RCN5dX6U72DMPgB76l4WnVMAFga6I4cR24WTtA/ng3fUdoNgwmduiiV0NYxDSJ3xlneZc= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB6224.namprd04.prod.outlook.com (20.178.247.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.22; Tue, 12 Feb 2019 14:00:26 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1%7]) with mapi id 15.20.1601.023; Tue, 12 Feb 2019 14:00:26 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v3 3/6] RISC-V: Move setup_bootmem() to mm/init.c Thread-Topic: [PATCH v3 3/6] RISC-V: Move setup_bootmem() to mm/init.c Thread-Index: AQHUwttOdTsDzGHhY0ijRWgwbLe67g== Date: Tue, 12 Feb 2019 14:00:26 +0000 Message-ID: <20190212135942.105008-4-anup.patel@wdc.com> References: <20190212135942.105008-1-anup.patel@wdc.com> In-Reply-To: <20190212135942.105008-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0126.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::20) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:de::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [49.207.48.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b065dd46-7425-4aec-8e56-08d690f2705a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:MN2PR04MB6224; x-ms-traffictypediagnostic: MN2PR04MB6224: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MN2PR04MB6224; 23:VrxPQrMbKRy8sKWy5l1c5n74D/O5l24F1/+pQdh?= =?iso-8859-1?q?pnZ0UPenzobqAMV?= =?iso-8859-1?q?FINR/KHx6tb/Q/4SSoeDJTmOASiUdoXhQ3Mx4asE+qNBWmRKHeZ8M4Do1IyZ?= =?iso-8859-1?q?6YS1qpRXSSW2JNbiEFc4MH3Y8kUC2KzbyWncywqGJrfbP3zheJKX5AZlrBG6?= =?iso-8859-1?q?MRN2ainRmbZnyciTh09sTcZu9LhNJ4evRReCDsYcAd87l2RfRVV4KaihSVXh?= =?iso-8859-1?q?QT7HhjiMsyjK/7HBZbiHAbvyEreiijFoNL2fQZoGqN1zmtgjeYPnNcAF8C5B?= =?iso-8859-1?q?p2fQi5DXVQSXsQCM3XlNiW/Z5QGjfDMsb3Yvt1HogqehVnX21okxufPbcq23?= =?iso-8859-1?q?IsIAprtP6siuS/NtrSBULlsCi+E8Q3CLWb+6VjAT94p3osOW5vPdlh3tcRWv?= =?iso-8859-1?q?3xdx2hranVwY+gy+tmjJCymeK8j3N0XsZdO/YkL9DGJxej0KiYZCr/2sTizn?= =?iso-8859-1?q?/4gIWfKIHiQU/k6jrJR8aUFQd6dhLO0l3qm+EEJ8jSK+izIdC5IQ7/TlvAmI?= =?iso-8859-1?q?mOZPfYHSWLQFnpKLPg6U7yDm05qrCa4R/dI7gs/YcBGITlXB62aEPW0bwNnH?= =?iso-8859-1?q?ji3yhaue+dH+xZxdMT+uwLXgOZFgz/+kurNEqHDERO+GG0bakIHaJDE9vLGA?= =?iso-8859-1?q?EpmzbWuORfOB2YSVhFWJytY+KMa0ZOQNjgmzxvrTmuNxQ8WbUasQHm2Hprv4?= =?iso-8859-1?q?PpReX3vC0frlvBp+/2che7a7y4QcAjvMdkLgYwgyM/+dRt/NTOTSAtKMDboB?= =?iso-8859-1?q?eNzCqGDK5TYyMOMzO7fOMFScUa9MfgDDjzBTWT6zJvAA/vB4/GmRaq6iUDdX?= =?iso-8859-1?q?zXkdXBLicwghXeL90z6x6bUqaBhPDTYUt7srgy80wLUNdFM/d8+/wz4+lHP8?= =?iso-8859-1?q?iAGDXNedL41r2og4VLQaFp4D4CWu9SagNSF9QLFfXZsDVi62Epa35YEc+wOt?= =?iso-8859-1?q?lNHy6FwDUg4lWKRx0kSgq28iJ1faKbQuSrHFiuKds7rJW+RYSCif5U0CCYLF?= =?iso-8859-1?q?bgtvC+Qq/V+kXfiSdhTVFCwPGfZZySonuezhCTJsKi5e9V3jr7uUhgikpuec?= =?iso-8859-1?q?McGcpFQxx+3TFlbgXwEd6E9gvjAjBOWAcivjPYQSBcWMCZPzDMOyCj2e7zQO?= =?iso-8859-1?q?6a5HuhabRp16+kQuR0ijuvWyhK3wMp6gmyQ1wdZRRiMK1h674JoWOHwntiNz?= =?iso-8859-1?q?q6EWnm/BMH7TIB7NQUAi9VMTmKE4oAIkOWHeJJPDliNLc0lmbYLVpcCc0r5l?= =?iso-8859-1?q?NMytYImwY/WjKLyatL3v0S2QFP?= x-microsoft-antispam-prvs: x-forefront-prvs: 0946DC87A1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(39860400002)(346002)(376002)(136003)(199004)(189003)(11346002)(25786009)(2616005)(72206003)(486006)(2171002)(478600001)(4326008)(446003)(14454004)(6512007)(476003)(52116002)(36756003)(110136005)(97736004)(3846002)(6116002)(8936002)(50226002)(76176011)(54906003)(99286004)(7736002)(256004)(106356001)(316002)(81166006)(105586002)(68736007)(186003)(8676002)(44832011)(1076003)(6486002)(6436002)(86362001)(66066001)(53936002)(2906002)(305945005)(55236004)(386003)(71200400001)(102836004)(6506007)(71190400001)(26005)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB6224; H:MN2PR04MB6061.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: +My5kfXJ+yNGSpeXFSzUxdzTdZeyWV8hts1Da/a016BF4D4+7Vb3LclqSdmbm5MIWlXo+EnbCj7S5bp4icPeah7mpkp2paZ/WuTZAnFg2jGhUQZXEaG9H++38TN2+QJmKM5ktGNFjKQEyWnLoJKu/+R9uempVHnSb/KnkdS0bsvFZSU7Upm12INAkNubJkPPQi5ij4JtjIESYxoU0gvizdReIZ1ccQTAQ8wZ/24yLknQ439nVzGacOmo3IppRNJirnVpkeEgBVOqLbA17l/mLsIwiYXbkP7sFCm3nf4yXYsjro4zVdZRAWXMw+UTnJHmACTXYs5qN+e/nFSkwUucB02dYR53RCdvg+Yt0HFVNfzjGxTBnF7thORaoIeZHusz8Wqem3/aajkx/zu8JfsCkaX3HixXf9wAodnZEyftl5c= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: b065dd46-7425-4aec-8e56-08d690f2705a X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Feb 2019 14:00:23.6544 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6224 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_060030_052275_5DEFFAAB X-CRM114-Status: GOOD ( 18.14 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Atish Patra , Paul Walmsley , "linux-riscv@lists.infradead.org" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The setup_bootmem() mainly populates memblocks and does early memory reservations. The right location for this function is mm/init.c. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig --- arch/riscv/include/asm/pgtable.h | 1 + arch/riscv/kernel/setup.c | 48 ++++---------------------------- arch/riscv/mm/init.c | 40 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 16301966d65b..35893810cba3 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -404,6 +404,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, #define kern_addr_valid(addr) (1) /* FIXME */ #endif +extern void setup_bootmem(void); extern void paging_init(void); static inline void pgtable_cache_init(void) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 9e6395b7d409..ab29a66a17fc 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -163,49 +163,6 @@ void __init parse_dtb(unsigned int hartid, void *dtb) #endif } -static void __init setup_bootmem(void) -{ - struct memblock_region *reg; - phys_addr_t mem_size = 0; - - /* Find the memory region containing the kernel */ - for_each_memblock(memory, reg) { - phys_addr_t vmlinux_end = __pa(_end); - phys_addr_t end = reg->base + reg->size; - - if (reg->base <= vmlinux_end && vmlinux_end <= end) { - /* - * Reserve from the start of the region to the end of - * the kernel - */ - memblock_reserve(reg->base, vmlinux_end - reg->base); - mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET); - } - } - BUG_ON(mem_size == 0); - - set_max_mapnr(PFN_DOWN(mem_size)); - max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); - -#ifdef CONFIG_BLK_DEV_INITRD - setup_initrd(); -#endif /* CONFIG_BLK_DEV_INITRD */ - - early_init_fdt_reserve_self(); - early_init_fdt_scan_reserved_mem(); - memblock_allow_resize(); - memblock_dump_all(); - - for_each_memblock(memory, reg) { - unsigned long start_pfn = memblock_region_memory_base_pfn(reg); - unsigned long end_pfn = memblock_region_memory_end_pfn(reg); - - memblock_set_node(PFN_PHYS(start_pfn), - PFN_PHYS(end_pfn - start_pfn), - &memblock.memory, 0); - } -} - void __init setup_arch(char **cmdline_p) { init_mm.start_code = (unsigned long) _stext; @@ -218,6 +175,11 @@ void __init setup_arch(char **cmdline_p) parse_early_param(); setup_bootmem(); + +#ifdef CONFIG_BLK_DEV_INITRD + setup_initrd(); +#endif /* CONFIG_BLK_DEV_INITRD */ + paging_init(); unflatten_device_tree(); diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 504a5e491f5a..a57dba8ac9e7 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -63,3 +64,42 @@ void free_initmem(void) { free_initmem_default(0); } + +void __init setup_bootmem(void) +{ + struct memblock_region *reg; + phys_addr_t mem_size = 0; + + /* Find the memory region containing the kernel */ + for_each_memblock(memory, reg) { + phys_addr_t vmlinux_end = __pa(_end); + phys_addr_t end = reg->base + reg->size; + + if (reg->base <= vmlinux_end && vmlinux_end <= end) { + /* + * Reserve from the start of the region to the end of + * the kernel + */ + memblock_reserve(reg->base, vmlinux_end - reg->base); + mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET); + } + } + BUG_ON(mem_size == 0); + + set_max_mapnr(PFN_DOWN(mem_size)); + max_low_pfn = memblock_end_of_DRAM(); + + early_init_fdt_reserve_self(); + early_init_fdt_scan_reserved_mem(); + memblock_allow_resize(); + memblock_dump_all(); + + for_each_memblock(memory, reg) { + unsigned long start_pfn = memblock_region_memory_base_pfn(reg); + unsigned long end_pfn = memblock_region_memory_end_pfn(reg); + + memblock_set_node(PFN_PHYS(start_pfn), + PFN_PHYS(end_pfn - start_pfn), + &memblock.memory, 0); + } +} From patchwork Tue Feb 12 14:00:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10807979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06DED922 for ; Tue, 12 Feb 2019 14:00:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EABF82B56B for ; Tue, 12 Feb 2019 14:00:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E85072B8F1; Tue, 12 Feb 2019 14:00:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D6762B56B for ; Tue, 12 Feb 2019 14:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l63ax3OQk2YSMEulJ0WRqI8JW7g5IltRO/rQC7R3np0=; b=SkCSVBmbc6uk+T YYJkSFP4tB6MTwrQkn7KMkK53wrOHODnkHSnDq56bHHAdn/4PyMYHyrs4uYF9NN0PaoT/+mFCXeqR JEeI/xIUMxTymCJk3g7/aW15Yzk+V4/NQIOXYU4vokREt0EFecbvp/G6Cz5ysexTdusQRfzWHyUbd dwHmAuh2oI4ydFIS6vMWYkvCHQhkveW87+X4t0IWH+KgOmZuxKOe5zmhf2paJrHYTIq7x+nPCnCgr L1B8qN8LFk/746inrngcQnhpLqm1gCOhtUwhKvQV+s9AwzTtCRxtT+PQBX5tkJI1lbTcVqBbNEQkm sxs8hsSVkcGRWnxJp6Ig==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYc3-00038K-Q7; Tue, 12 Feb 2019 14:00:39 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYc0-000358-2s for linux-riscv@lists.infradead.org; Tue, 12 Feb 2019 14:00:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549980036; x=1581516036; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=/9qqvZm9BuFaUahBO5rE9KWZFbLQhXyUVzJqiZgjWRo=; b=gZuGVdfEbGdIfjBEYQIbZYEKvCjR8GQtBTZnl75oYA48y2fhh7QCBp69 Kro0Vchj6k1PFQWD9hmm7y/V/FBjLepzBKa2ZjsQ98QwZMW0DqG7Hx6z2 3bIB2cXVUgwn9obi25qU4Lx6CwOpqLcVC/1ItNEru3yh2lyioykF/0ZTa 5oQL+dGs449b0f87Oa3BPjvSzy66+03+sRRDibd7hhzqScYh3pORkDwYX Z1hZe15xWwbpqbwmYXFcSdGytAxZGREROfaRkWWylddruSIOA/Bv2ZpAW 9uEBa5QJajH7NEMdzErYs1lBH3MSmW//SoK5xg4gkXg5CjImwxY1pc4b/ A==; X-IronPort-AV: E=Sophos;i="5.58,362,1544457600"; d="scan'208";a="102320639" Received: from mail-bn3nam04lp2053.outbound.protection.outlook.com (HELO NAM04-BN3-obe.outbound.protection.outlook.com) ([104.47.46.53]) by ob1.hgst.iphmx.com with ESMTP; 12 Feb 2019 22:00:32 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d0F4pvgq60HxEKWnoc+e9Gn5WgL9ePYqiMQTmBSNiP8=; b=irxJEDkreoMiqZ1UWfGVA1njvyCU8WVp1wsH94sulULJEPkCe/qemhLACCk4YgHD4zGM5gtqeP0CCDvdD6hN79QPfKL4vvM98GpO+FLMXloHivNgDP6pQPmpVrPqH3/pwX9fLx3so/YWruytk6rOiNbKOYFcoXo3gruFiqUhlWc= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB6224.namprd04.prod.outlook.com (20.178.247.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.22; Tue, 12 Feb 2019 14:00:31 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1%7]) with mapi id 15.20.1601.023; Tue, 12 Feb 2019 14:00:31 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v3 4/6] RISC-V: Move setup_vm() to mm/init.c Thread-Topic: [PATCH v3 4/6] RISC-V: Move setup_vm() to mm/init.c Thread-Index: AQHUwttQVbyPbi79K06WYpnA0PywoQ== Date: Tue, 12 Feb 2019 14:00:30 +0000 Message-ID: <20190212135942.105008-5-anup.patel@wdc.com> References: <20190212135942.105008-1-anup.patel@wdc.com> In-Reply-To: <20190212135942.105008-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0126.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::20) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:de::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [49.207.48.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 69d173a4-763b-43c4-fc69-08d690f2731f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:MN2PR04MB6224; x-ms-traffictypediagnostic: MN2PR04MB6224: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MN2PR04MB6224; 23:bD1z6jr0MatCoyNxyOAFkgQC3IYwJ8ZXKKLSZ66?= =?iso-8859-1?q?qwvoVBsKtzcjs9O?= =?iso-8859-1?q?7Wr5s4hBatV3giXWnKqdORBZN8cjhgPuB4tBh4R/dnQnCrfWMl8m+Wjoe20Y?= =?iso-8859-1?q?2WrL/iPkcunezFQMkrXSk1JZbaaL2Jd/IyI9fyMJ7tcUrvKJXFMVWizsyRad?= =?iso-8859-1?q?yYOy5mpJ24Yn/xniOJZyfm27TRx0X5CEduRVCFzhvRuz5QgRtfT6/PQ8LCo/?= =?iso-8859-1?q?q6WGZ4lxGJp/qfGfSYzl4EaSKwCNO3gs4U8Yq6Fjf8Tgt3Wf683y1ZMT6oW3?= =?iso-8859-1?q?wSxebbiv3hco0o6BBvrqYsU5xsbUWYzVfn9tLnxioG53v0oilJANBb2GsEpG?= =?iso-8859-1?q?ptH2vrSuJLRAHZnt9DVWdoLwpQw4UqaIYF4CpeKbdDxdqc7rtewXDLwOJqVu?= =?iso-8859-1?q?7WlrQk0im31YmxiTtev0YgjQCTJTj/71TMCPyxDqd09YvXlB8/f2vuT9S1mj?= =?iso-8859-1?q?d/1JBTBWuyUpqkWfxyqP5zDdVCUdgltWGxSRvCYreFNM9/0SICLJ1we/Miyp?= =?iso-8859-1?q?91mpKyTHyqijT0++X+o6coHZOYFbUmcVp2iIc/ape451+Vc0qP2IsxpNVKoD?= =?iso-8859-1?q?Jhyiq9Tyax8QNigo11vBLHrPwe+L02Hbau+k4HSxQ2Kdl+ZFPvv+tal4euov?= =?iso-8859-1?q?zR5+if/dYO9f7f+c8vO8IgTGq3EV+GB2NdHKgO+DlmkCROOgrbQVth5Qytzb?= =?iso-8859-1?q?/DfIeamRypJ141IqFN26p3iNZAZf6vbApwWm0qD9kdqRLw2NOeyzXcDbtpoo?= =?iso-8859-1?q?jdgpxlswr+pDkdrdgMF/rmYs3TL6HpsYCcfKV3AW6Ip4vjthaO7+O/5AM15/?= =?iso-8859-1?q?HK7w5mCRkQynYZ/dXthvu6vs370UUwLoSM3KzcE//s/Y4aVcD3h70PAkV2Lv?= =?iso-8859-1?q?4q/hNdGArtp8jAUxNJ/ttUFAVW0012gm62UKTpgunU9BpRx0f++UYxC7FBnr?= =?iso-8859-1?q?zpfVgroIeHDMnrfb/xmy4g/N6QkwvjzqVllWfXfTbhOrO/77UaUdv9I7U6pb?= =?iso-8859-1?q?9kr9Zj3MTSlp+jVImo047Gcs8JTNcvfOsxgdsPPeSG3gDbHeMU1eMUcyCfaa?= =?iso-8859-1?q?fVtmxqSeSoBSf3Wv8VDGZNEYDsdDT25tRC+MTuEVrobJlBQ9vuYK9Zp/Owuw?= =?iso-8859-1?q?IqSU7N6/x0eKuzGZhHnKBiR8MIxDzquVIXYtYqqW3jRKHLdC6kbpcrz4LobJ?= =?iso-8859-1?q?jQzmQWwfxPLeKMR68RiTCW7yqI+TdK2bmsTFVWd1RFXppfgF98N7fWpd/p7I?= =?iso-8859-1?q?95bjZW/9S00I7I7in7Xt6QntkR?= x-microsoft-antispam-prvs: x-forefront-prvs: 0946DC87A1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(39860400002)(346002)(376002)(136003)(199004)(189003)(11346002)(25786009)(2616005)(72206003)(486006)(2171002)(478600001)(4326008)(446003)(14454004)(6512007)(476003)(52116002)(36756003)(110136005)(97736004)(3846002)(6116002)(8936002)(50226002)(76176011)(54906003)(99286004)(7736002)(256004)(106356001)(316002)(81166006)(105586002)(68736007)(186003)(8676002)(44832011)(1076003)(6486002)(6436002)(86362001)(66066001)(53936002)(2906002)(305945005)(55236004)(386003)(71200400001)(102836004)(6506007)(71190400001)(26005)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB6224; H:MN2PR04MB6061.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: pKKXRZr34twV7Kh87BLcJ4WhxsrdStFAmA1BoRLsfURuewQTtgSgmG+pl0w7X7FlrC30vY3b7tHg7hPGy1gcw10HxXICQqW51rdYEhDWhgP1vrKJq5kbRrZs7VcX3nZbW5LMBhV7bTC3LE9lIOaR5MQPUSz+JSjvHE4/Be5scC2gF2H4v5IKGuTORsxWjMURpbM9IXBR8xTlJpBQrt0k8xQ4iPuuaFEM2cEjKa/O8Q12wG/c72iwuLO4m6Wpp2XcqICw9fRWBnKwepqm6uIzys15xaTqW0JMSUlHLJdxebSiwsDhmGwyEoNUmN+hMQogDhhJBVygjYMN8EeXw9OKpTorukQYojNSCrcKR1H41s3eAKPiWkvtNR023fKoEKRgXC7ndebo3I7YGhSE/D09g6nytTuN2f3bqqjOPl2Bgk0= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69d173a4-763b-43c4-fc69-08d690f2731f X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Feb 2019 14:00:28.3107 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6224 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_060036_242892_73C3CCB0 X-CRM114-Status: GOOD ( 15.07 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Atish Patra , Paul Walmsley , "linux-riscv@lists.infradead.org" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The setup_vm() is responsible for setting up initial page table hence should be placed in mm/init.c. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig --- arch/riscv/kernel/setup.c | 49 --------------------------------------- arch/riscv/mm/init.c | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index ab29a66a17fc..9cd583b6d1cd 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -102,55 +102,6 @@ void free_initrd_mem(unsigned long start, unsigned long end) } #endif /* CONFIG_BLK_DEV_INITRD */ -pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss; -pgd_t trampoline_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); - -#ifndef __PAGETABLE_PMD_FOLDED -#define NUM_SWAPPER_PMDS ((uintptr_t)-PAGE_OFFSET >> PGDIR_SHIFT) -pmd_t swapper_pmd[PTRS_PER_PMD*((-PAGE_OFFSET)/PGDIR_SIZE)] __page_aligned_bss; -pmd_t trampoline_pmd[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); -#endif - -asmlinkage void __init setup_vm(void) -{ - extern char _start; - uintptr_t i; - uintptr_t pa = (uintptr_t) &_start; - pgprot_t prot = __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_EXEC); - - va_pa_offset = PAGE_OFFSET - pa; - pfn_base = PFN_DOWN(pa); - - /* Sanity check alignment and size */ - BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0); - BUG_ON((pa % (PAGE_SIZE * PTRS_PER_PTE)) != 0); - -#ifndef __PAGETABLE_PMD_FOLDED - trampoline_pg_dir[(PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD] = - pfn_pgd(PFN_DOWN((uintptr_t)trampoline_pmd), - __pgprot(_PAGE_TABLE)); - trampoline_pmd[0] = pfn_pmd(PFN_DOWN(pa), prot); - - for (i = 0; i < (-PAGE_OFFSET)/PGDIR_SIZE; ++i) { - size_t o = (PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD + i; - swapper_pg_dir[o] = - pfn_pgd(PFN_DOWN((uintptr_t)swapper_pmd) + i, - __pgprot(_PAGE_TABLE)); - } - for (i = 0; i < ARRAY_SIZE(swapper_pmd); i++) - swapper_pmd[i] = pfn_pmd(PFN_DOWN(pa + i * PMD_SIZE), prot); -#else - trampoline_pg_dir[(PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD] = - pfn_pgd(PFN_DOWN(pa), prot); - - for (i = 0; i < (-PAGE_OFFSET)/PGDIR_SIZE; ++i) { - size_t o = (PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD + i; - swapper_pg_dir[o] = - pfn_pgd(PFN_DOWN(pa + i * PGDIR_SIZE), prot); - } -#endif -} - void __init parse_dtb(unsigned int hartid, void *dtb) { if (!early_init_dt_scan(__va(dtb))) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index a57dba8ac9e7..7ed6ae90cf6b 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -103,3 +103,52 @@ void __init setup_bootmem(void) &memblock.memory, 0); } } + +pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss; +pgd_t trampoline_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); + +#ifndef __PAGETABLE_PMD_FOLDED +#define NUM_SWAPPER_PMDS ((uintptr_t)-PAGE_OFFSET >> PGDIR_SHIFT) +pmd_t swapper_pmd[PTRS_PER_PMD*((-PAGE_OFFSET)/PGDIR_SIZE)] __page_aligned_bss; +pmd_t trampoline_pmd[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); +#endif + +asmlinkage void __init setup_vm(void) +{ + extern char _start; + uintptr_t i; + uintptr_t pa = (uintptr_t) &_start; + pgprot_t prot = __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_EXEC); + + va_pa_offset = PAGE_OFFSET - pa; + pfn_base = PFN_DOWN(pa); + + /* Sanity check alignment and size */ + BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0); + BUG_ON((pa % (PAGE_SIZE * PTRS_PER_PTE)) != 0); + +#ifndef __PAGETABLE_PMD_FOLDED + trampoline_pg_dir[(PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD] = + pfn_pgd(PFN_DOWN((uintptr_t)trampoline_pmd), + __pgprot(_PAGE_TABLE)); + trampoline_pmd[0] = pfn_pmd(PFN_DOWN(pa), prot); + + for (i = 0; i < (-PAGE_OFFSET)/PGDIR_SIZE; ++i) { + size_t o = (PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD + i; + swapper_pg_dir[o] = + pfn_pgd(PFN_DOWN((uintptr_t)swapper_pmd) + i, + __pgprot(_PAGE_TABLE)); + } + for (i = 0; i < ARRAY_SIZE(swapper_pmd); i++) + swapper_pmd[i] = pfn_pmd(PFN_DOWN(pa + i * PMD_SIZE), prot); +#else + trampoline_pg_dir[(PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD] = + pfn_pgd(PFN_DOWN(pa), prot); + + for (i = 0; i < (-PAGE_OFFSET)/PGDIR_SIZE; ++i) { + size_t o = (PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD + i; + swapper_pg_dir[o] = + pfn_pgd(PFN_DOWN(pa + i * PGDIR_SIZE), prot); + } +#endif +} From patchwork Tue Feb 12 14:00:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10807981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4E61746 for ; Tue, 12 Feb 2019 14:00:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A20F02B715 for ; Tue, 12 Feb 2019 14:00:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 948C62B89D; Tue, 12 Feb 2019 14:00:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EF282B591 for ; Tue, 12 Feb 2019 14:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+pOUIKxlDSGbFyTIgvEKSabDiuFTvJQWi0lorjgLG5o=; b=i21adz0TFEsmfU Yss8c9prK3bEeMbvRQzJIReH0+1WE46Rn6z+EbOWhDXxSwTsI7sEMQpn+5NMiLAnq+AwRlJEswbVo BCv39nrRAaehfwpHEohhy208vFH3qIXZkTljH4ocemthufOzMMjtUyXGYv+a3SHFTVaPYAj4aWSl3 5vY0tEe42+jvPCxC+ydpRIjICZ80xuKgjdZLxi8HhV+lBEQvNyexSMciNx5EaUoN4DsuKSnOi3iE3 iKz9hceanhjWXRoW9wj41B+sCRM72BEY2myPLUZCIEUnQL8zApgSfY4Zt+7BmA3zBtd7d2CfOLmxU XYkPPAAXe0J1XqbeUW8g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYcA-0003CG-LB; Tue, 12 Feb 2019 14:00:46 +0000 Received: from esa4.hgst.iphmx.com ([216.71.154.42]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYc1-00032e-FM for linux-riscv@lists.infradead.org; Tue, 12 Feb 2019 14:00:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549980038; x=1581516038; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=xccl57cIX77WtD5DIeAQVkFd6c+IU3UU/eqrtt4emLM=; b=aqpUxZd590Zgnh0Q1OcqIN8qpP/6Px1prse3NYvXZIOhk66DXQvSyCZt N6AVhckUiPX4BZZQTHz8JdBU3AQUZRdRXEuCZSGXWL2s0hQNVmN6engsV 8QWRIgHhwKcUX2wXXGIkvf4mhdHZNW7e0eWDBb+Hvhd6SNvoI9pmPCshV RI8Nm0yViKSf8OhClzPihS8Ncaw9Qkidqt5R4gIYO9Ifl0FmvfBpC1XZS D1plNNJDTWbl21cCWuQDkQegxGx6t8xeUq71w1ZvG/sHwT+NS9Wj0s39b NVhj31I0eidpF9fLLoQua0Xk71VaNiPMvnERIMkp5v7n/KK4J6HcZXTD3 g==; X-IronPort-AV: E=Sophos;i="5.58,362,1544457600"; d="scan'208";a="101010271" Received: from mail-bn3nam04lp2056.outbound.protection.outlook.com (HELO NAM04-BN3-obe.outbound.protection.outlook.com) ([104.47.46.56]) by ob1.hgst.iphmx.com with ESMTP; 12 Feb 2019 22:00:37 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nZ/M4jfIAscto9mHJTz64lIL4phbcm1TMzKkZbX0JdA=; b=ZJdhWsAYh9pmgXIA9Hc5NxiBLAA1QO4vayrFv7Nc0sex61gHpcrK+6KINDA/DWmd5FHx1t0Y5F2SsmDhRjgEQ6jgINROEkMAl9JsNy6JhwcifgDzqnkkvnlfu9qOAP3eKhckxihxXR3VSpZC86mp3jpZtJATlxnqS1T7CgL27rw= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB6224.namprd04.prod.outlook.com (20.178.247.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.22; Tue, 12 Feb 2019 14:00:35 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1%7]) with mapi id 15.20.1601.023; Tue, 12 Feb 2019 14:00:35 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v3 5/6] RISC-V: Implement compile-time fixed mappings Thread-Topic: [PATCH v3 5/6] RISC-V: Implement compile-time fixed mappings Thread-Index: AQHUwttTcPkGKpkMaUyP3qv9nTzjtQ== Date: Tue, 12 Feb 2019 14:00:35 +0000 Message-ID: <20190212135942.105008-6-anup.patel@wdc.com> References: <20190212135942.105008-1-anup.patel@wdc.com> In-Reply-To: <20190212135942.105008-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0126.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::20) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:de::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [49.207.48.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b8e4a2a9-42de-4fc7-2322-08d690f275cd x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:MN2PR04MB6224; x-ms-traffictypediagnostic: MN2PR04MB6224: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MN2PR04MB6224; 23:OQNh6AbPKD0qb+Uvp1IJeaYqoBk1VF8NhElItiG?= =?iso-8859-1?q?eVoOuehGQAa4QJ2?= =?iso-8859-1?q?ywduwZANkneusIU0ThEDBHpMgHwMUgXlXQFMUXpqjKSfaqdWzXfr2KB9otZu?= =?iso-8859-1?q?ryqPW1GlFjvnAYPJRohmrNz2Zj2D7OXabJlNKE60ZDGsWNcP1aqtupXjgHQd?= =?iso-8859-1?q?SC1HEYFjeAegz2ODFrl4VCQbgVYljmTGwiwCMfIvt8nk5eNL0Bx3fN4KJLdp?= =?iso-8859-1?q?frLNV/ljabRGBvlLpfaY6tknfI0ktCOFTeHezZvfiEuHFmCFHAZy99OlC64W?= =?iso-8859-1?q?9Ot7U50FDG2GYhbUmPQqX4xkR+7hwiLtRp23KdGU6lbnJn7TGphXvYpqmF/D?= =?iso-8859-1?q?nC7hT696R3d4YRpD3VJTmdXfJs3Z7MDh33hWA6X7egt1e0bgjiD3TrLbLCSb?= =?iso-8859-1?q?jHBd1078pASK3KhzjSqAyMU8/hjVTg069tOCXt+RdppZxC4Hfn+l6m5Kl6W+?= =?iso-8859-1?q?SKcVhM/sv/rS7bf7hb+hP2vZq7FXLh4gUGDscn3u+DsTYo65o772sPSSXbmf?= =?iso-8859-1?q?9wtwvpeARLEmKjDbTLQfroKzEXann4XFSsQAzvcG0u53mXBKjYU8zEgAw1Gz?= =?iso-8859-1?q?gRopOkQVJySS2d1kd7d36xM1d0ICEnmmDuf1sVygpiWdQhWh5g5JbKnQn1oB?= =?iso-8859-1?q?JdZ+VnfDFXvBY137qmEjVhj07CCC29PTFa1AiVxxBSKIT8H6giNPu0ulalpx?= =?iso-8859-1?q?tiQF1SoirsJrA4fBvI7KWGmqht51EspOZeazcURxQNTDMxfP6PfIRs6c8oBP?= =?iso-8859-1?q?ZPL3IdUUAwOqkUDsQGvu5kmi2P0o2dMGK1AKZJKxxrDyKMc2I+3/lmDiaWGA?= =?iso-8859-1?q?GqeDZr9cVGHcY888OmeerSJ+xrqYGrQG3PZe/euVfH8pqSgip2yhDJlyx0sW?= =?iso-8859-1?q?BZ7E+0DSe3qb5d5jlTlevOSGey0hyJ8ppKzKOAWo5lAOAkEuzxXutMb3cKfL?= =?iso-8859-1?q?XaJmm7RE4yQbpjCTFgPnLgJhV8wDHw0D2/zLtJMSm2nQTU+ZtJK7BxVhd7cI?= =?iso-8859-1?q?MEUxH/pLeezvcSE1V5/AdAHInpRVYdZv44s2/cKWWBYQU+ej7Hso+WY4yiyn?= =?iso-8859-1?q?zjcmdf74n6VIgeDenj4MBjbetOc7/Y8vtX3jY8LtPp58/gMIH1v509XLofF5?= =?iso-8859-1?q?nAmVmeAnr4LA7hMV/D7O7Sbnm3NugZt0C0hen4McLjA0/hE+AIPSQDhH6ked?= =?iso-8859-1?q?qAIZMJ0qzR5kRdeDILXg41Y4hrh1pBM4fmEV3vLpIzYHVamHf/+ZS1FdUjGY?= =?iso-8859-1?q?etP1xvFn0wWJQTFONss1PGvf3O?= x-microsoft-antispam-prvs: x-forefront-prvs: 0946DC87A1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(39860400002)(346002)(376002)(136003)(199004)(189003)(11346002)(25786009)(2616005)(72206003)(486006)(2171002)(478600001)(4326008)(446003)(14454004)(6512007)(476003)(52116002)(36756003)(110136005)(97736004)(3846002)(6116002)(8936002)(50226002)(76176011)(54906003)(99286004)(7736002)(256004)(106356001)(316002)(81166006)(105586002)(68736007)(186003)(8676002)(44832011)(1076003)(6486002)(6436002)(86362001)(66066001)(53936002)(2906002)(305945005)(55236004)(386003)(71200400001)(102836004)(6506007)(71190400001)(26005)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB6224; H:MN2PR04MB6061.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ODlg2tTpa2kb1jbL4Yc3bZxnrDziLlQaAFu0YetvZEqb3TKPZn/Rxmp6roPayFPua6HxtBBgA0cBnD9YoyCaMhB3/j44fT5YKCeo8PUV0jZlgwLh3FYpPthlp3rXyOV+clTG7OB2q463xt25oO6+m9IUOBkGfHbNdjXg3xfkSAH5XSzd+nWhf8rnHtz5aage+4L7P+JMut1u4HYad6nZ7/JPxzo3bqgxeBQPFvOKRcM0zt1IQaJikL5uzsRljqAUWtpaKvZ4t/NvTs2w4K/lwMMOVxrJkOCxFiPyTsMpv7Olrde5bhl6oJFR/fygvCFvVAJr+j0cy6zLCbIuV1GQcoT7Qsqwbp5Ha0fLyJNvzUrgNAymLHTp9u0O99iCgRy7ESB/gpcm68nNr21H0pKcNElbuaRl70R+my72/5WkT7o= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8e4a2a9-42de-4fc7-2322-08d690f275cd X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Feb 2019 14:00:32.7849 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6224 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_060037_618767_892A5DE5 X-CRM114-Status: GOOD ( 19.35 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Atish Patra , Paul Walmsley , "linux-riscv@lists.infradead.org" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch implements compile-time virtual to physical mappings. These compile-time fixed mappings can be used by earlycon, ACPI, and early ioremap for creating fixed mappings when FIX_EARLYCON_MEM=y. To start with, we have enabled compile-time fixed mappings for earlycon. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig --- arch/riscv/Kconfig | 3 +++ arch/riscv/include/asm/fixmap.h | 44 +++++++++++++++++++++++++++++++++ arch/riscv/mm/init.c | 34 +++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 arch/riscv/include/asm/fixmap.h diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 515fc3cc9687..3cfd10d35a28 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -89,6 +89,9 @@ config GENERIC_CSUM config GENERIC_HWEIGHT def_bool y +config FIX_EARLYCON_MEM + def_bool y + config PGTABLE_LEVELS int default 3 if 64BIT diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h new file mode 100644 index 000000000000..57afe604b495 --- /dev/null +++ b/arch/riscv/include/asm/fixmap.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2019 Western Digital Corporation or its affiliates. + */ + +#ifndef _ASM_RISCV_FIXMAP_H +#define _ASM_RISCV_FIXMAP_H + +#include +#include +#include +#include + +/* + * Here we define all the compile-time 'special' virtual addresses. + * The point is to have a constant address at compile time, but to + * set the physical address only in the boot process. + * + * These 'compile-time allocated' memory buffers are page-sized. Use + * set_fixmap(idx,phys) to associate physical memory with fixmap indices. + */ +enum fixed_addresses { + FIX_HOLE, + FIX_EARLYCON_MEM_BASE, + __end_of_fixed_addresses +}; + +#define FIXADDR_SIZE (__end_of_fixed_addresses * PAGE_SIZE) +#define FIXADDR_TOP (PAGE_OFFSET) +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) + +#define FIXMAP_PAGE_IO PAGE_KERNEL + +#define __early_set_fixmap __set_fixmap + +#define __late_set_fixmap __set_fixmap +#define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR) + +extern void __set_fixmap(enum fixed_addresses idx, + phys_addr_t phys, pgprot_t prot); + +#include + +#endif /* _ASM_RISCV_FIXMAP_H */ diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 7ed6ae90cf6b..efcbdb9b3da3 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -111,8 +112,28 @@ pgd_t trampoline_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); #define NUM_SWAPPER_PMDS ((uintptr_t)-PAGE_OFFSET >> PGDIR_SHIFT) pmd_t swapper_pmd[PTRS_PER_PMD*((-PAGE_OFFSET)/PGDIR_SIZE)] __page_aligned_bss; pmd_t trampoline_pmd[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); +pmd_t fixmap_pmd[PTRS_PER_PMD] __page_aligned_bss; #endif +pte_t fixmap_pte[PTRS_PER_PTE] __page_aligned_bss; + +void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot) +{ + unsigned long addr = __fix_to_virt(idx); + pte_t *ptep; + + BUG_ON(idx <= FIX_HOLE || idx >= __end_of_fixed_addresses); + + ptep = &fixmap_pte[pte_index(addr)]; + + if (pgprot_val(prot)) { + set_pte(ptep, pfn_pte(phys >> PAGE_SHIFT, prot)); + } else { + pte_clear(&init_mm, addr, ptep); + local_flush_tlb_page(addr); + } +} + asmlinkage void __init setup_vm(void) { extern char _start; @@ -135,20 +156,33 @@ asmlinkage void __init setup_vm(void) for (i = 0; i < (-PAGE_OFFSET)/PGDIR_SIZE; ++i) { size_t o = (PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD + i; + swapper_pg_dir[o] = pfn_pgd(PFN_DOWN((uintptr_t)swapper_pmd) + i, __pgprot(_PAGE_TABLE)); } for (i = 0; i < ARRAY_SIZE(swapper_pmd); i++) swapper_pmd[i] = pfn_pmd(PFN_DOWN(pa + i * PMD_SIZE), prot); + + swapper_pg_dir[(FIXADDR_START >> PGDIR_SHIFT) % PTRS_PER_PGD] = + pfn_pgd(PFN_DOWN((uintptr_t)fixmap_pmd), + __pgprot(_PAGE_TABLE)); + fixmap_pmd[(FIXADDR_START >> PMD_SHIFT) % PTRS_PER_PMD] = + pfn_pmd(PFN_DOWN((uintptr_t)fixmap_pte), + __pgprot(_PAGE_TABLE)); #else trampoline_pg_dir[(PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD] = pfn_pgd(PFN_DOWN(pa), prot); for (i = 0; i < (-PAGE_OFFSET)/PGDIR_SIZE; ++i) { size_t o = (PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD + i; + swapper_pg_dir[o] = pfn_pgd(PFN_DOWN(pa + i * PGDIR_SIZE), prot); } + + swapper_pg_dir[(FIXADDR_START >> PGDIR_SHIFT) % PTRS_PER_PGD] = + pfn_pgd(PFN_DOWN((uintptr_t)fixmap_pte), + __pgprot(_PAGE_TABLE)); #endif } From patchwork Tue Feb 12 14:01:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10807983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28A30746 for ; Tue, 12 Feb 2019 14:01:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14B582B8F9 for ; Tue, 12 Feb 2019 14:01:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 129632B8FD; Tue, 12 Feb 2019 14:01:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AFD2B2B8F9 for ; Tue, 12 Feb 2019 14:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8zE/eOBELY+EYMZ4XZYKvHcwQDaFtAQVTQxMCnLUF3Y=; b=s6TVutiE3q0dsb fXTRYSpfAkglKQCXrG8VHOljnxDZBUF9VpQovna0gJpoc97DL9cSVQyZjzSpnj1Os0nhG+3/BOEvt g0rfNwmjI5IT6Pf/9st9EjR7Qfx9/W6L2R6CECBQ6KWyyEq++1GPPQQ3gAuULuvWwIbmPESo7VVj8 ltSUOxdifU7EWIoEPvUy1YJAaBEhCYeiJL3uKSsdlDZPgPtGR74ceLE4FhZdHaW9/kauXS/CVCOpS vpcP4b03bUAGYuI9h6QnI7OxZM/ocd8/VSLhBk5yAc93gcictOu8sKRNRVxXu4/3RF6bNbW0cVune O8IlqM3LI45DVU3/SHFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYcp-0003IN-Qi; Tue, 12 Feb 2019 14:01:27 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtYcj-0003HC-Ur for linux-riscv@lists.infradead.org; Tue, 12 Feb 2019 14:01:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549980082; x=1581516082; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Sk3fdN0LwxgJvMgUpwPfeV1OJbFU3WDo0eWIv38YgDg=; b=LmZMQhliymK1ZyAvST85OAbumz9+Og/cTs1kuHw1G75CR254bs9YZ/A9 Qk8qc6yXyeHVSLJSVLI4sqWB7Dq0AxV8oF+hXSCJBdn69PFo43gNWksct CAhKNyAiu6oy+dwjdvzkZnsaZlM9wWwxNbZPYYBfIPkNlPDrLyd/+vHtv rJogwAjM+pgYzPwCE711scHzmw82tIOpYPLTK9uwuLAUKH1yaTGZuEdRJ ejJy+T6IeRBD9ev5NFo774+sK0G7xKn06M9nEdiqjV2SZErH8lk/koMyp UVDjhbbKVSbv0mZcTbHdx5W/alvl/u/SG80lZb6G231ecfkfFue2HxznI g==; X-IronPort-AV: E=Sophos;i="5.58,362,1544457600"; d="scan'208";a="102320715" Received: from mail-by2nam05lp2053.outbound.protection.outlook.com (HELO NAM05-BY2-obe.outbound.protection.outlook.com) ([104.47.50.53]) by ob1.hgst.iphmx.com with ESMTP; 12 Feb 2019 22:01:21 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VC6FY+xLOBsl1N4zS/biP8WkZqLwzg471RcMRzpWkXU=; b=I6x34EpOp3qDR06fTudIPiGYjBbFia5plHluaJodwi5IBkvc+UQjfuRBIqsN2DajVjNELlJAFtFXUQvdX3JrQqmc3TwCZvGevU9xaXbtFQGIfqE1Knxgqik+9Su5n49ocwYxs71xLtNCABFfo4lcmWG0uaRWhPguLn5IBbJylCI= Received: from MN2PR04MB6061.namprd04.prod.outlook.com (20.178.247.148) by MN2PR04MB6062.namprd04.prod.outlook.com (20.178.247.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Tue, 12 Feb 2019 14:01:19 +0000 Received: from MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1]) by MN2PR04MB6061.namprd04.prod.outlook.com ([fe80::2cdb:c465:af57:8be1%7]) with mapi id 15.20.1601.023; Tue, 12 Feb 2019 14:01:19 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v3 6/6] RISC-V: Implement keepinitrd kernel parameter Thread-Topic: [PATCH v3 6/6] RISC-V: Implement keepinitrd kernel parameter Thread-Index: AQHUwtttaGujNBaGJ026ihx5TuVFxQ== Date: Tue, 12 Feb 2019 14:01:19 +0000 Message-ID: <20190212135942.105008-7-anup.patel@wdc.com> References: <20190212135942.105008-1-anup.patel@wdc.com> In-Reply-To: <20190212135942.105008-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0126.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::20) To MN2PR04MB6061.namprd04.prod.outlook.com (2603:10b6:208:de::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [49.207.48.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5e0ec97e-51d9-41a7-fe4a-08d690f28fdd x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:MN2PR04MB6062; x-ms-traffictypediagnostic: MN2PR04MB6062: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MN2PR04MB6062; 23:U8Me1X3UFR5HtADcyV2iC1gFXU+lYon36UqrYry?= =?iso-8859-1?q?/UAnYi/o9H8lLqM?= =?iso-8859-1?q?EY2Ihw3JQd9TXmsRI1lS49iliQ8G+7fP4riv8eLkXJklMH53yk0vcaDjdd14?= =?iso-8859-1?q?TSTMspNUleBReiw1udZT0oDo3SF5kUSsnW+66bZ+OFkoH+nOD2mrv+haq97F?= =?iso-8859-1?q?PJPdsxgGiNpO3+8adWZyDBeORKv8RwDElvrZgc8CJ/rruCi9IhCX88oVAwlI?= =?iso-8859-1?q?pIpIhEqWii3xjUptDNt4U4oMtjNnrDLGBn43ZaLc85TxrIhc05luuZ+v5OcW?= =?iso-8859-1?q?m0iAO1yIaO/EsQm0Fm4yXZKRS1g5TOFnOPx64JcsgPhq3B9pNpG7BK99FzJz?= =?iso-8859-1?q?JfhANl+VdOFbSd1vHZmQwckwpEWYyeYCndRnzb0sIKNcQOUiSZ3YjRFhlyq4?= =?iso-8859-1?q?QrgFtIgzz6U7tFOvf74L77dxkNO1CgISFX+2nLbMGH4SvxKmfQdgWoG0xERS?= =?iso-8859-1?q?Zub3/Q/kc37UhdKHfLTL2p3mcBnshhRcGRo5QVRH7M+q2Xsvw8bWwbsSuRyS?= =?iso-8859-1?q?LCQW6EIAvrRtkSE395/UjnXiYzCbv9navkS5UiHTloYMvjIrZKprt1ff2Od1?= =?iso-8859-1?q?AvaP9HpJ10B0tLcm+GH0FONd5AIeJcbwmD95XyJFawwisEsuRbV6udyWWtTT?= =?iso-8859-1?q?1hjGF5O/Fh5pEOoj2TFSmxwdH9zhWtNMDKYwtzhpnKF9w7L7arrHWr3JmLkN?= =?iso-8859-1?q?kPliC9KZLQlAllw8XxixDEsL/gPe7ehTQkP4fzUfeaAjF6DYOO/tajjP7WQm?= =?iso-8859-1?q?XvU5fv4iD+33wojX1dTieey2VC6zZlN5OjyzthkMko9LdPGjBDiSVAf9lhUz?= =?iso-8859-1?q?NiIxB5JXXGdBIyoHbBULM8zeiATZzk5jJ+u10DaoQZFQExJU7B2KhO8O/JNB?= =?iso-8859-1?q?AfuhpZtefrzWC/G9mEuzSi5LQ7FebKUVlyVuBbo2Z3DKI/9LaWiv3ranw3rS?= =?iso-8859-1?q?z6e+Nz/bn6DGuD5kUTkvxtT8zhbs8Yp1mYV/vVjZKmPbrKQOkf0dkn8kc6TU?= =?iso-8859-1?q?bz/ClLmUveMr6ZQMDC0dEmWTBDSGYLZ/G8Q/3Xkwt47aE6mtXM3H96MMrhFe?= =?iso-8859-1?q?Dacxt2j7COLLMLkH0ETGTUFK/YPIMP/0klvYf8JebQbH1GIUbiSAVge4Rvg+?= =?iso-8859-1?q?2pWrNv/JX9bLHMb+7AnunKzw0DPXKUdvbv2I2dDrR5+AoyhSYYy/+RMxfAwu?= =?iso-8859-1?q?awGwOnyOJVDeUOiAbohaz26dSCo8tiNaIm0IQgp58XzTSjGIlJmr257W84Jp?= =?iso-8859-1?q?S2MpckGCSOvsE/gQ/QQsIuURvjhOMTNkikvFuWWN7JSKLbmg=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0946DC87A1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(346002)(136003)(366004)(396003)(199004)(189003)(8676002)(2906002)(81166006)(86362001)(44832011)(50226002)(2616005)(11346002)(106356001)(446003)(68736007)(316002)(53936002)(476003)(81156014)(76176011)(105586002)(25786009)(486006)(8936002)(14444005)(55236004)(14454004)(6116002)(256004)(4326008)(36756003)(3846002)(71200400001)(71190400001)(102836004)(66066001)(386003)(52116002)(6506007)(99286004)(1076003)(186003)(6512007)(2171002)(54906003)(110136005)(6436002)(7736002)(26005)(72206003)(478600001)(305945005)(6486002)(97736004); DIR:OUT; SFP:1102; SCL:1; SRVR:MN2PR04MB6062; H:MN2PR04MB6061.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 4X49z4u9GRfKePYOMv6bSyPFVg9Vs1+fxfCAsH0zFHJ5gvgZoL+rpIrqpb8i+ED8C8OV3v4fI0klH6fOe8ira+KDK1TsYnsJxZKI5+qCu+Scz43Or3PDBJMjI0UZYXid6CT65cQI0ereJl3QaE8oBYKK5lGp7Pc062DoJhRX8oM6lPjXwSuNnlq4BdDc8kDyYyyrnt6srUZ3BiKwuLFgygGFbqhZoCyLg13cH02U9/ZQ3nv6hF7iayu64TEUJl/2hj9BLyZ01oEaTzpUes+TpDGGHA0DIpf5TIQQ6B9wbYPcHdaVnIfvJekaB4rEu/zMJ4X8+DMLIB8hm5bT81nUFS38MbT/dVT7yGmfocUiRSDmugys71IpAHCKLIxssQqdjm7zXCAQMPtVkydtJ+DbeNN1hSuGORL0qkPgaUML+c8= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e0ec97e-51d9-41a7-fe4a-08d690f28fdd X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Feb 2019 14:01:16.5492 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6062 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_060122_128262_2A3E1EC8 X-CRM114-Status: GOOD ( 14.78 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Atish Patra , Paul Walmsley , "linux-riscv@lists.infradead.org" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch implements keepinitrd kernel parameter. By default, keepinitrd=0 so initrd memory will be freed by default freed but users can pass "keepinitrd=1" to keep the initrd memory. The keepinitrd kernel parameter is already implemented by unicore32, arm, and arm64 architectures and it is documented at: Documentation/admin-guide/kernel-parameters.txt Signed-off-by: Anup Patel --- arch/riscv/kernel/setup.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 9cd583b6d1cd..46e547dd8245 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -97,8 +97,20 @@ static void __init setup_initrd(void) initrd_end = 0; } -void free_initrd_mem(unsigned long start, unsigned long end) +static int keep_initrd __initdata; + +static int __init keepinitrd_setup(char *__unused) +{ + keep_initrd = 1; + return 1; +} + +__setup("keepinitrd", keepinitrd_setup); + +void __init free_initrd_mem(unsigned long start, unsigned long end) { + if (!keep_initrd) + memblock_free(__pa(start), end - start); } #endif /* CONFIG_BLK_DEV_INITRD */