From patchwork Thu Jun 23 11:30:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dennis Chen X-Patchwork-Id: 9194859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B60D26075C for ; Thu, 23 Jun 2016 11:32:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A34422844C for ; Thu, 23 Jun 2016 11:32:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 964602844E; Thu, 23 Jun 2016 11:32:15 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67A582844C for ; Thu, 23 Jun 2016 11:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751932AbcFWLcC (ORCPT ); Thu, 23 Jun 2016 07:32:02 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([207.82.80.143]:34240 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751660AbcFWLb6 convert rfc822-to-8bit (ORCPT ); Thu, 23 Jun 2016 07:31:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=L/CACPuJGTkWOx7e/EGp5ps7UrcaLfGAJC2mOzugVWA=; b=dfdVZ6bCfErb5XfDp0X7Qp/UIoDM0utCiGZMun/3p3CiuYfHE3QMzavawtmKFHB/aLv25ABPe0u6NhwXRfFQnLTYXdF04cfX3DQQfYDnj/VPwftjZAXuPqpIk5FOgub/cA8BNuKifrEmJbIr5MlhT50mem1qLBwlrsaJ0lI4GiM= Received: from emea01-am1-obe.outbound.protection.outlook.com (mail-am1lrp0019.outbound.protection.outlook.com [213.199.154.19]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-34-aGDqGCnPOFyVCifZHmZcpA-1; Thu, 23 Jun 2016 12:31:54 +0100 Received: from AM3PR08CA0068.eurprd08.prod.outlook.com (10.163.23.164) by DB5PR08MB1240.eurprd08.prod.outlook.com (10.166.175.11) with Microsoft SMTP Server (TLS) id 15.1.523.12; Thu, 23 Jun 2016 11:31:53 +0000 Received: from DB3FFO11OLC004.protection.gbl (2a01:111:f400:7e04::160) by AM3PR08CA0068.outlook.office365.com (2a01:111:e400:8854::36) with Microsoft SMTP Server (TLS) id 15.1.523.12 via Frontend Transport; Thu, 23 Jun 2016 11:31:47 +0000 Received: from nebula.arm.com (217.140.96.140) by DB3FFO11OLC004.mail.protection.outlook.com (10.47.217.132) with Microsoft SMTP Server (TLS) id 15.1.517.7 via Frontend Transport; Thu, 23 Jun 2016 11:31:46 +0000 Received: from dennis-ws.asiapac.arm.com (10.1.2.79) by mail.arm.com (10.1.106.66) with Microsoft SMTP Server id 14.3.294.0; Thu, 23 Jun 2016 12:31:38 +0100 From: Dennis Chen To: CC: , Dennis Chen , Catalin Marinas , Steve Capper , "Ard Biesheuvel" , Will Deacon , Mark Rutland , "Rafael J . Wysocki" , Matt Fleming , , , Subject: [PATCH 2/2] arm64:acpi Fix the acpi alignment exeception when 'mem=' specified Date: Thu, 23 Jun 2016 19:30:15 +0800 Message-ID: <1466681415-8058-2-git-send-email-dennis.chen@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466681415-8058-1-git-send-email-dennis.chen@arm.com> References: <1466681415-8058-1-git-send-email-dennis.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(561944003)(106466001)(189998001)(33646002)(4326007)(5003940100001)(92566002)(2906002)(246002)(356003)(8936002)(50226002)(7696003)(7846002)(5003600100003)(48376002)(36756003)(110136002)(19580395003)(76176999)(50986999)(26826002)(2351001)(19580405001)(229853001)(77096005)(47776003)(586003)(50466002)(87936001)(2950100001)(8676002)(86362001)(104016004)(6806005)(15975445007)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR08MB1240; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11OLC004; 1:jXvHWms4TtxyJwdZSsxphF7/hm7frC8ISKO0j81SL4HRU3Rl+mwX7pKZZfIfHfA0j8nx94FWL3a77ZCSFhtJyu77MYXANxVfZj+SUwJ94/xQzUlu/ctwCVWkWoCWQ9IZm3zp/cCErLZteZPjZKpilcuEanw9XY3ByX2uxDnC8a1gzsJeP8tcpXhXZ0Xo7oX9JzdpQ9X768R2nvRi32pclvAw0WTGk/TvWr1vLeE8Qh8ZkxlhT6DHgqgSZn23LRTaKEd19geZckIcN5J958tHcMt+ArFSzAOn/psir9S8ceFYLQJJNwJwFsCt2uKe+TyM1SfF9peFpVvpoJF0sSL43wxxIklEZbunibtCUPm8YdyDovJQT0l69e/TCdzpn8xuCh3MpiLuayi8gc+Tlm5fOGIMYYUwYemPun05OTtHJkUjXUs+0ks6wU+WiF/YX0XhJ6cRZk1gDcKem3FDHAAh8rGoTKVq9u/ca1SaFjKsp0LEDC5meGbYfwwbVhw1FDt9tRJQubRpUTM6MGeUIhkGN/a0IIVNnI7+Z5N2hRJahrsj2fzAP83nv0jxGd/MouDcRCSpVIs8JwfGgVgQYZR4b1T35rNfxVgFTThWDRDn/zw= X-MS-Office365-Filtering-Correlation-Id: 7baa0d84-e9dd-4cf1-eead-08d39b59f5f0 X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB1240; 2:yLZsEx9UHTsecWn6jn/Tz7KAHSb6zgp1XGNrb7rx1gFtgh0oETTSWxwj/D7p4skw0GPlu7SmMLz3JMMHUSUlpRR6NPNonCLaIWOXeM/JIumGl/BxdaJYDntft+KjUyVfYml+EGxoS0k8OKwuSy8J+ATT96l5jW09JefZ7/q3LgMBz25OmeWbZEZGtwsy2vIG; 3:4qtvPdh/9uvPZmD0dcKzr0jT/qp29NvUMCAnoSwY52pq9GD6jMFoUvxDAKZi3j7rC4PmxFGLCNomC4eBdX0Lz4G3M4oc53POndjzI1LvEa4lNU7YiESLYb0nhgUSW46A7c6aJlehanS6zWkmqsFy1UAkn7aucMVdLxAGGFJ5TEnFTzAMT3p6cn/g0bv55ZzuDhQ+MZELyI+9e43dBLllzVJRGu7omtbokqMgqqqnM5vPBXT0s9IkoBtO/10lnmuCXejR+odtOFffnv3fhnQIAw== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:DB5PR08MB1240; X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB1240; 25:10uKdiseraiDmyo7EWTHuxeKipu1QiILSDUTgtknpjofvO42bfarU+cosSIOIOWf05X5ZxGBbK/tIgWsyqJ8V4SlHfeOMNRZajfC1iWMyrssCbuxQ36lfr1+QaH0efmkudldWf6e5RHqCe+nzgAwfl7zH3GeUOo3+vqAODraULMuWOPt8GCuLrj61s/0lrxciviVicCJp0S2u5VaU85uCHFNIbX6j524fSq3PsbRms/hD3ILanPPUhtjpKImQwCAWQtJbDS6AdrdwoXSF3RFSwoj7JafvRXBpFI5B479xhDSPaD2TBnFwhxo9lwBucO/1YnVaor3gVqocCIEAXDFa1GXasi9NMzybmn7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JZr8ziUzC6dTwwK0EGyyiuunO9WMi8xQmxn1nR2qsHZwVDkB59uevfhCPrlfAYqjmG2wnkpfkambCfqyxGUTTaEuRHz7+nVsxEdJ0/eJnNhVpwWMJK7y2t5w9yI9aMSlpvMUKFqHPbVAC73rf0JXWLzDbyaOyEp7MWmpjktsc4vsrSaCt823M6VNTSimjka8tTouBfqUZ4PjXzjBfZ9LUOwNEUILsX3a5Mimdrz/10fCYJqmh1ZXH53W+CPnW7yQ4zW19tj8m/Nv4bXS7mYbknenHC2fEc/21kYdgwMFNhi66LkWJkX624ZNr04TxZZmh81VY2vBdOer51TjyLrw1L4UAjHRqCLhGkUeeE6IjTH+vgip+UPaEDB3ViQ450SY+x6kWjg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(9452136761055)(258649278758335)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13020025)(13024025)(13023025)(13013025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DB5PR08MB1240; BCL:0; PCL:0; RULEID:; SRVR:DB5PR08MB1240; X-Forefront-PRVS: 098291215C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB5PR08MB1240; 23:x+ZL5UOCMxkVYt/yBtcajUAL6iWpe12gs5tLCJE8b?= =?us-ascii?Q?JWMU/n/L6o53v3dmldsfpelOvziBlHxwTd3cinq/0pi086E59ZbXkN5yJGm+?= =?us-ascii?Q?8fhNtv2p+XTD6isTGPRZEXLMz9/8ExE/jjcTx5byLgvPwBw2hMBtmhSc0n9n?= =?us-ascii?Q?OCRlE1rVmQ1L92FiCpQUBhc5t1Wx09NbqJUdkoHoy7T+C4+m96tETzTKzFEu?= =?us-ascii?Q?4LxlH9SuxLxhqt2ilGZ0vQHceM1KA0d0qHxChRi2NkwZIj7FnUI9hbBeukzJ?= =?us-ascii?Q?w/yzWP7CsPlfdw30Fu6OPjYSl6k77of2+9zEQSw6DDwm8qpD8p2aRLAow0eJ?= =?us-ascii?Q?ykTL8rqp7LlAgTAYVcq3YkX2c7gORBcsldvze5xMqN5kKlzspFothzLs2cya?= =?us-ascii?Q?jFNkxce/In2SqegauEwV1czJ2li2KfO/cZJQDH9LBko2PRWKBpeO+En8uBuS?= =?us-ascii?Q?rXVEkRuACaGpOGeQbsvQrNz6Pq9p4IuWdsRqZAiEIm9XpIcLBmIJosze9eNu?= =?us-ascii?Q?WEESJPFMzPC7OMjb7BfXFo+d8T0t4QL2vwAOCDjhVDdCn34CPxW6Lq+spIYt?= =?us-ascii?Q?n3IF//boNzTmPAads3BqSn/bPTBIWJbMnZt2wib5PEuPbUPQz2tVXu2v8Osl?= =?us-ascii?Q?ErUbJlQjL6WHerFupMx416KFzOU5MYG3pSul/QtZBuLe2RgO3WqsFz6/kvz0?= =?us-ascii?Q?hwMdqEShQmKI/mLShxzh+JV54ay0Shemn00k/m/5aTLhcrubDeo8eq0bD5x/?= =?us-ascii?Q?lw5Qn9DPGKkaE4f2Ov69QoaCeSVHLXEOZJEDtDLmGe33ZxEjxCQ7B79Z/Q0B?= =?us-ascii?Q?sAU7UK+uwi7rMwfxGsX7Vj2iyW4GHQUCKYdxfSv9kG9HoSCA4uZYy4P6ERzk?= =?us-ascii?Q?CiDyiBP+K44wJXOP7u4l2m7kEj+wO0qjY9/wHHCG2Aly2DfMcGk1iLtoIx8i?= =?us-ascii?Q?8LEd/1RBGfalCiynmB3jaAFvZ169onP0b7Haj7VnBQ4xEP//l0AZAshbB3CX?= =?us-ascii?Q?ejs7oEKudcag5fUsOkq5S+/K5+Q3yfrfyhB7XOj1OdFRtgSetteJVnE3DEtP?= =?us-ascii?Q?hVEmyu76pqg7HVv47MpOhBX3lLa83dXCU5f6sJQ3Me+r0lR/w=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB1240; 6:yQAbMr7aa78VV+htBVQ/DxDhESZHeHnLOBhPOCLee3hPi1+wa8qChtkpgdk/1iv18lZNKtA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+XEnFrS0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2016 11:31:46.7322 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB1240 X-MC-Unique: aGDqGCnPOFyVCifZHmZcpA-1 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is a rework patch based on [1]. According to the proposal from Mark Rutland, when applying the system memory limit through 'mem=x' kernel command line, don't remove the rest memory regions above the limit from the memblock, instead marking them as MEMBLOCK_NOMAP region, which will preserve the ability to identify regions as normal memory while not using them for allocation and the linear map. Without this patch, the ACPI core will map those acpi data regions(if they are above the limit) as device type memory, which will result in the alignment exception when ACPI core parses the AML data stream since the parsing will produce some non-alignment accesses. [1]:http://lists.infradead.org/pipermail/linux-arm-kernel/2016-June/438443.html Signed-off-by: Dennis Chen Cc: Catalin Marinas Cc: Steve Capper Cc: Ard Biesheuvel Cc: Will Deacon Cc: Mark Rutland Cc: Rafael J. Wysocki Cc: Matt Fleming Cc: linux-mm@kvack.org Cc: linux-acpi@vger.kernel.org Cc: linux-efi@vger.kernel.org --- arch/arm64/mm/init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index d45f862..e509e24 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -222,12 +222,14 @@ void __init arm64_memblock_init(void) /* * Apply the memory limit if it was set. Since the kernel may be loaded - * high up in memory, add back the kernel region that must be accessible - * via the linear mapping. + * in the memory regions above the limit, so we need to clear the + * MEMBLOCK_NOMAP flag of this region to make it can be accessible via + * the linear mapping. */ if (memory_limit != (phys_addr_t)ULLONG_MAX) { - memblock_enforce_memory_limit(memory_limit); - memblock_add(__pa(_text), (u64)(_end - _text)); + memblock_mem_limit_mark_nomap(memory_limit); + if (!memblock_is_map_memory(__pa(_text))) + memblock_clear_nomap(__pa(_text), (u64)(_end - _text)); } if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_start) {