From patchwork Mon Jun 7 02:43:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59378C4743E for ; Mon, 7 Jun 2021 02:44:07 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E762761209 for ; Mon, 7 Jun 2021 02:44:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E762761209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137536.254868 (Exim 4.92) (envelope-from ) id 1lq5F9-0003av-6R; Mon, 07 Jun 2021 02:43:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137536.254868; Mon, 07 Jun 2021 02:43:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5F9-0003ak-2f; Mon, 07 Jun 2021 02:43:59 +0000 Received: by outflank-mailman (input) for mailman id 137536; Mon, 07 Jun 2021 02:43:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5F7-0003W9-KM for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:43:57 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:7e1a::613]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e72c521d-edcb-45e3-a34c-0b80ce31f886; Mon, 07 Jun 2021 02:43:53 +0000 (UTC) Received: from AM6PR04CA0004.eurprd04.prod.outlook.com (2603:10a6:20b:92::17) by AM9PR08MB5938.eurprd08.prod.outlook.com (2603:10a6:20b:2da::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Mon, 7 Jun 2021 02:43:47 +0000 Received: from VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:92:cafe::86) by AM6PR04CA0004.outlook.office365.com (2603:10a6:20b:92::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Mon, 7 Jun 2021 02:43:47 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT044.mail.protection.outlook.com (10.152.19.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:47 +0000 Received: ("Tessian outbound 836922dda4f1:v93"); Mon, 07 Jun 2021 02:43:46 +0000 Received: from 5e7e6bb04b87.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B3FF24D9-2469-4FA8-BD57-4AD5C80A7B5F.1; Mon, 07 Jun 2021 02:43:40 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5e7e6bb04b87.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:43:40 +0000 Received: from DBBPR09CA0037.eurprd09.prod.outlook.com (2603:10a6:10:d4::25) by DBBPR08MB4522.eurprd08.prod.outlook.com (2603:10a6:10:d2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Mon, 7 Jun 2021 02:43:37 +0000 Received: from DB5EUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:d4:cafe::df) by DBBPR09CA0037.outlook.office365.com (2603:10a6:10:d4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 02:43:37 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT045.mail.protection.outlook.com (10.152.21.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:37 +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.2176.14; Mon, 7 Jun 2021 02:43:35 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:43:33 +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: e72c521d-edcb-45e3-a34c-0b80ce31f886 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=wFHlw8L+DYMmW1VL14RO+7hEsLY/c2HmSWKQXFt7g74=; b=1bsKOM63byfLzsKnBPezFiDgPYOCfArV7ULsjR5ZpnwtG7nslTQcymaS9+nCker/oSnBeKtuT0fxeeTp9Ot3s0ECDXgdq/D5aHxAB3tb0vNm6OrPAxtTR8No91VaZQ2jlAd1nTJRO4EznZvydi5WlsTMOc6Fp6FozwKWxlZGvjE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: bb25161b750b923f X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b/uoTfvXvra6bWOonyZLbRBeNe3EFBTydk4OAwtkgqGN9fjJQVdclSUyg+6MvHffj2hTtrVWlKeBbrRdkMcFT+Ia1vQxGRM2MvcEOZx548O9gSFhDfTuQ+UBFdvVJ3oZNJxxeNXxALWX5vbFZvv8/ZWvEpjcd2RlJ3mun+CkzUj7jH0qhWl38gon+xncVE95sWCGRHPqBAwu7WgJv2E0rJLNNBIGpaQa9KPRwxPF7SXGDQ1X2cWnUpRj2fRazbU0FSPJ9Jo2OPTycJq/XrfYxvnv/HEl3xRkQ4Avj0eyxqDK+AnQ+l9G4ZCyWW9fSZi0GliiXK5ZzZX70zk7Ec0bVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wFHlw8L+DYMmW1VL14RO+7hEsLY/c2HmSWKQXFt7g74=; b=DbyzKIyIGXkuxFzL+jrIPBVrl+YPPgOwUnYNIyTOv5WEet4hb5ycGx8+mrQvaokVrWoe30zGj3zAIXx+hWTXGIAYpk1AWMTgVdXI138Qbu5X/Xehqi5nTfprcuaf1fYxZmO6FEnaWIg6y2mI7e2vwHFins8/YsqxCvqQLrfNPvO91ThuCCkjSXX9uOzMYZq1eBQ8bQxSrHYXi7ivBCxr76EFNObxAaVyFWgTtzuvZq+qIJvP76C/0EfkMF/vPaPJntqu7uAiYNm0XbGOjxviEKzWAm9rIIjOE5+mBy5ZFrjXlOnQNKvzzi5JVaIjedDmUgyvuzoz9+zOMm11l9of5w== 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=wFHlw8L+DYMmW1VL14RO+7hEsLY/c2HmSWKQXFt7g74=; b=1bsKOM63byfLzsKnBPezFiDgPYOCfArV7ULsjR5ZpnwtG7nslTQcymaS9+nCker/oSnBeKtuT0fxeeTp9Ot3s0ECDXgdq/D5aHxAB3tb0vNm6OrPAxtTR8No91VaZQ2jlAd1nTJRO4EznZvydi5WlsTMOc6Fp6FozwKWxlZGvjE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 1/9] xen/arm: introduce domain on Static Allocation Date: Mon, 7 Jun 2021 02:43:10 +0000 Message-ID: <20210607024318.3988467-2-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1afd8f2-ce5f-42fc-e02a-08d9295e12fd X-MS-TrafficTypeDiagnostic: DBBPR08MB4522:|AM9PR08MB5938: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: yN1QZl0eKLy6qmQjvRD+eNwBzWKoWU6aLms5DiUPiqTb1byCqsXdMnSPfhQWdcCy7F432l9WSFRy9m0JmouZRnk5KIwYjowhZjq1QHuUpreJ6VI2YGB6Ki8TxbeXHpxJc0eejgSNmGj2PK7+uY4ILMOAgRQGZO4DB4T6Fod5Xju2M+KlM3kRpm+1lg8u5Ovux6+ZgGYjwaJnoo7+YObfzf80UF0mFeSnyMWxeUj+IMopy5/kT1Yq5RUHPoWxUYQn0OGqKm3aITHFkA2z3AbKQFfdGkTCcXRujp11IhByZkSN/7cztkdTN0dmp4wpssiskHTg83XlowlJn1QTs08rdbKdMQ5csHoW2V4RKpl1lxs7UKM/A14+MWgW8BOuhMx6hxUS83DB27tC/icxgXNBfLrYd7ympaYniHPCwjC21D0ZKmxE3Z6A03va6+7At0jS3KdhYHdDmQrt/m+OXij14l3tSxI+f9F2v0DIf+DtZNS0O24lX8Ta3lzL1sDAVNwD6xwHOz9nOcCWrb+xs7rWpAn+GwIW4dE0ryX/RCj6sgtUeLbkFblo2PjGbfBtfEQZDA/58VpHfRgfJ8o6RsYofKvLiMDySH+owBDndUNTcXnPmyqybQST69zx8xs+RlTKEyiFSJ1azaLGyLm7iwZH29HMdjLZz2VFByIoZkUJ03dUFsO92USO0+HuBIVyyJLFCjxbtAl7Y3o3WC7F7hjGNg== 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:(4636009)(376002)(346002)(136003)(396003)(39860400002)(36840700001)(46966006)(356005)(186003)(82310400003)(70206006)(54906003)(1076003)(316002)(4326008)(426003)(6666004)(8936002)(110136005)(8676002)(26005)(83380400001)(47076005)(81166007)(36756003)(44832011)(86362001)(70586007)(82740400003)(36860700001)(5660300002)(7696005)(478600001)(2616005)(2906002)(336012)(2101003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4522 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: d6a9e6ac-375a-410d-7b66-08d9295e0d1f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MLZezpl5jCBA2q6yA5SUm7rr62tlT4We+bqZLJlAPrkK759HkGh+Yrb+yDbxMRT3JOcE1FAghtOsDRuus2Z2e6twd8pn9NDZPgat1hp6R92TE1KBUceVcVw47R5Fwyu9yeihYkhyb/dcXh+aCkw7z5cqtuM9s+EZmxukVCigrZMaKL6Y5LehpGJ4XC9PFT1FWlM/7NS0laplSw4HtIy7EbvN5whrDnZ60q3w4CT/b1AW+pPHf2J7ur+Ehn/7UOANYQ2aC8F+7qHK+Kpww4bFva7V+S66B6FmrUnSskH01uTGz1tKW1NNViHdgRRcZsbrlQNwQNh6/M8VJChCzaCSqw/cxgbXgcTZt7fQODODiX/os7nLBGngU0qoalPB07JolfM2gk3FjP5OZNhGjZdDR8u4JQ2r9Ylyb4Jv6DSkUBCpBDE/64dXurZrhOgKffXM53l6gOzp4AQjHg66HWbEwN17GqgNs5hwOVMrXQ1WmrTUoe59PbSeewjaIkAXCCde/9q7WzDzfKXiiAT7La4VBF5EvPzS5tmvJMx+NYwbqTnTkhU6MiRWRGdMmoS2w8TKA0/NzFPy6iOTicpnsU0ukgoplGwANH9xchlXsfqkpYGVipOQcwevMzSFPzUoslfato0wvN8O6fLrZy3qSw800kOp/CHaC+GPOPZqA27bVqEWMAz3U1dG1LRKkPyTQcuL 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:(4636009)(376002)(346002)(136003)(396003)(39860400002)(36840700001)(46966006)(186003)(82310400003)(70206006)(54906003)(1076003)(316002)(4326008)(426003)(6666004)(8936002)(110136005)(8676002)(26005)(83380400001)(47076005)(81166007)(36756003)(44832011)(86362001)(70586007)(82740400003)(36860700001)(5660300002)(7696005)(478600001)(2616005)(2906002)(336012)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:43:47.0608 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1afd8f2-ce5f-42fc-e02a-08d9295e12fd 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: VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB5938 Static Allocation refers to system or sub-system(domains) for which memory areas are pre-defined by configuration using physical address ranges. Those pre-defined memory, -- Static Memory, as parts of RAM reserved in the beginning, shall never go to heap allocator or boot allocator for any use. Domains on Static Allocation is supported through static memory nodes, defined in reserved-memory node with `xen,static-memory-domain` compatible, which are specifying physical RAM as this domain's guest RAM. {address, size}-cells will be consistent with the ones defined in the parent node, reserved-memory. This patch introduces this new static memory device tree node, and also documents and parses this new attribute at boot time and stores related info in static_mem for later initialization. Signed-off-by: Penny Zheng --- v2 changes: - fix typos - consider reserved-memory binding and use phandle to refer --- docs/misc/arm/device-tree/booting.txt | 49 +++++++++++++++++++++++++++ xen/arch/arm/bootfdt.c | 12 +++++-- xen/include/asm-arm/setup.h | 2 ++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt index 5243bc7fd3..ba7854b2d3 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -268,3 +268,52 @@ The DTB fragment is loaded at 0xc000000 in the example above. It should follow the convention explained in docs/misc/arm/passthrough.txt. The DTB fragment will be added to the guest device tree, so that the guest kernel will be able to discover the device. + + +Static Allocation +============= + +Static Allocation refers to system or sub-system(domains) for which memory +areas are pre-defined by configuration using physical address ranges. +Those pre-defined memory, -- Static Memory, as parts of RAM reserved in the +beginning, shall never go to heap allocator or boot allocator for any use. + +Domains on Static Allocation is supported through static memory nodes, +defined in reserved-memory node with `xen,static-memory-domain` compatible, +which are specifying physical RAM as this domain's guest RAM. +#{address, size}-cells will be consistent with the ones defined in the +parent node, reserved-memory. + +On memory allocation, these pre-defiend static memory ranges shall be +firstly mapped to the fixed guest RAM address `GUEST_RAM0_BASE`. +And until it exhausts the `GUEST_RAM0_SIZE`, it will seek to `GUEST_RAM1_BASE`. +`GUEST_RAM0` may take up several pre-defined physical RAM regions. + +The dtb property should look like as follows: + + / { + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + + staticmemdomU1: static-memory@0x30000000 { + compatible = "xen,static-memory-domain"; + reg = <0x0 0x30000000 0x0 0x20000000>; + }; + }; + + chosen { + domU1 { + compatible = "xen,domain"; + #address-cells = <0x2>; + #size-cells = <0x2>; + cpus = <2>; + xen,static-mem = <&staticmemdomU1>; + + ... + }; + }; + }; + +DomU1 will have a static memory of 512MB reserved from the physical address +0x30000000 to 0x50000000. diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index dcff512648..5b3bb75b5f 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -187,9 +187,17 @@ static int __init process_reserved_memory_node(const void *fdt, int node, if ( rc == -ENOSPC ) panic("Max number of supported reserved-memory regions reached."); - else if ( rc != -ENOENT ) + else if ( rc == -ENOENT ) + return 0; + else if ( rc ) return rc; - return 0; + + /* Static memory node with compatible string "xen,static-memory-domain". */ + if ( fdt_node_check_compatible(fdt, node, "xen,static-memory-domain") == 0 ) + rc = process_memory_node(fdt, node, name, depth, address_cells, + size_cells, &bootinfo.static_mem); + + return rc; } static int __init process_reserved_memory(const void *fdt, int node, diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 5283244015..5e9f296760 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -74,6 +74,8 @@ struct bootinfo { #ifdef CONFIG_ACPI struct meminfo acpi; #endif + /* Static Memory */ + struct meminfo static_mem; }; extern struct bootinfo bootinfo; From patchwork Mon Jun 7 02:43:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FBC1C48BCD for ; Mon, 7 Jun 2021 02:44:09 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 521BD61209 for ; Mon, 7 Jun 2021 02:44:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 521BD61209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137535.254857 (Exim 4.92) (envelope-from ) id 1lq5F6-0003Ip-TN; Mon, 07 Jun 2021 02:43:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137535.254857; Mon, 07 Jun 2021 02:43:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5F6-0003Ig-Pm; Mon, 07 Jun 2021 02:43:56 +0000 Received: by outflank-mailman (input) for mailman id 137535; Mon, 07 Jun 2021 02:43:56 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5F6-0003IQ-5W for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:43:56 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (unknown [40.107.7.54]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f1845ea1-542b-467f-92d7-6d1257dcd900; Mon, 07 Jun 2021 02:43:52 +0000 (UTC) Received: from AM6PR04CA0024.eurprd04.prod.outlook.com (2603:10a6:20b:92::37) by DB7PR08MB3835.eurprd08.prod.outlook.com (2603:10a6:10:75::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Mon, 7 Jun 2021 02:43:48 +0000 Received: from VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:92:cafe::e4) by AM6PR04CA0024.outlook.office365.com (2603:10a6:20b:92::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 02:43:48 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT044.mail.protection.outlook.com (10.152.19.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:48 +0000 Received: ("Tessian outbound 836922dda4f1:v93"); Mon, 07 Jun 2021 02:43:48 +0000 Received: from ebf985aec23b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BA651BA8-78CC-4AA1-97E2-FC7EEFFB8E5B.1; Mon, 07 Jun 2021 02:43:42 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ebf985aec23b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:43:42 +0000 Received: from DU2PR04CA0248.eurprd04.prod.outlook.com (2603:10a6:10:28e::13) by AM0PR08MB5363.eurprd08.prod.outlook.com (2603:10a6:208:188::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22; Mon, 7 Jun 2021 02:43:41 +0000 Received: from DB5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28e:cafe::d) by DU2PR04CA0248.outlook.office365.com (2603:10a6:10:28e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20 via Frontend Transport; Mon, 7 Jun 2021 02:43:41 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT062.mail.protection.outlook.com (10.152.20.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:40 +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.2176.14; Mon, 7 Jun 2021 02:43:40 +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.2176.14; Mon, 7 Jun 2021 02:43:39 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:43:37 +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: f1845ea1-542b-467f-92d7-6d1257dcd900 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=cC5QXJLTfZEmB3XeRfskTwUSAKX1zEyV98uM4QkI6go=; b=bQWQjoWa7x4Dy26UKrmGSwt6+XmWzDF7MQGjqnk+JYIdBpljmWjKjE9SrejpXmplCt7WSDDgWZV6VsdYNJyWuUgZzB7jdmmQzBjtxkmkF/P7llq47Xki7xWsnLqSxkPEPOPWcMVwH3Yxxg7noISegeR8eBNpxh07tCBZIieUqPI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: 9750348ef5da09c8 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oMCWgHXTxOc0cNVXAY8QQxYXCBbsefASSAuvKuKKA3W1fuxJlc3YHRtBgTdtLtIV7aYLjd6QSqLjotRnXFzi8y9kj3TV/uw2n1uXOiuF9k/oYW57rB2s62cCdi05BzoW5AeGSCpio/rG/cc9uokRPYz2+Q2pe5W+jvcEC8U93Tbh/33T1VHmQ/Mw16neHrERzu80YMPml+H8gVIhF2cczIifD0S+w5/OK6jW6A9cdhtbL3KE9hqruovxrMPEsznr7PMVjMwahSEpaedOFGPqEM1J9f1gwx6HBB9HsMuQPE+mU3gHAFo59NvOmS24oFBnJZdDe75H24iBbVsN95wkjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cC5QXJLTfZEmB3XeRfskTwUSAKX1zEyV98uM4QkI6go=; b=O64j7kBeSfEmzG2oEZ6KmJhg+eR6kk3B48KNipA9NpmIv0zzht+RjZ6KQ5T/hNG0bMhQpZCvQzFW5qXRymW4CPEmb5dJcowNkRMUPDvp+wnjLwviGc3pxqQ6P8G80s6fRchjyVhsCvLSXeUfcCDnJXbnewuq+zlac2kJeH3AhuGU17vjMgIHxMRmkUo8nK07vGIpg/Fx+hdgxMzQwb14BlHXH/zo2XwoVweYXXHSRR3BJ8fifOafYSqgu/8eXbazsHY3OZkL9cAAzWY9GsSxaoJystrESPGBwAFsX4TGPMp837r9hqorffdECbsNjeACwkN+lUSMmtA0nljn9sX/Rw== 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=cC5QXJLTfZEmB3XeRfskTwUSAKX1zEyV98uM4QkI6go=; b=bQWQjoWa7x4Dy26UKrmGSwt6+XmWzDF7MQGjqnk+JYIdBpljmWjKjE9SrejpXmplCt7WSDDgWZV6VsdYNJyWuUgZzB7jdmmQzBjtxkmkF/P7llq47Xki7xWsnLqSxkPEPOPWcMVwH3Yxxg7noISegeR8eBNpxh07tCBZIieUqPI= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 2/9] xen/arm: introduce PGC_reserved Date: Mon, 7 Jun 2021 02:43:11 +0000 Message-ID: <20210607024318.3988467-3-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05ef190f-59bc-4f7e-641f-08d9295e13ee X-MS-TrafficTypeDiagnostic: AM0PR08MB5363:|DB7PR08MB3835: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2331;OLM:2331; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 2/4uV6FPm6UCjnOKker4xkzeHRaNboO9iP4x7G4+L/dVX7xF1EakLc9TXvOS4H8D9C90IS2+Kpb23IZlqCIi87E/wT1XVtJicddOGG0fT2ntYDWPEJyfr8H3UTJPJ3ZIgcf3HHGuY2wEwGgLfeoLRyJkezZjls7zFDXiVqKaB5GMjr+DIsH52aXEBbWxBGk9THXsesRQPOjWUd+92+WeL/LqLKWpWIwhZwT1V2t401s75G5d6yFq5x1TdeSfnvM3UCLQpRNZW+hgR2SE1T24gqB4QpdzgVou8f08Cbk7LdcjSwbBEQMo7U6xwF6XbmgJPyd80NeAfoPPLx//rMYd+5Ws5xsd/KnCUoL0Aaxl5RiRYpu2KXbfHT+DKb+BC2OTqgXaMEthBC69aLBxka+mIkIifKBs5hUSiq6SVCLxr7R8ivSZEzdksmjkxRrIDSrxSrMTodFB61W+tk4REFjPN+sL8pkfCuyEbx4KE2jk/uZPUKl1h6CozasM+fHffAL224uY+wPydbmbOH7MiuTJqSb5Sm4annHwPAvR2NGOOTQWjJmLS5ytlUYVxawlsfDu6xJzMjLi8jKLozVfzh+hH8iLsrEWUvREdtsJEAuK2TckOmyO2uGGfv/Ai2mKh44OgrsRnwxkOhOJRxfUi2d2mM7sSkZkIJw2n8Hm1548rVIWmGPuFuECdviojEV9W5HaCpY16f/Vkj8IYvz7qECvXg== 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:(4636009)(376002)(136003)(346002)(396003)(39860400002)(46966006)(36840700001)(6666004)(36860700001)(478600001)(82310400003)(70586007)(36756003)(316002)(4326008)(47076005)(4744005)(2906002)(7696005)(54906003)(26005)(86362001)(1076003)(5660300002)(110136005)(70206006)(8676002)(2616005)(186003)(336012)(426003)(44832011)(83380400001)(356005)(82740400003)(8936002)(81166007)(2101003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5363 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 01b2e2f6-f140-4562-e251-08d9295e0f4b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nlerk61MW5oPLFmXPREyYUinC8sxtRf9MD1dgHcbrHjnzimfVM7iX8HnqasiHILtwiWlOjkWTfjyHehaC9imIEJ+KFXMd81c+Z4kjnDaax60y/i6xmC8eIytrwKaG7jlMs9H3OdK2QdC8OBqRARlXYzwAkOZ4/we5t4SWgJryFJ9Tqgw5OemYfu1S7aZtt0nArZ128NZPj07LZQNjaJH3nGSeXTzBRNgZQBp6NsIQjbSkZyQC86bqdoEk0MAhA2p13l/TPaxuBWesHSqBZzBIEix2wxzqYwcbOVsHOQBNsKrcUwEBngH7YutRM7J4IITFisIv+rTBhj1tExiwxwDAPs/+jPr99VnAvgayhKaUgkopY9VluJQb4kLQVRkQrrbrZUc31cjIFLPe7x+Jk/xtcoHr0IfnEI75skPsSrc1fh1InQjj8zMyFYUhjWlHn07HoIHXqYBWbUbXCNYItyJj/w5EF23uIdPRbA6GnmYOjtymA7FLDsoFFc7LORDMfnXIiz09m9EnqH0aEOf2uAywrdKUAOARnnroDlLk/aTifE8XwHLkaYzc9AzorhUGpC2SOqLzD8+/viVPVTQoxnXCFgzA9K6nMcYL9SC61Ibqopk3Wgg+Pkm8tUoy1aecoQallPenv8EkMo5LKvOR1TxPzeG94IN6hpbMKOPaAJZPKAM5oXvQpOvqXORs2NrSduQ 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:(4636009)(376002)(39860400002)(346002)(136003)(396003)(36840700001)(46966006)(2616005)(478600001)(8936002)(426003)(82310400003)(36756003)(4744005)(86362001)(70206006)(83380400001)(1076003)(5660300002)(44832011)(82740400003)(4326008)(54906003)(110136005)(316002)(2906002)(6666004)(36860700001)(47076005)(336012)(81166007)(26005)(7696005)(70586007)(186003)(8676002)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:43:48.6371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05ef190f-59bc-4f7e-641f-08d9295e13ee 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: VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3835 In order to differentiate pages of static memory, from those allocated from heap, this patch introduces a new page flag PGC_reserved to tell. Signed-off-by: Penny Zheng --- changes v2: - remove unused reserved field in struct page_info - remove unused helper page_get_reserved_owner and page_set_reserved_owner --- xen/include/asm-arm/mm.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 0b7de3102e..7034fae1b6 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -108,6 +108,9 @@ struct page_info /* Page is Xen heap? */ #define _PGC_xen_heap PG_shift(2) #define PGC_xen_heap PG_mask(1, 2) + /* Page is reserved */ +#define _PGC_reserved PG_shift(3) +#define PGC_reserved PG_mask(1, 3) /* ... */ /* Page is broken? */ #define _PGC_broken PG_shift(7) From patchwork Mon Jun 7 02:43:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE0D4C4743D for ; Mon, 7 Jun 2021 02:44:08 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8035960E08 for ; Mon, 7 Jun 2021 02:44:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8035960E08 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137538.254879 (Exim 4.92) (envelope-from ) id 1lq5FB-0003wC-Lf; Mon, 07 Jun 2021 02:44:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137538.254879; Mon, 07 Jun 2021 02:44:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FB-0003vz-IX; Mon, 07 Jun 2021 02:44:01 +0000 Received: by outflank-mailman (input) for mailman id 137538; Mon, 07 Jun 2021 02:44:01 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FB-0003IQ-1f for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:44:01 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (unknown [40.107.6.51]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e62f02ba-88a0-4b92-9ede-1c653ad2ce13; Mon, 07 Jun 2021 02:43:56 +0000 (UTC) Received: from AM5PR0101CA0024.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::37) by AM6PR08MB3878.eurprd08.prod.outlook.com (2603:10a6:20b:8b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Mon, 7 Jun 2021 02:43:54 +0000 Received: from AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:16:cafe::ed) by AM5PR0101CA0024.outlook.office365.com (2603:10a6:206:16::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 02:43:54 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT032.mail.protection.outlook.com (10.152.16.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:53 +0000 Received: ("Tessian outbound bf434e582664:v93"); Mon, 07 Jun 2021 02:43:53 +0000 Received: from a622a86e5caa.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2D36962D-F638-467F-B7D3-5FAE4E9318DC.1; Mon, 07 Jun 2021 02:43:46 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a622a86e5caa.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:43:46 +0000 Received: from DB6PR0601CA0035.eurprd06.prod.outlook.com (2603:10a6:4:17::21) by DB9PR08MB6857.eurprd08.prod.outlook.com (2603:10a6:10:2a2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.24; Mon, 7 Jun 2021 02:43:44 +0000 Received: from DB5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:17:cafe::e5) by DB6PR0601CA0035.outlook.office365.com (2603:10a6:4:17::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 02:43:44 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT044.mail.protection.outlook.com (10.152.21.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:44 +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.2176.14; Mon, 7 Jun 2021 02:43:43 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:43:41 +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: e62f02ba-88a0-4b92-9ede-1c653ad2ce13 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=2oM5iiW6n6qyxMv8aSjmUSUvQgcdsVFFxcjsWYlu1N4=; b=a/yA+w7oQl3DWt4LH5LvZezJTRI88SIvm051IVTo4/epBsxsQgKkarXVCH0KFZGbHwalKXJbkeUuROKIlPZPxiOTeVhKzVHwK+4SweuZUF9ehV+k2m5sQR81/rZIKEcdp6tOo5IDxo/TpLsT5yjTOLuuGFK215upjxbXqoQSiTY= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: 17c4e3fb51055c7c X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c0Z+rh36tSswXq3WjIP5LefuUHKZGA/8lGB4QyEtw4mjflMlSmv6sfwvcTBr/H12YBy5HEmR53vzq2ZUM3Z5LLCZ5KhnW52bekQD06wldFUiCJN1RsGwg508tYgLvJqrflghAPYEsJp+qKmVC6a70rmK07tfooZ7r3oTK3LJ4zeDxh5D7pGsOQbPM+YIwSFE7I6Vcs5a2ZXjv9VoC6ut/BczJY6En/sylPna4OneH55Ipt4fkaxE0U7q0I8wXgyWEF+XNlK7fjegpucq0aHUkK2xOxInSb7QNqdTnOp4rQXgWgZDDabEzPMU7yFllKyN8Bqf2MLxqFzj4HUKZghcCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2oM5iiW6n6qyxMv8aSjmUSUvQgcdsVFFxcjsWYlu1N4=; b=XPQFYD1b6BoJip5Q5CrYg95em3XmCzvSh4ZFL4gxZV5t45+VjHyY2nWlzvEQFdwZ4/Mz27xxk3aL10/gcj8YUojYSC5zpOKlz7ssIPk9TOcPR/iGIzJq3GzGMlO1XDN9z8HSsf7Gs2MhNluJBNj+ozrjTUYinnlE2ANjQQUE6/bBB0AN0imdQhzEzLsjSL1RgnuSnbVuHJqpnlpXll4U2uNnZ5oTpYkUHk7/yrUU0yejmFV4QEDRFSfNXQ/HtddxTz4E8cMSL9u0Dov/EEB5JO8ZbuZyFanq/zVA6CTJ2WZDiFVTnFqkFb5Xf/Sf1SjVg8dXNNn59JxaiBExMRlrkQ== 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=2oM5iiW6n6qyxMv8aSjmUSUvQgcdsVFFxcjsWYlu1N4=; b=a/yA+w7oQl3DWt4LH5LvZezJTRI88SIvm051IVTo4/epBsxsQgKkarXVCH0KFZGbHwalKXJbkeUuROKIlPZPxiOTeVhKzVHwK+4SweuZUF9ehV+k2m5sQR81/rZIKEcdp6tOo5IDxo/TpLsT5yjTOLuuGFK215upjxbXqoQSiTY= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 3/9] xen/arm: introduce CONFIG_STATIC_ALLOCATION Date: Mon, 7 Jun 2021 02:43:12 +0000 Message-ID: <20210607024318.3988467-4-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 40525657-4722-41d8-d4c6-08d9295e16e6 X-MS-TrafficTypeDiagnostic: DB9PR08MB6857:|AM6PR08MB3878: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:348;OLM:348; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: O7qhMxvRfGcbsbx5+7sohuD+Lx4RCcWRgE8G2euMwTo/QcLP/RkLdjIp5aJ+6BCEnwayHWUhtPXNXqLLF7DMFnNuhvf5XAJRCZEg4aMvvpIbzjBSRqy7cQY5I099P9NKDGVH4dFfBBoDKt6VhJJvxrLs7rRBPraKZPPzaMsL9XSKb+iG80PaYhcwIwXVq95W/3RDVCHMWp32FoEFlVbXEwbR10dp3w3YMAtLZKC74XBPgbgPxosOOt6ktT/6LyEtChZxhXMGqv1IRncfjqMyCu0IWCRyqxMC9FHbou2QGqBlHAzgVIjqGpot2qeMKWeA9GmdoF4c+scKQ5S8yCF+0eAKrTZNrDs5/PzpLo124V8Lj4zx2AYInhDL+wWbxM5PQvQYEM1wg2HnRz5kWnSlSlySLzD7Uc9xRglcpC1Rt1Nw/39fwJegl4Hc2N9O8XJ/xBm2mE6wjJlzAokxQFVoyhDOkGYUxjnkSTCNIe9zin1cp37H+PLBuF3vZtI7CJAfqq6W4/tge8Nvhx3tTs2eQwE07eiFJt+N+pGjg48u0Bl37iN8tkQ0bTk7M5QqLEE6usnYJoFLKL0LcuGM1X+YHANcDp5n2Ebtc0LH+mMeVbOrF97ARh6YYdHFkETCDT/tK+xHYDdXsYc0pq9i8xG3HH4ACf7HFWxVwVfqJaNDSaYPH0eXq9fe8/JjuOJuHbjeermHfUlrpAOik5rK971TRg== 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:(4636009)(396003)(346002)(136003)(376002)(39860400002)(46966006)(36840700001)(336012)(4744005)(478600001)(7696005)(86362001)(186003)(4326008)(44832011)(36860700001)(356005)(54906003)(1076003)(26005)(36756003)(2616005)(70586007)(70206006)(426003)(47076005)(82310400003)(82740400003)(6666004)(81166007)(8936002)(8676002)(110136005)(2906002)(316002)(5660300002)(36900700001)(2101003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6857 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: be6afcbc-5bf2-476d-361c-08d9295e1188 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +f37c69d9C9HMxXkDUEO1AqdJBgnYekDM65yyvyv8ebEQydVsSkFZyo9W2zRVCJ1n9ExMP4qoE/grFSbNlzu4VN+XOpHoT+e+F+NqkXAGk2A67JRYE+YjPvIelUr5SD8mXz2u4rVHmzaB4Ei12Y4Ht1DSxGN0ni6NFQAfd1uOipBSx5RSuNnSQbTa9osURKclLXSXxVi+3T9gbsSWAKeMGwYAF1HKdvcQTPaETzqQkIuaHgW0FVpKMrPczrQ+SimSr0rd9cGp6BfDwxorA1C7gSL6zECiRd5OiUjtnp+o85QcQV0NfJ0WFSc6FrngwykIot0G/i7jX6VQQkF0T1ctkDFYA+aW+g6tMpcXfOGXg3jFdVTkv1mUu9K5iSo1961VpM2DYsR7FmnYIcwPZFJSQJet8i6VEQ5r/gT+bztjpEv/Hi+ryOy6eAUWXIa7SNRhshmPLdxU0bZQNNxTLjiTjBDxlR+lHfnjMCLpSuJU2DIiHiJjhmcxiQJkPDwA0EgyXIg5DIXCscpFpk3oGtO+Gyuk4o5zI+7L/XzfjSkNg9bTkMQLXpKEaxgJKAJN8i32uaami/GEfrEbvdZbZ2FyPDuvbdivjAZu605KV3h2vqkVFXIiZ2EvOum661EgZ6ExOBt157MNhdRATx4rB69i+SwkwlUkqlMJO2cVPdRRrCmJ8es+n/Nqop6X3IRCja2 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:(4636009)(346002)(396003)(136003)(376002)(39860400002)(46966006)(36840700001)(8676002)(82740400003)(36756003)(110136005)(478600001)(6666004)(5660300002)(2906002)(8936002)(316002)(4326008)(54906003)(70206006)(86362001)(36860700001)(70586007)(426003)(336012)(47076005)(2616005)(7696005)(82310400003)(44832011)(81166007)(1076003)(26005)(186003)(4744005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:43:53.6967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40525657-4722-41d8-d4c6-08d9295e16e6 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: AM5EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3878 For now, since the feature of Domain on Static Allocation is only supported on ARM Architecture, this commit introduces new CONFIG_STATIC_ALLOCATION to avoid bringing dead codes in other archs. Signed-off-by: Penny Zheng --- changes v2: - new commit --- xen/arch/arm/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index ecfa6822e4..f165db8ecd 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -278,6 +278,9 @@ config ARM64_ERRATUM_1286807 If unsure, say Y. +config STATIC_ALLOCATION + def_bool y + endmenu config ARM64_HARDEN_BRANCH_PREDICTOR From patchwork Mon Jun 7 02:43:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A46FBC4743E for ; Mon, 7 Jun 2021 02:44:13 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4BFC86120D for ; Mon, 7 Jun 2021 02:44:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BFC86120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137540.254890 (Exim 4.92) (envelope-from ) id 1lq5FH-0004Nj-0q; Mon, 07 Jun 2021 02:44:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137540.254890; Mon, 07 Jun 2021 02:44:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FG-0004NV-S5; Mon, 07 Jun 2021 02:44:06 +0000 Received: by outflank-mailman (input) for mailman id 137540; Mon, 07 Jun 2021 02:44:06 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FG-0003IQ-1c for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:44:06 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (unknown [40.107.20.71]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1b257ead-462c-4549-b0c5-e09e4d61eec7; Mon, 07 Jun 2021 02:44:02 +0000 (UTC) Received: from PR2P264CA0045.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101:1::33) by AM9PR08MB6211.eurprd08.prod.outlook.com (2603:10a6:20b:2de::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22; Mon, 7 Jun 2021 02:43:56 +0000 Received: from VE1EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:101:1:cafe::69) by PR2P264CA0045.outlook.office365.com (2603:10a6:101:1::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Mon, 7 Jun 2021 02:43:56 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT056.mail.protection.outlook.com (10.152.19.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:56 +0000 Received: ("Tessian outbound bf434e582664:v93"); Mon, 07 Jun 2021 02:43:56 +0000 Received: from 99d96216c950.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 12EA9111-7FA4-470D-94E8-3C8E040EBF66.1; Mon, 07 Jun 2021 02:43:50 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 99d96216c950.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:43:50 +0000 Received: from DB6PR07CA0157.eurprd07.prod.outlook.com (2603:10a6:6:43::11) by PA4PR08MB6255.eurprd08.prod.outlook.com (2603:10a6:102:f1::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22; Mon, 7 Jun 2021 02:43:49 +0000 Received: from DB5EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:43:cafe::9) by DB6PR07CA0157.outlook.office365.com (2603:10a6:6:43::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.11 via Frontend Transport; Mon, 7 Jun 2021 02:43:49 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT042.mail.protection.outlook.com (10.152.21.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:49 +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.2176.14; Mon, 7 Jun 2021 02:43:47 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:43:45 +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: 1b257ead-462c-4549-b0c5-e09e4d61eec7 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=1pQ5ZYSIi8AeHiMoc+JqHBOk6Ajg45oD8n/vlgw9XyM=; b=wPpwC0p1EDoBhTPIPznNVFrBMR3CwEE1sy7kSnYsHMt6smxb4yxzHriPGaav0rjw+gIv8mKtkY9A9xSmjLWXd5wpGlReo8UgdhduW90LZAbNBUfVJjJKVascbgJfLktgDUVNcjasEneALaNSSuurjqyBMv2r0dGvuKMCIAUuV6o= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: eca746ad0a4f5db5 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=auQr5+Hw8bVa50IMqI76MdGxrxH7fBhq5+mqE6MP8hhFXIzs71vGdIm4yas3v40DEw1zdAdlca7lbTrTLpc6ZI/6DpNzcgiHBr2xfDRaLMoSfuh8jUBJXWrtCyyrsO9bOpeSQMGZFFL7R4KlriVeHMn6IWPDtAGIpo2z4rGPa1VILH9NOkxP3ykaRQZUtBwrQWQvBLOvdIObBmvBIktU6WNKgdlBbH7KBRiLG+QqBh6g0X/p0tirnP5pxC4M56kXJm46zi/qw4qVYgdisrR//lu9bG5Y1bwQturXJgYlzBvQl2apuKxjCGkrrWHobagWHB5E9Ypg/WhfJ51vWb40kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1pQ5ZYSIi8AeHiMoc+JqHBOk6Ajg45oD8n/vlgw9XyM=; b=XUMNC1gDAdLNBmsvr6PjXFeKV4S1I9YBMl1oiHTN1B7BD8gBdzCUtR05cwb4J1IGHDxk6mt/xgFdxDIuVBNu8VlJk3gqYkWpHfJrfCOSL40FheaFEpGxnrUj74z4/lqHmdkQDiiKYy1i8hX3179azDJqKE6bD2CXmYlxkLKQLlGeHGnfNBhtD8BZqE13CRvdBS5DYPs+agGcmX3EhDFlKibZ/jlfOZSe9yYv3DHI7vy+NwPovjpICFbkGa9gzocYfoq2pZuIxeP8x8WpnnXJJh8AdmrKgheKMRm8+VZ1L6sCte9aLtogtARyoB4Rlwc9lJ6XY5Ue5WtPFpv0/T8OSw== 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=1pQ5ZYSIi8AeHiMoc+JqHBOk6Ajg45oD8n/vlgw9XyM=; b=wPpwC0p1EDoBhTPIPznNVFrBMR3CwEE1sy7kSnYsHMt6smxb4yxzHriPGaav0rjw+gIv8mKtkY9A9xSmjLWXd5wpGlReo8UgdhduW90LZAbNBUfVJjJKVascbgJfLktgDUVNcjasEneALaNSSuurjqyBMv2r0dGvuKMCIAUuV6o= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 4/9] xen/arm: static memory initialization Date: Mon, 7 Jun 2021 02:43:13 +0000 Message-ID: <20210607024318.3988467-5-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7659ad6-78e9-4fb7-b9c9-08d9295e1896 X-MS-TrafficTypeDiagnostic: PA4PR08MB6255:|AM9PR08MB6211: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:409;OLM:409; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ConVpp4M6/fpTn6TFFXfhR5JCHasFD5yOr7RBESrZoNx/Hy/a7hW/HeDYzMWBkiBI3yZzWOHkPpD2noFvPnhnrAvM+t6u1VhuM6RXUhZJhx2NDqC7sd1yY29moWCtq7Z8KG+9mjwffmW9rUHoo25nv/QU5CUTEOrIx78NfX+MQxiNVo9hU25eHuc6VX9V4RhpLmewuUQMU7Z9uKC5m0MNHGllLAAkV7BQujAcgVhLNtJXfLdWTtOGFAlZnq0YjLxyTkHw/bUQUGBh6YxKCJNBmrEBVC9o0yLgYfMQPEwBIZnmfHuJSBAomiVHd9ay86uPayRVPU/UKEYKJEMeJvK+xsEg5i1I1swe7PnGRhQ8qGzdZ6bwkaEqAYOjQWWqsttNqNVU9be9/571OaXn3u4xEDRkkXJ+XQC6im+vKy+Sz4MivggClVIhUT4wmu+/2UTmhUtVBQhZob2ai/6nSm0UPaLp0OiUGt9N7/s8etEs4G1QDhtJbMtKFSwR8il5aa/hgiU9IGkmQLkkvVhW5TF3IAcY874vlp5nKg1uhDrwxyhBGwCxXYP52/WiyGkYd3lJu7bVF8MW6KXqmljthzfuY+KJpmsjz/6pFt2y18VcAgEJHgTzygM4AliVfgg2/QqhK81WVHarZ9n/JwZFiee/DJSyODJF7mtwJNubSC0hTgEGsD/hGqbS0TVhMfniBMRYkrclrMCSyAJfeuGJLwGnA== 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:(4636009)(346002)(376002)(396003)(39860400002)(136003)(46966006)(36840700001)(44832011)(7696005)(70206006)(5660300002)(83380400001)(426003)(82310400003)(81166007)(70586007)(26005)(356005)(36756003)(47076005)(2616005)(82740400003)(1076003)(110136005)(54906003)(8676002)(478600001)(6666004)(36860700001)(8936002)(2906002)(316002)(336012)(86362001)(4326008)(186003)(36900700001)(2101003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6255 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT056.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: d95f0018-13fa-43d6-8618-08d9295e1414 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zXeFbB4BmLfvcf67Q/bizRPdn0b38fuO5dKqg5v4BmNJonun0t+/kBILcG2yZkEz+WXvFqxVAXd5lYdlyzr7kW7UWGLACOuXxtqRNoKeDjsYxl8dNFH9IrSnJMvKzT2BaohNfSeQiG/tONUE8nyLG5soeozd5uwXsSzpVoORASvYcFlSr9suR1etmlpmmh8zjlqxwhkKbhPooRyjpN78ArUQfiQagtyWsGgwjhFXZDZPLexfiA5BLM0VctFMJxLuxKy6S8WXHuvJOUttz0gkQnHoMOT30mtGwQaufFeui3NZcnMAQUNPIpwGrhNn7v/sMJ2/PnhbzMq/7+rDYmzQGlBJ04o6L/tH72ruw2Ym7oIVXp1hMzDmyBK7THTwImk6Fh59csA6Pp5acj+RPUqycOuqqZYR8aMA0lYZCo9LKv99dT8wRxZKWgY/ZsQptGUOFYHXoaUMWphNlCXuV4HSF1KAfZRy2PLXomliIlkSYWGCz7A31woxFNuQ2svY9QNuDLjXCATwkFGv5D5ZxTZCdM3nqYUTCWIZktzkuKUmWHSNg8og7At88rhCKHBRYJiFWvjOzY0jUHKwxuaUR7Ra7SsL5UwJTDYYnFIYHgHeipmcQ8AQk0igGrGh0LS+LvWUDqpFz9xSQiXFjoY2Sf04T5OmVBan+pYAYDht2JK/DYcxwPXIgNs8Swjn87Z07ozY 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:(4636009)(396003)(346002)(39860400002)(376002)(136003)(36840700001)(46966006)(44832011)(7696005)(70206006)(5660300002)(83380400001)(426003)(1076003)(70586007)(26005)(36756003)(47076005)(186003)(2616005)(82310400003)(81166007)(82740400003)(110136005)(54906003)(316002)(336012)(8676002)(478600001)(6666004)(36860700001)(8936002)(2906002)(86362001)(4326008)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:43:56.4512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7659ad6-78e9-4fb7-b9c9-08d9295e1896 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: VE1EUR03FT056.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6211 This patch introduces static memory initialization, during system RAM boot up. New func init_staticmem_pages is responsible for static memory initialization. Helper free_staticmem_pages is the equivalent of free_heap_pages, to free nr_mfns pages of static memory. This commit defines a new helper free_page to extract common code between free_heap_pages and free_staticmem_pages, like following the same cache/TLB coherency policy. For each page, free_staticmem_pages includes the following extra steps to initialize: 1. change page state from inuse to free state and grant PGC_reserved. 2. scrub the page in need synchronously. Signed-off-by: Penny Zheng --- changes v2: - rename to nr_mfns - extract common code from free_heap_pages and free_staticmem_pages - remove dead codes in other archs, including move some to arm-specific file, and put some under CONFIG_ARM - mark free_staticmem_pages __init --- xen/arch/arm/setup.c | 27 ++++++++++++++ xen/common/page_alloc.c | 78 +++++++++++++++++++++++++++++++++-------- xen/include/xen/mm.h | 6 ++++ 3 files changed, 97 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 00aad1c194..daafea0abb 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -611,6 +611,30 @@ static void __init init_pdx(void) } } +/* Static memory initialization */ +static void __init init_staticmem_pages(void) +{ + int bank; + + /* + * TODO: Considering NUMA-support scenario. + */ + for ( bank = 0 ; bank < bootinfo.static_mem.nr_banks; bank++ ) + { + paddr_t bank_start = bootinfo.static_mem.bank[bank].start; + paddr_t bank_size = bootinfo.static_mem.bank[bank].size; + paddr_t bank_end = bank_start + bank_size; + + bank_start = round_pgup(bank_start); + bank_end = round_pgdown(bank_end); + if ( bank_end <= bank_start ) + return; + + free_staticmem_pages(maddr_to_page(bank_start), + (bank_end - bank_start) >> PAGE_SHIFT, false); + } +} + #ifdef CONFIG_ARM_32 static void __init setup_mm(void) { @@ -872,6 +896,9 @@ void __init start_xen(unsigned long boot_phys_offset, cmdline_parse(cmdline); setup_mm(); + /* If exists, Static Memory Initialization. */ + if ( bootinfo.static_mem.nr_banks > 0 ) + init_staticmem_pages(); /* Parse the ACPI tables for possible boot-time configuration */ acpi_boot_table_init(); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 958ba0cd92..8c00262c04 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1376,6 +1376,37 @@ bool scrub_free_pages(void) return node_to_scrub(false) != NUMA_NO_NODE; } +static void free_page(struct page_info *pg, bool need_scrub) +{ + mfn_t mfn = page_to_mfn(pg); + + /* If a page has no owner it will need no safety TLB flush. */ + pg->u.free.need_tlbflush = (page_get_owner(pg) != NULL); + if ( pg->u.free.need_tlbflush ) + page_set_tlbflush_timestamp(pg); + + /* This page is not a guest frame any more. */ + page_set_owner(pg, NULL); /* set_gpfn_from_mfn snoops pg owner */ + set_gpfn_from_mfn(mfn_x(mfn), INVALID_M2P_ENTRY); + +#ifdef CONFIG_ARM + if ( pg->count_info & PGC_reserved ) + { + /* TODO: asynchronous scrubbing. */ + if ( need_scrub ) + scrub_one_page(pg); + return; + } +#endif + if ( need_scrub ) + { + pg->count_info |= PGC_need_scrub; + poison_one_page(pg); + } + + return; +} + /* Free 2^@order set of pages. */ static void free_heap_pages( struct page_info *pg, unsigned int order, bool need_scrub) @@ -1425,20 +1456,7 @@ static void free_heap_pages( BUG(); } - /* If a page has no owner it will need no safety TLB flush. */ - pg[i].u.free.need_tlbflush = (page_get_owner(&pg[i]) != NULL); - if ( pg[i].u.free.need_tlbflush ) - page_set_tlbflush_timestamp(&pg[i]); - - /* This page is not a guest frame any more. */ - page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */ - set_gpfn_from_mfn(mfn_x(mfn) + i, INVALID_M2P_ENTRY); - - if ( need_scrub ) - { - pg[i].count_info |= PGC_need_scrub; - poison_one_page(&pg[i]); - } + free_page(&pg[i], need_scrub); } avail[node][zone] += 1 << order; @@ -1512,6 +1530,38 @@ static void free_heap_pages( spin_unlock(&heap_lock); } +#ifdef CONFIG_STATIC_ALLOCATION +/* Equivalent of free_heap_pages to free nr_mfns pages of static memory. */ +void __init free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns, + bool need_scrub) +{ + mfn_t mfn = page_to_mfn(pg); + unsigned long i; + + for ( i = 0; i < nr_mfns; i++ ) + { + switch ( pg[i].count_info & PGC_state ) + { + case PGC_state_inuse: + BUG_ON(pg[i].count_info & PGC_broken); + /* Mark it free and reserved. */ + pg[i].count_info = PGC_state_free | PGC_reserved; + break; + + default: + printk(XENLOG_ERR + "Page state shall be only in PGC_state_inuse. " + "pg[%lu] MFN %"PRI_mfn" count_info=%#lx tlbflush_timestamp=%#x.\n", + i, mfn_x(mfn) + i, + pg[i].count_info, + pg[i].tlbflush_timestamp); + BUG(); + } + + free_page(&pg[i], need_scrub); + } +} +#endif /* * Following rules applied for page offline: diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 667f9dac83..df25e55966 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -85,6 +85,12 @@ bool scrub_free_pages(void); } while ( false ) #define FREE_XENHEAP_PAGE(p) FREE_XENHEAP_PAGES(p, 0) +#ifdef CONFIG_ARM +/* Static Allocation */ +void free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns, + bool need_scrub); +#endif + /* Map machine page range in Xen virtual address space. */ int map_pages_to_xen( unsigned long virt, From patchwork Mon Jun 7 02:43:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDC23C4743D for ; Mon, 7 Jun 2021 02:44:21 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D36E60E08 for ; Mon, 7 Jun 2021 02:44:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D36E60E08 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137541.254901 (Exim 4.92) (envelope-from ) id 1lq5FJ-0004iu-Bk; Mon, 07 Jun 2021 02:44:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137541.254901; Mon, 07 Jun 2021 02:44:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FJ-0004if-72; Mon, 07 Jun 2021 02:44:09 +0000 Received: by outflank-mailman (input) for mailman id 137541; Mon, 07 Jun 2021 02:44:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FH-0003W9-Jo for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:44:07 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (unknown [40.107.6.65]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 92589372-4352-47c5-8fff-33cf698ec7b6; Mon, 07 Jun 2021 02:44:04 +0000 (UTC) Received: from AS8P251CA0018.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:2f2::25) by AM0PR08MB5091.eurprd08.prod.outlook.com (2603:10a6:208:15e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.24; Mon, 7 Jun 2021 02:44:01 +0000 Received: from AM5EUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f2:cafe::ee) by AS8P251CA0018.outlook.office365.com (2603:10a6:20b:2f2::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 02:44:01 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT055.mail.protection.outlook.com (10.152.17.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:44:01 +0000 Received: ("Tessian outbound 6d1d235c0b46:v93"); Mon, 07 Jun 2021 02:44:00 +0000 Received: from dd53acc8070d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 84A0B27A-975F-4E20-9B50-7054C63CE008.1; Mon, 07 Jun 2021 02:43:54 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id dd53acc8070d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:43:54 +0000 Received: from DB3PR08CA0009.eurprd08.prod.outlook.com (2603:10a6:8::22) by VI1PR0801MB1854.eurprd08.prod.outlook.com (2603:10a6:800:5c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.25; Mon, 7 Jun 2021 02:43:52 +0000 Received: from DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:0:cafe::9f) by DB3PR08CA0009.outlook.office365.com (2603:10a6:8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Mon, 7 Jun 2021 02:43:52 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT026.mail.protection.outlook.com (10.152.20.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:52 +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.2176.14; Mon, 7 Jun 2021 02:43:51 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:43:49 +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: 92589372-4352-47c5-8fff-33cf698ec7b6 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=K0fOlzkmZo8NkZdZnpDOUw9db/Rylzfd7fdhb0LDRQo=; b=NcwTHjVfAJ+iZgFKXRSAKk/xplxOYrdho2V6xsfOfq7+/ZyClBdEew3BzvND3uKaXaW4BdCiHgK73P0hpIUEiFJYu+Vn31LB54rR2lQqPBB2dEfU9xRv7NvMu/r5kpD6hbc5ifEWEYFuyn6iIOHfuyac1Nyo/JW0EMePxnIodu8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: 263d801f856ac61a X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rl1ylBfpsqgOxamCMH10uxipty3iprdODYqVDFeaTuDva+EXl+1Mf+nrReH3tewrA/KJ9pgGHzUaleIuf4yaI+roWiE4p2dXsXnxh6nXuC66skCcfWlamBm+sNoccULkWiKoZYH19uUlavnamr07yL78mNyl1sv2K1Shahrq22hoI4brd9l9+H1DRG3t6WpLlkU9IpzKGgqUsPuT/qUN1eZv0d/9zwUXWmpRk1iq4LzSCudQiQP4cQAr18YiL88S/fqxD1tuNKcFs+vZ4W54sgQz5eQPWyIwEZYxxiHGK2VEHUcqhmofXmdstu8/dHrkw/cdv9dFVuTqoZc/tzhhEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K0fOlzkmZo8NkZdZnpDOUw9db/Rylzfd7fdhb0LDRQo=; b=obXBO0BXvri9l0PxEjjghNQLeLBODpY65aLFiDBdza8iCruJ9fzUpy/NGSdNDDqY5s5M7H0/Z5eZ6cASWE/siP+Q1W37kTj7bpY5vTgyfV1WlVRvR0vFSHs0CNqrwlxztbhJKfQedLj2kmO5HbhaOtnlrxpsBaauPlWpur6OaApT6x3p4SlnOEU9oZrDCTvoIYpnc06efNtF6l2omjT9+KGPTEr+4BHZ0AGdCaSWdp7eu7uucUtVhddT2sIVAt9Lfwu8Leq2X8tS7EXSNwoQyMZYfYV/zFp1sIForzCzYlm8mK40UUexhFbsniSQR6aFtx7QzVjIylLHTCLaeZf4TA== 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=K0fOlzkmZo8NkZdZnpDOUw9db/Rylzfd7fdhb0LDRQo=; b=NcwTHjVfAJ+iZgFKXRSAKk/xplxOYrdho2V6xsfOfq7+/ZyClBdEew3BzvND3uKaXaW4BdCiHgK73P0hpIUEiFJYu+Vn31LB54rR2lQqPBB2dEfU9xRv7NvMu/r5kpD6hbc5ifEWEYFuyn6iIOHfuyac1Nyo/JW0EMePxnIodu8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 5/9] xen: introduce assign_pages_nr Date: Mon, 7 Jun 2021 02:43:14 +0000 Message-ID: <20210607024318.3988467-6-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2a9d48f0-e967-45bc-0d4f-08d9295e1b7c X-MS-TrafficTypeDiagnostic: VI1PR0801MB1854:|AM0PR08MB5091: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4941;OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ip0DfnUXDQx+26sRcl8H5XDeYFELaRGl6JXPvJfYizw6RY2wJ/VX29yzwzAqUKncaKGKNt8hCq4kRb69x6Ldzxi44arB4ql7fJKf66WbScu1OnuLXianeFqAl/H5N1gk3/ijuwlV0DH42p7eHhZWbXqOUALZsmhZk1mkpIrkhA1E9ofk1o399Z8olCUClsBqY1aiHvr7EhV/3AwL8L9ivr1bpAeJAg4hLtVacRS5DNvl7tlGWnKA2uOEiOrJf3Rk1PMDcPs+Hhr/lI6llUPBIxw/PKxnQALQgciBQLDDGyx8Vbla2bxQZRE0jx9oN5bBPpgbbtWS/KnlM4a4gdiyGnFhVD9GhxbT8b6xEdkpNS8YHf4UKX7LVL7/bR0+nCFYfXozn45Yhj8t2v6PXigVccc3AR5x3Mz4YY/J5kPOPSbf4PboiKGrVrHr7ySRUJHfrTgoTyKYYGWIHDnWVKAdC/1y2zWIDfhtyAmm0dCFNUE8s1Oh5HClMV3gTdX3pa99OYkaA7TLt5M5Zj2wzZqJ4gZfX6GV5ArbngwGes5nedSXaZr9GqHlmWFxqnMhPnGZZoAj74Z3J6xIQHUFcjb4r4ps0PwYPW8TG/OctKqnzr/smt0bjLI8l9R6Roc/Y1m4athuCLDoXBMMxvmT56aKb1xT0XUOy1y1LwE3HuBSK/hzVTOstJO2pStZSL3RMn2WkRVr5JFvBvFvgVgy9I9BNA== 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:(4636009)(39860400002)(136003)(376002)(346002)(396003)(46966006)(36840700001)(36860700001)(2616005)(426003)(2906002)(83380400001)(36756003)(1076003)(44832011)(82310400003)(336012)(6666004)(81166007)(8936002)(82740400003)(54906003)(110136005)(478600001)(4326008)(316002)(70586007)(47076005)(356005)(7696005)(186003)(26005)(70206006)(86362001)(8676002)(5660300002)(2101003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1854 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 363fd8cf-9a61-4515-c7c1-08d9295e1633 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jhibhITHFGAJOMP+jWEUFXl33TGqj868lI1NFvSLhcCDHkcHXB2Dnd4zYUnGk+PPXLiBjX6MHs7JK9VsPzBeDPhIOAniGewiaTDNPplK+7iqeWTTsCPqlbGOli5fBZR2P8OO4nAt0H6ZPJWq0ioTRM83GQ2+U+34vhpA0J0vtt27fEmPQO9Seqw36WIkzwE3ZRHsnjaBori2aewqpuzvyjYnw5BxRY74/epnUBj7b2Ddl+4xE0ekjv/Dc8sPXXRkfM+dPLoezW0a0U8bCkQsCPTw4q/5et58iZcX+FgGTnlMXJyvMrZb+r1EfuaGkbM4RP1BDFvHw4XDFtlIfzI/uQc4eEsLQcdgOLrm+xLp3+wWDs0Rk3jHINlvmIjj0LmDcIW0m0J8bplbFlkCMpamUiiNwZZJrmINlrCJ9HSdONhwQrgkHxCEfaqGXRP+O4wSZBGWUUEWM8cBm/Seiz7IDtlgDw8X9AMi31CYAmsxD3l1Cg/THpTpZ2WseZaYhtxDepdI4ufzrZOwpYYQfnGQwyuI5yDyzxG1+Q9zK5wc8ozlW/V6jS5UPbpIm0fJvLK3BTTADaDJFa64ciw+4WiSp+Emqv2REsIUUfALZuZy0beVZFBltx4Nk3mVPflSS3GrRan6IAJljwF2sEZmit92HyRt80MVMK0iWqO5ZN6SWkLDj+xfsLrAOvUYkJB1oDGs 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:(4636009)(39860400002)(396003)(136003)(376002)(346002)(46966006)(36840700001)(186003)(82310400003)(86362001)(26005)(44832011)(47076005)(336012)(2616005)(82740400003)(426003)(478600001)(7696005)(81166007)(6666004)(5660300002)(83380400001)(36756003)(70586007)(70206006)(4326008)(8676002)(8936002)(316002)(1076003)(36860700001)(2906002)(54906003)(110136005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:44:01.3845 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a9d48f0-e967-45bc-0d4f-08d9295e1b7c 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: AM5EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5091 Introduce new interface assign_pages_nr to deal with when page number is not in a power-of-two, which will save the trouble each time user needs to split the size in a power of 2 to use assign_pages. Signed-off-by: Penny Zheng --- changes v2: - introduce new interface assign_pages_nr --- xen/common/page_alloc.c | 26 +++++++++++++++++--------- xen/include/xen/mm.h | 10 ++++++++-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 8c00262c04..e244d2e52e 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -2301,14 +2301,14 @@ void init_domheap_pages(paddr_t ps, paddr_t pe) } -int assign_pages( +int assign_pages_nr( struct domain *d, struct page_info *pg, - unsigned int order, + unsigned int nr_pfns, unsigned int memflags) { int rc = 0; - unsigned long i; + unsigned int i; spin_lock(&d->page_alloc_lock); @@ -2324,7 +2324,7 @@ int assign_pages( { unsigned int extra_pages = 0; - for ( i = 0; i < (1ul << order); i++ ) + for ( i = 0; i < nr_pfns; i++ ) { ASSERT(!(pg[i].count_info & ~PGC_extra)); if ( pg[i].count_info & PGC_extra ) @@ -2333,18 +2333,18 @@ int assign_pages( ASSERT(!extra_pages || ((memflags & MEMF_no_refcount) && - extra_pages == 1u << order)); + extra_pages == nr_pfns)); } #endif if ( pg[0].count_info & PGC_extra ) { - d->extra_pages += 1u << order; + d->extra_pages += nr_pfns; memflags &= ~MEMF_no_refcount; } else if ( !(memflags & MEMF_no_refcount) ) { - unsigned int tot_pages = domain_tot_pages(d) + (1 << order); + unsigned int tot_pages = domain_tot_pages(d) + nr_pfns; if ( unlikely(tot_pages > d->max_pages) ) { @@ -2356,10 +2356,10 @@ int assign_pages( } if ( !(memflags & MEMF_no_refcount) && - unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) ) + unlikely(domain_adjust_tot_pages(d, nr_pfns) == nr_pfns) ) get_knownalive_domain(d); - for ( i = 0; i < (1 << order); i++ ) + for ( i = 0; i < nr_pfns; i++ ) { ASSERT(page_get_owner(&pg[i]) == NULL); page_set_owner(&pg[i], d); @@ -2374,6 +2374,14 @@ int assign_pages( return rc; } +int assign_pages( + struct domain *d, + struct page_info *pg, + unsigned int order, + unsigned int memflags) +{ + return assign_pages_nr(d, pg, (1U << order), memflags); +} struct page_info *alloc_domheap_pages( struct domain *d, unsigned int order, unsigned int memflags) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index df25e55966..25d970e857 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -131,12 +131,18 @@ int query_page_offline(mfn_t mfn, uint32_t *status); void heap_init_late(void); -int assign_pages( +int assign_pages_nr( struct domain *d, struct page_info *pg, - unsigned int order, + unsigned int nr_pfns, unsigned int memflags); + int assign_pages( + struct domain *d, + struct page_info *pg, + unsigned int order, + unsigned int memflags); + /* Dump info to serial console */ void arch_dump_shared_mem_info(void); From patchwork Mon Jun 7 02:43:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC0E1C4743E for ; Mon, 7 Jun 2021 02:44:20 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 427BC61209 for ; Mon, 7 Jun 2021 02:44:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 427BC61209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137542.254912 (Exim 4.92) (envelope-from ) id 1lq5FO-0005GW-3a; Mon, 07 Jun 2021 02:44:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137542.254912; Mon, 07 Jun 2021 02:44:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FN-0005GK-TR; Mon, 07 Jun 2021 02:44:13 +0000 Received: by outflank-mailman (input) for mailman id 137542; Mon, 07 Jun 2021 02:44:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FM-0003W9-Jn for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:44:12 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:fe02::623]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ef5b5427-2c06-4ac0-87cc-8ddf888cac62; Mon, 07 Jun 2021 02:44:08 +0000 (UTC) Received: from AS8PR04CA0054.eurprd04.prod.outlook.com (2603:10a6:20b:312::29) by DB6PR0801MB1719.eurprd08.prod.outlook.com (2603:10a6:4:3a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 02:44:05 +0000 Received: from AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:312:cafe::c9) by AS8PR04CA0054.outlook.office365.com (2603:10a6:20b:312::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 02:44:05 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT006.mail.protection.outlook.com (10.152.16.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:44:04 +0000 Received: ("Tessian outbound cce4cc55b7ee:v93"); Mon, 07 Jun 2021 02:44:04 +0000 Received: from 2fe3bb3aaf7d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B6965954-0DF6-472B-A63E-164F0ADC7278.1; Mon, 07 Jun 2021 02:43:57 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2fe3bb3aaf7d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:43:57 +0000 Received: from DBBPR09CA0005.eurprd09.prod.outlook.com (2603:10a6:10:c0::17) by AM9PR08MB7013.eurprd08.prod.outlook.com (2603:10a6:20b:419::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.26; Mon, 7 Jun 2021 02:43:56 +0000 Received: from DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::a) by DBBPR09CA0005.outlook.office365.com (2603:10a6:10:c0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Mon, 7 Jun 2021 02:43:56 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT049.mail.protection.outlook.com (10.152.20.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:43:56 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.14; Mon, 7 Jun 2021 02:43:56 +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.2176.14; Mon, 7 Jun 2021 02:43:55 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:43:53 +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: ef5b5427-2c06-4ac0-87cc-8ddf888cac62 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=pGxfEEBgvfyzUcQmDtVFw6fyVeow+GfVG9WP8F/FLKo=; b=XfnJA6E0yAXuYVbO2Iefp05/6kw7vdmXK3Cd7+lZckqHN2o+sZqaf+wWikIKDT/esPHfbP0dQwnXUDuh8M5aisehijz/gBB+VcH3H5RzxPVfiALRmPKC1/zbMdASNHbbDqy4tUbyijqQa3vxZW7lqwVr6ydE4a3zXMADQbb/aMo= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: 5ce1bddece8bc241 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gkKU40QEGQ7Y5k7LyIGVXnPPaJmLpF6vuP5RtGTrBIGdETEMF21StvwBdZfR52wdsjNgqnsSLcsXZ6X6uBDDk6AHgYEYCjE88XsqMHnnYG4Hw9o4FWQoeDuYSyOP0vuXWPU1ag5IjP6Q106zOn320tFeKDue7FuV9e9Do2XSK7P8UICADwqlidQm3JRsvNa+gvqjz98g/aR4D3TYl4hlrwFTVjHozN7+kT2f9CDzJ/F8JxWe55y39FtrRnfgdoA5jEXqlHoW+DTryEaGxaqEumSeOOnhUpkFpt+YxlfKViLreHDS0hLDzeI1YXO8shY+Z1q/BIkkZnfLg/ChIIZZWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pGxfEEBgvfyzUcQmDtVFw6fyVeow+GfVG9WP8F/FLKo=; b=Y1UOHINYILZP7T7FKZf7Npfd+eCRjeXHDXL9P0MEEAwL1jkifZu2CZclW/OIr8PcH7LvxD7PLd41gZLoJqV45RcR4XB1Z15PktEKOIATMAY7VLd+ud6xNw05iqz2YOBZpKqiFo5VOS1Am3bl7tgCoRyfSU1U2Zwoie3ZVeHBOng1NCA517seoWon2CBGj6OAhIfCY72GGd4CfhXNv+g5gFZc83TiowzMg4YWTptdHPxGjDwTVECleaQOxJoyP6ND2xj0oXBxOlaAOEKMdrmHiHGL4aUXppVeoEzZJ8RF8g4fAsnrYKcLza6fkvozUtAzaXLCd+7tFPm0g0cMBzU5gw== 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=pGxfEEBgvfyzUcQmDtVFw6fyVeow+GfVG9WP8F/FLKo=; b=XfnJA6E0yAXuYVbO2Iefp05/6kw7vdmXK3Cd7+lZckqHN2o+sZqaf+wWikIKDT/esPHfbP0dQwnXUDuh8M5aisehijz/gBB+VcH3H5RzxPVfiALRmPKC1/zbMdASNHbbDqy4tUbyijqQa3vxZW7lqwVr6ydE4a3zXMADQbb/aMo= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 6/9] xen/arm: introduce alloc_staticmem_pages and alloc_domstatic_pages Date: Mon, 7 Jun 2021 02:43:15 +0000 Message-ID: <20210607024318.3988467-7-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cbaf51ef-202e-4085-a234-08d9295e1d6e X-MS-TrafficTypeDiagnostic: AM9PR08MB7013:|DB6PR0801MB1719: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3631;OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: dlXr1y4EkSnQOPH4QSg3nnPIJWK5k6gWcJfOUtcwtk7vCkKNLmAdQ2F0cjYGDSdYxazC2Pr7ZTwnVkSk1huAkAwo41HFm6kqsbUcXicMcMMUyrbb44PA4pZXc7MTCcUu67Jj0RoX389UEfWKlf5/zYMVKZW/3YS9xBpr0Nk+D486q7hAYxe8G9KHhWSrDJqBbRRJzl2x00zQ/AuZVqTq2jtReMuPZqIvokFqcmJwz8JErBWYGbLy0D0MWAQzc4tLibL04fg697GzQJltYoHxxqTfAffQBxAsxQgr/2qqjS2RLEE2jQgHYKjTx83mTF5IwgAnSFB1SMRSVU19oc3MFanPvYHDHFv4TCq04jJoou/qyCrNdRzB79sukW0IksEhET/OMq5HeXHywPo4kAo/+6ikz2Kw1JxFPJcWEQknPm8d4d5aCIc82oXkuewGQXrSTRDQqwKNWZjGx5jYuNXcjQzYqaEzZz7teukRHFRK9b/U/FsM4OYM7YybBME2SauEPAvTjremyWcDfV01/qGWoqXx7sThzLrq2KZon05fc7hciLW4qsDQ7wJIXUopsGOyTc9dsHiusv+WwXTljC6OCHPljgu8mw1j0dfFaolfJ4MT1sUregbcPgG4o432Yx1oqcWQDImy1ORFMPE4bcGoTApYyLK/jg7i1DIcI1JRD/d9Wz8gsnNoAi6fYERiev5e4pqaq3EIgrcSVulb1m9qwA== 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:(4636009)(39860400002)(396003)(136003)(376002)(346002)(36840700001)(46966006)(81166007)(336012)(2906002)(316002)(8676002)(110136005)(6666004)(47076005)(36860700001)(356005)(70586007)(186003)(26005)(7696005)(86362001)(70206006)(1076003)(83380400001)(8936002)(2616005)(478600001)(36756003)(426003)(82310400003)(4326008)(54906003)(44832011)(5660300002)(82740400003)(36900700001)(2101003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7013 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 61eb3d68-ee7b-466d-e165-08d9295e18bf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /FJDH1/9p6/JnoTTJhW+EXULbyxxetbeiWvM/1IJwa6+axI+3xYdrgffIqkLmrJ8AUbaYpallReYoFQeId3xYHHtztoNPQXdUyjGL69LhvAIHuj8tXewmbsG4Djlpm9Vfz2YLO+DvNPQE+fhO0e+QWTUxVgjt33B4RcivYsX0PxqXq04X7Ew9rly/YPdoITJNeie8ADop+zLYI6miv2JXP7KGJrdpismee1lg0ZJ+F7Uyq626QLgI5qbSHKSa0pbyCZ9zeL9MU/2VnI7UaUBqGpifRkFwQhVPRzLzsO2Il+ucgErDIg5gYB1u2Iiep+W47oPglFBPt6oFL0IyHDohz/NK498x6VhqWA8H19SLdAYYNgo4EfS+uJtrqytM9SagP/Fgh31vMQBO0yCxJIxaV/ulG2MHRDaIXjl0sFOIZcV/94T8+tayXW3HzZRAdzsftZqXAfpjhXdyJ8kqknyTpSm0mr8llT8jI8XKodNYmU28ihIZXtzUtWpzcrDV6iRiDNQjC8JhwNNLRPvs65mMtMuyHhammYTx/RmLOH9rbsDEJsMRo8YOaNKP+6/N5EKC1HMsW5M2z9Y7h9yqq0gjW24KC2XRNGBmkvgmiJ359d0LtQWPk8zvsGPmSdBTTe4lmgcfF20tpKSFr3GAIy67E0wfldjKOkfCF1s6tx2EeBHFzPcRnkT6aFgjJKOmzuU 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:(4636009)(136003)(346002)(396003)(39860400002)(376002)(36840700001)(46966006)(7696005)(44832011)(8676002)(82310400003)(8936002)(47076005)(478600001)(82740400003)(2906002)(26005)(81166007)(186003)(4326008)(110136005)(1076003)(6666004)(316002)(83380400001)(70586007)(36860700001)(2616005)(426003)(54906003)(36756003)(70206006)(5660300002)(336012)(86362001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:44:04.6510 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cbaf51ef-202e-4085-a234-08d9295e1d6e 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: AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1719 alloc_staticmem_pages aims to allocate nr_mfns contiguous pages of static memory. And it is the equivalent of alloc_heap_pages for static memory. Here only covers allocating at specified starting address. For each page, it shall check if the page is reserved(PGC_reserved) and free. It shall also do a set of necessary initialization, which are mostly the same ones in alloc_heap_pages, like, following the same cache-coherency policy and turning page status into PGC_state_inuse, etc. alloc_domstatic_pages is the equivalent of alloc_domheap_pages for static mmeory, and it is to allocate nr_mfns pages of static memory and assign them to one specific domain. It uses alloc_staticmen_pages to get nr_mfns pages of static memory, then on success, it will use assign_pages_nr to assign those pages to one specific domain. Signed-off-by: Penny Zheng --- changes v2: - use mfn_valid() to do validation - change pfn-named to mfn-named - put CONFIG_STATIC_ALLOCATION around to remove dead codes - correct off-by-one indentation - remove meaningless MEMF_no_owner case - leave zone concept out of DMA limitation check --- xen/common/page_alloc.c | 129 ++++++++++++++++++++++++++++++++++++++++ xen/include/xen/mm.h | 2 + 2 files changed, 131 insertions(+) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index e244d2e52e..a0eea5f1a4 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1065,6 +1065,75 @@ static struct page_info *alloc_heap_pages( return pg; } +#ifdef CONFIG_STATIC_ALLOCATION +/* + * Allocate nr_mfns contiguous pages, starting at #smfn, of static memory. + * It is the equivalent of alloc_heap_pages for static memory + */ +static struct page_info *alloc_staticmem_pages(unsigned long nr_mfns, + mfn_t smfn, + unsigned int memflags) +{ + bool need_tlbflush = false; + uint32_t tlbflush_timestamp = 0; + unsigned long i; + struct page_info *pg; + + /* For now, it only supports allocating at specified address. */ + if ( !mfn_valid(smfn) || !nr_mfns ) + { + printk(XENLOG_ERR + "Invalid %lu static memory starting at %"PRI_mfn"\n", + nr_mfns, mfn_x(smfn)); + return NULL; + } + pg = mfn_to_page(smfn); + + for ( i = 0; i < nr_mfns; i++ ) + { + /* + * Reference count must continuously be zero for free pages + * of static memory(PGC_reserved). + */ + ASSERT(pg[i].count_info & PGC_reserved); + if ( (pg[i].count_info & ~PGC_reserved) != PGC_state_free ) + { + printk(XENLOG_ERR + "Reference count must continuously be zero for free pages" + "pg[%lu] MFN %"PRI_mfn" c=%#lx t=%#x\n", + i, mfn_x(page_to_mfn(pg + i)), + pg[i].count_info, pg[i].tlbflush_timestamp); + BUG(); + } + + if ( !(memflags & MEMF_no_tlbflush) ) + accumulate_tlbflush(&need_tlbflush, &pg[i], + &tlbflush_timestamp); + + /* + * Preserve flag PGC_reserved and change page state + * to PGC_state_inuse. + */ + pg[i].count_info = (pg[i].count_info & PGC_reserved) | PGC_state_inuse; + /* Initialise fields which have other uses for free pages. */ + pg[i].u.inuse.type_info = 0; + page_set_owner(&pg[i], NULL); + + /* + * Ensure cache and RAM are consistent for platforms where the + * guest can control its own visibility of/through the cache. + */ + flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])), + !(memflags & MEMF_no_icache_flush)); + } + + if ( need_tlbflush ) + filtered_flush_tlb_mask(tlbflush_timestamp); + + return pg; +} +#endif + /* Remove any offlined page in the buddy pointed to by head. */ static int reserve_offlined_page(struct page_info *head) { @@ -2326,7 +2395,11 @@ int assign_pages_nr( for ( i = 0; i < nr_pfns; i++ ) { +#ifdef CONFIG_STATIC_ALLOCATION + ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_reserved))); +#else ASSERT(!(pg[i].count_info & ~PGC_extra)); +#endif if ( pg[i].count_info & PGC_extra ) extra_pages++; } @@ -2365,7 +2438,12 @@ int assign_pages_nr( page_set_owner(&pg[i], d); smp_wmb(); /* Domain pointer must be visible before updating refcnt. */ pg[i].count_info = +#ifdef CONFIG_STATIC_ALLOCATION + (pg[i].count_info & (PGC_extra | PGC_reserved)) | PGC_allocated | 1; +#else (pg[i].count_info & PGC_extra) | PGC_allocated | 1; +#endif + page_list_add_tail(&pg[i], page_to_list(d, &pg[i])); } @@ -2434,6 +2512,57 @@ struct page_info *alloc_domheap_pages( return pg; } +#ifdef CONFIG_STATIC_ALLOCATION +/* + * Allocate nr_mfns contiguous pages, starting at #smfn, of static memory, + * then assign them to one specific domain #d. + * It is the equivalent of alloc_domheap_pages for static memory. + */ +struct page_info *alloc_domstatic_pages( + struct domain *d, unsigned long nr_mfns, mfn_t smfn, + unsigned int memflags) +{ + struct page_info *pg = NULL; + unsigned long dma_size; + + ASSERT(!in_irq()); + + if ( !dma_bitsize ) + memflags &= ~MEMF_no_dma; + else + { + if ( (dma_bitsize - PAGE_SHIFT) > 0 ) + { + dma_size = 1ul << (dma_bitsize - PAGE_SHIFT); + /* Starting address shall meet the DMA limitation. */ + if ( mfn_x(smfn) < dma_size ) + return NULL; + } + } + + pg = alloc_staticmem_pages(nr_mfns, smfn, memflags); + if ( !pg ) + return NULL; + + /* Right now, MEMF_no_owner case is meaningless here. */ + ASSERT(d); + if ( memflags & MEMF_no_refcount ) + { + unsigned long i; + + for ( i = 0; i < nr_mfns; i++ ) + pg[i].count_info |= PGC_extra; + } + if ( assign_pages_nr(d, pg, nr_mfns, memflags) ) + { + free_staticmem_pages(pg, nr_mfns, memflags & MEMF_no_scrub); + return NULL; + } + + return pg; +} +#endif + void free_domheap_pages(struct page_info *pg, unsigned int order) { struct domain *d = page_get_owner(pg); diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 25d970e857..a07bd02923 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -89,6 +89,8 @@ bool scrub_free_pages(void); /* Static Allocation */ void free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns, bool need_scrub); +struct page_info *alloc_domstatic_pages(struct domain *d, + unsigned long nr_mfns, mfn_t smfn, unsigned int memflags); #endif /* Map machine page range in Xen virtual address space. */ From patchwork Mon Jun 7 02:43:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D5DEC4743D for ; Mon, 7 Jun 2021 02:44:30 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14F3A61209 for ; Mon, 7 Jun 2021 02:44:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14F3A61209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137551.254934 (Exim 4.92) (envelope-from ) id 1lq5FY-0006h8-1k; Mon, 07 Jun 2021 02:44:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137551.254934; Mon, 07 Jun 2021 02:44:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FX-0006gr-TG; Mon, 07 Jun 2021 02:44:23 +0000 Received: by outflank-mailman (input) for mailman id 137551; Mon, 07 Jun 2021 02:44:22 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FW-0003W9-KG for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:44:22 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (unknown [40.107.7.44]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2355fa02-f776-46e9-8159-3fc5e00c58ce; Mon, 07 Jun 2021 02:44:16 +0000 (UTC) Received: from AS8PR04CA0124.eurprd04.prod.outlook.com (2603:10a6:20b:127::9) by DBBPR08MB5882.eurprd08.prod.outlook.com (2603:10a6:10:200::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 02:44:10 +0000 Received: from VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:127:cafe::7a) by AS8PR04CA0124.outlook.office365.com (2603:10a6:20b:127::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23 via Frontend Transport; Mon, 7 Jun 2021 02:44:10 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT042.mail.protection.outlook.com (10.152.19.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:44:09 +0000 Received: ("Tessian outbound bf434e582664:v93"); Mon, 07 Jun 2021 02:44:09 +0000 Received: from 42d751cfa30d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 27168AAA-11A1-4D08-8710-E696E1208AE5.1; Mon, 07 Jun 2021 02:44:03 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 42d751cfa30d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:44:03 +0000 Received: from DB6PR0601CA0013.eurprd06.prod.outlook.com (2603:10a6:4:7b::23) by HE1PR0802MB2521.eurprd08.prod.outlook.com (2603:10a6:3:df::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Mon, 7 Jun 2021 02:44:00 +0000 Received: from DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:7b:cafe::40) by DB6PR0601CA0013.outlook.office365.com (2603:10a6:4:7b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 02:44:00 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT005.mail.protection.outlook.com (10.152.20.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:44:00 +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.2176.14; Mon, 7 Jun 2021 02:43:58 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:43:56 +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: 2355fa02-f776-46e9-8159-3fc5e00c58ce 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=/JHF5WaQ0fbVKChrSZ5i9VP+rOLKRk36xXg7oyU+VXY=; b=HWX+z9JGnwqGi3cpZzIMNBN/ppMighqzDDhgZronSd5B5eb+b1RrJz46/9NOBOe23GnF+EXnI5cQnGtnb6a1vw6SAbfwCH1ma7PWNZmvnQL7loeoBVGRk8m4N0Q8U6ZgJzykFrky96RyuOnQ5BdM8TRSBRW2ZCRWK0/K0y4Kvpo= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: 788d0609dd54f541 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T/D7veZtl/BSsuiNy6+mof86zzVKMNR35v03tl9zbDZmUwSDkRRIVLroKYVqMGBlwN/UpfxUvcGmo4PENcOZhpUxjamaR0mGpQX9n0S0o/K6PnKMbA0VJjw8FZrcPeq7GPAC7BgR2k5tPZN4dO604kWCIvvkUWFIgcv6rMq9HOYqtV/bb9WxgLJIt4Z7lhuYItKsvaLF7zIbI+1NFeKo7j3mfrd9ipg1vYkSFsxy9g+sL58gTaD0FkmLVrxTXmUGl+0lWXDEemJXcuH26TbVSRYohYSSNpILb3RQpTwnReisT8kpB/GI8zVPYJIM64zLJCxEAr0KJI7RktDkxs5HGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/JHF5WaQ0fbVKChrSZ5i9VP+rOLKRk36xXg7oyU+VXY=; b=ZXMvDk8VmcyqAKBFBaQJv46ex32NcwSViXlCMPjde3qlQrtUcAEvGSdpIyf+sFx15J45fZIVxL7zwriEjanDyxuh3OlZP61T+5AQ3DT5PKd4k629pqMeuR7DqIcfDjI/QQZ6e3y0ztHGF2KGZ1jv8FhJ0BWCLgoDWyIdweCtOehwTbDRpumusyPCd2EoewQlTCuBA9qD0QIyTgSyX77uCux8l3v/W3Vb0csY25Fg2fSWHc3oAx/x8BbPgzoKwUgi1VZAnLZhZ0rmXbXC58cBLtOLButEvUNcG6sT+WfD13NnmuLQX+SLu/FRo0RsrSFWFvAYGfCmPr52A/VH6uwcHg== 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=/JHF5WaQ0fbVKChrSZ5i9VP+rOLKRk36xXg7oyU+VXY=; b=HWX+z9JGnwqGi3cpZzIMNBN/ppMighqzDDhgZronSd5B5eb+b1RrJz46/9NOBOe23GnF+EXnI5cQnGtnb6a1vw6SAbfwCH1ma7PWNZmvnQL7loeoBVGRk8m4N0Q8U6ZgJzykFrky96RyuOnQ5BdM8TRSBRW2ZCRWK0/K0y4Kvpo= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 7/9] xen/arm: take care of concurrency on static memory allocation Date: Mon, 7 Jun 2021 02:43:16 +0000 Message-ID: <20210607024318.3988467-8-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d6b9e365-948f-4a72-7f9b-08d9295e209f X-MS-TrafficTypeDiagnostic: HE1PR0802MB2521:|DBBPR08MB5882: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:590;OLM:590; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 1iz3w8t67Ip9LiWn+hr8BIL5flrBarhkPkeQ/GsDwSiiWR/3h9uOyCAQNCneyhq/g0f02H0sKth46apmAUnr1e1fvSvpcrZ1JviL9r57FRSlHI0dVpfGx25GVmasL56TQvCXVb1SL4kZjCFqj27pQ2GnV7b9ikFrbvALkTKPKSf1LqFFahPnF70lyrDy5UeaUtsMVsOgswDjKY1t67AdgGgeF0JbuukmAj1iJ0FxZq1a8MjYP6D1lNQaVks3Rov2e6ucfQVkK2HTSi5+EmFehershm7DZMwVAxaULiZrHPWfs+/IygQDkhPzGI5cfps3o7WvJFvINj9KvP3VSzjqZIY2Rt/4hMb68gA4/apxoNsgnv2ovIddadsGHOqM+q/qgLhzn3Gu2f+CAMbinVoCi+s4QhywiemtCDcf3dTl2YHOKHMQS2Kgs9xvCCzI1vfLH0ieWd2ynaxlh5llrQT+NxUU5/E11Kd2I0OizlfJG6c3hFBpkR8vw2uA5hZ5rDmNoKTZura2iRFHoWl83XBTakfexJ1r81v9B11KuacWTb7CG4ZEm7q74vvQ4dxf2ktE+6hPTV620eY9JLK509fJft/QXzgUEx034C7kUlKIkcEV7n0jTxIt7ay7EQA+Qb3J8xozaJ4qARUXH25YwcotOZC4F5/2jQzSCLyzyamBUinuhDIy1t5ZKEwOCe8x03X/HgOIKzivQSytDj5OEgwkUw== 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:(4636009)(136003)(376002)(346002)(396003)(39860400002)(36840700001)(46966006)(2906002)(6666004)(36756003)(5660300002)(47076005)(1076003)(4744005)(186003)(26005)(44832011)(86362001)(426003)(110136005)(54906003)(8676002)(83380400001)(81166007)(36860700001)(356005)(7696005)(4326008)(82310400003)(70586007)(70206006)(478600001)(82740400003)(8936002)(336012)(316002)(2616005)(2101003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2521 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 53a0d1e3-767e-4d74-b760-08d9295e1aff X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bFpj7HCWmiqb0wFsnYY519160ZUpJcZ8BpGAUQSZ7OMIq2QeiV5V6y+AWEAGAoH1WiyqnjnBnD38ovr43mjQBtAoVWzWOHFM59AVeiDbzf6wLhnxgcbQB9gWbAj7lTv7qPx5CcSjun7uel86cqgYyCfE3hA2L3AyF6mJPAPLqWvASTMA0D44kIX972XNMKi5Aye7ZEi0PW9OnDEp7JCkRQrmVZVOQWHBzD4VAF7dcEgNCIjU5VVSl/y9A16LmWRZnMz7FgK9g7jkP/7fTWUqUbFP4y2yELY2ppVhXcoa8N0pVSnvY78tyjqBJZFrlMqDSNgqjUBlYCM4fLKmJ4NeONmjpnkf/7rN+3AN1KKZ7S2SXuw8nlTLYQ+st3g3SVngj+ykFj4/JLzyR/pfGx0f76nnorRvjRt3tVZXoZP6l1LhvIixDeKrbCUiIiNwjg/+g3BuQy5tbeWbO17mBMEHTBC0P+lQ0lNlJRDqCAHGOEcuQZ4Y1MqkzJ2FRLAn6ByPTe0/wSQPxa6H3gipamY7FGeFduJqYAa4wRN+nYKg2LWKn+3F6zHrvU/ZVbGJELhzGXDoN2nMtE67WhkxL+F0Wfr42uQAtA6zijMzHsv4wwc99eG7aeuswosKVAQTsu1oxPEctFGvRHGjj5oOm6rcWQj81wa2r+Z6n755K8Fj5r4DZ8ZvBo48oyWCNmxRSUa8 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:(4636009)(39860400002)(136003)(376002)(396003)(346002)(36840700001)(46966006)(4326008)(6666004)(83380400001)(36860700001)(8676002)(47076005)(36756003)(81166007)(8936002)(26005)(2616005)(2906002)(478600001)(70206006)(1076003)(44832011)(426003)(54906003)(110136005)(70586007)(86362001)(4744005)(316002)(82310400003)(7696005)(82740400003)(186003)(5660300002)(336012)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:44:09.8884 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6b9e365-948f-4a72-7f9b-08d9295e209f 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: VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB5882 In the future, user may want to allocate static memory at runtime, and it is quite important to get the code protected from concurrent access. Re-use heap_lock to protect concurrent access in alloc_staticmem_pages. Signed-off-by: Penny Zheng --- changes v2: - new commit --- xen/common/page_alloc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index a0eea5f1a4..c6ccfc3216 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1087,6 +1087,9 @@ static struct page_info *alloc_staticmem_pages(unsigned long nr_mfns, nr_mfns, mfn_x(smfn)); return NULL; } + + spin_lock(&heap_lock); + pg = mfn_to_page(smfn); for ( i = 0; i < nr_mfns; i++ ) @@ -1127,6 +1130,8 @@ static struct page_info *alloc_staticmem_pages(unsigned long nr_mfns, !(memflags & MEMF_no_icache_flush)); } + spin_unlock(&heap_lock); + if ( need_tlbflush ) filtered_flush_tlb_mask(tlbflush_timestamp); From patchwork Mon Jun 7 02:43:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B053BC4743E for ; Mon, 7 Jun 2021 02:44:28 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6584261209 for ; Mon, 7 Jun 2021 02:44:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6584261209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137547.254923 (Exim 4.92) (envelope-from ) id 1lq5FT-0005v3-DF; Mon, 07 Jun 2021 02:44:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137547.254923; Mon, 07 Jun 2021 02:44:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FT-0005uk-9U; Mon, 07 Jun 2021 02:44:19 +0000 Received: by outflank-mailman (input) for mailman id 137547; Mon, 07 Jun 2021 02:44:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5FR-0003W9-Jz for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:44:17 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (unknown [40.107.3.40]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0516d7ff-8a69-439c-a0a7-07175f7fb513; Mon, 07 Jun 2021 02:44:15 +0000 (UTC) Received: from AM7PR03CA0020.eurprd03.prod.outlook.com (2603:10a6:20b:130::30) by HE1PR0802MB2585.eurprd08.prod.outlook.com (2603:10a6:3:d4::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.27; Mon, 7 Jun 2021 02:44:13 +0000 Received: from AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:130:cafe::fa) by AM7PR03CA0020.outlook.office365.com (2603:10a6:20b:130::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Mon, 7 Jun 2021 02:44:13 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT035.mail.protection.outlook.com (10.152.16.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:44:12 +0000 Received: ("Tessian outbound 2977cc564e34:v93"); Mon, 07 Jun 2021 02:44:11 +0000 Received: from c39aee2c5cfc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1A51EFF2-D5D9-4C77-8BFE-6E63319D2DFE.1; Mon, 07 Jun 2021 02:44:06 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c39aee2c5cfc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:44:06 +0000 Received: from DB8PR03CA0022.eurprd03.prod.outlook.com (2603:10a6:10:be::35) by VI1PR0802MB2381.eurprd08.prod.outlook.com (2603:10a6:800:9b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22; Mon, 7 Jun 2021 02:44:04 +0000 Received: from DB5EUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:be:cafe::ae) by DB8PR03CA0022.outlook.office365.com (2603:10a6:10:be::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Mon, 7 Jun 2021 02:44:04 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT045.mail.protection.outlook.com (10.152.21.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:44:04 +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.2176.14; Mon, 7 Jun 2021 02:44:03 +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.2176.14; Mon, 7 Jun 2021 02:44:02 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:44: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: 0516d7ff-8a69-439c-a0a7-07175f7fb513 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=hjHc/ZQydMUgz2CkElY2HaTa10pnGTpDgjZ8IA6R1sw=; b=lTG2md8QPpBmoccvIkX+y3xtOV7631r0My4UhrKOWX47j5MEPSmQSsAB+SadkAWqUae4ln1DGZ1hSwGAKHieEQ1G0X/ZGtLfRx2xZU002ArF6EG0vx2aQf4LU2wDn39vSRx4dPNF59BamCGUEqXsw4S7MerIOkyA6EQT19a2iiY= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: c833dfd982f25670 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kMty4Emx9M8u3E/deZ3l3zvUPz5NloJQs1I9f2SDVP6gMk7rwcI20jf1ccWAEkQYH7g3V/YrgMIh1yBCRaCrraTN3p3U5FiGUf3q0UymwYBIDrqxHwqe0wsKz78U0s/GRShkQbHB2OaYWeVAIwUFIeJdfTxH7Oh63pCkVZ/3l28PnywxIYfCHjP4cGHWMxKLL56K80LKpGNFiytzAWcTdM7eE8ovvZSsa2Xb1S/MdW0k4Ur8htj76MEbkAmyatVbV5Be7H22jYLLy/WYBb8CrlpwJUumRTo+2zK+wr6r8ZBZStgDTtgQR2nCVO+X8E//wRLno9ZVxc5bpA2XUSwfWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hjHc/ZQydMUgz2CkElY2HaTa10pnGTpDgjZ8IA6R1sw=; b=gDIi7T8V+34CPcOCZaK8US1Fze45LAIlFWmc5LLjEot3ZbLpP7BmxoOL23Jj0lyfFCVTNIN03MWWkej458O3pqNvdU00F+ZPs/VyK7pwJhKCg0UiTN8D9wn6CQmxGdKw+xBV3ToZUSOl+D4DdeWOfwwjrsBfrOqDkhLsYtdvW1BT2S8PhUQFTba7UIPDods6RZi+Ew3aKGql98vI3cwwvcsFmP1vLbkKSPffbNkmUcYcwZbp9TtaYuqhNq3abjWdrCtSH5crQmQq5g3VpWsiiO2l0mCXMJmdW5yvBKPJB43gcl3lkFHMFg5ZvyYrgd3SKgcnndkoeOxK27vAfRu3mA== 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=hjHc/ZQydMUgz2CkElY2HaTa10pnGTpDgjZ8IA6R1sw=; b=lTG2md8QPpBmoccvIkX+y3xtOV7631r0My4UhrKOWX47j5MEPSmQSsAB+SadkAWqUae4ln1DGZ1hSwGAKHieEQ1G0X/ZGtLfRx2xZU002ArF6EG0vx2aQf4LU2wDn39vSRx4dPNF59BamCGUEqXsw4S7MerIOkyA6EQT19a2iiY= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 8/9] xen/arm: check `xen,static-mem` property during domain construction Date: Mon, 7 Jun 2021 02:43:17 +0000 Message-ID: <20210607024318.3988467-9-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f9e3e0da-1eba-4377-8046-08d9295e221a X-MS-TrafficTypeDiagnostic: VI1PR0802MB2381:|HE1PR0802MB2585: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:747;OLM:747; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: yKdNQzBmplE3N31U2qwrNZhMWtrFzULMSRIsiq6o259K83lqdL9DCq9XixEekAs3VDgxUnNeF/pATNH8jLzx5Jr8+5q+72aclbtOqs3JwzvWEUWgkDhko9rPa3rmwElTQnTJ2h4OX5FfuGFKR+kMrUeZIfNPAIz9bhzY3tNAs/gswjRz3p0Gb1ZnLgFgL1BMk7ybsnlM5Tv+WRczwykOPkUwCfln2CWnjiQEflgh2mwEox0covFNF+iTHgfWF0ld1lXKy2vi5ud8WDmCzyOCACAP9INxRz07gy0M1HXAqUyKpjbdNXYAIJs/opdy/C781X6aUf3XMXCY1ltf5iF719faB71JHNuXHs1ywtjewLJo1jWatwEUR4NXh5/QA8LAWWZWSQA4VGszS2gfljewOQAYX4R+ZWhbjAYF2UC14sBle47HItqyC+NX2aMgkErSl+hbSqVSThybpfUWf4ucFh0t6AM1qMFa+PowdexLz+KQjUvuYJRcpQjjmR/wevthMFVP96kfZSaU2h9O2XAXM+jyspYbMqYgx2N89c45zNxDOJLo+v345eP7CBqvbKTuRTZO4MNjuTmE+yFH660TX+qMWaXhywW9rN2XHTugCRz+VdGi8It78kZSSdLIJenlCzge0RZE0h5WMf4qBVBkJ90ocekpPmITvIq+XD6/CecroZ3Vn2i0br/JPwAWsBcbLguy1JgzwO34OSEEhPdsI0Lhv1NcMMwkrBtOr0y9LQ4= 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:(4636009)(346002)(39860400002)(136003)(376002)(396003)(36840700001)(46966006)(6666004)(4326008)(478600001)(7696005)(186003)(1076003)(86362001)(81166007)(110136005)(356005)(8676002)(8936002)(336012)(70586007)(26005)(70206006)(5660300002)(426003)(316002)(2616005)(2906002)(44832011)(47076005)(82740400003)(82310400003)(54906003)(36860700001)(36756003)(83380400001)(81973001)(2101003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2381 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 832cdbb1-6b57-4076-c7aa-08d9295e1d2a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3jZBqvtTY6EGuiE98vEGTV/ZOArJka7PoepI/VbdtmU8/vL9GTsDar5xSsp9Fao1iOPUOahxAX11vHITWm5KSOCpaQc2X9HFp/uanA5F05meqcFyNoznim8TIHSxYRMz89fMIFOpd/K/9ocJzeAN4sh07oTVm0JylN/koi1ds9489xd2weFdL/6Kjy1+mPWj2d5wHCsloq1s0K4hV2xG4UwFiG58SWcS/YTPcGtP45C61RUOIi2ps/SDuoRSniuDN5RrRrBxUPTBT5szlJPEuvJrFmgYW6G9HhLqp5Yfvpj93jVn0v0Q5GM2U7lIBEqHExXkHN8nwY5QUuYwtarKIMGkak2LprU1F1omrmMLHXkECx/GTvQAkQeZDPb+sR0uabBctqdWDXO3+tC74flmKco+unXWKanMsFfriYuwao8QfrZy7VAZUQ19wU/QVbZzIMzlQZidm4p5FIwqjUDiLcQT0t5vL46EP2+JTwzRjwlbpCdYzXYToR7+4nWfX4cwOTlG43D/ZPmQ3cjZFsNkv5zPDx89ITD+M5JaswOE+rgec2FNcmNajPinVqGgBZDCd+vSyExtzkMUoSadZZTjVJdZPY0vJiLG/12rD0uiBQuRrqrKcKTswm0Tpu+GJCAdICuBYsm3gG2uRn2mMQHEr/1fUqwt468Id/z0qOt86dgPDrt0xLV8B665siLxoI9TFAgmu9X5LjubbfXHUzbXRQ== 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:(4636009)(376002)(39860400002)(136003)(346002)(396003)(36840700001)(46966006)(2906002)(70206006)(7696005)(5660300002)(426003)(70586007)(336012)(110136005)(54906003)(36860700001)(1076003)(6666004)(2616005)(44832011)(47076005)(26005)(83380400001)(82740400003)(81166007)(82310400003)(86362001)(8676002)(4326008)(186003)(8936002)(36756003)(478600001)(316002)(81973001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:44:12.4672 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9e3e0da-1eba-4377-8046-08d9295e221a 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: AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2585 This commit checks `xen,static-mem` device tree property in /domUx node, to determine whether domain is on Static Allocation, when constructing domain during boot-up. Right now, the implementation of allocate_static_memory is missing, and will be introduced later. It just BUG() out at the moment. And if the `memory` property and `xen,static-mem` are both set, it shall be verified that if the memory size defined in both is consistent. Signed-off-by: Penny Zheng --- changes v2: - remove parsing procedure here - check the consistency when `xen,static-mem` and `memory` are both defined --- xen/arch/arm/domain_build.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 282416e74d..4166d7993c 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2424,23 +2424,47 @@ static int __init construct_domU(struct domain *d, { struct kernel_info kinfo = {}; int rc; - u64 mem; + u64 mem, static_mem_size = 0; + const struct dt_property *prop; + bool static_mem = false; + + d->max_pages = ~0U; + /* + * Guest RAM could be of static memory from static allocation, + * which will be specified through "xen,static-mem" phandle. + */ + prop = dt_find_property(node, "xen,static-mem", NULL); + if ( prop ) + { + static_mem = true; + /* static_mem_size = allocate_static_memory(...); */ + BUG(); + } rc = dt_property_read_u64(node, "memory", &mem); - if ( !rc ) + if ( !static_mem && !rc ) { printk("Error building DomU: cannot read \"memory\" property\n"); return -EINVAL; + } else if ( rc && static_mem ) + { + if ( static_mem_size != mem * SZ_1K ) + { + printk("Memory size in \"memory\" property isn't consistent with" + "the ones defined in \"xen,static-mem\".\n"); + return -EINVAL; + } } - kinfo.unassigned_mem = (paddr_t)mem * SZ_1K; + kinfo.unassigned_mem = static_mem ? 0 : (paddr_t)mem * SZ_1K; - printk("*** LOADING DOMU cpus=%u memory=%"PRIx64"KB ***\n", d->max_vcpus, mem); + printk("*** LOADING DOMU cpus=%u memory=%"PRIx64"KB ***\n", + d->max_vcpus, + static_mem ? static_mem_size : (kinfo.unassigned_mem) >> 10); kinfo.vpl011 = dt_property_read_bool(node, "vpl011"); if ( vcpu_create(d, 0) == NULL ) return -ENOMEM; - d->max_pages = ~0U; kinfo.d = d; @@ -2452,7 +2476,8 @@ static int __init construct_domU(struct domain *d, /* type must be set before allocate memory */ d->arch.type = kinfo.type; #endif - allocate_memory(d, &kinfo); + if ( !static_mem ) + allocate_memory(d, &kinfo); rc = prepare_dtb_domU(d, &kinfo); if ( rc < 0 ) From patchwork Mon Jun 7 02:43:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12302451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1E94C4743E for ; Mon, 7 Jun 2021 02:44:50 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 59C2E6120D for ; Mon, 7 Jun 2021 02:44:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59C2E6120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.137560.254945 (Exim 4.92) (envelope-from ) id 1lq5Fn-0007pM-Cq; Mon, 07 Jun 2021 02:44:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 137560.254945; Mon, 07 Jun 2021 02:44:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5Fn-0007pB-98; Mon, 07 Jun 2021 02:44:39 +0000 Received: by outflank-mailman (input) for mailman id 137560; Mon, 07 Jun 2021 02:44:37 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lq5Fl-0003W9-Kw for xen-devel@lists.xenproject.org; Mon, 07 Jun 2021 02:44:37 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:fe05::61b]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2c8abd4d-335f-4e8a-919d-b0ed7e002ae2; Mon, 07 Jun 2021 02:44:22 +0000 (UTC) Received: from AM6P194CA0004.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:90::17) by AM0PR08MB4100.eurprd08.prod.outlook.com (2603:10a6:208:130::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.20; Mon, 7 Jun 2021 02:44:15 +0000 Received: from VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:90:cafe::7a) by AM6P194CA0004.outlook.office365.com (2603:10a6:209:90::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Mon, 7 Jun 2021 02:44:15 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT010.mail.protection.outlook.com (10.152.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:44:15 +0000 Received: ("Tessian outbound 836922dda4f1:v93"); Mon, 07 Jun 2021 02:44:14 +0000 Received: from d51c310d07aa.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1679F000-86AC-4362-BAD0-20E79C3A7969.1; Mon, 07 Jun 2021 02:44:09 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d51c310d07aa.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 07 Jun 2021 02:44:09 +0000 Received: from DB6PR1001CA0019.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:b7::29) by DB8PR08MB5035.eurprd08.prod.outlook.com (2603:10a6:10:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.24; Mon, 7 Jun 2021 02:44:08 +0000 Received: from DB5EUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:b7:cafe::4) by DB6PR1001CA0019.outlook.office365.com (2603:10a6:4:b7::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Mon, 7 Jun 2021 02:44:08 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT012.mail.protection.outlook.com (10.152.20.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4195.21 via Frontend Transport; Mon, 7 Jun 2021 02:44:07 +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.2176.14; Mon, 7 Jun 2021 02:44:06 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 7 Jun 2021 02:44:04 +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: 2c8abd4d-335f-4e8a-919d-b0ed7e002ae2 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=kHSMQ1sGOPQDhU5EE4xS8cKC3DuRiiQSJWMUP5Duxbg=; b=CKyIXG3MK+C6ysHsALDE0Fb1C8sjrnLWyXRMlrlmGNahxqUy6My85Ms0I0PlYpTCnnbHhYjJA66eC/lCeZxh0OPjk5Q3rGlkAs/tNrV6Q15y7iyG6owQ8rw7B4FYeQIkoIA7HqU4gPhHITJG1JhXgao9tBLb/Tqc0FBdJKaaTOU= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; 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: 5f5a7362ab08dbbd X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QZrRCX1v/4OBiq7aUEU4MxpdBKUEZP9YE16raGUxd9lqRF6ZnBk+ifaUz0VpHz0wQxp9jLykl/CojtZOx17lX7rJeIKrBnRZ7OTysvaJg+EboTbU1YzJMwVB2pluhJPNrmBNCkEnifzzWqhWcf/MUkQNdMjY0eq//3sLLlN54Ub0JpRzmPogGmY2QDdgHDVHTUcoB2jzkkPaEJzCVrWiT7koC1mJbuJBRGjEz2Cq06TCfEzuM1UtgfJXvNGr6jN13ypHuysiuXqyF75SQuBKJR+YAljm+nUKpM1H3RpDFufdO6i3E2XsZWNX74xQiKE4RhXnCnjM2otZiSXac9ppgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kHSMQ1sGOPQDhU5EE4xS8cKC3DuRiiQSJWMUP5Duxbg=; b=JdraQ7X7dlfVkARB04jF9OnNmEp2QG51BOo2BUv1dDxeSkpyvcT9ewIB+OwUgy1DYUW9BVohw0XvN2Lyuu39UbTSf1WQcqUm/Qj3PP4IYULRMDqcQT1dd8rPLmT4OP21DCkzxaJLUvC7n9HzmUDBObJf8UU4HXanX6uBHDVcv43H/qtlRZCsO7np7SJaZi+3/9A4BKq7/nXQqyyKsKNTqI88UfZcYG+dOUF8RSXITQFe5QUce91CtmeOFBvle+wxDynHXe1QQFEm5wUpe0VwFy84Kfnoa6FCwU9IfgclxKpZJ9Fj5lyWd+HUuIF1vY/PoJJeL/DP4lgeRPvXXOjFxA== 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=kHSMQ1sGOPQDhU5EE4xS8cKC3DuRiiQSJWMUP5Duxbg=; b=CKyIXG3MK+C6ysHsALDE0Fb1C8sjrnLWyXRMlrlmGNahxqUy6My85Ms0I0PlYpTCnnbHhYjJA66eC/lCeZxh0OPjk5Q3rGlkAs/tNrV6Q15y7iyG6owQ8rw7B4FYeQIkoIA7HqU4gPhHITJG1JhXgao9tBLb/Tqc0FBdJKaaTOU= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; 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: Penny Zheng To: , , , CC: , , Subject: [PATCH 9/9] xen/arm: introduce allocate_static_memory Date: Mon, 7 Jun 2021 02:43:18 +0000 Message-ID: <20210607024318.3988467-10-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607024318.3988467-1-penny.zheng@arm.com> References: <20210607024318.3988467-1-penny.zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fe858219-dd68-4cc9-0d49-08d9295e23d7 X-MS-TrafficTypeDiagnostic: DB8PR08MB5035:|AM0PR08MB4100: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5236;OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0CwGaWSGThSq0G6eAKCK5bA01pOR6d/+lW8mFNINli8q8onPjsR/mQfejX5SFgExklTnF5PrFy9V+B5WDgJOzzS1/aXc0fWxtj16VNvXwhOlhpyxIFuyADnndzBVxzK5B5MP0a5zmGZxpOwVcz8KKGqflqEQCbi5cRz0XAucLKoTvc1qC5kBtX9EK0Yuy48mMHfZtgniBbr7mqGx6A7Pij/uLxRcQSbPCYUR1/t9VRGC7+Tv2mCnFNYkbKyY0soSdK5u0loY4pbM+CS0MsyzPSXuz1YOi1RNolwABQBvYo4FOqNNQoeyp29m6jTWQkmqYGgprJNqlYhuslYlscNe1dfjD8nj7fVGydNB0ZrQr2amjWb0N67dunsMDll6gCMQfgloGNQPAg8ClF2VCfEUMP3ZnYhhRly+UqrTQQbUVZL9tGuy7EeuRBcgIIya+G8yMp0r5f+eCMQlHlhivZoSh4jnKbo5v04FU0axMbxyr9KYALvdkc6P00Vrfj+Z7UBeufZmCaMnT3lvvmvz3A9Zm9EVKS7DlfHnjXT88tYPr7tp6YKFN71yyTjAC8IHI2FYKcszUjctJxidYsh4MuctL24iat/FwfRsWx+TKPobJS/5GLjq/P1hlQyGXYjK22tv09RhCGSEVAArx34nCo3I9gaSZftFBuj29DojqZPjZs2VN4x+bz5PEsPGSojnX0ySH8Q4qgztVTJ6B8Rei4L2Pg== 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:(4636009)(136003)(376002)(39860400002)(346002)(396003)(36840700001)(46966006)(8676002)(8936002)(70586007)(70206006)(4326008)(54906003)(110136005)(2906002)(1076003)(316002)(36860700001)(336012)(47076005)(2616005)(186003)(86362001)(44832011)(26005)(82310400003)(5660300002)(83380400001)(81166007)(6666004)(36756003)(356005)(426003)(82740400003)(7696005)(478600001)(2101003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5035 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 8065edcc-42e8-494d-cbee-08d9295e1f4d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6tSXe5J57PWNXai3JQpZINVadA2TCbCMitw5wILDcqcx5VRwctI+uYk237BBbxIvaUEbJV4y1G90GLqV0fIHAwc2uAqCk2NW/urpDyHycNynrXk/UeCDFTqwS1NoRa2rA5x1viCik/Xx5NRsFHOhqbPcP3wryNaA9ELZ+lzFM7RqsQVHLPcE1bzfiZAymfb1sR/hl79gJU8Yg4qpydWnu4rM+9fdE3NIBH1AvxDU2HZ2daBeyyxaBnoRjKkZG/Zpxo3rf8y3arbgwGLGjG88Tkplt3PoQ+OrKuRhjjvoeSC04TRN5WeQEa5V4x0z/aQSz6iSkN0+h2a5t7eg2Q3LP7ElrUXa5LAkZRAS97opj/eUPmvklf5RdLuzo4gjUVRYK0Okk5LWuKwaMXBYVPMSP7WcWPyGwFa5RIweRxUIckkLH7qLOtcmo3S4QZy6zOQBCv8q6j3H0xYWN82/hV49PER2q7sVsxSB6a874nw06vxeFEgbSw0Z+IXXHhWWGGtORTBBwyZxzNe9rYbsTx1qtvVZFmv7dSyqOQLy6DooYMpaNOMIuNosageqwYvN5NYyiuehLTEqNop8P01S8rsMv75Rh8jTwTQKEKiqOEJmFiF23QM5kMK89keIidgDF54b+HxmZkK4e0d02K4l/tjw7peeJpNNvS/ZbWmMModxWvpYL03jxDj6qoi5bfTGPabc 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:(4636009)(346002)(376002)(136003)(396003)(39860400002)(46966006)(36840700001)(26005)(186003)(36756003)(82740400003)(86362001)(83380400001)(82310400003)(81166007)(54906003)(7696005)(316002)(6666004)(36860700001)(47076005)(5660300002)(336012)(2906002)(478600001)(4326008)(2616005)(8676002)(70586007)(426003)(70206006)(8936002)(1076003)(44832011)(110136005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 02:44:15.3217 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe858219-dd68-4cc9-0d49-08d9295e23d7 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: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4100 This commit introduces allocate_static_memory to allocate static memory as guest RAM for Domain on Static Allocation. It uses alloc_domstatic_pages to allocate pre-configured static memory banks for this domain, and uses guest_physmap_add_page to set up P2M table. These pre-defiend static memory ranges shall be firstly mapped to the fixed guest RAM address `GUEST_RAM0_BASE`. And until it exhausts the `GUEST_RAM0_SIZE`, it will seek to `GUEST_RAM1_BASE`. `GUEST_RAM0` may take up several pre-defined physical RAM regions. Signed-off-by: Penny Zheng --- changes v2: - rename the values, like prefix it g/p - fix the scalability issue - allocate when parse --- xen/arch/arm/domain_build.c | 155 +++++++++++++++++++++++++++++++++++- 1 file changed, 153 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 4166d7993c..63b6a97b2c 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -437,6 +437,48 @@ static bool __init allocate_bank_memory(struct domain *d, return true; } +/* + * Static memory bank at #smfn of #gsize shall be mapped to #sgfn of #gsize, + * and #sgfn will be next guest address to map when returning. + */ +static bool __init allocate_static_bank_memory(struct domain *d, + struct kernel_info *kinfo, + int gbank, + gfn_t* sgfn, + mfn_t smfn, + paddr_t gsize) +{ + int res; + paddr_t tot_size = gsize; + const uint64_t rambase[] = GUEST_RAM_BANK_BASES; + + while ( tot_size > 0 ) + { + unsigned int order = get_allocation_size(tot_size); + + res = guest_physmap_add_page(d, *sgfn, smfn, order); + if ( res ) + { + dprintk(XENLOG_ERR, "Failed map pages to DOMU: %d", res); + return false; + } + + *sgfn = gfn_add(*sgfn, 1UL << order); + smfn = mfn_add(smfn, 1UL << order); + tot_size -= (1ULL << (PAGE_SHIFT + order)); + } + + /* Guest RAM bank in kinfo hasn't been initialized. */ + if ( gbank == kinfo->mem.nr_banks ) + { + kinfo->mem.bank[gbank].start = rambase[gbank]; + kinfo->mem.nr_banks++; + } + kinfo->mem.bank[gbank].size += gsize; + + return true; +} + static void __init allocate_memory(struct domain *d, struct kernel_info *kinfo) { unsigned int i; @@ -480,6 +522,116 @@ fail: (unsigned long)kinfo->unassigned_mem >> 10); } +/* Allocate memory from static memory as RAM for one specific domain d. */ +static u64 __init allocate_static_memory(struct domain *d, + struct kernel_info *kinfo, + const struct dt_device_node *node) +{ + int nr_banks, bank = 0, gbank = 0; + const uint64_t rambase[] = GUEST_RAM_BANK_BASES; + const uint64_t ramsize[] = GUEST_RAM_BANK_SIZES; + const __be32 *cell; + const struct dt_property *prop; + struct dt_device_node *static_mem_node; + const struct dt_device_node *parent = dt_find_node_by_path("/reserved-memory"); + u32 addr_cells = 2, size_cells = 2, reg_cells; + u64 tot_size; + + paddr_t pbase, psize, gsize; + gfn_t sgfn; + mfn_t smfn; + + kinfo->mem.nr_banks = 0; + /* Start with GUEST_RAM0. */ + gsize = ramsize[gbank]; + sgfn = gaddr_to_gfn(rambase[gbank]); + + /* Parse phandle in `xen,static-mem`. */ + static_mem_node = dt_parse_phandle(node, "xen,static-mem", 0); + if ( !static_mem_node ) + goto fail; + + /* + * #address-cells and #size-cells must be consistent with the parent node, + * "reserved-memory". + */ + dt_property_read_u32(parent, "#address-cells", &addr_cells); + dt_property_read_u32(parent, "#size-cells", &size_cells); + BUG_ON(size_cells > 2 || addr_cells > 2); + reg_cells = addr_cells + size_cells; + + prop = dt_find_property(static_mem_node, "reg", NULL); + if ( !prop ) + goto fail; + cell = (const __be32 *)prop->value; + nr_banks = (prop->length) / (reg_cells * sizeof (u32)); + BUG_ON(nr_banks > NR_MEM_BANKS); + + while ( bank < nr_banks ) + { + device_tree_get_reg(&cell, addr_cells, size_cells, &pbase, &psize); + tot_size += (u64)psize; + smfn = maddr_to_mfn(pbase); + + if ( !alloc_domstatic_pages(d, psize >> PAGE_SHIFT, smfn, 0) ) + { + printk(XENLOG_ERR + "%pd: cannot allocate static memory" + "(0x%"PRIpaddr" - 0x%"PRIpaddr")", + d, pbase, pbase + psize); + goto fail; + } + + printk(XENLOG_INFO "%pd STATIC BANK[%d] %#"PRIpaddr"-%#"PRIpaddr"\n", + d, bank, pbase, pbase + psize); + + /* + * It shall be mapped to the fixed guest RAM address rambase[i], + * And until it exhausts the ramsize[i], it will seek to the next + * rambase[i+1]. + */ + while ( 1 ) + { + if ( gsize >= psize ) + { + if ( !allocate_static_bank_memory(d, kinfo, gbank, + &sgfn, smfn, psize) ) + goto fail; + + gsize = gsize - psize; + bank++; + break; + } + else + { + if ( !allocate_static_bank_memory(d, kinfo, gbank, + &sgfn, smfn, gsize) ) + goto fail; + + /* + * Physical bank hasn't been totally mapped, + * seeking to the next guest RAM i+1, if exist. + */ + if ( ++gbank < GUEST_RAM_BANKS ) + { + psize = psize - gsize; + smfn = mfn_add(smfn, gsize >> PAGE_SHIFT); + gsize = ramsize[gbank]; + sgfn = gaddr_to_gfn(rambase[gbank]); + } + else + goto fail; + } + } + } + return tot_size; + +fail: + panic("Failed to allocate requested static memory for domain %pd." + "Fix the VMs configurations.\n", + d); +} + static int __init write_properties(struct domain *d, struct kernel_info *kinfo, const struct dt_device_node *node) { @@ -2437,8 +2589,7 @@ static int __init construct_domU(struct domain *d, if ( prop ) { static_mem = true; - /* static_mem_size = allocate_static_memory(...); */ - BUG(); + static_mem_size = allocate_static_memory(d, &kinfo, node); } rc = dt_property_read_u64(node, "memory", &mem);