From patchwork Wed Feb 13 11:53:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809655 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 0FA3614E1 for ; Wed, 13 Feb 2019 11:54:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 140ED2964E for ; Wed, 13 Feb 2019 11:53:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07E0629753; Wed, 13 Feb 2019 11:53:59 +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 3F5092964E for ; Wed, 13 Feb 2019 11:53:57 +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=e7LuT+zi1cmxq8q7+C8KvqzZf1wT1xq8PcP5wDAQ/KI=; b=VvWPtb4rn2ArMJ egOg+pVigCghvyejrYzpNO4z+yxm6Z20/WdQ6her2dctGolFJf6gNwX+5ai58HWqz66lejvZr3QjC P+VXsqU0ct+OR+VyljicwsPs9Y6F33dm5zJdWffzzwhUNZyXwrcaQPZ547Av73O0z/m6q18bA3DD3 zFuT2tjGWIyleebgJFfBXR/EvflmRlcv51bpXkrNonaKKr8xYt3sk/tzLDrljN3OB3pkoUQSCuIO6 cOnhjsGQhMlhXEpZ5j3D5OhS0ONjvJqe/5nkgcS+/nWK8+giV+36gRcrysx/4ToGwnfpGvREiEmBe u7I7GiSDhZzD7g3H9n4A==; 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 1gtt6w-0007gn-O0; Wed, 13 Feb 2019 11:53:54 +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 1gtt6j-0007Mt-Cy for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 11:53:43 +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=1550058821; x=1581594821; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=BugnXiiHSquLMITdS4N4nCW3CaOWl+ENENqHgGEP1co=; b=p9ay4t05ZxS+Wf7TuRPjOMe2CuZobhgo6BHYBExmkXGUDlrRKnVDuKtB 0930cVc1UBUnH5LW3KstEvghvPjGcNn5S9aMAPA1+zdjSW7HLTfW1EhUI 7y8iSR3Syeu6LVjnBnjj7K7T4jpDlg6yfhIl/keNzYdOHIvPGvvvmLzS5 t0ot1JzwYSyvjTErUBriTKhVSqoRyKpg8ZoKncdVz+0ocUVKxi643mGco po2nImDXAQBrPKxh4e2yNwl+noton1++BJDhoe6yErF/4TNIS3RlI094q Blj6xBPlmSP+XnfNUGGsrqYmjPo+PKvXyB3oWMvnDJ88QpbNDnC1HSQNS w==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="102883425" Received: from mail-dm3nam03lp2055.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([104.47.41.55]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 19:53: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=Iavg7vVy3aEZO2x3AbiPR7yXfQqOvTeZkm7ohvI5WJE=; b=UQxrw5r01V6QuEdNylW4UOd5L1+wYddnRTFTuMQ9RilBFcCso7+udgYF5dty5svPMtidd3q4R2jmEW9oYb78Hev5voSXPuD2DOe9TFZsH2b7tHO2VMYSBn0h5F+Zc+C1NceX6leQcpvLulnEvgp1m3fw7v/VRhZ+NhDOFSxHvm4= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB6171.namprd04.prod.outlook.com (20.178.227.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19; Wed, 13 Feb 2019 11:53: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 11:53:33 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v6 1/5] RISC-V: Setup init_mm before parse_early_param() Thread-Topic: [PATCH v6 1/5] RISC-V: Setup init_mm before parse_early_param() Thread-Index: AQHUw5K+eETtQHy410+MMjhdKr9Y1w== Date: Wed, 13 Feb 2019 11:53:33 +0000 Message-ID: <20190213115301.103989-2-anup.patel@wdc.com> References: <20190213115301.103989-1-anup.patel@wdc.com> In-Reply-To: <20190213115301.103989-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0007.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::17) 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: [49.207.52.22] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2462f792-35fc-451b-f688-08d691a9e0d2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB6171; x-ms-traffictypediagnostic: DM6PR04MB6171: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB6171; 23:rkfe2+f/EmvWnxrvl29LIQCdmQpQ4qlLBwDf0UW?= =?iso-8859-1?q?MyiHyDJS0yxD1jh?= =?iso-8859-1?q?es1A07x5Mfu9mB96EGBiSfvkhAi4EZCnaV9A2xOzK9dDb+o5XYkrjxHywT5Z?= =?iso-8859-1?q?aWym6MKdLsVX3EUlUVqOGUB3wrW5xsnKjOSKxQV8Izctppw2nwL2iupxLCjr?= =?iso-8859-1?q?kfxjHeRs4W1W/M6X6R/HyOibZa+JxEBWc9PizT9Wd8NdD3/cGvuCsevjZO1Q?= =?iso-8859-1?q?oQjoAnz5sEKi6E28Uo2MPyeuyuNBE2ieWuRQ06lNt7m7QHYaR+FEVsme3VOP?= =?iso-8859-1?q?AY+LEWMVvBuDFlcGrTnuLpklm8zLUqo9Kd7bJYSVXeihg3Dy2i1e9mS2uV78?= =?iso-8859-1?q?Az2fNLCknBd4o5/xmUtpM0qMDB0YABEBWdyUiV390t/t/pVIhFojRslQRI/Q?= =?iso-8859-1?q?/Uy07ifBDI6tHF9SFCggi8jMA/iIWsxixrftBdfcviSq/Z5IUdsn9WIUSrlK?= =?iso-8859-1?q?WaK8Ec9+94HTtLNgpNBriqBUz0sHHxDfAs5CT2lvKl9l6KxS4DjYkMAF3ffn?= =?iso-8859-1?q?juzmTpLwK0AK7WEqqlSc9Ldn4cdZ9WHALuxOo0Vq/b9AsFP0eMZNRzw0Wpc6?= =?iso-8859-1?q?RTanflrH8bDzSRe292qlDmbdt5Vjq1Vp+IvXLCfJQsIZq7KOdmPcNVnqzOey?= =?iso-8859-1?q?TKntCgFQqxstylqwD/Ywogws0n3SkMFh+ZLOiW54oOmqlSZJTaDPNn0hrx4e?= =?iso-8859-1?q?JP1oABES56ddfHsL7pbALSKUsOlIhwSCfSdCTsIqCroL5hrjX9KiSqqlRJcj?= =?iso-8859-1?q?xxNxv8sZxK8zjBTVn9He7zCeG5h4PtGBpyGc5jnTni8o2ngBDDvfjzOXl/++?= =?iso-8859-1?q?frtYevzey/6YBeKSsA+m9/qtabmSAaTRi2oTevYLxBaboHWRKD0Mw50EvdTi?= =?iso-8859-1?q?ecRzxCUwKmMnzja+oZ408xBo4xtjpfAauQg7NFNNmoXztDHsp/wJHMAgcfKX?= =?iso-8859-1?q?8pYzrwSQm6KYeGp/dcNjcoNPhKFp+HP/7LP6qKI+vQw9SZaB4Yu//VRE316Y?= =?iso-8859-1?q?Zpm5tiZByX01ubG4OXRq9OG4DTtn3VVezn/cki7WQOZDLXNCKiQ0PL6VQksI?= =?iso-8859-1?q?bVFpTrpEA7Lg+kbYxjK1wnI0XPpbRVepoY/QaNrVzh0icnIhMtSNVl2rm6Lv?= =?iso-8859-1?q?Cn5+zqawtR79Tr/l3YQy9fbzdR1uYD1ywuNTxoj+lgvmhcTXlrxhKKvtmzMk?= =?iso-8859-1?q?QDXvKqqHxG9c8+S4ZuSd7wxPy5g6DvlzZC2CZSaQ3zo71V9XS4WGUuE/lTrT?= =?iso-8859-1?q?Y5Tz4s6Jk6HlYhrseCAMcAPsDj?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(346002)(39860400002)(136003)(396003)(199004)(189003)(52116002)(4326008)(66066001)(71190400001)(76176011)(316002)(8676002)(6436002)(106356001)(6486002)(6116002)(71200400001)(105586002)(3846002)(53936002)(386003)(44832011)(6506007)(6512007)(256004)(55236004)(97736004)(8936002)(54906003)(478600001)(72206003)(305945005)(26005)(102836004)(446003)(186003)(68736007)(1076003)(14454004)(81156014)(81166006)(7736002)(25786009)(99286004)(36756003)(2171002)(486006)(86362001)(11346002)(2616005)(50226002)(110136005)(476003)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB6171; 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: ROjJ4sd8oQgPb/rR042naiRtbFdJLWJL7aD0WyYxdWY7SS5DCE965/pne+18GYxL5g5jQXCmjMj8VxaQW7oAl5K//W6v4b8XD7SR4Oz1XrGYAccz33ORSmI80foSz8slJV4dtTUBDOJeNIFkRM6k8rbOTqljIT2DQOt94ghKLXNgXYNiKr8F0VzTKywl3x/EkLgVDNbBUmaGjZcujSmckiA1UUZpob1EIymhgniqktSKdRgGQQ4+5tIM1mCpLcRrXeGsTjqxwnE0oceOYZ2iueY4ljjXZF+uKdRfvoS3nI6EAX2GY8jszlytau8tG3teWtoD5aq+TxL4mebNab1+QbaOGFdSb27mjyGZHETyllVRGIJThXW9/R8FSdkQZmFQHu6XxmsHI7rTsoMd+nOrYwoHX9qz/EomHDtfy/dQRsQ= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2462f792-35fc-451b-f688-08d691a9e0d2 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 11:53:29.7426 (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: DM6PR04MB6171 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_035341_475063_98F8431E X-CRM114-Status: GOOD ( 14.53 ) 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 77564310235f..c6e858122815 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -204,15 +204,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(); @@ -231,4 +231,3 @@ void __init setup_arch(char **cmdline_p) riscv_fill_hwcap(); } - From patchwork Wed Feb 13 11:53:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809657 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 CDA141390 for ; Wed, 13 Feb 2019 11:54:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6B5A2964E for ; Wed, 13 Feb 2019 11:54:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8D5929A3C; Wed, 13 Feb 2019 11:54:02 +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 180FF2964E for ; Wed, 13 Feb 2019 11:54:02 +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=IlnDFNxifhI57Y3FiX+WEpwfW1e1UP9RFcuFMG2uNI8=; b=kkhkKG5Elij04I hqPotDIAjwa26eXGZnGCgoteCgmv3+gDAkwin+t1Do24X9p51ZyIt62dbesYId7ZxTxVL+/0Egew0 /81tY8UwX5zGf6J7WzGiEwUArBXGCSC+7yY/X7Z65WxYomIKPb/ELlJuBTuOjWwXn9hymKZ6dRdHC ReZmMIcWJ+LOXfkazgOOzvAaCIoFdDtK0lwj7mLT3rD8ckcPnlieAbwoUpcU53q238KQZVuCYYWiH vJS5d+NInCxV5x60GF6HLRT2fHsINWWa5Ru6mVXrXbkPzS1icmyAqNqIcEOxMwufZSPNtdX2ONIUk Ms25RT0VmvSvBiidrovA==; 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 1gtt70-0007m9-3G; Wed, 13 Feb 2019 11:53:58 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtt6k-0007Mh-3l for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 11:53:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1550058823; x=1581594823; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=scyx7QhE2+zJgIQiGgwc6SW6QfEoJ4Zs6s50gRyyT3Q=; b=drx7UwUk4QWlbvFaGtzAG0djn4uUodSmEIpLJNkBhkl4lo2F9dTr+hhJ dQzqXcH9LR4ibJrvwM5BKU9sb7PKAEppsH6QIQISy3teOiWkrR4VxLjfT QbnCRxZakiIMze5bzdCzc7JkLMOECEsSDAaepOvmweKAWkIVrQqROxTgG S4Tj5TK6sj7/K9RjdIGmlW5g6ze40TbzPjA+kE4lFo9RQvV+DJ7KqjDnz OaxplD7Djg36avsgxhQEqnDSUw7N3dJ9PzBxE+aixnT2qx1E6UnEBKanW BH0k3bqI2gKpPu1lnNMLnEB6dlWEnOb7kGW/zheK+CPTwanavsuwFoLTk w==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="106122615" Received: from mail-by2nam01lp2051.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.51]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 19:53:40 +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=4WTjUbOSOiYSslYkFClGRbRHiceLJ67RnmGsuMdQX3k=; b=YKyTZIRUjGMIAehl2ZYP9GgCwbbv1wgX/q0K+CTUxRooQD8Sjmr0IiRIomrB2M/paJabHVLS3Qw0st6o+ehvrkvNt0sH65m7OddVRnMjxl4HhLY/bAvCzCpq0Io3YAJHmRaUS0vfmXW9/sKPcUQAzsasWE3eoNzEeEG7IQ6Zg48= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB6171.namprd04.prod.outlook.com (20.178.227.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19; Wed, 13 Feb 2019 11:53:38 +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 11:53:38 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v6 2/5] RISC-V: Move setup_bootmem() to mm/init.c Thread-Topic: [PATCH v6 2/5] RISC-V: Move setup_bootmem() to mm/init.c Thread-Index: AQHUw5LBolG6jiYwKU2Pc9ReG2jXXw== Date: Wed, 13 Feb 2019 11:53:37 +0000 Message-ID: <20190213115301.103989-3-anup.patel@wdc.com> References: <20190213115301.103989-1-anup.patel@wdc.com> In-Reply-To: <20190213115301.103989-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0007.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::17) 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: [49.207.52.22] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ea0ea0bd-36ab-45f5-b526-08d691a9e3c7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB6171; x-ms-traffictypediagnostic: DM6PR04MB6171: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB6171; 23:lT/yPGCEJg+v0VoLgmcRCzJlPZjUAtSYR0rz+oe?= =?iso-8859-1?q?3RJWG74MwMyB8z6?= =?iso-8859-1?q?LC4Rn+otfGBvoNlVC5m0kvDKVJrM4LdTjCa35gp7WZVDQQralf5EYcJdfLX4?= =?iso-8859-1?q?wr/Do6DQldyHVzabPn+a4OUT5iZ055/GrD3iqcyO9W/P3q11fxhE7J0cKMmh?= =?iso-8859-1?q?u6V2sjPofH6q6tXeKtGjQvwgKwR+DAFCFqcNJ9WJkC2O6seRDBCCHR5lgtW+?= =?iso-8859-1?q?ijxBEMjZ0R4QInA1Y2KMvaX6gSG7NVfZ2h+tw10QnGImIv/vFHLOOdhKBFjw?= =?iso-8859-1?q?MHCFgFvkMKMyu1H+euYE6keKy6ho1focZ4nIqJaY6LhZ6ZtsRz4uZpbUJPu/?= =?iso-8859-1?q?fjWhykLIeINra9WDk2nnpruRjm1A5EeTyJS1J328rOTvAo+UNf7UR103TH0W?= =?iso-8859-1?q?9asGWkzwwtD45QiGvZvR1OcboeaMqeMad9BEVuzcwXImPKLLijD8VTnQhDID?= =?iso-8859-1?q?sYggumqN5Xb1d+ri31VSTVnQJEOdMHVdHiRAWp+am/vL15wbpPQikDwc3KJz?= =?iso-8859-1?q?l7Ss9kj00ixzGeIdU9zvtWBrmH1x/EXOf4svkbh2fxEo6Rf4+ZOFqSBFqt3j?= =?iso-8859-1?q?RqPRT6cOkjP5ECgOS+xqYV1GaKaEKe/oYffnqTh3UW9PLvJHY1S2UpzjgphH?= =?iso-8859-1?q?wq5dSFljXIKTRMpzkxBy9xIRmD8hAoVmHwxGb0Nwi314F9WknN5MdEOGmh8y?= =?iso-8859-1?q?kofOXi8PE8bHlFWc+lNdftwlCuknKhlryTqyoUk7WtvtYWyicWJO3gVCQFTj?= =?iso-8859-1?q?OXAlraR7Xt3vzwtW0bV9eTysWW+07VaWFv86EArLZNSH4j7xH2ybDjmCGsnV?= =?iso-8859-1?q?2YxAQ8FL+veVlMzkb00ZSn2kJG8KHfGmhBidBhpKXTXg0ZHVLcJQFyJ54OSl?= =?iso-8859-1?q?S/NoqD1e0nhLzxVq4oA658CrjHgo9O3S2ppGL5c7RrRXGF5ZYsKkd4IHbjdc?= =?iso-8859-1?q?mtBWrxahxLJSCzzYbxor0t4p0TSQzbVJsNqmA+eiidurtmceaerAL4OptPky?= =?iso-8859-1?q?8poCXYKCzTMUU9+HQzLU8fStdOAWfod4E8Jv+bxmaToVSoUcRb2tcxDZGE0i?= =?iso-8859-1?q?nOgm+gKy575+LRM4Z1UvTSi69UI7QFjB09S6q6vq5gLeYi4Y5HRToW307h9s?= =?iso-8859-1?q?Opu37oI+PNYuElWfhJ/rqmCtfj/9osSxTudjPOV5y7As+WXOaPapUFYvNFYv?= =?iso-8859-1?q?3ZbFPQHbcJR75Mr9pM6Rpv5IodWnE1QfrbSDUa5EUVVaakvBuqPZbDNpITYk?= =?iso-8859-1?q?QP7Zyf5rMgxb8/0RUzIpuwe478?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(346002)(39860400002)(136003)(396003)(199004)(189003)(52116002)(4326008)(66066001)(71190400001)(76176011)(316002)(8676002)(6436002)(106356001)(6486002)(6116002)(71200400001)(105586002)(3846002)(53936002)(386003)(44832011)(6506007)(6512007)(256004)(55236004)(97736004)(8936002)(54906003)(478600001)(72206003)(305945005)(26005)(102836004)(446003)(186003)(68736007)(1076003)(14454004)(81156014)(81166006)(7736002)(25786009)(99286004)(36756003)(2171002)(486006)(86362001)(11346002)(2616005)(50226002)(110136005)(476003)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB6171; 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: sHNyH8HfQJ/X+io2u2EeaRizMr1TvdbyEA/pbiG/GgWGN2rm5tDAGgdPdgTQVpHXev8mx68OBHiN03aiZo9YqJC+BKPQoGU5jDngfjTvb5qI8gozzVn5AyxGknAw2pNWtP7jHBoLuHUtDi0o0bpH2QLZv3k4Zun4xfaM546zD5StCw6oPi1z1ZS0vXn42Mluh5qkLJ30DZl+GsGztwc7X/jfzWIDWJr0hQMxwAWKbQ4ZSqTqPE0SVi9q+lm4TrPqoLwZrsN453+KZqCnohX8Uerttamt6VOVzmoIGFFJqmsXXBJwMx1UXP76Bn1SRawQCfTYgxz19Fk0YEG/d1fLuo2Fr9bTU3bbOJomT46/kuLmDbTMwrKelA5K83DUsTuGh9RwWqD1A0U93qZZUkQqnShmGK28bdKqcNynkLgjxFc= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea0ea0bd-36ab-45f5-b526-08d691a9e3c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 11:53:34.7120 (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: DM6PR04MB6171 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_035342_339434_52F3E925 X-CRM114-Status: GOOD ( 19.81 ) 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. It calls setup_initrd() so we move that as well. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig Reviewed-by: Palmer Dabbelt Reviewed-by: Mike Rapoport --- arch/riscv/include/asm/pgtable.h | 1 + arch/riscv/kernel/setup.c | 72 -------------------------------- arch/riscv/mm/init.c | 70 +++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 72 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 c6e858122815..49bce6692f39 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -70,34 +69,6 @@ void __init smp_setup_processor_id(void) cpuid_to_hartid_map(0) = boot_cpu_hartid; } -#ifdef CONFIG_BLK_DEV_INITRD -static void __init setup_initrd(void) -{ - unsigned long size; - - if (initrd_start >= initrd_end) { - printk(KERN_INFO "initrd not found or empty"); - goto disable; - } - if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) { - printk(KERN_ERR "initrd extends beyond end of memory"); - goto disable; - } - - size = initrd_end - initrd_start; - memblock_reserve(__pa(initrd_start), size); - initrd_below_start_ok = 1; - - printk(KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n", - (void *)(initrd_start), size); - return; -disable: - pr_cont(" - disabling initrd\n"); - initrd_start = 0; - initrd_end = 0; -} -#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); @@ -159,49 +130,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; diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 658ebf645f42..bedaf04f9c2f 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -66,7 +67,76 @@ void free_initmem(void) } #ifdef CONFIG_BLK_DEV_INITRD +static void __init setup_initrd(void) +{ + unsigned long size; + + if (initrd_start >= initrd_end) { + printk(KERN_INFO "initrd not found or empty"); + goto disable; + } + if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) { + printk(KERN_ERR "initrd extends beyond end of memory"); + goto disable; + } + + size = initrd_end - initrd_start; + memblock_reserve(__pa(initrd_start), size); + initrd_below_start_ok = 1; + + printk(KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n", + (void *)(initrd_start), size); + return; +disable: + pr_cont(" - disabling initrd\n"); + initrd_start = 0; + initrd_end = 0; +} + void free_initrd_mem(unsigned long start, unsigned long end) { } #endif /* CONFIG_BLK_DEV_INITRD */ + +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); + } +} From patchwork Wed Feb 13 11:53:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809659 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 00D031390 for ; Wed, 13 Feb 2019 11:54:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 211CE2964E for ; Wed, 13 Feb 2019 11:54:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1446129A3C; Wed, 13 Feb 2019 11:54: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 7C2B32973A for ; Wed, 13 Feb 2019 11:54:03 +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=/YinQNQS8QG7Hpe4IwnGLeNOR4DNXa3hjQA5p56UeBc=; b=nUUpTqpsS6DZX9 9zX3qrkxWhNL4B4rTq2rIfHpeBhyucG40gSUyjkLfaTKbNqZb5ig8DdQUWeRj83UEVUb7EKt2AODz BBx44ZxWLG0l1AnR0RC26ld6R88eICvJu3i4yQ+ffTLYeaYAoBV1/+PwsSkFLgeGhqZkjbYY7edb+ mTUjFdBRewC63q1luQrIxcTUKpBLbudbNGBhnvhRB3d/cQpusb7Fw0kMVngg6ZGknoYX/h0F+XSLj pgL8B796e8Ebbn2JGbkBz/V2YXSQms1C9KNF/ae0t3uKPjHwW/wIYZI7nma/W7IH6v3DSEXOlxrqL tRSZULaw6NxW1nh4mm3Q==; 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 1gtt72-0007ox-Cu; Wed, 13 Feb 2019 11:54:00 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtt6m-0007Mh-Jo for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 11:53:48 +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=1550058825; x=1581594825; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=KQcGW8lAHUewzSPpCVt2l3wyt8C2e+e5pUxeKnjvl8E=; b=I+VCSK9bV8TxBJ99oj6AFso2B2AUuY2oYjwIw9MKz/1vRayNrRngf70S xMiG6Ve43mLnnyDUt+2r/MTN+kldP3R9e9ZMym4VYAaK09nD+AdX+Mh+r 18xHNjgHH+V//j5+rYP7014j+7jjKu5ONBTuO3+VT29Gfu69bL5B/qCZP HFZE0DVwtextqr6fp44PYj97LoX27qy+ZyfxIygfZ4nCbLJ6J9vcZroks ozZG3NTNaWGNpQKONS8adOXp3pn2TMkYZTy3tDfQKcUyONoRHQVVvAp2o Mt5I+ygxv+Di9QqeEHMqsO9u6/BqLbMtRXT7uxsBfaNzcHT4wI3Olfyax Q==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="106122630" Received: from mail-by2nam01lp2052.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.52]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 19:53:44 +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=Vfy9a7eQpprxHOxnGVIApyfvb1IkN/Eoi7kyg0aj3DU=; b=Gm8ymGkcNxlkUJzKDRBv5rgxN5j5PdjDgt/nGEmPJpf1lNHSCglRdibdyJuVoTN7q4BK5W/7fvaBfqsCfJfSpEhOQw2xn08s2BdivynXX2LTOBNxIRm26d1UB4R1lzcw+hh1jc7fgNsxeNZtth473wFOlOv0oI8xVARHxdqveNE= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB6171.namprd04.prod.outlook.com (20.178.227.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19; Wed, 13 Feb 2019 11:53:42 +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 11:53:42 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v6 3/5] RISC-V: Move setup_vm() to mm/init.c Thread-Topic: [PATCH v6 3/5] RISC-V: Move setup_vm() to mm/init.c Thread-Index: AQHUw5LEqZUXVUXd9EWkO2EciZPqYA== Date: Wed, 13 Feb 2019 11:53:42 +0000 Message-ID: <20190213115301.103989-4-anup.patel@wdc.com> References: <20190213115301.103989-1-anup.patel@wdc.com> In-Reply-To: <20190213115301.103989-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0007.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::17) 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: [49.207.52.22] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b9cb2d7f-1d15-4967-e7cb-08d691a9e661 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB6171; x-ms-traffictypediagnostic: DM6PR04MB6171: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB6171; 23:hMp3BXTmo6atw/NvBhCZhXdbfFeK9G28jPITtpm?= =?iso-8859-1?q?GMYa1LGIGcvxSbu?= =?iso-8859-1?q?AqyDGwI5vfFKooJHfrjBedqnlb5RGero7bdJU/D+2Gql25QWKLdmw8OUqxch?= =?iso-8859-1?q?uIaBdeArjPNK4EwrNNLO6RKKF8+LzdusSZqyRyTW0YCQNCGyX+EVh3V6DZOm?= =?iso-8859-1?q?oi6TAnIrIbbay5ZITIV+mOvPc5Wa4hJWTEoP1HLOUMysYNT+mYzke0Tqw2vR?= =?iso-8859-1?q?mBx1IH5LSHwadFz9l+KN3qPtA2L6435McaC0Zlq+DuBdlcNnr919aLhGXR6r?= =?iso-8859-1?q?a6d53lWVXs/3wy9F14O1/0qyCnFR1iyb8eKwTLOLV3EsJycJQr+sqgw/f3+G?= =?iso-8859-1?q?9yP8CeHH2zC5E7N3GqpMAtzOE4DT4Qp7muXU+fBg61u3TgCQfrdagN2U2jNt?= =?iso-8859-1?q?qKlrnZY+qbaUEsWv59KKPWDMAnxVRmGQGSLtMk+L9S6zFw2LodFLWCa3DtZV?= =?iso-8859-1?q?FLTQU6zm8h71lFBA9/WKHYrqfpv+IuWSgPV35GAFT8YrHSS7YQUSwAB2msRW?= =?iso-8859-1?q?+ucCrT6uJVGKpFFdefh3ijqotohTbODyjzNxC4psUkuVa7RJWd4YTKFmLcSF?= =?iso-8859-1?q?GhWrSTGjVx6sgpOCCA7xneQULwTSptbPQWAwd8zNtKiuvZyfPRuaOOsLzv2M?= =?iso-8859-1?q?cf9UpUOZE+9kr2N3A7Z3uwEb3mih1RAMwgKqNgSapzR06Z+VhKPT5vZ9PJtj?= =?iso-8859-1?q?O62cy6GLIib0PvXoKgYY9fqHJVg8cTkzxHT869j4An2v6uVCvXHkvPood0GR?= =?iso-8859-1?q?XpbUDKn6cNcuw9O2ulBVkdNiYgC1qOBVFC3a+ow4MiBwG62lIvviaEaSpgnj?= =?iso-8859-1?q?aulZCK5TWCNixIzfP3x4IWNQv7gO3+BbnQF0omG4xX1f5AiKwjHx/xoDBwoe?= =?iso-8859-1?q?RCOL1owYb8gGQxyz0+NnsYo6HeCn0OyqkLrD3O5k+LCsaJ0lSo42E7L3h91K?= =?iso-8859-1?q?VBLjjfX5FDUaJsL7/eL4ud4HZ8bI8bILrlrBtRG1mYhId9GJ9NoFRUNmRU/L?= =?iso-8859-1?q?JQz23VHxbQiwVHlWolKTo6ruujiTnT1Xph4y0tfkuff+YA8D7BKuFIk+uBap?= =?iso-8859-1?q?9UZV9OpkkHBJKLHRT15Iwc2Bu9bAJM8CC4kT0iRnZQOX3EZ45m4QXs/Sz/lh?= =?iso-8859-1?q?VOOibYd1JzCSARwgiAw+2x95++/vjQxnL+/b9mzBlD7mb9g9cuDnjQXYAJ5H?= =?iso-8859-1?q?jMZIv+eoru55OaDz66i3iGjH2x9RYOVU6hqe5XJTvzBUhFL9jZMZxG+OkfHJ?= =?iso-8859-1?q?7tSKb03+bE40fiMvUfyPs4xD2f?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(346002)(39860400002)(136003)(396003)(199004)(189003)(52116002)(4326008)(66066001)(71190400001)(76176011)(316002)(8676002)(6436002)(106356001)(6486002)(6116002)(71200400001)(105586002)(3846002)(53936002)(386003)(44832011)(6506007)(6512007)(256004)(55236004)(97736004)(8936002)(54906003)(478600001)(72206003)(305945005)(26005)(102836004)(446003)(186003)(68736007)(1076003)(14454004)(81156014)(81166006)(7736002)(25786009)(99286004)(36756003)(2171002)(486006)(86362001)(11346002)(2616005)(50226002)(110136005)(476003)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB6171; 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: p3mkempJrc+2kJTsavInElWPc47QyJsLVPJ/T++PkLEuPYTbyn9wKUmkaHQAcataEq2LcJRtlmQVyVA31V6p1XXomwn5eAGqdkfufP2QSHRidlC2Z0Ubheu8UJI0GSo9pNf+5JwCtr3fWaxcnloqhBWB3uSZVj8zdd2AOBcvY1k2B3bONx0PJxFCwfk4K4ID5UiP1JKM5xLnxg3v1YM/h98DIrdWstExH49ycEBj6lXZOOZ2PQOVCUDHEIev83oJOwAlLiQq/PqiX/VvmhFg8ROB2pcEaNX/ekHDjGO+3XiWM/tq0OrX3GPLMLC7EtPryXh73RpAaS8PVWMRF4oPXiaemE0q2qiRjfdwwmx7j6LV2R81MEWq2iOb0FrYScsRMyfRw7E5e5lMAoL656GY8Sop3zMAWyJ0uyw5dtve2q4= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9cb2d7f-1d15-4967-e7cb-08d691a9e661 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 11:53:39.1040 (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: DM6PR04MB6171 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_035345_051425_DF4D56AC 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" , 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 49bce6692f39..cffe0b3caba4 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -69,55 +69,6 @@ void __init smp_setup_processor_id(void) cpuid_to_hartid_map(0) = boot_cpu_hartid; } -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 bedaf04f9c2f..358e3d5daa29 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -140,3 +140,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 11:53:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809661 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 C98B914E1 for ; Wed, 13 Feb 2019 11:54:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2EBC29753 for ; Wed, 13 Feb 2019 11:54:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D758F2A078; Wed, 13 Feb 2019 11:54:05 +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 496AD29753 for ; Wed, 13 Feb 2019 11:54:05 +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=uXK2djnOV7UOKyvzU+BgPOdQ7NDpCS3qR1/lvWpqKmg=; b=AdjE5jIkt9HW1H vPpx+49GVLo29xz9km5Sz0f+iRP6jpr+CLs5GOswv/M8XJFogzh8RiXg523tsJsAJmYF5J+eGemvs q8DIkPEzB2VyaNlFo74g60HtBUkHG8BH1I8kpplSf/dOpJdJ/O8Ky5Leo7bgWp2cOqdKJxPfCSmX4 bNCOeG56vNHTDaFLZFn1Nx4B98UIXuhUhNnO8wUUIb5+mt/kUDsMGJQAejXOmzjpqzDyRB5VeUHpk OXkl5zBYkkB2jjjYQHolDb+5pS+2AnHWSxBQqOqeh4MLKs7jNucw5wxvUthqBoHFCNxaN+URJ4OAQ xakOzOBo0LCsOcneekQQ==; 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 1gtt74-0007ru-KQ; Wed, 13 Feb 2019 11:54:02 +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 1gtt6r-0007YV-NP for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 11:53:55 +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=1550058829; x=1581594829; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=MXwtB/6kdzvkLSnmhvP1yQ8F2Bym4aV17HddVT2C4do=; b=j/7p+WZJoUIuGeLtJNWKwZ6fCACpsaqLaIkqSKBI4Uxj6/9QPrGMbjsd zWVJqWRFJxyPypHTsPgQhjQR8HYLhlErkTaSZqzwkV9tS74zttHnbVA58 YcSqEXVb73BIlzC+fb/ZApT9DmWCpZAO7RTszlj6j4nzAj4chyK1Q/Wcy f0qbojyYybokKMqdYyXbcWmqBtMoWKe468ZDeUGb60D5MYMynm/8Sb8fN MSpzv1N0xPKUyTI+bycBxo0G1iat+yskD+x0caKXmtJw2UKOx0Ug+5zFM RBU3MLwT1gHih0Esf2srrW0mk2WaHmhreaQA5n3V2JalGaeJ+d31G2zQT w==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="102883457" Received: from mail-dm3nam03lp2055.outbound.protection.outlook.com (HELO NAM03-DM3-obe.outbound.protection.outlook.com) ([104.47.41.55]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 19:53:49 +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=UIDgpony2OOpbAJB9j4n/tkKHKAtaD6tZ2pRyXqkoyc=; b=EZ1irKMpPx/FZ6cVPpB3DBRTpBRpNcgowqfOESpYOPMIBqGFw+utnuQCamJA25+obwjCsIC7EbOB3eSMLGq0bWDgf33uuLNls8OwzwuJtugDZWUN8VE3Ow+C7zmbtqhDpD31oDFyuoF1WKhUmoFkBkbEAuj3V9WaQ+diwkpDMTA= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB6171.namprd04.prod.outlook.com (20.178.227.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19; Wed, 13 Feb 2019 11:53:47 +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 11:53:47 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v6 4/5] RISC-V: Implement compile-time fixed mappings Thread-Topic: [PATCH v6 4/5] RISC-V: Implement compile-time fixed mappings Thread-Index: AQHUw5LHaJ/8dfuWWUGPZC+DaMx2xg== Date: Wed, 13 Feb 2019 11:53:47 +0000 Message-ID: <20190213115301.103989-5-anup.patel@wdc.com> References: <20190213115301.103989-1-anup.patel@wdc.com> In-Reply-To: <20190213115301.103989-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0007.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::17) 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: [49.207.52.22] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e042ee8e-b44f-498c-5359-08d691a9e930 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB6171; x-ms-traffictypediagnostic: DM6PR04MB6171: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB6171; 23:WZbrdD7JAvcoQJhqGDEM30FanJ4dJkCKa4Sb7XR?= =?iso-8859-1?q?Kk5sFFronD3k0uR?= =?iso-8859-1?q?D7nt2jtXh78A9MVhiJMwcQZbY+oia/0OmPquTJiaUDMYZ3cbYO8uLh/CD8hr?= =?iso-8859-1?q?jkz11DutMLMBQHNdG24Km2fDCLMzUVpc5/lRgkFmxcZ59YRrBhWeYMznu63n?= =?iso-8859-1?q?zvlCskrpOL6AHlcbhiVWUIbKTUFIyLHCvNFlhA8wsOtLdmMpX/cy0Fs4szDl?= =?iso-8859-1?q?Rl2BnpUgEwRcEPLdclXqNkyOXfqCjHlxCqmRvKugW4zQna6knbyeyfbh4A+L?= =?iso-8859-1?q?ZVR3XP7XYIndPvZjigf1KC2wweVqu9v/FmzlORxwR00YOHW5i9iUiMpETVI9?= =?iso-8859-1?q?zn0WgfET7q2dCGBSAgcZxdZpjZmgIZRlM55m6e8hzaAqwzhhHfCFkrw0J0WY?= =?iso-8859-1?q?i/GMXqfzFvVL8q21PmW3O3zP0695a6GWlSPP7CegVEHq6lLGqUH7N1ujG1rm?= =?iso-8859-1?q?t42Zgqrg7c6tWpoSeFEJLp5UAsbDcEKPuDeiPZnS0UdP8iyeIOd3QN/cyt8Y?= =?iso-8859-1?q?HLsuYf96FoX69M3GDIZPcJb73MP8vS7YhM6w5BJMw2weclKOMjTNFDZYCycg?= =?iso-8859-1?q?c2Ut6a8QJyi6LgYYdD+IwJP1k5rna5reeg9TeKVnIg1GS3RGSrGDpEWJhMpZ?= =?iso-8859-1?q?d8/+cHtbDi0kFp0pKHe0tU+vS8AahkO5dEjwcIf3AOi2VS/VHA22PjFQVODW?= =?iso-8859-1?q?SojMw9dbud1lkzo98k/YvXd+ggy3gzQQ1ijHrabJ6414Rkrg+EHD8fH8LIZN?= =?iso-8859-1?q?zF9cTPSl9lupnrzenlVVxIIS/ve8i1+NMhhyu7VxShPlL8U2RmwYHceG+ngY?= =?iso-8859-1?q?RPGpRkZhDphc1aiV7VgeAqqPw+h35nkOzvOSGWHMLWOHjCeTG3GKe4tinQgj?= =?iso-8859-1?q?k3DMvURuN4vyOB4QjpPtg/ZY0ArN8qBtsxbpX+hlZLeDyBBhxaqkgdDUVPn9?= =?iso-8859-1?q?VbZITCxJGPMTIZjDCQLDeS4igT7OuzelPY6NNj2/TPuqutMEMtmFYvX8PQBi?= =?iso-8859-1?q?PsPMYeM7DqaKTHKQIzUkj77OlGspOTbdvw4lI6CkeGDfEHvfyQgYzNWAxvTA?= =?iso-8859-1?q?8Nn0IchO87ATDRQIBdwNEwffEq0IKn8+Y0V2bSpKh8jtcQeMlsjM95x4j/ik?= =?iso-8859-1?q?jHHtT0cQ4W9+Y7262ENMcHTwsO2CvP4PinjlLywg5p2KnxUeyJfURNfFNmbO?= =?iso-8859-1?q?TGWpQwCI5fzC8QDfrYN8a91WC8V+eNssujhtgZxaD805831u7e2a7xmIRp7L?= =?iso-8859-1?q?UFeRexN1dKgAjcaNpcGhIDP0zf?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(366004)(346002)(39860400002)(136003)(396003)(199004)(189003)(52116002)(4326008)(66066001)(71190400001)(76176011)(316002)(8676002)(6436002)(106356001)(6486002)(6116002)(71200400001)(105586002)(3846002)(53936002)(386003)(44832011)(6506007)(6512007)(256004)(55236004)(97736004)(8936002)(54906003)(478600001)(72206003)(305945005)(26005)(102836004)(446003)(186003)(68736007)(1076003)(14454004)(81156014)(81166006)(7736002)(25786009)(99286004)(36756003)(2171002)(486006)(86362001)(11346002)(2616005)(50226002)(110136005)(476003)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB6171; 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: Vy5gV24SqEUxiMooA/1zuCqd3qxfH17z2EOwnjB7MmapFJmb6PhFzBcf8Q86UrkTcalWTQp0FTb832LDD0LttZ3M4p0zNYAx0XadoNJ/0kdRNrMbHUOAWuMp+uy5vyO0qJU4+k3JTHoco+f8ZqkXg6sAEyN43OsGD5Dq9KTMgWnWdJ25euU68DDtY2BkQpp+2Zq2cv8ReP/703y25LhCYoHeervf/9b1EaCMy+F8X0WKYhUa6qo5lzRF8IMrBGcc6OX2XyrVyzx7taZqcxtq5YmwT4XWzbDKk9uCwYIUwZYSAZ8ACCVvAgemdf5N3ROCpwGC7KoFSXywxx4j9hOBBQSZgYCX4X1n0gooZOcXlm9/XWPFG1Dw3xmQpPJg0+WkCdM0LUeExm/Lgk53YEC0CyQ/UkCheSxKJzp9z9Aq5m8= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: e042ee8e-b44f-498c-5359-08d691a9e930 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 11:53:43.8112 (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: DM6PR04MB6171 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_035350_229692_95FF29B5 X-CRM114-Status: GOOD ( 20.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" , 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 358e3d5daa29..b1167a6f5a92 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -148,8 +149,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; @@ -172,20 +193,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 11:53:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 10809663 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 C5B9914E1 for ; Wed, 13 Feb 2019 11:54:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 930442973A for ; Wed, 13 Feb 2019 11:54:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 875B529A3C; Wed, 13 Feb 2019 11:54:09 +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 3D7CB2973A for ; Wed, 13 Feb 2019 11:54:09 +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=0H1h/FDguWf8qEwcHNfZnKt4Bt6BdVac3oBYfq/69r4=; b=QDxqhOLsU4FzxL MWyjf8ld81nir+j9pkf8cmQpYWjwjo4B5FVy2HCE3A9v776GRuB+bXC/+oIyaz0oQdXtQfiof6fPz gl5XgNo7CV4LQDK01LaYizyranIN/wfWNMqd/L8qlcinoMUUgAOEll3LKu+3yGO/w/UpyUdsdJhcd slbb2zAlEL4SoGroYAlIGzWu5q5QIvpkYnY0NDFk9TcXzBSGMjBdKGYOlC0GujkZ1jC3gApUydSjo zxeDrDJIaHFjgp9wZEBT+e1btqhiQjNsc9UgR6zAamFwA6afKkpycIHjUwBoUk9MDiDMOlaMYPlxK 8tBUG/zu20reSH5/aVeg==; 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 1gtt78-0007wk-Lr; Wed, 13 Feb 2019 11:54:06 +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 1gtt6w-0007gU-Ss for linux-riscv@lists.infradead.org; Wed, 13 Feb 2019 11:54:02 +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=1550058835; x=1581594835; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=hdynpLsXwVKwcClFb4N8UkG4HyfxmZo8SJfWqKU4gbc=; b=Qj1R679DPDvmB8xfHcLZQNMsC0DISurXId4XBs0G75XBmToKnqgKnvc5 DMoZlthGd1Z5I/ojTXYLU6/RpMQG8ADgiAv+VNPXauJXKYKTlb5B02HD5 k+VSOY54OMDBQuZhNTw+hhKuav8HfLWhhtnv8P1O8bp2a/fh0MXen52Wl xLocdrGMAnB/hwFN+vfeUbLY8T8xJT3zmgm25bMD+e82BsZgIT7auL2Du opI/g5xD16Y5YyDOCPIvB8lIcPW44Tz1XyftWYZgu4yxz9YUnLZFBoU5a hbOVD4XyH84vlcT+ytmlur6sHIPEDeZC4GvaWzScEXUYdVJJyGTmQM3T9 A==; X-IronPort-AV: E=Sophos;i="5.58,365,1544457600"; d="scan'208";a="101095245" Received: from mail-by2nam01lp2050.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([104.47.34.50]) by ob1.hgst.iphmx.com with ESMTP; 13 Feb 2019 19:53:53 +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=bZN5zUH1x1xZWl7BtTWHLtybsd33DX9UC1Eh7RejOP0=; b=mwIr/vyPbuT2ZifYFDqKWipjDgC5/GFrsLCBLKeb/BHwsqM2UlloEw95hM+1bu4lo6jnTbJ8RRgdL6iF6ozuY2dkrCVsNPCXA1AR/R9ubCMXUi+Gmoyi6M0RoJNk7la7/u5c69NunMxOAMhX8Zr/swzqS1n5WAiN3MKkoxVeCkA= Received: from DM6PR04MB6059.namprd04.prod.outlook.com (20.178.226.89) by DM6PR04MB4458.namprd04.prod.outlook.com (20.176.104.203) 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 11:53: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 11:53:52 +0000 From: Anup Patel To: Palmer Dabbelt , Albert Ou Subject: [PATCH v6 5/5] RISC-V: Free-up initrd in free_initrd_mem() Thread-Topic: [PATCH v6 5/5] RISC-V: Free-up initrd in free_initrd_mem() Thread-Index: AQHUw5LJNBZjt056iESEmmv3JNu8Cw== Date: Wed, 13 Feb 2019 11:53:51 +0000 Message-ID: <20190213115301.103989-6-anup.patel@wdc.com> References: <20190213115301.103989-1-anup.patel@wdc.com> In-Reply-To: <20190213115301.103989-1-anup.patel@wdc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR0101CA0007.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::17) 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: [49.207.52.22] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 535f05c4-daa7-4d09-c1fb-08d691a9ec07 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:DM6PR04MB4458; x-ms-traffictypediagnostic: DM6PR04MB4458: wdcipoutbound: EOP-TRUE x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; DM6PR04MB4458; 23:3HjocLzHNbh/M6pXTkTBAZ4Xc5VNOaBoTX/RdSO?= =?iso-8859-1?q?Mxxu8Ftzvqv006h?= =?iso-8859-1?q?MN2M323tfywA9UhAAnkx/hjlAmJ/6mJa+wacg96e3Qsrye+SunHovmD99NmU?= =?iso-8859-1?q?wuT/aXsr6i0xRQ2FIyoeVxJ8C9Y7SMMSn9y+VlL07i9bskONLt9yWItENHDK?= =?iso-8859-1?q?YGCHPkkmcbhq7YnyZRDiK38c42ozsMhmGJRRCQIPMbYA/dHooIloJcb5cXVJ?= =?iso-8859-1?q?MHwxhS9MSzwlqFPYk4QPbPEZjTxfh7zTK4I6wUzd3Bkq9McKpZovUnIVQ7DV?= =?iso-8859-1?q?lC+ltwRYLKovOb927uRlyW1tHpywT05MJVqKaNlcf7ShL/8jHnlZQ4dlFWnj?= =?iso-8859-1?q?JzZWjBknl8vNICCoN7C2QavHxj37dHlEyVT9R51o6IQefrgnfx0e1CIGEG2N?= =?iso-8859-1?q?oq+XODvbcUqY1LO3TaE7iufiawYu7HqHe9N27RNh3BfaRjMK4QnIxpqt4Fj6?= =?iso-8859-1?q?qCtib2U79Y7eRsbNBzP7xc7cdjxI0+xegVQqsUrGy0PqobE1JniZvoPwTXzo?= =?iso-8859-1?q?bPSG5eotDhATroTr2XTsZTfn2U/SZSW7ImJH5pkjFxmJU9HqDTPYieOfBhkL?= =?iso-8859-1?q?6QmP/m/5elGndPEaE8roJfLMghbVU08onU3ux7jr/leJl7H8Tz8Dbe07/Sqi?= =?iso-8859-1?q?CR8poQolX8puyjCr8grlipO7qFPjY87pkRwsavS5CCIIvwEgq6rKxm/Fy9Nz?= =?iso-8859-1?q?1TP+1dLMcWg4TmPYdOb4tmJeQZTbZz/aj4bsIcTC3rj7yHAKIYX1c3YXLM7f?= =?iso-8859-1?q?9iafgs252PRc6JKEFQhMc889gsIh0oEYjamEnYtQY0RuByV8ZYMKryuGuLLX?= =?iso-8859-1?q?SI2uk7Lgw5uD/ACXg/EHrfAmJMNeQDjZhYjBzmYPUwNacAmU1eZCHJha+C5a?= =?iso-8859-1?q?38dKfajTX4gphunHOXY4bPeMY9AVl0usYT87gFJvHeAs344d59PDVzlyZQs5?= =?iso-8859-1?q?BEDLh4mDjhb3uegIXgh6dkIVAzN2yd6TkuKlGGqZrofngYhjQ8NVYoFYK5JV?= =?iso-8859-1?q?uHXsUp71bWXS7cGvpf/dHBN0jgHMcCZZt2I3b5kZRUE5Z17U9jAmBrB/mWKP?= =?iso-8859-1?q?Fdt7jXIlMqPW5YYkRJtO40xcygyG5qDlPISdnj5XlCnqqL2Z8HzO48PFYPrx?= =?iso-8859-1?q?P/7MvfFYiOfGR0A1ZCtAR64yQEDPCsdVFKSxes1cqqWr7Sdk8ZgPXgX6GaZ5?= =?iso-8859-1?q?VNeRYTcPOsKsK/NIACI+y+xP5y4WTHRf/xAd7zHIikSBEfnJKwI5nsLk14t2?= =?iso-8859-1?q?XwOK6ECANTNvf8E3NKjiGHoOdAQdhmP29HUbezfP/jHC2ilg=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(366004)(346002)(376002)(136003)(396003)(199004)(189003)(53936002)(25786009)(6436002)(71200400001)(6116002)(3846002)(6486002)(86362001)(99286004)(71190400001)(72206003)(76176011)(2906002)(54906003)(52116002)(476003)(106356001)(305945005)(110136005)(44832011)(14454004)(316002)(2616005)(68736007)(7736002)(486006)(97736004)(66066001)(50226002)(4326008)(14444005)(26005)(11346002)(446003)(186003)(478600001)(256004)(6506007)(81166006)(6512007)(36756003)(102836004)(8676002)(8936002)(1076003)(4744005)(2171002)(105586002)(81156014)(386003)(55236004); DIR:OUT; SFP:1102; SCL:1; SRVR:DM6PR04MB4458; 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: ym4sZ/BQNXxOf94Sz+dndBzNFZWfld/M7is8WBI7zGE/8qYh7tl+N5uazXrh2fkOQEau554eHiPw1F/SQ66UIwHvEopedFAo7iYJkwjE60x/lQty896zFqdkAMclhBQyMncl7rHtSjZ4r22f95+lT5YDDDyp8Pxd4+Qlqo4p45rrU+4D3MgPfS4hHHrvh+dWuly4oEphEpfakTqd//l0QqbUYXEFm+YUEhJyhKh2PhjeJLGdHyyywdk5ctNXr/RkSBM35vAqymvf/qmQTXQELiufOGjzNBocG14aP3Pqjh1DdbfM2aC8VqYRznMe24zqCXJv1DLUlUF77wJG5WsRbVefYLp1X3LXUXjAOJQfNWl8P0frpIaEqGhSKUoqgIpHL44MWMZtXTWQpP3dWGDW2wvU3JzV2LtGpuhx9t+CaQo= MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 535f05c4-daa7-4d09-c1fb-08d691a9ec07 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 11:53:48.5595 (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: DM6PR04MB4458 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190213_035355_428396_B0949B1D 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" , 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 Reviewed-by: Mike Rapoport Reviewed-by: Christoph Hellwig --- arch/riscv/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index b1167a6f5a92..aabf1869c54b 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -94,8 +94,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 */