From patchwork Wed Feb 13 08:07:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809317 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 32BE51399 for ; Wed, 13 Feb 2019 08:07:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2330D2BEA5 for ; Wed, 13 Feb 2019 08:07:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 140AC2C8B9; Wed, 13 Feb 2019 08:07:27 +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 AF77F2BEA5 for ; Wed, 13 Feb 2019 08:07:26 +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=MHC18DoeB4dinbGGvP0XnxXlyNdhiRpkYinnO1KfVZs=; b=kxZO/JGPAjInQ6 CXmqRjPDBySTRACgsj8VbFeLMjKSM7RWSUEq0CsK162iHu/yE64ICgjIgHOK88klKqI6l70jnjhxK gaFjrQMQijfxQp7skbsMeRbJwm37EAfDfP9juzKR00qkTuefg24TmBY1j2tqcrmRk/Mszfl90F568 8V+/xC9n8SodnH/Dp3w+B0GnwONhqhqcxLkbSMR8y13cXtFrPcSvOuXXHt7Plq3Bcc52VAj86W0Qh oT1UEX7SXIyxM1MbPtnOVwCq6Ra8xHK/sTXByREKoYw8zHwslFifSA/W4Rdb6yBeype5jNbJCorje 9w7RM9+zNKoWzGit0Rhg==; 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 1gtpZj-0000Sh-G7; Wed, 13 Feb 2019 08:07:23 +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 1gtpZf-0000Ld-Fy for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 08:07:22 +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=1550045240; x=1581581240; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=+/p8HkxkueZ7rQ8VzLG/lOFOWhPGN42z3n4YDQTEe1Y=; b=J6sloyyXbNU36t6irNEaVvJ5IdHW1v00/zoL7BXQJgptHqw7ZBL5Tmfl J4vSuJe83F6+Fp+LqYnlnnnpVcLd8pdkDcPUYHW9icNVAntn0VwU+Vx/k LNRa2HsKVUa5VbR38u0KKQeDMiyPSR9+iGtFqFx1ellp2xs9fHU5DMZep PTNZQpa9vDny4UWjDfANg4lG+fdspUKtlQFpKVwij8/cHhzG4KbS1NPHv 8KyL4VJKTzNi4BLSXRry6oq/zmPIFWlcvvCmZTi1jwx/TGYe0R5hKlfbD FWM7v5MOF1kWDK65M032Tdt+yoUT7/PV/0Log02YmtjbwHLFM2sHPtbVV g==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="101081331" Received: from mail-co1nam05lp2051.outbound.protection.outlook.com (HELO NAM05-CO1-obe.outbound.protection.outlook.com) ([104.47.48.51]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 16:07:19 +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=Sxx+mlJOnQqF8LM3AFqxTEVHgpOYIFpbc+4AjA3qutU=; b=GlMr/wjMgQajqD9TMlaT+Pf8JbGrF5339wJSA7em9S3d+BsnxAO5O+IpL8XgkT/XZIn3WQt4j1+iXgXSGVJk6yGqTUNp2YJDkZ1J6RWk/cTtW7WYvlwI7RSn1Wu6Ps+Q3zQa25S5E3IWodXUV+4aVpWEvRT8iW++h01z8RHxQfM= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5993.namprd04.prod.outlook.com (20.178.225.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Wed, 13 Feb 2019 08:07:17 +0000 Received: from DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c]) by DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c%2]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 08:07:17 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v5 1/6] RISC-V: Move free_initrd_mem() to kernel/setup.c Thread-Topic: [PATCH v5 1/6] RISC-V: Move free_initrd_mem() to kernel/setup.c Thread-Index: AQHUw3MilRR/kWU9BEe52TaCNV3UfQ== Date: Wed, 13 Feb 2019 08:07:17 +0000 Message-ID: <20190213080647.68204-2-anup.patel@wdc.com> References: <20190213080647.68204-1-anup.patel@wdc.com> In-Reply-To: <20190213080647.68204-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0140.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::34) To DM6PR04MB6059.namprd04.prod.outlook.com (2603:10b6:5:129::25) 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: [129.253.179.161] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 508153db-2797-4fae-db82-08d6918a454d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB5993; x-ms-traffictypediagnostic: DM6PR04MB5993: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5993; 23:09DnEsKmxZ6rw9xAYenst6je1hAG71XYXISVuom?= =?iso-8859-1?q?6I1ABRBcDiAWdgG?= =?iso-8859-1?q?2G5YrcMHmWmNQoEFTd7l/fS3uJSwJxkle/9PI/uw9XJcGbfgC/c5gtuPBl3h?= =?iso-8859-1?q?j2g7NbQRmbN5nlk74EKIk77rvXLWqyJ60O5kVFkrKD1ZcwclbmODSUaA4t8G?= =?iso-8859-1?q?9zkEtQyn3YQlx5DMn98wJ12//jWN1azZzrNgmjIXNYNCE6+LI7NoeAlablLl?= =?iso-8859-1?q?jHUTljzcmEoCHwm/xtzwQAWfOHBSv1ThDSEOkqFwDYNXV8Z8oKgNXaK+z21o?= =?iso-8859-1?q?8cpPUPE8oZsJtIqIho4OgJPb9IMWt5zFtSCKwBh2M5JLcCwVsWbXtW8EkCB1?= =?iso-8859-1?q?ewd1GICSxR7+sQjtzHve5eabKl/VP7WCFWhNrWj1YGqw+4AW6owIbtQmhNXz?= =?iso-8859-1?q?4h9J90OcVnVW2mrz9Pprh7ow4jJR3JgoWxim1pAPmywCJFuC8VB6FCbWKHxR?= =?iso-8859-1?q?0okIG4fXXIaX+jAJ31Fa0gwR/rTtpsVYeGVnXQIPEBZCvoPVc8dtKZDuKEwh?= =?iso-8859-1?q?odw3ZjqR9bjXsU/74TKACSR+8pw5UV9o423WZo4+wZtvk8ZXF3saZzUWLMvx?= =?iso-8859-1?q?jMHXPLQBf6EBvVTVZU12cRnV75ttfQVAvb6j9JyFF+eBbHZuD3MTlYykZ8ev?= =?iso-8859-1?q?j0g/6OV6v2zr6kAI2hi89ROcsCHQ8jSoZUuQNEFZ1Tyeth0/OTG1utOLcVqi?= =?iso-8859-1?q?nL5m/tESBApVumn0mAns+KI3Ybm63SEJCjO9HnzCZoCKJOly6xyrfRI6+ltE?= =?iso-8859-1?q?K56mxFwyn+HQIKtfWcxEq2u8RvZllEvzF5Yut+5O7BMxUlkXbGjur6P7M6cq?= =?iso-8859-1?q?pypGQ5HlS5QeHgpWQNE6QEn42P0gxRyk11imZzcuBmy9uUW5GSFSKjrku/UU?= =?iso-8859-1?q?njNsh7NX6qFrS5QCdaD/wrxmH7mEBwjD3jfAgxHz4NSxyHErq78UcRq7lR/s?= =?iso-8859-1?q?6MyyuJj4+w5eXblXR3TTUpT/rsmQfRbSCalVt9ydbxt/4WtPFWbYcXfZgsSN?= =?iso-8859-1?q?DlWI9QG7wKk6YyuFUoolEeHKg1nQdlYxPswiRtOHs2qgOGYdMqxpfTL3AF4E?= =?iso-8859-1?q?5Uq1w7YGUuZCrLUeP+kCsEsaCO4PSmDh1Cv+io9Xq2VuEnCdTyvFRr3SJHbp?= =?iso-8859-1?q?aB4LiGvkB6qdRGRXRMKa9ge5vANdC0JG4Oj2Rsu1B85qUYsZXX4KrTEoJu5O?= =?iso-8859-1?q?ja0ApOf1eve1BQz851+ern3NmUKoFbadGIRhNM2rw1aA0+iF6Kxx96njEtk/?= =?iso-8859-1?q?WZPfY=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(376002)(346002)(136003)(366004)(199004)(189003)(6512007)(99286004)(53936002)(50226002)(386003)(6116002)(52116002)(105586002)(3846002)(106356001)(76176011)(110136005)(6506007)(25786009)(256004)(54906003)(86362001)(6436002)(316002)(2171002)(36756003)(6486002)(97736004)(4326008)(81166006)(66066001)(8676002)(68736007)(102836004)(72206003)(476003)(2906002)(11346002)(446003)(81156014)(1076003)(14454004)(71200400001)(71190400001)(8936002)(7736002)(305945005)(26005)(186003)(486006)(2616005)(478600001)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5993; H:DM6PR04MB6059.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: Z11LWHjHEHEBeSI+J8R9xnqlPGfFJSp1ogYs3b7s7/Ywdwnid63ZcgKYP3YY5DGY20HL5vQY1mC1AZIiouONY94Yz2VcczOBCCnoOz4sxFEQzQZW/V7ql9/73gEUbOnwDJugSFHHyV8WPuqYhdjIdvzAi36boncUt8w0WCvd7dCFhaEGu/mMYPsTvSUHpf3zPiGp2Cm6YaojwpjSjXisgJMr6R6z9TA/SqkacnRheyWsZPRf3tjdJCqLIVylLb2ABrGdN2dEJCp+xLK0Cxq4ClkUKJdtkwC+roWKWrEbanv6yEAJNjRual4VC+gnupUV/ezCIJg2myuYi8lFffLlOqC1EmCSHiC8ab7ttgdmQ7Z+z7nJQEsr/IoVU/qeReMoqjq0vlW0zLJGVjXb1BA93JbJfONjAbp3MWhhMMtaas8= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 508153db-2797-4fae-db82-08d6918a454d X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 08:07:14.2876 (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: DM6PR04MB5993 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_000719_768587_09B7E926 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" , Mike Rapoport , 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 Reviewed-by: Palmer Dabbelt --- 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 Wed Feb 13 08:07: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: 10809319 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 B124E1399 for ; Wed, 13 Feb 2019 08:07:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1EC42BEA5 for ; Wed, 13 Feb 2019 08:07:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95B7E2C8B9; Wed, 13 Feb 2019 08:07: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 425BC2BEA5 for ; Wed, 13 Feb 2019 08:07: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=dI1iKPv1Rj9Fs0afOfot5FRJuLacjS5JSbHCOdT3TjI=; b=Y4/CoPWf7JmZmf hQJBZcshoaup97GoohCyn6V0ezer5888ync1XU32E5BaPBubsovsD93ntnjuhOOWDDlr9QOZUKnoo JpU2lI3rT1gvWDm78quekg1LnJiTkWsRhJCzd9GCDuHr85JWsah5C5kOaHbLyR75KhXLo96cbV2gt kpD5zpMAdq4o/rgB+2mrsdb+VNKaJUpsFhHHtsMbDeQnwoUoNnHG/OqVkLMUxvB5OKJJlJWz1tDP0 yQDX9zy4404jctHCDQjU4rkt2kxLCy4VhNi3CRAncClhvgGtyP0DtGcd8djBB92UEamPdm+d1i9EV dLB88TR2yLKlBYGRhgDw==; 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 1gtpZt-0000Xs-Fc; Wed, 13 Feb 2019 08:07:33 +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 1gtpZp-0000Wv-Rx for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 08:07: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=1550045250; x=1581581250; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=h25QTCPdlhMfqtz+zmztEhyRxhdRVXagsuYHINwV8lo=; b=qTFD7VPK8DLSDPGXkUphws01FKiVCNB+7kE4FOz9tqPUNeSumZWjICLN ZY9igs39rMizRtuj4zBZZFnaKV+KhH/cI6Szgc1Zit0vRQRTi9Zwf4j++ urflIyIcxgOLjdcTClDUn+MRbbadVJmCdCyTUJ0IKhVN0G95T9c0N2UtP HHrOQknk5wB0rRrUHFnQGcphHwlj9DZnLjTxfObCtRuAkJ6RZYkC13c3q sWMKYxJ+zXHTQ/URh3ChbfQxhbTfcFAgQJKZ4IHM2uB4wdjkBwkjAxIVV wi6GlZoFb9s6h0y5b6jBfnP+LJ2CU9e9oRbzrVedKE3/ldIE5WuAMl6pf w==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="102402297" Received: from mail-co1nam05lp2053.outbound.protection.outlook.com (HELO NAM05-CO1-obe.outbound.protection.outlook.com) ([104.47.48.53]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 16:07: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=I8qCA2Iv5UJ1d1yEkinn+T39/F/zEuxMl5ljAL1ZXGM=; b=Hfj0Twx0LROkyOranho1twaEmTrd6cXIWErC1TRuA8KgVJpYpGZiR3jAFR/Iui1cIDTR4/jWrSkm/ER3nbBsqoaE2T12Z0JeAUjk36vPBkvN86BhBaNLn4SgBraqnun/csa5U5xnsGcrxqzv2rXU0BliTxNTMVEcmJKrvA4D9dc= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5993.namprd04.prod.outlook.com (20.178.225.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Wed, 13 Feb 2019 08:07:26 +0000 Received: from DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c]) by DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c%2]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 08:07:26 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v5 2/6] RISC-V: Setup init_mm before parse_early_param() Thread-Topic: [PATCH v5 2/6] RISC-V: Setup init_mm before parse_early_param() Thread-Index: AQHUw3MojzWUPEGlyUOTNqeH6ojcbA== Date: Wed, 13 Feb 2019 08:07:26 +0000 Message-ID: <20190213080647.68204-3-anup.patel@wdc.com> References: <20190213080647.68204-1-anup.patel@wdc.com> In-Reply-To: <20190213080647.68204-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0140.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::34) To DM6PR04MB6059.namprd04.prod.outlook.com (2603:10b6:5:129::25) 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: [129.253.179.161] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2016079c-fd96-483f-dbb5-08d6918a4a4a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB5993; x-ms-traffictypediagnostic: DM6PR04MB5993: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5993; 23:dRkXvadU4amHWoDZW6zTrM5nkYAmyD6a+4lxOkc?= =?iso-8859-1?q?hbemWWGUfdldLXV?= =?iso-8859-1?q?uJ6T0og0cO5M6raytIfKrscVhui/YhfDinTw13ZHB9vkaF9yg8cQZG5sGA1O?= =?iso-8859-1?q?Clq6aQqba4NpO8M9YZwng3zIdRJLl4scbqnWvrOPMOc7NkCjoMdHQxfqpwAy?= =?iso-8859-1?q?atsjzjZWjclhAcwvPghieQ/JCI1ZY00kJG7k2frS4uhf4X3gNUmmH0Ji63lr?= =?iso-8859-1?q?BY6SEPJOez8d/T+kiUixT6GG09+HhIDpl6KAytRVTkwmEQybFncPZYFnOaOG?= =?iso-8859-1?q?gMyi2KsUEjPtrogD8vAs4r8SS2ZjEFqwU7MBsV9nPSZfBVZ1IWEpCw5LeWCL?= =?iso-8859-1?q?tJ94r23YCyMrenJcpjYLtYph6gRmHO8U39pz0u3b2hz1LDj1WxvdLXeDQFPj?= =?iso-8859-1?q?GO7MI13O6J/xxMfLeT/r89xuHgah3orukyaj8IXdCKdXEUvMzj3/meyxpUWN?= =?iso-8859-1?q?HdoqnpD1Gkl7Wsx700jwKu5KiwpO+tGRAYEoWI6LwjRv91V06Mj8k6eloOvg?= =?iso-8859-1?q?rw349qey2syds0qcUBqheB8pQv89To8vVKSvOrW5AqeYa5SOq+aoDIVHR7yw?= =?iso-8859-1?q?tMBpHHqCT0CifTIzLfjOBLecP6dwZGsmfBMzpfYW1onn6y00N2VfEdSjpONH?= =?iso-8859-1?q?hzt9grAQBXTGB07Kf88S383dy24Qamkw+tBQe7R+Ee2BdNGyMZ9ROXVlQBvK?= =?iso-8859-1?q?h38yKNaU6rrSiz0B8zdAebwbWXSv4hrCv9qeomzwCxyvInK+tbEvZ17FyNAw?= =?iso-8859-1?q?ZTwmNNtO5mdInIuEeyYWGZ6oD3Fjfek1umtPz2p0AIU8PfZihYqtqdH08775?= =?iso-8859-1?q?RSIFiwjfcdWJV3CPkdsfQuT5fN4Tu1HNt3MRQSb+1NmQX+uJ2FEaMCT/UDql?= =?iso-8859-1?q?Tuvo23ZtI8onBABi5cqxGWAHrXkFSKOa7dxT58t2Kfv2JZfU0zRrs/QBO8uU?= =?iso-8859-1?q?w/D2zWbs+StO+U/a408X5P2Sg1unD0i9UP3zIQRszlrTDlyEyfaYLq39Clya?= =?iso-8859-1?q?zhGXLmWN3VapQI0VFB/TRHmZwIEzA8/d8/TqJuVekaLlfr56tVWivxUFMRKm?= =?iso-8859-1?q?n49tv9+4GGUT1xfSi3RWeg4kTFM8fysq/GRL9x5SfSVzEm3WrSI4Oeeoy9nE?= =?iso-8859-1?q?//4dU6xIKiwM1nu+WEgzrDtseu96zguSRLFMu1XHX0/IYQ7kGBYu8sZf7dtS?= =?iso-8859-1?q?dQ8L4+ULiapBfdkaBzQwC5G2TC9NYsSbZ0e84K0N8FJeHpVlZ5qCvsuCqeOw?= =?iso-8859-1?q?tNw4s=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(376002)(346002)(136003)(366004)(199004)(189003)(6512007)(99286004)(53936002)(50226002)(386003)(6116002)(52116002)(105586002)(3846002)(106356001)(76176011)(110136005)(6506007)(25786009)(256004)(54906003)(86362001)(6436002)(316002)(2171002)(36756003)(6486002)(97736004)(4326008)(81166006)(66066001)(8676002)(68736007)(102836004)(72206003)(476003)(2906002)(11346002)(446003)(81156014)(1076003)(14454004)(71200400001)(71190400001)(8936002)(7736002)(305945005)(26005)(186003)(486006)(2616005)(478600001)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5993; H:DM6PR04MB6059.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: eNtj9ZWJ7WDE3BoOBqH9xLtvX6qM93cAKDhAxgsAlhvzVTDsBIht7+lV3vq30vD8ophFL2g6yNzOvmaReV9ZGtd+D6cNVEN8ejQP+qHlS1kVtAP6My7m+ChHQgBRPgOzXdA7VzWOSbaVbheYh2OdFCdMj74tidW6OvS1KJF2o8qWdJx/Qb/t72X3sdfH9H6g3TVC7EHn6hOUg+dqG1cWjsrmJjYZ/eBrVxFSKsDWT14eM7CgVXLvVB3RVdVrCAUl7IP1TtK7FcYBM8xdweUUzisWVkc4nKQbmxfquYVTKEdoP5eG46/QajKNe+enb7cnEyne7MfUEcwLvWZ5fBXMlJ0JzEBZIFCR/2yDyWfh0VwXeAS1WbiV+m+jwSwDC7E9CzF1pmx4qxf2q5kckOLcloLL9OL2dGmUdQ+F28oep1g= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2016079c-fd96-483f-dbb5-08d6918a4a4a X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 08:07:22.6696 (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: DM6PR04MB5993 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_000730_014916_CE36708A X-CRM114-Status: GOOD ( 13.29 ) 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" , Mike Rapoport , 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 Reviewed-by: Palmer Dabbelt --- 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 Wed Feb 13 08:07:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809321 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 B1E1713B5 for ; Wed, 13 Feb 2019 08:07:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A25F82BEA5 for ; Wed, 13 Feb 2019 08:07:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 967592C8B9; Wed, 13 Feb 2019 08:07:53 +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 0D2532BEA5 for ; Wed, 13 Feb 2019 08:07:53 +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=Fl7Gzw9SofxlwrnSrtvEh///RNaHhVwuL/8f1iwIr6M=; b=sWarRGDVSIaPQB R3E4nDLNRfxN76bNuoEoYosdTcE85a8QyUhJP0JzMKnBZdg8btmaTLtLVB1ANImrUNN22okjJpJFK uEhlcdXwGf82MYyIQq0IuKhLaeJpN39y0q/8z9aTDm7Z9IjcGmJFlTgqTYRV7NQ161p07JMnPRui6 7H/xI5XMSAWbigHVEBpZc6o9Ur9lswqOLhwP7a5KYLlhqdmsL1Et8JkE4b5Qx04lKKTskHdmiJZJc RZbuYMbSf03ddgPglH0R1vLIYVTl7mIyWIczUOXJOYwrSfzrqKpmkVWs+7yKh4B+FOSKsrI7dPsRI YDxivunD0EFnESt/dJTg==; 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 1gtpa8-0000np-T0; Wed, 13 Feb 2019 08:07:48 +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 1gtpZu-0000Wv-Qc for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 08:07:36 +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=1550045255; x=1581581255; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=PuUS9APfMCm0201mEnejJ6ms7yQO4HAQocfr3TMtdYE=; b=CUDeNMP+vRF3yAk9q06rY7BOc1IuhMTLeTDem8j2YOg9Z/RHTAX6JYvO ry435008zriIrmdfNLAg2iiJAndT7egYOwqQvtv4J5rjnwuD4qlKWijNq qr2Zy/mTsNZzP9Chf7rQVaa9C9PIhdQ4tCe/ujDkdhHznmlW1mWyzVBAm KT8ZLaKy+fkHso7CHdpJ2CQ0piVkF8gxVOlnwcE+K4LembQv8kODvFd23 QpPVmlGNrnfT0L02GyDSFwZGvRfBucTS/CzN2RaPSQ9V/iVq62h1gL9tv xXrMUv1TdGTpurwyRUKbSWIHe+F/747MroIxr3WcdNKa/FhV387udQONc w==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="102402322" Received: from mail-co1nam05lp2057.outbound.protection.outlook.com (HELO NAM05-CO1-obe.outbound.protection.outlook.com) ([104.47.48.57]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 16:07:34 +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=nZYC+n40qSzR4f+zCg6G37FQlaEhcuFjDfi10z8r5e4=; b=SFMkwB7CWKbs6dvuz+r8HvZSoIRjHdw1wHEIADytmaXx2D+YUdoSKyPCpRPm6+85HdmUxJB68HAhX9T3/Km2uRbRprV/49aZwg+YiB/UxR3rzCTuvx8Sc7z6WA0S40G856qNzQYOECodxkXqWUCEiyJ7SeUu6Lqp1FP8q7FGT/0= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5993.namprd04.prod.outlook.com (20.178.225.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Wed, 13 Feb 2019 08:07:33 +0000 Received: from DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c]) by DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c%2]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 08:07:32 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v5 3/6] RISC-V: Move setup_bootmem() to mm/init.c Thread-Topic: [PATCH v5 3/6] RISC-V: Move setup_bootmem() to mm/init.c Thread-Index: AQHUw3MshXGMAgT6hE+rgap+UEOhBQ== Date: Wed, 13 Feb 2019 08:07:32 +0000 Message-ID: <20190213080647.68204-4-anup.patel@wdc.com> References: <20190213080647.68204-1-anup.patel@wdc.com> In-Reply-To: <20190213080647.68204-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0140.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::34) To DM6PR04MB6059.namprd04.prod.outlook.com (2603:10b6:5:129::25) 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: [129.253.179.161] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ccd81a7f-a717-4c0f-610d-08d6918a4e69 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB5993; x-ms-traffictypediagnostic: DM6PR04MB5993: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5993; 23:PsUO0gxNDrX4tMNwC0dZCEC6faDE0p7EgITH68t?= =?iso-8859-1?q?r8XjckG2FwRE95H?= =?iso-8859-1?q?u4kdaJe/zfdJxu6asenkFSk0lV9/T8iYdxuwxfIHQ/4j4bTAWFj9B5LFYGt+?= =?iso-8859-1?q?TdpZWgHGvzn00GtrLvMmGtLa6zFUUso6jVPlPUmFtZYODIEileyAV72iMRIg?= =?iso-8859-1?q?EH5MPlyIlMRszY/PQ94tjNpmgtKTvWU2elfN7EIqzTsvM7X6nyon0X3rENPy?= =?iso-8859-1?q?eyfptEGmGoWyyn9iG+aZvv+qpAcpRQEDjiw2ZqL8q4g93jJBT24ZYw5SubSA?= =?iso-8859-1?q?ygbciLLrMlyn+7ejPfY6kSz9DDBezQq+SGnpubcbW+gb9kaO7uUYsyqwx8Ea?= =?iso-8859-1?q?6B1M0JWhZrm3uyfT8XLArh0rePitSCMBVeVX94u2Lm7ydxpaiDfH8ggZaFxz?= =?iso-8859-1?q?QxJtDGKT5fV+9PbzNAN9iRTNIsVM9DwgceVA2k2xwQyO4S6/Ew6LbhNmcDd6?= =?iso-8859-1?q?PcpS842on7k42xUFEasS3RWTFleGIwgL4RmODnXfh8nOoIcJc4/DIWfXQrxm?= =?iso-8859-1?q?Cx8jmbQHlu80eMjrBYytqpe6zucQPso7HElz742a5akXj3euiJVUTVuDpCrT?= =?iso-8859-1?q?xA9V66m8W7YjmomRJB0K/L/grf9js6KWo0gaVRf3/9FTxq01BzQ8tKkXJE7v?= =?iso-8859-1?q?ISt2cOWxKHn4no9wEJC53pF9rqrqkKqE32PHG64kWE5T2dq7iRSLRIdv84QP?= =?iso-8859-1?q?SjwjbTUKmnzJGV50f5I4ZxDsRaJLQ3Po8/TRPpFG0ylG2cHxfvrHa3AJtbrw?= =?iso-8859-1?q?aIW654Ipk4/rMCVBvpufedCXPQL1TYD9D1SZcQXBD2VKtCGgkcY2mtEGtUNs?= =?iso-8859-1?q?VWdgXtZEq4gMf7yefpkDQ+JOJ0uGZVFaL6hQGot2u2nQdDA5M5z2L/eGKBa+?= =?iso-8859-1?q?pFivesgTaaSSB9zNVC/7zS2n2n98hXe0Q8GPH9Aw9Ah/cblLSNQjcIYDX1Lj?= =?iso-8859-1?q?ps2TJiYf7mquo68DrQQxBKwLJqTCAKEZqthVH6SzBV5z4g8NPVCcozQY3lH+?= =?iso-8859-1?q?Qawlb7Q3qBqc62gfjrhXjzdgaWuv2KyH3OeqiO3IeyAiJ74XWlMxcDrgkTsy?= =?iso-8859-1?q?ouuU/k00hQxfNqYJcL4c3WeXXBISvpahVa4kbyfxSRfUZRrx5dpStoAetvWM?= =?iso-8859-1?q?HFeNg7InY8rfSrM78jtAAzsSCBRNHOEqIUFpdK4qnXhmxPa1AIkFyMvTdcA6?= =?iso-8859-1?q?cROP11KRCrsK8cgobgGLeT1hf72OzIHe4E1nattRhWgspehBFV9kgQLnRNE1?= =?iso-8859-1?q?wcMnA=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(376002)(346002)(136003)(366004)(199004)(189003)(6512007)(99286004)(53936002)(50226002)(386003)(6116002)(52116002)(105586002)(3846002)(106356001)(76176011)(110136005)(6506007)(25786009)(256004)(54906003)(86362001)(6436002)(316002)(2171002)(36756003)(6486002)(97736004)(4326008)(81166006)(66066001)(8676002)(68736007)(102836004)(72206003)(476003)(2906002)(11346002)(446003)(81156014)(1076003)(14454004)(71200400001)(71190400001)(8936002)(7736002)(305945005)(26005)(186003)(486006)(2616005)(478600001)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5993; H:DM6PR04MB6059.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: IOrb1b7D9+EAmqJcsTh78m+UzIFC2JEuSmqgZAFxT73xzXIYaudW6bNQwgJqeNy8p7Y8nWYTZYaiaHc/f2Jg6fYiJWcA4qtdRIYxB9xHUlYUarHiq385YBK7yKC9WmM8+sVbtSdia9xuoQRYJvw1DOB/6lXoLzkDVc33QJ5fVma+sElzGKIKMJuAIaR5zZaqF92h1RM/oVskGyYWjtuIAW7eNjVFYR7MJQeyGlCf+vJ6jzMAQfApDz5I+fu4zU5BvQaeseE87SDJkOYv93rGrFHayAHQCFECu3D6NLA8K3nfsNn8Aw1fo/MAc4VHcItQce6KAxQ5w43biGiYWp/bNpI17/MPrxpFlaEjNZ0GQ4Po8yOBUwwtNcg6guO98QP8yIgK7iwveSRYgEWevUUC4gwQuN25ka/3uCFHWrzXdkI= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ccd81a7f-a717-4c0f-610d-08d6918a4e69 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 08:07:29.5835 (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: DM6PR04MB5993 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_000735_101308_DBA4B501 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" , Mike Rapoport , 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 Reviewed-by: Palmer Dabbelt --- 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 Wed Feb 13 08:07:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809323 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 54D7E1399 for ; Wed, 13 Feb 2019 08:07:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 455762BEA5 for ; Wed, 13 Feb 2019 08:07:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38FAF2C89A; Wed, 13 Feb 2019 08:07:54 +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 AAF7A2C8BB for ; Wed, 13 Feb 2019 08:07:53 +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=QAgQRKNtSCPays4lhRrvus3eQ+qkXB1z+D9NGGlIYuc=; b=Oc2W69gCNklBOg xok3CGRspwUPIg7eV3JUfsw2G5aWgz6VjM5rzKCJhnuHC80mFJMzxlK2Ts9EEgx1VzoCZ6LQTJlCJ r4Kr2JgEyKoQVJYGOin67Rjfn5yuhVgV0+WSuHbzU1KB2Sh1o1OFne90h7JJLMCj08pSRN+bp4qdh nRug+UpH/RYXdvtgWvMepxnMCWJ5QBCjxysOYtVXnBXKV8Uy22/ISrfBd+aGwUPT6sA/pOkdo1Csf P38YvHpNb7QAH34ZItS32d2debIApSQGeXa6/LZ1wDW2S6LLEAJfUsZvIS7PVSfKOYdfOniHI7Bh1 C9h32IyjRCjwb/uFZ11Q==; 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 1gtpaA-0000pv-Qf; Wed, 13 Feb 2019 08:07:50 +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 1gtpa1-0000Wv-E0 for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 08:07:47 +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=1550045262; x=1581581262; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=7AOlzjSj/WH9jMA4KAlBpIw3dgu/3amnrTdBqVuJ7o4=; b=NOZ4yRIWeQiLTBUIWQCCZqo45KzBJV86h15Exy2q4k97nR9vGRZz4ps6 dpv/SpcsqZQmsv8XFs4FKD5XyBW29DVdX0PP5pBvzN/Mz58stcvExI7JO kyVyE1mE7aKLFC2z6IXAk0d32A6dpxx7lX8NV2hC011yA91T1vJSz7IYC ksBGbEncpJyBCOIIanO3GPj36bOHy2TMmHgWTpqqFt0EYYL1gKHccXD5H FYFwIFzCk8sMZbtPnBHbcab3WKklV82yatsmq/eKtx6BrG1sknjjw5rKG wmBdCRx3EWEHDGUrDZT7pF3IQ3PHI2e8z/iOFvrIlsLSS2F6UHHkgf2PN Q==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="102402329" Received: from mail-co1nam05lp2057.outbound.protection.outlook.com (HELO NAM05-CO1-obe.outbound.protection.outlook.com) ([104.47.48.57]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 16:07:41 +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=PJY7sWbcAVPre4asLkQ/uKfSKIpiTlgqnZgh0KYFeFE=; b=YJGYaa6TlTowI9yfcAtbfdwFtKL5rhQPslkyqiHy68fSQgaFnh28bVL+a8zy0iUxOa0C2oBQV3fO2invqO7aRl3D/F9XzXjOaf/SmhKoBFaBd3hYUe+eZb97iTsaFhU1fOpUnLeGTwc+BMPVV2SBe3IryuFmv9uZAhNZAkN0D20= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5993.namprd04.prod.outlook.com (20.178.225.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Wed, 13 Feb 2019 08:07:39 +0000 Received: from DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c]) by DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c%2]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 08:07:39 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v5 4/6] RISC-V: Move setup_vm() to mm/init.c Thread-Topic: [PATCH v5 4/6] RISC-V: Move setup_vm() to mm/init.c Thread-Index: AQHUw3MviTRH367Kt0WCzQchbikLcg== Date: Wed, 13 Feb 2019 08:07:39 +0000 Message-ID: <20190213080647.68204-5-anup.patel@wdc.com> References: <20190213080647.68204-1-anup.patel@wdc.com> In-Reply-To: <20190213080647.68204-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0140.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::34) To DM6PR04MB6059.namprd04.prod.outlook.com (2603:10b6:5:129::25) 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: [129.253.179.161] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2dfdeb91-9e28-4e61-a861-08d6918a5255 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB5993; x-ms-traffictypediagnostic: DM6PR04MB5993: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5993; 23:1HGuRLC6eUbQ4Lw3q+pTtZWoeDZIEDDIb1kLKfb?= =?iso-8859-1?q?WgRDnku7QR8UrCE?= =?iso-8859-1?q?nU6/NewbW3DN3CPJeRBrQbid4OvSh82on3suvCgAhhkWNNe74izchMqa4nHF?= =?iso-8859-1?q?M0Qd70skwLG8Mg8lcG1W7egRGSrGvMtHpa23sS1XL1PAvYv9lj30AS2Rs/ve?= =?iso-8859-1?q?ofZWNHCO1JRFt+hHuWmNhSEnKSkXdcSw18GpaUIfAAoGReSbqDW7zvHVm8jV?= =?iso-8859-1?q?NU8NcOyRVb8yRdfxkJk5+R/vCeJz4NjMrazHpli7MRN+8IB8KZ336GO6zc8a?= =?iso-8859-1?q?S29Jdm8CvdEnaj8z+oKEjZ2g6o/5G12Nyi8PCBqCsdz6s5OcHdbImIjDdTvA?= =?iso-8859-1?q?XltacVDFCLmMn/KbFOfTLvypOei5FpOgA5Rezy3OL3/P0i5RD7FVyWyr3oAl?= =?iso-8859-1?q?UZE+rfUbgXsl9RDKXBFkRDq3h+FGkuekBoW61fy5qAY7qfkS80POpmiuuo8C?= =?iso-8859-1?q?QGUJUxS32S2SpEDc4bnXwr1BQVHlfWrDRBhyMbcGxfP2mq2Jj7aYtKJ3qTaY?= =?iso-8859-1?q?ryjT+4Bng/KQf1uUfsspNW8m6P7jzv4VQ3kqmU4IkAokemMhbyFflIf4IqrZ?= =?iso-8859-1?q?lqlC+nLD3DC6Hr2vjUa0LSmR/x2HbhzmWR4hAQL8OPCxCSM+ODu/+Fxrn5H4?= =?iso-8859-1?q?gkIbEZU8CbdwguCWQXHKUZGrPufuIehEkPHvPlwMGwHMnQNS3wK2en4dFJ5v?= =?iso-8859-1?q?qXn/s0YHFM+LFYu1gCH3AuMLfMRAvtsHszYBtpk7QA68PTdrwzKX9nJznuCG?= =?iso-8859-1?q?0AKy5Sjo3jCIVkCmyk6DgPc+qHVaz7W2bY2eNerRMNfauKRTttnHN22mZpiI?= =?iso-8859-1?q?HTFT08BVm8mgPGNn3kqOVSMWVB1bF5kyoLQLbz87C+gy9Ga/NNbSmPEj9M66?= =?iso-8859-1?q?mttDm/JU8gA0hI8ZY/oL9e794/q4fYaAraYMFCYhOHcMOB/Abznq+tHb7osm?= =?iso-8859-1?q?qRojEBhY+jT+GdiFw6QpQyXUaSfiW40/BdiH5hRqT7ptIkYg9H0a9a/Hn101?= =?iso-8859-1?q?3R4jG03AxoA2/Fsv6dd41XvIyvUINM9U1EQctAJ2+88hRYenxF72pTzqZIxT?= =?iso-8859-1?q?2h/EJenKljenM/O3Q8G2/RgiQi78C6oAjqen4ZvckOWQ3H7q//3vzSwRUc3G?= =?iso-8859-1?q?M9eco6LLwU/GuCbTkkKTEj/AHnuxdR8p7pcn/WDlNf1tBaGj0aQEEPhuhd3H?= =?iso-8859-1?q?/I8WT5TSBr50QtxgAHdnm+UETAqhRbqlq6Wwt2/odZYZAKKLq6RfJzuF8GxL?= =?iso-8859-1?q?t8yZk=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(376002)(346002)(136003)(366004)(199004)(189003)(6512007)(99286004)(53936002)(50226002)(386003)(6116002)(52116002)(105586002)(3846002)(106356001)(76176011)(110136005)(6506007)(25786009)(256004)(54906003)(86362001)(6436002)(316002)(2171002)(36756003)(6486002)(97736004)(4326008)(81166006)(66066001)(8676002)(68736007)(102836004)(72206003)(476003)(2906002)(11346002)(446003)(81156014)(1076003)(14454004)(71200400001)(71190400001)(8936002)(7736002)(305945005)(26005)(186003)(486006)(2616005)(478600001)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5993; H:DM6PR04MB6059.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: Nn3tBN/hvydU5Raq8XQxqrodz86JyhvDXdNkwwqMe5TJoIfSsQIxuID8ru+lMorH8KKQlTLmSR0qWd+ZSJJT2pLqDA0kqXeMjkUfk3+WtyqfXWCSL19V1Hug6LpgHKCtGFS3KmyCJWjUmoGL0mJyLx0nFMGW74MjJ+aErkcRYsRxA5ux7qWQevMFvHF2HPWtc5NJ19riDsAYw7I5g9XXD25+oZSvKj6hxkfm3bwQZrVTFgqL45PNy8CcAoCTPy5kMjVsrwTDg3GE/KKBj6uZ4nWTjE1eWhyIqYq6ILSfBv2rSy//MHc5dsO8lvpnbmtel1q2fVA4ygSNdo0AHumwaH86fL6ce65NUuVcsE1EoDszk985AaJzsvTTXCChiN+E28ey+xg3/DkFHFs1I5HstIO2+bPP/waBne9KikbOeGc= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2dfdeb91-9e28-4e61-a861-08d6918a5255 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 08:07:36.1631 (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: DM6PR04MB5993 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_000741_949731_783AD129 X-CRM114-Status: GOOD ( 14.88 ) 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" , Mike Rapoport , 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 Reviewed-by: Palmer Dabbelt --- 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 Wed Feb 13 08:07:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809325 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 763D21399 for ; Wed, 13 Feb 2019 08:08:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60D052BEA5 for ; Wed, 13 Feb 2019 08:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52AE02C8B9; Wed, 13 Feb 2019 08:08:01 +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 AF0F82BEA5 for ; Wed, 13 Feb 2019 08:08:00 +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=UrbuIJ3C8CFhIMecSuQudpM69pMIFRbrVKEsmuJBnjI=; b=PHcJ9XvaJD85XU BVNCP8+Nd7nA+Yf86kpQ5SF8Vr/L6NtrNLF6WgBieuF+t7EGtK/ByZdBAfA0CiaLA0UxmDZuBxGa/ ZuWH9cof6ps3PGUX1OquwtY6gBA4dRAIIU/k/OS2C57f8kMYvcbO+aSc3YDPwbz8GVV9y3ZNjKavY JP2Yxn5Y/XRYEr0wmYfyA0LXAAzD6bPy0RrfUu84vWGkHKwobF7ryC2Jba+mUkgRrsCKEOkrE683H KcRPBuGcG8QWBQZTVslJaSJNO4rqVQX2qohO7DkZEpEF/XKRVIspETCwe41yCiR7J94O8BEAIInqr Fonj1pthTkeWVeilx+hQ==; 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 1gtpaI-0000wS-1Z; Wed, 13 Feb 2019 08:07:58 +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 1gtpa8-0000Wv-Dt for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 08:07:53 +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=1550045269; x=1581581269; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ubekwtYIPFFf005R5Hzs4jmv+czpJXwjEd3zgesqrRw=; b=W9AaLMz3gb1nXofm+UbobGgFsUI7vFHNcJULasn+vRwNL4n/yKfKTiTt UXEIBV2jPQ329zIDd9BlnKeIr4cLuA5DfzzRWLsN518C6EcVcq8gtDVsV qqoXQei/5R70sOLbb6s3ecB4yFfLF2qkdkK32IbJukRUM0uk5MvTKTvKE IiirVIHkuHvtKEutFeYEdTuV3u48bUfT2uTwFCBVcdESxVlxKIDzdXJCl c55w83jqiDM9186q7Gvw6so0OmQrNDS2XLOdzdmPT4DmvsQ4WGUxURBlP 6DIHMATaJZ4LATdDKSaTww3IV8qSYiBijwzaFltPxjO0bhbD+2AgjJBl+ g==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="102402336" Received: from mail-co1nam05lp2053.outbound.protection.outlook.com (HELO NAM05-CO1-obe.outbound.protection.outlook.com) ([104.47.48.53]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 16:07:48 +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=DcBwDJJXFu1PqOJGPFzp6HBUM2mAFRKjvzARIRyaD18=; b=IfCn9oRP5T+5ap8AdWq4CKvoKX3+fxVuJFG3VX2m5ffB1S8TzAUy1RgSz49pFV2EeSz9lp1eK49mC+KZ0+5RCusCLN7qCRbNOOeFor5Bg1Flwrfd0tiujUP3bN5Qm5Srg3yeCV1d3lD2aI3tHuUOj5hkq4bY6lOct3OXI7xqAII= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5993.namprd04.prod.outlook.com (20.178.225.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Wed, 13 Feb 2019 08:07:46 +0000 Received: from DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c]) by DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c%2]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 08:07:46 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v5 5/6] RISC-V: Implement compile-time fixed mappings Thread-Topic: [PATCH v5 5/6] RISC-V: Implement compile-time fixed mappings Thread-Index: AQHUw3M0J56JXC4eo0qhxf/X/5rwMg== Date: Wed, 13 Feb 2019 08:07:46 +0000 Message-ID: <20190213080647.68204-6-anup.patel@wdc.com> References: <20190213080647.68204-1-anup.patel@wdc.com> In-Reply-To: <20190213080647.68204-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0140.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::34) To DM6PR04MB6059.namprd04.prod.outlook.com (2603:10b6:5:129::25) 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: [129.253.179.161] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6c528b62-2eee-411c-5c95-08d6918a5665 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB5993; x-ms-traffictypediagnostic: DM6PR04MB5993: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5993; 23:PSOleOI5esjNHoqT3A0d9OG6mkob56iG9tg+ldj?= =?iso-8859-1?q?SHEoRY1yH9cAiDU?= =?iso-8859-1?q?AWmo3brjSAaCYXDKmVCTOjkm7qaASFCDxhKk/NFSm+zeTJNTgBFtyRQYaTqW?= =?iso-8859-1?q?dnWY/R6vOU9QZAGJ9ryWldfV53E2Ex6HD07ONml1lFTfHlSTO2qtAKhfb+gm?= =?iso-8859-1?q?TgiIgganFFzYS6hwVxWfs1c1Khjq2CJat20nKGz4TJu+WEoX/yIF0dfq5gYi?= =?iso-8859-1?q?ZtdXJ2X0H6MVcHKvqkJiKCXxOfCPvFPmqNon6l/W4Gw3YT9PG9G4FNzR42Qu?= =?iso-8859-1?q?CSPQpiyi9JMpT5j/Oa3kwMGipF1NzNqW7OXrZ2R8Z7OUJNS2RTnfjiaZLRrI?= =?iso-8859-1?q?EEqPF062cZD7x32BmivGplAZ6JPhzApFmrbSk5aTvzpJYXEWCD6DHkbcWcca?= =?iso-8859-1?q?QatC7xPKzi3aZH+3KQotaygBn6t+m5kZ4OweSDObNtaNrfzEsTaiJDOW/6KO?= =?iso-8859-1?q?yvWQVDOfBdRV1GvBuEDMTeC+VjrF1jNLHU64qFPJ4zY5RIkdXBYRRPKFWoRQ?= =?iso-8859-1?q?iCrUFTJEVk1TYZm90VgRRa1PuQYSeXt3vQiWROo3BEdw7fOYtoV3b+4mYqJu?= =?iso-8859-1?q?p2HbEpSDW+evuMwQwR1TfU0elT3wzu6pJSYjczSsGpJd67u9uETN3T1tQY6z?= =?iso-8859-1?q?VfCZPqBCvca5dpvT+GrhHhgVYVvV49trpGoJrnqIePg9FjMmzGsNrrYK1Nd3?= =?iso-8859-1?q?oBJsbM1knLRPCQctasTR21iG0bgOUp73XaUkgqDyjXwDhkhrSrWzAqKA36Uw?= =?iso-8859-1?q?1un4NodRTutvaFK33e1rlkz3UjTTrEOARkO3l9aEn7PZDre0TBCmVnJSevqL?= =?iso-8859-1?q?mHvFKJ5r4xcyVok9wHmeVK+F3CqVCbJgjjyWKBGEHFCYNrULQepQjVM2z3au?= =?iso-8859-1?q?S8d4huUbP+G7KXPNDexqLHI/rJXW5TRn2K3jYBT4oKLqrhsChKXZw6JDe5xE?= =?iso-8859-1?q?y5+SBsdcSeNMn7Dftv7adch5HhMRTtN5E9b/6sQ37+zoCCvt6nknR58X5/Vq?= =?iso-8859-1?q?fz0Hjhx9AUcW1JQ1MCHaYnDGJvnK07/Viqi9ggXkJQh/WiDnCfDuDHFqrfzi?= =?iso-8859-1?q?f8YM1u/TKs5UrJPDkZj2atmy8R3SCiXQ9eBEeTZIej3vBxgEgXjnsa9fKivo?= =?iso-8859-1?q?7CM5NNk7fufXp9YLDOuRYUeLWuP4uQrY2laWtgT568wUzLI5+eNowT6WwtBi?= =?iso-8859-1?q?JSfknZrg+Ab/ULKbq5j2rGbLhxXrarFvlKWldQdNpcLrHomQ/gjxz7HC3NqD?= =?iso-8859-1?q?fntCs=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(376002)(346002)(136003)(366004)(199004)(189003)(6512007)(99286004)(53936002)(50226002)(386003)(6116002)(52116002)(105586002)(3846002)(106356001)(76176011)(110136005)(6506007)(25786009)(256004)(54906003)(86362001)(6436002)(316002)(2171002)(36756003)(6486002)(97736004)(4326008)(81166006)(66066001)(8676002)(68736007)(102836004)(72206003)(476003)(2906002)(11346002)(446003)(81156014)(1076003)(14454004)(71200400001)(71190400001)(8936002)(7736002)(305945005)(26005)(186003)(486006)(2616005)(478600001)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5993; H:DM6PR04MB6059.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: eFvAcLBoExK/fOo4ZxexM+Ru3nFrKLM8LPgaiqlzsbGa+lzQ4Xf6afpxWRYgif+Uw/XhH9b7wjFBbN7Q3ajWs6NGcsg9NVbs5B0B/C/koFiQaddavP8IPhm0LG4nLIlMhvGQd7iyMbs1pkkyv5xhaGnXcxXaq5FOnUwCp5gdVKm4pgsl5GP8L97jotlZh4dPTi4yysQN8pwhkfdixCuIEf6IwvUBxfaPI5DqHxWENMO75mZm78QLpI5zGoI05B+r8HJvw2LJlzErBX8x9MW05Y+PWdjaygu+FNgj5yJmCkaCL5L6QE6T18xDBowYgkDLzilsR9yM283Ud+EsleQQvohs9SiJ10A1ziE8LtnOyayTniO++GHdQ6wrs/q0UUqxCewyL5ZgWRU0gFGo0gZQqTF6VXJAqqiCPG4VRZpx1sA= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c528b62-2eee-411c-5c95-08d6918a5665 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 08:07:42.9779 (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: DM6PR04MB5993 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_000748_752877_7F19028A 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" , Mike Rapoport , 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 Reviewed-by: Palmer Dabbelt --- 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 Wed Feb 13 08:07:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809327 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 ABD7413B5 for ; Wed, 13 Feb 2019 08:08:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A92E2BEA5 for ; Wed, 13 Feb 2019 08:08:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C1C42C8B9; Wed, 13 Feb 2019 08:08:04 +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 2D1142BEA5 for ; Wed, 13 Feb 2019 08:08:04 +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=yItPc7De/nBD/KMYLkUklz1GSsoQEDPBvZW3JPSbD2M=; b=LqbwleezOKoJCo tpppwk0KUPo9Tib9vzfEbRNu0t9oLDKq9eUOionyLspNi0qGVvpVBQpmk1v1Lux09s3E7fyNXzn4w 5iXRhR5QyM5Ing/JkAiTLoK7/f8eQ/LBVTJBI9sGxOVCfydGF0T9b/Wbw/WWs9KjyYR8by5wFehGJ +Y+7zQv1GejmF+ggkA9D1CiolBIYdXG7JCl058HRnjiqq9UNVYcgZTG5uaUdRFbIyersonI8w/30U gmiQXPrA81s8CTLihGy1C6YxwvzKYHoFDSMuR18Su8CPcyNKfTnGTR8o7hyjAd3SIDj3oJIJ+K11e oHwhsDPewkj9kjkhfYCw==; 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 1gtpaL-0000zp-Cc; Wed, 13 Feb 2019 08:08:01 +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 1gtpaE-0000Wv-Ew for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 08:07:57 +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=1550045275; x=1581581275; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=mVPMs9C8+6CQAaDj6NugfLu86pA3zkPXJHHWwQpuR9w=; b=VoPmgeHMUNQbaitKP+QU+CtqZsLTzDX5GELvAF9WL8tkvPvk269CgwXJ oR9G9QtQQQteAY+AXQ2ST103Q2/gulQjET2dTWmkQDapHw2GSB568boW0 DCYc1gfkopcZf8rxK1uCQNN/MT9j+imvfc58JhIaKkPrnV/1KcVlN8FFm 3zCUJze6+ARxArP7ziSWCINSOzJIWjarn99ECsX3S4qTHIV5cCrGfo5hm J443NsT7TIeZwtqP7E4nFC0K17rmD7FlKUhLvQqWLGa8j2X1HsEJOOGBJ fPYCet+Ismj674XSjyw6Clfboj9ODxMqt/nbnBDZhBJh0O29qkhlOUOGD Q==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="102402348" Received: from mail-co1nam05lp2058.outbound.protection.outlook.com (HELO NAM05-CO1-obe.outbound.protection.outlook.com) ([104.47.48.58]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 16:07:54 +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=UAFENJ0ckmNmp39g4DgIRLAtQx1PuVea/P1XlwG4f1o=; b=WueOUukaWaWiB4Q5/PNhCfOXDWlyQPbN7rLwxsoj0zhqqLlE43kClnZc5uyOJxB52YcTWhB7orr/UVBpx1qQTrU+roCjU9pwEIyx0NUVCcxwIDjZVeo2YrP12D5aAC/GWUrp9ABRHRJfi4coTewh7o+ro6/mVMBGj1U9HR4kzSQ= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5993.namprd04.prod.outlook.com (20.178.225.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Wed, 13 Feb 2019 08:07:52 +0000 Received: from DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c]) by DM6PR04MB6059.namprd04.prod.outlook.com ([fe80::d006:5be7:c3f:ba6c%2]) with mapi id 15.20.1601.023; Wed, 13 Feb 2019 08:07:52 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v5 6/6] RISC-V: Free-up initrd in free_initrd_mem() Thread-Topic: [PATCH v5 6/6] RISC-V: Free-up initrd in free_initrd_mem() Thread-Index: AQHUw3M3QH97A0lstE6SewwvrcIfpw== Date: Wed, 13 Feb 2019 08:07:52 +0000 Message-ID: <20190213080647.68204-7-anup.patel@wdc.com> References: <20190213080647.68204-1-anup.patel@wdc.com> In-Reply-To: <20190213080647.68204-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0140.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::34) To DM6PR04MB6059.namprd04.prod.outlook.com (2603:10b6:5:129::25) 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: [129.253.179.161] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b63cb087-1be9-43f7-f066-08d6918a59f6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB5993; x-ms-traffictypediagnostic: DM6PR04MB5993: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5993; 23:nZoSFga0WrTqsE2lMz/Yi20cgjCC24DMQVMbeMJ?= =?iso-8859-1?q?TZAUuEcYEatOHuM?= =?iso-8859-1?q?X6FCeqXcIkcUjF14KsB5Xs5d10VZSqYxJ6UAmmOdFkkCSwTOdjJWwssHxhj+?= =?iso-8859-1?q?zsDm25dWHRs3M/yscESuqya9xhq6NpfcKviJYLQBkz0AeRMny6AZ7Sr2n+2Y?= =?iso-8859-1?q?bYCTDj82f57Cvazm7P6gVa7p7hRgWqsa6HYNKJ+VtoKYhXH/3s8fTBnexfhW?= =?iso-8859-1?q?ZgvY1LzRG5goXKZjoZydgipzEdUXvbL+AxeFTE36oRkFCifSZGZNHlARNVas?= =?iso-8859-1?q?WgB5ONZyvNqwW9QWE78TcpTSEgFANTUacU4lXu4m4MWQ+71FdZb5rJHZOMQi?= =?iso-8859-1?q?Q4QMUbHBodhFK8mkdXevRio3CkCWlZK+f+/62yqUg4GDCrQu3Mc4aaA0eYB/?= =?iso-8859-1?q?bLBlGP+p0klywJqYNtngPgGXPYcOVr8nRVgDnTfciIVbpV6D9ZdOgA5mHFYQ?= =?iso-8859-1?q?S/jOukm/GcJ5RxLSe3tGFryd65OI86rTG7WrzdXn+jqYw65p/Rm7MNc84V2x?= =?iso-8859-1?q?sfVLvppwlDvtjVh7BGTOLte1b6F5Q7MlGtaCoeIHn/8Bmhp9ZzpCjJ5L5qnC?= =?iso-8859-1?q?hXSFMaPDdKCVKCFfEOL4VWWfT3ZeggnwSQX+ruaA3F3lTC/3zUW8XgGA9QuA?= =?iso-8859-1?q?qhE4AuQUdTBx/rq7UBRL1xHQxUiiDbjUK69G3JK0BGlI2eJmM0ffOehZTcno?= =?iso-8859-1?q?8Ku76oKnep9OAah4H80lEbgNocMqcIuErUlUv4+2N61bKn10Mu8KSYfpQWdb?= =?iso-8859-1?q?b+DhC3kGgurnpGPGpjt41MA3U2qJM6Y4XDR9f21lSig3UI0ft2NRkRxkMA/o?= =?iso-8859-1?q?+bGdYZHGeFnU7fNt0PmN/x5VsY5QFxNQdcitwoRHe4l5Ygl9J60Z17zChKSU?= =?iso-8859-1?q?jF5s5NoOCugv1fKryZD1TVdXYsBDp/5Qr2QB8tIeaYgX18ASUBepOdT16vQG?= =?iso-8859-1?q?T+dT4dumhRUmSDlJ0f/vKZGb1k6vrdxg0W6LEFdy9/DgsJDJkLs9Bif4ITex?= =?iso-8859-1?q?DSgxaYFOA14GWsl5G0fHZTzeQ6fBSKPAaZzeH2mZpyMZojU2qMbILBy1dB/5?= =?iso-8859-1?q?zKnYOSDLtiT6sjwM9415SPJEoIuaRzJ0MLsW67+GXrjypgpOkLklwrqN9GTo?= =?iso-8859-1?q?bCJoMLT9cYQfnIqIhaPR/6tYx2L0PkSnv+zlle/3G3tVczgexxXW+daSWOQz?= =?iso-8859-1?q?MmQsLAfJg10gghKnQuiaeqB6RZXsqXZdJsV7F3jBoce7ZQhaGdJZ4TtyUp70?= =?iso-8859-1?q?QQaglitghn5zXkOb39vUKW1B5/?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(396003)(376002)(346002)(136003)(366004)(199004)(189003)(6512007)(99286004)(53936002)(50226002)(386003)(6116002)(52116002)(105586002)(3846002)(106356001)(76176011)(110136005)(6506007)(25786009)(256004)(54906003)(86362001)(6436002)(316002)(2171002)(14444005)(36756003)(6486002)(97736004)(4326008)(81166006)(66066001)(8676002)(68736007)(4744005)(102836004)(72206003)(476003)(2906002)(11346002)(446003)(81156014)(1076003)(14454004)(71200400001)(71190400001)(8936002)(7736002)(305945005)(26005)(186003)(486006)(2616005)(478600001)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5993; H:DM6PR04MB6059.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: /LFrOUpjCdpohcnQkb8T5xadw1Q7Wd66uxsOWCkLwkVOrsqlyuV3Xpg51jmE9AKeo1omQTdyWNnKfRz3hY/rm1bTgsyPwAygqHDQthu2OobNZojNDC2ErQJ5dmtJXj6SBi02+1Kv95kMx7x3iLOSoF0EGTD/sfVInkgseykxQfD8/FAz+XWu4u7JZvD7DSMedEA2qYB10o79+yyyjVcoi2jJzPWK9IOVbdcg1q4l50pbcRO4hpm/dCUczSV3C+DxGkqSkkYJjmVGeD36F5mpwyc86KeBFXehhDdhqqp/8EDOpnLZ2HQafnDpie7kcbj1ptyWqKZ/cIXM2OcFEN0+a7NBiVjoSO6keGD92JRjrqBZJyYviT0yULxN1XdNqZefmCn5ilqFz6s1ynXmOzkSrhH8Apu4q6myMmzSkghoEiw= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: b63cb087-1be9-43f7-f066-08d6918a59f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 08:07:48.9622 (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: DM6PR04MB5993 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_000755_116523_F528CADB X-CRM114-Status: GOOD ( 14.16 ) 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" , Mike Rapoport , 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 free-up initrd memory in free_initrd_mem() instead of doing nothing. Signed-off-by: Anup Patel --- arch/riscv/kernel/setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 9cd583b6d1cd..ed8dd28ca98c 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -97,8 +97,9 @@ static void __init setup_initrd(void) initrd_end = 0; } -void free_initrd_mem(unsigned long start, unsigned long end) +void __init free_initrd_mem(unsigned long start, unsigned long end) { + free_reserved_area((void *)start, (void *)end, -1, "initrd"); } #endif /* CONFIG_BLK_DEV_INITRD */