From patchwork Mon Apr 18 09:07:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9C894C433FE for ; Mon, 18 Apr 2022 09:09:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307049.522312 (Exim 4.92) (envelope-from ) id 1ngNNW-0007Ct-Ep; Mon, 18 Apr 2022 09:09:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307049.522312; Mon, 18 Apr 2022 09:09:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNNW-0007Cm-BB; Mon, 18 Apr 2022 09:09:02 +0000 Received: by outflank-mailman (input) for mailman id 307049; Mon, 18 Apr 2022 09:09:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNNV-0006ub-EY for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:01 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on061e.outbound.protection.outlook.com [2a01:111:f400:fe06::61e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2f58788e-bef7-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 11:09:00 +0200 (CEST) Received: from AS9PR04CA0057.eurprd04.prod.outlook.com (2603:10a6:20b:46a::17) by PAXPR08MB7089.eurprd08.prod.outlook.com (2603:10a6:102:200::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:08:58 +0000 Received: from VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46a:cafe::13) by AS9PR04CA0057.outlook.office365.com (2603:10a6:20b:46a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:08:58 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT045.mail.protection.outlook.com (10.152.19.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:08:57 +0000 Received: ("Tessian outbound ac9bb5dd84f6:v118"); Mon, 18 Apr 2022 09:08:56 +0000 Received: from e904b8361973.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 07049532-8FD6-4FEA-BCB0-EEAFAB37F2F0.1; Mon, 18 Apr 2022 09:08:50 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e904b8361973.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:08:50 +0000 Received: from AS8PR04CA0148.eurprd04.prod.outlook.com (2603:10a6:20b:127::33) by AM5PR0801MB1972.eurprd08.prod.outlook.com (2603:10a6:203:4b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Mon, 18 Apr 2022 09:08:48 +0000 Received: from VE1EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:127:cafe::78) by AS8PR04CA0148.outlook.office365.com (2603:10a6:20b:127::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:08:48 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT020.mail.protection.outlook.com (10.152.18.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:08:47 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:08:46 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Mon, 18 Apr 2022 09:08:44 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:08:42 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2f58788e-bef7-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FIw93tJ3H+SfJwxD5M/sOYcJYzkHITrNvMbzRUuV10w=; b=nI5PJ/2apY4zRDuBKuJiTRS5Dlnw6e7il1gzcfWEFnE6UKQ3a+Sjp3IqisvxYNr7Khog7PT/MD3h4tAR1qYjr8BIskaZiehm7FwOTKHa0ZIHatTVJsCSZ3phy7nOWf0+IqYJJBw3vn3S+V2FnpLoFH4aydCxW9JrzUiHIiNcNzI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 2363d4b466de078c X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RzoFdnGDJnskow1Ky3YI5yjPDXf7PkzJ4O7gUvM+/onqmxm5RX5xcNPsWjgu5faqpqM7WpWzcsaynu17lXIhnLZxWvKl2TdFJh9VTyNOtSZ5EfI2c4gu+3TTpyGUBnB4qWarQSyzlRP25MSCGFE6S5hYPomUONn0Y4e024X73zKl8U4tOLk42zir66tzIHg/K7jOHse8kfBzF9H/rKrnN6wcK9e7jf3p4x8fU5RLzm8ZxYOuAN10N8MvEDMg0Q1tpGnDoyaAKV/FqugJvMcqH8CfZytH0MLdIDxBeIflpMh1mSSokxCTpr/xbhEzjMB2SUYYRd0RhBDiDeeBQvJ1jQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FIw93tJ3H+SfJwxD5M/sOYcJYzkHITrNvMbzRUuV10w=; b=b9Hf+f/t5UF9Z1H4gBgpnLVEDhVPWfJtF7srDN659wSrn9bQ81QUbFfqUuTHgxfE7M+vBsCyr62ba/uyiis2xrEulLjbhGYOwt1FdfSmuP+xCbjiGiqFf+P9ac1riVKftkXo+Q0Opv7TdJdEa7Ho0wWK2rSWLujvGaLcnm5YXRKXEw2q8QfKi+ov0Tki5lKBmIe2sFerGcfHTl3g4hfVT7IoNjpt9csT6tZC8KL/a/bIZOKGHI9HAo2jMirSHJhE5VTeaXUhP1TbLeUFDvP4U5xwiKsburwUcaZMX6wq1fTmA4f9r3QXU8AU7BIHLqyS+0x+GBuKDbxhT+vcTvybgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FIw93tJ3H+SfJwxD5M/sOYcJYzkHITrNvMbzRUuV10w=; b=nI5PJ/2apY4zRDuBKuJiTRS5Dlnw6e7il1gzcfWEFnE6UKQ3a+Sjp3IqisvxYNr7Khog7PT/MD3h4tAR1qYjr8BIskaZiehm7FwOTKHa0ZIHatTVJsCSZ3phy7nOWf0+IqYJJBw3vn3S+V2FnpLoFH4aydCxW9JrzUiHIiNcNzI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Julien Grall Subject: [PATCH v2 01/10] xen/arm: Print a 64-bit number in hex from early uart Date: Mon, 18 Apr 2022 17:07:26 +0800 Message-ID: <20220418090735.3940393-2-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 212121c3-b22f-43b3-f3c6-08da211b11ee X-MS-TrafficTypeDiagnostic: AM5PR0801MB1972:EE_|VE1EUR03FT045:EE_|PAXPR08MB7089:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: JymwDniJCB3u+g3PmTSrn9f2tp4UHCiROgez7VHxj9XkAA2WRClZLTGZ6zxixnzVJDE2Rmpx+GXv/gjh8LmFMZLDPZhYdDg8O6JK0UFuSaP0XYHBLqVF7DqrWkZboaxY/LXC0rONRzafGyrk19LePpJQ0cwq0QnarEjXsfH6gEH2shsGva9wo2VkCVMk2tdlCBToTPBhUfSgN90khvuUcsJbh1IJT5H71qv4v0qtWHAFVbsbiqdqj3NtJYuG9daN6xyYAKHvNHatLMFhlOW+jhnE6UAveAFcY8lsQkr1ecgYka9NACJBDH3TVH2UhVgVK9ibK6lqDTRU4/Tic/MU1GPMpoxiqtca18kS9XLNAqCQpE/DwijLH8H/RnOeGpTAJ/R6ws1lZGv7RLH7oLsut1FKtYacLczzojyA4WH4EXrRhj9hLbBdvXIzxguXq1GDlgApjC319WCyHCXWCYtNV3Eu+CeGurRKvlmOgZIv8hE6qDa/ydeYFI5d6h1phFwUQVBp594u/4tHbLQMRpJwrc8LKo+ByoNNslO6NErbNTfk8fgDxJ6fvozuVojiWz3yMTuPSinyHhCElfWC0MwfLv+2tPqetlunObLlSEubDyFYZE3zXWnKfPzQaRiNXSPz/wZb0XoGSSHYEm0qrK46QMk1NilXEUmqq/DSE0aSqPFF4uYOzaFSQcRaKXA+xaM0U3yOQ3h934TmdLan5mPGUg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(356005)(8676002)(508600001)(4326008)(40460700003)(70586007)(44832011)(5660300002)(6666004)(81166007)(8936002)(2906002)(83380400001)(426003)(336012)(70206006)(26005)(7696005)(186003)(1076003)(110136005)(54906003)(86362001)(316002)(36756003)(47076005)(82310400005)(36860700001)(2616005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1972 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8acaf597-ff42-42ce-0ace-08da211b0c28 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mUEQJTf5bR60qaye7+ufanAlkWIyCjOHO/phoTSP+UiJjdG5FWeRmb3z7y6GVw3BKdnok/HBte/S/cPJZ+PwGPxNtkHdYyT6+DU7FPMavHWQNf1aCYHrXCfbLiyAPGQFunSFDV+JQdExhQ+01R+l6rj/IdwCxqX/TxD2vZVJHOIWGqyxrxOJLczlpDquBmg+XVODq87T8YG2JdlRQ8CSRdOdWxh4JYYvEFt+3QyB74wC9bIXrC7tm35xAO2lJony91JGBTwizKc5whodpxIB9ZCmMwVTNZUcoHvrYssZByuqnZeNjT9C/J/ivN/ZZ28gKrUYFZzbmRU+A2XajqHVqBYWeOh9KukdMHgRTvhmxOqrQVilXzKiFSpcyqPjRqQaPVFpAwiHLPfb0cEALuD52pLtnnNAPZhU1n4RCSsG6TQTviTu24fbIAllQAOMj8LBasVX13ygDdyEHmPdSJuMn6U8xBM4TthAsarSOv/kDeENDBS6ZHdsfC06jd2agnaBlc4Wfzm6LCXYtQmB726xD6NaiCCxqWKTB/LtO52tyXzny+HDmqjzDjmk+tIowiW0O80NqqHihrUchtNLvCmfvoeb6Ht2zR+ICjzEXb2L67LvIHPEiFA5ilzekVNdbI6isxmVlWVdrCadEwVV4UNwSfhs+hkibeAjnQre8z5UHC5qxAflfQcyfp4K4b/tmLCj X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(4326008)(40460700003)(70206006)(70586007)(36756003)(336012)(8936002)(5660300002)(508600001)(1076003)(2616005)(186003)(44832011)(426003)(86362001)(2906002)(8676002)(107886003)(81166007)(47076005)(36860700001)(110136005)(54906003)(316002)(82310400005)(450100002)(6666004)(26005)(7696005)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:08:57.3490 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 212121c3-b22f-43b3-f3c6-08da211b11ee X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7089 Current putn function that is using for early print only can print low 32-bit of AArch64 register. This will lose some important messages while debugging with early console. For example: (XEN) Bringing up CPU5 - CPU 0000000100000100 booting - Will be truncated to (XEN) Bringing up CPU5 - CPU 00000100 booting - In this patch, we increased the print loops and shift bits to make putn print 64-bit number. Signed-off-by: Wei Chen Acked-by: Julien Grall Tested-by: Jiamei Xie --- xen/arch/arm/arm64/head.S | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index e62c48ec1c..2bb7906f69 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -866,17 +866,19 @@ puts: ret ENDPROC(puts) -/* Print a 32-bit number in hex. Specific to the PL011 UART. +/* + * Print a 64-bit number in hex. * x0: Number to print. * x23: Early UART base address - * Clobbers x0-x3 */ + * Clobbers x0-x3 + */ putn: adr x1, hex - mov x3, #8 + mov x3, #16 1: early_uart_ready x23, 2 - and x2, x0, #0xf0000000 /* Mask off the top nybble */ - lsr x2, x2, #28 + and x2, x0, #(0xf<<60) /* Mask off the top nybble */ + lsr x2, x2, #60 ldrb w2, [x1, x2] /* Convert to a char */ early_uart_transmit x23, w2 lsl x0, x0, #4 /* Roll it through one nybble at a time */ From patchwork Mon Apr 18 09:07:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EA23FC433EF for ; Mon, 18 Apr 2022 09:09:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307056.522329 (Exim 4.92) (envelope-from ) id 1ngNNp-0007tL-E2; Mon, 18 Apr 2022 09:09:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307056.522329; Mon, 18 Apr 2022 09:09:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNNp-0007rX-3o; Mon, 18 Apr 2022 09:09:21 +0000 Received: by outflank-mailman (input) for mailman id 307056; Mon, 18 Apr 2022 09:09:19 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNNn-0007Zt-IQ for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:19 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2060d.outbound.protection.outlook.com [2a01:111:f400:7e1b::60d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 397f129c-bef7-11ec-a405-831a346695d4; Mon, 18 Apr 2022 11:09:18 +0200 (CEST) Received: from AS9PR06CA0314.eurprd06.prod.outlook.com (2603:10a6:20b:45b::16) by GV2PR08MB8027.eurprd08.prod.outlook.com (2603:10a6:150:77::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.29; Mon, 18 Apr 2022 09:09:14 +0000 Received: from VE1EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45b:cafe::e7) by AS9PR06CA0314.outlook.office365.com (2603:10a6:20b:45b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Mon, 18 Apr 2022 09:09:14 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT037.mail.protection.outlook.com (10.152.19.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:14 +0000 Received: ("Tessian outbound 9613c00560a5:v118"); Mon, 18 Apr 2022 09:09:13 +0000 Received: from 34f05a90a264.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 517773D1-31C0-4A4B-BE16-A9622B197C53.1; Mon, 18 Apr 2022 09:09:07 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 34f05a90a264.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:07 +0000 Received: from AS9PR04CA0099.eurprd04.prod.outlook.com (2603:10a6:20b:50e::22) by AM6PR08MB3768.eurprd08.prod.outlook.com (2603:10a6:20b:90::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:05 +0000 Received: from VE1EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:50e:cafe::cd) by AS9PR04CA0099.outlook.office365.com (2603:10a6:20b:50e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:09:05 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT051.mail.protection.outlook.com (10.152.19.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:04 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:02 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:00 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 397f129c-bef7-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hKhGWgAz7VOd0X/bf4Vgu84CVR+pM2MueQtIIaIgjYw=; b=em5bSzYnov4JJhMJs5UnjOdhKnbfxDzdIgrxZXCiWpmzYDdl7L/RFfARfUH7AL/ZVZPLCGzpuZU8DFXrYwTKBncDdRMRCBkfKmPGDg17jrRoo5Lx5c0F+YC9xaSV4QOWUGAecgtRR/fU1FhYdUoQh2aPhEojNgskWFRxZ6MBKsk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 9baa8cfa302fb627 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F9NxgDoGs2mP7ZgvvucXHIcAPQEgCXPKG/YM8/BIKG+9IPokoUmiemn2k083mD7+frthxfecocMB79REkFVY/7CcubbEGjXdgkZc5HjINpaC05//m14ZtWeMjscG7hPAwaPDcgrfmiXdWnp/J/jkqpXFGJT8WY/mene+eY+EdKvyDB9eBZMVpIqeRRFxfzim3nyzYxqqxSWeFXxTUQb9DNHE9ILWUkkBT3xTajhvetZunzFWSzM7IFSuX3075QPedjv49o9HUCWB3wQpZgF81B1ZU18Mpex4fk6YAwESWDkHYp94MY1SMdnS7BxjHC4lrb4Ahkgbyc5KB1ZsUZAV6g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hKhGWgAz7VOd0X/bf4Vgu84CVR+pM2MueQtIIaIgjYw=; b=CYY9zLdZsWsiDOJG9eQzaAgmz2LqX+pvY0lvgJ/7hbS/FHEl0eYNqJNK25ElATPA2+SGC9JD4AXx2SUhU0foxh+kWaHe/BsfunLLb5CgazCQqmt/s5nK3XwRFJE2MXSSyadiRJDaYie9gysiVGQztYPTnHJZ9azRK1akpOnVPXbWYJcajFfkU29bfFNTPSVeFGmVbQg24XGPP7+BSi7/xqpAzgyTaDEVdB9sCHbpGdYogYnA5aJByCNChq7QS8DerKEcfvcNj9ML9GVmt6yYMUBbuk9BHJSszR2xjwhPBefoIvYrummHCTDj5hmmTPF3S376YOHvGzr7IjsXhLgYdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hKhGWgAz7VOd0X/bf4Vgu84CVR+pM2MueQtIIaIgjYw=; b=em5bSzYnov4JJhMJs5UnjOdhKnbfxDzdIgrxZXCiWpmzYDdl7L/RFfARfUH7AL/ZVZPLCGzpuZU8DFXrYwTKBncDdRMRCBkfKmPGDg17jrRoo5Lx5c0F+YC9xaSV4QOWUGAecgtRR/fU1FhYdUoQh2aPhEojNgskWFRxZ6MBKsk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v2 02/10] xen/x86: move reusable EFI stub functions from x86 to common Date: Mon, 18 Apr 2022 17:07:27 +0800 Message-ID: <20220418090735.3940393-3-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 3bb0308f-f56b-40dc-a080-08da211b1bf6 X-MS-TrafficTypeDiagnostic: AM6PR08MB3768:EE_|VE1EUR03FT037:EE_|GV2PR08MB8027:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: nPhU5GAwzl4cbqeWymZlcWm9ejTGEJ8V56FpA0XINtwGGCHrXAL+PbqIrcTu9CWrAJaZW5aU7ZFcUljnebPAE4PjMEYtDHoB3YHMY/lnMbxcBfHj9wdraJP0m+Qq/5JNmw9q8UezFwDX0o2ucD1bnRg2MkpEXeytqrx4s8lfdUQZEsmXUICwR/veaR0eQqOUj3R0IPM/KvFSXc+xTV8sg9ORUMzp8mEWU6+565d0Gy3sKGb+kH4fLWYkVAOZ0HLS9DCDTEcHloDoXCMpLfQlf8vlmZf3kdqb4/rXUVtcAyJjjPXoBtTXFCMqB+7lYXbb0j6lnVEM8kpfBDhkr1FntN87NzZalQl1pSDQCzdkf1A9qfCOifs/T2LiT8awt5xuiwpZRoKlABXNB+KlON+OkAqzu8+2JW/+C88gG6J8M+dGplROF5fsygLoHNZ8MBY3j6jL675kIutuj9+2M4UxJTox6lLudFTuoU9Bt/iSF5n7yM+Ky2jTkTCUHlEsab9iD0pyL3jRhb8uT3wnoA+TXSmX4pu2MmrmrfzmCkf3TzHN5tadiZ2aejQrLMA63lvp7wqcq3COxl2YMLM4OUFDUC1Lb54WCmeCcq5tl4krBAs/ikfH/ykMAiknLIThYg8X9UgZnj2ocvqRwaaFT18IMszNr3LDPTuiwi+70V4T30u2lxrIETZ4qfimpchSjQ7arEm/xJftuKNA+oYIbU+XsQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(83380400001)(2906002)(40460700003)(70586007)(70206006)(44832011)(4326008)(8676002)(26005)(5660300002)(186003)(1076003)(86362001)(6666004)(8936002)(2616005)(7696005)(47076005)(356005)(508600001)(336012)(36756003)(82310400005)(36860700001)(426003)(54906003)(316002)(110136005)(81166007)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3768 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0f4cbbba-1f71-490f-c943-08da211b163c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JbkXeTDt1x5JrTLySBhvZ5V7uZQE1YZnMnCLNy1uyC8+DddhDEF/nLr+cbsPEwu/K8ngd/bsGWNDGN0W4KOAQBC0Mg5zJKCtsP1+4tudkoWcSCLIwy7g0pGyW6xUrum49yYoZ5TFd8m7NjvWjkfFpOWTBZC8DqV1wvfR/FnCYrI/uc05ZT9dEmGuNgOxT3u46rDYF4StJi2hVAN5JgsGzLhF2UasX5vPXwXJLtpZnZSlZf7IikRXo7PGwUpTpJ33E34pJMqMw96sLFnI2YJODycjRjDKqA2xGheruOz6wsANx776bmLbmBjvJqdktNdv14ascrCtTEhmmatpCaf2nhkPrk2iEmZsvnnt0Arh/0Qhe1QSS28xhXYqcl0OM3Ux3RFtjoXKj9UA+7xQg6PlRbJKZhFseLi3x9jbeXTBE8R5f5OLocU9UMa2Lqv1t0eNsY9Mt3U4y7NYwNd6Bm2kWLoEa98Ijnu7gpkVRgB4DSbOnyDWF4cq4o4DwSzB9I04BeKDxSzyIzp4wJR3ucz7n2C0/WTD3SDO1KedPZHEa9AdkThBHwKIq6LZxs3vu1S9/93YmqD2g3Yl6PVda1DUcDABNQCCfEl5VEyEyxc62PmXsy8NptRfvyR/emePBbIKT4tRU3L/0WjHbS4oU7YN0j7Oo0X/tEm1QGRm/NVQJ+XWL7fOtFq7Q+qnRh1qoxGq X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(36756003)(40460700003)(26005)(86362001)(110136005)(2616005)(81166007)(36860700001)(186003)(7696005)(6666004)(336012)(5660300002)(44832011)(8936002)(508600001)(426003)(83380400001)(70586007)(450100002)(82310400005)(1076003)(2906002)(54906003)(4326008)(316002)(70206006)(8676002)(47076005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:09:14.1921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3bb0308f-f56b-40dc-a080-08da211b1bf6 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8027 Most of the functions in x86 EFI stub.c can be reused for other architectures. So we move them to common and keep the x86 specific function in stub-x86.c. Signed-off-by: Wei Chen Reviewed-by: Stefano Stabellini --- v1 -> v2: 1. Drop the copy of stub.c from Arm EFI. 2. Share common codes of x86 EFI stub for other architectures. --- xen/arch/x86/efi/Makefile | 4 +-- xen/arch/x86/efi/{stub.c => stub-x86.c} | 37 ------------------------ xen/common/efi/stub.c | 38 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 39 deletions(-) rename xen/arch/x86/efi/{stub.c => stub-x86.c} (71%) create mode 100644 xen/common/efi/stub.c diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 034ec87895..5ca3a0b4a4 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -11,8 +11,8 @@ $(obj)/boot.init.o: $(obj)/buildid.o $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4) $(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary := $(cflags-stack-boundary) -obj-y := stub.o +obj-y := stub.o stub-x86.o obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y)) obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y)) extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o -nocov-$(XEN_BUILD_EFI) += stub.o +nocov-$(XEN_BUILD_EFI) += stub.o stub-x86.o diff --git a/xen/arch/x86/efi/stub.c b/xen/arch/x86/efi/stub-x86.c similarity index 71% rename from xen/arch/x86/efi/stub.c rename to xen/arch/x86/efi/stub-x86.c index 9984932626..2cd5c8d4dc 100644 --- a/xen/arch/x86/efi/stub.c +++ b/xen/arch/x86/efi/stub-x86.c @@ -1,7 +1,5 @@ #include -#include #include -#include #include #include #include @@ -45,11 +43,6 @@ void __init noreturn efi_multiboot2(EFI_HANDLE ImageHandle, unreachable(); } -bool efi_enabled(unsigned int feature) -{ - return false; -} - void __init efi_init_memory(void) { } bool efi_boot_mem_unused(unsigned long *start, unsigned long *end) @@ -61,33 +54,3 @@ bool efi_boot_mem_unused(unsigned long *start, unsigned long *end) } void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) { } - -bool efi_rs_using_pgtables(void) -{ - return false; -} - -unsigned long efi_get_time(void) -{ - BUG(); - return 0; -} - -void efi_halt_system(void) { } -void efi_reset_system(bool warm) { } - -int efi_get_info(uint32_t idx, union xenpf_efi_info *info) -{ - return -ENOSYS; -} - -int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *) - __attribute__((__alias__("efi_get_info"))); - -int efi_runtime_call(struct xenpf_efi_runtime_call *op) -{ - return -ENOSYS; -} - -int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *) - __attribute__((__alias__("efi_runtime_call"))); diff --git a/xen/common/efi/stub.c b/xen/common/efi/stub.c new file mode 100644 index 0000000000..6e4f4de9af --- /dev/null +++ b/xen/common/efi/stub.c @@ -0,0 +1,38 @@ +#include +#include +#include + +bool efi_enabled(unsigned int feature) +{ + return false; +} + +bool efi_rs_using_pgtables(void) +{ + return false; +} + +unsigned long efi_get_time(void) +{ + BUG(); + return 0; +} + +void efi_halt_system(void) { } +void efi_reset_system(bool warm) { } + +int efi_get_info(uint32_t idx, union xenpf_efi_info *info) +{ + return -ENOSYS; +} + +int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *) + __attribute__((__alias__("efi_get_info"))); + +int efi_runtime_call(struct xenpf_efi_runtime_call *op) +{ + return -ENOSYS; +} + +int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *) + __attribute__((__alias__("efi_runtime_call"))); From patchwork Mon Apr 18 09:07:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8391CC433F5 for ; Mon, 18 Apr 2022 09:09:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307055.522323 (Exim 4.92) (envelope-from ) id 1ngNNo-0007pR-Vs; Mon, 18 Apr 2022 09:09:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307055.522323; Mon, 18 Apr 2022 09:09:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNNo-0007pK-QE; Mon, 18 Apr 2022 09:09:20 +0000 Received: by outflank-mailman (input) for mailman id 307055; Mon, 18 Apr 2022 09:09:19 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNNn-0006ub-1b for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:19 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0618.outbound.protection.outlook.com [2a01:111:f400:fe0d::618]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 39d4040b-bef7-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 11:09:18 +0200 (CEST) Received: from DU2PR04CA0294.eurprd04.prod.outlook.com (2603:10a6:10:28c::29) by DB7PR08MB3161.eurprd08.prod.outlook.com (2603:10a6:5:1d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Mon, 18 Apr 2022 09:09:15 +0000 Received: from DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28c:cafe::d2) by DU2PR04CA0294.outlook.office365.com (2603:10a6:10:28c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:15 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT037.mail.protection.outlook.com (10.152.20.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:15 +0000 Received: ("Tessian outbound 62985e3c34b6:v118"); Mon, 18 Apr 2022 09:09:15 +0000 Received: from 9d98b1640673.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BB27E34A-68A8-4D6E-A93F-CB124D85EABE.1; Mon, 18 Apr 2022 09:09:08 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9d98b1640673.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:08 +0000 Received: from AS9PR06CA0202.eurprd06.prod.outlook.com (2603:10a6:20b:45d::32) by AM0PR08MB4593.eurprd08.prod.outlook.com (2603:10a6:208:fd::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:07 +0000 Received: from VE1EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45d:cafe::d6) by AS9PR06CA0202.outlook.office365.com (2603:10a6:20b:45d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Mon, 18 Apr 2022 09:09:07 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT050.mail.protection.outlook.com (10.152.19.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:06 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:05 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:02 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 39d4040b-bef7-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tvRkI0wVuOuaZghSz7/nXNikDcYdh4Q7PzQrJ96r9QA=; b=YUDKS71MikoJvX65ifqmPpod0KGHhhnq+pzS0w4Rou/tRPHHvB0BhqcCJkvHJiKwFYzS65TqaAbYxiL4YyCwfju+9FM3pgGFWFpzSdd0PuuAPOyhg1XaxON3/J41yMX+3jF06ufHgRqdVqETjerWiSuPubJ7M8gQ5A6x9UgLb/E= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 8506ce5e04c293cb X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oPwufD1BqEtiZBCWKPIhWFqRtCR90lYDMkv5Q7vm9rtS8ZOHru/opEfuIBBUlT4KwvLuFtPLBLY+eW0dAHc8HFB7pyEeQujC9B/91CDvdGeKcK9wmSlCf+6QKtGoU4xBHdTqFXIrhAakkezVr68AqiBEjZJFiEZvmpFiY8bOEW+OrzU9kjVB/3hZAHx4jAKE45km6Ly3ZzIneNQPnvSGHn3hmnAZdJIqErLzlRi8sUFX1AJbO3/7Daebwg/0g5Mdijc6b/H2Bk+rkV8Ca/3ZaOralIMneOen6n91rHJ1gC8Z9QGCvBDg5ZsyBrA5c7erNIkLWB5LTicVaxKjZAzG8Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tvRkI0wVuOuaZghSz7/nXNikDcYdh4Q7PzQrJ96r9QA=; b=cppydxpY1baLhGESuagiuW5xVhmC++ewa3Xy5fV2ZJjxIXDg7C7qvQR2EBz/7KnzDG3o3sj6rgQncrjqWCB/io7IDkjAlK3gjNxajfb/ARX/gyRPEJ5KXGAf4MiKEDR3E0escmYpB1C8LB1UijEfbweESIjy+XxEiQdKp3yDQbUZiWWbxmSrTSXNxf2q1GTjh4WhJx9pRC1/zO1ZeWADoFlmHiwaBAQVyBBWEweXDOHkF1bHulZkhXRSPrENhibRzBv9+ThqUGxrgmO0m8FuG++2cIKic++PlAT3kJGctMZ8cie4fA7+exh7jHBZD69VA1nLMkCKxSyz2z/ImvqQlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tvRkI0wVuOuaZghSz7/nXNikDcYdh4Q7PzQrJ96r9QA=; b=YUDKS71MikoJvX65ifqmPpod0KGHhhnq+pzS0w4Rou/tRPHHvB0BhqcCJkvHJiKwFYzS65TqaAbYxiL4YyCwfju+9FM3pgGFWFpzSdd0PuuAPOyhg1XaxON3/J41yMX+3jF06ufHgRqdVqETjerWiSuPubJ7M8gQ5A6x9UgLb/E= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v2 03/10] xen/arm: add CONFIG_ARM_EFI to stub EFI API Date: Mon, 18 Apr 2022 17:07:28 +0800 Message-ID: <20220418090735.3940393-4-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: f44a135a-5445-481a-9760-08da211b1c7a X-MS-TrafficTypeDiagnostic: AM0PR08MB4593:EE_|DB5EUR03FT037:EE_|DB7PR08MB3161:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: dOXIfggwWPsp+6c2RVO80rNMNXkx9IgEIySwNoUJbD4Dqkpy/O+17fQDzLLTyAOOjO3+pZg44A8BYDfz2Hx4rxY3pjeP4WLGhkM209w6l1kvSAJxuws8HllNt2HSN12pSXS2t2bxP6E+ofPOnCJNo0+fzfT3kWPgW/nXSGgwAm+IjAzTwFx66SmXq6G631HG2Xu4OosYrSLEjugykXSV7UUAgUBaDD/gi0dWhvh6GhMv9pYu4nkX07gmPWkQvflRTVEXz55li/dBPKdYFnZjMX+7aUBuN8qWAcNEpumqyW1IIWLgwndg85EgquTQKZaWFxI9I4xiwH9VK+y3XwnSnK7uCjoMHhUGYkmUYUL86hf/2JDay6fRqaXswk8duuAlU+DM6ukk878WnLN5Hz6zFlL+fU4XdP9kiQBUB8VC/SlECGET87n9W5vevHaTLfqow9nA6AOA7937iRNwslOUKbvjxUNDDWZN++E0hcEspa5goAtnAtF7NCVoYy2h2nXVBDiEU1+G4C+tsRgOe6L1fZpGfh3byq+kgr/XsEszUxGvLa9ZWwMMYacS9cJPqvqXfWm1W5gw9t9KvKQQa4tdnuhDk6ijYRf+w/wREyPBLfL0Qw/9TM7Kr1YOmCSNaBtUpKxA+BkHw9kuUtP4XVqzOnWDLDk0AzWKH96yeBzeRs/Jdomi5Gm0WP9jOoDl2wVDufSb6rLr3kjHRdgrmwCpjA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(426003)(4326008)(44832011)(47076005)(508600001)(70206006)(2616005)(8676002)(6666004)(336012)(81166007)(26005)(8936002)(83380400001)(186003)(5660300002)(2906002)(316002)(356005)(1076003)(70586007)(36860700001)(110136005)(54906003)(7696005)(40460700003)(36756003)(86362001)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4593 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b375e3d7-1360-4db0-74a6-08da211b178b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pVq2uErkLBaSvoQ/RcIr2zTkF5GT/Kvp00oLPu5F37/53IjsfW2SRebGNC+k2SruUiBdryCvyNFEKma94HJ5C67OkJpowRcYme/la2Elb15W0VW8e+Smht4H8+SEF9gHB30J5dajpzut08db+x8XWtIKqVmvbImLRSmuMaOZZ30vGRr2KOphLGLbrxJOg73nWfVMImXTsB8luNJxEkgrkzKq/A7jNrhb/GqIXxOl+CAZTupmycD1+3M8SDshD7uI/sAv7Q+yUdBvoUa7j5zX+NyXOzCr/akNf/1VnK9UP7ZAD5rbs1GFcaD7jmiAQBt0o+Wg44+BiacbH1s9A9hWuj4bGFmIRckexgwElPwn32M2l2urHQF8TWMLm+uHESVoQegIZ8vGT1HalwLM5dwdT64ITr6x4nxlwdLRJU1Hb+TVhLL0SYOAvYunBuDnDUEfbFOYh36YutthvgwTdB2Wd+dPHQG12mG+WzH4Mdf2KI0kEfeXS0vFUIUEftwwUumaO+ozgg7uGs+NA7Hmacd8353yAb8bqTptg98lhO+v+yVbDtqDNgNubmsx1Q03HrchHqel1zK5dtlIQ+bB0N11OUEcTkWfOVPO2bAgykz2zVYrLitP1U9yuK++lhu/B/q5RWdOwlfG2qzAbwrxWEs+sw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(2906002)(508600001)(36860700001)(54906003)(450100002)(81166007)(44832011)(8676002)(4326008)(70206006)(70586007)(86362001)(110136005)(316002)(83380400001)(5660300002)(8936002)(2616005)(107886003)(36756003)(336012)(1076003)(7696005)(186003)(47076005)(426003)(26005)(82310400005)(6666004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:09:15.1820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f44a135a-5445-481a-9760-08da211b1c7a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3161 x86 is using compiler feature testing to decide EFI build enable or not. When EFI build is disabled, x86 will use a efi/stub.c file to replace efi/runtime.c for build objects. Following this idea, we introduce a stub file for Arm, but use CONFIG_ARM_EFI to decide EFI build enable or not. Signed-off-by: Wei Chen --- v1 -> v2: 1. Use CONFIG_ARM_EFI to replace CONFIG_EFI 2. Remove help text and make CONFIG_ARM_EFI invisible. 3. Merge one following patch: xen/arm: introduce a stub file for non-EFI architectures 4. Use the common stub.c instead of creating new one. --- xen/arch/arm/Kconfig | 5 +++++ xen/arch/arm/Makefile | 2 +- xen/arch/arm/efi/Makefile | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index ecfa6822e4..5f1b0121b0 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -6,6 +6,7 @@ config ARM_64 def_bool y depends on !ARM_32 select 64BIT + select ARM_EFI select HAS_FAST_MULTIPLY config ARM @@ -33,6 +34,10 @@ config ACPI Advanced Configuration and Power Interface (ACPI) support for Xen is an alternative to device tree on ARM64. +config ARM_EFI + bool + depends on ARM_64 + config GICV3 bool "GICv3 driver" depends on ARM_64 && !NEW_VGIC diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 1d862351d1..bb7a6151c1 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -1,6 +1,5 @@ obj-$(CONFIG_ARM_32) += arm32/ obj-$(CONFIG_ARM_64) += arm64/ -obj-$(CONFIG_ARM_64) += efi/ obj-$(CONFIG_ACPI) += acpi/ obj-$(CONFIG_HAS_PCI) += pci/ ifneq ($(CONFIG_NO_PLAT),y) @@ -20,6 +19,7 @@ obj-y += domain.o obj-y += domain_build.init.o obj-y += domctl.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +obj-y += efi/ obj-y += gic.o obj-y += gic-v2.o obj-$(CONFIG_GICV3) += gic-v3.o diff --git a/xen/arch/arm/efi/Makefile b/xen/arch/arm/efi/Makefile index 4313c39066..75ef180233 100644 --- a/xen/arch/arm/efi/Makefile +++ b/xen/arch/arm/efi/Makefile @@ -1,4 +1,9 @@ include $(srctree)/common/efi/efi-common.mk +ifeq ($(CONFIG_ARM_EFI),y) obj-y += $(EFIOBJ-y) obj-$(CONFIG_ACPI) += efi-dom0.init.o +else +EFIOBJ-y += stub.o +obj-y += stub.o +endif From patchwork Mon Apr 18 09:07:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3C48EC433FE for ; Mon, 18 Apr 2022 09:09:47 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307063.522355 (Exim 4.92) (envelope-from ) id 1ngNO3-0000XN-2q; Mon, 18 Apr 2022 09:09:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307063.522355; Mon, 18 Apr 2022 09:09:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNO2-0000X7-Va; Mon, 18 Apr 2022 09:09:34 +0000 Received: by outflank-mailman (input) for mailman id 307063; Mon, 18 Apr 2022 09:09:33 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNO1-0006ub-Dz for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:33 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0609.outbound.protection.outlook.com [2a01:111:f400:fe02::609]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4241f919-bef7-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 11:09:32 +0200 (CEST) Received: from DB7PR03CA0095.eurprd03.prod.outlook.com (2603:10a6:10:72::36) by AS8PR08MB6919.eurprd08.prod.outlook.com (2603:10a6:20b:39e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:18 +0000 Received: from DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:72:cafe::ba) by DB7PR03CA0095.outlook.office365.com (2603:10a6:10:72::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:09:18 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT010.mail.protection.outlook.com (10.152.20.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:17 +0000 Received: ("Tessian outbound 78191104f1b7:v118"); Mon, 18 Apr 2022 09:09:17 +0000 Received: from f51aa0450e9c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A2B559B8-7646-46D0-8CE1-D20079B0863E.1; Mon, 18 Apr 2022 09:09:11 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f51aa0450e9c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:11 +0000 Received: from AM7PR04CA0025.eurprd04.prod.outlook.com (2603:10a6:20b:110::35) by AM0PR08MB4577.eurprd08.prod.outlook.com (2603:10a6:208:fe::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:10 +0000 Received: from VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::6a) by AM7PR04CA0025.outlook.office365.com (2603:10a6:20b:110::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:09:10 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT041.mail.protection.outlook.com (10.152.19.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:09 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:08 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:05 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4241f919-bef7-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b+kkvGS3/fA3Z6skbovMJfBC0zHGpIPcShHjvP25cAE=; b=l27uyZZ9/Y7WzwOt6kXyxm2MfJYNG8NBjX56R7Igc7yz+yIMR8UiKbJO1Pa5D3w5CXDIQjJXBZzYc3r7GRjv6UmTL+GRM2dQqbMGhrbxg5Bw00B/i4kqnfknROwGWgyTY/GDIk7bt/PKAHjfhvf53r9VCTOpBxZrJKpHZCLrVl8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 95b13141f1f39154 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jJhIAr5eQlspRDJp8E93yhTHxeWgfZYDdopNGYSXsNbHxvWeTsQ5KB4HMBQeH/rp1e4tj8LNm8ThdB/ZRLgysBPitPiNJGPzMz0scLwGFU4dS5F2nX4EalTFIm2Y3sbfsAR+acmF4umhgPwvKBF8D1nxJebOijtE8G1FU2PCFa3cnjgP45AZG59BJ/KaNImsrQkAhwKuKRXh45d4Q0cVtv6nU1K3UMUYiPqv4HA9fQUSCnE59OxkLLqAZsn7XRRWQFlvXPANLto04NytLp6JjIlslJzzBUjl/LJIABOkmS3CTPMTLLApV/g2iX8vOrNc4PBBL1DWLFulkSdLuuygLw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b+kkvGS3/fA3Z6skbovMJfBC0zHGpIPcShHjvP25cAE=; b=lbnnQmm7c0hl1wBmhZt8sRrujxSqaXGIeiPUzu/DB62WJ1VXUtSlkhlCfmstt7okhzl2RMH/C4p1C7WpjtnmisAYtT5/DE7yYUBFZv/H6WB85WvPnwYcEeW2ab5K8uEqTeDwpTRvIFWERDc5QfAMim4VFM2JxI/sDrg3EGTKi6Pj1vDl5LttPjHinvqfcu8cl3xvVtcv2ncd6tHC08BKdHRkGvg53I/Itp7vCmiY9jbyk4VV0VuaibQvh6uJGOPRp5r5JwSIzt7hdDCiwsqs/gwg97iV1ZlFY5mBsQf3bWooy8GJaHt79HlqsB1dQCQkXI74CX68AZhiLqxVRFWwoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b+kkvGS3/fA3Z6skbovMJfBC0zHGpIPcShHjvP25cAE=; b=l27uyZZ9/Y7WzwOt6kXyxm2MfJYNG8NBjX56R7Igc7yz+yIMR8UiKbJO1Pa5D3w5CXDIQjJXBZzYc3r7GRjv6UmTL+GRM2dQqbMGhrbxg5Bw00B/i4kqnfknROwGWgyTY/GDIk7bt/PKAHjfhvf53r9VCTOpBxZrJKpHZCLrVl8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v2 04/10] xen/arm: Keep memory nodes in device tree when Xen boots from EFI Date: Mon, 18 Apr 2022 17:07:29 +0800 Message-ID: <20220418090735.3940393-5-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 281da175-eb93-4564-b5d5-08da211b1e02 X-MS-TrafficTypeDiagnostic: AM0PR08MB4577:EE_|DB5EUR03FT010:EE_|AS8PR08MB6919:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: B7eFzo2nCsVI+2O9YuQQ30xoceR2qZ/mdcc2jeaQFkpCIwAC3ZHKSTfiEY28FgJci0xRrFm9pz2MJQvBCftuhMYzT6/0ql2KmAUA71iu8NKiR8T6vvxFO0BOw30IMdrv3NkNDeQHkAoPbNRXgmMHFl6e1PvJSyljX7JT98ORET2n/gwQA3uBWgKWW0EXLTxhqeBbcDqffTDWbQQ3vos8UNyKNvxpBxJLWY0XP6a4SRjP6xEM3I7kXYVwFkmEW6w5VEAm8jcFQySohqUKvAYBrJ1/eMFmUBkEZuF8XSDji6YYazcNutzHlh5KwBENXS+xTBsamgrlivVJOCr1xrNaRTVexmPZxyTxbkV3dinJ3K6Bka150aWe8tIr58DCODneG7F2Cb7Xlv3r+aRfP0JOllxmIexggHZHMmSyuZs6G6KW0/TBT0+LPPp3cXp2G2/Aph4Vg3rhDxstqaNWodgBkxDd3fRh/Ukpc9sUsH5FRQp+qJduV8Lu0m4saFvdOXWG93RdXMQp33m4H8mi5nKJESl7AxDOT9KBV2e/m6yGOilhwNzEKi0D2hmdnR0uvPrWOcOcv4Hg6HYDugLPjtMYdqtbR738igcjB40yiCMWQ+3eJwjWUnDu3yBeIugXkUOLbrh7EFcOOq/vfIcmMdJ7X+ufmXru3ZvZ4YTlvWkIrf2NxRQImeWkX6HVdZireDVtbBO8BofjCpUNb3Xje+HBnw== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(82310400005)(26005)(508600001)(8676002)(4326008)(47076005)(110136005)(54906003)(36756003)(86362001)(6666004)(7696005)(40460700003)(316002)(70586007)(186003)(2616005)(83380400001)(2906002)(70206006)(1076003)(426003)(336012)(81166007)(356005)(36860700001)(5660300002)(8936002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4577 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: dca60300-23c2-4b04-23d8-08da211b192d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IvcVQkdpgv1Emytnp1hjEzD7ZTRBp8ATPOyd1TM8AEMu4m96hzphwBjdlSgrDjEeSMllW+YeTn3uyfsrcbo3CuXHvCZfavOB4N5B0CKlt+B6l6qJC/Fk4IJ3vTqOy5dNyZivRTEfPeViEEIPFhCpV1Cu67ZMl6wLmnnLX9v4NipQCE7x/mlgZTPC8rwPcgC5ZKBOeQGLbo8x14PF6092f0yGWlrosYvkChHE9FzaRZ/uzMSlhExxpuSATdzoxrfKmF80jH9zUB/9Ar4JeorlCs8+xSOzes5yvrXnFlyxVKzLvBDMfM2rToz8f851tTM8YMt4EpXoBGc4UWJywwHO3UcKbTptdOVVM+4IsaPaOCvgVEdlhuWxeBKsKtBiJ83kMdXeYupMvgA8XA2wN65RHqArPgV19w1L6/CCo5xYGhUT7bK+srMgoyBo/5vLBp4xzSzFgDNme4rtrgWqHRxhADiGe6iO7z4ls0uhpKNagbWkVg0yEx8ripkYOmXomTn3vnIvpY1xZllGxDK4R/IUbHfRfXOdmyWx29+bSJlOjI+LLvg7oW0B+qaWAGIwWdcqj51w4OSjmcx1TZhiF+xWzOHKPBJXHgmzoyGSJIkyhFMuzZDlqYdsLXGctWDLgLcHXufMe7jyhHUCqQsSchUnSyBKyszgd1VYx9rlCCS9h4NWtIy5cQ6f5Z0KmOhuVdQv X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(8936002)(40460700003)(54906003)(508600001)(6666004)(5660300002)(81166007)(316002)(83380400001)(86362001)(36756003)(110136005)(2906002)(7696005)(44832011)(8676002)(4326008)(26005)(82310400005)(36860700001)(70586007)(70206006)(450100002)(2616005)(1076003)(47076005)(426003)(107886003)(336012)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:09:17.7674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 281da175-eb93-4564-b5d5-08da211b1e02 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6919 In current code, when Xen is booting from EFI, it will delete all memory nodes in device tree. This would work well in current stage, because Xen can get memory map from EFI system table. However, EFI system table cannot completely replace memory nodes of device tree. EFI system table doesn't contain memory NUMA information. Xen depends on ACPI SRAT or device tree memory nodes to parse memory blocks' NUMA mapping. So in EFI + DTB boot, Xen doesn't have any method to get numa-node-id for memory blocks any more. This makes device tree based NUMA support become impossible for Xen in EFI + DTB boot. So in this patch, we will keep memory nodes in device tree for NUMA code to parse memory numa-node-id later. As a side effect, if we still parse boot memory information in early_scan_node, bootmem.info will calculate memory ranges in memory nodes twice. So we have to prevent early_scan_node to parse memory nodes in EFI boot. Signed-off-by: Wei Chen Reviewed-by: Stefano Stabellini --- v1 -> v2: 1. Move this patch from later to early of this series. 2. Refine commit message. --- xen/arch/arm/bootfdt.c | 8 +++++++- xen/arch/arm/efi/efi-boot.h | 25 ------------------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index e318ef9603..78e10c6ebc 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -370,7 +371,12 @@ static int __init early_scan_node(const void *fdt, { int rc = 0; - if ( device_tree_node_matches(fdt, node, "memory") ) + /* + * If Xen has been booted via UEFI, the memory banks are + * populated. So we should skip the parsing. + */ + if ( !efi_enabled(EFI_BOOT) && + device_tree_node_matches(fdt, node, "memory") ) rc = process_memory_node(fdt, node, name, depth, address_cells, size_cells, &bootinfo.mem); else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") ) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index e452b687d8..59d93c24a1 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -231,33 +231,8 @@ EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, int status; u32 fdt_val32; u64 fdt_val64; - int prev; int num_rsv; - /* - * Delete any memory nodes present. The EFI memory map is the only - * memory description provided to Xen. - */ - prev = 0; - for (;;) - { - const char *type; - int len; - - node = fdt_next_node(fdt, prev, NULL); - if ( node < 0 ) - break; - - type = fdt_getprop(fdt, node, "device_type", &len); - if ( type && strncmp(type, "memory", len) == 0 ) - { - fdt_del_node(fdt, node); - continue; - } - - prev = node; - } - /* * Delete all memory reserve map entries. When booting via UEFI, * kernel will use the UEFI memory map to find reserved regions. From patchwork Mon Apr 18 09:07:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D82C6C433EF for ; Mon, 18 Apr 2022 09:12:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307091.522399 (Exim 4.92) (envelope-from ) id 1ngNQH-00041g-KY; Mon, 18 Apr 2022 09:11:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307091.522399; Mon, 18 Apr 2022 09:11:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNQH-00040C-EG; Mon, 18 Apr 2022 09:11:53 +0000 Received: by outflank-mailman (input) for mailman id 307091; Mon, 18 Apr 2022 09:11:51 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNOD-0006ub-Eb for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:45 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-am5eur03on0607.outbound.protection.outlook.com [2a01:111:f400:fe08::607]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 49c68361-bef7-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 11:09:44 +0200 (CEST) Received: from AS8PR05CA0028.eurprd05.prod.outlook.com (2603:10a6:20b:311::33) by HE1PR0802MB2489.eurprd08.prod.outlook.com (2603:10a6:3:d8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:24 +0000 Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:311:cafe::86) by AS8PR05CA0028.outlook.office365.com (2603:10a6:20b:311::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.21 via Frontend Transport; Mon, 18 Apr 2022 09:09:24 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT013.mail.protection.outlook.com (10.152.16.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:24 +0000 Received: ("Tessian outbound 9613c00560a5:v118"); Mon, 18 Apr 2022 09:09:23 +0000 Received: from 0675bfe1463d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 060C464D-32CF-48A5-80EC-4AC72AB3D0C0.1; Mon, 18 Apr 2022 09:09:16 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0675bfe1463d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:16 +0000 Received: from AM6PR0502CA0051.eurprd05.prod.outlook.com (2603:10a6:20b:56::28) by VE1PR08MB5629.eurprd08.prod.outlook.com (2603:10a6:800:1a6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:14 +0000 Received: from VE1EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::b3) by AM6PR0502CA0051.outlook.office365.com (2603:10a6:20b:56::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:09:13 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT013.mail.protection.outlook.com (10.152.19.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:13 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:11 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:08 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 49c68361-bef7-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=29LYeiieE23CD0WLwJtnSYLtGaVHDf97F/bctCj7n5U=; b=Ki2e13f7txQp2lVU1auB2Mskus6Vu3CeqUunChNJF3PNL9PWPBoHQN4r/pRVj+YC7j73D2DxAYl0ldcA1AHJMqidYRPWqanpAeT6HCbq0rjguxOBbkO844wS/btll53P6ozf6vuZOWNF84lDIVc75oBCFR4aW9ewRpiKAcCadnE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 65cdb1ba32225669 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TnUbvlFfTLseXlX229YjrFVy49gUlyHRQ1XUjIDI9eRkFv+e+zXzij53P2QPvak147CUgrm9WsNr+WXuiQ0WPEBhTlwens/olTlZK5PO9VEybSeB/3c/CbyOZPFAXP4sMXRZnfctfkzT9tiEcDaQGtJa2S9LXAQuP9MaEsFjuol5faaqfXyNP74L24ImUs6nQUuVEglPvajP02cj1NpRf4LkCmA01dTiQl5Am0QDcs3aeuyq8CgO+1b6NiyacD2mLx1Sg9Fk1UmStsiK3stvgl2FzDqSCwM49pKlXJOrlytx/zX+hXvmCtXCr38szNcBY51miXEJyQ1t2N+pk4ujvw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=29LYeiieE23CD0WLwJtnSYLtGaVHDf97F/bctCj7n5U=; b=S4h+BmdlbhNyndFyKuzmOqXQy0lpZfIeg32RbMPgmEw0tFi2SUtPoXZPYGVTN3Epdo8bPmPivcnCqOt+bQ8Hlislto3Gv8bcLfwZkXDqf1uNzgf4/b40Z7UxwnMq+qxRYBa6Z5HvAYPe1Hcqg+dzyD9u/k6/7PA56QheQKktQ3Zgu2qCkA+tjzrAHj76KQIkxg19pxym4K+hVOEfoQi+u4vIu4QW17eVZzI7UQ+mj+fi+A2k5AfEJTEzGBlXcnfXwLRjVwa68WQCMzD5aoNjCYs0d6UzglBd7IyxzPqbX2sXt34jPtZefsdBPBIXqhk6P9iAyySppwIm/i5UIIoaMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=29LYeiieE23CD0WLwJtnSYLtGaVHDf97F/bctCj7n5U=; b=Ki2e13f7txQp2lVU1auB2Mskus6Vu3CeqUunChNJF3PNL9PWPBoHQN4r/pRVj+YC7j73D2DxAYl0ldcA1AHJMqidYRPWqanpAeT6HCbq0rjguxOBbkO844wS/btll53P6ozf6vuZOWNF84lDIVc75oBCFR4aW9ewRpiKAcCadnE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini Subject: [PATCH v2 05/10] xen/x86: Use ASSERT instead of VIRTUAL_BUG_ON for phys_to_nid Date: Mon, 18 Apr 2022 17:07:30 +0800 Message-ID: <20220418090735.3940393-6-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 65092e79-f4c7-48a7-aa5b-08da211b21cf X-MS-TrafficTypeDiagnostic: VE1PR08MB5629:EE_|AM5EUR03FT013:EE_|HE1PR0802MB2489:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 7IKQK5lDBBDGYu0rD2Pr0OrXLlFPQVESNGhFivy8MMmjZgSDFxXHdWvvYnRC+HPZz7kWKVVRWj8jhZQm+/ceZ0HMR7b156QxWxiulakBfX8djucS1gD9luwNbz5FSA1f2VQgz8EJV4UEePE6uusEwSnvr5W64yHzDSRpe6ptMhG2654Rc6hSftguphMQwREN8tQN4a4VW9Ahnc5q/DpRhppCvpBh/GbgdjK8qLgrUD8S5c9G4MgrzhnxUd/VUIl3JSPKUvtbHAOQmyZjt7aiJOxyGhdX9gflUP++48Baw5GrXOA+dLv3W+dencJ7Q/NDkwmklrCLbfwAehX1jslDRnroep8xsGOQg8p5dnESLxKQKQbA8DtRFIwDbmxCR+/GaouqyGLB/G/aJDpLeFNz7yZI23i/FoAORyJggsMWIS3zV0f1fBfT40S+sCuF0DlaAiMcyFfIpVsBofRO3FEWC1B4gn8hyZZjl2AYSgXjMNMBdBS0vajE2z3/Ezw0liN81R2EwfrfqSw4EEUI6UQew1Jhs20EWlf6frjHhAAVe6cYSu5EIY0N2LA9Wc5W4puEIcyEVhNOYmub96ZD/hYFi4U5dqK9nz9nh5/Ck6KBv66khVUUdGhMG9jTkzy9usNxf/LeBdSCETI9QFwmowEueQ2e8Z2sdAY7CMS3E0X5ImQtw4TlhbFbbX8Ls9gooZVg X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(36860700001)(83380400001)(36756003)(82310400005)(316002)(2906002)(5660300002)(86362001)(47076005)(8936002)(44832011)(6666004)(508600001)(426003)(356005)(336012)(7696005)(81166007)(1076003)(2616005)(110136005)(26005)(186003)(54906003)(70586007)(70206006)(4326008)(8676002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5629 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 400928e9-6c96-4e76-3289-08da211b1b80 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OC58Yi+c2HFoaJ4N/2psBKHyhFtkz9Ni2sKz7FegMCGwfzWOMFxbicr3Z0tUAknR6QVlnn929VSd47t2a0m+6AyOXqSFDq6kv1lpWLXIqU8n2sS2zfCuw8fVnE1j9wDWgSznxidbi0oSmwN8oDjhE+GtLcVd8xTItLLNb0dqWPYd3ux+kkChuGyxwfZlm58NzhS4GoejeKs5LMM0tLB6onBcmiIs5QnMZP3ZQQoN24DbRUULovQTq4FUjDGBC2nAiibbpiHtZXRLi+istMuK6JWiBEA9w1DVvpxttkoqDsw28yG91ft6XKLEN5iwCNvsRDcVX5Mv+VYx/2sbEOXNoS6o7B66Bxptuv8aE3WEudYXBj+M+uTnNWZCslliTxnA7swDRfLJlHXAOV4N/5QilusswNhjwdCJuNQ4B5wRog0uZ89p/4KwXpF+xKs/ClPy1Bz8+i2WjmkbobrClbPxU5ElHvn8wbNT0XDtPgrIiPSvJGDo0sh9ZZG8bBsfH3Fg9A3mesFaleKj7wt5FoB8BBcW0eeKRXjTj3DXfJ1u+t+vYCXal/KwnTRkayZi08wtwT6dKwPKv6cviLO4g0vSYZRoxsIGY5xCD84WlqdfM8pdo12dvYSKij2ij8BYQm+FRC7IJdnJ7drA3iZotFJknv7PdfJxk5fH7lvYxBu/jyj9Sle6lHO3zWfUTJD5IHEM X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(8936002)(36756003)(2906002)(83380400001)(5660300002)(54906003)(426003)(186003)(36860700001)(316002)(47076005)(336012)(44832011)(107886003)(1076003)(6666004)(2616005)(7696005)(508600001)(8676002)(4326008)(70586007)(86362001)(70206006)(26005)(110136005)(450100002)(81166007)(40460700003)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:09:24.0656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65092e79-f4c7-48a7-aa5b-08da211b21cf X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2489 VIRTUAL_BUG_ON is an empty macro used in phys_to_nid. This results in two lines of error-checking code in phys_to_nid that is not actually working and causing two compilation errors: 1. error: "MAX_NUMNODES" undeclared (first use in this function). This is because in the common header file, "MAX_NUMNODES" is defined after the common header file includes the ARCH header file, where phys_to_nid has attempted to use "MAX_NUMNODES". This error was resolved when we moved the definition of "MAX_NUMNODES" to x86 ARCH header file. And we reserve the "MAX_NUMNODES" definition in common header file through a conditional compilation for some architectures that don't need to define "MAX_NUMNODES" in their ARCH header files. 2. error: wrong type argument to unary exclamation mark. This is because, the error-checking code contains !node_data[nid]. But node_data is a data structure variable, it's not a pointer. So, in this patch, we use ASSERT instead of VIRTUAL_BUG_ON to enable the two lines of error-checking code. And fix the left compilation errors by replacing !node_data[nid] to !node_data[nid].node_spanned_pages. Because when node_spanned_pages is 0, this node has no memory, numa_scan_node will print warning message for such kind of nodes: "Firmware Bug or mis-configured hardware?". Signed-off-by: Wei Chen --- v1 -> v2: 1. Use ASSERT to replace VIRTUAL_BUG_ON in phys_to_nid. 2. Adjust the conditional express for ASSERT. 3. Move MAX_NUMNODES from xen/numa.h to asm/numa.h for x86. 4. Use conditional macro to gate MAX_NUMNODES for other architectures. --- xen/arch/x86/include/asm/numa.h | 6 +++--- xen/include/xen/numa.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/include/asm/numa.h b/xen/arch/x86/include/asm/numa.h index bada2c0bb9..1f268ce77d 100644 --- a/xen/arch/x86/include/asm/numa.h +++ b/xen/arch/x86/include/asm/numa.h @@ -4,6 +4,7 @@ #include #define NODES_SHIFT 6 +#define MAX_NUMNODES (1 << NODES_SHIFT) typedef u8 nodeid_t; @@ -26,7 +27,6 @@ extern int compute_hash_shift(struct node *nodes, int numnodes, extern nodeid_t pxm_to_node(unsigned int pxm); #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) -#define VIRTUAL_BUG_ON(x) extern void numa_add_cpu(int cpu); extern void numa_init_array(void); @@ -62,9 +62,9 @@ extern struct node_data node_data[]; static inline __attribute__((pure)) nodeid_t phys_to_nid(paddr_t addr) { nodeid_t nid; - VIRTUAL_BUG_ON((paddr_to_pdx(addr) >> memnode_shift) >= memnodemapsize); + ASSERT((paddr_to_pdx(addr) >> memnode_shift) < memnodemapsize); nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift]; - VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]); + ASSERT(nid < MAX_NUMNODES && node_data[nid].node_spanned_pages); return nid; } diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h index 7aef1a88dc..91b25c5617 100644 --- a/xen/include/xen/numa.h +++ b/xen/include/xen/numa.h @@ -10,7 +10,9 @@ #define NUMA_NO_NODE 0xFF #define NUMA_NO_DISTANCE 0xFF +#ifndef MAX_NUMNODES #define MAX_NUMNODES (1 << NODES_SHIFT) +#endif #define vcpu_to_node(v) (cpu_to_node((v)->processor)) From patchwork Mon Apr 18 09:07:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 323AFC433EF for ; Mon, 18 Apr 2022 09:09:47 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307062.522345 (Exim 4.92) (envelope-from ) id 1ngNO1-0000Fq-JB; Mon, 18 Apr 2022 09:09:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307062.522345; Mon, 18 Apr 2022 09:09:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNO1-0000Ff-Fw; Mon, 18 Apr 2022 09:09:33 +0000 Received: by outflank-mailman (input) for mailman id 307062; Mon, 18 Apr 2022 09:09:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNNz-0006ub-Mg for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:31 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20626.outbound.protection.outlook.com [2a01:111:f400:7e1a::626]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4158a990-bef7-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 11:09:30 +0200 (CEST) Received: from DB9PR02CA0004.eurprd02.prod.outlook.com (2603:10a6:10:1d9::9) by AM6PR08MB3016.eurprd08.prod.outlook.com (2603:10a6:209:44::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:27 +0000 Received: from DB5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1d9:cafe::ac) by DB9PR02CA0004.outlook.office365.com (2603:10a6:10:1d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:09:27 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT043.mail.protection.outlook.com (10.152.20.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:27 +0000 Received: ("Tessian outbound ac9bb5dd84f6:v118"); Mon, 18 Apr 2022 09:09:27 +0000 Received: from e5a766ff2263.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5E91799F-258E-49D9-A7AF-0C51ED3A79AF.1; Mon, 18 Apr 2022 09:09:21 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e5a766ff2263.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:21 +0000 Received: from AM6PR0502CA0058.eurprd05.prod.outlook.com (2603:10a6:20b:56::35) by PR3PR08MB5867.eurprd08.prod.outlook.com (2603:10a6:102:87::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:19 +0000 Received: from VE1EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::e) by AM6PR0502CA0058.outlook.office365.com (2603:10a6:20b:56::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.21 via Frontend Transport; Mon, 18 Apr 2022 09:09:18 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT013.mail.protection.outlook.com (10.152.19.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:18 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:15 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:12 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4158a990-bef7-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7upcQINO9FI5IlOhkk4nMfwI1rBCpr+XywVNSPgYPn8=; b=PIM8W0tLp9LpyVtpY0MQOwvdwEv7drh56TbvkwFuYs8nqi6VxplHfstgEaDA2var/kCF7COufc9CLilQ51SITm4drV/fpgTLwYkQQAMg5Qvbh/jshqss8N8iPXOaL55bPIAbhkfIYT1ZSKU03FRj1KnUP0sjK3UEgXCxrDjzoNk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: b47319d808b60900 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W/waVCtOtUlgsNeY60R1HtvU2s+XbInCZMbzhOgNGN8RTUBoUChExhGoUOCqviiXsVLw8GDEZTf/XcCUSqJd7hvOagX7pROMs6SaL5EilFu3jMHdEYOxDNrxiJmqlI0oaUhrJGWCdmIrljIhiHo7JXYvlCi7hn5DWaO5Vz8ekN1fSnscW0rsIImeuwJUlWxUpxtTvv0laPi0OSL3NIDfesYbp8jEiefXSqK+02+uVDIg7QZgFY68YFAJbw/ucpp+nmUVOhuhpQ4xhtlz2Qz+BgCWnbGlVx8KzjeM83DcYTPX+bdCt/Su3cHrtgGq6nTG4Rufz/2ZWszghx2CLUxcDw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7upcQINO9FI5IlOhkk4nMfwI1rBCpr+XywVNSPgYPn8=; b=i8I/WeOTBLWOe2Zk5wdWS7jNQhMaHBtCAyXVa/V01hOt3KedOJrNQ3Ey7ro0M2ZymrkjK/H6vgSfPdGyOyk3Wayd91byreeyyWrIN4PMWz/UzRv2zfqS5HkeDxnK5cHWpUWL/hAURNLdw26Jb8IPuigOY4Io+sy435rIXlQPt41e4rytwuIbuXG0iNsibOmVRZXxt9V6U02RWonYdNl+72pTbZXBSS1LjgrZzDQ6aFVO1D7iWEsdNRu/QNDwf8aBkrW/CwO0fmPTGZ0JMjXYPShVltsbVYJU3NIZcwb5xoqBz72vgP5WTD3J1O27d7qOElYWksCjB0UumxfAuY5saQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7upcQINO9FI5IlOhkk4nMfwI1rBCpr+XywVNSPgYPn8=; b=PIM8W0tLp9LpyVtpY0MQOwvdwEv7drh56TbvkwFuYs8nqi6VxplHfstgEaDA2var/kCF7COufc9CLilQ51SITm4drV/fpgTLwYkQQAMg5Qvbh/jshqss8N8iPXOaL55bPIAbhkfIYT1ZSKU03FRj1KnUP0sjK3UEgXCxrDjzoNk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH v2 06/10] xen: introduce an arch helper for default dma zone status Date: Mon, 18 Apr 2022 17:07:31 +0800 Message-ID: <20220418090735.3940393-7-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 33871645-af97-441c-446a-08da211b23b3 X-MS-TrafficTypeDiagnostic: PR3PR08MB5867:EE_|DB5EUR03FT043:EE_|AM6PR08MB3016:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: u2ou5bKMLU+wCecp/60EdU9X2Sc35AAL11VfPoZDhUfTeC+KgweShRK7lt3mMiwJJXRYxTVFvNkMtmtKO+pr307wYvcLYnnmknUeKHd9oodcK2uEJGAJn9uyPOT74tuz6ZS3j5IJX4YfdgCu8n8sAxFZ2XfAlWD+mLEwH4Mr+XZkPuzvBP4Ucpp75pDpwgyO8nbSyjCCfKA0cAj+WBw4lq6QDif6fke8nSNdhpZ6O6WPwiiZZTxfD2g4QPmnwVJZFeQeGuOSS7Xkiu/DNaOQPV+RuowTGk33Kw7p24axDddBEFwRjzBUNukj6KO/MXiodi2a75hFzAEDjtHQ02kh83cS7KacB59ne2BHy9kKdO1NCDTMq+PvlIpPKmwxeo6qkiISt442E8XUGDYvZqy+Q08SJDJ/tQJoy5zFQzPWRlMBIIkfPWyO+6qGA3pnC2fVg5Sw5HD9QqKJ/RcKiIB/cT+PDmlLVbGNzph+D0KNCQqu6KS9VDYbFF+b58ke9Kf73/cXfD185ympTsW3jD7ZcuExfqMQMX77uKxLCciSpeL899aKtA3kd3GVYUKt9Kk90V3tM2jgn3esdlYT9BcrrjKeegzU2zTOVauSxzLjxB6VyCLYYrydlgycMFfUZU9E0DSHMQgs+BPyOnV/9bl6WsVaa31WFzqBgIkdjY+ANBDVfEp4lDdqI+QVnqWXBWCADqP+2hbftjRIrDrApvuqcg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(81166007)(356005)(7696005)(86362001)(426003)(2616005)(1076003)(6666004)(47076005)(336012)(186003)(8936002)(4326008)(8676002)(36860700001)(26005)(83380400001)(44832011)(7416002)(70206006)(70586007)(5660300002)(36756003)(82310400005)(2906002)(110136005)(54906003)(316002)(40460700003)(508600001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5867 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5f895dc0-e219-4c8f-c810-08da211b1eaa X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dHgqf7KBYEt5JNj8G/kREUDoEGqf9/XCzpQbEhsio9Vxvw/bi2NeRPPyc9L7cJ4Rzb23haAUWWV88AyQONxEDLEVvniHtx5CiRvd7dXBBF6l5sasMjdgN4dQDScJ66wbMZY5JhDZO5s2mOtYN7aw2Pol+HLa6jUL8/J22J/7Axer899nKegkxRMaaD4CZbr+b2bJ5SStk4ueP7n3+FU1KQEHHWAym49Jra0mq4TlW/Fd3bPe1hmJjge2Jzpb1WrYX8YIDkq+tV/qEOX7YKNnEYKUZJEI6xLNcvn+RrObYYLSkWeUMsrT1sGTk+0dpMAi9wjqKFKueEdzu8VP1Nod0kucNIY7eXl7+aVwX5WadnQHQa67qomnscLxKlSSiSVnWBpCmhReY+6PIMRVs5g1Ua+lF+/nsf0igC6SBWIxqumPMde1ZQIBPH4k0y2TvuxVOJ01ywBnY4/YhCAVuqqP+8MeUMctQ2/olhwiyRNIZEOr5+aePnF1PXzCYI9vYlqUB/OVVwF6T0CymlErZv/USN8LsX/VKPvQqearozFUwnxDy7o2rgcGo5hvMQkEHvQyFJSPrTSPANNGIonM36sfHXzQXFcWN95j7LBrRalVWy7Ps73sd/o1lXqa4rrLSURtadeBDMWjAzW8px61CJZ3JCa1b6sVawF6BG9QJJBLRLoMCm8M3s1ikd1x2lDiD6Tq X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(186003)(7696005)(336012)(426003)(5660300002)(44832011)(47076005)(2906002)(508600001)(86362001)(107886003)(1076003)(2616005)(26005)(8936002)(316002)(82310400005)(6666004)(81166007)(54906003)(110136005)(8676002)(450100002)(4326008)(70206006)(70586007)(40460700003)(83380400001)(36756003)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:09:27.2974 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33871645-af97-441c-446a-08da211b23b3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3016 In current code, when Xen is running in a multiple nodes NUMA system, it will set dma_bitsize in end_boot_allocator to reserve some low address memory as DMA zone. There are some x86 implications in the implementation. Because on x86, memory starts from 0. On a multiple-nodes NUMA system, if a single node contains the majority or all of the DMA memory, x86 prefers to give out memory from non-local allocations rather than exhausting the DMA memory ranges. Hence x86 uses dma_bitsize to set aside some largely arbitrary amount of memory for DMA zone. The allocations from DMA zone would happen only after exhausting all other nodes' memory. But the implications are not shared across all architectures. For example, Arm cannot guarantee the availability of memory below a certain boundary for DMA limited-capability devices either. But currently, Arm doesn't need a reserved DMA zone in Xen. Because there is no DMA device in Xen. And for guests, Xen Arm only allows Dom0 to have DMA operations without IOMMU. Xen will try to allocate memory under 4GB or memory range that is limited by dma_bitsize for Dom0 in boot time. For DomU, even Xen can passthrough devices to DomU without IOMMU, but Xen Arm doesn't guarantee their DMA operations. So, Xen Arm doesn't need a reserved DMA zone to provide DMA memory for guests. In this patch, we introduce an arch_have_default_dmazone helper for different architectures to determine whether they need to set dma_bitsize for DMA zone reservation or not. At the same time, when x86 Xen is built with CONFIG_PV=n could probably leverage this new helper to actually not trigger DMA zone reservation. Signed-off-by: Wei Chen --- v1 -> v2: 1. Extend the description of Arm's workaround for reserve DMA allocations to avoid the same discussion every time. 2. Use a macro to define arch_have_default_dmazone, because it's little hard to make x86 version to static inline. Use a macro will also avoid add __init for this function. 3. Change arch_have_default_dmazone return value from unsigned int to bool. 4. Un-addressed comment: make arch_have_default_dmazone of x86 to be static inline. Because, if we move arch_have_default_dmazone to x86/asm/numa.h, it depends on nodemask.h to provide num_online_nodes. But nodemask.h needs numa.h to provide MAX_NUMANODES. This will cause a loop dependency. And this function can only be used in end_boot_allocator, in Xen initialization. So I think, compared to the changes introduced by inline, it doesn't mean much. --- xen/arch/arm/include/asm/numa.h | 1 + xen/arch/x86/include/asm/numa.h | 1 + xen/common/page_alloc.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/include/asm/numa.h b/xen/arch/arm/include/asm/numa.h index 31a6de4e23..268ba93a92 100644 --- a/xen/arch/arm/include/asm/numa.h +++ b/xen/arch/arm/include/asm/numa.h @@ -24,6 +24,7 @@ extern mfn_t first_valid_mfn; #define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn)) #define node_start_pfn(nid) (mfn_x(first_valid_mfn)) #define __node_distance(a, b) (20) +#define arch_have_default_dmazone() (false) #endif /* __ARCH_ARM_NUMA_H */ /* diff --git a/xen/arch/x86/include/asm/numa.h b/xen/arch/x86/include/asm/numa.h index 1f268ce77d..6eeae02060 100644 --- a/xen/arch/x86/include/asm/numa.h +++ b/xen/arch/x86/include/asm/numa.h @@ -74,6 +74,7 @@ static inline __attribute__((pure)) nodeid_t phys_to_nid(paddr_t addr) #define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages) #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ NODE_DATA(nid)->node_spanned_pages) +#define arch_have_default_dmazone() (num_online_nodes() > 1) extern int valid_numa_range(u64 start, u64 end, nodeid_t node); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 319029140f..4c0dc3cb3c 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1889,7 +1889,7 @@ void __init end_boot_allocator(void) } nr_bootmem_regions = 0; - if ( !dma_bitsize && (num_online_nodes() > 1) ) + if ( !dma_bitsize && arch_have_default_dmazone() ) dma_bitsize = arch_get_dma_bitsize(); printk("Domain heap initialised"); From patchwork Mon Apr 18 09:07:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C390DC433F5 for ; Mon, 18 Apr 2022 09:09:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307064.522367 (Exim 4.92) (envelope-from ) id 1ngNO5-0000v0-Ef; Mon, 18 Apr 2022 09:09:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307064.522367; Mon, 18 Apr 2022 09:09:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNO5-0000ut-Aq; Mon, 18 Apr 2022 09:09:37 +0000 Received: by outflank-mailman (input) for mailman id 307064; Mon, 18 Apr 2022 09:09:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNO3-0006ub-Ko for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:35 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0624.outbound.protection.outlook.com [2a01:111:f400:fe0c::624]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4394dd6e-bef7-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 11:09:34 +0200 (CEST) Received: from DB6PR07CA0081.eurprd07.prod.outlook.com (2603:10a6:6:2b::19) by VI1PR08MB3104.eurprd08.prod.outlook.com (2603:10a6:803:42::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Mon, 18 Apr 2022 09:09:30 +0000 Received: from DB5EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2b:cafe::e6) by DB6PR07CA0081.outlook.office365.com (2603:10a6:6:2b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.12 via Frontend Transport; Mon, 18 Apr 2022 09:09:30 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT034.mail.protection.outlook.com (10.152.20.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:30 +0000 Received: ("Tessian outbound 62985e3c34b6:v118"); Mon, 18 Apr 2022 09:09:30 +0000 Received: from 4f42fa70571b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FF6153FE-11D1-415C-91D8-C9DFCB1B1FCB.1; Mon, 18 Apr 2022 09:09:23 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4f42fa70571b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:23 +0000 Received: from AM6PR0502CA0070.eurprd05.prod.outlook.com (2603:10a6:20b:56::47) by DB6PR0801MB2069.eurprd08.prod.outlook.com (2603:10a6:4:7a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:21 +0000 Received: from VE1EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::a2) by AM6PR0502CA0070.outlook.office365.com (2603:10a6:20b:56::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:09:21 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT013.mail.protection.outlook.com (10.152.19.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:20 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:19 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:16 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4394dd6e-bef7-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bpBKGazT9JC8lRpfqSPdaFeJFZI9C70EVp+BKwYVSR4=; b=nQ+5MP228nSOFQBxbFNYpOZFA3FJTx0PYgo593b0kojgaovpgPA17f2LMDesqQcVu7P2KH+2vX7bmmuf2YWf1Wh5i3IXBUMHsIVsZd2PkH58gO/lLZX9c9YbxkJz2YLSCdoX99XD/lbP1/WBLIqY26op2sMeo2AreflHn2K8K3U= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 23b4a5fef05d5e3e X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qu7vEESF5z6unrsZANbJVxjyuDCWIgW25s1Mt3F2+KC1PHbovU8aR3tTrc5Mtk3UXvNUCuBRMOGG5Xhmw07eIz43xr07gFXhJOim8QL8DXk5uRgwFY5AQI7IyU6J2LngytOAVJ2ExZMyUx7B3FBuu76z7lJgaKLObukZc7K0F/zhsBsYv6FvQdv5ghyCPTT422k3LLw3nqYzuXvU7kMliUozoY2PsJjfbqCYUk8z7bfh3FW9fQ++GacZNp5hB0wr3dpDc1x/DO/BWjzRmym56Xef6FDBfAa+YYWszDnCcp9y2RWS1aiom+uMzNLR/eRug4t1C3XeffbjRpmOQpllOQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bpBKGazT9JC8lRpfqSPdaFeJFZI9C70EVp+BKwYVSR4=; b=h7X7y4Kf66cd7DEbFbDHCIoGUCNfCWo/Rc+unLWy1mtErL4ZfjsNEgxS9df9KkY0tiE88qPel80sMrjD2wu01AWjzfCLH7kZWQi+65Too7aYHDU7JgS+5CpxfndSMAwmKD8UH7WOuHZO+sRKvoPhqThB15ZhzSrZY0OgD3hfabgd9phCkBNUEUOp9ZAW4VmFG62+8i/qNwO1CyzdhvpuaYYZOOfpHO0zlXvvDBlJOnV3cM27qWr4gI6PlnhSnzj64DoI9r4umG7k6kWf+hueQJR2RYPSS2iyDuILRGuk2DTaNxBa609CPntQxO01zPhJ031aLSDpx/W/1OasHGQ96Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bpBKGazT9JC8lRpfqSPdaFeJFZI9C70EVp+BKwYVSR4=; b=nQ+5MP228nSOFQBxbFNYpOZFA3FJTx0PYgo593b0kojgaovpgPA17f2LMDesqQcVu7P2KH+2vX7bmmuf2YWf1Wh5i3IXBUMHsIVsZd2PkH58gO/lLZX9c9YbxkJz2YLSCdoX99XD/lbP1/WBLIqY26op2sMeo2AreflHn2K8K3U= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini Subject: [PATCH v2 07/10] xen: decouple NUMA from ACPI in Kconfig Date: Mon, 18 Apr 2022 17:07:32 +0800 Message-ID: <20220418090735.3940393-8-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: d5855dca-c0cc-4346-8026-08da211b2575 X-MS-TrafficTypeDiagnostic: DB6PR0801MB2069:EE_|DB5EUR03FT034:EE_|VI1PR08MB3104:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: gluoZOpqTErfSkjpXG4bjpicgNlQUvAqQOyKwXx3178Z3G0Jhc7aZIzRjfMFHJiu08QuhKOcuJMlwHARcohT4lRylZPuGrXpW47A27Ncje+i6jGRNoE+ET9E9OUqmRgZOO1HRjmQwiJ/lz7Tb+eHPZUkq+YSud70fCPAoNVwMsFyjjnaKzzJ7KbrffK2FCrbNPylIunh//406cVjt5tpAQiCvmOChu5myOUngysvTcIhlxcu6qLZ+CTzzvLbt1OQFpPwwqjqzqLuEeNv492l1Hzs+DcaYcsS1I7yMwfzK0Dw04NKicU3reeLlw5TY6e1B6bbyHF+6WiScyyfsmNX4mozWEAn/TxjSt/hrguxFeZfGT5Bd5ApCjufToUazFS4j1/LvOr9uSukd6fx4EbM6z1O+Iz99ib26FJYz8qIKGYg/CW55CC0uVIFgbU2wVZZzgT9HCNVgrl7oNXRQgYASJsu0lDO/zHPmjN+DqxTepxL67T4TqVkNUVDsfvQpnKDVWneXtL5y0Ohga7F7tSCEuIriVLWvqGqWlsWNjNpWD21v/mn2urnSuNU0MRyLaUKWYuqbmLgZ3eUPVHDMb+gLgWdefDb5n/yp60XyN3HafArG0XC03WgviaVHEXG3HNsrr1Gsp03XxB+BecUJ6tTnb7228w6pCcLsHYTeXiYXd7nVx+5YWe30GvEvXyPvg3N X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(86362001)(83380400001)(5660300002)(110136005)(1076003)(7696005)(82310400005)(2906002)(508600001)(81166007)(356005)(36756003)(26005)(186003)(54906003)(47076005)(426003)(336012)(8936002)(2616005)(44832011)(6666004)(36860700001)(8676002)(4326008)(70206006)(316002)(70586007)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2069 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 15f81b41-839c-4ea2-ef6a-08da211b1ffa X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +6IE9pkXIU+eAR2kSZmGkM49XZCJ17ZGJ/Qt8BSj/PvGOKvKIWywiq8+hqxwCYjBr5EDdt90E+Fst8TTDfow8bUheq0veEVwHnZ7SzS8T94clMB753Oo5Br/hO/8Y/zyT13GyW60a1mgRzBlRjk0fM9155vZ/y7Tx8HzdHQD/Gz0E8lEgoY//+4m12eTLcQcqCcH3x98a69oG1auXQPj3xUpppxJ/V9q46WlXUNB08NZGRuDR/YtuJuvR1c7gSe4AqB5ch95sCCEp2dLjQQYvAZt4Ct3LXubqju5NBzNeAJzVmFAb6VnWREzk0qLQt5/vIl0Mu9XHjr5JlA60mcLzXkS/hmR+YjDcWUfNDD7/igWHkNFfO2cYrdBeHX8QjhyVXBHZdOWtIlhoB1XkOKgAi279EVfdBYiDYRCByBCKl2FWTGmhI/TkS3SS9MXVstSK3Z8rVhrksYpM7KDQvJIqPlbd7yJt3KKCFSu88lhnvddSu7Pdns+l7V2vqQOYwaC8bboXtI0N5MrKcj6s4r7tfCp3ZfUfptQTGnrjJFL8f0a0EwGPfrJJ6tQRaknFcJRlwInq16VIVVyXrI2Ma9JzkmRCTj6sV5utz0UNm9W9E/VfWeiOQ2cFrYtXgspolvMJ6bGsvQLauHH0iDbfoY9Pg== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(44832011)(36756003)(8936002)(5660300002)(2616005)(450100002)(316002)(54906003)(110136005)(7696005)(6666004)(508600001)(70586007)(70206006)(2906002)(1076003)(86362001)(186003)(107886003)(426003)(26005)(47076005)(336012)(36860700001)(82310400005)(8676002)(4326008)(81166007)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:09:30.2637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d5855dca-c0cc-4346-8026-08da211b2575 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3104 In current Xen code only implements x86 ACPI-based NUMA support. So in Xen Kconfig system, NUMA equals to ACPI_NUMA. x86 selects NUMA by default, and CONFIG_ACPI_NUMA is hardcode in config.h. In a follow-up patch, we will introduce support for NUMA using the device tree. That means we will have two NUMA implementations, so in this patch we decouple NUMA from ACPI based NUMA in Kconfig. Make NUMA as a common feature, that device tree based NUMA also can select it. Signed-off-by: Wei Chen Reviewed-by: Jan Beulich --- xen/arch/x86/Kconfig | 2 +- xen/arch/x86/include/asm/config.h | 1 - xen/common/Kconfig | 3 +++ xen/drivers/acpi/Kconfig | 3 ++- xen/drivers/acpi/Makefile | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 06d6fbc864..1e31edc99f 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -6,6 +6,7 @@ config X86 def_bool y select ACPI select ACPI_LEGACY_TABLES_LOOKUP + select ACPI_NUMA select ALTERNATIVE_CALL select ARCH_SUPPORTS_INT128 select CORE_PARKING @@ -26,7 +27,6 @@ config X86 select HAS_UBSAN select HAS_VPCI if HVM select NEEDS_LIBELF - select NUMA config ARCH_DEFCONFIG string diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h index de20642524..07bcd15831 100644 --- a/xen/arch/x86/include/asm/config.h +++ b/xen/arch/x86/include/asm/config.h @@ -31,7 +31,6 @@ /* Intel P4 currently has largest cache line (L2 line size is 128 bytes). */ #define CONFIG_X86_L1_CACHE_SHIFT 7 -#define CONFIG_ACPI_NUMA 1 #define CONFIG_ACPI_SRAT 1 #define CONFIG_ACPI_CSTATE 1 diff --git a/xen/common/Kconfig b/xen/common/Kconfig index d921c74d61..d65add3fc6 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -70,6 +70,9 @@ config MEM_ACCESS config NEEDS_LIBELF bool +config NUMA + bool + config STATIC_MEMORY bool "Static Allocation Support (UNSUPPORTED)" if UNSUPPORTED depends on ARM diff --git a/xen/drivers/acpi/Kconfig b/xen/drivers/acpi/Kconfig index b64d3731fb..e3f3d8f4b1 100644 --- a/xen/drivers/acpi/Kconfig +++ b/xen/drivers/acpi/Kconfig @@ -5,5 +5,6 @@ config ACPI config ACPI_LEGACY_TABLES_LOOKUP bool -config NUMA +config ACPI_NUMA bool + select NUMA diff --git a/xen/drivers/acpi/Makefile b/xen/drivers/acpi/Makefile index 4f8e97228e..2fc5230253 100644 --- a/xen/drivers/acpi/Makefile +++ b/xen/drivers/acpi/Makefile @@ -3,7 +3,7 @@ obj-y += utilities/ obj-$(CONFIG_X86) += apei/ obj-bin-y += tables.init.o -obj-$(CONFIG_NUMA) += numa.o +obj-$(CONFIG_ACPI_NUMA) += numa.o obj-y += osl.o obj-$(CONFIG_HAS_CPUFREQ) += pmstat.o From patchwork Mon Apr 18 09:07:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 63744C433FE for ; Mon, 18 Apr 2022 09:12:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307084.522378 (Exim 4.92) (envelope-from ) id 1ngNQF-0003Xs-Si; Mon, 18 Apr 2022 09:11:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307084.522378; Mon, 18 Apr 2022 09:11:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNQF-0003XX-Ok; Mon, 18 Apr 2022 09:11:51 +0000 Received: by outflank-mailman (input) for mailman id 307084; Mon, 18 Apr 2022 09:11:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNO4-0006ub-SW for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:36 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02on062b.outbound.protection.outlook.com [2a01:111:f400:fe07::62b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 44786735-bef7-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 11:09:36 +0200 (CEST) Received: from DB6PR07CA0086.eurprd07.prod.outlook.com (2603:10a6:6:2b::24) by DB8PR08MB4057.eurprd08.prod.outlook.com (2603:10a6:10:a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Mon, 18 Apr 2022 09:09:32 +0000 Received: from DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2b:cafe::75) by DB6PR07CA0086.outlook.office365.com (2603:10a6:6:2b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.12 via Frontend Transport; Mon, 18 Apr 2022 09:09:32 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT062.mail.protection.outlook.com (10.152.20.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:32 +0000 Received: ("Tessian outbound 9511859e950a:v118"); Mon, 18 Apr 2022 09:09:32 +0000 Received: from 473d338c93a5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1E534BB9-E16A-47EF-9784-088848B356DE.1; Mon, 18 Apr 2022 09:09:25 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 473d338c93a5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:25 +0000 Received: from AM6P192CA0024.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::37) by AM6PR08MB4659.eurprd08.prod.outlook.com (2603:10a6:20b:ca::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:24 +0000 Received: from VE1EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:83:cafe::96) by AM6P192CA0024.outlook.office365.com (2603:10a6:209:83::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Mon, 18 Apr 2022 09:09:24 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT043.mail.protection.outlook.com (10.152.19.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:23 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:22 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:20 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 44786735-bef7-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ryDzFvecatRrku+p3Uf242SapmXbat71UQcLw2AlN5k=; b=kRdd1KkF/a9OIi8OvMKVCRWILg36qwTODXAZ+P03LTPM64hqkt+AOjC6p1NqCTr3jSrxHsiFlodHVRWWY6RfQcZIUsNZ41R1ZS4PqfJ+VOkNhfYHBzlzcQXCP2bisOiczHGnjF7qMvppGpFOx4nO+N97F7nUAJQAw7zbzLOm3sw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 7c151209e6bdb9ca X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NvbN3UGXKosLyTwzRN1T4ZaXMq65MMCC2iQhb8bXVEC3wO+tLkFLtfhHTQcaOqaerAU2lSoPFOVixllZ60q7MqHUIKlx9w2+CfbrUcMKFZ0u+yRWTvjdiHRV/r9HlUnUhQ2gbW1qgDfamW4bGnUmNsIIC83nLU/TRfvOTd0hDRqUKHZK31H8LeZRMVg6clokV0GnSNzA2EhtezM3zZ8KJOCMylbL/Kv1Dn5djTTuzvYIE3HkvxJgvOf1DRj9+XiE9BrfZdPiDjwP8iQzTFK+GMoM/OPll9+iaF/ri/ti/R4Nn36is5tM9Yximlh9IjVNPTAbqT42FfMVvHlc6/5UvQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ryDzFvecatRrku+p3Uf242SapmXbat71UQcLw2AlN5k=; b=h85gJgsW7lC3C9jfpluPe8RVDCVyZnAfnyMH0xqnV9qfRRsqL28ymsSPsenYXwScE0BQsQS2kK/Z1p3yXqcNQCD7iyrDqh9NiG1HeZXJBMxv7D0IZHxR9oVnsC0VonNX5Ps9nF6vjZFNP34IeNZDBXKJ0TacoejsBdjZrK5HbDfu7KwQTpiRsrYeRXolHl4ayqFAWvkg42rywDoPQqUr0vR58YNsS+RM3k/KgMkQ9I+YDM1/NRT7wBUgQcljTf65XZ62QOiiYbcaT4K+eBHlTioOswT7zf82YlZYLrLj8HGyibsgLeU+EPUUyaYjNDhMrvZcp2E/8YiYdoBtALKGIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ryDzFvecatRrku+p3Uf242SapmXbat71UQcLw2AlN5k=; b=kRdd1KkF/a9OIi8OvMKVCRWILg36qwTODXAZ+P03LTPM64hqkt+AOjC6p1NqCTr3jSrxHsiFlodHVRWWY6RfQcZIUsNZ41R1ZS4PqfJ+VOkNhfYHBzlzcQXCP2bisOiczHGnjF7qMvppGpFOx4nO+N97F7nUAJQAw7zbzLOm3sw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v2 08/10] xen/arm: use !CONFIG_NUMA to keep fake NUMA API Date: Mon, 18 Apr 2022 17:07:33 +0800 Message-ID: <20220418090735.3940393-9-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: c15145fe-f9b9-416e-b35f-08da211b26a7 X-MS-TrafficTypeDiagnostic: AM6PR08MB4659:EE_|DB5EUR03FT062:EE_|DB8PR08MB4057:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0Bbpp2Dc7JF+jbPJeJ3ESNoo3UbR9EXyjBpRvm/02e1f3d/LwKlxHQ28Pv9EN7n/4DDnCESngLqeKQ5oBIwuwyaBmuwWn1IrD5ZjZ26oXocI9czMSavjthQPxnsLSgtJv3EOjKjDeo4Ab8td0UqrBN2uKyVxOfeLn90WxW46bcWVJWvvsvuBqrkuIbcLv+cBpHynhJ3WarDYPL1cI4ulFAeZ1qOTTNCMpBSN5iXL++Cl1I+4uhNUUYD2L2ShsDbacJwOtBRjgxxGyJ6LeGaKenBHrIA1Gkr/ZWz8+ZBKF/eouqabM3eMF7WokiyWptio7R8rAvgGruDV0xAekVh/4Jaoh1X2YXYRLnsBstK5abr6TIzLk4eWBdeHOzIx4H6We96/wqQTsESFgMxZhAR+XduBqgi6gUDWZX1OXK3tMnU7h914+3e7Sp1MYBdJYAJsSIA3Ha1CD2N95JPexUbjPvFfhYsGvjbPrUlkz69m9w0UuEbxP2lR24biKMvhTvbqeI8HRMRkLyUt26jV1cbBODtpl9fR9+r3DDUR0rM5LPKUWQIUctviWJHUeze0s3t4LKNEek9X5D86mDlFJlW8cyXeoBUK4SktE6Zj9ma1W54GwC9/Nww0qTrvUYBa/khCtOaYSnd2lJeuXSGsLLIPWecFCjgBcjI7LVklCScqGD2qUErdzlD92rMFWYjzy/PPXlkzjVsjVMwXHzlWZq7ujg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(40460700003)(8936002)(336012)(426003)(86362001)(1076003)(4326008)(508600001)(83380400001)(47076005)(26005)(316002)(54906003)(110136005)(5660300002)(36756003)(6666004)(36860700001)(7696005)(82310400005)(8676002)(70586007)(70206006)(186003)(81166007)(2616005)(2906002)(44832011)(356005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4659 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 84fc2458-507d-4f9e-f124-08da211b21c3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o3wAxv0Yx+4bc/e2GiE9lDFYuYcCW8sJef+RNUHm11bH0S8zU6wYjmg/LyaejnnpmO5WViPNLpHTsGNnha5/P+5tu0qH+NcLDvBZLA0VSto8ncCdzbdvixInz2gaGxTCVJwKH+8KiA/nSibzJ/ZtsTiPYXhR37wrsyEg9rihuOo4iJ20TNY5EVPvAYCmiTHE+qLAIvAzgWPQWjIFPK17JP55Zg2dajSHJwgekwZOHjnkjE6/VrxZrJxSly4+d4K7qN4PNqyF5c2gCs+iO9xBAK7O4osUyHtUgOs5KWRvSd4DNoVipf8p3/Do8uPpUFWvItEyBr22bFKn00ylYxn+qFgc/isb1wmbMIcVTMIaWodcOclu8Yrobef2kW/5kWFwU01yDPWcwdlQerIsx4GBKLkKX1qNPgg29VY903Bss5DR1QRD502atZUX9Ii5xDbRfz14q8Ye1wnlmFLQgdITg68xfS8tHzTX5jvel8ZOBDVD1spF6K+5rl1EdWty/D7TEPfo8DUHxGRWblP1huMh8XzxP3nBMxI0EpO5cp/p6C4h1iQKrY9Ii++smWoXMmbVqp+nTmfSCarkl8p4LxYpnZVwy/oD14iRFdyqVso02mOOCHJI74UgYBe6/qBNcqNe2IDYlZCL/pndkWM5/x347+TW1JkaZYXZIfFABNIwvDnUJ2tWeUqXjfwLft7HmXU3 X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(36756003)(426003)(86362001)(4326008)(8676002)(2616005)(81166007)(450100002)(110136005)(70206006)(82310400005)(70586007)(508600001)(7696005)(40460700003)(107886003)(47076005)(2906002)(336012)(26005)(54906003)(316002)(6666004)(1076003)(44832011)(83380400001)(36860700001)(186003)(8936002)(5660300002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:09:32.2548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c15145fe-f9b9-416e-b35f-08da211b26a7 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4057 We have introduced CONFIG_NUMA in a previous patch. And this option is enabled only on x86 at the current stage. In a follow up patch, we will enable this option for Arm. But we still want users to be able to disable the CONFIG_NUMA via Kconfig. In this case, keep the fake NUMA API, will make Arm code still able to work with NUMA aware memory allocation and scheduler. Signed-off-by: Wei Chen Reviewed-by: Stefano Stabellini --- xen/arch/arm/include/asm/numa.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/arch/arm/include/asm/numa.h b/xen/arch/arm/include/asm/numa.h index 268ba93a92..59cdf8e39e 100644 --- a/xen/arch/arm/include/asm/numa.h +++ b/xen/arch/arm/include/asm/numa.h @@ -5,6 +5,8 @@ typedef u8 nodeid_t; +#ifndef CONFIG_NUMA + /* Fake one node for now. See also node_online_map. */ #define cpu_to_node(cpu) 0 #define node_to_cpumask(node) (cpu_online_map) @@ -24,6 +26,9 @@ extern mfn_t first_valid_mfn; #define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn)) #define node_start_pfn(nid) (mfn_x(first_valid_mfn)) #define __node_distance(a, b) (20) + +#endif + #define arch_have_default_dmazone() (false) #endif /* __ARCH_ARM_NUMA_H */ From patchwork Mon Apr 18 09:07:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12817619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B2186C433F5 for ; Tue, 19 Apr 2022 08:41:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307860.523192 (Exim 4.92) (envelope-from ) id 1ngjQM-0002F0-QC; Tue, 19 Apr 2022 08:41:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307860.523192; Tue, 19 Apr 2022 08:41:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngjQM-0002Et-Lc; Tue, 19 Apr 2022 08:41:26 +0000 Received: by outflank-mailman (input) for mailman id 307860; Tue, 19 Apr 2022 08:41:26 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngjQL-0002En-Tj for xen-devel@lists.xenproject.org; Tue, 19 Apr 2022 08:41:26 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on0619.outbound.protection.outlook.com [2a01:111:f400:fe06::619]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7cf3cce2-bfbc-11ec-a405-831a346695d4; Tue, 19 Apr 2022 10:41:24 +0200 (CEST) Received: from DU2P251CA0026.EURP251.PROD.OUTLOOK.COM (2603:10a6:10:230::28) by AS4PR08MB7782.eurprd08.prod.outlook.com (2603:10a6:20b:516::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Tue, 19 Apr 2022 08:41:19 +0000 Received: from DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:230:cafe::85) by DU2P251CA0026.outlook.office365.com (2603:10a6:10:230::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.25 via Frontend Transport; Tue, 19 Apr 2022 08:41:19 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT060.mail.protection.outlook.com (10.152.21.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Tue, 19 Apr 2022 08:41:19 +0000 Received: ("Tessian outbound 9613c00560a5:v118"); Tue, 19 Apr 2022 08:41:19 +0000 Received: from 3365da07ef86.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AF6BD8C6-7682-42F6-8B85-127173D7295C.1; Mon, 18 Apr 2022 09:09:29 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3365da07ef86.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:28 +0000 Received: from AM0PR02CA0188.eurprd02.prod.outlook.com (2603:10a6:20b:28e::25) by AS8PR08MB6903.eurprd08.prod.outlook.com (2603:10a6:20b:39e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:27 +0000 Received: from VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:28e:cafe::86) by AM0PR02CA0188.outlook.office365.com (2603:10a6:20b:28e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.21 via Frontend Transport; Mon, 18 Apr 2022 09:09:27 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT057.mail.protection.outlook.com (10.152.19.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:26 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:25 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:23 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7cf3cce2-bfbc-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p7tS9ML08zDxjl47hmFDH/GGJS3XOkcDbsDVCb+URRE=; b=ophlSkyirVWZp6K5Kd3j4XzwEF3tUz/x+En54lL/dfh9To2lRZJAtiz88CHf5JB3IFTxpca6p0YH8I2rplqSTaqDFMUTXLWo41CiDEm4zhEYYkRW29xs0rrXeBMLNuv7wO4f42XYyIgpMpNEJp2A/LRuFllevCnIlo2mxiHKOo8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 759d7a6716b78d46 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M8+EqGHmU1+ZedttPSni5tCucyt4TCUM1SpOF5naxAku3MwFsms6aa/hza9SPP6PZ+iOOGX2w9IZmsYujYnes376visrkOq0xCNIBdU2gyWJZsdjYm2mVGn2/TexOYdbjvH8DdUjPhrX+LaPbN4suJ2dMCCKQBzDWkD9OmB16Dk6EIpyQPntc7QpZQZ1x+MUSvfrnSG9WbN2Xa3gGdXTAmpLRg3tc8Oexqye7whrwXvoKDlVTaNFIlaCuLywehJKFCzl5u/AsheUkrGI7hGVa9xVSrOitpNZEpzZtwdYhH1ybMB8u4s7Q5tccvrQ2edVQL0SuOse5vT3x5ojLdXWfA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p7tS9ML08zDxjl47hmFDH/GGJS3XOkcDbsDVCb+URRE=; b=Nr6y8EKFB86xRa9yuHG1lhHAShNhFaqBfqT8yfbTH90CpUExSO+Brnz48OuQnkbrahUZTmZN5W42SMWz9w/ytcTklBxf2JHOwQKiPVCv3xRXMtydB3lVMkGhX12spaRTL1yJVy1fkmhVa2YZ9LkKuR3mmOb2L6P26Pz60nQKaRM52YmTrDO37yX/C6QoiHjtjoOHfk6Y3e0FCtzO3bsW4aUOVisUHSs494gXVIRqaK6J6zyQXeczWZCQSEZEcO/CVXFRY+BuFFQeDyAlnYw2YhbtKQDZeOtK5B0TtmwefU3jCXHLuq/j3bH+eNHotNWparD8tlmoJ1/mJsEJyemwiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p7tS9ML08zDxjl47hmFDH/GGJS3XOkcDbsDVCb+URRE=; b=ophlSkyirVWZp6K5Kd3j4XzwEF3tUz/x+En54lL/dfh9To2lRZJAtiz88CHf5JB3IFTxpca6p0YH8I2rplqSTaqDFMUTXLWo41CiDEm4zhEYYkRW29xs0rrXeBMLNuv7wO4f42XYyIgpMpNEJp2A/LRuFllevCnIlo2mxiHKOo8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v2 09/10] xen/x86: use paddr_t for addresses in NUMA node structure Date: Mon, 18 Apr 2022 17:07:34 +0800 Message-ID: <20220418090735.3940393-10-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 767ffcf6-bf7e-403f-801c-08da21e06022 X-MS-TrafficTypeDiagnostic: AS8PR08MB6903:EE_|DB5EUR03FT060:EE_|AS4PR08MB7782:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: AMqSS0+fCfqaVC27wyHNgTl1/1i5GpGNEYQundD5iZsGld5mywSsTbtcbaMmaBb4gkYp7NFnGWUWMK/ItLYPM8SH7m7+qPGG8SjnS3xACnNIXva6GlJjaocX86urk1fxIFN0ybFb3r8sZoo/V7oy4VurgB5j5l6kSfpBJt0t9HWGOOXLy/zne+mVrqTFTH7nTyR6CWqmn7F61dvBK4kx6Bp5XtRpnQkZIzdYzzDWs8kQz6A2ffx/F6t7Q60ItKmWk76/0lZBznDFeCIRd+yR2pkBmBtjvigX8VRMmgXHZJPkXiDHrWg9HXIeTADKgnA1B1EDiuloLkIQ33T3ZqMVcvAHHfYOFjxMWwV50wf6zC/TGzzbrdlPqLnXbWYDjWDAzASq6juTRRTFJdRQtVzsWfQ0zrW3LAGyJgczF32Gkbk9YELSwtk6Et2IsN1dRHVxaje96OIZ+YUcu3Zd88lMDUl5wz8lAjlu8cTQHignV7/BJtPOEf5mcLmrQX/wfdMKhhNStx9zszU3Oas0Vw8AqLADx0y/CCO98GxF+lo3ZjfJjyM0V2atHAcshBILeOuv7VnRhe3RUg1S4xQ3MZImCv+Y838/JPjOItloyXvhYTxFb503/5MFFFGdzaAQ/rhM13k2KsJ2zEk1CSnzDwFCs3rE3ynQZqyxw4wbI908qAxZM2iJ8i3AODkvxfKJGHW9MmFXs4IRcFsw1h+EDrrrLA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(356005)(40460700003)(110136005)(26005)(47076005)(7696005)(36860700001)(8936002)(6666004)(5660300002)(54906003)(336012)(70586007)(70206006)(81166007)(36756003)(8676002)(2616005)(83380400001)(4326008)(1076003)(82310400005)(86362001)(426003)(316002)(44832011)(508600001)(2906002)(186003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6903 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 40d31bc9-b61b-48fc-1074-08da211b2370 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OEDOW+7ZD/gYj1kvhdC6mCpuCALUuar241SfJ+H5dDkybekn/R2Z+OcIY/nLC+jxG1pi17pDUOMr3eNd9dAUI0Gyx3WXNZeFzlHI8KBOcjzkmXA8JO8honH10nQ0Ngi1T2w7n04uZwgbxjjkgG7BV1lFctBBL2LUXU0Kvqk28QYWmDFitJtLzkpcXhoEnmdOZ76u8GB6oVpeBjQpG4AO2mvkwHa0PVtoEbL9y0ELHI6TPf+TNHmkzZHawDLAUULpqOGvLqcvrM2GFCWAI+AQpcyVy3bKXZqhC4oahBCrzaNzV+ybuXsMQ2LklSKVd7/nSfmacPSva23Sz+pkbWsTkKYZ+oW0xUbbSiLJqTT+J7Z5eZIXYisBgbL4fFvcs7zTffInP7mvDUehiHxynrPpZKUPkM4eMpWpgZKZHporfSbM+teE6Zz+7fWOU5n0ZXdXqJLjt+i8PvP22czQFrB3jQEu1YHBxL4RwR7iGD962sixyrR2YOztruu7XtF/BaJXugly8bWkauE3iguAODvmFXVco0METtjj2CcM3l0gHJKK9bJoqUalH3MK6la5du+Pt/+gipN3cZ4ImIV9+ybjKkPml3grsx680KLWBZtxUJGxWjpy0fp6wSXueRJfgmSg8uIAvl0kDOf2Oeo7le0UhZ3UFo+/8Pull8gHDyBrFwR9Amcbmuf9O6ZwOWHgF8AS X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(2616005)(47076005)(5660300002)(426003)(82310400005)(70206006)(70586007)(44832011)(8676002)(36756003)(450100002)(4326008)(508600001)(316002)(8936002)(2906002)(36860700001)(81166007)(83380400001)(26005)(1076003)(336012)(186003)(6666004)(54906003)(40460700003)(110136005)(7696005)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2022 08:41:19.5454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 767ffcf6-bf7e-403f-801c-08da21e06022 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7782 NUMA node structure "struct node" is using u64 as node memory range. In order to make other architectures can reuse this NUMA node relative code, we replace the u64 to paddr_t. And use pfn_to_paddr and paddr_to_pfn to replace explicit shift operations. The relate PRIx64 in print messages have been replaced by PRIpaddr at the same time. And some being-phased-out types like u64 in the lines we have touched also have been converted to uint64_t or unsigned long. Signed-off-by: Wei Chen --- v1 ->v2: 1. Drop useless cast. 2. Use initializers of the variables. 3. Replace u64 by uint64_t. 4. Use unsigned long for start_pfn and end_pfn. --- xen/arch/x86/include/asm/numa.h | 8 ++++---- xen/arch/x86/numa.c | 30 +++++++++++++++--------------- xen/arch/x86/srat.c | 25 +++++++++++++------------ 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/xen/arch/x86/include/asm/numa.h b/xen/arch/x86/include/asm/numa.h index 6eeae02060..1239f017c2 100644 --- a/xen/arch/x86/include/asm/numa.h +++ b/xen/arch/x86/include/asm/numa.h @@ -19,7 +19,7 @@ extern cpumask_t node_to_cpumask[]; #define node_to_cpumask(node) (node_to_cpumask[node]) struct node { - u64 start,end; + paddr_t start, end; }; extern int compute_hash_shift(struct node *nodes, int numnodes, @@ -38,7 +38,7 @@ extern void numa_set_node(int cpu, nodeid_t node); extern nodeid_t setup_node(unsigned int pxm); extern void srat_detect_node(int cpu); -extern void setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end); +extern void setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end); extern nodeid_t apicid_to_node[]; extern void init_cpu_to_node(void); @@ -76,9 +76,9 @@ static inline __attribute__((pure)) nodeid_t phys_to_nid(paddr_t addr) NODE_DATA(nid)->node_spanned_pages) #define arch_have_default_dmazone() (num_online_nodes() > 1) -extern int valid_numa_range(u64 start, u64 end, nodeid_t node); +extern int valid_numa_range(paddr_t start, paddr_t end, nodeid_t node); -void srat_parse_regions(u64 addr); +void srat_parse_regions(paddr_t addr); extern u8 __node_distance(nodeid_t a, nodeid_t b); unsigned int arch_get_dma_bitsize(void); diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index 680b7d9002..2b3a51afd0 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -162,12 +162,12 @@ int __init compute_hash_shift(struct node *nodes, int numnodes, return shift; } /* initialize NODE_DATA given nodeid and start/end */ -void __init setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end) -{ +void __init setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end) +{ unsigned long start_pfn, end_pfn; - start_pfn = start >> PAGE_SHIFT; - end_pfn = end >> PAGE_SHIFT; + start_pfn = paddr_to_pfn(start); + end_pfn = paddr_to_pfn(end); NODE_DATA(nodeid)->node_start_pfn = start_pfn; NODE_DATA(nodeid)->node_spanned_pages = end_pfn - start_pfn; @@ -198,11 +198,12 @@ void __init numa_init_array(void) static int numa_fake __initdata = 0; /* Numa emulation */ -static int __init numa_emulation(u64 start_pfn, u64 end_pfn) +static int __init numa_emulation(unsigned long start_pfn, + unsigned long end_pfn) { int i; struct node nodes[MAX_NUMNODES]; - u64 sz = ((end_pfn - start_pfn)< 1 ) @@ -218,9 +219,9 @@ static int __init numa_emulation(u64 start_pfn, u64 end_pfn) memset(&nodes,0,sizeof(nodes)); for ( i = 0; i < numa_fake; i++ ) { - nodes[i].start = (start_pfn<start < start) { @@ -275,7 +275,7 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa) void __init acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) { - u64 start, end; + paddr_t start, end; unsigned pxm; nodeid_t node; int i; @@ -318,7 +318,7 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) bool mismatch = !(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) != !test_bit(i, memblk_hotplug); - printk("%sSRAT: PXM %u (%"PRIx64"-%"PRIx64") overlaps with itself (%"PRIx64"-%"PRIx64")\n", + printk("%sSRAT: PXM %u (%"PRIpaddr"-%"PRIpaddr") overlaps with itself (%"PRIpaddr"-%"PRIpaddr")\n", mismatch ? KERN_ERR : KERN_WARNING, pxm, start, end, node_memblk_range[i].start, node_memblk_range[i].end); if (mismatch) { @@ -327,7 +327,7 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) } } else { printk(KERN_ERR - "SRAT: PXM %u (%"PRIx64"-%"PRIx64") overlaps with PXM %u (%"PRIx64"-%"PRIx64")\n", + "SRAT: PXM %u (%"PRIpaddr"-%"PRIpaddr") overlaps with PXM %u (%"PRIpaddr"-%"PRIpaddr")\n", pxm, start, end, node_to_pxm(memblk_nodeid[i]), node_memblk_range[i].start, node_memblk_range[i].end); bad_srat(); @@ -346,7 +346,7 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) nd->end = end; } } - printk(KERN_INFO "SRAT: Node %u PXM %u %"PRIx64"-%"PRIx64"%s\n", + printk(KERN_INFO "SRAT: Node %u PXM %u %"PRIpaddr"-%"PRIpaddr"%s\n", node, pxm, start, end, ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE ? " (hotplug)" : ""); @@ -369,7 +369,7 @@ static int __init nodes_cover_memory(void) for (i = 0; i < e820.nr_map; i++) { int j, found; - unsigned long long start, end; + paddr_t start, end; if (e820.map[i].type != E820_RAM) { continue; @@ -396,7 +396,7 @@ static int __init nodes_cover_memory(void) if (start < end) { printk(KERN_ERR "SRAT: No PXM for e820 range: " - "%016Lx - %016Lx\n", start, end); + "%"PRIpaddr" - %"PRIpaddr"\n", start, end); return 0; } } @@ -432,7 +432,7 @@ static int __init cf_check srat_parse_region( return 0; } -void __init srat_parse_regions(u64 addr) +void __init srat_parse_regions(paddr_t addr) { u64 mask; unsigned int i; @@ -457,7 +457,7 @@ void __init srat_parse_regions(u64 addr) } /* Use the information discovered above to actually set up the nodes. */ -int __init acpi_scan_nodes(u64 start, u64 end) +int __init acpi_scan_nodes(paddr_t start, paddr_t end) { int i; nodemask_t all_nodes_parsed; @@ -489,7 +489,8 @@ int __init acpi_scan_nodes(u64 start, u64 end) /* Finally register nodes */ for_each_node_mask(i, all_nodes_parsed) { - u64 size = nodes[i].end - nodes[i].start; + paddr_t size = nodes[i].end - nodes[i].start; + if ( size == 0 ) printk(KERN_WARNING "SRAT: Node %u has no memory. " "BIOS Bug or mis-configured hardware?\n", i); From patchwork Mon Apr 18 09:07:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 12816429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3A082C433F5 for ; Mon, 18 Apr 2022 09:12:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.307089.522383 (Exim 4.92) (envelope-from ) id 1ngNQG-0003aJ-9D; Mon, 18 Apr 2022 09:11:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 307089.522383; Mon, 18 Apr 2022 09:11:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNQG-0003Zt-1F; Mon, 18 Apr 2022 09:11:52 +0000 Received: by outflank-mailman (input) for mailman id 307089; Mon, 18 Apr 2022 09:11:51 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngNOB-0006ub-Cx for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 09:09:43 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on0620.outbound.protection.outlook.com [2a01:111:f400:fe0e::620]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 485455bc-bef7-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 11:09:42 +0200 (CEST) Received: from AS8PR04CA0175.eurprd04.prod.outlook.com (2603:10a6:20b:331::30) by AM0PR08MB4402.eurprd08.prod.outlook.com (2603:10a6:208:147::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 09:09:39 +0000 Received: from VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:331:cafe::13) by AS8PR04CA0175.outlook.office365.com (2603:10a6:20b:331::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:09:39 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT021.mail.protection.outlook.com (10.152.18.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:38 +0000 Received: ("Tessian outbound 62985e3c34b6:v118"); Mon, 18 Apr 2022 09:09:38 +0000 Received: from ff45ff41fb00.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B65B4532-1C2E-4959-AB3A-F74E8031AACF.1; Mon, 18 Apr 2022 09:09:32 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ff45ff41fb00.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 09:09:32 +0000 Received: from AS9PR06CA0544.eurprd06.prod.outlook.com (2603:10a6:20b:485::14) by AS8PR08MB7791.eurprd08.prod.outlook.com (2603:10a6:20b:52d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Mon, 18 Apr 2022 09:09:30 +0000 Received: from VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:485:cafe::e8) by AS9PR06CA0544.outlook.office365.com (2603:10a6:20b:485::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 09:09:30 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT055.mail.protection.outlook.com (10.152.19.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 09:09:30 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:28 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Mon, 18 Apr 2022 09:09:27 +0000 Received: from ais-wip-ds.shanghai.arm.com (10.169.190.86) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 09:09:26 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 485455bc-bef7-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D2YTQR4kVi07mVUXoM7ogXNLlXVpGhLewzGsT6EnZHU=; b=JWOD7Em0KRj2/b2TGc2wmvTSRaoDrgOwJFbKZMvDrztf1Ewfn6npj2HPv+CwwfENTVlLTz86gF7g4K7EsXP2jFxpEqQMl51V2b2buaHrFKRahmEVZoZFK3iQemf9Fem1wDGYNfMnhby0xthq7Vk1hzWw0JhfjYOLUiiow/jSWqI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 4a4768c3d8d5e889 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MvMLb6QpuStdUhsJUHMdqf5n5N5A750ce+Nn1hP4hQCVok2rBbkH21A+23+cdUJMYFYsKw8zXyk2tWbqkgwjQG3S9B6COdHjqOt2wesqsM/KKmSl0PT308Sabk9rzpVUYZtESI2MzEQlgYSy2nhcZlJiMJzHxN9u6LUrQr7HJ8pt+t3MYgkcsWL1+G/hjseuPRo9KRp8jEVTweifcZJJBzWnopQJSKKGzHWpI5+GifcGYSQbIeD20WWtpBoIdzA1ZSoXg24Dj9ftUoGwx0y4HGSiOsRmzXPhBhbF0r66mqg4Rscy8+rwQ1ri6d/CEQKwwLO8wYXZ5NgzbSGtK3taMw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D2YTQR4kVi07mVUXoM7ogXNLlXVpGhLewzGsT6EnZHU=; b=eXF4NlfHtEaY99c12+vK/3Zl/3X5GGv7v514hhhsu3/TObhkHxTIRGyDbaw6nV/5l7Whx8AjwcIoOdFjCY4psxeDpU/RTDoHF1+kGxJkqug0V5XzYI720EY6+0SN8XFBgOhXGNCfWg4IFQHOtYOuL2M75Nr6+fC6CMczmNT+adi6fRYe/2JlQNw3v7FJiFIi5n+x+nyhFIjLzbYjQvKwwWoF+Keaua5hQBD/XmP4nc56vZueD2BCe1b6TGrMRJpziGyh7d1l046AJrAxETV2mzCpTn+a55OLb9hm6v8YqS9d+nvtIFbTvVwmSJNVkB59PD4BkH0qFi3mnSvWT46pfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D2YTQR4kVi07mVUXoM7ogXNLlXVpGhLewzGsT6EnZHU=; b=JWOD7Em0KRj2/b2TGc2wmvTSRaoDrgOwJFbKZMvDrztf1Ewfn6npj2HPv+CwwfENTVlLTz86gF7g4K7EsXP2jFxpEqQMl51V2b2buaHrFKRahmEVZoZFK3iQemf9Fem1wDGYNfMnhby0xthq7Vk1hzWw0JhfjYOLUiiow/jSWqI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Wei Chen To: <--to=xen-devel@lists.xenproject.org>, CC: , Wei Chen , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [PATCH v2 10/10] xen/x86: add detection of memory interleaves for different nodes Date: Mon, 18 Apr 2022 17:07:35 +0800 Message-ID: <20220418090735.3940393-11-wei.chen@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418090735.3940393-1-wei.chen@arm.com> References: <20220418090735.3940393-1-wei.chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 8fe2667f-5c83-42ed-43f9-08da211b2a8f X-MS-TrafficTypeDiagnostic: AS8PR08MB7791:EE_|VE1EUR03FT021:EE_|AM0PR08MB4402:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 5vbjxV65qalRGNW5ycXmUv+w0iYAcmkTaStqPKnnMYYqR5Xzuab2REBMdjGyiGGEXxFDuEB83IZkl/+HM3EUGXVrs9wYDRWr3lKgedgA4t2CY4luQDmcLg6K0uP07QM+gB2RhNzhuc1cbNYm5SX78Dz0zcagN18/ymFNhFyXd4NuA3T+D2bHlv2Yr7DychNA83lEWnH8PJ5Zbp4YyS0xfpH4EssaV6TT+4hXCXJeHyQJo+ks7rmfQJS59sqiZnqkpUMFkOpuS8ZRYvbrroMoFY5jnzI7xnQvo1pzy3kTHuPugTbb+STF+8S7JO70Ah0OQaXhk9XMjwxXoaoG0cSCcW/mtlz4+IQZHo6/v35QD2MSKK1OjcPEFniJ68Eie934IMlQz9w7u7XN/4I6UZbOYyhredIVU01qKs2EwSbVL7+PGxQe99lQwdc44XzzWb+faPmDEsPZNZCjMpwXuXJEcU2kbuy8GJeT9CmkvboAB4dXGJVs1GaRBvmUnYhgcqHifwZdx3acqrusyliqlwZviCvycUpAC9unkHMUbZC2yjS49+9wmCV3MIozf5C4UVrbSZ9iPV1ljZsIeOls6LiWZQT57zlNOE56Qz1uzwr8hkQQyBdXeE0Nu8t7EDYahmHC5drbARKDZQWtdGummQO/97Fc/EDcWTCEOXrISS740SkdtIACsbKzM2LMjuEEj4Khz+5/5fpzHZtAN0iBR2/fQw== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(8936002)(6666004)(7696005)(8676002)(316002)(356005)(26005)(1076003)(336012)(426003)(70586007)(4326008)(86362001)(36860700001)(5660300002)(44832011)(83380400001)(70206006)(2616005)(81166007)(47076005)(186003)(36756003)(2906002)(40460700003)(110136005)(508600001)(54906003)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7791 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8cf1de3b-8cb8-4123-5504-08da211b2569 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fNTokM2cT+IhKc36fE7XL8XYfarcIIcbNawRbwsPJW7WB2nn6gxgg0fawG4QfJKenpbd7N7H0BvcYlAbzOSlecRkYZwxnINx4Ws6Oz3f5tgu2At5v+y0qzmZQ+VaBogZUQxhBUEZeNrD7Q3X7ko7PtHZsDOymnTN5r2Ro2a/jaOvaIq/TRHonjg5XUHoUYdKdWejufiX+NjYGQbWy91KDMMbkzwLepl7imO4amQn6bhfd7axDsA2kKv35tfZUnTGORhA3EOYyvmgh/56TY8YQnPFeyJsvfS7ZZwbnGSeQY0lzuD/f4/zFz/MxAnsmC2B8kmrLsUHsB9aQrguHwAaQPAlBuYwuwGxkQr6qa4jhALQ1F43ZxLEAbmNuo6X58BjZGeRDPz2gmen5Ci37kHYrXtiOBriXqoHmQYTMWDJOVzQdE1d99Xt2btL49g+KLrB70hDj1MHjE+keCV4i3ef8tWnQem4Uq5dwcIQkE3nEWIFseoVx3Tt4zQgBNbF7r0zA8x6dVpJkZVlKNZNKgKglk/+2IaePDI9rgg6xHegeJqL1dZbEjC11Qc4BpE32v8Kpuf8S2Wb8cdWa8LQ66Eojxw6eWva1m1B1D/wj5qudHcAfGuflEIh8Vv47Q/wDEB6Dz+yZEWtpx5+2vu6haB60Izyz4alZf3GSmpB1yL3VmxDVVhyl6J5ITloWFpUxX8L X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(44832011)(186003)(450100002)(26005)(40460700003)(110136005)(36860700001)(7696005)(82310400005)(2906002)(54906003)(316002)(6666004)(336012)(70586007)(47076005)(426003)(70206006)(2616005)(81166007)(36756003)(4326008)(1076003)(508600001)(8936002)(83380400001)(86362001)(8676002)(5660300002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 09:09:38.6829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fe2667f-5c83-42ed-43f9-08da211b2a8f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT021.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4402 One NUMA node may contain several memory blocks. In current Xen code, Xen will maintain a node memory range for each node to cover all its memory blocks. But here comes the problem, in the gap of one node's two memory blocks, if there are some memory blocks don't belong to this node (remote memory blocks). This node's memory range will be expanded to cover these remote memory blocks. One node's memory range contains other nodes' memory, this is obviously not very reasonable. This means current NUMA code only can support node has no interleaved memory blocks. However, on a physical machine, the addresses of multiple nodes can be interleaved. So in this patch, we add code to detect memory interleaves of different nodes. NUMA initialization will be failed and error messages will be printed when Xen detect such hardware configuration. Signed-off-by: Wei Chen --- v1 ->v2: 1. Update the description to say we're after is no memory interleaves of different nodes. 2. Only update node range when it passes the interleave check. 3. Don't use full upper-case for "node". --- xen/arch/x86/srat.c | 49 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index c3e13059e9..53968e4085 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -271,6 +271,35 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa) pxm, pa->apic_id, node); } +/* + * Check to see if there are other nodes within this node's range. + * We just need to check full contains situation. Because overlaps + * have been checked before by conflicting_memblks. + */ +static bool __init check_node_memory_interleave(nodeid_t nid, + paddr_t start, paddr_t end) +{ + nodeid_t i; + const struct node *nd = &nodes[nid]; + + for_each_node_mask(i, memory_nodes_parsed) + { + /* Skip itself */ + if (i == nid) + continue; + + nd = &nodes[i]; + if (start < nd->start && nd->end < end) { + printk(KERN_ERR + "Node %u: (%"PRIpaddr"-%"PRIpaddr") interleaves with node %u (%"PRIpaddr"-%"PRIpaddr")\n", + nid, start, end, i, nd->start, nd->end); + return true; + } + } + + return false; +} + /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ void __init acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) @@ -340,10 +369,22 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) nd->start = start; nd->end = end; } else { - if (start < nd->start) - nd->start = start; - if (nd->end < end) - nd->end = end; + paddr_t new_start = nd->start; + paddr_t new_end = nd->end; + + if (start < new_start) + new_start = start; + if (new_end < end) + new_end = end; + + /* Check whether new range contains memory for other nodes */ + if (check_node_memory_interleave(node, new_start, new_end)) { + bad_srat(); + return; + } + + nd->start = new_start; + nd->end = new_end; } } printk(KERN_INFO "SRAT: Node %u PXM %u %"PRIpaddr"-%"PRIpaddr"%s\n",