From patchwork Fri Sep 23 02:55:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 9347329 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 04A506077A for ; Fri, 23 Sep 2016 02:58:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E26BE2A1D4 for ; Fri, 23 Sep 2016 02:58:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D71322A220; Fri, 23 Sep 2016 02:58:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A8882A1D4 for ; Fri, 23 Sep 2016 02:58:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnGek-0001i6-Kd; Fri, 23 Sep 2016 02:56:06 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnGei-0001i0-CG for xen-devel@lists.xen.org; Fri, 23 Sep 2016 02:56:04 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 13/4D-13744-3C994E75; Fri, 23 Sep 2016 02:56:03 +0000 X-Brightmail-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Ref: server-3.tower-21.messagelabs.com!1474599359!34040736!1 X-Originating-IP: [40.107.5.45] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56607 invoked from network); 23 Sep 2016 02:56:00 -0000 Received: from mail-eopbgr50045.outbound.protection.outlook.com (HELO EUR03-VE1-obe.outbound.protection.outlook.com) (40.107.5.45) by server-3.tower-21.messagelabs.com with AES256-SHA256 encrypted SMTP; 23 Sep 2016 02:56:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BoJPocv0B3lzN0fww68VAq1IHqQ/T1v+XUacbFn2lYI=; b=XPifiBKD26FRtKFuI3j2Z5cA2mUS8C7X+bTYCqQdj+lDw9SIR97sg1+nbtP5oH4e2YYqACh1YiSGQQzWg0czaAnQnaYsAtjx3ajy5Uiiav2uOB+Lv0E+Lfet7w3EEDReJaGKrvjH6wqBUb9NJFYBVcHa66ZBM8kXJtJ1I2wDhws= Received: from linux-u7w5.ap.freescale.net (123.151.195.53) by VI1PR0401MB1807.eurprd04.prod.outlook.com (10.165.234.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.2; Fri, 23 Sep 2016 02:55:56 +0000 From: Peng Fan To: , Date: Fri, 23 Sep 2016 10:55:34 +0800 Message-ID: <1474599334-30709-1-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 2.6.6 MIME-Version: 1.0 X-Originating-IP: [123.151.195.53] X-ClientProxiedBy: SIXPR01CA0036.apcprd01.prod.exchangelabs.com (10.163.105.164) To VI1PR0401MB1807.eurprd04.prod.outlook.com (10.165.234.157) X-MS-Office365-Filtering-Correlation-Id: fa091ee0-d2c4-4ab1-8ac7-08d3e35d2513 X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401M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WraPvVvHdxOQKla9it4czIO2Tv1sQSgmQuC4xfTkdWO3HainmjvcMCfmxhOCx39TkXH0jIBjFut9SnJ3NXzXAANbYQossLA/9zvRL/bjD/DerRcF0lm72WRqeKGh/QZUfcm3Eiq+GTrr5dv8cw8MCKxftc4B11QkyP5FvNmgxJG7QgdiSk6UyjkWAfbfzc5uza6cYttpk9tlEhulC4ZJmkbNHNtXACs= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB1807; 31:/t9UpAPmjh/ugd9peMD6E5dDnnJnMBDiH4CPjcz6aeM8Ff/CzS2jiCD1EWpDzjMi8umPdpavHw9aXVp5E8DgJGtxFsFlzsWsTHVnTZ6G/HsJid5LOKqkO7Wceor4eaVqc9V1qeo7NuzEsXpnuFyqMbZPsFHqFmTdPOm9o6d0fPOBWBmA0ZtJeFio+WSWNYZvSS4CTAs/dIB4iul6Qhr6yaji0hPyG756F8B69hk6opg=; 20:2AccMKdPnaA0Ng6XqGyFTnPEyLsE8gqmwWecqx+mtF4uIY0+U1TryvzzWe7c8wN/hVNj+zfiu01AB8o0j42CGZORRnIvgsCvln2/NKDMAS/qhTZmF8kd7o6i3V4dIZ2kYXknvNCtVhCNSOsO1+KjfCHd4hupfDI9bCeP7w4EjN9ui2UrkVhza18DnOaIlKXSrGntgdBLwnnT+NDrhqxtdw0VRp1SVlLOX2OvfqwzhuSDJ38QDgsAN6Ajd8teVILhoaRnOHxdwUuWopzD/FA3kV3f1GUZD7sA0509qcHeFDxbf46RFkTKy0dkBnfzeiSj037UWfUmgDuZqhDrHQRGOG2i8DGtYFwLIU2mBjOmng4hDelL0K2B4cCjTi9Vg6ejsCuVoH7NB1QPzRU4juKSaUwENUz8h+O7jbyGtmsujK9USZhihcFruGhjunQTwbbM1u5Rib7yb9oti0YihHH1TG7XSolmrgHLqJuTNMMJ2Y9pSlsr8XMA7rYM82vt4SjO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(185117386973197)(114974198459425); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:VI1PR0401MB1807; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB1807; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB1807; 4:1PbOz7KJBzAdQErKdWTSB0y7cFr3U0up74gotnBJNWPpCgDoFh6hA9NNPiYoX5fSRwoXAZfnv0TQlsuiMDoEKiVsbrHbdG1WnUGucvzJXjRyAbA7bPI6BNwFzrdY9Y7Uan5+6Kschq85P2yVR/cz2bviULjlH5gDYE4yYCHcSvkmdupLHdCktrdUYbcXnUtSu1VkC7YioXbWZ+UhCA/esm2Fp7l/sHG1FBeE7L/Z9Lh/t9EHxQl7xjb63O+F0s38qXbEmlBW8XLlJAJtl/vhAJ5DMwv2TszU+SOSf91XM94xT0LgymVDKheHSc8iTATG42nnLPvNdwvKIN9WxSpC5MAUMxRjfZYxRdW08prfGBJCN9SXsCxJWWq0m0vqg4VEoGbHyohj79B0xwCfSy/sHF3o847RIFwPh9d9W0yj+685KPMgNYXsksPmdgGUjhGfEMVSzcV/9CG6MOwBbuUwTIgVL8tW1u9Js7exS9W4z7gCm98RfqFLI2awwXHmJLkkDp3h2ljsgocBdbc0vyvJxg== X-Forefront-PRVS: 0074BBE012 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(2906002)(3846002)(106356001)(105586002)(6116002)(86362001)(5003940100001)(586003)(50986999)(4326007)(33646002)(42186005)(101416001)(5660300001)(229853001)(92566002)(305945005)(7846002)(7736002)(50226002)(189998001)(68736007)(48376002)(5001770100001)(97736004)(50466002)(8676002)(47776003)(81156014)(36756003)(15975445007)(19580395003)(77096005)(19580405001)(81166006)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB1807; H:linux-u7w5.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0401MB1807; 23:/f8hD7jbQs50IrGIEyQVz5Z15CP56JpVmHozfSp?= =?us-ascii?Q?relUbl4E/kqtcTwqYqgwEjwHy/pYI1O8XB+/w1vh3A/T8myyR8X/hT9BGpFV?= =?us-ascii?Q?7pSZm+VXVJHYNIAtrOdnz5jOuKrmPL7o6fTYNaBpHzs5Z8pEk5WsT/LK2nz9?= =?us-ascii?Q?lsC4CSkJUGa0rWB9tUIOVxgP/CumDJbZNJYEhN5rpH1j/DVC3PmdiK91zXw2?= =?us-ascii?Q?NB9V4VqoxlPvtPyZo9hPqCES6UiiqJwt2inrXZ2QQRkKJBKxnyWnYhP5duvH?= =?us-ascii?Q?HPwPGHpnjWNyTxkwGobNfGhy6xuBWIERD0+5IRklS6OcNU4JtDfI+2SdVBgX?= =?us-ascii?Q?bwXAyMehdRGnfw6Hlqvw9LqtTWLKTHnEAFS4MqBvkXREBHDqX2xiWkkQis7w?= =?us-ascii?Q?MIEPyL8wgDzoUUoNb450EwFSKeDzGmGoB/rFPk+S5OXF3yoXkJFhAGgQI5R+?= =?us-ascii?Q?hx8DeR239OzIxnYmcB43WoHXDUhJudWSthzMqpKw0Q6t7hnGikdKHgx0Z29S?= =?us-ascii?Q?9y2fC/gQaddvBWdUDeL3S9b/+qs7gOKui3iwRQq0JyGTatmuGJfhB8K70Ilo?= =?us-ascii?Q?0HEI+cMDfJVtNHiRoYx3O3ttNDkL6w3+Wd4qS2nNSnMwUWIPu37LQQ+cxPba?= =?us-ascii?Q?Qtg6T0UEHpKSCsBiKEe3vpr1eeWHkmD3x/WXms0MdWCNO2zGRtKvhqzIJjHG?= =?us-ascii?Q?gsagnVfMHZ/bhxlUq7Qm1/D/C4UPMe0Ou9khRBDpVLs9/ybVgFiffX6j61Au?= =?us-ascii?Q?25L48rR3svZjbzZxcz8rSiynD9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CHT9asEgrWOn5fOKPyi+uXDsqTOnGiD0EGmKBj2W2AEnV62A1XZ3EUb2Z5QnTEGz/HQ9Ped3FCe1m+a4oaQV5dRnZfwBDo8vMlaNO79psrpP2Dm8sSEbnjHt0gPIlisvCnzesmY8IcQepoaJcwSqa0+DSv2HVoAue6+nW4t7Uj8n4NEdwuRtD+ihN1rE/ymyVw5rXhcg0BB6OjFuA5Cl2wrjeqRpuGgHKWKFk3MhMSn73EIJsSp3ItEcNzt8Y+Q3Yl+dBdFIsC4Zx2mx7LvAG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2016 02:55:56.2987 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB1807 Cc: van.freenix@gmail.com, Peng Fan , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH V4] xen/arm: domain_build: allocate lowmem for dom0 as much as possible X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On AArch64 SoCs, some IPs may only have the capability to access 32 bits address space. The physical memory assigned for Dom0 maybe not in 4GB address space, then the IPs will not work properly. So need to allocate memory under 4GB for Dom0. There is no restriction that how much lowmem needs to be allocated for Dom0 ,so allocate lowmem as much as possible for Dom0. This patch does not affect 32-bit domain, because Variable "lowmem" is set to true at the beginning. If failed to allocate bank0 under 4GB, need to panic for 32-bit domain, because 32-bit domain requires bank0 be allocated under 4GB. For 64-bit domain, set "lowmem" to false, and continue allocating memory from above 4GB. Signed-off-by: Peng Fan Cc: Stefano Stabellini Cc: Julien Grall Reviewed-by: Julien Grall --- This patch is to resolve the issue mentioned in https://lists.xen.org/archives/html/xen-devel/2016-09/msg00235.html Tested results: (XEN) Allocating 1:1 mappings totalling 2048MB for dom0: (XEN) BANK[0] 0x00000088000000-0x000000f8000000 (1792MB) (XEN) BANK[1] 0x000009e0000000-0x000009f0000000 (256MB) 1792M allocated in 4GB address space. V4: Address comments in V3: https://lists.xen.org/archives/html/xen-devel/2016-09/msg02499.html Drop uneccessary check when failed to allocate memory under 4GB Refine comments according to Julien's suggestion in V3. Keep "bits <= (lowmem ? 32 : PADDR_BITS)", but not changed to "bits <= 32" V3: Add more commit log Add more comments Add back panic if failed to allocate bank0 under 4GB for 32-bit domain. V2: Remove the bootargs dom0_lowmem introduced in V1. Following "https://lists.xenproject.org/archives/html/xen-devel/2016-09/msg01459.html" to allocate as much as possible lowmem. xen/arch/arm/domain_build.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 35ab08d..6b5ac8d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -195,9 +195,9 @@ fail: * bank. Partly this is just easier for us to deal with, but also * the ramdisk and DTB must be placed within a certain proximity of * the kernel within RAM. - * 3. For 32-bit dom0 we want to place as much of the RAM as we - * reasonably can below 4GB, so that it can be used by non-LPAE - * enabled kernels. + * 3. For dom0 we want to place as much of the RAM as we reasonably can + * below 4GB, so that it can be used by non-LPAE enabled kernels (32-bit) + * or when a device assigned to dom0 can only do 32-bit DMA access. * 4. For 32-bit dom0 the kernel must be located below 4GB. * 5. We want to have a few largers banks rather than many smaller ones. * @@ -230,7 +230,8 @@ fail: * we give up. * * For 32-bit domain we require that the initial allocation for the - * first bank is under 4G. Then for the subsequent allocations we + * first bank is under 4G. For 64-bit domain, the first bank is preferred + * to be allocated under 4G. Then for the subsequent allocations we * initially allocate memory only from below 4GB. Once that runs out * (as described above) we allow higher allocations and continue until * that runs out (or we have allocated sufficient dom0 memory). @@ -244,7 +245,7 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo) unsigned int order = get_11_allocation_size(kinfo->unassigned_mem); int i; - bool_t lowmem = is_32bit_domain(d); + bool_t lowmem = true; unsigned int bits; /* @@ -269,20 +270,30 @@ static void allocate_memory(struct domain *d, struct kernel_info *kinfo) { pg = alloc_domheap_pages(d, order, MEMF_bits(bits)); if ( pg != NULL ) + { + if ( !insert_11_bank(d, kinfo, pg, order) ) + BUG(); /* Cannot fail for first bank */ + goto got_bank0; + } } order--; } - panic("Unable to allocate first memory bank"); - - got_bank0: + /* Failed to allocate bank0 under 4GB */ + if ( is_32bit_domain(d) ) + panic("Unable to allocate first memory bank."); - if ( !insert_11_bank(d, kinfo, pg, order) ) - BUG(); /* Cannot fail for first bank */ + /* Try to allocate memory from above 4GB */ + printk(XENLOG_INFO "No bank has been allocated below 4GB.\n"); + lowmem = false; - /* Now allocate more memory and fill in additional banks */ + got_bank0: + /* + * If we failed to allocate bank0 under 4GB, continue allocating + * memory from above 4GB and fill in banks. + */ order = get_11_allocation_size(kinfo->unassigned_mem); while ( kinfo->unassigned_mem && kinfo->mem.nr_banks < NR_MEM_BANKS ) {