From patchwork Thu Oct 17 20:07:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Woods X-Patchwork-Id: 11197089 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D79E5912 for ; Thu, 17 Oct 2019 20:09:37 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B30C520869 for ; Thu, 17 Oct 2019 20:09:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="NZFed5DY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B30C520869 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLC46-0002OD-4f; Thu, 17 Oct 2019 20:08:06 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLC44-0002O8-Qg for xen-devel@lists.xenproject.org; Thu, 17 Oct 2019 20:08:04 +0000 X-Inumbo-ID: d3433c52-f119-11e9-93d7-12813bfff9fa Received: from NAM02-CY1-obe.outbound.protection.outlook.com (unknown [40.107.76.81]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d3433c52-f119-11e9-93d7-12813bfff9fa; Thu, 17 Oct 2019 20:08:03 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VNRCpS5NaCGtVKBTlyvoH3/1kkCW/DeTQj79+KBONR3z/rHX8rNymMSQmw0+up6wCBQmL6ccN2QkfBg+Hjp+PVPMzJel6CFv7KMaJ/QN9eqyG6QaEVPOftO+kctN/1MYBvL+8AWqEK6V4/IlI83NkgwOCzY/BWP6s8E0qM+y3vzzP5L0vXugNkXA41Q1s3Y9FU7YPzY8Xf/aCbhKYDgTLhfpwLiUJYeM4RNYiQKDhfZt+domYfbs8w43BuKo3vmrFTRMUVVH8h671w8Gppy7f4QkR003h+a2R3HnnHEEuCx9FFZ//f/UDiVdlsSBZJAmIE/FkPXlFXOwyJA2cILaMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+6aqsrlVx+M4Yaf0+/zrHQY0vg69SlIZH0Lw6B9X3E8=; b=kXLzWw3CVtouyN2ipqqKs+FwPPjCd+N/BWQRSRrvIwe3LVe6gbFeTLiEzdaQnCfv78oOW+7nNzawEsKFKe+CqeMoZE6XRk0vmWJnEZQp/QQMpB99+4NNSAdi9MzBunXU7g+2scCF0nL5qywMkL9Dwb4v8Ui7FXGOFAmfVZ2qeB4M9ARWGVejSvMzhTx1KscLwA4y0T4lh6lm7S8cfBh+eIIm6RGGFar5Bvt3sy+G6h/x3MAEdugI9htNMo/xbpehEc98tu94Woto7JcMk+JqFAweyLpCU7jhBqehSZK1tjtVuOryFUqoAVJCYtdREP2Q+J6B/zKRNcS1kxJZPyBOfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=epam.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+6aqsrlVx+M4Yaf0+/zrHQY0vg69SlIZH0Lw6B9X3E8=; b=NZFed5DYq2k3YJ1c8GMbqhiL8OrazqtOWJN1/2lwv4J4oxitoaaiuaojoonwAKtSihGSPTCystCQuNR+YY9nf1yJaCSpKmEqFeNLLznqhkqzKvuYJp+Ka+lfIDry23xp7kSGJ14qy4fSroUCO58pug4z6y9hQnY0or0vI/D03F0= Received: from SN4PR0201CA0068.namprd02.prod.outlook.com (2603:10b6:803:20::30) by BL0PR02MB3796.namprd02.prod.outlook.com (2603:10b6:207:48::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Thu, 17 Oct 2019 20:08:00 +0000 Received: from SN1NAM02FT025.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::203) by SN4PR0201CA0068.outlook.office365.com (2603:10b6:803:20::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.18 via Frontend Transport; Thu, 17 Oct 2019 20:08:00 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; epam.com; dkim=none (message not signed) header.d=none;epam.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT025.mail.protection.outlook.com (10.152.72.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 20:08:00 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iLC3z-0002JZ-PX; Thu, 17 Oct 2019 13:07:59 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iLC3u-0002IJ-MD; Thu, 17 Oct 2019 13:07:54 -0700 Received: from xsj-pvapsmtp01 (maildrop.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id x9HK7npR022748; Thu, 17 Oct 2019 13:07:49 -0700 Received: from [172.19.2.62] (helo=xsjwoods50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iLC3p-0002HY-3b; Thu, 17 Oct 2019 13:07:49 -0700 From: Brian Woods To: xen-devel@lists.xenproject.org Date: Thu, 17 Oct 2019 13:07:40 -0700 Message-Id: <1571342860-15838-1-git-send-email-brian.woods@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1570650447-3225-1-git-send-email-brian.woods@xilinx.com> References: <1570650447-3225-1-git-send-email-brian.woods@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(199004)(189003)(4326008)(426003)(6916009)(305945005)(36386004)(11346002)(486006)(476003)(2616005)(14444005)(126002)(336012)(2906002)(70586007)(48376002)(446003)(44832011)(70206006)(50226002)(8936002)(8676002)(9786002)(81166006)(81156014)(2361001)(2351001)(498600001)(36756003)(5660300002)(26005)(186003)(86362001)(47776003)(7696005)(76176011)(51416003)(50466002)(54906003)(6666004)(106002)(16586007)(356004); DIR:OUT; SFP:1101; SCL:1; SRVR:BL0PR02MB3796; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; A:1; MX:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 483cd3a1-1bc0-48af-4c52-08d7533db5bb X-MS-TrafficTypeDiagnostic: BL0PR02MB3796: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:595; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HeN1AR+as6qtmYersEqM4SbCcfl8FYzN1Cdz398qXND4ipLTZXOh8umaRqds87CRSInLJpWcHOBjy/UOSNmnRTUtlsEpdROOesJoZGGojbOArnDiMfwBK3f4CzknJv32n8f9+hTmFEc7JYFLO2qRMES3qrYWiJolTmcMc6nyBHNjFIG2cabGx77J94fRIiojT5X6gMWZbxODqB0dasXVg3yxZZo2kxe6U9pNaniUOraLboRjaDKtlRXl1Jym2uI8YMn7D1FzPqDMUigyzlUFyHm4w/LkX9KggeezdlyW9z/OA1r/Sennqzfw0sGI4Diir06YOQNVSsjgqdaE7/MNOU0nKmZgjPnrT8cEqiip3VCIXTzQKxleXv7IMJlHU8hi8T39lvGYx4Yva7ONrtPY6XDVF9SsFbdqUs8Vr7gaH4g= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 20:08:00.1784 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 483cd3a1-1bc0-48af-4c52-08d7533db5bb X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB3796 Subject: [Xen-devel] [PATCH v2] xen/arm: add warning if memory modules overlap X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Brian Woods , Stefano Stabellini , Julien Grall , Volodymyr Babchuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" It's possible for a misconfigured device tree to cause Xen to crash when there are overlapping addresses in the memory modules. Add a warning when printing the addresses to let the user know there's a possible issue. Signed-off-by: Brian Woods Nacked-by: Julien Grall --- v1 -> v2 - removed nested loop and placed check in add_boot_module() Sample output: ... (XEN) MODULE[0]: 0000000001400000 - 0000000001542121 Xen (XEN) MODULE[1]: 0000000003846000 - 0000000003850080 Device Tree (XEN) MODULE[2]: 0000000003853000 - 0000000007fff676 Ramdisk (XEN) MODULE[3]: 0000000000080000 - 0000000003180000 Kernel (XEN) RESVD[0]: 0000000003846000 - 0000000003850000 (XEN) RESVD[1]: 0000000003853000 - 0000000007fff676 (XEN) (XEN) WARNING: overlap detected in the memory module addresses (XEN) (XEN) Command line: console=dtuart dtuart=serial0 dom0_mem=1G bootscrub=0 maxcpus=1 timer_slop=0 ... xen/arch/arm/bootfdt.c | 4 ++++ xen/arch/arm/setup.c | 6 ++++++ xen/include/asm-arm/setup.h | 1 + 3 files changed, 11 insertions(+) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index 08fb59f..f8b34d4 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -387,6 +387,10 @@ static void __init early_print_info(void) mem_resv->bank[j].start + mem_resv->bank[j].size - 1); } printk("\n"); + + if ( mem_module_overlap ) + printk("WARNING: overlap detected in the memory module addresses.\n"); + for ( i = 0 ; i < cmds->nr_mods; i++ ) printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start, cmds->cmdline[i].dt_name, diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 705a917..315a131 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -69,6 +69,8 @@ integer_param("xenheap_megabytes", opt_xenheap_megabytes); domid_t __read_mostly max_init_domid; +bool __initdata mem_module_overlap; + static __used void init_done(void) { /* Must be done past setting system_state. */ @@ -254,6 +256,10 @@ struct bootmodule __init *add_boot_module(bootmodule_kind kind, mod->domU = false; return mod; } + + if ( ((mod->start >= start) && (mod->start < start + size)) || + ((start >= mod->start) && (start < mod->start + mod->size)) ) + mem_module_overlap = true; } mod = &mods->module[mods->nr_mods++]; diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 2f8f24e..4bb1ba1 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -122,6 +122,7 @@ void device_tree_get_reg(const __be32 **cell, u32 address_cells, u32 device_tree_get_u32(const void *fdt, int node, const char *prop_name, u32 dflt); +extern bool mem_module_overlap; #endif /* * Local variables: