From patchwork Wed Mar 30 09:36:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12795603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 554F2C433F5 for ; Wed, 30 Mar 2022 09:38:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.296123.504041 (Exim 4.92) (envelope-from ) id 1nZUly-0000pC-7G; Wed, 30 Mar 2022 09:37:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 296123.504041; Wed, 30 Mar 2022 09:37:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nZUly-0000p0-40; Wed, 30 Mar 2022 09:37:50 +0000 Received: by outflank-mailman (input) for mailman id 296123; Wed, 30 Mar 2022 09:37:48 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nZUlw-0000Fm-E5 for xen-devel@lists.xenproject.org; Wed, 30 Mar 2022 09:37:48 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061c.outbound.protection.outlook.com [2a01:111:f400:7e1b::61c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0ed4d611-b00d-11ec-a405-831a346695d4; Wed, 30 Mar 2022 11:37:47 +0200 (CEST) Received: from AS9PR06CA0073.eurprd06.prod.outlook.com (2603:10a6:20b:464::17) by VE1PR08MB4861.eurprd08.prod.outlook.com (2603:10a6:802:a5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Wed, 30 Mar 2022 09:37:35 +0000 Received: from VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:464:cafe::76) by AS9PR06CA0073.outlook.office365.com (2603:10a6:20b:464::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 09:37:35 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT018.mail.protection.outlook.com (10.152.18.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:37:34 +0000 Received: ("Tessian outbound 826a6d8e58c3:v113"); Wed, 30 Mar 2022 09:37:34 +0000 Received: from a861ce71bd4d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7EC18895-6DA7-4026-AC93-A4274A7F2B58.1; Wed, 30 Mar 2022 09:37:26 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a861ce71bd4d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 30 Mar 2022 09:37:26 +0000 Received: from DU2PR04CA0153.eurprd04.prod.outlook.com (2603:10a6:10:2b0::8) by AM9PR08MB7014.eurprd08.prod.outlook.com (2603:10a6:20b:41b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.19; Wed, 30 Mar 2022 09:37:24 +0000 Received: from DB5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b0:cafe::e7) by DU2PR04CA0153.outlook.office365.com (2603:10a6:10:2b0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 09:37:24 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT013.mail.protection.outlook.com (10.152.20.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:37:23 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 30 Mar 2022 09:36:59 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Wed, 30 Mar 2022 09:36:51 +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: 0ed4d611-b00d-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tUQ3cl6p5PyL7bKJEli7MfTrbAhvi8uIycMc+ch+Fi8=; b=PnMuhDzUw7XGckigOXqBlUiPTc2uQ40Yxkk035hwxB6axL4ScInmZoILiZqkvE3u5veY/HbXXR8bmOsRcw7jcO83t0uKb7efMfd840699uim79hVnyQ62EMXVKuTtww/Y2RQh/9GWfBfQPW23F65Ud3r5bn4OmDTXxz8B4jtlCc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: c3d9b65d0ef536fb X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cQDUiSdVqkEeooN6yHjMkXa5euxhYvIYlV53Vf9ULF1mrUKlhSdV3gFeSqp5iTPrFfswbGgcNLkLNWkXwWVQ4kLCGYoEfkP9JxQeKJ4ULl4vgedj9hxkQF19cgKmTE+iScQ3QuZBRXlqMEvo+0F1jBhb9qu7j/mRF6aeX1A7LwTKB3/3MdyybYrgywOwefysMyUk8CY/Z3eYeK3ywE6a5cRmmELwhJOTARDPGQv8CA7xOMSsrMgz8hyUUAFrjlPXKFxAoQ6DipgzuNXl4vj2dskzd/tyBjlzASpDWg5718dGBXUlCodyeGRzK6knLLgShOMUV6kaZGmkYCdxDSn71w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tUQ3cl6p5PyL7bKJEli7MfTrbAhvi8uIycMc+ch+Fi8=; b=aRH8fsZjkLBQO/iui6kFCWYJRlz1of2foj+3Ou2i27t0TWdJHktVkXaqbYC7thTIKwRUKjpdQoM0CBOAdrLVk3zKe5l3Wa0fRbK+b/02g7xgFp6TbA1iMpXzv06tNmjdQt8pcsl9krI4MZm4lGz5pa9GJpKrIhSMJ2MZZ/tVqtkQ7IOpQ+tmJ8EX/L6aaFBMyM2hhTckRPjGcuP+9Nce0XK44xwpcmQ8NENdj2kfmDJxtwZzLIUYcq1pMpoV38qZmEQwQT4fK1uL0/X5zCw7IV6c3pFmXih3UjvRuSo5J+3J3WoZHjiD04XOV2S3Eb/gNoazC2vzBT68iHxIAoZhGw== 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=tUQ3cl6p5PyL7bKJEli7MfTrbAhvi8uIycMc+ch+Fi8=; b=PnMuhDzUw7XGckigOXqBlUiPTc2uQ40Yxkk035hwxB6axL4ScInmZoILiZqkvE3u5veY/HbXXR8bmOsRcw7jcO83t0uKb7efMfd840699uim79hVnyQ62EMXVKuTtww/Y2RQh/9GWfBfQPW23F65Ud3r5bn4OmDTXxz8B4jtlCc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , , Penny Zheng , Stefano Stabellini , "Julien Grall" , Bertrand Marquis , Volodymyr Babchuk , Penny Zheng Subject: [PATCH v1 1/5] xen/arm: field "flags" to cover all internal CDF_XXX Date: Wed, 30 Mar 2022 17:36:13 +0800 Message-ID: <20220330093617.3870589-2-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330093617.3870589-1-Penny.Zheng@arm.com> References: <20220330093617.3870589-1-Penny.Zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 4fb68276-2cb6-4d87-339a-08da1230eb79 X-MS-TrafficTypeDiagnostic: AM9PR08MB7014:EE_|VE1EUR03FT018:EE_|VE1PR08MB4861:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: gtMoY+OwRg9vLJmt+sbbMTdoosTCBIdMeF93ER6GnpmXtUBsdDnoqNjZ3IBhHLEFpcoOKZ9PfKzPQxxRVqLl3Hs7wIpCykqTGIOm/aporm1MbYKDoqWurdxYQdVsWTioVJCrN3P8D00U/fdE4x9dx+l/oT3Mn2Pw5kgZ2cWh85NXeFBItb4IikRvKShVOEqqVAhucPLLa1zQzZfRBvRHDhn1elOlrJOOJadPvD73CMRZa4RHg61Lbi9Yb/kefV0wv6BylevcN7cOe7zgXt2hW3uRk8m0PkzsNIrwp8J/Zs3e7PnYEKdXoM+pLreCN+bgRYhIEhUTPuw09I3Yij9sud7yxHO23RhO4vmQJw6ei+ieTA0MJ3IEQkxuU0Lvu8RcgnvBc97v8QXq3wttApA9dl7xQzdOcFS+GO3uM1MyAeSRIXLomsvNNeOnfimn59HQ42VS8VuziIw0gUTXyeU4nsu8GfA5IrOROFTej/n/mCRCYGEOCGbjJCWhsBUdRhSNFJETEaDfXssnhTMRFIucTJFLZn/PpXfPkFCWI/220lhrn3XbR3ycbLzI6U0jVsRTQ2FwC1DoIrXReOPcyqZJM7P6B9eQD2ky/TrTGJRZVulCkszpgW9au/t82E8yoiiQT8IdpE2zJXYpClsIr6fKWOcccYxGFg0xqOLaHEn+4ptjjFTpsBw2A9nb5l7uojYFjGZ+w8wg+qm6yy/oRty0UBE7ONNwR9eoPi6yfaq/w4w= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(70206006)(2616005)(70586007)(47076005)(40460700003)(8676002)(336012)(186003)(82310400004)(26005)(1076003)(83380400001)(426003)(81166007)(356005)(5660300002)(316002)(36860700001)(8936002)(2906002)(86362001)(6666004)(4326008)(36756003)(7696005)(6916009)(508600001)(54906003)(21314003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7014 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a096aa1f-165f-4adb-8b3c-08da1230e50f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8LosLsHKdZcSl8W/K289oUL6M/Q/qYDIpH/3DdHqaGY6CPtNaeiDQyFlK3tFNFw0UpFJLp7KB5h7xb/eTszdjos22G8MDfVyzfFHkqXh9vcs3YxFBCinMG3GI5ZYGR8bHyEE8T+lMEPbCOd9Atv9cccs/1VhtFXueWQxG0e5wlM1Syel8MxnvUj9/DQskII0IuUBSCWaSWlnBS106ht9yd8OjA+JoaT2mrxJdo3CQyvTKMnKb/5IkQmfY17XybjqJgWJ1X+hvjjLB0z6ZohDJ6hABfGNALpRONKK3+flCsNrCaHly0TY/uNTHQ3PoWIxXGnaHmtzANKvYQMyTyYo6ywXDW+J/4dDd6l943eYKE20GFzqWdq9sns8286cILVKznfCRoR6TuOi2c3TjcCsVdIT3wNb7j98x9MNn6RqEGnD/n1a04yWbYB1EZ9ZZgtMjWMydcaAiy8uKl/Nj+8fhIJIMYW6WZt4+KDSKIZjMohMVcMzagayi9ioUtPdnsDZT6pevMtyTvlBNIaInRPmgIlW2RrVdH+PwGaXFazTDIH7m9/kBZ2FmxUW79VPUElpkB/B+BXZKRuBhljVy6a4P6DuNOQLAOfDceKvz2GxXXrKV8/zNT7bQSy96T8/GoEnFUib7kHPmHSIgXGsS74ebZMZ5ZIPuo4TwZtcFnVlsIxoEWoLXhO48snX+7LI1tRqJeXXrFPFER4dt8KVz8atbw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(508600001)(81166007)(86362001)(6666004)(82310400004)(316002)(54906003)(6916009)(47076005)(5660300002)(83380400001)(7696005)(36860700001)(4326008)(8676002)(186003)(70586007)(40460700003)(8936002)(2906002)(2616005)(70206006)(336012)(36756003)(26005)(426003)(1076003)(21314003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 09:37:34.3728 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fb68276-2cb6-4d87-339a-08da1230eb79 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: VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4861 With more and more CDF_xxx internal flags in and to save the space, this commit introduces a new field "flags" to store CDF_* internal flags directly. Another new CDF_xxx will be introduced in the next patch. Signed-off-by: Penny Zheng --- xen/arch/arm/domain.c | 3 ++- xen/arch/arm/include/asm/domain.h | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 8110c1df86..35c157d499 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -709,7 +709,8 @@ int arch_domain_create(struct domain *d, ioreq_domain_init(d); #endif - d->arch.directmap = flags & CDF_directmap; + /* Holding CDF_* internal flags. */ + d->arch.flags = flags; /* p2m_init relies on some value initialized by the IOMMU subsystem */ if ( (rc = iommu_domain_init(d, config->iommu_opts)) != 0 ) diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h index ed63c2b6f9..95fef29111 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -29,7 +29,7 @@ enum domain_type { #define is_64bit_domain(d) (0) #endif -#define is_domain_direct_mapped(d) (d)->arch.directmap +#define is_domain_direct_mapped(d) (((d)->arch.flags) & CDF_directmap) /* * Is the domain using the host memory layout? @@ -103,7 +103,8 @@ struct arch_domain void *tee; #endif - bool directmap; + /* Holding CDF_* constant. Internal flags for domain creation. */ + uint32_t flags; } __cacheline_aligned; struct arch_vcpu From patchwork Wed Mar 30 09:36:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12795602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60BC2C433EF for ; Wed, 30 Mar 2022 09:37:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.296119.504030 (Exim 4.92) (envelope-from ) id 1nZUlk-0000Ne-RQ; Wed, 30 Mar 2022 09:37:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 296119.504030; Wed, 30 Mar 2022 09:37:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nZUlk-0000NX-NA; Wed, 30 Mar 2022 09:37:36 +0000 Received: by outflank-mailman (input) for mailman id 296119; Wed, 30 Mar 2022 09:37:35 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nZUlj-0000Fm-35 for xen-devel@lists.xenproject.org; Wed, 30 Mar 2022 09:37:35 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on061f.outbound.protection.outlook.com [2a01:111:f400:fe0a::61f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 061e665d-b00d-11ec-a405-831a346695d4; Wed, 30 Mar 2022 11:37:33 +0200 (CEST) Received: from DU2P250CA0007.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:231::12) by AM4PR0802MB2211.eurprd08.prod.outlook.com (2603:10a6:200:5e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18; Wed, 30 Mar 2022 09:37:26 +0000 Received: from DB5EUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:231:cafe::87) by DU2P250CA0007.outlook.office365.com (2603:10a6:10:231::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 09:37:26 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT012.mail.protection.outlook.com (10.152.20.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:37:26 +0000 Received: ("Tessian outbound 826a6d8e58c3:v113"); Wed, 30 Mar 2022 09:37:26 +0000 Received: from ab1cb7758456.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CF3A45DD-2CBE-47D9-9F06-2B0A9C3837B1.1; Wed, 30 Mar 2022 09:37:18 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ab1cb7758456.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 30 Mar 2022 09:37:18 +0000 Received: from AM6P194CA0102.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:8f::43) by AM0PR08MB3954.eurprd08.prod.outlook.com (2603:10a6:208:130::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18; Wed, 30 Mar 2022 09:37:16 +0000 Received: from AM5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8f:cafe::c) by AM6P194CA0102.outlook.office365.com (2603:10a6:209:8f::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17 via Frontend Transport; Wed, 30 Mar 2022 09:37:16 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT037.mail.protection.outlook.com (10.152.17.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:37:16 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 30 Mar 2022 09:37:11 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Wed, 30 Mar 2022 09:37:02 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 061e665d-b00d-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mLwBeL3HiizwBwJEJZAokUo9XslH5YOwT1NuUQp5TDI=; b=OEyDjSp4hWDbIZaBatyhohvFRxs7CXrAqk0iHzScj/Ud58VLP0uW7JuP+QzKS12P+4kLseGgov3haNaI/3gT68aYr5ckeC1hzyITaWE6P8rgdoOHCH3s1rPFfCH781T+PZMhRPy9z3Sl47c2ny+Yq69K+SuojA4+YmLxsXgxDKE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 6eb2069c4d4ff3f8 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C7PNs4ZzMXRQJ9bJjdia+W14BqFGHrVigoIxELq6ATVcMmirBrgZte7WwDSa8wdyQCc5JQ0MnmgUJfPw3tBrCnmv8Es5R+U98jYFs8KYT8vNlm7+0W9rB0MQ6OzYK5tGDmRDl54UkJKUWwhnv8CPCqmfAjYqriFs6sTeXTxOU3OR726DSnsQWCoMFuKlTE4Qae35ld8vGjjXQEs1Nus5xnCs5C/Jufr6nHzR8WKCkmN9MaYHAn2bQ0lqB2r++X9hjtclv9+Y/793LfKXr5ZFv00c7Rsyvj3BzKKnpmq/I6v7Ro22+RTuraXPvNXkJbhUSnbTqY2wqllNhmQc8W58ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mLwBeL3HiizwBwJEJZAokUo9XslH5YOwT1NuUQp5TDI=; b=CgMJDWamaw0cXv6Nhc5aO+jPUEdJ685nDeR8cEvuhV3ZloDsxAW5zPAyk3UfQVp6YAswzEhJxsOOVtRiS5a0TFLVP3kTM3rvg3wlYRaAJQ61irbkhL4phR3l1fO8P4svn7efkTAS8UcT/wdwrCdFFlmLL4dZne+mHkfISnRGiknHuX/ECT17U/tCLogLMBq3tnAif6jp0TVCskO798sFSm8STw5kNMLDhIld5JK2vgrLnSn9MIAcbIKdi2NnPl26LE8TO7XKsEOPQNHfeBImgQg2LqljmWtn0Chnf2RfSAxgy9jJRqFU+il0KsCPXyqx7jhtfB/wpNpnbHK4PfhInw== 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=mLwBeL3HiizwBwJEJZAokUo9XslH5YOwT1NuUQp5TDI=; b=OEyDjSp4hWDbIZaBatyhohvFRxs7CXrAqk0iHzScj/Ud58VLP0uW7JuP+QzKS12P+4kLseGgov3haNaI/3gT68aYr5ckeC1hzyITaWE6P8rgdoOHCH3s1rPFfCH781T+PZMhRPy9z3Sl47c2ny+Yq69K+SuojA4+YmLxsXgxDKE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , , Penny Zheng , Stefano Stabellini , "Julien Grall" , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , "Jan Beulich" , Wei Liu , Penny Zheng Subject: [PATCH v1 2/5] xen/arm: introduce CDF_staticmem Date: Wed, 30 Mar 2022 17:36:14 +0800 Message-ID: <20220330093617.3870589-3-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330093617.3870589-1-Penny.Zheng@arm.com> References: <20220330093617.3870589-1-Penny.Zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 5eb5d2db-237b-4de9-94e9-08da1230e692 X-MS-TrafficTypeDiagnostic: AM0PR08MB3954:EE_|DB5EUR03FT012:EE_|AM4PR0802MB2211:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: juvwHx/nEsNO3LUftiuwVqiC2l0LZVqwyYGqRE0StsDmbrrDpF509vkEo/WZpEKRqk7BR8epJ1QxkS41YBMTlrSQ3xZwtQG9/Ca5ttxPEKLAGdCCUSjOIOxdUShgWvtMJnfqHwOF7D0Ajpf/01u2KKcC3neZ1WduDIjWqWo2i/kp1pRClHq0aWgHTd0ev7qlwJvx4uoDPjVijC/UbKBFdrjCqYSkWoewltwoL6Td5pnzSB+o0+2ZRnXSXd2+mEX+9kO3S15qG9fSpvpP7648puTInIRre07SeA9mJ/1c33zA1cYQ5uu0qaw1OEhUK29H00BT7DYfUGustDX5XYmDY/nxUJlmSsYBlRIE81CrztqUDu6ESPYZ33iByYt19XOSJhNR+me+89qNzDsb6R9KLxWz/oMqgz7NXvknjvT4POxBkPojIqPzXWlGUSeFCBeO9CVbHn1lRCuOU0FaQWFerekw5dSd76lXyMdAUVxBdEQ9QxT7mm8ADt1HgyiZ5AzeZYWu5ChUvBnC35CrUjK9J2D0wslwSlUnqiNO3GmY4C0nbvw92uP/OeSPJe7PUh5yYBqkQRCuRH+CngxEK53FdewRLw/4H5Cn5FZXHQToBcky3KqKYctUTSX+E7gos+yYvz0zaRGpS5TbCwn//2fybyuY8VdJhKwVE490Rf2jjOEXGVZTooyVakw3HKvcuYqr9gf9kYIOT8dA2EfxjXp8gg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(81166007)(2906002)(70206006)(5660300002)(356005)(2616005)(82310400004)(40460700003)(83380400001)(70586007)(316002)(4326008)(1076003)(8936002)(54906003)(426003)(36860700001)(36756003)(7696005)(336012)(86362001)(47076005)(6916009)(8676002)(508600001)(26005)(6666004)(186003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3954 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c474861f-45dc-4cce-8d35-08da1230e099 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lkpOzXx+E9lBXxUjIwa6bzJeihYOSSiyAyaQMtf08db6gvVWAfO8hMq1CnOQpbOglujA1lNR8rRaMGUodKdCLIEHPcuLjpetLhqfDA3Ry9Aoo9RwTt50H7sLWFcDHaB0W52zS8jE2aIH3QyKJkQEFOIeyuzzJ52EKZXd8aaxnzBxkEhkG/cmF3SbiiqAQV2F3vTrEJNSDOqsX29quXL6h9gXuYscZzrsKt8KSTntpoMGFTpmjf87MvDJlDRmoYNl428AP22FRKx7SNlMlIaQCsDSPJFk3xCkDXG5UkMONn8dZanyqbAFm7KRsFhaj8YmO4wM7VCEfsFaV16cBN27MVBLnTrQSIrArmfqPZI2Og4WyNcDRtRmIbzqLWL80514pDYs7SEwKW03KVgeKWunVJeSXS1iq12Ohuz/jczP7RmVgPozJ/GYhGJ5U2lqgkqBVsmm02fi0OXxX7zyol1rTw8VUml9f7EWn6N+u+ln7rTgIeQf+d8ccxnfIawL7v9C3D6Ijwq9pvvnOa/D/hbdAdgBUWujqYScUOEiEHfpO8CUq7x2z9fDUQqDjeRivJTq6TzTuVpNNd1P2P8ULXIXOrVzejACHVgy3aj3dt6mjeX1iLD4AVTPq5NDos7ZTVp1ddUoJ94c2CZTVRHmZ89qztCAL3LyBGwh908RasQ2fC01OMgIePkwFC+8dF0ft2nK X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(36756003)(86362001)(6666004)(8936002)(4326008)(47076005)(5660300002)(508600001)(8676002)(81166007)(70206006)(70586007)(7696005)(426003)(36860700001)(1076003)(316002)(54906003)(6916009)(82310400004)(2906002)(336012)(186003)(26005)(40460700003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 09:37:26.2442 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5eb5d2db-237b-4de9-94e9-08da1230e692 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: DB5EUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2211 In order to have an easy and quick way to find out whether this domain is on static allocation, this commit introduces a new flag CDF_staticmem and a new helper is_domain_on_static_allocation. Signed-off-by: Penny Zheng --- xen/arch/arm/domain_build.c | 5 ++++- xen/arch/arm/include/asm/domain.h | 2 ++ xen/include/xen/domain.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 8be01678de..4e62fd0bf1 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3191,9 +3191,12 @@ void __init create_domUs(void) if ( !dt_device_is_compatible(node, "xen,domain") ) continue; + if ( dt_find_property(node, "xen,static-mem", NULL) ) + flags |= CDF_staticmem; + if ( dt_property_read_bool(node, "direct-map") ) { - if ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !dt_find_property(node, "xen,static-mem", NULL) ) + if ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !(flags & CDF_staticmem) ) panic("direct-map is not valid for domain %s without static allocation.\n", dt_node_name(node)); diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h index 95fef29111..4379f20a12 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -31,6 +31,8 @@ enum domain_type { #define is_domain_direct_mapped(d) (((d)->arch.flags) & CDF_directmap) +#define is_domain_on_static_allocation(d) (((d)->arch.flags) & CDF_staticmem) + /* * Is the domain using the host memory layout? * diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 1c3c88a14d..35dc7143a4 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -34,6 +34,8 @@ void arch_get_domain_info(const struct domain *d, #ifdef CONFIG_ARM /* Should domain memory be directly mapped? */ #define CDF_directmap (1U << 1) +/* Is domain memory on static allocation? */ +#define CDF_staticmem (1U << 2) #endif /* From patchwork Wed Mar 30 09:36:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12795604 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C8D3C433EF for ; Wed, 30 Mar 2022 09:38:10 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.296127.504052 (Exim 4.92) (envelope-from ) id 1nZUm7-0001Eb-FM; Wed, 30 Mar 2022 09:37:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 296127.504052; Wed, 30 Mar 2022 09:37: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 1nZUm7-0001EU-Bw; Wed, 30 Mar 2022 09:37:59 +0000 Received: by outflank-mailman (input) for mailman id 296127; Wed, 30 Mar 2022 09:37:58 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nZUm5-0000ky-RF for xen-devel@lists.xenproject.org; Wed, 30 Mar 2022 09:37:58 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on062a.outbound.protection.outlook.com [2a01:111:f400:fe02::62a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 14366c13-b00d-11ec-8fbc-03012f2f19d4; Wed, 30 Mar 2022 11:37:57 +0200 (CEST) Received: from DU2PR04CA0024.eurprd04.prod.outlook.com (2603:10a6:10:3b::29) by PAXPR08MB6400.eurprd08.prod.outlook.com (2603:10a6:102:150::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Wed, 30 Mar 2022 09:37:54 +0000 Received: from DB5EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:3b:cafe::51) by DU2PR04CA0024.outlook.office365.com (2603:10a6:10:3b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 09:37:54 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT042.mail.protection.outlook.com (10.152.21.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:37:54 +0000 Received: ("Tessian outbound 341d209a0e52:v113"); Wed, 30 Mar 2022 09:37:54 +0000 Received: from 539857bee079.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AF0D191D-D72A-40A2-8C78-FAC784AF9DBC.1; Wed, 30 Mar 2022 09:37:47 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 539857bee079.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 30 Mar 2022 09:37:47 +0000 Received: from DB6PR07CA0166.eurprd07.prod.outlook.com (2603:10a6:6:43::20) by AM9PR08MB6691.eurprd08.prod.outlook.com (2603:10a6:20b:303::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.16; Wed, 30 Mar 2022 09:37:45 +0000 Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:43:cafe::81) by DB6PR07CA0166.outlook.office365.com (2603:10a6:6:43::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.12 via Frontend Transport; Wed, 30 Mar 2022 09:37:45 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:37:44 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.27; Wed, 30 Mar 2022 09:37:24 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Wed, 30 Mar 2022 09:37:19 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Wed, 30 Mar 2022 09:37:14 +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: 14366c13-b00d-11ec-8fbc-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=csxfLE0x7VKw62ppqcl6atLmZHiQeVO09K5L2Np5/LY=; b=DWdv1J5MV/Aog1VTNYy1g1/XbQHjXvbGgAdBB0f/x/1isRsNL0GeSLQy5HlaGq+DCnrQ2aTbqoJW7A0PERpU6JeOFGhVS/9f6hpUUOc0/biTNImAbf3tpQYZXtf7lxcBxR/Ax15xu7v93gsdvtnn3WmD/H8zFZdlgzcMRB9DOa8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 9516156d429fe3dc X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jbZbPE5LUTjr5AesxfhBYIllkvVTgD+kgEwBBzMo2q/3X2rWDArSYh5JMplIjeuIni2yn+jdiN7XZIpgW8gVtJ0S816W2vzVBLIhBB40UXg97ISdgXwFM7G98MV2EKu3EFuOarmFeXwRXKeIZ5Rvwpp02M+wsL8gdPeSWjfTTITVOv9nQBrx2QxwUqPLkftYAHIAVMjW6etJULHPcMBJedg8NW4LKYz05WjBP17SNIrtYTIgOLA3aAtovpBhmFOJVBeMtPmHVuCZf2g6Oo16ZbHLI3rhh/QRXooB40wDi5v4ScIZUVvb8HbzNNQLuPGUX/kmlMX/Tv2pWJUIR8DDGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=csxfLE0x7VKw62ppqcl6atLmZHiQeVO09K5L2Np5/LY=; b=YTYIsrFNhHI8mKBd+8BG0RmxHo4BUI1eV6WBEV3i49TtvDWDJYmo2OmcILBq8E3nLKPR2MAH5fQenB2ni7aikV7CPRvQP9CE6vkVNt4FjMMpXbw/NK5dJ8edoeYRhPfb0/SbQAQ3Zbt7UcQix7RxWI4yjkdQFr8K/Xo4H4aDSAlQorp18msudvRD/ggpBSXMYi4Dicgfgpxk1dxofqAjJzKiUdZvE7LWacohih1GEmPLkBWyo9LbyvwCZSTWNDTJ/gd2dcUW0abfV/EjYpsnrHe/pMYxC/947S20uk0SNhyG/hS+ZWxAwfwN0jqid7KI3ipv9eRiqSfsVEgJkuo6zg== 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=csxfLE0x7VKw62ppqcl6atLmZHiQeVO09K5L2Np5/LY=; b=DWdv1J5MV/Aog1VTNYy1g1/XbQHjXvbGgAdBB0f/x/1isRsNL0GeSLQy5HlaGq+DCnrQ2aTbqoJW7A0PERpU6JeOFGhVS/9f6hpUUOc0/biTNImAbf3tpQYZXtf7lxcBxR/Ax15xu7v93gsdvtnn3WmD/H8zFZdlgzcMRB9DOa8= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , , Penny Zheng , Andrew Cooper , "George Dunlap" , Jan Beulich , "Julien Grall" , Stefano Stabellini , Wei Liu , Penny Zheng Subject: [PATCH v1 3/5] xen/arm: unpopulate memory when domain on static allocation Date: Wed, 30 Mar 2022 17:36:15 +0800 Message-ID: <20220330093617.3870589-4-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330093617.3870589-1-Penny.Zheng@arm.com> References: <20220330093617.3870589-1-Penny.Zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: daf6ab2a-af7c-4ecd-aeab-08da1230f76f X-MS-TrafficTypeDiagnostic: AM9PR08MB6691:EE_|DB5EUR03FT042:EE_|PAXPR08MB6400:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: m36Sd7pxcJrfzPfCDzrj6BN9I9dxkyrxlXqB5e2LAsSFmacENE2IhfUJYB3KQCP6FPDhQajqOUNC1nM7DVxC/pAIKcQim96fogt3gp9Ja5W4OuM9K/M3s1mKDHmzvJhqMjcEsFadWeRhMBXxOrNqfy9DtavI1eZNXxxDQUWR84CLrLnMj1jtyFzgGRclHJwz1TyPYM0I/AGUALDGzHWpuAiXKX1ot9VgMMbNnsYD8oDmiVFK2PDd2JpH5NRVviitSWXbGg8kTWSs+d+/Ig632IU/MlCzrih6rHga7QyOQrXBj0V+R8To2Cdyv2DWWUF3BGHgfQUpuH0Zn1mScNL58KsYwRKSFf9KjEVLPzAkRfAMo+YSycItJfyBPjNjZCWJJqxjuom3sxE3a47xXmILODW6ewbFc/Ov0+OVhhunOHt3H3P51MrsweTg39l2w0PUAdTiSA1dBZy2H+PTO6Za9/9T2MIjqeQjman8RBcp3Q467HBWEAEdYrqM0joVnSAhzyU9jaqjBt4sHH1p2jbt79j+7AjGMoYy0Ma93MtoYx1X1giqAJwvZL+vZNZRZjYbtAJdp6jwfF/75Fs/oQ7XeWWDV+9L3TNxG/EN9rcrNS+ChLXescNZAIMtU6EcJvpkS7SaKmCZ8oxMxofkWp4yzbIj7aLhohu1Yx+zKvl9IJCiuN/Q+w+E641foXumVhKEnYs5KrIp4tqQBV0ehA5rYA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(1076003)(186003)(6916009)(54906003)(8676002)(316002)(508600001)(81166007)(86362001)(40460700003)(82310400004)(26005)(2616005)(7696005)(356005)(36860700001)(4326008)(8936002)(5660300002)(426003)(70206006)(336012)(70586007)(2906002)(83380400001)(36756003)(47076005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6691 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 44810791-68b6-429e-9110-08da1230f1b6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hC0WOAp/lhYAVSMgdpFJpibW8GT9MtowUz1JnEFdknF/Vkb0HKYpkoB7HELK/WtfjuuS6veOyE1sBX9Mvs5R56jR4rhQT0v19WUzjV8JqDvdt2ffY2L9YftthhK3eS5IrGQ1PTANeyBA9CbzYCDFztPTVW3YF5UTOlrNR4aT+igHKRUAJTreN189RJ90Jzop+h0kQP8bjGmozpQAT/c0+B8Y4Phh2CZukDPMMzm/uHC0i3dYasV4vnazKyPCqufZCAZPWt07MVsTPEyLNqrR1XnsPMbeJat5Ry/+gkm8KEw+k0M7wQjHvey14jrqIz6/Iq4K0XRU4TQmAWgKYNy1HfUSNYvOTDabHk1ktY25LzCHrVhT8LgzXLqLjOnoEyDMv3Cr+ZxKy58tfJTIh+EHosanNX+JJ7G7VhC3AJZevVX49iK7NaObc+KdW1FliuUn/Tmromzy2BhIUc4IR+fmH2kI4zurGUPol8AiDj7qkmE71UjXFatsLAtKRWzsmSFh9SsgLJpCD5dpxr+CCO0ZEcBz1+36dvoPJJXsp5utghhBvQ8DVnSe4PyKLBScrJ+ZTuJTYxSWxo+9viApWJmwa7ogu1fsXFSEOJmxbfzsIWM8lqpYMXIBFpwyMgw5qdGM8AaDuBVEn+JKg0lGv2eZvGQw9NFZjzIppGs7LIxbC/i/1fHtcBKMbz800i3nouMf X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(5660300002)(508600001)(26005)(2616005)(316002)(7696005)(186003)(336012)(36860700001)(86362001)(82310400004)(1076003)(8936002)(40460700003)(70206006)(47076005)(426003)(81166007)(4326008)(83380400001)(70586007)(8676002)(54906003)(36756003)(2906002)(6916009);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 09:37:54.5368 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: daf6ab2a-af7c-4ecd-aeab-08da1230f76f 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: DB5EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6400 Today when a domain unpopulates the memory on runtime, they will always hand the memory over to the heap allocator. And it will be a problem if domain on static allocation. Guest RAM for domain on static allocation is static memory, which is reserved to only this domain, so it shall never go back to heap. For above purpose, this commit tries to keep page allocated and store it in page list d->resv_page_list on guest_remove_page, when domain on static allocation. Signed-off-by: Penny Zheng --- xen/common/domain.c | 4 ++++ xen/common/memory.c | 22 +++++++++++++++++++++- xen/include/xen/sched.h | 6 ++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 351029f8b2..e572f27fce 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -602,6 +602,10 @@ struct domain *domain_create(domid_t domid, INIT_PAGE_LIST_HEAD(&d->page_list); INIT_PAGE_LIST_HEAD(&d->extra_page_list); INIT_PAGE_LIST_HEAD(&d->xenpage_list); +#ifdef CONFIG_STATIC_MEMORY + INIT_PAGE_LIST_HEAD(&d->resv_page_list); +#endif + spin_lock_init(&d->node_affinity_lock); d->node_affinity = NODE_MASK_ALL; diff --git a/xen/common/memory.c b/xen/common/memory.c index 69b0cd1e50..2afc3c6f10 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -35,6 +35,10 @@ #include #endif +#ifndef is_domain_on_static_allocation +#define is_domain_on_static_allocation(d) 0 +#endif + struct memop_args { /* INPUT */ struct domain *domain; /* Domain to be affected. */ @@ -405,13 +409,29 @@ int guest_remove_page(struct domain *d, unsigned long gmfn) * device must retrieve the same pfn when the hypercall populate_physmap * is called. * + * When domain on static allocation, they should always get pages from the + * reserved static region when the hypercall populate_physmap is called. + * * For this purpose (and to match populate_physmap() behavior), the page * is kept allocated. */ - if ( !rc && !is_domain_direct_mapped(d) ) + if ( !rc && !(is_domain_direct_mapped(d) || + is_domain_on_static_allocation(d)) ) put_page_alloc_ref(page); put_page(page); +#ifdef CONFIG_STATIC_MEMORY + /* + * When domain on static allocation, we shall store pages to resv_page_list, + * so the hypercall populate_physmap could retrieve pages from it, + * rather than allocating from heap. + */ + if ( is_domain_on_static_allocation(d) ) + { + page_list_add_tail(page, &d->resv_page_list); + d->resv_pages++; + } +#endif #ifdef CONFIG_X86 out_put_gfn: diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 406d9bc610..d7e047bf36 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -376,6 +376,9 @@ struct domain struct page_list_head page_list; /* linked list */ struct page_list_head extra_page_list; /* linked list (size extra_pages) */ struct page_list_head xenpage_list; /* linked list (size xenheap_pages) */ +#ifdef CONFIG_STATIC_MEMORY + struct page_list_head resv_page_list; /* linked list (size resv_pages) */ +#endif /* * This field should only be directly accessed by domain_adjust_tot_pages() @@ -389,6 +392,9 @@ struct domain unsigned int extra_pages; /* pages not included in domain_tot_pages() */ atomic_t shr_pages; /* shared pages */ atomic_t paged_pages; /* paged-out pages */ +#ifdef CONFIG_STATIC_MEMORY + unsigned int resv_pages; /* reserved pages from static region. */ +#endif /* Scheduling. */ void *sched_priv; /* scheduler-specific data */ From patchwork Wed Mar 30 09:36:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12795630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BA33C433EF for ; Wed, 30 Mar 2022 09:48:12 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.296160.504089 (Exim 4.92) (envelope-from ) id 1nZUvk-0004TT-4n; Wed, 30 Mar 2022 09:47:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 296160.504089; Wed, 30 Mar 2022 09:47: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 1nZUvk-0004TM-1i; Wed, 30 Mar 2022 09:47:56 +0000 Received: by outflank-mailman (input) for mailman id 296160; Wed, 30 Mar 2022 09:47:55 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nZUnK-0000Fm-0g for xen-devel@lists.xenproject.org; Wed, 30 Mar 2022 09:39:14 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0607.outbound.protection.outlook.com [2a01:111:f400:fe02::607]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 41c40da2-b00d-11ec-a405-831a346695d4; Wed, 30 Mar 2022 11:39:13 +0200 (CEST) Received: from AM5PR0701CA0052.eurprd07.prod.outlook.com (2603:10a6:203:2::14) by VE1PR08MB4798.eurprd08.prod.outlook.com (2603:10a6:802:a2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.16; Wed, 30 Mar 2022 09:39:05 +0000 Received: from AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:2:cafe::ef) by AM5PR0701CA0052.outlook.office365.com (2603:10a6:203:2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 09:39:05 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT014.mail.protection.outlook.com (10.152.16.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:39:05 +0000 Received: ("Tessian outbound 341d209a0e52:v113"); Wed, 30 Mar 2022 09:39:04 +0000 Received: from b2ebb19cadfa.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3F00165D-0D1F-4FC0-8E1D-47EA4D4446C9.1; Wed, 30 Mar 2022 09:38:57 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b2ebb19cadfa.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 30 Mar 2022 09:38:57 +0000 Received: from DB6PR0301CA0057.eurprd03.prod.outlook.com (2603:10a6:4:54::25) by PAXPR08MB7105.eurprd08.prod.outlook.com (2603:10a6:102:203::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.22; Wed, 30 Mar 2022 09:38:55 +0000 Received: from DB5EUR03FT025.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:54:cafe::fa) by DB6PR0301CA0057.outlook.office365.com (2603:10a6:4:54::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 09:38:55 +0000 Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT025.mail.protection.outlook.com (10.152.20.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:38:54 +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.2308.27; Wed, 30 Mar 2022 09:37: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.2308.27; Wed, 30 Mar 2022 09:37:35 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Wed, 30 Mar 2022 09:37:31 +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: 41c40da2-b00d-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7qVkQ1qo3iAE+FDwNj2htVkkE7SSyq5qLjILB2koE80=; b=DIeuDu54hK8jHZxQED0isbg08am9B0MZ36067ccRaINykRLLaXae1HRY1izt8OrKTEt9P1kZOMwUShWoKUGz9AqrXFa0ZwVe7DmvnwcjQgfca7CeXr/Gztz2wzJS3K5KVkG+kbHwzhNoiHAkHZcL2ZRYNPU3cBSQrvShgREhpTU= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: e497e6f73c5547ee X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nI5SacCHGDtkOJa5lwav/L2kfYGKAczzup1+Stp52WPMAamgRp13IUY+6eKUdFW24fRAyn4aOq74pEiqbZJ0EAhEtydlWxXuSgrJugVphfAKdOKwKql7z+kA49PUj8VfO0ixGwvZaACPLJlO3t6b++aq/hmcky14kf71WUlSY+DXSK/HVuveW2SFqSzziwulTlxp4bdkJ8w55D0houhq5hCxSIPs9kQjftL4rUmwWv0YfLN7X/e3e05BI4+Yh5PM4rH3JfTSbVuEObd+f331tWGfMH5LdSZ+tZT2SYkpBYpI7ozcR62hfXJXkPrrZW8eUCSR0Ql02QsfzaySkTdf9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7qVkQ1qo3iAE+FDwNj2htVkkE7SSyq5qLjILB2koE80=; b=TQDLUM0LjpUCo2mKoyL2Kgbmrt3i52/Ig28MiMU7dORGkJBACFq7J1A7smvX6Y1Sfgt9TrwCCywnuwQWQ8JmQBZxJli0L0r1RtS4Urk+PmaWXJRjWlpU1O5xfYngKB4QAEkBEHNjYEJXJfVmBOcQqb0zGf2mM9xNLz4A7bs2mxEPveBDmV0vRk8hgS26sFa49HmUr2Ph95UswBnwjxkZt7oZF6L2v1C9mXhgW87rMGJ4XwXyMJr/l33guoHq18YgsuGVkodjTDnv9rYYQgbEFPfAE8JZ0wdeReygO4TC8Bf1CnWw4lGeTxf5M6LNOgcQaPcpsFocw8zen2tkx+o2UQ== 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=7qVkQ1qo3iAE+FDwNj2htVkkE7SSyq5qLjILB2koE80=; b=DIeuDu54hK8jHZxQED0isbg08am9B0MZ36067ccRaINykRLLaXae1HRY1izt8OrKTEt9P1kZOMwUShWoKUGz9AqrXFa0ZwVe7DmvnwcjQgfca7CeXr/Gztz2wzJS3K5KVkG+kbHwzhNoiHAkHZcL2ZRYNPU3cBSQrvShgREhpTU= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , , Penny Zheng , Andrew Cooper , "George Dunlap" , Jan Beulich , "Julien Grall" , Stefano Stabellini , Wei Liu , Penny Zheng Subject: [PATCH v1 4/5] xen/arm: retrieve reserved pages on populate_physmap Date: Wed, 30 Mar 2022 17:36:16 +0800 Message-ID: <20220330093617.3870589-5-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330093617.3870589-1-Penny.Zheng@arm.com> References: <20220330093617.3870589-1-Penny.Zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 59f1ddff-e998-4e35-4cd9-08da12312187 X-MS-TrafficTypeDiagnostic: PAXPR08MB7105:EE_|AM5EUR03FT014:EE_|VE1PR08MB4798:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 9LqYhnf5FgAyHrloVvr8FMeiBCudOqk0YSNDP3/jh10KPp3M673R1vH2DvLT+3uQjI+sAMN7JrfoaiA/nSkVu2O7Nnj5+k9aKbnULBZXlxsPL1UFzoE+PeLy0aK+lI6HVGE8t3KQ7Ym3FW0mS71kz6ORJOvZhW481XiFPqOryhcVUpcDapBHAhV+aSoM7KE2hGOSQVyBvCTFwLmpcPy41HLJ/xrM70Ezr20yjrXxGjuxQ5tqjq/j6b9N0HV9xrXzMGNqsVCpEr+vIZzT75C1ge2oReXL3qDu0Wmk/RhFmb37YfIRec19HTwcXV2PUbSC5xrlm/ijnvgyWAAJyBgir5TYmqm37RQhNkrfpFyPRW8nEKsAZrAnZZu7HW03bJ7me1kmmG7hy2kC192x4SfSV5Y/IUIsteYH7/RFgJYlqgxVCes3hYDTDlCvWOWfj7pveMJAoJOoDs9NlwF2zhAhiHTvtpE5WFRT3Pd4R1Tt7yw4D1kHr3Ds4QwbFUTqcXAGpqOt3SboGxdvKs4nkZzgd4KKeRwQ7xyDHs+e4hYnNBDoky2f8oDRLPtAakND3aINCfTvX+3EqwATM6sMnOdkiMYL+G5gbOURCBUL2UU65k2aU2YiRn3rp5jR8YjU2QV3BGe1/uqnFYLACkDtBZr+I6qfgvOgZzzY+xUJuX6CmCJPhEHVtvMeoOVY3pwJtrpRHQzKp0uDZstJq2C0ki19mQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(7696005)(40460700003)(8936002)(186003)(5660300002)(81166007)(82310400004)(356005)(26005)(508600001)(426003)(2616005)(336012)(1076003)(6666004)(6916009)(70586007)(8676002)(36860700001)(316002)(4326008)(83380400001)(54906003)(70206006)(47076005)(36756003)(2906002)(86362001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7105 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a4ecc0fb-6140-4a66-6129-08da12311b49 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3rTR1IW0E9DHnKXmX8+Hd9qXy6VHv6vvhVmhwbHF3bvXqc/21xzLbmY6TyJT7/JJuVKRPdxYQJ9IFdonrfIXLzJrwteU2SnEowe31QyDouXLzeIn5/YsMjLR0M4nPTDAJu4jgJoaJVW00TojnAupvSH7XZNwpP++JX9N1s45vPwvYwJOiRl4egldtF39tv33RvrxLpyNxPlM6Ku1fY1vDQW4yCr3UXWG88XgDNJCSEZe+swN/TW+AcfpwdCiru0FvDYs5EnzW+5UoGR5rDcrKWnlxXHKSynLWFiuR86N5wGKMfMEZuWxu6j4LGUlsJJYRz24qBTmSXd98y6DY2XagpSytQ/o0cskno1oP+BGQAgOvLapKeVrbJjslmnBgbQK0qDmKeAHWK21AxydrPfczFBUKlpdHheMAjmTBzi5EAHvAESuFXEx3nu6cmz07WejtEa9eV/nWUXl3DJglvrpzoKBe/LYYxxG8AlgCeQXwFvleilOAgjm8AurxPd1Fzmv0StoEVpg/5nE7b9i54um/hpsf/KLTswUYRbX47SekuEkiWIdUpWzYK2v3+y1tHUbUd5JGa4j0dNCFREQgypmwmQ2vVy8Auze4iHZyum3wUE/VOwkiHySPCKXfjxcTgjBB4jMPR0pWIKkHrRCpkNHni4/DuqJ1xv/C5eJ/IlCK2qm33UgVVWlyOHHeKtHb8d2 X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(8936002)(54906003)(426003)(2906002)(7696005)(6916009)(186003)(26005)(1076003)(508600001)(336012)(82310400004)(36860700001)(316002)(4326008)(70586007)(36756003)(6666004)(86362001)(8676002)(5660300002)(2616005)(83380400001)(70206006)(81166007)(40460700003)(47076005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 09:39:05.0621 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59f1ddff-e998-4e35-4cd9-08da12312187 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: AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4798 When domain on static allocation populates memory through populate_physmap, other than allocating from heap, it shall allocate from resv_page_list to make sure that all guest RAM are still restricted in statically configured regions. Signed-off-by: Penny Zheng --- xen/common/memory.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xen/common/memory.c b/xen/common/memory.c index 2afc3c6f10..2122ceeba7 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -249,6 +249,26 @@ static void populate_physmap(struct memop_args *a) mfn = _mfn(gpfn); } +#ifdef CONFIG_STATIC_MEMORY + else if ( is_domain_on_static_allocation(d) ) + { + for ( j = 0; j < (1U << a->extent_order); j++ ) + { + page = page_list_remove_head(&d->resv_page_list); + if ( unlikely(!page) ) + { + gdprintk(XENLOG_INFO, + "Could not allocate guest page number %lx\n", + gfn_x(_gfn(gpfn))); + goto out; + } + d->resv_pages--; + + if ( j == 0 ) + mfn = page_to_mfn(page); + } + } +#endif else { page = alloc_domheap_pages(d, a->extent_order, a->memflags); From patchwork Wed Mar 30 09:36:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Penny Zheng X-Patchwork-Id: 12795605 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F65FC433F5 for ; Wed, 30 Mar 2022 09:38:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.296135.504063 (Exim 4.92) (envelope-from ) id 1nZUmV-00021Q-P7; Wed, 30 Mar 2022 09:38:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 296135.504063; Wed, 30 Mar 2022 09:38:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nZUmV-00021H-Lr; Wed, 30 Mar 2022 09:38:23 +0000 Received: by outflank-mailman (input) for mailman id 296135; Wed, 30 Mar 2022 09:38:22 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nZUmU-0000Fm-Hs for xen-devel@lists.xenproject.org; Wed, 30 Mar 2022 09:38:22 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20611.outbound.protection.outlook.com [2a01:111:f400:7e1a::611]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2344ff12-b00d-11ec-a405-831a346695d4; Wed, 30 Mar 2022 11:38:21 +0200 (CEST) Received: from AM6P195CA0069.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::46) by AM0PR08MB3811.eurprd08.prod.outlook.com (2603:10a6:208:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.22; Wed, 30 Mar 2022 09:38:18 +0000 Received: from VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:87:cafe::3a) by AM6P195CA0069.outlook.office365.com (2603:10a6:209:87::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17 via Frontend Transport; Wed, 30 Mar 2022 09:38:18 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT048.mail.protection.outlook.com (10.152.19.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:38:17 +0000 Received: ("Tessian outbound 63bb5eb69ee8:v113"); Wed, 30 Mar 2022 09:38:17 +0000 Received: from f961511ea16c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EC901C94-3FD1-4D61-9A00-815D65616AB8.1; Wed, 30 Mar 2022 09:38:09 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f961511ea16c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 30 Mar 2022 09:38:09 +0000 Received: from AS9PR04CA0082.eurprd04.prod.outlook.com (2603:10a6:20b:48b::6) by DB7PR08MB4619.eurprd08.prod.outlook.com (2603:10a6:10:7d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Wed, 30 Mar 2022 09:38:06 +0000 Received: from AM5EUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:48b:cafe::5f) by AS9PR04CA0082.outlook.office365.com (2603:10a6:20b:48b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 09:38:06 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT012.mail.protection.outlook.com (10.152.16.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5102.18 via Frontend Transport; Wed, 30 Mar 2022 09:38:05 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 30 Mar 2022 09:37:51 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Wed, 30 Mar 2022 09:37:42 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2344ff12-b00d-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=znsC665yGCk5zE8FKB/DjZh+uBcFbBobBpnEb5l3DdA=; b=T5KExU6oHi4JSE0FnI6i1LDFukEGvF3yDljyV/ClQl4BSHJBaNYi8qmldEre49q89L+A8MOXaMnxG5BqvQGrsTKsAw5XEyUQXz5BRK44W/OPS+BvtHn3C6gy2UOx1E7BDToKQAum9cS77F+oghWO+l1ZOh7YBI9xjKziw4srDWY= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: b2bc2a68fb15f2c0 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ovnq9ej+sqptTfndfJ7i4RGgH+A+x+lub4O9pYc+98GrlUwuSWGCcA2aTfYy5uGP+FTAUW5uNaDE15rpQpBtHqgjKjNgqctQ4bogf+pSKH30Rghnh5k/b4tft0//ibsof5f1EjvRmzgln4alXXg/Tdh+wNGgLLGnfjikGMn4ApVoG5zHnKZI0UX6o5ebVGocXiTe/R2cTVRh6MGoPF/KlrKcQ8H40tnRdwwBPzSXgru0rrFNgz3i0nHrmcWxUNME8yVDIOKQGocF+1o4SQd/G9rJgd1n7Ez9V+HY1Wg9EaISkpuvXCSnFmWJQHibbUw5XrrpcFBZ1X3qismNkptFag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=znsC665yGCk5zE8FKB/DjZh+uBcFbBobBpnEb5l3DdA=; b=bLMQP6Y+rsLDmjFa8qpakbCORiztYJJ+qLDH3qav4xhWCoJ2SZn/gs0OkMAba5BvYBkALO0N53DzJeC6oLOMPm44frFDTpC0jatvgEBbCnM354OQx4RHdcdVNHKj4CINqcLRqEsuf5xjjCezCZ310E1ZkcrraBEKdWp1b4wwpG53QcTukuHi7Fvlk1CMwqIoXouDx2sPSSrbvu+ceuf0kAa0dDAZyuHSvzynXcu0mqAxZpgNiFMU+DtRLbG0Yj48RS0ndYn9yO1njzjC4Q6BjMHP36fNm5PaPsh87+8fgCLaHlO2rfpr+VYhTShPfCqA24WYGh8dv37NcsRXy3KhQA== 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=znsC665yGCk5zE8FKB/DjZh+uBcFbBobBpnEb5l3DdA=; b=T5KExU6oHi4JSE0FnI6i1LDFukEGvF3yDljyV/ClQl4BSHJBaNYi8qmldEre49q89L+A8MOXaMnxG5BqvQGrsTKsAw5XEyUQXz5BRK44W/OPS+BvtHn3C6gy2UOx1E7BDToKQAum9cS77F+oghWO+l1ZOh7YBI9xjKziw4srDWY= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , , Penny Zheng , Andrew Cooper , "George Dunlap" , Jan Beulich , "Julien Grall" , Stefano Stabellini , Wei Liu , Penny Zheng Subject: [PATCH v1 5/5] xen/arm: no need to store pages in resv_page_list when domain is directly mapped Date: Wed, 30 Mar 2022 17:36:17 +0800 Message-ID: <20220330093617.3870589-6-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330093617.3870589-1-Penny.Zheng@arm.com> References: <20220330093617.3870589-1-Penny.Zheng@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 62a3db76-fa7c-4824-0689-08da12310550 X-MS-TrafficTypeDiagnostic: DB7PR08MB4619:EE_|VE1EUR03FT048:EE_|AM0PR08MB3811:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: NZkBB6e9hupq/LnQ5QVudyRu9/95w+88uvfu88myVoGXs27FOCmysqjjk7D+9M1aEQ19N7ShVXZOMNkPoNoa7FCm1PmkCtGVlHVpiwmFh3u/dsAypEH8EuHCwbSX0dspFBfuSGCdoh8XRl2o17nq0YuhnmjBpHdiIy+xqRwio/baVmx/N0Fn777NidmdbIFknFF/iYSg/Pvv23gIvRVe3c9Afz8FA8jqZBASVBuVwO11QBM9LhzQJZamQ1VQOaGYSKy+baGyIOpdyHkuNC1w7bD0J9LQhSZN1exGMIpNuSbqQfI8KaeK/WgBJSNmyTid0PZc9TA7SzdcokS/4ks6/DXtYwBlO5VvkX+Llv8LX3+UtB0DTtjv4WrMzzftqaENbYxv9Lm++BcCoKEvvANottkXqJYEaz0k/wkD3hXUp+qXClMvFUIIOB1BWHheKs24uGo1sTH4JUfjMYUvv35XR0lwcQDppv+Z9DrbCEqC+2UKcYOa027JmPJOAwouWtM9BToiNmj34zNGiqSWR/6NzF8dPaFTrQnyiHOsA90llOjUrUC0Mbw4/AlEdqQeu/0yamUbDkC4We2MvBaJRkmod4mzF54AbRPTTB67HiKE2MLp0Z+uN3opfD+wA0qbqtvCp5DTPKSmvpxIpEP8ZyNg4wcomupOq40hmOUPapIgwLLoJhkty4VkFWqF53CKrpJwK+pAUIVgDp8Il2gnPflnmQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(82310400004)(8936002)(70586007)(70206006)(4326008)(508600001)(86362001)(2906002)(54906003)(6666004)(316002)(40460700003)(5660300002)(7696005)(8676002)(426003)(336012)(47076005)(83380400001)(36860700001)(2616005)(6916009)(356005)(186003)(81166007)(36756003)(1076003)(26005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB4619 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: dccf726f-824f-47c1-2657-08da1230fdb9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lWM3k/m7UqQdLjSs3IhQAA0Es5x6w8PWTOAD4qq0SZO8ERwzu3hT5gBdcXSCSKGyIk9m1UiL+OopRVjTpZZN8GkxEmP4fgb1wf+7fR7ObhD0yDT+jC8OUvsa8YuaMcSkxbJ0M/2YyCaoe6M2RTV4gRfS6ZyewnC1YGHvulMY2fIurjsUw03e2dJlUTNcJVq7Hi1NFtnG05UHv3X1ebKnW7i5d5ca6r08Zr/R55jsNAsowZlZdlas6NRlBaXFFZtl3LBA3IDgPnKDJjL3RslrzjcgDnWkHkRLmoup7YKg/2UPC+g8fkcetUDiYSrUmZGNgxL0uJbJrF08Q9lQw310Nj1tiXb9XNn6aiT/sqW9/+iNHXR4ErxiFej4mqbU4FGRP++Mo6guuuVf4ZX4cQ6Xk7a9TIO5SeEAsxIj0F+F/UwvW6qTaTUla6lkawwiiJgq9yb7brqCRCqtuRtssDHIqhUvdyzmgcHZaIcea81WQJqXMc0Hm9gf3FejzQiCXRHRMFG4Fk4AyBgKDnkDN0srNnxHF0uzNqLtWsK/cX/W4hYvjFmNU9m9vSTxsNg0jDuDMCom3CIrpsRgNnfHYCfJv4Y56WDO5f1rfwQEussiCyf2R1DU6tXyIaYKoc6G7CZEguyNh5rGEVYHf7GLmOEr7TtStWxTgqGMT+YOgb55gv36ig6TQ3RjeItUVQl0TYM0 X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(6666004)(86362001)(8936002)(508600001)(5660300002)(36756003)(4326008)(8676002)(81166007)(47076005)(7696005)(70206006)(70586007)(316002)(1076003)(36860700001)(2906002)(54906003)(6916009)(82310400004)(336012)(186003)(26005)(426003)(2616005)(40460700003)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 09:38:17.7116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62a3db76-fa7c-4824-0689-08da12310550 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: VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3811 When domain on static allocation and is directly mapped, in terms of GPA == HPA(guest physical address == host physical address), we could use mfn_to_page() to easily find the page, so there is no need to store pages in resv_page_list. Signed-off-by: Penny Zheng --- xen/common/memory.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/common/memory.c b/xen/common/memory.c index 2122ceeba7..2865e09a33 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -445,8 +445,11 @@ int guest_remove_page(struct domain *d, unsigned long gmfn) * When domain on static allocation, we shall store pages to resv_page_list, * so the hypercall populate_physmap could retrieve pages from it, * rather than allocating from heap. + * No need to store pages in resv_page_list when domain on static + * allocation and directly mapped, since we could use mfn_to_page() to + * easily find the page. */ - if ( is_domain_on_static_allocation(d) ) + if ( is_domain_on_static_allocation(d) && !is_domain_direct_mapped(d) ) { page_list_add_tail(page, &d->resv_page_list); d->resv_pages++;