From patchwork Wed Feb 13 06:32:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809171 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 4CD126C2 for ; Wed, 13 Feb 2019 06:32:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 396872C4A5 for ; Wed, 13 Feb 2019 06:32:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D7CD2C4C2; Wed, 13 Feb 2019 06:32: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 CA30A2C4A5 for ; Wed, 13 Feb 2019 06:32:34 +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=rjoYUkL2ubcjtq BT2OvVt9rM/g0xodDQ1bkTeMvYHOIs56wK8q4RAXhPn//7mIfSwIfLqJZZ3D4YhE4/coEo3+OPj+8 qjCEHVGxYaPjliImLYY6jLUxN2JrT2cPG1LxA5NCDFObnoqKUSmqh1mxicp5cqxZxzSOA8E9pFgnb Oj9N84N9//ltpwW2OfIK+HnfCppn3E6f3gsnw92et83c0ZzKsaMwKSGgEKiKSW/r74N8yNrLh//3X WwvbI46XaNaXnVCkxnt+sYOa72Di8MHaO7CTzIauAY/5bKKipY5ZtVd47RlcQLnNRFJIXGC5uUN5T vH8dCjXs6//Sf27Cnh4g==; 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 1gto5v-0006re-AG; Wed, 13 Feb 2019 06:32:31 +0000 Received: from esa6.hgst.iphmx.com ([216.71.154.45]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gto5q-0006lZ-1f for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 06:32:28 +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=1550039547; x=1581575547; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=+/p8HkxkueZ7rQ8VzLG/lOFOWhPGN42z3n4YDQTEe1Y=; b=pQln9TujrmS3BAfZ02Tjp9cEbcRvnKOB6oIz+p6qAF4IjkThxMQltI/N VGGk9KP3HGsDWVUb4sc5vHsEPAp4WdKIPEbQBZo9w6GbCwqnLOlYvWfJZ 9oM5Xbd/SyLzd2HUCAcFkxhaGf5ox9AaAiyKFJ9fH55lbz9mK5y7/ui2T xNJpiGf4m0gSsvJEaFu4/+uqT5DyUsEEeAMGBLOmp+u9isWtYUeZtgybT ZJKLTScs5msyTyw5wUmXJ3uvqbAeTv4XQ4r4zyFpkfGOZLia3+bk1h68W tbA6ezh9T91tSSBvsn40uIY9z+++Sg1lpsrNdTkzb+Zn2RxbstkaxlQA9 g==; X-IronPort-AV: E=Sophos;i="5.58,364,1544457600"; d="scan'208";a="102859898" Received: from mail-co1nam05lp2050.outbound.protection.outlook.com (HELO NAM05-CO1-obe.outbound.protection.outlook.com) ([104.47.48.50]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 14:32:24 +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=T0vTWxWZfRQq1mBruxLOubJxihzE3BrwOyjfAxksmV6Xt/THlVw2JHvi2rhsGBAOWsW6c8R266BxkYZ8wXQBQn2ExhpmmkHOuCHa+w40eDgMQtKnAjXmPoS67NzWK6BI72ccVxB383h6oYeljPpfUqZtV8r4u2i1GrB2CG5q3R0= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5515.namprd04.prod.outlook.com (20.178.224.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.22; Wed, 13 Feb 2019 06:32:02 +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 06:32:02 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v4 1/6] RISC-V: Move free_initrd_mem() to kernel/setup.c Thread-Topic: [PATCH v4 1/6] RISC-V: Move free_initrd_mem() to kernel/setup.c Thread-Index: AQHUw2XUM0HeGU3JKUmZsgmw0A9sjg== Date: Wed, 13 Feb 2019 06:32:02 +0000 Message-ID: <20190213063127.28703-2-anup.patel@wdc.com> References: <20190213063127.28703-1-anup.patel@wdc.com> In-Reply-To: <20190213063127.28703-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::13) To DM6PR04MB6059.namprd04.prod.outlook.com (2603:10b6:5:129::25) 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: 7afd3fc0-37b8-46df-590e-08d6917cf6bd 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:DM6PR04MB5515; x-ms-traffictypediagnostic: DM6PR04MB5515: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5515; 23:Ru+yyp8fRRKgnE+O6K89A+ODEm7aKdJONymiwXu?= =?iso-8859-1?q?B3LmjezHXAvyysR?= =?iso-8859-1?q?CVr416VCmyYup3z82B3AzVE5YF1E/Qg6C3inBCrEjtj0R/P+citeWMsfzTyW?= =?iso-8859-1?q?tGJzHs5LfuvjzKyRz2vKKOopnukP2405pp5Q2vHFux1GQviuB+5YwRwOppEn?= =?iso-8859-1?q?z/YkKcRI+aP0i8DzRFB9vXl0yhyjtEF1o3PWgKlj3HmdSE7OdSEwp65fNQAQ?= =?iso-8859-1?q?1fZS38wti8vR2gA4pPzC1FAkEHN2OMhHNX9NrnvNN3muRy9IkwmIv2IHwxOB?= =?iso-8859-1?q?OHOXeBZz1OHMwDZFSLL8FT0JG20ORE2P4KY6bqvz9Qw/BfLyvGVj+AVCFXna?= =?iso-8859-1?q?WSNn+Z5AcmN8+lzJ0450ZnVa1S9anU8g7gGTqrcGoDaPaPkXhY+LgNSFkWEj?= =?iso-8859-1?q?+OLNl8W6j7ksOXeyoCT2cVWpjTy3B/RiCaH5pvB59Ksj3WAp7T90jb6vUAGZ?= =?iso-8859-1?q?gTIhSPACuv5AqtLTb4OyTfmjGnfYKK9KleGwY9NSpzYQP9eHRzi/VizmFIi6?= =?iso-8859-1?q?crv/D/COqkq4JoH3rByQ38KpTIgWSskNWlrzuRhTdj/3DV1frLemXIHjs8cO?= =?iso-8859-1?q?qoDPhhkhOAw/G7Q+EjSw/ZWcZkGALFcg0o+Qs+l0S9E6ixRPEvpeHGLW1O5l?= =?iso-8859-1?q?bqK6sxkr4rjupNK9TcRfZjijMefbqgHVXt2yyriTIB/AICRqZU2XA1WPtcU6?= =?iso-8859-1?q?xdHHbTCgd754sLBimbk9SsBSxOwyxg4zX+Wxyh8EohAGtVmnP0N9vjLTKkrf?= =?iso-8859-1?q?a6T9ymg5rxaJBvdZA3nv2NfTLeNQr2AzRcQS90PCZsctaNcku+HAlnyiemFI?= =?iso-8859-1?q?QgNgeTgWkoCvt1UeolC3fp5JercTEWI2B36EMGuqlDqLI6V8W7o//gc+jCeF?= =?iso-8859-1?q?RmX6SnaIOw4XpX99g3LcfbT6O9aQe70sqQeyG3Vs9T7kg2i28A93Y5MsnS9K?= =?iso-8859-1?q?e96t6PTr2upVSYE4HjWsuIBMIgyY5WhJ40PyJb+J0m5Zu3dF3RmGrjfPB3yD?= =?iso-8859-1?q?mFOBF7F+PAsP83RYpVYq5L6ve/FVVEt/TIdLFiGWymBzq2Hc1AIR/PO739lU?= =?iso-8859-1?q?AYP9IIyr5ax7sAnTxyiOJ/ykhUwmNflu+rkAzLhx75csS7ZexmLhGGe2oVmK?= =?iso-8859-1?q?0TgSAZWxq6s80ZRCvshUPFNIEMDN/StPEeBiSdD0J++ksCb/XuMd76mPGO9k?= =?iso-8859-1?q?BsnELBwZOkUFbKX5AVIec78IM4JHshQ64rLoi8giHS9n9wd4Xg/WIwSEc3N3?= =?iso-8859-1?q?MvUDY9SJTJD2fX0HtBOHLfedpO?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39860400002)(346002)(396003)(376002)(199004)(189003)(1076003)(6512007)(2171002)(478600001)(72206003)(446003)(386003)(6346003)(2616005)(11346002)(102836004)(6506007)(476003)(2906002)(256004)(50226002)(4326008)(97736004)(14454004)(6486002)(110136005)(25786009)(6436002)(68736007)(316002)(44832011)(486006)(99286004)(36756003)(8936002)(186003)(6116002)(106356001)(81156014)(81166006)(8676002)(3846002)(86362001)(26005)(105586002)(71200400001)(71190400001)(66066001)(305945005)(53936002)(52116002)(7736002)(76176011)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5515; H:DM6PR04MB6059.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Z/+k1kL3m5Ezi+vw8DoPnzd8eDogu4WAijlP41ExbSzZ0t8Cm2IF87iNX9+u2Xvq1tcGZHsFC+rN1C/58ePiIKOqLm41rqOb2PjWy8wsbIY5LA0xzpJGP8LxAE4FH3AQi0hUVtLQN82QoGZ9gtpgBZCGh53JCaiMmz8sLDS52TJ8ycC08qWl1UJCYfuyjVtIM1icZzmXXWpW8ZGVyqwekZpTtJ38hiaSsQHVNWgojk0MyxkPVqJiKVLWfHMg1s73z3ZnX/AEgCiwiSWxsSRLtJrOEOACdJdZrfJz5jncWktEn2JD3KRggzdiaFPZ0GQGwqItZs3zVHWbkl1ZjWImgRmlGR1vxPR0ebjFvdnU8f7uWLph2qc0U3e19OLxAekAvJS+Ii/HuteW0eRULalX7VNzp4b27Jxys79HESvcnK8= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7afd3fc0-37b8-46df-590e-08d6917cf6bd X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 06:31:59.3520 (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: DM6PR04MB5515 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_223226_412774_2683767A X-CRM114-Status: GOOD ( 14.44 ) 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 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 06:32:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809173 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 C4CC513B4 for ; Wed, 13 Feb 2019 06:32:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B183C2C4A5 for ; Wed, 13 Feb 2019 06:32:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A59F62C4C2; Wed, 13 Feb 2019 06:32:36 +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 506E62C4A5 for ; Wed, 13 Feb 2019 06:32:36 +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=Ugiai6mILmIuW5 5IWw9EM1UV9evPfZa1eXzEeIfX9JiatS4YWQgLEl4qe4RyNyKR3E6yRYDysbtjxS/CGNan2cEUgZE NExCygVS1PZRhkAti8VP52QVnR0fps3VqPuN8i2Sw+7JLOC7K3NVKUFUtMq+D7GwfsfJ2e5eT9RM9 xiDxOBXSnrp1bibNNdDLOeX/Y1f1jtyE/RWR3GfgNsB3qfTS48LfMi0EyJ8IDP+4nHxYq9C/CwEm4 os9jQBbCQSxYYxIZgUCAOnDJ1l91kHHklEujpyF2ZO2noh16ampbA2YGIncFbLxHOqdj2Se/kyA1C Q10UjdB783hg3eQ6EXYg==; 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 1gto5w-0006tg-Nq; Wed, 13 Feb 2019 06:32:32 +0000 Received: from esa6.hgst.iphmx.com ([216.71.154.45]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gto5s-0006lZ-NS for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 06:32:30 +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=1550039549; x=1581575549; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=h25QTCPdlhMfqtz+zmztEhyRxhdRVXagsuYHINwV8lo=; b=Mb7ILi/Fb1wUBBfPwAW4n/7BjTc6rAnVsfZgYEAiq+dewespUvRyzLEB ZbJnuw1ZHbpolp2t2/KTkrcM7X8WLd0kiiMiML8hbxWTKIvBmjSf1bk77 h9TzcPphR8RLFxN/gI/05COmeu+EyLoJvUn0bFTFQ/+KmlFeiQcmIP7fz j9VLZrmTQIXYIDnSv03ujuUzjgEVybEGMhKOSFjrYGF5y0GCpOf90tRNu lDnDWAXi6PGAsPtKc6i1I32Yo4xoltjak0E9BMnwoci3HhOJ+MbyXsnET Xwy3JmuL3p3P85qEkiMYtwbf79utpsrlCHFbej5gSFDqnI2u/IAIgwQOT g==; X-IronPort-AV: E=Sophos;i="5.58,364,1544457600"; d="scan'208";a="102859901" Received: from mail-co1nam05lp2050.outbound.protection.outlook.com (HELO NAM05-CO1-obe.outbound.protection.outlook.com) ([104.47.48.50]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 14:32:25 +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=m/oukO1MXLU7grl9pGZVN8I2FUBamNt5QjLOayGTVm80CiW6ckS6o+UFz6HK0QA6CoBVHj4s11n87w5YrZZWp+Hw02aUWci8Q1NTmwaL1NY0jZZa6O1lJPsr1mGtFrZ5UaqXXVljl8l/UTKimoL5mYQfr1TQ+TxQbzOFc8rJLuY= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5515.namprd04.prod.outlook.com (20.178.224.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.22; Wed, 13 Feb 2019 06:32:07 +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 06:32:07 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v4 2/6] RISC-V: Setup init_mm before parse_early_param() Thread-Topic: [PATCH v4 2/6] RISC-V: Setup init_mm before parse_early_param() Thread-Index: AQHUw2XXY56X4eWHMkuwX0WnD4R8rA== Date: Wed, 13 Feb 2019 06:32:07 +0000 Message-ID: <20190213063127.28703-3-anup.patel@wdc.com> References: <20190213063127.28703-1-anup.patel@wdc.com> In-Reply-To: <20190213063127.28703-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::13) To DM6PR04MB6059.namprd04.prod.outlook.com (2603:10b6:5:129::25) 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: 5ed4c8e0-c26d-4f5a-47ba-08d6917cf972 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:DM6PR04MB5515; x-ms-traffictypediagnostic: DM6PR04MB5515: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5515; 23:zJ0fRm00/9MUwR01jnNrYGUu+B/cpT+BI7OX1VY?= =?iso-8859-1?q?8lhItQ5soJX+sYe?= =?iso-8859-1?q?oBeQ67k/sSDN8fO8M7zGIdsfaOY2/grKKH93tRG/iBrKVsNfGevV+if7j6FS?= =?iso-8859-1?q?grCjzRizNY5KR7we0WT75yiLE82sAPdC61PnNxbb831llYn4cI0ItrE1F79R?= =?iso-8859-1?q?22DzDHxr5Cc148+cRPyomeZ+IJukoBSJo8jBQB1r61J2i8iDRz1JqTCUngEt?= =?iso-8859-1?q?sj5YQlJNaHSiGtw7JESlEEgmLoVSakHp2YRxB8D5F32BsZ1cfQWNmT/FiuH/?= =?iso-8859-1?q?KlglUnDZkP7QwpTsmcubybKSxbzewoh1iibfic+GNFSqbduUgPEc2xH22B9Q?= =?iso-8859-1?q?uxja1nWSZ37qi7XF7vp35vxX9IyDl9ms3ZkkhfBJtkh0s/vQcgajMmVLQTo6?= =?iso-8859-1?q?YwI65plZH02P97h+CB4eaKXD9g8RYN+oAxuO8i6QBSxhJzqAEzCM7QmLzGOW?= =?iso-8859-1?q?G/q60tHloujHMkW5lnwXOaBrdt7llgpYNeejrk5cODbpP5iZYDdyeyQxRPur?= =?iso-8859-1?q?0bf9A6nvCgGMfvRjD4mFfk0e7ksUT3JyJWyYHGnL/1WVY54sGUHG7YIAXXNu?= =?iso-8859-1?q?OvO1lPP47t/+ThWfsz2/mjDj+IMrS4aeIyjWg0qNNMxbREtTC4HN+NyE5fYb?= =?iso-8859-1?q?V4SxW4dyKGTCRps2Ba6OtsZUf+w8EwY/qsUdKkgv701XRQxXsdjvgrp8v9H0?= =?iso-8859-1?q?N+F5JKp+ZMCgPwA83K/CNLfNTWbNIm7NT9dnjKIpu/TWy2MtvKlSL/gzDiPQ?= =?iso-8859-1?q?vGK4tzoPfojga7KtLkW/va1t20jchk0g+K8vxjRYf8EHNELPqAmttsa7idHT?= =?iso-8859-1?q?jDlPnhwfXxwBNUyhvXxjAwTSlo+aMqUfdyaV7yt8wjYKbWouxteNw1QN76hM?= =?iso-8859-1?q?HebIQD0+afIxBsN03vt4QMaufUdQHbozw4+soGnfUcyljli48KNPDrs97xeo?= =?iso-8859-1?q?csluqLuKisAhtgMbOwMq4y3nK6KwRwaIEO+TU3WAtXx15s+7uoPG31IB9AZt?= =?iso-8859-1?q?qgj0Kzuem7N7xF+WOdCcbxKf4jzyXnQVIp730WmoOuv6im+7uonlX6KRyKy0?= =?iso-8859-1?q?9Y0bklYmmqedio6t3uSYKsx2vbk8r5DHG8wV8zPDXeJLRifD+Wqpchbz2uce?= =?iso-8859-1?q?+RP3+72aAeOGPYXmF4GbvD339XnmlwpAyVvrnsKvgkveUMg88K1QLM77Xza7?= =?iso-8859-1?q?dllFhBbOQctUeLlca5i9oGwiw6cO3XT0k9H5j2qR94yLdtEbSJp3+l5ubTMT?= =?iso-8859-1?q?VmcFvAK08fhtuIOlIFCwjEtD2l?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39860400002)(346002)(396003)(376002)(199004)(189003)(1076003)(6512007)(2171002)(478600001)(72206003)(446003)(386003)(6346003)(2616005)(11346002)(102836004)(6506007)(476003)(2906002)(256004)(50226002)(4326008)(97736004)(14454004)(6486002)(110136005)(25786009)(6436002)(68736007)(316002)(44832011)(486006)(99286004)(36756003)(8936002)(186003)(6116002)(106356001)(81156014)(81166006)(8676002)(3846002)(86362001)(26005)(105586002)(71200400001)(71190400001)(66066001)(305945005)(53936002)(52116002)(7736002)(76176011)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5515; H:DM6PR04MB6059.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anup.Patel@wdc.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Z5K61Xf4Kf4a0zlwo1cfGlFQKMyi1Md1daORb9HUwnsHXoHAgf93qvQjf8NqxbITj6DhMzOOZCdbcnvoWXdeOj2WIkpGtkDeWZeGGSa4I53xnupstcNYpBOQq6uycEeQtjR3nzddRtR9tBaX7i2Ia62A2OMA5JqfvJIdSoARi/j2HY/p3OpSLZTC1nr4e3ubKWT8dj0iMLu0tdz6/BQKPPWGs4VMA0hMTexNvEJ3B4GCHccYijVY1flV7qOs+25XI5Hl3fshdCT+Lx+4rJ3g+ttDuIu655f9vcD8no1V8jpT7eKKVgJZ4Unh/jlwgE73CMR0E1CU3eovQLdUzjHxvFPrTF55KoK2rm6nz9koFW66hC2eJdIWOvkdIpb1KEVsNGggMMqv1bcwuUgt+YEPosw0ENGh1zFpM5248R/Ofdk= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ed4c8e0-c26d-4f5a-47ba-08d6917cf972 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 06:32:03.6391 (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: DM6PR04MB5515 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_223228_853588_F73D9195 X-CRM114-Status: GOOD ( 14.04 ) 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 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 06:32:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809163 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 130ED6C2 for ; Wed, 13 Feb 2019 06:32:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F32D72C4A5 for ; Wed, 13 Feb 2019 06:32:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E746B2C4C2; Wed, 13 Feb 2019 06:32:21 +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 6F1092C4A5 for ; Wed, 13 Feb 2019 06:32:21 +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=WEr0RCqQKA5ISh 8LJb4aFUQ5arbjkb0PPVzy/+lm3UUREj7tbwZfIB7VdJeet2XHpOieRlkXYRhS65z89xmbJDjVpM/ sepnJHuFbsUT8zDuV+q98MVgR35nsjFdd4/4+uShnhRH6hyPzuz/DyxM801J5Tu1pAKHqT0GCJzhU IB8PxhlHPjhqktQ5pKZHap+GagUe4ltw10wDvtdsJ65FV5lxLEmRm3VX7M9DhXkcLgwFH8g4qV5tL s16GI1TPyy197oZH1TD3KZ/r7/Fk9uPY6qz/Te+b/Xz5m6EKJRjO8OhG81W5gkFFaMghGTFGQPKIR gkVhiFY9vxlv6cycfNCA==; 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 1gto5i-0006gV-E1; Wed, 13 Feb 2019 06:32:18 +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 1gto5e-0006e9-Bh for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 06:32:16 +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=1550039535; x=1581575535; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=PuUS9APfMCm0201mEnejJ6ms7yQO4HAQocfr3TMtdYE=; b=S60996No+oAGcqtpQcHYRFQR/jNzP8ugPnZTPHDP2aPOcS9/d/9fu0GG +/FCiqveOc2PtxLSCmAFBrbzmgYDl2LcjItkFpcWcADr6hVCHwdEUCvCN GzFyKtGfZPC/eNK1Tylk5Wniud1aAjPMWJAFWY03ULZDhTpJQwWGLaWG4 rUlI4IEuoogfSTo6G1FvxR+l9XKzqQUNtREUqFcGtx6jpXjHf0jvFrJDe J+lGK6pS4ya+wnOT1M9mSx+crm6jrWp46QwOyFyIxO0uoFhQmWv8+WRHU VTjkmhCje5fhLFSOa0veziLLQgVRlml1MdTNhtRV8l8+Mn209PXTlPaxy Q==; X-IronPort-AV: E=Sophos;i="5.58,364,1544457600"; d="scan'208";a="102393223" Received: from mail-by2nam03lp2052.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([104.47.42.52]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 14:32:13 +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=mRyBbgeClFKZMaAfzmgezpm9ltAuAB1EZN16QH+JS6EY7rZ30LESBy2naTn5k8+AwApz4XxId3hIR2S/bC3toBSMVFFAS7+vK1lPvvsCx+XhZrJIYmlwm7GyYldC4S393ebazOx6maR//F6E7CpgqhhIfxnTsLWlTRJKsJV9nzM= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB4699.namprd04.prod.outlook.com (20.176.107.148) 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 06:32:11 +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 06:32:11 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v4 3/6] RISC-V: Move setup_bootmem() to mm/init.c Thread-Topic: [PATCH v4 3/6] RISC-V: Move setup_bootmem() to mm/init.c Thread-Index: AQHUw2XZrm8QKiLFmkqv8lvDo8ck6w== Date: Wed, 13 Feb 2019 06:32:11 +0000 Message-ID: <20190213063127.28703-4-anup.patel@wdc.com> References: <20190213063127.28703-1-anup.patel@wdc.com> In-Reply-To: <20190213063127.28703-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::13) 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: 4e0fa01b-180d-4672-d2c6-08d6917cfc27 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:DM6PR04MB4699; x-ms-traffictypediagnostic: DM6PR04MB4699: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB4699; 23:fnJhzMLhrXrQc7zpp7Xg5hoTV56tpWwEho9KkaX?= =?iso-8859-1?q?20r865SFxrqL/Jn?= =?iso-8859-1?q?91VDcx1XHvGGkKxKgMxKKVZ15trDmDPzrgNVmhdR6MCAx8NUULdAqSJxyk/q?= =?iso-8859-1?q?f7aARvXLfTMmhdG5gV0B87P/qjc2RjiyIbuR+T2r4e050UZv3e+S7cKmo1Dt?= =?iso-8859-1?q?UWaRceDhEfFot2MFV6hpWyaNc6+3k/gg2IE6rr9JL7L58WtXL+6LF8EYHM/7?= =?iso-8859-1?q?igkKB06QnmipUU2Lct+HpZQXhxSHz+AcEpxm3xhawQUOEEP0gvFxyktz9Akv?= =?iso-8859-1?q?PZ5ZBs4RIz9tuAbM+vJgkSCJueLhAevY8Uyy8fQID1bDOY2YWhj6mWjikH4y?= =?iso-8859-1?q?IZKekOKSE76zohMwTHzVBgr0FaN/m1EWl/2TwfMSEQM/r9ILAdSl5ASVPhpW?= =?iso-8859-1?q?6QT4o9M7qBzqptXipoaEWqz0BYlsg0mMaw6hBf4kSRzTicHMTs1rcBEinqXZ?= =?iso-8859-1?q?Ral3v2jzVPLgDcbRVIpZaLmduMVNPdKU1IIsD+qFDZSsMJpdDKJJewyKRAnV?= =?iso-8859-1?q?fZ7/VtKigzj35vgPL5/KT9pQ2AW7uM7MNAdjYxSV0zok9hw58a5ySp/NC1fJ?= =?iso-8859-1?q?KFUUDP32sPNKygzTEfCYMfVkW4MUavSU6u1hkvp2TeCK+nAF2+hfv4vhfduL?= =?iso-8859-1?q?ZlzI4Av29Fj3GZAKoIB6xv8jtLfifj5woPq6Yq/R4w/YthkN8gg5OEgmyIBw?= =?iso-8859-1?q?hA0JJD2IZAPtXqH5RpCnDz7lbRpScEkcA5Jl4bk4n1J6PiJXK34xH8Xy4wsx?= =?iso-8859-1?q?EM/ANADvpYYK6/c6N84IhmxHQcbDmUcrSkhSctE6iCZHsCsqM3t5Z4gFkfEg?= =?iso-8859-1?q?WHkHLKckB1Hs5YEtIRRZAVYentBQMkxor80rEZLfAxXyDDHrtuPFsCS/KthJ?= =?iso-8859-1?q?kaeeuE233NiMnTHVb6uZHqPGJxMkf9xkSjM/N8NC9nU0W/P3yhu7tIMDRg9b?= =?iso-8859-1?q?cDwxcezpVj9eOiZcpe8S1vA1ujeRMFYbh77B/IWcnGeIlL4lF/DkYJcAqh6c?= =?iso-8859-1?q?B/gqZ0mi/1Q4Jv9/F2rQYUqDbw7WE1jn5FfxJLBo6/iJxYAZcyqRi2oHznUw?= =?iso-8859-1?q?U0S45ZZC0cyzKZht9BMNH8KNINuKJLuuot3xpNfNJATBnVA5ALb6F3g/U+oN?= =?iso-8859-1?q?0SOHH8s5aDn4IM34XH3C9PTdKVrJliBFUkXTsPTMlOfgEVJAmdcNiv8fa53a?= =?iso-8859-1?q?1v5R37Wejmew/Xr0764nTz/cxqPfd8s6J0gmWBPMcmSIkGfUlwzySrAc2189?= =?iso-8859-1?q?NkDvI=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(346002)(396003)(136003)(39860400002)(189003)(199004)(72206003)(446003)(106356001)(478600001)(6486002)(36756003)(6512007)(25786009)(11346002)(476003)(99286004)(6116002)(2616005)(4326008)(66066001)(102836004)(3846002)(486006)(386003)(76176011)(6436002)(6506007)(52116002)(105586002)(14454004)(2906002)(8676002)(26005)(1076003)(53936002)(71190400001)(256004)(50226002)(97736004)(68736007)(316002)(81166006)(81156014)(110136005)(8936002)(86362001)(54906003)(44832011)(2171002)(186003)(7736002)(71200400001)(305945005); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB4699; H:DM6PR04MB6059.namprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: R3mIPPmE+eo+KUaSqH7gpYmpN+cu/fDV2oRg/cuJqNmRwg/YZWjO67Et/eQgCG51beNw3W5LfHYKndYutZtqyRfCs9g6oxJVfgPdScldNGJfpAe/bNp6WAeHqviK859Py7VIaWAWluBA8Ej9ihQpnwAx1phRnEn9y78oMYuwCAtLyUY4P2QSrOhuhDuHPPvKj66O6kza/599DzWlBLLYhBcLlVEYJf0Hnr3Gdd2ffNgciJMS6pIhpgyV2GFUobsbOGkyVELb7lpcf1FlUPGdLpCszCeo/uEUDWpKghxy1MnfWcGpMx5AxjqGtedxTrR/eofhRdewMZLhfLKPO9vemxF0ZIWNYs3lina8obi7zu1S1DkJ9yTmQRfabbyTrASAIo/jqfGMoJGTGzoJkL8qbAmq24dWsJ5xm+G4rRn+VlU= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e0fa01b-180d-4672-d2c6-08d6917cfc27 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 06:32:08.4234 (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: DM6PR04MB4699 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_223214_510879_4C06AD5B X-CRM114-Status: GOOD ( 17.83 ) 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 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 06:32:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809165 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 4462813B4 for ; Wed, 13 Feb 2019 06:32:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30CB72C4A5 for ; Wed, 13 Feb 2019 06:32:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2427B2C4C2; Wed, 13 Feb 2019 06:32:26 +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 997772C4A5 for ; Wed, 13 Feb 2019 06:32:25 +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=FUQmP2cC69dUvN qj9ezai1qkvaMxMPeyCNnpWxbd9kqtfXq3wt+AoknO0WUvEobip8yI098JjIpDx4Pqe2EDkbot1aG n40BQYoRhBHEPY1+ftD1ruz2IXz716Bw8eaO9MuGEoaCVd9cwaPWVXR1ILf21mKuFc6P4LnKxQ5TS xCo1pcTz09rvdYl8nxap83F53UoKjhXVYtaylnFU2Q/thw5X9+Dz7SX1PGPyRX0MVdDRHLod/0Tl6 GyPKG11++wr3raK2cgtR4bZMkEGYtc8p0e0daEzAiY6uKxQoQ2M4AI0mRySYjEpG8Kyfts0g8ZgXX O5xwvcmB9UO1ZSq/p0Mw==; 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 1gto5n-0006kO-7s; Wed, 13 Feb 2019 06:32:23 +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 1gto5k-0006hR-Cz for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 06:32: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=1550039540; x=1581575540; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=7AOlzjSj/WH9jMA4KAlBpIw3dgu/3amnrTdBqVuJ7o4=; b=ZRlAiTiu7hlqS1gFcqgC41q/H6bL0SHRQCGzZzwhHnHtFfxUAL2XkUEn 2dV4gE8VeLSbmjgEcsjlYJNowG3dyw9FgXeQ2621Vn6lHL0c9LkkrxY33 kpG4thPICinHP8z8mTNlqRGdRCptm9i8/VMPavbMtI1M4RZJEsfsmJAoH MZEX3WuKZgFaXnFLK5Ry/V/4FY/uvs/uKRCzyzeRqioRUbELbT4Qsripz aETmbB6ycDLPZph5TzyqYTCfIg8DKTRjQa/hqiwli7RSmwkEQqIy+/J3s 8XL4I7zwANxI+qL/hAj13XudS8hFNO2Pbl5SzFL81bV/JYmKfQWidDzmG Q==; X-IronPort-AV: E=Sophos;i="5.58,364,1544457600"; d="scan'208";a="206244724" Received: from mail-by2nam03lp2056.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([104.47.42.56]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 14:32:16 +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=ZQdsTTYcbpj7fOnE/WJMpE0QQynJAqo5xMIoHJl3prcE3f4EQWNUPAY2NmsiNk6KljuW+YzENcVmnZRwe7zL/C+QBKeDAkIpfSOoHbVWfo5MQt+W9lQvEdnp43a7/DOCawBsX2/ClrEyzWq/kcdLvb+xgIKY6DloVWkvPYEBz/A= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5628.namprd04.prod.outlook.com (20.179.51.151) 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 06:32:15 +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 06:32:15 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v4 4/6] RISC-V: Move setup_vm() to mm/init.c Thread-Topic: [PATCH v4 4/6] RISC-V: Move setup_vm() to mm/init.c Thread-Index: AQHUw2XcDqJ7FZsjdUi9mP3ngbpFlg== Date: Wed, 13 Feb 2019 06:32:15 +0000 Message-ID: <20190213063127.28703-5-anup.patel@wdc.com> References: <20190213063127.28703-1-anup.patel@wdc.com> In-Reply-To: <20190213063127.28703-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::13) 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: cec771fe-7800-487e-244c-08d6917cfec8 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:DM6PR04MB5628; x-ms-traffictypediagnostic: DM6PR04MB5628: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5628; 23:Q0n3F3Ns7FXXTvdCDLS85Jy9y3kBLF9yFpVr72p?= =?iso-8859-1?q?RXR+KLowKg+mZlH?= =?iso-8859-1?q?LxJBr0nNXMLuJ2IjsLkYlgf+BO1d16pZNVGFRicyEuVgRD2O0jCD4zqMXH1U?= =?iso-8859-1?q?ZIaJz4ysntPzcGqrIIKgfQ7YhGlYIB3E6arbroazw7Tw1phqeuzBzMW2jAyM?= =?iso-8859-1?q?unVCchOyugiTpND//sjs335hfpa1x5f79B1e5WPrAhIJB8rmyXn55SJ+0X3f?= =?iso-8859-1?q?nDisTXXHKLPWXYpSSNrTDHDRn1miLJmFujBIZer6c0MPm4fsbdPLY/KMcU1J?= =?iso-8859-1?q?RsyeXQSk9DtCBzX9lksPOE6aiNpWwkMF7kMkfJwCqtEEY0di155/1gzf5zGn?= =?iso-8859-1?q?/KIKLX6d9qDQrINgqgS6dyHsuIEbeG527nkkAhVaNttsYl3znjDHHi0Cn8do?= =?iso-8859-1?q?5rLqsNYbQ4WF9jOPmI2PnOPw4fyRfl0CYw7OD2ot2A+c/lBDsk2AVVPFFYDd?= =?iso-8859-1?q?1YU7uqHoVKdh0ZQEZhkfn+jb2+SvQYqza5AB78fwXrecil3O5fZVmCgLmgkR?= =?iso-8859-1?q?Kjl58xVGLmAP55xwTgU6ocRxRRcFQplqmXAdkzqMbwWgIRb2Z54pw/ANlvYe?= =?iso-8859-1?q?ccA2qwJQG/SHe7uipL5pnw8K+VyKxU3dJmmn+bbbuIgt66phMlUSuBqU8s1I?= =?iso-8859-1?q?eDxswPUN+pt3QpxTOcm3kJzEwcqdnUAAF6vY/ogeinei77Xvjd3S3kT0KxWp?= =?iso-8859-1?q?D4mNd89K6rU0sbTqxKBxlKWsLUmUM3vc4I/NLeEZn/snzw6K0nowGVLYM7Kd?= =?iso-8859-1?q?Nj0LTUbc3PCdbJOTisa+mDQgpbS8Nn0jG5kUYhm7vND2AP4614m13WBOBR4M?= =?iso-8859-1?q?bX21G+YMJoeJZpzDnbv5FAE4YDtzsE0ORf+1IqyPzy1H8gEApxVlObWhw23P?= =?iso-8859-1?q?lwfMtQhozHcB5s9FQsvo5F30lG+kjnah7fyWlJ1imNgsMfXRnq6NlcoLrY4J?= =?iso-8859-1?q?9K1G+2oJvPNV5h87/0EMgt36TgiHPQs7dA4wXYIaBPxwsavIuz87NffkX8Qp?= =?iso-8859-1?q?3tG1G+R9pxgZsDize4AdNlLY2Eu2GNfjvw+AooiaEDjuIaH8UOb8PKPD8+39?= =?iso-8859-1?q?dPuRgVzRwyY1Rbn6btj8wOAKWNFiYh/6fnOTBssPZNB05WzHnRTaM9Fsx5r4?= =?iso-8859-1?q?2kM91DxeXtqnj993kxyBU+iHJgjG6rUVpyqw7hLQZ2fa00K8jmzbmAaAGmuy?= =?iso-8859-1?q?bqBq/6rw7YSnen/vl2cpvmkGoZL1G03QeR0aJbI3ltrYSGJI4z4c7tcrJdyd?= =?iso-8859-1?q?fo6VQ=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(376002)(136003)(39860400002)(366004)(199004)(189003)(14454004)(478600001)(4326008)(106356001)(97736004)(86362001)(50226002)(66066001)(102836004)(2906002)(6436002)(256004)(6512007)(105586002)(72206003)(25786009)(26005)(53936002)(6486002)(36756003)(316002)(186003)(8676002)(7736002)(81166006)(81156014)(8936002)(110136005)(54906003)(11346002)(2616005)(6116002)(71200400001)(3846002)(71190400001)(68736007)(2171002)(52116002)(76176011)(6506007)(386003)(99286004)(1076003)(305945005)(476003)(44832011)(486006)(446003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5628; 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: s4CciL6aitM+8GTm3MGsU/LcXMrp89YSZffXLgTS7jErRxkaVny4Egbwd/5XUn/PK3mto6Oi445sDDPbmJ6ESc+m0QTOsbRo72G7NmAgGXpI19KfIUrf5Iytgt6mubvdlDmUkeKNik8NYMUA6EhZ06YjzfyM6B7DWXdFj9q+1kE3Xb0uFO51+x7k5gqOfCd6RKgmfFEsu8Jzc2yray/ZzCHFbm43CIq2s/NDxPwPs1c8g7BaOh9qgBg9N55fKuzzmVH6udJipZR7ohP8MDV68vbmdcyfWq3uNgAWdFLYx2lNQ5kDh7Wsmxvq4znIBjy1qZybwkowEW3KJr8cPCMAIzPFguOkiCOSaj7qkACllcQWJdFfu6+J/7eM/gcjZFxb+zg4l82Mk5ntKbL/tiEuKyB9Iict6yI2ajmnxFL/XWU= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: cec771fe-7800-487e-244c-08d6917cfec8 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 06:32:12.5674 (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: DM6PR04MB5628 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_223220_600701_01AE8907 X-CRM114-Status: GOOD ( 14.57 ) 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 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 06:32:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809167 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 9864713B4 for ; Wed, 13 Feb 2019 06:32:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84D272C4A5 for ; Wed, 13 Feb 2019 06:32:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 792412C4C2; Wed, 13 Feb 2019 06:32:28 +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 E766D2C4A5 for ; Wed, 13 Feb 2019 06:32:27 +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=a0tGAG0PsBcekm O7yC4v2xh4Ihv1LseClRZ14P1bCNvbta4LIohNFpTaR1oPu3/X2MEyXp4y6TWdv8LOlq6Vxd765nm 9sFuPwz/Kb8b/pxmrpH97aT98zeu/PPg5xXCoaHHy6tnPHxKnDY3l4tINKkFjT0SN1I8mGnYjuaZm iPBJ0fp12OjXBGkEQ1Gxsasca2ut49kIlV8WL4HbYN3X0U0+Bi5/0q9/uo73/bkYBSs/Qh4bL7YlD OuMZaSBb/E4aS1QhRTiAR+M1d+A2NnJJpKqAgzgRiaw+2jUzSiinubqTMN36xMdyZQD4X6xbSzuna fzWVpS/lNGJQ9qtFX44Q==; 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 1gto5p-0006mK-Rv; Wed, 13 Feb 2019 06:32:25 +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 1gto5m-0006jI-7N for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 06:32:24 +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=1550039542; x=1581575542; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ubekwtYIPFFf005R5Hzs4jmv+czpJXwjEd3zgesqrRw=; b=p71PBOxuf4Atvj9Zro10flq+4kXX+vaELX803pMs398drhOROy+OSf0N O1xcJcBi3Ag2hNZISYdNJO0S9anSmxJLLB0p+LzMtYisT7jZQI+mzw1+B 9oyxmdiNiLB4Nbwou0E1/5TublNakp9rh7Rd9f5P9LhE003rXgtdlz36g qprGN/9DVrjK4bgzYr1c6Gqmh348LdESEyTl0V0PtHJ81qjsDRr5iH0g8 YuDsxG7B8a00mY+brE/ddrxz7HR6EO1BfcQw+gypcOzjT5h06RMYYKckE E/Lvrqv/R/OTpBcUa2CHKrlVfO+NQNBvEX0/w9s0m+7sJjiRyKlp8fGXS w==; X-IronPort-AV: E=Sophos;i="5.58,364,1544457600"; d="scan'208";a="206244733" Received: from mail-by2nam03lp2052.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([104.47.42.52]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 14:32: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=DcBwDJJXFu1PqOJGPFzp6HBUM2mAFRKjvzARIRyaD18=; b=JFYc6HsXYXNEBl/moUVoR+J8llnlCMryjDmgpUmyRUQNwwVAxmxBcZO7D53ExPLfQr3TdeqCA5ci86KVBCaBf4dAq+kXb4d7Lcz30DJC8FjuwUILbwUM22sM2nfplcoLcqjr1tlRfyJFrIMoqPqIuvPg0gk5nzUWmgQM9So6fsM= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5628.namprd04.prod.outlook.com (20.179.51.151) 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 06:32:20 +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 06:32:20 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v4 5/6] RISC-V: Implement compile-time fixed mappings Thread-Topic: [PATCH v4 5/6] RISC-V: Implement compile-time fixed mappings Thread-Index: AQHUw2XecMjWZazmUk+dH5VlOX50xA== Date: Wed, 13 Feb 2019 06:32:20 +0000 Message-ID: <20190213063127.28703-6-anup.patel@wdc.com> References: <20190213063127.28703-1-anup.patel@wdc.com> In-Reply-To: <20190213063127.28703-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::13) 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: 538d74a1-d08b-43ab-504e-08d6917d015d 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:DM6PR04MB5628; x-ms-traffictypediagnostic: DM6PR04MB5628: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5628; 23:L5tgIxZi1VR8CfyL5RitznuH++vYuEE7MWnUTgL?= =?iso-8859-1?q?ZT91xsfkec7ZDDY?= =?iso-8859-1?q?Gw99pPdtknnkr3PT1M9UFnyaygf0/R5f/06yWs72VJ3oCFUPPMn+11I0tTUw?= =?iso-8859-1?q?8GlOiRGtlRwgyf1juEEv7BEwgEk7gp7+M97kHdv7AFrgSq3PwPdpIj13sgud?= =?iso-8859-1?q?6eBUgcw0ABfDR2HuAMcLnQlL1n+NBuYy/JXLDl1ZpsDRSVqpVWDKL8/81umG?= =?iso-8859-1?q?fG1MoWNCjV8ngxO++ckhMmV9kp2uXSv51ge4eGAS+sgS283B8fHxhAYeGXme?= =?iso-8859-1?q?krrIsAtKE3xgR/8bPqmajunLOTiK0AV6hpwlNwlSAyVKI7Xh8QWMBYxh8889?= =?iso-8859-1?q?+ivw5wpIyTbkPZRJ75W5ozsho/QlELHRp7jRFeXyA5fEh1/Y/5KbbcBtVOCG?= =?iso-8859-1?q?qsPtGZga7UO2khB7xOBQnL+G3tHf1C1ZK3eBgqSlWGuSJ7dykW8lB0nqalL/?= =?iso-8859-1?q?AHgWJ80C/ucLsc3gijNKQjRN/6Z1zJBf7a9TMYILCuhqL36QvGbuS8w5vvuY?= =?iso-8859-1?q?lDfy26JnWpqGyCJZGRtWmkDBZi7v4a+IQYJc+jS2nK9IXkNgk07BficGf8io?= =?iso-8859-1?q?UILBQMR63E35QkaW7YnHYp5JE7aJhp7rVizuKdgtIVTqw9Gb4sx/sErvHziu?= =?iso-8859-1?q?bHsXzaH8V87HtESzPK+VnxA4sJhzSd0f9a2Q9bvR/M6ksMoql9S/D8l9Jxt1?= =?iso-8859-1?q?P6441vW+ooTK2yQQY/4CZFoR7knz9749MQUKzq8hza+D09q2Xb4QwrbKLl+x?= =?iso-8859-1?q?hfMqReUsFsEp6fUKTZgHv9YqznemOo04P9hdQAiTVAWm5G4hbEXOAhp28PhY?= =?iso-8859-1?q?gxzFS36LgamcEAtdCXreWYBS6pqat80St56BsT2VgvU5VUCljrCSOiYOh9gB?= =?iso-8859-1?q?Mol0KwzsG5t2XXWMlCenVlt+D+UzSFibNYgFIGVDnQexfuxrU39583E3oj+c?= =?iso-8859-1?q?Lwh553Efk+zeJF7JsVYooUuBJIhNNld6IOuCrdVVAwcKN4uz4cv5CoerMRWv?= =?iso-8859-1?q?17aQfvqhlCd5fLH/Akp7WWJ62zbafR/jMKy6BkGwrDeK34OTDJtvtLsLlZ6F?= =?iso-8859-1?q?KqqanGEh3JD64aHtdo4FUt/+ECMbBUIr+cc0nwxWyLpaIZk/D92+JuScx8oD?= =?iso-8859-1?q?tAIHP/S2IBBadC5fyf5RIjyrZJnwdlTVS2cFPVJ6k2SDJuTSfuSr8MnJdHNl?= =?iso-8859-1?q?0s24XOrP1uR7KbHTiH5Pn+V+K5ESP2dE9lbMcWB08OP3O5ZRSz680UBw7CzR?= =?iso-8859-1?q?UekjY=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(376002)(136003)(39860400002)(366004)(199004)(189003)(14454004)(478600001)(4326008)(106356001)(97736004)(86362001)(50226002)(66066001)(102836004)(2906002)(6436002)(256004)(6512007)(105586002)(72206003)(25786009)(26005)(53936002)(6486002)(36756003)(316002)(186003)(8676002)(7736002)(81166006)(81156014)(8936002)(110136005)(54906003)(11346002)(2616005)(6116002)(71200400001)(3846002)(71190400001)(68736007)(2171002)(52116002)(76176011)(6506007)(386003)(99286004)(1076003)(305945005)(476003)(44832011)(486006)(446003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5628; 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: 8+dIr9jd1nTP8wmIhWxAlycNIPQ+YXuEbA8kTjTZgSvPDQ9hL3CnCr/unkdZyz3aoxx7aJud2miY2ffVF7MVbKyetjEPlZOgbkJycAAohjuTdLtU7cebdhMXshX0vYJ7k9T/15fV7VNT8PLvy9/9VGCYjvrlWcUXsLHbPu3xvmzg0RAgFRwf86er9LojxvkYXEbToiOq+q73XbDhPQFddd9AOFjE4JSsI+KDs6SBA0H22H5jG7koy5wlEH/95gyE43lUbldBUg/OgVMfeXw7eBI/E9/KMIa527f47R0VgDj2oK+8JNokC3UklZBrORW3JMYSXuMzdorRl0WoBL89/EH/RPPZx/yG385MONGsXRTMHchlK03VTwg4AIpfTtWqfwc3bwR0/wyFA0v6SJQi/KC+w2k+lxiHX4dwE5HRByI= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 538d74a1-d08b-43ab-504e-08d6917d015d X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 06:32:17.1606 (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: DM6PR04MB5628 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_223222_383643_60A531C2 X-CRM114-Status: GOOD ( 19.04 ) 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 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 06:32:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809169 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 018F96C2 for ; Wed, 13 Feb 2019 06:32:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D572C4A5 for ; Wed, 13 Feb 2019 06:32:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5B452C4C2; Wed, 13 Feb 2019 06:32:32 +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 7995B2C4A5 for ; Wed, 13 Feb 2019 06:32:32 +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=nHW/ChMrAb9sSRrBQ23dQndw3oHTfjKpM5/pS8WbsCs=; b=D1RgXTvsWPmt1V RMr16fNILyxSQP//C3XrAePmHbjf9t7APdzYAVX+64Qy8OSFIKakGZ9oK3PZ8V24nwbNPus6atlKG b8/vH6VhI/jbRD8vNZNo5rlVw9vDObSmGAS7Be7csy8nlFGqTqumoRi0v7fbnHug3IRk7c0aKRPDw exI2UtUKoEHHqLL+pCBbn2H6wq+5cHFUPvkjf9WOaIi2tj2ZKPQZmbd2gCA8cG4VWQA8C6ch1DzN+ ybjqvKEqlH5+zIpkzi+D3Er0mO8X/dZs4bPCNLW/FK1UfUYxEWbMZdVqxLGOAb5/DQUxaerX0DtAS WZcsjvURG/Ohz9aAwt5Q==; 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 1gto5t-0006qY-QU; Wed, 13 Feb 2019 06:32:29 +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 1gto5q-0006mI-6w for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 06:32:28 +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=1550039546; x=1581575546; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=VGSTh2Ic6u1arTIsot2MkHbC7XHLwGF1acoeESpQzbQ=; b=Dx2drwZ4TFtsRJQ8zJXlrXKT5fWYPbxqkQh1y/5hlQst9kCCZBNca6I6 Yzc/itK2FnkeNZQHIqsKkr7YW1wN+agCBX4lWAc5c3EQfr72hRfNtG/XB 30okRa74JC72YDdJO3kgdD7mlN53/HSSpQaIQLqZJeGS6HRG6AWt9NK9A bdsnV0zB7k9Fh3f4Rx0NmOVv5nCLZX6K2A5PgOwUbynPIY6UQvNE4uJvn TQtFRNNzhFyP8u0yyRlJBUQY55KtAvZhygB4MogbWM3xORI3AdCYU5VXN wxvxiYKraqRx26QVyzeZ86zmmEk1WhJMYmier28/PCPxcPhGSMnfFJhDX A==; X-IronPort-AV: E=Sophos;i="5.58,364,1544457600"; d="scan'208";a="206244739" Received: from mail-by2nam03lp2059.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) ([104.47.42.59]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 14:32:25 +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=N+0AVyeEHd1iUHRkPUD6vRsiNWlv2R9o902vTqIBfs0=; b=hshCeRMUfED75B40rkwk3cj7ye4rWUVrvKdr1BzJQMJhNKJFOxAnkeXEvX8pbEfz5dSbd9FKwj7kez5oOYdxxcBojB0+AdoiCQixMcSe8oeZJb6zYzVlVFnUxkO6zqbvLpMjrPPp5P9zuUxwysaBqjSrggK2Xb8FgTNv1aYMUbE= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB5628.namprd04.prod.outlook.com (20.179.51.151) 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 06:32:24 +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 06:32:24 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v4 6/6] RISC-V: Free-up initrd in free_initrd_mem() Thread-Topic: [PATCH v4 6/6] RISC-V: Free-up initrd in free_initrd_mem() Thread-Index: AQHUw2XhneCVLsk8fkmL4zO8eU0wjg== Date: Wed, 13 Feb 2019 06:32:24 +0000 Message-ID: <20190213063127.28703-7-anup.patel@wdc.com> References: <20190213063127.28703-1-anup.patel@wdc.com> In-Reply-To: <20190213063127.28703-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::13) 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: c4a4d949-0354-4ba6-aa2d-08d6917d03da 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:DM6PR04MB5628; x-ms-traffictypediagnostic: DM6PR04MB5628: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB5628; 23:jIBM9UNBTMzLGYMG/O1KmV5JJLWKYMUXVEzs8/o?= =?iso-8859-1?q?wRXaXeL62cwJgu3?= =?iso-8859-1?q?JaoXfEVe/8AkirCuknz4C22ERxhgHL5LSK4pzsYPSCdgwoJEic2gMytAerdH?= =?iso-8859-1?q?7VUIyVKfLm3eEH/mtJC7ch1jiyKIBwwzoqHJtv8HhELXi+r3X27Hdlq6fc7g?= =?iso-8859-1?q?UQ0Yevw4oMzuWK0hCQa15I//67Y/siyZMLckINoc0PhSCy/jrODCkJL1uVjz?= =?iso-8859-1?q?5pEQYAqlvngBTOZtFNg0aHsYBX25Qc5iv0EEYcsgM8ND3cQouc7nI9TuM1W+?= =?iso-8859-1?q?OFfvvZ1N0y2j/0kvWGoKCWfDcDEecFlO2cfMOpGHvkqQbvIRI8mLCUKwDmqB?= =?iso-8859-1?q?snuMGnp056TmH7Fm12M1dRHn4G68a7dm/p0MK98c3e9jJ97oHcIg/uSF/Mic?= =?iso-8859-1?q?lnNzV0WA7cErHSAEskOLEYm6ajjRfxst8r1CWAR99f0TR4F4jbxTertRWxzO?= =?iso-8859-1?q?mjwHcEY/S3KZzzHtKJbHdGdVflPCMnivUsEdcabVXDGDnBEHrVUj3WhY/qI1?= =?iso-8859-1?q?ScxFPCPKNZ/ZbSZuvpbCtzsO+aCWPEQRd0ZfResT8TTtOwKzJCFeaXWHCi7M?= =?iso-8859-1?q?V8mqEWH0lSpQmWVGRwoSS1whQIHYPF+Fl9da6tR2VlEmDj87OkOEkiQ3H0dz?= =?iso-8859-1?q?uOlvPnTbLfMagWaWET5XX0wtF5FWDi+axlNflyAHKS82fSX//38C1Wn9cVx5?= =?iso-8859-1?q?9BhR5rc0GEKvQjbj1LzDqcM9D7H1RkjFHMRNLb//4nQ/IkKfgNfOQ/2BhTpk?= =?iso-8859-1?q?uLPpcpMHLqbFGWn9fG4mfqbFRXolZ3j8q9PitTVaNvkSIZkhRPaN64XUMBSB?= =?iso-8859-1?q?xgoaF5L0lGo+78e5VFwMif8kfADwqNdLQuAd/HJeZL2dSN/jNTuarWG9A5t+?= =?iso-8859-1?q?+xMdjgcHvsdhMN9Nf090g9nw4OUpShY+tByBVR6S0FPRnqF6GPmJag5Cvc1R?= =?iso-8859-1?q?tNLfamJb8R4GC1Kdz9LH412h8jtPXUOunzRmFxrrnZeEa4eKip7y7pMS86Di?= =?iso-8859-1?q?XFG4eJer0CsyanOfZxO40BzfCwNkB5hHmB74+tJqWz2feNCg8dcHnhjgUBCD?= =?iso-8859-1?q?PghBAfnKX2BvG82IxZtpvi8UFdPpUlzy1Y9xLIAKOLymShlF14/3vBN1VvvQ?= =?iso-8859-1?q?DOqeax7RTeBKEIIXCxo8quky519KFAcRMM4ZvNoCDytTPqn8EARGl3RzXkgb?= =?iso-8859-1?q?1S48ZoGqKAvtu5Do4djcvFz34PbmYGi+9IUUBZi6zskyVCTxtzg+blmcGHHr?= =?iso-8859-1?q?SJMfvz712i4NGkgnFK3hOBJhle?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(376002)(136003)(39860400002)(366004)(199004)(189003)(14454004)(478600001)(4326008)(106356001)(97736004)(86362001)(50226002)(66066001)(102836004)(2906002)(6436002)(256004)(14444005)(6512007)(105586002)(72206003)(25786009)(26005)(53936002)(6486002)(36756003)(4744005)(316002)(186003)(8676002)(7736002)(81166006)(81156014)(8936002)(110136005)(54906003)(11346002)(2616005)(6116002)(71200400001)(3846002)(71190400001)(68736007)(2171002)(52116002)(76176011)(6506007)(386003)(99286004)(1076003)(305945005)(476003)(44832011)(486006)(446003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB5628; 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: w/SxbdvuIYHo0lN9hTcaTjqsfQU8IJ7l4xNMO1lRUTs3sizL21jq2vLFXnDg27Y6woOnkiBIx92EfKWgW1wlSey4jtlY2ofcpFXops/AevFtQfaWGH6VP6sdbltXgvfFYQsDHp2yq6DNaAW79j4Z2Sl2627Y7LJfbIl/GYGnZn5mGyolAq2uklRQKnrgjB+MZrQNm2CJqHus2TxIAHHXQwiKcGn0oUMsO2nG00ZAnbaAWN2IadEmvLVsACgjHoVwR+66jviYwlb/zGlJx2N6HbqXZWAaH4aPgRxENg0QD1XKUJ6+yHV9PoDyJfiYALKsC8NIQp9o0VIG1+5a4jdK/I6bkG2bBJmyQ7N9sl1VivqPqB8ErhpsNzdQJG/unVgGmj4H8XZEgEoCBFmqTIr/YtKwezwH5VPoXtv9e2x7i1A= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4a4d949-0354-4ba6-aa2d-08d6917d03da X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 06:32:21.3546 (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: DM6PR04MB5628 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190212_223226_602676_7DF6863E X-CRM114-Status: GOOD ( 14.18 ) 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 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..c22b873de856 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) { + memblock_free(__pa(start), end - start); } #endif /* CONFIG_BLK_DEV_INITRD */