From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808901; cv=pass; d=zohomail.com; s=zohoarc; b=Weh1o2xkR8XVkYGG2+cWvKavU8o/D8vF9kOFOkp8AB5TQFc3ugWhoh2yI/l6SBh4PQVwJhNlHGTfa03DH3Il8+PcB/L3eO04JXxwbOdLMx4k2CoRx7gdDTagdDC8jkigdz+JWvaG685I8jbqeDAZBgF3RG2zQaCnrtLLa5UD/Ew= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808901; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KB1S60IihEv8VGYUXws5DWDnmLCtiZ1gCsStIIhUK5E=; b=cmiVBl2JGDWgj2Tdd7vzie4wfwanXBLKHtWGECA4DXOkuhkoY2QI5URnyElb0QpPABMPpVu68FtJfxkFyOUpBCqYWaSAyXOSr+r/pUbwsrb03UW6DeB6/5oV+aG70YgdKLT3ecrekOh0/YfA0X+/BivXr+I5QP42hQc0mbDsn8g= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808901501739.9658358252852; Sun, 13 Feb 2022 19:21:41 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271070.465406 (Exim 4.92) (envelope-from ) id 1nJRvP-0007M6-No; Mon, 14 Feb 2022 03:21:15 +0000 Received: by outflank-mailman (output) from mailman id 271070.465406; Mon, 14 Feb 2022 03:21:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvP-0007KJ-HR; Mon, 14 Feb 2022 03:21:15 +0000 Received: by outflank-mailman (input) for mailman id 271070; Mon, 14 Feb 2022 03:21:14 +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 1nJRvO-0007B4-4f for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:14 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on0630.outbound.protection.outlook.com [2a01:111:f400:fe05::630]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 26eb130a-8d45-11ec-8eb8-a37418f5ba1a; Mon, 14 Feb 2022 04:21:10 +0100 (CET) Received: from DB9PR02CA0024.eurprd02.prod.outlook.com (2603:10a6:10:1d9::29) by VE1PR08MB5614.eurprd08.prod.outlook.com (2603:10a6:800:1a8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Mon, 14 Feb 2022 03:21:06 +0000 Received: from DB5EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1d9:cafe::83) by DB9PR02CA0024.outlook.office365.com (2603:10a6:10:1d9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.19 via Frontend Transport; Mon, 14 Feb 2022 03:21:05 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT004.mail.protection.outlook.com (10.152.20.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:05 +0000 Received: ("Tessian outbound 18e50a6f0513:v113"); Mon, 14 Feb 2022 03:21:05 +0000 Received: from 1e3b77a573ee.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9BD198F7-54EC-48D3-892A-28F6A9466F78.1; Mon, 14 Feb 2022 03:20:59 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1e3b77a573ee.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:20:59 +0000 Received: from AM5PR0502CA0008.eurprd05.prod.outlook.com (2603:10a6:203:91::18) by VI1PR08MB3181.eurprd08.prod.outlook.com (2603:10a6:803:3f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Mon, 14 Feb 2022 03:20:56 +0000 Received: from AM5EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:91:cafe::2) by AM5PR0502CA0008.outlook.office365.com (2603:10a6:203:91::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.19 via Frontend Transport; Mon, 14 Feb 2022 03:20:55 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT034.mail.protection.outlook.com (10.152.16.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:20:55 +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.20; Mon, 14 Feb 2022 03:21:00 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:20:53 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:20:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 26eb130a-8d45-11ec-8eb8-a37418f5ba1a 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=KB1S60IihEv8VGYUXws5DWDnmLCtiZ1gCsStIIhUK5E=; b=sOoA07eoaC5uOlpPGVmeR2z5sgVr5iWqc6Tv5RyNiOR2nwfnHVlj/BjxKdXKz2zeIi6Jf27o9Oy6paEfSvXc3YOj/PZF6LL/lm3w7FLpEEBsPSRg3U7y9Le9lZqHy7OuMQKJL3RreGD/Na3I8E1agVZau7T5HZI0PIUY31K19Hc= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: f5f60d10bf1e6aaa X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dkafOOd8VhO2QbtLdJrAULqWM+im+y1uDTqEokvYpTwHFVvJu5NiFrsLe9jGI0moHwYhn/EDcPI0fiuqtFnFHjviLOGpNp8VRmJO+02oU/PDKMXG4aGesmfZUafqUm/2H79QSEP15gNYQUktoaID2Gp77hiXdCjP4Ax9yXIF2p4ms9RUsVA0q8m30R67wS1zq8mzYhDqFHRUgfpDcqBlkqtTKcGJMS+YgFQW79YNxQHS+CYyLV6m13uI1yv+SoGW9dq0zbbgCSlPtCKbWuNRDOBUCFF06xH6ooOzwhtrpfQGIFTUgxMsk6640ZytT5pNu33b4cjtRtA9+McpnWt5kQ== 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=KB1S60IihEv8VGYUXws5DWDnmLCtiZ1gCsStIIhUK5E=; b=bDhwU+g9YSIU/VJb7DzeDmC8pywD0rEzlsBeiLWjvKknxzovgcv+40C9fglb1x6ZMpj2kd9Ph0F4F35f8ccpFggk6feSGUOyGKMtdVjCG6kimcuaSBzZBHaSaJ+MuYJAR9coC0NqkE+QUmrS2/x38JVO4c2xgWK4DLuMmNUdEyPTqYLa+K38w4DG0niOV8bBPn6W96Ker0oGws5oPOjknt9pyVfZtIv4r+7T5Du3jMZ1A+vweK+gakn2wxkhv8U7OU+Q1wBSPXuvnCqAi3mEKO7Su/0O/TZvdtVQG6k2tAQkIczJYHCbkfaevZakHInVka6XiuTEUW0j2o7OpnBktA== 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=KB1S60IihEv8VGYUXws5DWDnmLCtiZ1gCsStIIhUK5E=; b=sOoA07eoaC5uOlpPGVmeR2z5sgVr5iWqc6Tv5RyNiOR2nwfnHVlj/BjxKdXKz2zeIi6Jf27o9Oy6paEfSvXc3YOj/PZF6LL/lm3w7FLpEEBsPSRg3U7y9Le9lZqHy7OuMQKJL3RreGD/Na3I8E1agVZau7T5HZI0PIUY31K19Hc= 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: , Subject: [PATCH v6 01/11] xen: introduce internal CDF_xxx flags for domain creation Date: Mon, 14 Feb 2022 03:19:46 +0000 Message-ID: <20220214031956.3726764-2-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 563f6192-236e-484c-9565-08d9ef690945 X-MS-TrafficTypeDiagnostic: VI1PR08MB3181:EE_|DB5EUR03FT004:EE_|VE1PR08MB5614:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1051;OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: FxnqTkrpzjeRvOJmUOWcWxbskkmFYJnn70Hu+8YE+PaDNaYdc8DfSR6DgBDxmnP/393XD/y/pi3VuMYTPZxLSoSPhWZTtSm/pIzb2hryCkqvV/ookrLy45GpyL8D7yZw9FmEEbeB0bs+TESoXSuLfy5RiqZZQ77DIt+fxP0CO7dEbH/hyuxJceYjjquGBUWxAh/M7jVySs6+8QLSZKwbPAmaqJwq+ShJn4dU7TxQqDddo22K/YvT4cbDrsqeWoJFmErwTXodxgByrsUtQj7MpH/sxkZGgi+aX+05hE8sC6yF7wtNO/Yo4Em5bSWCPJ0TjnFx0xM5r60Sz06AxD0ODzH+w53VbVAopwwIiLY/iBSn5lNe+UJ8ci3a0yNnuXW0IUFdWlQX49F+ZuuyrB9Bc7HdSqDmSRrrFyWYUzqT4JZcF6vSvwxH2kdQ8uZbfamfcefArKMHWWgB/005Z4NqqUe2RVm70MiBTC2x/X02quMa3SBwyRv5NIJeTkp33J0u7bGce2gRLU3euoyLIKwBBYt6yHwY2uk4PirloqGE2+sb/G3IUuypoNuq/zhFsr6BPvfurSndKRqIUlW56so2FRC3eUranvhQqo4kkO6yBjccc52Sp7/wzGPPLDIRWJhZ+iqVAHyklgrDJVn4ztTdcZj4idrDc1rJn2z5C3Kep3i8gOzDHYHE62aCeIX5kJa9pTsc4aaSTKIh7uQ8sfyckg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(83380400001)(86362001)(70206006)(70586007)(47076005)(26005)(186003)(316002)(336012)(81166007)(356005)(36860700001)(82310400004)(4326008)(426003)(2616005)(508600001)(8676002)(7696005)(6666004)(1076003)(110136005)(2906002)(54906003)(36756003)(44832011)(5660300002)(8936002)(21314003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3181 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: db33df49-10bd-4325-1f62-08d9ef69033d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wBF02sTg2RHE5EadfEpipcNu7EVR2ItR2hlP1wI10ZC+Olum/tlF8TEd1Lmt7y0jM4JovCB3JBBaaBcqq1GYRwafuTy8fbGiOqoV2Zz4gHY5tdTDrxWbXKxtUdqhW9wskk9w/jsJQxS3uBhMfZCjlwrnQvfttacAzxK99XQngvOJKMRz3EYdADwxP+03Jo1VugmgQrnQj8ZxeJ/2ahHNuDFaNgcHd/wTmBvB26yWW+wJToJeJJMyA3VLFAvzWPdU+0+ru9X4m2gQ932dwv8j6OpPduu3pDVWWMooFtA3XnqIns0MinLzerLckPZ0H4xb7dhv2NYYhdvB7d4Kal+i8gQ8A+64jr5ACzeUD85D2FjqfpdDSZmqSyU5w4TEnS/Ef62KEsZGJ459jQ2KO3qtSg/0iHq5iqWxhDIkSiG6izSd4KP9eQkd7yEBUCiEXmuwxTz0/kdR1jt8xNo26wYt/3v3RGOIet2igFsOWNM1CWp6gdYlgCY32siCKTuePH84qXZKe53vvMMnGa/tXsw4Sb9BoqSm9DQwW7g94uV12hj21Qzd+HeoZvQ/yA4acW7tt2rAu8YLxUMjJ+Rv2XLtaGakZvNVDPUMZLZs/eFBs+VE6BCmJ1O9ScAX1mYrAhAqucoxGcN5ujDuIfT54mvuAQVFspS/j0G1Vxdxcpj6IqE= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(186003)(26005)(1076003)(70586007)(2906002)(2616005)(70206006)(7696005)(44832011)(81166007)(4326008)(8936002)(8676002)(6666004)(82310400004)(47076005)(36756003)(336012)(508600001)(426003)(5660300002)(36860700001)(316002)(54906003)(110136005)(83380400001)(86362001)(21314003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:05.5639 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 563f6192-236e-484c-9565-08d9ef690945 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: DB5EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5614 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808903708100003 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini We are passing an internal-only boolean flag at domain creation to specify whether we want the domain to be privileged (i.e. dom0) or not. Another flag will be introduced later in this series. This commit extends original "boolean" to an "unsigned int" covering both the existing "is_priv" and our new "directmap", which will be introduced la= ter. To make visible the relationship, we name the respective constants CDF_xxx (with no XEN_DOMCTL_ prefix) to represent the difference with the public constants XEN_DOMCTL_CDF_xxx. Allocate bit 0 as CDF_privileged: whether a domain is privileged or not. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng Reviewed-by: Jan Beulich Reviewed-by: Julien Grall Tested-by: Stefano Stabellini --- v4 changes: - new commit --- v5 changes - remove const constraint --- v6 changes - no changes --- xen/arch/arm/domain_build.c | 4 ++-- xen/arch/x86/setup.c | 2 +- xen/common/domain.c | 10 +++++----- xen/common/sched/core.c | 2 +- xen/include/xen/domain.h | 4 ++++ xen/include/xen/sched.h | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 6931c022a2..0fab8604de 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3058,7 +3058,7 @@ void __init create_domUs(void) * very important to use the pre-increment operator to call * domain_create() with a domid > 0. (domid =3D=3D 0 is reserved f= or Dom0) */ - d =3D domain_create(++max_init_domid, &d_cfg, false); + d =3D domain_create(++max_init_domid, &d_cfg, 0); if ( IS_ERR(d) ) panic("Error creating domain %s\n", dt_node_name(node)); =20 @@ -3160,7 +3160,7 @@ void __init create_dom0(void) if ( iommu_enabled ) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 - dom0 =3D domain_create(0, &dom0_cfg, true); + dom0 =3D domain_create(0, &dom0_cfg, CDF_privileged); if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) =3D=3D NULL) ) panic("Error creating domain 0\n"); =20 diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 115f8f6517..624b53ded4 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -789,7 +789,7 @@ static struct domain *__init create_dom0(const module_t= *image, =20 /* Create initial domain. Not d0 for pvshim. */ domid =3D get_initial_domain_id(); - d =3D domain_create(domid, &dom0_cfg, !pv_shim); + d =3D domain_create(domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged); if ( IS_ERR(d) ) panic("Error creating d%u: %ld\n", domid, PTR_ERR(d)); =20 diff --git a/xen/common/domain.c b/xen/common/domain.c index 2048ebad86..a79103e04a 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -552,7 +552,7 @@ static int sanitise_domain_config(struct xen_domctl_cre= atedomain *config) =20 struct domain *domain_create(domid_t domid, struct xen_domctl_createdomain *config, - bool is_priv) + unsigned int flags) { struct domain *d, **pd, *old_hwdom =3D NULL; enum { INIT_watchdog =3D 1u<<1, @@ -578,7 +578,7 @@ struct domain *domain_create(domid_t domid, } =20 /* Sort out our idea of is_control_domain(). */ - d->is_privileged =3D is_priv; + d->is_privileged =3D flags & CDF_privileged; =20 /* Sort out our idea of is_hardware_domain(). */ if ( domid =3D=3D 0 || domid =3D=3D hardware_domid ) @@ -772,7 +772,7 @@ void __init setup_system_domains(void) * Hidden PCI devices will also be associated with this domain * (but be [partly] controlled by Dom0 nevertheless). */ - dom_xen =3D domain_create(DOMID_XEN, NULL, false); + dom_xen =3D domain_create(DOMID_XEN, NULL, 0); if ( IS_ERR(dom_xen) ) panic("Failed to create d[XEN]: %ld\n", PTR_ERR(dom_xen)); =20 @@ -782,7 +782,7 @@ void __init setup_system_domains(void) * array. Mappings occur at the priv of the caller. * Quarantined PCI devices will be associated with this domain. */ - dom_io =3D domain_create(DOMID_IO, NULL, false); + dom_io =3D domain_create(DOMID_IO, NULL, 0); if ( IS_ERR(dom_io) ) panic("Failed to create d[IO]: %ld\n", PTR_ERR(dom_io)); =20 @@ -791,7 +791,7 @@ void __init setup_system_domains(void) * Initialise our COW domain. * This domain owns sharable pages. */ - dom_cow =3D domain_create(DOMID_COW, NULL, false); + dom_cow =3D domain_create(DOMID_COW, NULL, 0); if ( IS_ERR(dom_cow) ) panic("Failed to create d[COW]: %ld\n", PTR_ERR(dom_cow)); #endif diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 8f4b1ca10d..f5c819349b 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -3021,7 +3021,7 @@ void __init scheduler_init(void) sched_ratelimit_us =3D SCHED_DEFAULT_RATELIMIT_US; } =20 - idle_domain =3D domain_create(DOMID_IDLE, NULL, false); + idle_domain =3D domain_create(DOMID_IDLE, NULL, 0); BUG_ON(IS_ERR(idle_domain)); BUG_ON(nr_cpu_ids > ARRAY_SIZE(idle_vcpu)); idle_domain->vcpu =3D idle_vcpu; diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 160c8dbdab..cfb0b47f13 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -28,6 +28,10 @@ void getdomaininfo(struct domain *d, struct xen_domctl_g= etdomaininfo *info); void arch_get_domain_info(const struct domain *d, struct xen_domctl_getdomaininfo *info); =20 +/* CDF_* constant. Internal flags for domain creation. */ +/* Is this a privileged domain? */ +#define CDF_privileged (1U << 0) + /* * Arch-specifics. */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 37f78cc4c4..24a9a87f83 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -665,7 +665,7 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config); */ struct domain *domain_create(domid_t domid, struct xen_domctl_createdomain *config, - bool is_priv); + unsigned int flags); =20 /* * rcu_lock_domain_by_id() is more efficient than get_domain_by_id(). --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808898; cv=pass; d=zohomail.com; s=zohoarc; b=R/4i1lIx6QYfsiYXWrpNCNPFIwQItVcA2dTsZMg3afdFvjmNB20yHTle2tOWOlSQQMsmY8QjOtMhozHL7lDaqh/lsiXjCdx+mVsZZTv7qqRVy+awCrqAsAZnOE/X1mcW5g6qM+Xd2bEJCkZiUh3Em4LLXp4DPdhSHtXirIRpACA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808898; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2d0zlUHuPGVdtqU2Zxo5Ydvr8hkysX87Lzm7MZgBpwE=; b=jmTcGNPFjU6c0cuE4MQqdH+2Q9Qo1OFWU2TNpcN1wqbUhkp98DYQ7ApqRM7uBcW1FgSC6TJ99mgOhbFqPJLPo+W/VJl3CXpS9ESdJmHypYrmEzd9oWdXV2/X5/BMoi60iegSMON1Ah0FRnXtBNzt5Nj2eUQ+pkd3IeH2tm7iS24= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808898825885.1914566414009; Sun, 13 Feb 2022 19:21:38 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271071.465414 (Exim 4.92) (envelope-from ) id 1nJRvQ-0007UW-3h; Mon, 14 Feb 2022 03:21:16 +0000 Received: by outflank-mailman (output) from mailman id 271071.465414; Mon, 14 Feb 2022 03:21:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvP-0007Rd-RL; Mon, 14 Feb 2022 03:21:15 +0000 Received: by outflank-mailman (input) for mailman id 271071; Mon, 14 Feb 2022 03:21:14 +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 1nJRvO-0007B5-CV for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:14 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03on0628.outbound.protection.outlook.com [2a01:111:f400:fe09::628]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 285dd3ec-8d45-11ec-b215-9bbe72dcb22c; Mon, 14 Feb 2022 04:21:12 +0100 (CET) Received: from DB6PR0801CA0054.eurprd08.prod.outlook.com (2603:10a6:4:2b::22) by VI1PR0801MB2015.eurprd08.prod.outlook.com (2603:10a6:800:8b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Mon, 14 Feb 2022 03:21:09 +0000 Received: from DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:2b:cafe::c2) by DB6PR0801CA0054.outlook.office365.com (2603:10a6:4:2b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:08 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT006.mail.protection.outlook.com (10.152.20.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:08 +0000 Received: ("Tessian outbound 1f399c739551:v113"); Mon, 14 Feb 2022 03:21:08 +0000 Received: from c0aeb5dd910e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2FE714F8-BF9D-4F72-BD1C-88F2E3E17C2C.1; Mon, 14 Feb 2022 03:21:01 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c0aeb5dd910e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:01 +0000 Received: from AM6PR08CA0010.eurprd08.prod.outlook.com (2603:10a6:20b:b2::22) by AM6PR08MB4834.eurprd08.prod.outlook.com (2603:10a6:20b:c9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:20:59 +0000 Received: from AM5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:b2:cafe::ac) by AM6PR08CA0010.outlook.office365.com (2603:10a6:20b:b2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15 via Frontend Transport; Mon, 14 Feb 2022 03:20:59 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT018.mail.protection.outlook.com (10.152.16.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:20:59 +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.20; Mon, 14 Feb 2022 03:21:02 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:20:56 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:20:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 285dd3ec-8d45-11ec-b215-9bbe72dcb22c 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=2d0zlUHuPGVdtqU2Zxo5Ydvr8hkysX87Lzm7MZgBpwE=; b=GIQPPv+IoohPF5PVyWHV8YnIOtdHsMpzbP7sneM/6n0t2gU2ANA+H4QVKzcsFNcOPIW8jM5P1EnMGGkg/Epgth6l03fXaDiKC4neO6HKMNf589CHR1vipPaD2Sqk/bKVyzcWntQmu8lCJAwyp5kaAMbdBGwese4+uP1C+PbBh6o= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 0c811310ce51801b X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mjn970oYqCajI24+Nn48qG+Gg/BAG6Jow34nhBv28T0fwmm5KuHgh8Np6JEZpL1d7w9CkJUArqCAoH/4JTVhdbcJhlOfmlrWuhLSY82PMy6Qy/7eN1IcKuGi87nyBprdNLnOwWe+kUpnmxEgDVTsspWgn171IL+EmwP+G6ckTGKuoQxAqRsm3K0PhKxuaPPbyN72f9Z3sBl7TiOWY8uzkezfkbLsXJfJmMX8if4EOfu/ANz+kd3IKxeenQSVGuDdt5ArUVRXowlvIs2oNOyeFT3ejpRT/ucc7IZDH/Qaa35wWxCkOyGWEENQag9aOfcYJ/+Keyn/TPJoL/VLPeFi4w== 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=2d0zlUHuPGVdtqU2Zxo5Ydvr8hkysX87Lzm7MZgBpwE=; b=YeCTwQp3olGEcJtgzoRwU2Q9eYUdkqd9ahcMkVYoNqH20iuFBFb3ctA80tNoKI2SF4+YoXysi21VFfFi4X2o0fwJmQdZwm8wI9xXmzr8eyCu5HpTjG1gr/KS1ryVrBQ93OrAL+y67LTcUHEUzHzMfZCdr5jsrCs3KFG4FsntVtLvriHUTfr+mNfmgOkIYE+ZRmd5oRwfleIA8jxPwzZv1HySCEy0u90OHzi6x6r84ewQ4ulwiXA6qn0OsI5EIvYSaWb4PUm2jXNgNa1X3sNwiy5jpGlq4oVowytP/UhsCY/QgLALlt+LTibk6/AlsUBTwTPq/6V5mos8YlmxBIGyuw== 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=2d0zlUHuPGVdtqU2Zxo5Ydvr8hkysX87Lzm7MZgBpwE=; b=GIQPPv+IoohPF5PVyWHV8YnIOtdHsMpzbP7sneM/6n0t2gU2ANA+H4QVKzcsFNcOPIW8jM5P1EnMGGkg/Epgth6l03fXaDiKC4neO6HKMNf589CHR1vipPaD2Sqk/bKVyzcWntQmu8lCJAwyp5kaAMbdBGwese4+uP1C+PbBh6o= 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: , Subject: [PATCH v6 02/11] xen: introduce CDF_directmap Date: Mon, 14 Feb 2022 03:19:47 +0000 Message-ID: <20220214031956.3726764-3-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 7c63ec18-bcc2-488a-3a00-08d9ef690af3 X-MS-TrafficTypeDiagnostic: AM6PR08MB4834:EE_|DB5EUR03FT006:EE_|VI1PR0801MB2015:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:213;OLM:213; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: p3bzuHgkvDc1pwwpyCUAydWwVYR+bobpg7XCrCpxjVrHtjTFIhaA8rI4lwpJHgToCDYv+7B/CAVxpLYae8uszExuvK7H/UhD+9XHXqy2TqT+6JMMheCMoUGWVPFLXLptWdhY7dOlCE5WsS+YXd1HNrKIXfWCvkkH4bCuZqBJDO1C2yggH/FzmMRsn0atMpbLozGfkWQHdxkZCR8GCM1dtgprgPxRlrr6cW2Z6sWyC2b55p18Icvxykfh2whzTU36wTlrh2uLPBPbmzEBCXonSVctUNj9QiAeI5yE8YE3c0uPXorgjQLcRF0B/vXW7WF//dopxFuDrcdgmFihyklewQ0dRI5xjVKTHkQj3MsGHc/6h/NO8spyWAHy9xGnxf8ciDlREInzXnx7jcT81CXhNyaS8A+xAb8LS/ozcWVskEn+6AliJ9A++6YOfWsqnaHX0mFbsU8e9729BXK/7QBATr14pLBjraL00t3w6zWGz3Om7k3UGIpCHwK36cvixImVzmARLlJ/RivQeNK7jIkSjJWDNxnR0qXpSbRRCKeX4Wj/k4EN2sRaMNjK2Jil+yHCABntLPT2quBAQ77z4oqbQMk3fxGF6/4Bw/I9/jGf1l9767mYXFtpCaAzX6e3scwqxYMW06vi2ClW2D+Z8bt/ZtTQ9s394VZDfkEDjuwFNU6mzFhU9tVB3BN5EvHR8lL1lrdqDBAnxpnQ4MBPbgM/TLEmIKp+8qlZUjTKiLZpmCo= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(86362001)(26005)(7696005)(186003)(44832011)(36860700001)(508600001)(336012)(426003)(6666004)(2616005)(36756003)(83380400001)(1076003)(47076005)(82310400004)(356005)(8676002)(81166007)(316002)(54906003)(110136005)(70586007)(70206006)(4326008)(2906002)(8936002)(5660300002)(40460700003)(21314003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4834 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b8e73cd8-c584-4be0-41a5-08d9ef690568 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SpDAuX+OUEqdbZcTcSxXLcGF9ML5ITITA48pBInlhM4aqO/KAVkOpM3BHCUw2u6TlzxcmLzTeoMK6izIVRUz4GDOlTmDt/QXm62ogBtYly2T05qxjaILjIyRASEux211gg/0Zw6Yq3cD0EqmLih1+rgEsx5ZBB7qyxb4rKvtYtBKm43thhc+txKuegzS8YCeSVqTEQbwNBd+KOKZPmgTjorNlshY9A4bfL/tREiS7RDKulZLsCyCfaZ57iwlJ9oetxOZgHCJNL7qVVzzxEIBsQDCCs60ZZMr1e9DBZfFTXTRECXE+0x8IKbUpCbtqM2d/G5AVJ4AwjQ321uLjfbtT6E/sIxlnqq24DRnztK6SNUGGSk/E8CPPEjUppPbnXkNZLuclguiZN38MX84na140hefxNNNoTRsE2kvO2mFk2sp+JGTZ1HJ6mfiMS7y0rXIDTrYOvvlGMHFCUb75AjyDo3SrNAusg2c4AyW1gtLcofFQta437pvpONlAzyvPq+IHD+raNaIwkKOFuSEQZt/RJuubCv2X0Jo5mEDGVVISmTcyHPVMBT/yX4mm7EDyscPkQneuFzKy19SkUEYkkZtke/xsTzlsdZjp+JQRS/Zir7WAl3RiYeCq8cmac3wu9f9IXIu9bqIiorFcQZ2MvEoHA1aOYXPvJN5Mnh+NixaVek= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(86362001)(70586007)(110136005)(54906003)(36756003)(4326008)(70206006)(316002)(8676002)(508600001)(5660300002)(81166007)(6666004)(8936002)(186003)(26005)(83380400001)(7696005)(36860700001)(44832011)(2906002)(47076005)(82310400004)(426003)(1076003)(2616005)(336012)(21314003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:08.3796 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c63ec18-bcc2-488a-3a00-08d9ef690af3 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: DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2015 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808912246100005 From: Stefano Stabellini This commit introduces a new arm-specific flag CDF_directmap to specify that a domain should have its memory direct-map(guest physical address =3D=3D host physical address) at domain creation. Also, add a directmap flag under struct arch_domain and use it to reimplement is_domain_direct_mapped. For now, direct-map is only available when statically allocated memory is used for the domain, that is, "xen,static-mem" must be also defined in the domain configuration. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng Acked-by: Jan Beulich Tested-by: Stefano Stabellini Acked-by: Julien Grall --- CC: andrew.cooper3@citrix.com CC: jbeulich@suse.com CC: George Dunlap CC: Ian Jackson CC: Wei Liu CC: "Roger Pau Monn=C3=A9" --- v2 changes - remove the introduce of internal flag - remove flag direct_map since we already store this flag in d->options - Refine is_domain_direct_mapped to check whether the flag XEN_DOMCTL_CDF_directmap is set - reword "1:1 direct-map" to just "direct-map" --- v3 changes - move flag back to xen/include/xen/domain.h, to let it be only available f= or domain created by XEN. - name it with extra "INTERNAL" and add comments to warn developers not to accidently use its bitfield when introducing new XEN_DOMCTL_CDF_xxx flag. - reject this flag in x86'es arch_sanitise_domain_config() --- v4 changes - introduce new internal flag CDF_directmap - add a directmap flag under struct arch_domain and use it to reimplement is_domain_direct_mapped. - expand arch_domain_create to include internal-only parameter "const unsig= ned int flags" --- v5 changes - remove const constraint --- v6 changes - comment and coding style fix - protect CDF_directmap with #ifdef CONFIG_ARM --- docs/misc/arm/device-tree/booting.txt | 6 ++++++ xen/arch/arm/domain.c | 5 ++++- xen/arch/arm/domain_build.c | 14 ++++++++++++-- xen/arch/arm/include/asm/domain.h | 5 +++-- xen/arch/x86/domain.c | 3 ++- xen/common/domain.c | 2 +- xen/include/xen/domain.h | 7 ++++++- 7 files changed, 34 insertions(+), 8 deletions(-) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index 71895663a4..a94125394e 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -182,6 +182,12 @@ with the following properties: Both #address-cells and #size-cells need to be specified because both sub-nodes (described shortly) have reg properties. =20 +- direct-map + + Only available when statically allocated memory is used for the domain. + An empty property to request the memory of the domain to be + direct-map (guest physical address =3D=3D physical address). + Under the "xen,domain" compatible node, one or more sub-nodes are present for the DomU kernel and ramdisk. =20 diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 92a6c509e5..8110c1df86 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -692,7 +692,8 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) } =20 int arch_domain_create(struct domain *d, - struct xen_domctl_createdomain *config) + struct xen_domctl_createdomain *config, + unsigned int flags) { int rc, count =3D 0; =20 @@ -708,6 +709,8 @@ int arch_domain_create(struct domain *d, ioreq_domain_init(d); #endif =20 + d->arch.directmap =3D flags & CDF_directmap; + /* p2m_init relies on some value initialized by the IOMMU subsystem */ if ( (rc =3D iommu_domain_init(d, config->iommu_opts)) !=3D 0 ) goto fail; diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 0fab8604de..6467e8ee32 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3029,10 +3029,20 @@ void __init create_domUs(void) .max_maptrack_frames =3D -1, .grant_opts =3D XEN_DOMCTL_GRANT_version(opt_gnttab_max_versio= n), }; + unsigned int flags =3D 0U; =20 if ( !dt_device_is_compatible(node, "xen,domain") ) continue; =20 + if ( dt_property_read_bool(node, "direct-map") ) + { + if ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !dt_find_property(no= de, "xen,static-mem", NULL) ) + panic("direct-map is not valid for domain %s without stati= c allocation.\n", + dt_node_name(node)); + + flags |=3D CDF_directmap; + } + if ( !dt_property_read_u32(node, "cpus", &d_cfg.max_vcpus) ) panic("Missing property 'cpus' for domain %s\n", dt_node_name(node)); @@ -3058,7 +3068,7 @@ void __init create_domUs(void) * very important to use the pre-increment operator to call * domain_create() with a domid > 0. (domid =3D=3D 0 is reserved f= or Dom0) */ - d =3D domain_create(++max_init_domid, &d_cfg, 0); + d =3D domain_create(++max_init_domid, &d_cfg, flags); if ( IS_ERR(d) ) panic("Error creating domain %s\n", dt_node_name(node)); =20 @@ -3160,7 +3170,7 @@ void __init create_dom0(void) if ( iommu_enabled ) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 - dom0 =3D domain_create(0, &dom0_cfg, CDF_privileged); + dom0 =3D domain_create(0, &dom0_cfg, CDF_privileged | CDF_directmap); if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) =3D=3D NULL) ) panic("Error creating domain 0\n"); =20 diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/d= omain.h index 9b3647587a..aabe942cde 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -29,8 +29,7 @@ enum domain_type { #define is_64bit_domain(d) (0) #endif =20 -/* The hardware domain has always its memory direct mapped. */ -#define is_domain_direct_mapped(d) is_hardware_domain(d) +#define is_domain_direct_mapped(d) (d)->arch.directmap =20 struct vtimer { struct vcpu *v; @@ -89,6 +88,8 @@ struct arch_domain #ifdef CONFIG_TEE void *tee; #endif + + bool directmap; } __cacheline_aligned; =20 struct arch_vcpu diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index ef1812dc14..9835f90ea0 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -722,7 +722,8 @@ static bool emulation_flags_ok(const struct domain *d, = uint32_t emflags) } =20 int arch_domain_create(struct domain *d, - struct xen_domctl_createdomain *config) + struct xen_domctl_createdomain *config, + unsigned int flags) { bool paging_initialised =3D false; uint32_t emflags; diff --git a/xen/common/domain.c b/xen/common/domain.c index a79103e04a..3742322d22 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -659,7 +659,7 @@ struct domain *domain_create(domid_t domid, radix_tree_init(&d->pirq_tree); } =20 - if ( (err =3D arch_domain_create(d, config)) !=3D 0 ) + if ( (err =3D arch_domain_create(d, config, flags)) !=3D 0 ) goto fail; init_status |=3D INIT_arch; =20 diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index cfb0b47f13..24eb4cc7d3 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -31,6 +31,10 @@ void arch_get_domain_info(const struct domain *d, /* CDF_* constant. Internal flags for domain creation. */ /* Is this a privileged domain? */ #define CDF_privileged (1U << 0) +#ifdef CONFIG_ARM +/* Should domain memory be directly mapped? */ +#define CDF_directmap (1U << 1) +#endif =20 /* * Arch-specifics. @@ -65,7 +69,8 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsi= gned offset); void unmap_vcpu_info(struct vcpu *v); =20 int arch_domain_create(struct domain *d, - struct xen_domctl_createdomain *config); + struct xen_domctl_createdomain *config, + unsigned int flags); =20 void arch_domain_destroy(struct domain *d); =20 --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808900; cv=pass; d=zohomail.com; s=zohoarc; b=A2p5OVT82lYdkpvlrn8fTCvMqswbywflDAiEX5wE3W8N3/aMzc03bGuKJC+yYPuNoYTWxD6vYS9Hw5WkR6CYxo8ENsMRRnEykYFt02y1/MQGr190TdTIS9fJgV/KEKvon7diTbWHKUU4tRA+6qCR6SXjKwPznRCEl1ebfCUwKJw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808900; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oRbPxrfxtUguB6iv9k6N/YrNB/mDdmcGGUpf5LaQEEM=; b=FZRgFjnm9RaFBm8P8ybO9ovDwu3w7K18+i4+S4h2/ub2abTwYppWUm/fhgDXatp3F3m+TFzpgNli0XuXZhlu0iv4dCSwJPjnioSszCcCuEwAUTEEYzM3BCdnWTsmpdn+iVlUl4iivUA3NwzpEiHvW/Km7K7hetIp1KOupARuZHM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808900291489.5548782485805; Sun, 13 Feb 2022 19:21:40 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271069.465399 (Exim 4.92) (envelope-from ) id 1nJRvP-0007E8-AJ; Mon, 14 Feb 2022 03:21:15 +0000 Received: by outflank-mailman (output) from mailman id 271069.465399; Mon, 14 Feb 2022 03:21:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvP-0007DO-3h; Mon, 14 Feb 2022 03:21:15 +0000 Received: by outflank-mailman (input) for mailman id 271069; Mon, 14 Feb 2022 03:21:13 +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 1nJRvN-0007B5-KL for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:13 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on060f.outbound.protection.outlook.com [2a01:111:f400:fe0c::60f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2877ef72-8d45-11ec-b215-9bbe72dcb22c; Mon, 14 Feb 2022 04:21:12 +0100 (CET) Received: from AS9PR06CA0170.eurprd06.prod.outlook.com (2603:10a6:20b:45c::30) by AM5PR0801MB1922.eurprd08.prod.outlook.com (2603:10a6:203:4b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:21:08 +0000 Received: from VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45c:cafe::5) by AS9PR06CA0170.outlook.office365.com (2603:10a6:20b:45c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.12 via Frontend Transport; Mon, 14 Feb 2022 03:21:08 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT058.mail.protection.outlook.com (10.152.19.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:08 +0000 Received: ("Tessian outbound 2877e54fe176:v113"); Mon, 14 Feb 2022 03:21:08 +0000 Received: from 14b0bff7f3e5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7EF27C02-6C50-451F-977D-8ACBA3309D22.1; Mon, 14 Feb 2022 03:21:01 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 14b0bff7f3e5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:01 +0000 Received: from AM6PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:20b:b2::26) by AM5PR0801MB1617.eurprd08.prod.outlook.com (2603:10a6:203:39::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:21:00 +0000 Received: from AM5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:b2:cafe::99) by AM6PR08CA0014.outlook.office365.com (2603:10a6:20b:b2::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:00 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT018.mail.protection.outlook.com (10.152.16.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:00 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:03 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 2877ef72-8d45-11ec-b215-9bbe72dcb22c 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=oRbPxrfxtUguB6iv9k6N/YrNB/mDdmcGGUpf5LaQEEM=; b=l7JVg8X8abnzkPvGmomkMftevNR2bTX6whbXQVw0jRvKt5ASev6kniqONP+B/JdEsyMoE5KPUlGkth99to24XgFr+HMe4pILFaspHUBl9ZoKlE8Kza02xVBFsD8rSrqwaQgZ9fL7KHRPh4Ilcj24yp60v9DE82EI8o1grc/2Xck= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 0aa005b79a539185 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qn7t9wL/8zslFhuNOCp+J8soot3UWDQ3Koi6/Ht1ctiI/tetglwQ9acSck/+wJK2D9ff6LEafTCWqcIsXPuCi/x59cJSuOqkMnOip3qbgVqICyIn/CFgQAL4GMZBXrJA5nSgu1kYdbj+QB3ieuLQKQNEq8p+f3ZHsiMRDoyiJuadeiweyOcUL1rVDjgTCcm3PS6VOkPN14JqvqjpAKjhZxubS0u4e1YeJC45mtjoVFCnGpraLWSquVERM5kIhDftNa7vUG5yRzvt39Ah2v87I8ovXdQs/YmfcSwejIKCK6pnvRdfTuWAEdog2u2oqY3/ctU6/ZTZmL8m5TeKM6lC4g== 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=oRbPxrfxtUguB6iv9k6N/YrNB/mDdmcGGUpf5LaQEEM=; b=XSJMtEzIpVWbVItoH67FfefwmcRj3Jmd/2XecuMbxWfaJFmKkXzpz09/B9LPE/M7ye5BIKfKO1j0LNyg7boKeJ0ZeVibf2ITNpEuw4qDBzMGAzHTByV50mDUd95SsFkaGXVOGL99LPKeaXR8EjOCU0PAjClmUIEtzQf42SgDYDpmHnf59NSP5/xrjxpvUWNOvSk0nNb6XgPZmY5LMUgY/2NvlvzOegOnqFS+7QRR7X7c5i5pIzLkCy1zYNrK0XV3tcMAGNyErBt03K6xWnfalwpPB646uXqctnMpOM16o3Z027msAVQQeV6zFmYVU1Q3w4DZ6aydGwmgT9kWSrXJIg== 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=oRbPxrfxtUguB6iv9k6N/YrNB/mDdmcGGUpf5LaQEEM=; b=l7JVg8X8abnzkPvGmomkMftevNR2bTX6whbXQVw0jRvKt5ASev6kniqONP+B/JdEsyMoE5KPUlGkth99to24XgFr+HMe4pILFaspHUBl9ZoKlE8Kza02xVBFsD8rSrqwaQgZ9fL7KHRPh4Ilcj24yp60v9DE82EI8o1grc/2Xck= 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: , Subject: [PATCH v6 03/11] xen/arm: Allow device-passthrough even the IOMMU is off Date: Mon, 14 Feb 2022 03:19:48 +0000 Message-ID: <20220214031956.3726764-4-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: f5050ff9-08df-4a93-8e63-08d9ef690afb X-MS-TrafficTypeDiagnostic: AM5PR0801MB1617:EE_|VE1EUR03FT058:EE_|AM5PR0801MB1922:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ephZ2oyUDcH98HjX9CcnN3bu0CdjZtw1BtLTurq8DI6iT2zBzilFMpZpdrhcQ+ay7YVtAGJYzyIhK4ZLpr0oFVPROXligPXfkzHrK8+xmSzqrJE+GHKeYQsaAsTpz0Stnull4wpvet0wM6pdGAnsR+IMW3JDBZyfUZhn+SCC9MXr0VxA5wb3j8/F6SvhecSKxSILGks9Mjer5XAvO679ZPok4A0Gn3yJ2iA81/lViO7ShRAj/aCAI/XXbS04R30YzI/5B6+yS8EQ7JXd6xd3OTTnYgLPMwDKGEHZvwOr5yMgKkFPI7zcMaE5NaiWSWrq+gZuw2FZb3bXXKXlIGPp30sjOzMpKb1651iJowJsmxJ72b4S58LSEVHLFi5yh1e0OhJkFRx8QcZ/4Yasau+4jvSU5SF56bE3PJIpjd3ncHf0ym92qzWXHOEyegV01xPoJMsldu/lTCfUpDUNd/W+5+SMzwYMoLEGeDulqb9VXzYE1XWsq56EYu/9amP6U71TsWJ3es2C9gyo6UXbiABCbG3BBYDbfnAXXReA5KXVvwSPn1eYwE7+5Re4ywBtiiUVsIqYTZAMX2Y1E5Nq04bxc9m7Xno07kOHj2vpLpHssv7w0TlsggKuDw0u+tr0VM1tImcPNVH+EEhyycIgXmLku1lo1G6Z/P071gLLdRImV4SUXCbVW7F1P5L9P0Azwqzl9Wwqtu9tfdGsSfS29171pg== 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)(316002)(81166007)(8936002)(54906003)(26005)(186003)(110136005)(70206006)(4326008)(8676002)(5660300002)(44832011)(82310400004)(2906002)(356005)(70586007)(86362001)(47076005)(2616005)(36860700001)(36756003)(508600001)(83380400001)(1076003)(40460700003)(336012)(426003)(7696005)(6666004)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1617 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 53cd6acd-612c-4cf5-aee3-08d9ef6905f9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +pBOsRCrhHTUW51ns4zGeurTLnkY4LiIVBo8mlf5Gb7iOMhsLiKQjCTOP3+Y909ekFIuEeC1veqVRfte+FZixoKjByEqJccjiOxKRlhIS9x/8uLOzUS9IiNn2HCWiZW3rgCNIQ4vMZSf85GF+sT/rn19ceCVkL6TSUw3UIbhdlC/z8FChpY0qPb2Xj4LaJCtZRmI7N7ynMIFLzT9fNK1NWiyUqwfVUp30V1ALSRWrw+FvXXGv6QkF9InVkJEWWFxSbvQSsM3JHcOrC1XPgkOT3lKR2+fNcLSiNWTMV9MuY7S300djFwiMajCOnMdggZEQqBGaMj6y/Nlm2BReHQRPks7rYhf94VgsXDoO8Z+uFoNGtq1Qetp+dpVhHJfrPKgO9hg45kaetKGQCoCb0/JZBTZS3lH7vAvnjeGup8tVIjX3DvS3hTkkKLwVmhvJMTTsjKJry0rBBEH1cnXQeg1v/ppnYnGStsug6UqBrQ7FCiFifnR4oPXwCrY4qfRKkhnvtZcwXSgcK7n5Ds1pgOhWtGR3wJnpGGDmy+VO16FOQuu9ce5+rEwPnmbYE2XOJZk1x+ZkBuMS24CebxOm+0anZ8vMCanMATzW7POPVXYRTbDlbXDzPZLsfW9fO6vJJao5qUrRm8KoS3n36I38teheQ== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(2906002)(83380400001)(44832011)(508600001)(426003)(336012)(7696005)(5660300002)(47076005)(6666004)(81166007)(316002)(82310400004)(8936002)(8676002)(186003)(2616005)(4326008)(36860700001)(54906003)(26005)(36756003)(110136005)(70586007)(1076003)(86362001)(70206006);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:08.3404 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5050ff9-08df-4a93-8e63-08d9ef690afb 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: VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1922 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808902119100001 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini At the moment, we are only supporting device-passthrough when Xen has enabled the IOMMU. There are some use cases where it is not possible to use the IOMMU (e.g. doesn't exist, hardware limitation, performance) yet it would be OK to assign a device to trusted domain so long they are direct-mapped or the device doesn't do DMA. Note that when the IOMMU is disabled, it will be necessary to add xen,force-assign-without-iommu for every device that needs to be assigned. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng Tested-by: Stefano Stabellini Acked-by: Julien Grall --- v3 changes: - new commit, split from the original "[PATCH v2 2/6] xen/arm: introduce direct-map for domUs" --- v4 changes: - explain briefly in the commit message why we want to do device assignment without IOMMU. --- v5 changes: - nothing changed --- v6 changes - commit message refinement --- xen/arch/arm/domain_build.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 6467e8ee32..c1e8c99f64 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3047,7 +3047,8 @@ void __init create_domUs(void) panic("Missing property 'cpus' for domain %s\n", dt_node_name(node)); =20 - if ( dt_find_compatible_node(node, NULL, "multiboot,device-tree") ) + if ( dt_find_compatible_node(node, NULL, "multiboot,device-tree") = && + iommu_enabled ) d_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 if ( !dt_property_read_u32(node, "nr_spis", &d_cfg.arch.nr_spis) ) --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808901; cv=pass; d=zohomail.com; s=zohoarc; b=ND3EARb1PY508HQwzr3x68cJtT3K1kFRYLq6rb58nsZICuCIrkKXJla117msidLYRzC+UBySJRJ4m7mFXgPwOz9PHSRZtqPv6e5edNOTmZA7lzInmL2wA3Ub5D/ExZimuFqgKAvPUcMMn4RuRuZ7ZreRI6Eb3X9FouDjpqV+Q8M= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808901; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IsRjtoJi/dcXTUUD4SSPKSVxouxZVNwFWUBYcsUvmi8=; b=NTltfNNmh+gB/bTfUYJ1hlwUtZ3XMaL822F/UZvS+H+Nn+G0o9rE2N1Pthc9z22z8XbVpFhBRSCLg0PjbRcLzxNcay7zWNrG7gUFQfcPHjodsiVSMgJ3yqVnk6vkFKNayaaQYFoLyrWqIO6da38WnhAbNIzMmtREkV4uF+02HVc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 164480890159256.77254223874672; Sun, 13 Feb 2022 19:21:41 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271072.465438 (Exim 4.92) (envelope-from ) id 1nJRvS-0008EL-I4; Mon, 14 Feb 2022 03:21:18 +0000 Received: by outflank-mailman (output) from mailman id 271072.465438; Mon, 14 Feb 2022 03:21:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvS-0008EA-DD; Mon, 14 Feb 2022 03:21:18 +0000 Received: by outflank-mailman (input) for mailman id 271072; Mon, 14 Feb 2022 03:21:16 +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 1nJRvQ-0007B4-JH for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:16 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on062b.outbound.protection.outlook.com [2a01:111:f400:fe0c::62b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2a8a1568-8d45-11ec-8eb8-a37418f5ba1a; Mon, 14 Feb 2022 04:21:15 +0100 (CET) Received: from AS8P189CA0023.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:31f::31) by VI1PR08MB3647.eurprd08.prod.outlook.com (2603:10a6:803:85::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.17; Mon, 14 Feb 2022 03:21:11 +0000 Received: from VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:31f:cafe::eb) by AS8P189CA0023.outlook.office365.com (2603:10a6:20b:31f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15 via Frontend Transport; Mon, 14 Feb 2022 03:21:11 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT011.mail.protection.outlook.com (10.152.18.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:10 +0000 Received: ("Tessian outbound 741ca6c82739:v113"); Mon, 14 Feb 2022 03:21:10 +0000 Received: from 30609cc8816b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EC72F650-BF67-4D34-838E-9C43BA604C61.1; Mon, 14 Feb 2022 03:21:03 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 30609cc8816b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:03 +0000 Received: from AS9P194CA0027.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:46d::22) by PR3PR08MB5818.eurprd08.prod.outlook.com (2603:10a6:102:8b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:21:02 +0000 Received: from AM5EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46d:cafe::49) by AS9P194CA0027.outlook.office365.com (2603:10a6:20b:46d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15 via Frontend Transport; Mon, 14 Feb 2022 03:21:02 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT049.mail.protection.outlook.com (10.152.17.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:02 +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.20; Mon, 14 Feb 2022 03:21:06 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:00 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 2a8a1568-8d45-11ec-8eb8-a37418f5ba1a 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=IsRjtoJi/dcXTUUD4SSPKSVxouxZVNwFWUBYcsUvmi8=; b=fofnIoQZwPXgw63GyUq5/Z9SuEkZyR+t0eanuA+BQenlPMm+H0d9j5VxEVFHzktHCvvczjJ/AqTq1cQXKJeJKfQigp+ivdKdoIflsW1TwQBPKk6ZIoZrveg72txQlaTgjG0B+gFR7FicHN/lY9F3dv8MLdLdmEgtOp1mYW7L3H0= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 69b00cd927348eea X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EaLeEkK0a/EteRqRe4DJaluPeRcYh57lMCZj9tJm+fKJ/LM7Bxzs1bTAO0iIcyZrew759ZN1WiUKadDgYPwcHemCgPgfxFvB3XIIeK8YKDS4yAO1kmYvtevTuQHR6wQDZv4SjR7jhbCixvo4wqjHAURF9lcPxKdA+GdnqzMvnyvzkZ4SIWwe/m4K+oDD8MM378v8WFgq+xVxY3/78Qb36TLklGRezlWz6JcfqFTe9K4U+RS3PAYy1bpgXTmJURUSDwb5ujlDcjqTjYf5+Rc7kiQc8mhpsEoahibMwK2Bi/JAq1yvDjaSx8hoNn85IaXZvaBwwo5AuR+0emuW76IiCA== 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=IsRjtoJi/dcXTUUD4SSPKSVxouxZVNwFWUBYcsUvmi8=; b=VfZiKdxkgpR6wowdFIZtdDFqk3j64NyWb1KwlkSnfhVwD3RNcGnvOGOknhWxxmkoQMq9C8wQpM8ZuT9KhMpxcm0V2jItGCfXVKxGmNXRtCHxugcujXGt7UK9su0EzNUABrxCUaGAtKQgWWw07jhjdJOJHooPIibvh8pLI/0cgcFsvzo2l3/wcon4cup7V3TgD2Ih3Rxgs4+zHWLXQVo/UcJQFzINGjZqZQHk8PC4cA2/07vC7/uyaZkxabjzDia+Cz6euzjwxWs9IReXKA0aNpiM2g6T/gonJIcl8veaIr/y2LNQvSKi12R4zGC1G+Aj0GC8r4c/J0seepz3YMXJHA== 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=IsRjtoJi/dcXTUUD4SSPKSVxouxZVNwFWUBYcsUvmi8=; b=fofnIoQZwPXgw63GyUq5/Z9SuEkZyR+t0eanuA+BQenlPMm+H0d9j5VxEVFHzktHCvvczjJ/AqTq1cQXKJeJKfQigp+ivdKdoIflsW1TwQBPKk6ZIoZrveg72txQlaTgjG0B+gFR7FicHN/lY9F3dv8MLdLdmEgtOp1mYW7L3H0= 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: , Subject: [PATCH v6 04/11] xen/arm: introduce new helper parse_static_mem_prop and acquire_static_memory_bank Date: Mon, 14 Feb 2022 03:19:49 +0000 Message-ID: <20220214031956.3726764-5-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 35907ce1-104b-4a40-ebb3-08d9ef690c39 X-MS-TrafficTypeDiagnostic: PR3PR08MB5818:EE_|VE1EUR03FT011:EE_|VI1PR08MB3647:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:281;OLM:281; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GD4RcxewPWLK6t3R5KHoKfXnSXNK6oNPvUFLMNkUkt64zcoQddi1VDMe2o4Wfe6ErKDLK59BJeij7HD/In7R4/U/MoLFfr+DzjRzW3u42j6QScuWut7+8zXW5myfEIWWaleqY4cPcUKzIEiZyu5/Kp+gTp49fV9x77Jnb4dN2dr93Y1RIAn/akCuETmHFb8nPJ0YK2DQ+jAbQVEhFOgURtThFZWQUzPPP5tTFGTpjpe4t3RC6BQskqiDIGXBuS2DpNRwb9R3cXjsRl89Q/TnEc360fkLhVofxKzxcNC8czS3eBo1s2CKjdNGeXW0q3xHHp25xAKks0/Zu5Ri3nxbL8+7LwFBsRMASvidJuM/GubiRTGUMJpQPIcw/4+Xt3LuiGiLM8jK5rSSReDFJlmI65cge+8gctG3zepaIbqiMJTHX8uPtlYpsG6W40wBvaUYsswTpYQoeM51XFR10jWmwGwytupGWLxGakn6Qi3vBVF0iUKmNWzrIcP7/1zEU/uSSz8pdbiBjl0bqB9Adr9u7cq1NFUWYaxXF/k0yASahELeq32gJyIVWA/+ndIcDIoPMkbUYmWMyUAbVr331rIf/BJAQDPRd0KJxtISj51TdwZhL0F5RErcpzErK47DPVld2F6NiiYbB+Lux35jyZXRnIWKjFy0YX91a/HY38C0qTQSwgXMK4mIt7htqqKl7Gbpt2600Dew8h63dX9jqW8JDQ== 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)(336012)(426003)(36756003)(82310400004)(44832011)(1076003)(186003)(26005)(2906002)(2616005)(47076005)(36860700001)(83380400001)(356005)(81166007)(70586007)(70206006)(4326008)(8676002)(8936002)(6666004)(7696005)(316002)(86362001)(508600001)(40460700003)(54906003)(110136005)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5818 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9cc47751-86f4-4140-07d5-08d9ef690730 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MVjfpaaaROgCi2fsfysjOPTc7k/RPswQ8TrtpDrdps5V/oQkKi8Ftm5K5B7T82Gw0YwqDJVCdlPtsDe1TVL0sYQF0PaW6opAgi8scmpHjZYGFfjD9Ma1Vpx52yD7qCRM7HLlk94Oik45jNBVTzoHhILqL7EG+I1NQFo0xDtvYwdX89zKkwL03rI2RduBm3UoJQpYmKE3zIiHzOfDC4LcB91RiJg/XVCMU3GBB2yfreN/dN6jKcoiKVJ31kPw09MLPC1tiidcZD1MACvg58ZbBgVUnlNKOOVe7F8Pkn5FYpFdcXMcg/eRgKWke2cDfefgh6XLLYPE9uboKU1doJjE5eO2VO/wXlb4dZO/JTCB7Ws8KfLZHjiEG5Jf0+8eVOkvc2QORP8HzLK8Fbh5wk3c4Xt05ElSV+IppFqqyKWdi9UVCZUrW0Y8jzpGMfq8HpfHgLaj8ZJEtTI7jcdxRSo37kjpJYn0RNBYh7VO3h19SBcJdPe44s5eEyhNCJ205dgsdlCCVBTVa58b/NlGeFkPYR8F9NCK7pNUuDTgHsoXHTmPN2X6rwpnKCjJjO8z0mWIndyeTE2fd2ScLpcW6OJYE5T397fuC3e//8Z02YYQjkGTIwRX7K6bdXz3+LIpIgBKj50MVxGKR5vUh9ljaQPRNg== 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)(4326008)(70586007)(70206006)(36756003)(5660300002)(8676002)(86362001)(8936002)(47076005)(82310400004)(83380400001)(81166007)(7696005)(54906003)(110136005)(2616005)(44832011)(316002)(2906002)(6666004)(26005)(186003)(1076003)(426003)(508600001)(36860700001)(336012);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:10.4269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35907ce1-104b-4a40-ebb3-08d9ef690c39 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: VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3647 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808903756100006 Content-Type: text/plain; charset="utf-8" Later, we will introduce assign_static_memory_11 for allocating static memory for direct-map domains, and it will share a lot common codes with the existing allocate_static_memory. In order not to bring a lot of duplicate codes, and also to make the whole code more readable, this commit extracts common codes into two new helpers parse_static_mem_prop and acquire_static_memory_bank. Signed-off-by: Penny Zheng Reviewed-by: Stefano Stabellini Tested-by: Stefano Stabellini --- v3 changes: - new commit, split from the original "[PATCH v2 2/6] xen/arm: introduce direct-map for domUs" --- v4 changes - explain briefly in the commit message why we want to do device assignment without IOMMU. --- v5 changes - fix coding style --- v6 changes - no changes --- xen/arch/arm/domain_build.c | 100 +++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 36 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index c1e8c99f64..e61d2d53ba 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -509,12 +509,69 @@ static bool __init append_static_memory_to_bank(struc= t domain *d, return true; } =20 +static mfn_t __init acquire_static_memory_bank(struct domain *d, + const __be32 **cell, + u32 addr_cells, u32 size_ce= lls, + paddr_t *pbase, paddr_t *ps= ize) +{ + mfn_t smfn; + int res; + + device_tree_get_reg(cell, addr_cells, size_cells, pbase, psize); + ASSERT(IS_ALIGNED(*pbase, PAGE_SIZE) && IS_ALIGNED(*psize, PAGE_SIZE)); + if ( PFN_DOWN(*psize) > UINT_MAX ) + { + printk(XENLOG_ERR "%pd: static memory size too large: %#"PRIpaddr, + d, *psize); + return INVALID_MFN; + } + + smfn =3D maddr_to_mfn(*pbase); + res =3D acquire_domstatic_pages(d, smfn, PFN_DOWN(*psize), 0); + if ( res ) + { + printk(XENLOG_ERR + "%pd: failed to acquire static memory: %d.\n", d, res); + return INVALID_MFN; + } + + return smfn; +} + +static int __init parse_static_mem_prop(const struct dt_device_node *node, + u32 *addr_cells, u32 *size_cells, + int *length, const __be32 **cell) +{ + const struct dt_property *prop; + + prop =3D dt_find_property(node, "xen,static-mem", NULL); + if ( !dt_property_read_u32(node, "#xen,static-mem-address-cells", + addr_cells) ) + { + printk(XENLOG_ERR + "failed to read \"#xen,static-mem-address-cells\".\n"); + return -EINVAL; + } + + if ( !dt_property_read_u32(node, "#xen,static-mem-size-cells", + size_cells) ) + { + printk(XENLOG_ERR + "failed to read \"#xen,static-mem-size-cells\".\n"); + return -EINVAL; + } + + *cell =3D (const __be32 *)prop->value; + *length =3D prop->length; + + return 0; +} + /* Allocate memory from static memory as RAM for one specific domain d. */ static void __init allocate_static_memory(struct domain *d, struct kernel_info *kinfo, const struct dt_device_node *nod= e) { - const struct dt_property *prop; u32 addr_cells, size_cells, reg_cells; unsigned int nr_banks, gbank, bank =3D 0; const uint64_t rambase[] =3D GUEST_RAM_BANK_BASES; @@ -523,24 +580,10 @@ static void __init allocate_static_memory(struct doma= in *d, u64 tot_size =3D 0; paddr_t pbase, psize, gsize; mfn_t smfn; - int res; - - prop =3D dt_find_property(node, "xen,static-mem", NULL); - if ( !dt_property_read_u32(node, "#xen,static-mem-address-cells", - &addr_cells) ) - { - printk(XENLOG_ERR - "%pd: failed to read \"#xen,static-mem-address-cells\".\n",= d); - goto fail; - } + int length; =20 - if ( !dt_property_read_u32(node, "#xen,static-mem-size-cells", - &size_cells) ) - { - printk(XENLOG_ERR - "%pd: failed to read \"#xen,static-mem-size-cells\".\n", d); + if ( parse_static_mem_prop(node, &addr_cells, &size_cells, &length, &c= ell) ) goto fail; - } reg_cells =3D addr_cells + size_cells; =20 /* @@ -551,29 +594,14 @@ static void __init allocate_static_memory(struct doma= in *d, gbank =3D 0; gsize =3D ramsize[gbank]; kinfo->mem.bank[gbank].start =3D rambase[gbank]; - - cell =3D (const __be32 *)prop->value; - nr_banks =3D (prop->length) / (reg_cells * sizeof (u32)); + nr_banks =3D length / (reg_cells * sizeof (u32)); =20 for ( ; bank < nr_banks; bank++ ) { - device_tree_get_reg(&cell, addr_cells, size_cells, &pbase, &psize); - ASSERT(IS_ALIGNED(pbase, PAGE_SIZE) && IS_ALIGNED(psize, PAGE_SIZE= )); - - if ( PFN_DOWN(psize) > UINT_MAX ) - { - printk(XENLOG_ERR "%pd: static memory size too large: %#"PRIpa= ddr, - d, psize); + smfn =3D acquire_static_memory_bank(d, &cell, addr_cells, size_cel= ls, + &pbase, &psize); + if ( mfn_eq(smfn, INVALID_MFN) ) goto fail; - } - smfn =3D maddr_to_mfn(pbase); - res =3D acquire_domstatic_pages(d, smfn, PFN_DOWN(psize), 0); - if ( res ) - { - printk(XENLOG_ERR - "%pd: failed to acquire static memory: %d.\n", d, res); - goto fail; - } =20 printk(XENLOG_INFO "%pd: STATIC BANK[%u] %#"PRIpaddr"-%#"PRIpaddr"= \n", d, bank, pbase, pbase + psize); --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808907; cv=pass; d=zohomail.com; s=zohoarc; b=hlRi/7/S173H9bzMprEQGI03heRa05VL4IYitl4hC8UtaOPmP17nxMdPJtl2i6JA/POKC87uJnvhgzxWi4OpI5E1CIoUFuc7nOR/zMRmOMjs2eEHcGH8eEFdTLQRo8Cje/ri73TSc0b1iY6BMxgTITz/F8sJjTg30RfeQUHU1yg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808907; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Rwq3BQ8hJu/bwkftJjd/wj3OUNX0PEAg7LDBt9R1U8E=; b=h1YoIlgH8hnpVcVbg9uLJ4ZcreOSq2TdibFfKcsxYyoYux3KUW7RjYCE2vz3woHCit4kkPax2s0VSyVtbtumU7Aa9zrPyWCW6i8iMBkyDL9CZSKLRjmDpNJ5NhRVJLF7obWGfsl7ZwRHQ7NfhwcjCB/tBO8pLL2si062MvbenQ8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808907065561.2539675674668; Sun, 13 Feb 2022 19:21:47 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271073.465448 (Exim 4.92) (envelope-from ) id 1nJRvY-0000IK-VR; Mon, 14 Feb 2022 03:21:24 +0000 Received: by outflank-mailman (output) from mailman id 271073.465448; Mon, 14 Feb 2022 03:21: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 1nJRvY-0000Hs-Qu; Mon, 14 Feb 2022 03:21:24 +0000 Received: by outflank-mailman (input) for mailman id 271073; Mon, 14 Feb 2022 03:21:24 +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 1nJRvY-0007B5-0S for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:24 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on0605.outbound.protection.outlook.com [2a01:111:f400:fe05::605]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2f003a5b-8d45-11ec-b215-9bbe72dcb22c; Mon, 14 Feb 2022 04:21:22 +0100 (CET) Received: from AM7PR04CA0001.eurprd04.prod.outlook.com (2603:10a6:20b:110::11) by AM6PR08MB2966.eurprd08.prod.outlook.com (2603:10a6:209:4e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18; Mon, 14 Feb 2022 03:21:20 +0000 Received: from AM5EUR03FT016.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::e7) by AM7PR04CA0001.outlook.office365.com (2603:10a6:20b:110::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18 via Frontend Transport; Mon, 14 Feb 2022 03:21:20 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT016.mail.protection.outlook.com (10.152.16.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:20 +0000 Received: ("Tessian outbound 741ca6c82739:v113"); Mon, 14 Feb 2022 03:21:20 +0000 Received: from 8473bcff6336.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 59C6AD33-613C-4FFC-A6BC-0D6A6DC6FF14.1; Mon, 14 Feb 2022 03:21:14 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8473bcff6336.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:14 +0000 Received: from AM6PR08CA0001.eurprd08.prod.outlook.com (2603:10a6:20b:b2::13) by DBAPR08MB5701.eurprd08.prod.outlook.com (2603:10a6:10:1a6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:21:04 +0000 Received: from AM5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:b2:cafe::8b) by AM6PR08CA0001.outlook.office365.com (2603:10a6:20b:b2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:04 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT018.mail.protection.outlook.com (10.152.16.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:03 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:08 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 2f003a5b-8d45-11ec-b215-9bbe72dcb22c 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=Rwq3BQ8hJu/bwkftJjd/wj3OUNX0PEAg7LDBt9R1U8E=; b=kl7UJ7H+T+M9GPV1l7QEe5Dpu0FdyVhw3aiV3/ype7jy7ncBY/1IAJ+RXEq0L5JiQusHDWJih819LwONK1H2r19JJKwdhooM24GTQzk90lStmMHb0h5Vk06WWLgvy4zokQhU88RJjAWklaAEb6ndHtxGE+LHvO10c5t3N9Nr6N8= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 09d991b60ae58833 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MsZWMXJxXJcKwcsEWKa6DckZwJLt0SrYSoQQeop5T3yGUTQEV0SLlJwouYjEBhfW0/coU1V3IzVeGM9m13OAHIQmVI0bxOajPEEYGnEjhwvmg/NLgi5UZEUD8djZLQFyzFTgeZqBgrvQcUcWZdOgofMcYLc/Y9xTjtLu/4CITlpabtQ4KzAG1+ZTiz6UzVCeqxSwiNBo1mHN4RyfaCz9/Viniz4IKYnKA/adVc8jFu5JTklxez9Ki9WxD9i/kBZIIjauxS6VLpGFXXozul0w62uqit/hFiCDEwByY68/Feb0bkabGHBc5TDZkqDKOzuISnIoIWXBSp1gbCaieBTFeA== 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=Rwq3BQ8hJu/bwkftJjd/wj3OUNX0PEAg7LDBt9R1U8E=; b=Viulyf05yy/wQGOAB4Vds5igfWUDMetwg8+X0cFADAZmI0rOwcFxy3d682TFTIrvB3oHJDkBZdnAmZ480Tw/1ZWkjiPiueNrE5gbdCoFF62uFlpxvgQ2PyIa1YqmngZ7xHc+xjBsu6zPxqdul0+IgBb5Yogultq0TcU1vL2CyWKsf4BhYul3vPjLBKMGPb4ikQQ5K4p5j6dV3QsMYQRp255ER0Zn+L1OuCAEMGFk1EHap6vjQmJmQOmjALSIj7mw/cJV1J4HNY0YntSkoXpZWlGDtwpIozjivav7edyjYI+i1b2khPBJZgR7A+tQDiPJS5vwLC2h2m4iAG20t0609Q== 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=Rwq3BQ8hJu/bwkftJjd/wj3OUNX0PEAg7LDBt9R1U8E=; b=kl7UJ7H+T+M9GPV1l7QEe5Dpu0FdyVhw3aiV3/ype7jy7ncBY/1IAJ+RXEq0L5JiQusHDWJih819LwONK1H2r19JJKwdhooM24GTQzk90lStmMHb0h5Vk06WWLgvy4zokQhU88RJjAWklaAEb6ndHtxGE+LHvO10c5t3N9Nr6N8= 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: , Subject: [PATCH v6 05/11] xen/arm: introduce direct-map for domUs Date: Mon, 14 Feb 2022 03:19:50 +0000 Message-ID: <20220214031956.3726764-6-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 0deb74f3-4d3c-4512-e5a7-08d9ef691246 X-MS-TrafficTypeDiagnostic: DBAPR08MB5701:EE_|AM5EUR03FT016:EE_|AM6PR08MB2966:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1332;OLM:1332; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: xxI8AOTSggpt3uZwj46T7btNz1EuphtQhrT2uKwQ9q2bWNrB4q437Y871rcPFgEx+v4HIEV9S3gYpJwUFjHVtBuQqdiqrJOyFx2f9031gcmNBc+59x4iBoTay+vMkSnCORkEBxdbtWWIhCJPnZmH5pW9O8ER4DCE/pWb15HRWOU0RNc3G7Fx6MOyBCgXqBjs/hyh3umM899NzJLVCjVqcROG3JLcK6YSw9VjTUZfmItzyE/qoPRZ2nelv17Gj0Uk4qDbfurPRi9lcCIVovaJOgoZmLPfRbLQTlvc1BD76gJCGmliyS2Gq4G3Bef3OfTeFgmdAs1n6N5jBLsGhTOe81oD8PGbNU1WcnkTZaCxWSI/1Sf2O7rihGcl475wYn2iV9134XQSAapdiCO1BgHrftEdyGGUcLY3qLP9ftiJsWwHI4510dm7lkCKfxToyMlcjw34/PYZl8KB959VSX8l71oEPrdIJLfpOu5LyMCTN0sdz9NgklC+LU/njRvHEBf3onPQs2Db0o4uLUb/UhrKke2U34VC9lO40WjDLeqr7MdQY/T4/tP2m5zbOjSLcY+vdxR3VpoGkgyZw6iBUDkhZl1sKxEAyGF9xfFwH+rePlOlNEw0yBMlj6SASrE3owa41qorH6gp98x7uIa7jmUnTMXLX3tCnoSpNYHnCFKnV7O6lBf6hF8yCMVUAtXXwaM44I/D7GKB8FHWA6hCfEdczQ== 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)(8676002)(508600001)(2906002)(7696005)(47076005)(6666004)(5660300002)(8936002)(44832011)(4326008)(70206006)(70586007)(81166007)(36860700001)(82310400004)(316002)(86362001)(1076003)(83380400001)(426003)(186003)(26005)(336012)(36756003)(110136005)(2616005)(54906003)(356005)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5701 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 07d3af5b-3362-4988-75fd-08d9ef690852 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gf42OWAQ4ClTJIYQGOmav9/7/wEBIF5Qy2LWNIec9ZjcXZjiNZYHrN47YMyF2PCQQBjsinicF2W95VKYpo6ZX16Nhb9RR7tiUBMcSzXwGTvwI6wRCVb/lGxn83Nlxy3IP7fIf+3PzmD61xEk7p+MsHcM4YZjtYpKJzvTnlOCkASx0LrRilvT/8OPImSnOQmH61o3QVrk47sPXmuLfLvcge7cQrTVMVTcW+RSHOYzb2gg15FH+I2RCxoqO5Ab2++dr4NSO7MZTGv82f44k1AGu2dnRg1/XJ0dO+w06Dn+VTzQ1NLWpVAwDJSP6Gv1VYzvib1YCSjnl1ErAKvwBe8e6xUDBCDIC09M1ev1cZFFtcd8/QW1v7p7u7eawvlkpoZWQ7PZ9UqSK4Ih9kBJjZ1TUcDDscBOMoBZ7H1G9N1yU7FPH/7/0QSSwwURpHW1G7//eS9DbjVH+QQ5nCLR3JBXFBz4GssYfrgg5gA0k/D5giPE/PXel4imaTDcIlAE2nNe2ysvm0UoiqgBXmjOqoRKPTuUpww8Y9OhEoPEPPyBVEnkvmEW5MVZkSVZM2G7ZtHMiy5s2QHOwPcPdq9ZayUt5yyIE2LI7itzren5FnOxXJJ2kLuKm/QUr2G3KQrNaCI5wZjVMUya8CjHjDhjjyBl6g== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(70586007)(70206006)(2906002)(86362001)(8676002)(4326008)(8936002)(82310400004)(44832011)(5660300002)(81166007)(186003)(26005)(426003)(336012)(2616005)(1076003)(83380400001)(6666004)(7696005)(36756003)(508600001)(36860700001)(47076005)(316002)(54906003)(110136005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:20.6347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0deb74f3-4d3c-4512-e5a7-08d9ef691246 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: AM5EUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB2966 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808907726100001 Content-Type: text/plain; charset="utf-8" Cases where domU needs direct-map memory map: * IOMMU not present in the system. * IOMMU disabled if it doesn't cover a specific device and all the guests are trusted. Thinking a mixed scenario, where a few devices with IOMMU and a few without, then guest DMA security still could not be totally guarantee= d. So users may want to disable the IOMMU, to at least gain some performance improvement from IOMMU disabled. * IOMMU disabled as a workaround when it doesn't have enough bandwidth. To be specific, in a few extreme situation, when multiple devices do DMA concurrently, these requests may exceed IOMMU's transmission capacity. * IOMMU disabled when it adds too much latency on DMA. For example, TLB may be missing in some IOMMU hardware, which may bring latency in DMA progress, so users may want to disable it in some realtime scenario. * Guest OS relies on the host memory layout This commit introduces a new helper assign_static_memory_11 to allocate static memory as guest RAM for direct-map domain. Signed-off-by: Penny Zheng Reviewed-by: Stefano Stabellini Tested-by: Stefano Stabellini --- v2 changes: - split the common codes into two helpers: parse_static_mem_prop and acquire_static_memory_bank to deduce complexity. - introduce a new helper allocate_static_memory_11 for allocating static memory for direct-map guests - remove redundant use "bool direct_map", to be replaced by d_cfg.flags & XEN_DOMCTL_CDF_directmap - remove panic action since it is fine to assign a non-DMA capable device w= hen IOMMU and direct-map both off --- v3 changes: - doc refinement - drop the pointless gbank - add check of the size of nr_banks shall not exceed NR_MEM_BANKS - add ASSERT_UNREACHABLE to catch any misuse - add another check of validating flag XEN_DOMCTL_CDF_INTERNAL_directmap on= ly when CONFIG_STATIC_MEMORY is set. --- v4 changes: - comment refinement - rename function allocate_static_memory_11() to assign_static_memory_11() to make clear there is actually no allocation done. Instead we are only mapping pre-defined host regions to pre-defined guest regions. - remove tot_size to directly substract psize from kinfo->unassigned_mem - check kinfo->unassigned_mem doesn't underflow or overflow - remove nested if/else - refine "panic" info --- v5 changes: - fix coding style --- v6 changes: - no changes --- xen/arch/arm/domain_build.c | 97 +++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index e61d2d53ba..ec29bd302c 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -494,8 +494,17 @@ static bool __init append_static_memory_to_bank(struct= domain *d, { int res; unsigned int nr_pages =3D PFN_DOWN(size); - /* Infer next GFN. */ - gfn_t sgfn =3D gaddr_to_gfn(bank->start + bank->size); + gfn_t sgfn; + + /* + * For direct-mapped domain, the GFN match the MFN. + * Otherwise, this is inferred on what has already been allocated + * in the bank. + */ + if ( !is_domain_direct_mapped(d) ) + sgfn =3D gaddr_to_gfn(bank->start + bank->size); + else + sgfn =3D gaddr_to_gfn(mfn_to_maddr(smfn)); =20 res =3D guest_physmap_add_pages(d, sgfn, smfn, nr_pages); if ( res ) @@ -668,12 +677,92 @@ static void __init allocate_static_memory(struct doma= in *d, fail: panic("Failed to allocate requested static memory for domain %pd.", d); } + +/* + * Allocate static memory as RAM for one specific domain d. + * The static memory will be directly mapped in the guest(Guest Physical + * Address =3D=3D Physical Address). + */ +static void __init assign_static_memory_11(struct domain *d, + struct kernel_info *kinfo, + const struct dt_device_node *no= de) +{ + u32 addr_cells, size_cells, reg_cells; + unsigned int nr_banks, bank =3D 0; + const __be32 *cell; + paddr_t pbase, psize; + mfn_t smfn; + int length; + + if ( parse_static_mem_prop(node, &addr_cells, &size_cells, &length, &c= ell) ) + { + printk(XENLOG_ERR + "%pd: failed to parse \"xen,static-mem\" property.\n", d); + goto fail; + } + reg_cells =3D addr_cells + size_cells; + nr_banks =3D length / (reg_cells * sizeof(u32)); + + if ( nr_banks > NR_MEM_BANKS ) + { + printk(XENLOG_ERR + "%pd: exceed max number of supported guest memory banks.\n"= , d); + goto fail; + } + + for ( ; bank < nr_banks; bank++ ) + { + smfn =3D acquire_static_memory_bank(d, &cell, addr_cells, size_cel= ls, + &pbase, &psize); + if ( mfn_eq(smfn, INVALID_MFN) ) + goto fail; + + printk(XENLOG_INFO "%pd: STATIC BANK[%u] %#"PRIpaddr"-%#"PRIpaddr"= \n", + d, bank, pbase, pbase + psize); + + /* One guest memory bank is matched with one physical memory bank.= */ + kinfo->mem.bank[bank].start =3D pbase; + if ( !append_static_memory_to_bank(d, &kinfo->mem.bank[bank], + smfn, psize) ) + goto fail; + + kinfo->unassigned_mem -=3D psize; + } + + kinfo->mem.nr_banks =3D nr_banks; + + /* + * The property 'memory' should match the amount of memory given to + * the guest. + * Currently, it is only possible to either acquire static memory or + * let Xen allocate. *Mixing* is not supported. + */ + if ( kinfo->unassigned_mem !=3D 0 ) + { + printk(XENLOG_ERR + "Size of \"memory\" property doesn't match up with the sum-= up of \"xen,static-mem\".\n"); + goto fail; + } + + return; + + fail: + panic("Failed to assign requested static memory for direct-map domain = %pd.", + d); +} #else static void __init allocate_static_memory(struct domain *d, struct kernel_info *kinfo, const struct dt_device_node *nod= e) { } + +static void __init assign_static_memory_11(struct domain *d, + struct kernel_info *kinfo, + const struct dt_device_node *no= de) +{ + ASSERT_UNREACHABLE(); +} #endif =20 /* @@ -3023,8 +3112,10 @@ static int __init construct_domU(struct domain *d, #endif if ( !dt_find_property(node, "xen,static-mem", NULL) ) allocate_memory(d, &kinfo); - else + else if ( !is_domain_direct_mapped(d) ) allocate_static_memory(d, &kinfo, node); + else + assign_static_memory_11(d, &kinfo, node); =20 rc =3D prepare_dtb_domU(d, &kinfo); if ( rc < 0 ) --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808911; cv=pass; d=zohomail.com; s=zohoarc; b=O73r6TLykm8fdTB3RXeYCxN3dLs1Nk3f/KFRA7xGLi4Rfi/3NYpvCy2YWSReORyEsbe2dXc8pKH6o9Zb/L138qCym2CnxZjUiqMsFSojBvk5n+8NKykXsUHZ3u+VihmoI5y4pmuy6063nerl1ysYQFlASq7ijgp5XYNlur9C0RQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808911; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NA3/zFgsd8czwwlA2vS7TK6OY5eYCgsFdWBPbAyOYuI=; b=ib9Uz47qXarVc65d3Jm9DE0dtHwkJWV8HWJA6XgiITz5l00bEIiyKcv/cqRGEUqQineezqPbc0uShy/ddm6mzGoRiL+cbekxrMmDgsTuIY9TSBojPV7nddEBsO5/HnZyxGDp6EofrsWX+DJUwyOwYqwor9jSEtkkfp0AQ4DSWeY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808911190750.6581708851749; Sun, 13 Feb 2022 19:21:51 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271076.465471 (Exim 4.92) (envelope-from ) id 1nJRvd-0000um-RZ; Mon, 14 Feb 2022 03:21:29 +0000 Received: by outflank-mailman (output) from mailman id 271076.465471; Mon, 14 Feb 2022 03:21:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvd-0000sr-G3; Mon, 14 Feb 2022 03:21:29 +0000 Received: by outflank-mailman (input) for mailman id 271076; Mon, 14 Feb 2022 03:21:28 +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 1nJRvb-0007B4-U8 for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:28 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on061d.outbound.protection.outlook.com [2a01:111:f400:fe1e::61d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 318beeb5-8d45-11ec-8eb8-a37418f5ba1a; Mon, 14 Feb 2022 04:21:27 +0100 (CET) Received: from AM6PR04CA0027.eurprd04.prod.outlook.com (2603:10a6:20b:92::40) by VI1PR08MB3022.eurprd08.prod.outlook.com (2603:10a6:803:41::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:21:16 +0000 Received: from VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:92:cafe::98) by AM6PR04CA0027.outlook.office365.com (2603:10a6:20b:92::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15 via Frontend Transport; Mon, 14 Feb 2022 03:21:16 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT027.mail.protection.outlook.com (10.152.18.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:15 +0000 Received: ("Tessian outbound 2877e54fe176:v113"); Mon, 14 Feb 2022 03:21:15 +0000 Received: from 2f95158a49a2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 83B4BB29-FEA0-4D64-A62A-0878618A94C8.1; Mon, 14 Feb 2022 03:21:09 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2f95158a49a2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:09 +0000 Received: from AS8PR04CA0176.eurprd04.prod.outlook.com (2603:10a6:20b:331::31) by VI1PR08MB4590.eurprd08.prod.outlook.com (2603:10a6:803:c3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.17; Mon, 14 Feb 2022 03:21:06 +0000 Received: from AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:331:cafe::c4) by AS8PR04CA0176.outlook.office365.com (2603:10a6:20b:331::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.19 via Frontend Transport; Mon, 14 Feb 2022 03:21:06 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT026.mail.protection.outlook.com (10.152.16.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:06 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:10 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 318beeb5-8d45-11ec-8eb8-a37418f5ba1a 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=NA3/zFgsd8czwwlA2vS7TK6OY5eYCgsFdWBPbAyOYuI=; b=wfYRLJrq67BbINzObSsLLYvF68MlhQQ0sUbSTmyoy5KmgAiHcgd3LuS0yMJ+fBt+X5MXHhD0ut3m6wsQAl0ErYAPnJc8WuT89ZeDQPXhcwzU7M0QHkjzCPm7NauEDdeoxq0CcYp6rNYsumGqZG47wGMegirzz8xdC2ZicEpfHDs= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: ef95869d07175b08 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VFTH8IxnJjqD2STISE2u8vrCQftScDLU7DiSLIZEh1FIZsS8V1aEfcBZHZMKYWZiGiO29esc4+9E2UMUjgxKFb0SzsHYPC9JRu0Y1zjzqtbrmJXa6uTaq2HygZ2D7Xp6WirzZ7Y9iOVK/kYjYGM1u8ra0N9I0fat6PlgCj5le/oLJ+PdmSWgl3TnIcWuceRMLi39J6Z5gZdb8l5LwtLBF0SFCDqO9hRmXyqgfamyKMdmqoA4PGZO5aPSjlq2tkMyoi6duzL5OPp/+lC3L00jQjxqrovrxuI4PfR5z1raJUFmbyIrQzF13hPvsjD+eucXTI/o+Hrf/uk/UXBbgG4o4w== 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=NA3/zFgsd8czwwlA2vS7TK6OY5eYCgsFdWBPbAyOYuI=; b=aE/mVwJIl9qy/cY/okStLtDn5n8qXatoEneArWOpVPIrfce0VzJ156xJnMNVc1iwQJwvYAhVPg+67Vaf/idYdQ2Y9dZtprgDOAURFPRTAIgfj+reNWGEYDwVY0UH98GmVeCX6gfJysr6nYjIkDRzxHFIAu+SncembhMDQFn0Co3UMmKDxkV7S5QHiHNc6O5PUevH0L40Do5NZ4VAbxkgOcyE4orUzHsKUZpToHTrpeKihUsrkbrNPpbJruL6tZEhytsh0RX73Aaa8WcQoQCnhlgspIe9bhJ6OFoj6qigpCfg9ZMjkANgLqzbPF8qwPPrZO343JiqY6xwrnPHvgWjAA== 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=NA3/zFgsd8czwwlA2vS7TK6OY5eYCgsFdWBPbAyOYuI=; b=wfYRLJrq67BbINzObSsLLYvF68MlhQQ0sUbSTmyoy5KmgAiHcgd3LuS0yMJ+fBt+X5MXHhD0ut3m6wsQAl0ErYAPnJc8WuT89ZeDQPXhcwzU7M0QHkjzCPm7NauEDdeoxq0CcYp6rNYsumGqZG47wGMegirzz8xdC2ZicEpfHDs= 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: , Subject: [PATCH v6 06/11] xen/arm: add ASSERT_UNREACHABLE in allocate_static_memory Date: Mon, 14 Feb 2022 03:19:51 +0000 Message-ID: <20220214031956.3726764-7-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 8cf46b9c-100a-49a9-cc37-08d9ef690f6a X-MS-TrafficTypeDiagnostic: VI1PR08MB4590:EE_|VE1EUR03FT027:EE_|VI1PR08MB3022:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:326;OLM:326; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 8/Yuw2l6JSKob5EkCWsq+HxIVYNw2YnDp2eJm/iwL39VAAHnejz5zd1D9eQQy1BSmghWjlJurkO//SbTNabMeqo8Cmymwn04yeJj3JQ8jg5+vNCtHwH98icEr/OArXDyHOeBD03v+2b56r9p/cKw5qjtk0yRVlbawIVTHmKOvNU+/uVMsKFje3oo6UX0egvtDyMC/zwj9fCbubrQESsx0EPJSlMyOdox+zb21AhfJ1578yWPG37tMBhvZr/Y5gbd6wxdRRRm2wq6S1AYYdkERZtw0n1k2h+OVY108kHuWym0eiYzbYhZKjYjHgTmIlBarYwPejUwHCOnuKjDpw/RUJsdN4r6lWyDcFBFR7HpUQUXKpvBFkmZfeAE6S3yn/JVudpjJG5vHtlUusNKeLueIKQLn8XuKvZbeuDidfhqoxqN2d9+pPceXCE5as6Z7Fi/AZdZ2YRV6VhWSznuXm/EnLTB1nRZW8XVdKz3LcXU/Lfzm5RQhbjkrlW2uxNp+iSKzfiZIu4yseNDRYmxJJuWbTTtehfrr7EPHC3ZbGeq9P4pC+N31Vs0quKBuUyMoi1fm+sHhciGzwjdmN/tfawgT2kKSeqEq0+/qj6jbUP5TJjdZ4EBBWk6IDFGlo+kFvujTqTZq2LckyJDy+/ZyCxuZhllNRVqT+g/a1UXWpHrQsQi2yg1SaZAveDJbnCztyi/ X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(47076005)(508600001)(54906003)(1076003)(6666004)(110136005)(316002)(2616005)(36860700001)(426003)(336012)(70586007)(70206006)(356005)(36756003)(81166007)(8676002)(4326008)(186003)(7696005)(26005)(8936002)(5660300002)(4744005)(44832011)(86362001)(82310400004)(2906002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4590 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9ce4d7a6-3342-4bb2-07c5-08d9ef6909a6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wund4c2iZ4camLE9JUYfaubc9q/gyzSkyw7HC1ncB/4jcwaqF6OSLhGiNoQPqz5RlRHIHZtfMXYTEhGHN0wqsr99jm07PFU1w2NC5+UcGVTu0rJd8lAd+EwtZL76S7tZsHPStz6NEXhb5bk2r1W3ZXXz0n49LFN0+qfUGqAVrFJLncWNkfH8d7Fgrby2g08zbnli38G6czoUjV7OOX8ulVT8SwbPJjWicAOB4G6BSZ0xE/5CHik05LxSQO+inPxLYaGTfnVpZIm3fOekWy+z0zwt4KV39S/E/DVXKrBeAlHUUe0ZaPnDj++qeuuMtTbMUD5+1Lj6i+NqvcwkqEpPLLWUM8iF2Wuj4kr0vSp926bfcroOoX7jKyKDLl2jGe9F9zXITfpotYYI/wItb6CVLpmKXu8NmUSDD+zyc0H7MeIjvvlbOz19LYiMHeiYDH+bUFnnZkqeYO0KecngW3/UVyss5Yd+ffXd4i5pNqnzcHaefa/K/xLcq4d+ds5MG5tEdX4oAkcu0eIZKanS+T1ofUgl8ORtgmeC0anCAQxroctv3zRg2Q/r+YIc6b+vZiLvz+XS1tRm/tlX2c6RbWahaCI8zTPG+FZtkTk0TxkHvtAL4OMBcBeyPg5BC5hKipmK8Gk+1o57ZsK7MNhV1xKwVg== 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)(70586007)(70206006)(6666004)(36756003)(82310400004)(316002)(5660300002)(336012)(426003)(2616005)(4744005)(2906002)(44832011)(26005)(186003)(1076003)(86362001)(4326008)(8936002)(8676002)(7696005)(36860700001)(508600001)(47076005)(81166007)(54906003)(110136005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:15.7804 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8cf46b9c-100a-49a9-cc37-08d9ef690f6a 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: VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3022 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808911727100001 Content-Type: text/plain; charset="utf-8" Helper allocate_static_memory is not meant to be reachable when built with !CONFIG_STATIC_MEMORY, so this commit adds ASSERT_UNREACHABLE in it to catch potential misuse. Signed-off-by: Penny Zheng Acked-by: Julien Grall Tested-by: Stefano Stabellini --- v3 changes: - new commit --- v4 changes: - nothing changed --- v5 changes: - nothing changed --- v6 changes: - nothing changed --- xen/arch/arm/domain_build.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index ec29bd302c..52f256de9c 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -755,6 +755,7 @@ static void __init allocate_static_memory(struct domain= *d, struct kernel_info *kinfo, const struct dt_device_node *nod= e) { + ASSERT_UNREACHABLE(); } =20 static void __init assign_static_memory_11(struct domain *d, --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808910; cv=pass; d=zohomail.com; s=zohoarc; b=K114lyPVf/1kqZBlAMwkb24rZnFJNXEbCfbVorYuQOTp59rymtmQ0kE3IieimpJRS+WlXQ979tgZQ4b9FD8t2pboO5JWB7QZB1bresmdpCRlAqOCqU4M2zrEUH6WA65F086p6dg4WYJS+50cBMaGoS02IiBWNN2ffXKURVvQ/bI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808910; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=op4V66n/UXRW6FyBCeIN+WP0ySiF94rkWc6FafgtJa0=; b=cf2n2IGR+dOlxeYciEfD0QRaJB58kLDM5DkWxhPvzG5fQq6uNrPjaYWPsQrim1RGLKaJRvRpCcTMllJ2lTCIb/kOuE7WHERSLbXlia9XeN+R0Dxmo5gJkf1Qf3nGbO1DRYz2cOPzbTczbbeB2ocPS54Gpt1C/IyopwKx8MRVXSA= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808910333586.2739967236424; Sun, 13 Feb 2022 19:21:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271074.465459 (Exim 4.92) (envelope-from ) id 1nJRvc-0000fn-Cb; Mon, 14 Feb 2022 03:21:28 +0000 Received: by outflank-mailman (output) from mailman id 271074.465459; Mon, 14 Feb 2022 03:21:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvc-0000fU-8v; Mon, 14 Feb 2022 03:21:28 +0000 Received: by outflank-mailman (input) for mailman id 271074; Mon, 14 Feb 2022 03:21:26 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRva-0007B4-Lh for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:26 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on0621.outbound.protection.outlook.com [2a01:111:f400:fe05::621]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 30b8c398-8d45-11ec-8eb8-a37418f5ba1a; Mon, 14 Feb 2022 04:21:25 +0100 (CET) Received: from AM6PR04CA0017.eurprd04.prod.outlook.com (2603:10a6:20b:92::30) by PAXPR08MB6880.eurprd08.prod.outlook.com (2603:10a6:102:13d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:21:20 +0000 Received: from VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:92:cafe::9) by AM6PR04CA0017.outlook.office365.com (2603:10a6:20b:92::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18 via Frontend Transport; Mon, 14 Feb 2022 03:21:19 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT027.mail.protection.outlook.com (10.152.18.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:19 +0000 Received: ("Tessian outbound 2877e54fe176:v113"); Mon, 14 Feb 2022 03:21:19 +0000 Received: from ff8e26062fb6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0D39541A-15DB-4FF8-AB74-588CD450E1DF.1; Mon, 14 Feb 2022 03:21:13 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ff8e26062fb6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:13 +0000 Received: from AS8PR04CA0170.eurprd04.prod.outlook.com (2603:10a6:20b:331::25) by DBBPR08MB4887.eurprd08.prod.outlook.com (2603:10a6:10:d7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Mon, 14 Feb 2022 03:21:08 +0000 Received: from AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:331:cafe::b3) by AS8PR04CA0170.outlook.office365.com (2603:10a6:20b:331::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18 via Frontend Transport; Mon, 14 Feb 2022 03:21:08 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT026.mail.protection.outlook.com (10.152.16.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:08 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:12 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 30b8c398-8d45-11ec-8eb8-a37418f5ba1a 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=op4V66n/UXRW6FyBCeIN+WP0ySiF94rkWc6FafgtJa0=; b=6k9SugG66QvHHxz3hMEy4xVuHdMpGYJW8ELVR6T7ZUeRDALON2ib+rgpeaPXmomk3of2Ca7U5k6DDeCnOQB9vbhX8eoF7igm0WoEqW84Q31AIv9JaUFQ0/6gapbAqHYx/8sIB0hdpTSVsLziSOBEfc5Ei7Tn8t3Gbm/FHeViApk= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 2ab075b81aeb8afa X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ni/JsYX2nWEqT8MuQX6TmphQBldfF6NHqTXqUja+PeABpMJcOz0Fbf3oDafms2VG6dmushkjYqy7ztZ2L+o7Hnb1f1mHNLJEJOHabUgnihanDOAeH1RZ1DuEW6A7WpjC51VuW5xDVALP4Tpub7n+XqRw/XgGwKS+1/DIhG3A+sdHfkR1O1jJBROvM9ib9njNIHSLJIF6hR6T+5s9wg7A0sy38lOYmnWx5sOQkMM5YiN7gK8O37zauc+HdPGeVaP3utEA5k3toMF4PAerXO/MB7VHzOee24lGXKFCU4O8HD0gz/rOaEQmWW1dJxJcDAYBOthxQGLUzTdkAcI3lyQ+3g== 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=op4V66n/UXRW6FyBCeIN+WP0ySiF94rkWc6FafgtJa0=; b=BUYLS6QLfK1GUycyngeQ0XtUAmh6G7xDBSI6OCcgB2M8RI+2Mbnnu8Oof/4aconmBH8mraM6s5HwAGhB5+iOUzpTmY/S6BDQNhqB3C7GdGmoEXBvSJr3eo80VI7VGM1iHFJP4NKyDuGcWMvTASUvlBy4w1psD3cX19oHqukQ4MrX8C9d7PyYzY8P9sz+SegVUWcO0BvuBaZ932NqBr9NXXn+mOi0NqvgiJ2R5o8fOA8qbNDRFEa4j8JhYroU7/5nD0LDwUJPSAWIvUG+wLiBAbWSSn3RMt5tdfmww5MVo1tWVW+T2jcDB+0s/6lF4tAC7MSXFv6IpMx9+5WMwz4pwQ== 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=op4V66n/UXRW6FyBCeIN+WP0ySiF94rkWc6FafgtJa0=; b=6k9SugG66QvHHxz3hMEy4xVuHdMpGYJW8ELVR6T7ZUeRDALON2ib+rgpeaPXmomk3of2Ca7U5k6DDeCnOQB9vbhX8eoF7igm0WoEqW84Q31AIv9JaUFQ0/6gapbAqHYx/8sIB0hdpTSVsLziSOBEfc5Ei7Tn8t3Gbm/FHeViApk= 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: , Subject: [PATCH v6 07/11] xen/arm: if direct-map domain use native addresses for GICv2 Date: Mon, 14 Feb 2022 03:19:52 +0000 Message-ID: <20220214031956.3726764-8-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: ea5ab49d-5b45-49ac-44aa-08d9ef6911b5 X-MS-TrafficTypeDiagnostic: DBBPR08MB4887:EE_|VE1EUR03FT027:EE_|PAXPR08MB6880:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 65EDMwFw7r/1JnM1TrD/hhq3bNp0mlzRWmPFDYvS0ieKAT/Tra3Tku8bGP7vTCt4aLI4zGAMCyVnbufuDDzJ4dTxvcElJkeT8KQBz5vwx2G6V+LKWbK1nUmiZqari0xSKf9Dn5ie/Y1HoAvh33uVZSvdEapoqP39QGAVluauI6BrhERGKugpq8LG1QvgZgDmqOCLZQblmlqZIEJmV10ve/MZRpLEZpES2X2ZxhOostqClzW3bPDCGD/0h1UjpKnZvGGZDLF56Efx1/VNGZsQ+fFp7ZF2J6VeFYjKCpQBN01BaCxgBuptYirAINvwBaOs4r9acUynNWdiHsBAmVyqOLr/r2MWWlTdzYxi2k/9i6lcuP6auW6PTsJxGwsvmM8IQBNqggRTKwkJbDFUjfg12+Ja64H6r3C6bUpPttnc7SoyZdmOYtAzSQo5DoajiBoK/2PmNqbPj8LgJDXOaKAJ5dkFE7QER5fDG8H3E2+aBH2BcdSgy/9B36w7HyIXwAEY+FU9zpLeCQb7Y59jKHARP1cDDB6EH/MyqAI6l1Dh58oGjUA7Q6WSvJZBIfMZRTcYLfMKSQVKWl74YpUZ6Takaw/SSBdh/lsOLmTbjN8Vd3hpUOyUophKuXWcd3CobCJcdHJd8KxrNFzjF/zjYumSe2iLit3XgdKurn5fmIt6eWdERPZjvMBMyxwmib+HAHjwCN7j8sOY+b9AfoTJntH0iQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(8676002)(40460700003)(4326008)(36756003)(8936002)(70206006)(70586007)(7696005)(6666004)(36860700001)(44832011)(86362001)(5660300002)(186003)(336012)(426003)(1076003)(2616005)(26005)(316002)(83380400001)(81166007)(508600001)(82310400004)(110136005)(47076005)(54906003)(356005)(2906002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4887 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 452b18ba-45b1-4296-57c8-08d9ef690afd X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xFP0qlXNUFm3RJK9jtcLPdUsbbLmpBeK8Vq6LzFDZMKESYOZ14sWO9M+GObF1TlaQvbS6/JFuaTGCm7qcPMFsjUeYq5PvgprljnQB68ea9vRBT87MvOMO3aqy9AOkNZBevvHXzl/JFw+cop+6LzaDWHQLQPGVmU+2mcCFIDybQxTwoDaCXlsS7IwJzfGa+ki6dqdToQVeC5s6Pkl4R4VQEjt7nml9susPFGGKkOnTYvw5B+bmeomlAoeuk4eb70vY5cieylTiGQmWtABtjpSF78VxvnIouMS6i9qsk8pWbr44L/Rf/Uvb4DOzSgLH/XPNCKPlQqsA9oHGRJjXA2stSmcOXAuXUUgyQ4qi2KoDXcimpVPQkpdgR381waio4JjQIxb2P2EoRPNIAZ/y55PbjDyhABKalY3RqKDdbFKgspq4qiPz6U71C14+gkIoRMiKxJ6IK0lCKTYq6fLtjRYUKRURXzDv7Pcb1PnSBZfBJThsWZioMEVKO7iXqwwzvRp7sF4olLh3zhDeW+t2lRZCyBrnWMbQ8dnuxnxQNuVl2QSBHyeHJl6S80KkLf06uPtGLAwU1LU8BlCkU2OXRvPGt7OBFx25dnp1VVPqWjz53rVWqBGWx35aQ0kH084nG6+dczdtttR11HY5zsq5lfWKA== 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)(81166007)(8936002)(426003)(2906002)(5660300002)(44832011)(1076003)(186003)(83380400001)(336012)(36756003)(2616005)(36860700001)(26005)(47076005)(82310400004)(70206006)(316002)(110136005)(54906003)(7696005)(8676002)(4326008)(508600001)(6666004)(70586007)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:19.6082 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea5ab49d-5b45-49ac-44aa-08d9ef6911b5 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: VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6880 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808911760100002 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini Today we use native addresses to map the GICv2 for Dom0 and fixed addresses for DomUs. This patch changes the behavior so that native addresses are used for all domains that are direct-mapped. NEW VGIC has different naming schemes, like referring distributor base address as vgic_dist_base, other than the dbase. So this patch also introdu= ces vgic_dist_base/vgic_cpu_base accessor to access correct distributor base address/cpu interface base address on varied scenarios, Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng Reviewed-by: Julien Grall Tested-by: Stefano Stabellini --- v2 changes - combine all changes in patch 4-6 here --- v3 changes - refine comment message - add a comment explaining how the 38 was found of "char buf[38]" - simply map the CPU interface at the GPA vgic_v2_hw.cbase - remove a spurious change --- v4 changes: - refine comment to let it be a summary of the if/else if/else. --- v5 changes: - nothing changed --- v6 changes: - nothing changed --- xen/arch/arm/domain_build.c | 11 +++++++--- xen/arch/arm/include/asm/new_vgic.h | 10 +++++++++ xen/arch/arm/include/asm/vgic.h | 11 ++++++++++ xen/arch/arm/vgic-v2.c | 34 +++++++++++++++++++++++------ xen/arch/arm/vgic/vgic-v2.c | 34 +++++++++++++++++++++++------ 5 files changed, 83 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 52f256de9c..87391adde6 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2273,8 +2273,13 @@ static int __init make_gicv2_domU_node(struct kernel= _info *kinfo) int res =3D 0; __be32 reg[(GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) * 2]; __be32 *cells; + const struct domain *d =3D kinfo->d; + /* Placeholder for interrupt-controller@ + a 64-bit number + \0 */ + char buf[38]; =20 - res =3D fdt_begin_node(fdt, "interrupt-controller@"__stringify(GUEST_G= ICD_BASE)); + snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIx64, + vgic_dist_base(&d->arch.vgic)); + res =3D fdt_begin_node(fdt, buf); if ( res ) return res; =20 @@ -2296,9 +2301,9 @@ static int __init make_gicv2_domU_node(struct kernel_= info *kinfo) =20 cells =3D ®[0]; dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_C= ELLS, - GUEST_GICD_BASE, GUEST_GICD_SIZE); + vgic_dist_base(&d->arch.vgic), GUEST_GICD_SIZE); dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_C= ELLS, - GUEST_GICC_BASE, GUEST_GICC_SIZE); + vgic_cpu_base(&d->arch.vgic), GUEST_GICC_SIZE); =20 res =3D fdt_property(fdt, "reg", reg, sizeof(reg)); if (res) diff --git a/xen/arch/arm/include/asm/new_vgic.h b/xen/arch/arm/include/asm= /new_vgic.h index 97d622bff6..ab57fcd91d 100644 --- a/xen/arch/arm/include/asm/new_vgic.h +++ b/xen/arch/arm/include/asm/new_vgic.h @@ -186,6 +186,16 @@ struct vgic_cpu { uint32_t num_id_bits; }; =20 +static inline paddr_t vgic_cpu_base(const struct vgic_dist *vgic) +{ + return vgic->vgic_cpu_base; +} + +static inline paddr_t vgic_dist_base(const struct vgic_dist *vgic) +{ + return vgic->vgic_dist_base; +} + #endif /* __ASM_ARM_NEW_VGIC_H */ =20 /* diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgi= c.h index ade427a808..d2a9fc7d83 100644 --- a/xen/arch/arm/include/asm/vgic.h +++ b/xen/arch/arm/include/asm/vgic.h @@ -152,6 +152,7 @@ struct vgic_dist { struct pending_irq *pending_irqs; /* Base address for guest GIC */ paddr_t dbase; /* Distributor base address */ + paddr_t cbase; /* CPU interface base address */ #ifdef CONFIG_GICV3 /* GIC V3 addressing */ /* List of contiguous occupied by the redistributors */ @@ -271,6 +272,16 @@ static inline int REG_RANK_NR(int b, uint32_t n) =20 enum gic_sgi_mode; =20 +static inline paddr_t vgic_cpu_base(const struct vgic_dist *vgic) +{ + return vgic->cbase; +} + +static inline paddr_t vgic_dist_base(const struct vgic_dist *vgic) +{ + return vgic->dbase; +} + /* * Offset of GICD_ with its rank, for GICD_ size with * -bits-per-interrupt. diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index 589c033eda..b1bd7a46ad 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -654,12 +654,16 @@ static int vgic_v2_vcpu_init(struct vcpu *v) static int vgic_v2_domain_init(struct domain *d) { int ret; - paddr_t cbase, csize; + paddr_t csize; paddr_t vbase; =20 /* - * The hardware domain gets the hardware address. - * Guests get the virtual platform layout. + * The hardware domain and direct-mapped domain both get the hardware + * address. + * We have to handle them separately because the hwdom is re-using the + * same Device-Tree as the host (see more details below). + * + * Other domains get the virtual platform layout. */ if ( is_hardware_domain(d) ) { @@ -671,10 +675,26 @@ static int vgic_v2_domain_init(struct domain *d) * Note that we assume the size of the CPU interface is always * aligned to PAGE_SIZE. */ - cbase =3D vgic_v2_hw.cbase; + d->arch.vgic.cbase =3D vgic_v2_hw.cbase; csize =3D vgic_v2_hw.csize; vbase =3D vgic_v2_hw.vbase; } + else if ( is_domain_direct_mapped(d) ) + { + /* + * For all the direct-mapped domain other than the hardware domain, + * we only map a 8kB CPU interface but we make sure it is at a + * location occupied by the physical GIC in the host device tree. + * + * We need to add an offset to the virtual CPU interface base + * address when the GIC is aliased to get a 8kB contiguous + * region. + */ + d->arch.vgic.dbase =3D vgic_v2_hw.dbase; + d->arch.vgic.cbase =3D vgic_v2_hw.cbase; + csize =3D GUEST_GICC_SIZE; + vbase =3D vgic_v2_hw.vbase + vgic_v2_hw.aliased_offset; + } else { d->arch.vgic.dbase =3D GUEST_GICD_BASE; @@ -685,7 +705,7 @@ static int vgic_v2_domain_init(struct domain *d) * region. */ BUILD_BUG_ON(GUEST_GICC_SIZE !=3D SZ_8K); - cbase =3D GUEST_GICC_BASE; + d->arch.vgic.cbase =3D GUEST_GICC_BASE; csize =3D GUEST_GICC_SIZE; vbase =3D vgic_v2_hw.vbase + vgic_v2_hw.aliased_offset; } @@ -694,8 +714,8 @@ static int vgic_v2_domain_init(struct domain *d) * Map the gic virtual cpu interface in the gic cpu interface * region of the guest. */ - ret =3D map_mmio_regions(d, gaddr_to_gfn(cbase), csize / PAGE_SIZE, - maddr_to_mfn(vbase)); + ret =3D map_mmio_regions(d, gaddr_to_gfn(d->arch.vgic.cbase), + csize / PAGE_SIZE, maddr_to_mfn(vbase)); if ( ret ) return ret; =20 diff --git a/xen/arch/arm/vgic/vgic-v2.c b/xen/arch/arm/vgic/vgic-v2.c index b5ba4ace87..1a99d3a8b4 100644 --- a/xen/arch/arm/vgic/vgic-v2.c +++ b/xen/arch/arm/vgic/vgic-v2.c @@ -258,13 +258,17 @@ void vgic_v2_enable(struct vcpu *vcpu) int vgic_v2_map_resources(struct domain *d) { struct vgic_dist *dist =3D &d->arch.vgic; - paddr_t cbase, csize; + paddr_t csize; paddr_t vbase; int ret; =20 /* - * The hardware domain gets the hardware address. - * Guests get the virtual platform layout. + * The hardware domain and direct-mapped domain both get the hardware + * address. + * We have to handle them separately because the hwdom is re-using the + * same Device-Tree as the host (see more details below). + * + * Other domains get the virtual platform layout. */ if ( is_hardware_domain(d) ) { @@ -276,10 +280,26 @@ int vgic_v2_map_resources(struct domain *d) * Note that we assume the size of the CPU interface is always * aligned to PAGE_SIZE. */ - cbase =3D gic_v2_hw_data.cbase; + d->arch.vgic.vgic_cpu_base =3D gic_v2_hw_data.cbase; csize =3D gic_v2_hw_data.csize; vbase =3D gic_v2_hw_data.vbase; } + else if ( is_domain_direct_mapped(d) ) + { + d->arch.vgic.vgic_dist_base =3D gic_v2_hw_data.dbase; + /* + * For all the direct-mapped domain other than the hardware domain, + * we only map a 8kB CPU interface but we make sure it is at a loc= ation + * occupied by the physical GIC in the host device tree. + * + * We need to add an offset to the virtual CPU interface base + * address when the GIC is aliased to get a 8kB contiguous + * region. + */ + d->arch.vgic.vgic_cpu_base =3D gic_v2_hw_data.cbase; + csize =3D GUEST_GICC_SIZE; + vbase =3D gic_v2_hw_data.vbase + gic_v2_hw_data.aliased_offset; + } else { d->arch.vgic.vgic_dist_base =3D GUEST_GICD_BASE; @@ -290,7 +310,7 @@ int vgic_v2_map_resources(struct domain *d) * region. */ BUILD_BUG_ON(GUEST_GICC_SIZE !=3D SZ_8K); - cbase =3D GUEST_GICC_BASE; + d->arch.vgic.vgic_cpu_base =3D GUEST_GICC_BASE; csize =3D GUEST_GICC_SIZE; vbase =3D gic_v2_hw_data.vbase + gic_v2_hw_data.aliased_offset; } @@ -308,8 +328,8 @@ int vgic_v2_map_resources(struct domain *d) * Map the gic virtual cpu interface in the gic cpu interface * region of the guest. */ - ret =3D map_mmio_regions(d, gaddr_to_gfn(cbase), csize / PAGE_SIZE, - maddr_to_mfn(vbase)); + ret =3D map_mmio_regions(d, gaddr_to_gfn(d->arch.vgic.vgic_cpu_base), + csize / PAGE_SIZE, maddr_to_mfn(vbase)); if ( ret ) { gdprintk(XENLOG_ERR, "Unable to remap VGIC CPU to VCPU\n"); --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808916; cv=pass; d=zohomail.com; s=zohoarc; b=GYtkziFbLLSFYb1pHpRhzDpYTSgRIIIRNetINwlfIA+7zCXheTCarlg+z/0GEVV2YbqVOmuKOcBwIVhzZPoR+4Ko3tdX3v7ugz6UAFVjpz3tMdyHmAryfXbVvSCdXsV9q9SQsosL+WIzxpKO807YmkSrtooo9jqQZXQO7Mey4nU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808916; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=imow8UlbEMwA9qvqpckFhNwsAsfpDkhGSm02fiqstow=; b=Vko3EMlbjrKp+HF/d0wxWN83ybcNw4uWbQXCs0D/uo5mJjkr/gDVjkMgnyq+9k5LE8DDoHaasQe+6bp5ZEG/jPoQ8LOCunMEO3hJoP8HWQzPSuVjUVhn0mPY3z5NePxAb8dk0Pw4V5k6w6bMfJtWtqmUjohVKOlBvHXwzn/63oQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808916906102.41020843038041; Sun, 13 Feb 2022 19:21:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271080.465504 (Exim 4.92) (envelope-from ) id 1nJRvj-0002LK-Ra; Mon, 14 Feb 2022 03:21:35 +0000 Received: by outflank-mailman (output) from mailman id 271080.465504; Mon, 14 Feb 2022 03:21:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvj-0002Hc-89; Mon, 14 Feb 2022 03:21:35 +0000 Received: by outflank-mailman (input) for mailman id 271080; Mon, 14 Feb 2022 03:21:33 +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 1nJRvg-0007B4-Nm for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:32 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20600.outbound.protection.outlook.com [2a01:111:f400:7e1b::600]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 34853964-8d45-11ec-8eb8-a37418f5ba1a; Mon, 14 Feb 2022 04:21:32 +0100 (CET) Received: from AM6PR01CA0049.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::26) by DBAPR08MB5558.eurprd08.prod.outlook.com (2603:10a6:10:1b3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:21:27 +0000 Received: from VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:e0:cafe::76) by AM6PR01CA0049.outlook.office365.com (2603:10a6:20b:e0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:26 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT035.mail.protection.outlook.com (10.152.18.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:26 +0000 Received: ("Tessian outbound 63bb5eb69ee8:v113"); Mon, 14 Feb 2022 03:21:26 +0000 Received: from d598cff77efc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1E48593B-EF03-4EF8-80B0-0BA192DFFB56.1; Mon, 14 Feb 2022 03:21:19 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d598cff77efc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:19 +0000 Received: from AM6P193CA0100.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::41) by VE1PR08MB5087.eurprd08.prod.outlook.com (2603:10a6:803:114::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Mon, 14 Feb 2022 03:21:11 +0000 Received: from AM5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:88:cafe::4c) by AM6P193CA0100.outlook.office365.com (2603:10a6:209:88::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:11 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT005.mail.protection.outlook.com (10.152.16.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:10 +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.20; Mon, 14 Feb 2022 03:21:15 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:09 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 34853964-8d45-11ec-8eb8-a37418f5ba1a 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=imow8UlbEMwA9qvqpckFhNwsAsfpDkhGSm02fiqstow=; b=nSoUmthnjbBw6NNu09CxwQAw3on4GhtgQVv5XGFm7s1YJLbJV36UUW7k4K73KWZPfKD20DqS+d283nBJJux7u5qnc7J4mhp1IE5vUUVylWPaRuJh/kZJT/kTjLWa5Dx77e7DYkBmMVvYaAUlqjmt2pd3TIm2X/Za4CcNbdgTU1I= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: c7f7bee1a37ed5a6 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TYi6Wz4nOK7GaP0/DV/GVLvprPQ37wn8jHnE6MTK7Qx2KAuWKPqTFLy4z4uNNiZqd3c99Owt3/N15vSOH8oSBU+4UPnosg+P1AlLY/cHe++/UJextnR9Rjn1bQV2u3SktdY0Ie35vjr5HbQOqzRElUkvlbSrObzrSVo5x23j79/B9izwqKvu78sARLpS4h6tVU335mhakWU5TgJnZk0l/oSttXpDdvYPaIbJrjVvQ5Q8u3ip8yOIapkNMTIFQyg5fPNG+Cxq6FvM7wJxGAf/5ByQhST741blShnx92OmMGAm8nomtb4FQELi3kx5RHp4bbCBVSFNZ+aoPRFXr3vAVw== 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=imow8UlbEMwA9qvqpckFhNwsAsfpDkhGSm02fiqstow=; b=DvPJaEMq5U/8pL4EAQqdqQuLCPTHBt5+XXTXA5HdKHH5jUL8anM7hHO9tMM4OgN8WGQaFemRmFKUqanMMOPYiTbB3LMMWrsDsVs/nPuw4y2Px90Y6RVDpCVCt0G4ksMDYzzUonkl2/I0HlTRXtlwwVgSDuzXSbUctPuS/2QS0KtUbzszy4XnTBTO+02zRyKDi9CdKSyPy5uRW24smnZLMnlpW2ECJo+m9MfLP5YW/DSWZUqVfFNVdNYdFcWgZFxq7n5G/6Hmo+Xwo4ld586r0Xf3BsmXx0nITLtL7T8iqM7J27B3eP8nzprVltpmdpLa9Z00AH3PfFK6dbmTwjeDeQ== 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=imow8UlbEMwA9qvqpckFhNwsAsfpDkhGSm02fiqstow=; b=nSoUmthnjbBw6NNu09CxwQAw3on4GhtgQVv5XGFm7s1YJLbJV36UUW7k4K73KWZPfKD20DqS+d283nBJJux7u5qnc7J4mhp1IE5vUUVylWPaRuJh/kZJT/kTjLWa5Dx77e7DYkBmMVvYaAUlqjmt2pd3TIm2X/Za4CcNbdgTU1I= 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: , Subject: [PATCH v6 08/11] xen/arm: gate make_gicv3_domU_node with CONFIG_GICV3 Date: Mon, 14 Feb 2022 03:19:53 +0000 Message-ID: <20220214031956.3726764-9-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: a89c6f7a-2286-444e-dfd5-08d9ef6915b8 X-MS-TrafficTypeDiagnostic: VE1PR08MB5087:EE_|VE1EUR03FT035:EE_|DBAPR08MB5558:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:78;OLM:78; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: G996ObXfx5BZRFYmOUGYcjMl11+BqvuSPuwP5+AevCsiItsOYlfuw7/TW+yBgSV3agrzOH2dH8ErAQlHQsBGw8QItRwnCLGrCGlKJg//hjYlMbHBRxtUIcVTSi208y5KIVseert+9qbLUPFEsO8KqI9r5vwnbbX7h0fVu4UJxVthyDEEaN9dSZYvIymRKELSoJjFHt0prV080zt1LyPk8g8AGJxZ+yU7ZMj0gt5bX0PIAkdAVJ60tDATAwEN28AtsLi/v29ke4GyabxcFdxhR8hNkko4LxJSdKcfSfYdjggWIz+haJVDOmV8OMfXnlwV59hE3Xqs3P9qu9SJZvCdGAGiY+uJP0yc8+xw4alxOGVxD1AaN0TjJGbKwqGaKabRk8bfdN0e9uJ/hYZHvDFCcigujhCCCl1N4YJ3XfFavNkF/OOP+BC48kiJZFR4Mfxi97WazGc1/hsx5lfKK+9aZ0nrUBqSmZTIizPtm2pYddIGj+M1UsclecjM4wu3lIT3YpSQsZke080kdu9oxVstB5Cg5HDxRWa+Oby0IKLPcrV2+LAJisQGlCh+DCJF8edAZugwtV3XKW3O/EWLGFeEI+kOpy9nzEHBR/s2CSnLxa66DN6G7d0v6QWb2px36Um8Ixlye9af/eUlEgq/AjgGKzOYs0inu9/xclFqvzpi/0HxlwhXNfgKCxU/XV86xzt3 X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(110136005)(4326008)(70586007)(508600001)(426003)(186003)(316002)(54906003)(5660300002)(70206006)(36756003)(336012)(8676002)(2906002)(26005)(1076003)(2616005)(86362001)(47076005)(356005)(36860700001)(81166007)(6666004)(8936002)(7696005)(44832011)(82310400004)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5087 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8d210955-ed99-4d27-af66-08d9ef690c4f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DNfMHOtK5MklINxiTawPXw2mT8b+kOZ+w9AZ1ynNPyAV4VxX7GnYrM9Z93vfGuAEWvlpLla63DOo79DzHM/96ONetwGclJCPktVOFl0Awi9zwf8XhBMvGdyylpUdzQiyAj/64Nc++pCSPBtVlY+m0/X8qwYnzv9xhC9VYmjXwFv99FakFvGzPvEjYr1bncokXy0pBD/TSQpICNhge36IkRq3vRH+qrwamiPK5MP/Y8/U/GunMH8RDj1sO/iGQI10U1KiJ8o/jrWzXJ/44DaMqNm5YcTExnj2uVSIbyTLTiOT7HQQSwH9adE4nrIxAVEFtTxGL4BZ2G/9kL4TET+uzGV4PZSyywnjCFXsnSq2cY2rem9WALhzZc5hDR1lms5fXHT2lD4D70spn7ytzew89ItoMRHiNAI9wY1UultNCmFBFemgXGKRgGbG+qfa4P5xjDWvOXH1abcneJzk/vMkxpHHcsXq7pWT44r4XItOhuy8O5XWZ0m9lSux4h29dJFhmd4jv0BMD+BuV3ytpsYsHy3wbxMLuRncxcBw3cTTHGe5zuV+sBrgEmFPSX5q392/5+eCrJqduGbkq1RTFWDVW0UlzqKZMda/JjhkT3rl7nExBMiH1UR1V4wG9YX7UmIsFcTNc4MN+n9owqX2glpoxQ== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(36756003)(44832011)(508600001)(47076005)(5660300002)(316002)(336012)(70586007)(70206006)(426003)(8676002)(4326008)(54906003)(110136005)(7696005)(8936002)(186003)(26005)(6666004)(1076003)(86362001)(2616005)(82310400004)(36860700001)(81166007)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:26.3584 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a89c6f7a-2286-444e-dfd5-08d9ef6915b8 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: VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5558 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808917740100001 Content-Type: text/plain; charset="utf-8" This commit gates function make_gicv3_domU_node with CONFIG_GICV3. Signed-off-by: Penny Zheng Acked-by: Stefano Stabellini Tested-by: Stefano Stabellini --- v4 changes: - remove ASSERT_UNREACHABLE() to avoid breaking compilation on prod build w= ith CONFIG_GICV3=3Dn --- v5 changes: - nothing changed --- v6 changes: - nothing changed --- xen/arch/arm/domain_build.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 87391adde6..a01dc60b55 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2322,6 +2322,7 @@ static int __init make_gicv2_domU_node(struct kernel_= info *kinfo) return res; } =20 +#ifdef CONFIG_GICV3 static int __init make_gicv3_domU_node(struct kernel_info *kinfo) { void *fdt =3D kinfo->fdt; @@ -2371,13 +2372,16 @@ static int __init make_gicv3_domU_node(struct kerne= l_info *kinfo) =20 return res; } +#endif =20 static int __init make_gic_domU_node(struct kernel_info *kinfo) { switch ( kinfo->d->arch.vgic.version ) { +#ifdef CONFIG_GICV3 case GIC_V3: return make_gicv3_domU_node(kinfo); +#endif case GIC_V2: return make_gicv2_domU_node(kinfo); default: --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808915; cv=pass; d=zohomail.com; s=zohoarc; b=OvKVHbGdpzBYGSBeUIXWq0ph1XpVJGiIea5usIp4QBcThOfXmUx5JhfQdzM1CAkkCO1GRgzh3Zo2/sg+rq83XkEVXJfHNi12riv3GIn9sm2p6LM8CYWrZQJ/phLGuVHmHL0wd0pOYsDYnb3SnCt3nVHul6WLfTphls5cvqfOwhg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808915; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8+EdtF5Eoz17ctXTfNPy+lev1ALcPCfwOoK+hIw6c4I=; b=MbmBfCb0l5l+qVMZfIxgBz6ElUnVzGf8cbGAQgTs0GITsUJLkfbCHjz48qwSuNh1vg0H37N6C9CbkQ56NGUvjLCeGSrlPFtbakuGsdO4zbZmAEN0sgzCS1IkM/As0lNipx3wGTZB9GxvhxparTHk7/nt92YAs2YaznTI7uJOF2g= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808915966987.8330623487415; Sun, 13 Feb 2022 19:21:55 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271075.465466 (Exim 4.92) (envelope-from ) id 1nJRvd-0000lU-60; Mon, 14 Feb 2022 03:21:29 +0000 Received: by outflank-mailman (output) from mailman id 271075.465466; Mon, 14 Feb 2022 03:21:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvc-0000jR-O7; Mon, 14 Feb 2022 03:21:28 +0000 Received: by outflank-mailman (input) for mailman id 271075; Mon, 14 Feb 2022 03:21:27 +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 1nJRva-0007B5-P8 for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:26 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02on061a.outbound.protection.outlook.com [2a01:111:f400:fe07::61a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3069747a-8d45-11ec-b215-9bbe72dcb22c; Mon, 14 Feb 2022 04:21:25 +0100 (CET) Received: from AM6P195CA0107.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:86::48) by DB9PR08MB6973.eurprd08.prod.outlook.com (2603:10a6:10:2bc::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.17; Mon, 14 Feb 2022 03:21:23 +0000 Received: from VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:86:cafe::aa) by AM6P195CA0107.outlook.office365.com (2603:10a6:209:86::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:23 +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.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:22 +0000 Received: ("Tessian outbound 826a6d8e58c3:v113"); Mon, 14 Feb 2022 03:21:22 +0000 Received: from 8c3fe565e400.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 997CE106-D74D-4D5A-9B62-E657899B0A6C.1; Mon, 14 Feb 2022 03:21:15 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8c3fe565e400.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:15 +0000 Received: from AS8PR04CA0184.eurprd04.prod.outlook.com (2603:10a6:20b:2f3::9) by AM0PR08MB4962.eurprd08.prod.outlook.com (2603:10a6:208:15a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 03:21:13 +0000 Received: from AM5EUR03FT040.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f3:cafe::d8) by AS8PR04CA0184.outlook.office365.com (2603:10a6:20b:2f3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18 via Frontend Transport; Mon, 14 Feb 2022 03:21:13 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT040.mail.protection.outlook.com (10.152.17.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:13 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:17 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 3069747a-8d45-11ec-b215-9bbe72dcb22c 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=8+EdtF5Eoz17ctXTfNPy+lev1ALcPCfwOoK+hIw6c4I=; b=CTRJynQyC4iCAbDP7f8fZnBuGDYP+iYwlf7872YurhlDYqvuiEB2TtR7KBMuvWfY4rwiXRV4+lKHN2dYvBOCryat5qOC4uAFG+JM10h4yKxqF+yY18sCCZnu4hXHyxjbBoCY9S8B1QBGqFuqAECEtBMjgMh/9t7V1JhGUshgztw= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 9ab8caaaae34ad5f X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GXskdfmAsQiJ2GqhvhcgHLOdu2Y26E/G0tai+uaEIjBcDbwqh2WBmY/DfZ8Jf2N7+08PTR9rHmGWIjT9kTKMtXJKl3/OWvTQRVjH2yPsCrQRBs5O6HUrqVWomTxDXHK3dPcKC6PaQsBKY89fhnI8cKrGCWYXJeVfq6WRe/6ONMQA+MrJuCRmXK/3XQ8omow6GwM34DwHf8rbkwY4sIQrQYaiZbLnqmdnmL8WfXDAdmhmSh9bNZKQvzQrUegDU6AToQ4/QYE9ZoCQNJAwF7+1JdaLrG9Mt6gLqGlhXZUysbVW/oVYmAnANNeUxKMxTNVK6NIAhfCdo2n9Pokbk77nvg== 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=8+EdtF5Eoz17ctXTfNPy+lev1ALcPCfwOoK+hIw6c4I=; b=HzIeU+bMKjiE0lFR4azwOuSjjrOHbaDOFxLSfmPSXuM64Gyw8RGBeC9OHMSEJSkdIPwplU/85UYPlLmtXyvOPKB5cEkgb6n8kC2KsFAfY/ZvTfl2mHK0mpd/kuFhVdgM2MigKlxQNzj8tpqo01VtXZbcXWp7HTcrx9v8Xi7nlES9qtX8+S9H1NDGpzESkwb23c/M5L7FrYQqfGx70lSrO629Fx7Fc4GTrnQyuzI7uKTMd02VFelX3cKaI4SZ2QBtb/dDumwmbeXhAISJyfU/98a//VfpUY69I5f/VD1xEYVLOeWg8GzA0ouN2WOiUmVHQyhHjy/D90ny7oKRFLqmJQ== 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=8+EdtF5Eoz17ctXTfNPy+lev1ALcPCfwOoK+hIw6c4I=; b=CTRJynQyC4iCAbDP7f8fZnBuGDYP+iYwlf7872YurhlDYqvuiEB2TtR7KBMuvWfY4rwiXRV4+lKHN2dYvBOCryat5qOC4uAFG+JM10h4yKxqF+yY18sCCZnu4hXHyxjbBoCY9S8B1QBGqFuqAECEtBMjgMh/9t7V1JhGUshgztw= 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: , Subject: [PATCH v6 09/11] xen/arm: if direct-map domain use native addresses for GICv3 Date: Mon, 14 Feb 2022 03:19:54 +0000 Message-ID: <20220214031956.3726764-10-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 9f4d2ce9-69f7-4042-8347-08d9ef69136a X-MS-TrafficTypeDiagnostic: AM0PR08MB4962:EE_|VE1EUR03FT042:EE_|DB9PR08MB6973:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6430;OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: eHD1O12Kj0SGr1X2cg8fAo0czXNM4i3qXqIH93bbs5Tgl10FM0Ya2ArJKV/Ttle1op80O0Ed+AGOd/gTkxEiRIVwszeuUeD4XPvRCiusKuqpzlFXvnfWx/Pw0C5d+be1+QAv08v6nhfxQ2bhXrLWwOHWwdy1TwkBo0tGmLSvbIy52SP1MxGD5S4FuKIQxkJtzkVIEeAam4cT2ygrokyJ5IG301HbmuX2JIXdzqiJyOlyKV3L2JAamkjDQh0QU7FgOBTxGe0k4/IQ1nbGuvvFKktGmGtJi7r9pZ7Q/C5XTH7W7cDxeWppEiP5rpFZWYBzqK8y6Y6XfE5Rd04zidljMXSd5N1+j55FdhpWT31OAz5iHlh/mBztVWpkxqLTxzcwDVLKHzddPedIEu5V1RSRoaRGYTY6WWyUuR9SR0pF/IbdLwaDVy/bndeosW8IhQxBNuI+6xEVuIgK5oTZk987efIqLQYLEXT7lX3IH+Rvl5XKVbTo26K7wqaN/x5GS65DcGjshKrXBrGgDWRtVK9AiBpTG+TKWiAY5crvUZxyLgSY64MU0oWN3mNfYrJwkYY6j29NqUFlXpiWiHwWvWD/JubWaA2AupoNxSiI92wnfzudm7VcnCy1eMChNVe7Eb++Rujb8SjrQSnRbIFsWTZ9NmUz17sI+T661N5UigScfiCWUqkil/cLye+NjMtkTzAnNgjgZd/i4iNGBuLG7SsFfQ== 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)(110136005)(508600001)(4326008)(70586007)(2616005)(8676002)(2906002)(70206006)(81166007)(82310400004)(54906003)(186003)(26005)(356005)(1076003)(316002)(83380400001)(6666004)(8936002)(40460700003)(44832011)(47076005)(7696005)(5660300002)(336012)(426003)(86362001)(36860700001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4962 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 31ce6402-b8f6-43dd-d7b0-08d9ef690e06 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NSXoTmDLBVYxJoWrTPZgL3LqoImiJ5SLOSii0af5dESizqcHQiMZEX6J7q9xDEeh1u5KCVwbW2F108g24H5SwY5hXWcLGlc6PqoAxdbHhGhjHXeNH476WQlGqihsQkZbE/PWS8yRB2a1vCPRJEVjHnnolHDFPxf/mRmw5Jjd8jtSHq5aVd1tqewAp7Whho98PoC6osQGDRNhrk5TVTzcjZU/cFCS6yQkPKfTSMDypt+1lNHt98Q9Y0DJ+LiJyx3OV4kNuu/i64QeNk5MsbbFbHmuu88N5uKEHqj/i/KS5i37wmWhNaws7AfhQuUPmT8oTcdJAZEr7eqhlIASYt/f6hciJdm0Y7eESOL42u10oh+WgYJHy/nTnBCUsWQz+U1CV0C4v8PDtgJ8QYspCqtAvv/j2EHdewS0yPuM74xRHHF66t1DsoGDpsQjwRZpEOfOH9eTFWaOPvLp9Ek5qC58WlOKYjCUmzOEif9hyrb+iJgDiX1WDTTwWnwGt7kgMd0obw87bObkIzRitFOTovSt+IOlVHEjrSXTsnZ0dNm91+pYdS3btk8ASTKyTkzkb4gZHbNZRSY82pA5xFNqEDcU+4Yvr1EvE6ypLuzI9yWp+yRf5TmUYOwBOgf6h+WJOKHnTij+AYMRM8qJ16i0pyYbUg== 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)(36860700001)(110136005)(7696005)(6666004)(54906003)(2616005)(86362001)(8936002)(36756003)(26005)(83380400001)(186003)(426003)(5660300002)(2906002)(82310400004)(508600001)(336012)(4326008)(1076003)(8676002)(44832011)(47076005)(316002)(81166007)(70586007)(70206006);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:22.4894 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f4d2ce9-69f7-4042-8347-08d9ef69136a 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: DB9PR08MB6973 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808917765100002 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini Today we use native addresses to map the GICv3 for Dom0 and fixed addresses for DomUs. This patch changes the behavior so that native addresses are used for all domain which is using the host memory layout Considering that DOM0 may not always be directly mapped in the future, this patch introduces a new helper "domain_use_host_layout()" that wraps both two check "is_domain_direct_mapped(d) || is_hardware_domain(d)" for more flexible usage. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng Reviewed-by: Julien Grall Tested-by: Stefano Stabellini --- v2 changes: - remove redistributor accessor - introduce new helper "is_domain_use_host_layout()" - comment fix --- v3 changes: - the comment on top of 'buf' to explain how 38 was found - fix res getting overwritten - drop 'cells +=3D (GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS)' - free 'reg' right way - fix comment - rename 'is_domain_use_host_layout()' to 'domain_use_host_layout()' --- v4 changes: - refine comment --- v5 changes: - nothing changed --- v6 changes: - refine comment --- xen/arch/arm/domain_build.c | 34 +++++++++++++++++++++++-------- xen/arch/arm/include/asm/domain.h | 14 +++++++++++++ xen/arch/arm/vgic-v3.c | 30 ++++++++++++++------------- 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index a01dc60b55..cff2cb93cc 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2327,10 +2327,16 @@ static int __init make_gicv3_domU_node(struct kerne= l_info *kinfo) { void *fdt =3D kinfo->fdt; int res =3D 0; - __be32 reg[(GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) * 2]; - __be32 *cells; + __be32 *reg, *cells; + const struct domain *d =3D kinfo->d; + /* Placeholder for interrupt-controller@ + a 64-bit number + \0 */ + char buf[38]; + unsigned int i, len =3D 0; + + snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIx64, + vgic_dist_base(&d->arch.vgic)); =20 - res =3D fdt_begin_node(fdt, "interrupt-controller@"__stringify(GUEST_G= ICV3_GICD_BASE)); + res =3D fdt_begin_node(fdt, buf); if ( res ) return res; =20 @@ -2350,13 +2356,25 @@ static int __init make_gicv3_domU_node(struct kerne= l_info *kinfo) if ( res ) return res; =20 - cells =3D ®[0]; - dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_C= ELLS, - GUEST_GICV3_GICD_BASE, GUEST_GICV3_GICD_SIZE); + /* reg specifies all re-distributors and Distributor. */ + len =3D (GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) * + (d->arch.vgic.nr_regions + 1) * sizeof(__be32); + reg =3D xmalloc_bytes(len); + if ( reg =3D=3D NULL ) + return -ENOMEM; + cells =3D reg; + dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_C= ELLS, - GUEST_GICV3_GICR0_BASE, GUEST_GICV3_GICR0_SIZE); + vgic_dist_base(&d->arch.vgic), GUEST_GICV3_GICD_SIZ= E); =20 - res =3D fdt_property(fdt, "reg", reg, sizeof(reg)); + for ( i =3D 0; i < d->arch.vgic.nr_regions; i++ ) + dt_child_set_range(&cells, + GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_CELLS, + d->arch.vgic.rdist_regions[i].base, + d->arch.vgic.rdist_regions[i].size); + + res =3D fdt_property(fdt, "reg", reg, len); + xfree(reg); if (res) return res; =20 diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/d= omain.h index aabe942cde..c56f6e4398 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -31,6 +31,20 @@ enum domain_type { =20 #define is_domain_direct_mapped(d) (d)->arch.directmap =20 +/* + * Is the domain using the host memory layout? + * + * Direct-mapped domain will always have the RAM mapped with GFN =3D=3D MF= N. + * To avoid any trouble finding space, it is easier to force using the + * host memory layout. + * + * The hardware domain will use the host layout regardless of + * direct-mapped because some OS may rely on a specific address ranges + * for the devices. + */ +#define domain_use_host_layout(d) (is_domain_direct_mapped(d) || \ + is_hardware_domain(d)) + struct vtimer { struct vcpu *v; int irq; diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 65bb7991a6..e4ba9a6476 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -1640,14 +1640,15 @@ static inline unsigned int vgic_v3_max_rdist_count(= struct domain *d) * Normally there is only one GICv3 redistributor region. * The GICv3 DT binding provisions for multiple regions, since there a= re * platforms out there which need those (multi-socket systems). - * For Dom0 we have to live with the MMIO layout the hardware provides, - * so we have to copy the multiple regions - as the first region may n= ot - * provide enough space to hold all redistributors we need. - * However DomU get a constructed memory map, so we can go with - * the architected single redistributor region. + * For domain using the host memory layout, we have to live with the M= MIO + * layout the hardware provides, so we have to copy the multiple regio= ns + * - as the first region may not provide enough space to hold all + * redistributors we need. + * All the other domains will get a constructed memory map, so we can = go + * with the architected single redistributor region. */ - return is_hardware_domain(d) ? vgic_v3_hw.nr_rdist_regions : - GUEST_GICV3_RDIST_REGIONS; + return domain_use_host_layout(d) ? vgic_v3_hw.nr_rdist_regions : + GUEST_GICV3_RDIST_REGIONS; } =20 static int vgic_v3_domain_init(struct domain *d) @@ -1669,10 +1670,11 @@ static int vgic_v3_domain_init(struct domain *d) radix_tree_init(&d->arch.vgic.pend_lpi_tree); =20 /* - * Domain 0 gets the hardware address. - * Guests get the virtual platform layout. + * For domain using the host memory layout, it gets the hardware + * address. + * Other domains get the virtual platform layout. */ - if ( is_hardware_domain(d) ) + if ( domain_use_host_layout(d) ) { unsigned int first_cpu =3D 0; =20 @@ -1695,10 +1697,10 @@ static int vgic_v3_domain_init(struct domain *d) } =20 /* - * The hardware domain may not use all the re-distributors - * regions (e.g when the number of vCPUs does not match the - * number of pCPUs). Update the number of regions to avoid - * exposing unused region as they will not get emulated. + * For domain using the host memory layout, it may not use all + * the re-distributors regions (e.g when the number of vCPUs does + * not match the number of pCPUs). Update the number of regions to + * avoid exposing unused region as they will not get emulated. */ d->arch.vgic.nr_regions =3D i + 1; =20 --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808922; cv=pass; d=zohomail.com; s=zohoarc; b=K2iHL1oFF+3fn3gc2C9SWbZ8jSZb5WSNYHOHm1IakwFRXifU+pWsv55Kujga/BxyyhQqqvCnNqCz40zGLUQ9I1LIqJ0FizCkBQ1qHYyqsKjCX1VLvseNy29wzvOPTVKKe9sFLXYL2qhybECEEv0yMba+6e8/goI07AG1bJvFPT4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808922; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4kFUJ81gEGlN2jJY6+KgXNfmBvm2zTX0lMR9H45QEE0=; b=ctAlcKIXr/p9sff7W1+S2m/o8ig3ReQNVuOVpFxQy7bN43hHwNQAI4y7L8sbKNytnwwiSVFjhi8OhhVg+UxHj0T3n1GgeUhz7qUOS5JMMrTU+xi5oVy5oRoc2PTosl/evL2L6MtTtHndbQ+6woEbkS3YYHLFGV2PAocUIkahGRE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 164480892231257.579353974382684; Sun, 13 Feb 2022 19:22:02 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271077.465492 (Exim 4.92) (envelope-from ) id 1nJRvh-0001lp-2r; Mon, 14 Feb 2022 03:21:33 +0000 Received: by outflank-mailman (output) from mailman id 271077.465492; Mon, 14 Feb 2022 03:21:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvg-0001ib-Mt; Mon, 14 Feb 2022 03:21:32 +0000 Received: by outflank-mailman (input) for mailman id 271077; Mon, 14 Feb 2022 03:21:31 +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 1nJRve-0007B4-HW for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:30 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on0602.outbound.protection.outlook.com [2a01:111:f400:fe0e::602]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 32e1864c-8d45-11ec-8eb8-a37418f5ba1a; Mon, 14 Feb 2022 04:21:29 +0100 (CET) Received: from AM6PR04CA0054.eurprd04.prod.outlook.com (2603:10a6:20b:f0::31) by VE1PR08MB5758.eurprd08.prod.outlook.com (2603:10a6:800:1a0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.14; Mon, 14 Feb 2022 03:21:26 +0000 Received: from AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:f0:cafe::ed) by AM6PR04CA0054.outlook.office365.com (2603:10a6:20b:f0::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18 via Frontend Transport; Mon, 14 Feb 2022 03:21:26 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT060.mail.protection.outlook.com (10.152.16.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.17 via Frontend Transport; Mon, 14 Feb 2022 03:21:25 +0000 Received: ("Tessian outbound 18e50a6f0513:v113"); Mon, 14 Feb 2022 03:21:25 +0000 Received: from a94bf39b6601.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0AD5F8ED-0BA1-4D6E-B331-2C86B46ECDC7.1; Mon, 14 Feb 2022 03:21:20 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a94bf39b6601.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:20 +0000 Received: from AS9PR06CA0346.eurprd06.prod.outlook.com (2603:10a6:20b:466::21) by DB7PR08MB3562.eurprd08.prod.outlook.com (2603:10a6:10:49::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.17; Mon, 14 Feb 2022 03:21:16 +0000 Received: from AM5EUR03FT025.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:466:cafe::d8) by AS9PR06CA0346.outlook.office365.com (2603:10a6:20b:466::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:16 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT025.mail.protection.outlook.com (10.152.16.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:16 +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.20; Mon, 14 Feb 2022 03:21:20 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:13 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 32e1864c-8d45-11ec-8eb8-a37418f5ba1a 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=4kFUJ81gEGlN2jJY6+KgXNfmBvm2zTX0lMR9H45QEE0=; b=OMyfBVeJ4v0lLibhhiVg66fAdRLYWbtBU1bJJt4xOkxrNSRORYmBDDHZZniEIwdg91HfNd0rvwIhxV9dXz1l8dkQEgrbWiVGeTx7mKzGJZpvFclzn5wan64BdQEsgdpRZbJIUtopKquHi5FZjWRsKvBG94drv8RAvXohPW06VGI= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: 24731f0ab9f456f4 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WSKSTuDiA7WiywnMS9DKIQ1JhwGd0u3xN6ACqVX11Nabfq2wmRIKL7CiR3ydlHSr2a9hLnF4sce9tVDFGOTzANvwT5P36GW6hPZIQkcsaeb5Jx6Mb9q1M05/sfOhkQc8gPzGKiRHj9Edz6Sb4wcjMSUeY/lt5ZS3GAMwfdQObk5aAZF/z3j6NVMASzfE5NA155htreTZQTOh1gcE0uQyrq0BYEh/LnAt5KmpuQ+xqYvfcOzQgy4UF2ZrLlEpG1MRfFL+zbCgEX97O8ERD26DvIch/i9LsvqihpNcwkWgsWVrXfwIKERibbDn4gkMnLX6lNn5ond6jvOv9E+XKOVR3g== 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=4kFUJ81gEGlN2jJY6+KgXNfmBvm2zTX0lMR9H45QEE0=; b=Nqt05MXXkPXMK7MoPxPniucxKr8XxaOtYi5nWJxGjM1gr22HgGbzQ2SBzetAXslSQvnExsMpqnSF5lO0R89CfCB0wUaVUBP1eKzw2c1Vzpirj/R2TeBMzLkNPoGvzyjRzRVDk9/925eFxss3K/xKJ+EL+IO5nWXIDT3vE+sWtQkSd9rGKT182Cbv8N+M4lI04LfZayHs3Mqbo9AMHuRquxlf1Xs5pgkjpc6gl4hYM/UFy9qVLsGbKraZ1oxKVXv3WpV5C4GNNNgEOl3ojstwz6Yx3iy746ltEKs0bJaYpIlf3kTUdmKch4tybNqyjrNxgDuoq/efuq+P1Ty/IiiA8A== 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=4kFUJ81gEGlN2jJY6+KgXNfmBvm2zTX0lMR9H45QEE0=; b=OMyfBVeJ4v0lLibhhiVg66fAdRLYWbtBU1bJJt4xOkxrNSRORYmBDDHZZniEIwdg91HfNd0rvwIhxV9dXz1l8dkQEgrbWiVGeTx7mKzGJZpvFclzn5wan64BdQEsgdpRZbJIUtopKquHi5FZjWRsKvBG94drv8RAvXohPW06VGI= 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: , Subject: [PATCH v6 10/11] xen/arm: if direct-map domain use native UART address and IRQ number for vPL011 Date: Mon, 14 Feb 2022 03:19:55 +0000 Message-ID: <20220214031956.3726764-11-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 94b0662e-c6ea-42fc-1f8c-08d9ef69155d X-MS-TrafficTypeDiagnostic: DB7PR08MB3562:EE_|AM5EUR03FT060:EE_|VE1PR08MB5758:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: sBCdoNosfDED/Eg6m3/bqEFGqIyfnudxpRSwSBAmhQYT8Csy70df4B6boVHxEsCMrbX8jjxMEPm3VbheAD3QA1it9qECcEhkkCMt8mt5hrPKC9+mtdmF5KJBYbR/q2Xwc9swnFIdqvmSd/kWwjQmv2JrKNAfBqR7sc3tfSghNcr1M6YaRg5C0DVDP/StaKHHfM0efUnXY2KsUcSAAZP0OFpUKD92oZxBWmQ4FxkH51LZxH7DoRp0PeKBc+ql9CYiUZpw1j2Vyd49R7uS4MvJrZMswtKLliVXNZs5C17HeVMB+LLTFsLjNgUhCFeLYROdSmtmyDDwy4uKlOhEufPcbMcRI6byKQCn/AcJmwOGVasXQiyDsucfd9H7L0kJtOwVMH7v2EIR74Z+F/HDM2xGe9wMJqNsmIvO3atsaxkavzYBMddY8R1YNv8iu6dBbLAAsv7pvVNMpH1DURV9K41QWp2IvGg0CHZCpXC6kyFo/1Jq7ap+ffjSUnzp6x+7ZFkNdYxSZsp05oyKodlU9NT089FZ+umj7gM2t9vk2sRspkqEO9DmgiMGtat+WczfPphPPDtMq/bX3l7IzCSK+ncPPxdeFlM50RBp+sXkAoHJZ9FddhCsjg36C+KIEKjuCLVeRZbwf4MaUyIfGKsFcPCwnSg634lSRTDffWXIvxB974HeMQmWZ795NHak1WlPvyQF 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)(54906003)(2616005)(44832011)(36860700001)(1076003)(82310400004)(186003)(36756003)(26005)(110136005)(47076005)(86362001)(316002)(2906002)(5660300002)(70206006)(8936002)(4326008)(8676002)(83380400001)(7696005)(336012)(508600001)(81166007)(70586007)(6666004)(426003)(356005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3562 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a5bcebf9-9b26-4cc6-244c-08d9ef690fd2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kIPJV7+Eo0n9QfbJ0cJuwXTNW+K5hFM37aPbLo0eaWho8R+uDSABCf9fkCLlFSlQvQuvjoe3zpzemr6JU0LNB26Rd8kpkIg902+YnCTQL9VVBo9uzNRGoubg9sNzfIRqjwHAXNNnOw43s2sKgXotSi4O8lOqAog6fU2Q53X4vm8yLWYpXPVmhscJhNmGwZZKxv3osRE6SI2cE5HNQUjDpUmcfM03ZhOZr9gSavZzq5LaGeTFoo7nA+4LVns/cH0JNiBe3NKpEtl2ND88AJOQ543i/Hi4zKARlgICZW/byHr47SX+Zwbo4Pt7MDXx9Wnz30Ji+6X3DFk3ZDJLrak+jm+HMa6YQGHKeES4dpMhNbd24a78InQcMkL7LSpic62BOxRlMZejSFtK9YwwIxUrjZNnVYZ4qYdd6Q80QbC67qD3mq3AJtCbHtmM5JIiMXoBpqIqqxQ7SuPYoZig+BTgOjk0A7pH/yZ7Ig/tX0papKiuWfav61Y5yt31T+KcB7rkoKTuzppFQPzN0XFmkJ9jv5J3yYrbjGGXjRyhmOdl4H1VtILiG0JbIgnFAxy+HQUbX0gimt6rcFkbk114TXARUNqjh4f/jooL4w8G8TOyL6lNdTwg7QN1uKHhcXh0jyUo8xFAwuDlDl9p9C/ok3ZqG9SHUkBVKE3Gbp9YRio2YLveV5Xr31KJLRODjvCTHH3Q 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:ErrorRetry;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(70206006)(316002)(508600001)(70586007)(2906002)(82310400004)(54906003)(110136005)(4326008)(5660300002)(8676002)(86362001)(44832011)(8936002)(47076005)(81166007)(7696005)(1076003)(83380400001)(36756003)(186003)(426003)(6666004)(36860700001)(2616005)(26005)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:25.8039 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94b0662e-c6ea-42fc-1f8c-08d9ef69155d 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: AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5758 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808923838100001 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini We always use a fix address to map the vPL011 to domains. The address could be a problem for direct-map domains. So, for domains that are directly mapped, reuse the address of the physical UART on the platform to avoid potential clashes. Do the same for the virtual IRQ number: instead of always using GUEST_VPL011_SPI, try to reuse the physical SPI number if possible. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng Reviewed-by: Julien Grall Tested-by: Stefano Stabellini --- v2 changes: - explain why vpl011 initialization before creating its device tree node - error out if the domain is direct-mapped and the IRQ is not found - harden the code and add a check/comment when the hardware UART region is smaller than GUEST_VPL011_SIZE. --- v3 changes: - explain how the '27' was found for 'buf' - fix checking before dereferencing - refine comment message --- v4 changes: - refine comment message --- v5 changes: - nothing changed --- v6 changes: - nothing changed --- xen/arch/arm/domain_build.c | 44 +++++++++++++++++++---- xen/arch/arm/include/asm/vpl011.h | 2 ++ xen/arch/arm/vpl011.c | 60 +++++++++++++++++++++++++++---- 3 files changed, 92 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index cff2cb93cc..8be01678de 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -30,6 +30,7 @@ =20 #include #include +#include =20 static unsigned int __initdata opt_dom0_max_vcpus; integer_param("dom0_max_vcpus", opt_dom0_max_vcpus); @@ -2415,8 +2416,12 @@ static int __init make_vpl011_uart_node(struct kerne= l_info *kinfo) gic_interrupt_t intr; __be32 reg[GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS]; __be32 *cells; + struct domain *d =3D kinfo->d; + /* Placeholder for sbsa-uart@ + a 64-bit number + \0 */ + char buf[27]; =20 - res =3D fdt_begin_node(fdt, "sbsa-uart@"__stringify(GUEST_PL011_BASE)); + snprintf(buf, sizeof(buf), "sbsa-uart@%"PRIx64, d->arch.vpl011.base_ad= dr); + res =3D fdt_begin_node(fdt, buf); if ( res ) return res; =20 @@ -2426,14 +2431,14 @@ static int __init make_vpl011_uart_node(struct kern= el_info *kinfo) =20 cells =3D ®[0]; dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, - GUEST_ROOT_SIZE_CELLS, GUEST_PL011_BASE, + GUEST_ROOT_SIZE_CELLS, d->arch.vpl011.base_addr, GUEST_PL011_SIZE); =20 res =3D fdt_property(fdt, "reg", reg, sizeof(reg)); if ( res ) return res; =20 - set_interrupt(intr, GUEST_VPL011_SPI, 0xf, DT_IRQ_TYPE_LEVEL_HIGH); + set_interrupt(intr, d->arch.vpl011.virq, 0xf, DT_IRQ_TYPE_LEVEL_HIGH); =20 res =3D fdt_property(fdt, "interrupts", intr, sizeof (intr)); if ( res ) @@ -3145,6 +3150,14 @@ static int __init construct_domU(struct domain *d, else assign_static_memory_11(d, &kinfo, node); =20 + /* + * Base address and irq number are needed when creating vpl011 device + * tree node in prepare_dtb_domU, so initialization on related variabl= es + * shall be done first. + */ + if ( kinfo.vpl011 ) + rc =3D domain_vpl011_init(d, NULL); + rc =3D prepare_dtb_domU(d, &kinfo); if ( rc < 0 ) return rc; @@ -3153,9 +3166,6 @@ static int __init construct_domU(struct domain *d, if ( rc < 0 ) return rc; =20 - if ( kinfo.vpl011 ) - rc =3D domain_vpl011_init(d, NULL); - return rc; } =20 @@ -3200,15 +3210,35 @@ void __init create_domUs(void) =20 if ( !dt_property_read_u32(node, "nr_spis", &d_cfg.arch.nr_spis) ) { + unsigned int vpl011_virq =3D GUEST_VPL011_SPI; + d_cfg.arch.nr_spis =3D gic_number_lines() - 32; =20 + /* + * The VPL011 virq is GUEST_VPL011_SPI, unless direct-map is + * set, in which case it'll match the hardware. + * + * Since the domain is not yet created, we can't use + * d->arch.vpl011.irq. So the logic to find the vIRQ has to + * be hardcoded. + * The logic here shall be consistent with the one in + * domain_vpl011_init(). + */ + if ( flags & CDF_directmap ) + { + vpl011_virq =3D serial_irq(SERHND_DTUART); + if ( vpl011_virq < 0 ) + panic("Error getting IRQ number for this serial port %= d\n", + SERHND_DTUART); + } + /* * vpl011 uses one emulated SPI. If vpl011 is requested, make * sure that we allocate enough SPIs for it. */ if ( dt_property_read_bool(node, "vpl011") ) d_cfg.arch.nr_spis =3D MAX(d_cfg.arch.nr_spis, - GUEST_VPL011_SPI - 32 + 1); + vpl011_virq - 32 + 1); } =20 /* diff --git a/xen/arch/arm/include/asm/vpl011.h b/xen/arch/arm/include/asm/v= pl011.h index e6c7ab7381..c09abcd7a9 100644 --- a/xen/arch/arm/include/asm/vpl011.h +++ b/xen/arch/arm/include/asm/vpl011.h @@ -53,6 +53,8 @@ struct vpl011 { uint32_t uarticr; /* Interrupt clear register */ uint32_t uartris; /* Raw interrupt status register */ uint32_t shadow_uartmis; /* shadow masked interrupt register */ + paddr_t base_addr; + unsigned int virq; spinlock_t lock; evtchn_port_t evtchn; }; diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c index 895f436cc4..43522d48fd 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -71,11 +72,11 @@ static void vpl011_update_interrupt_status(struct domai= n *d) * status bit has been set since the last time. */ if ( uartmis & ~vpl011->shadow_uartmis ) - vgic_inject_irq(d, NULL, GUEST_VPL011_SPI, true); + vgic_inject_irq(d, NULL, vpl011->virq, true); =20 vpl011->shadow_uartmis =3D uartmis; #else - vgic_inject_irq(d, NULL, GUEST_VPL011_SPI, uartmis); + vgic_inject_irq(d, NULL, vpl011->virq, uartmis); #endif } =20 @@ -347,7 +348,8 @@ static int vpl011_mmio_read(struct vcpu *v, void *priv) { struct hsr_dabt dabt =3D info->dabt; - uint32_t vpl011_reg =3D (uint32_t)(info->gpa - GUEST_PL011_BASE); + uint32_t vpl011_reg =3D (uint32_t)(info->gpa - + v->domain->arch.vpl011.base_addr); struct vpl011 *vpl011 =3D &v->domain->arch.vpl011; struct domain *d =3D v->domain; unsigned long flags; @@ -430,7 +432,8 @@ static int vpl011_mmio_write(struct vcpu *v, void *priv) { struct hsr_dabt dabt =3D info->dabt; - uint32_t vpl011_reg =3D (uint32_t)(info->gpa - GUEST_PL011_BASE); + uint32_t vpl011_reg =3D (uint32_t)(info->gpa - + v->domain->arch.vpl011.base_addr); struct vpl011 *vpl011 =3D &v->domain->arch.vpl011; struct domain *d =3D v->domain; unsigned long flags; @@ -626,6 +629,49 @@ int domain_vpl011_init(struct domain *d, struct vpl011= _init_info *info) if ( vpl011->backend.dom.ring_buf ) return -EINVAL; =20 + /* + * The VPL011 virq is GUEST_VPL011_SPI, except for direct-map domains + * where the hardware value shall be used. + * The logic here should stay in sync with the one in + * create_domUs(). + */ + if ( is_domain_direct_mapped(d) ) + { + const struct vuart_info *uart =3D serial_vuart_info(SERHND_DTUART); + int vpl011_irq =3D serial_irq(SERHND_DTUART); + + if ( (uart !=3D NULL) && (vpl011_irq > 0) ) + { + vpl011->base_addr =3D uart->base_addr; + vpl011->virq =3D vpl011_irq; + } + else + { + printk(XENLOG_ERR + "vpl011: Unable to re-use the Xen UART information.\n"); + return -EINVAL; + } + + /* + * Since the PL011 we emulate for the guest requires a 4KB region, + * and on some Hardware (e.g. on some sunxi SoC), the UART MMIO + * region is less than 4KB, in which case, there may exist multiple + * devices within the same 4KB region, here adds the following che= ck to + * prevent potential known pitfalls + */ + if ( uart->size < GUEST_PL011_SIZE ) + { + printk(XENLOG_ERR + "vpl011: Can't re-use the Xen UART MMIO region as it is= too small.\n"); + return -EINVAL; + } + } + else + { + vpl011->base_addr =3D GUEST_PL011_BASE; + vpl011->virq =3D GUEST_VPL011_SPI; + } + /* * info is NULL when the backend is in Xen. * info is !=3D NULL when the backend is in a domain. @@ -661,7 +707,7 @@ int domain_vpl011_init(struct domain *d, struct vpl011_= init_info *info) } } =20 - rc =3D vgic_reserve_virq(d, GUEST_VPL011_SPI); + rc =3D vgic_reserve_virq(d, vpl011->virq); if ( !rc ) { rc =3D -EINVAL; @@ -673,12 +719,12 @@ int domain_vpl011_init(struct domain *d, struct vpl01= 1_init_info *info) spin_lock_init(&vpl011->lock); =20 register_mmio_handler(d, &vpl011_mmio_handler, - GUEST_PL011_BASE, GUEST_PL011_SIZE, NULL); + vpl011->base_addr, GUEST_PL011_SIZE, NULL); =20 return 0; =20 out2: - vgic_free_virq(d, GUEST_VPL011_SPI); + vgic_free_virq(d, vpl011->virq); =20 out1: if ( vpl011->backend_in_domain ) --=20 2.25.1 From nobody Wed May 15 04:49:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1644808915; cv=pass; d=zohomail.com; s=zohoarc; b=dpVylHzPP8SClZkePMvqjXoFrhQz9oJrKAasHzKkcKHmns+8S88bCTtkVgloj4sZkzwRbQa/72bcg9m8t30xv9OjZHZVOqyHmaU3vB0imlkDSfn2+Q1q9b0/L04lr9aE+2VUOntflhxIkaoHoQJJCWGkqsizV1M35rnF6SX7vkc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644808915; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2d4IKv3T5/Hx+dqQ3Y2Ud1C+n1KbiL2IC5h2n3T2Clw=; b=KFoPpOpl8+WaFShzsK4sfUyNtRvC8C54hsG2hbM4jhqe4424vj5wNXm1f+eqIH2MpY2N0K5thaLgx8zTcyKAK8Cn9lidCoo3a2lDlXQi4G6pQj/P0yHjArD2vMpu8StgSPcnZ94Y+P2+T+KTtuonOda6EIPNn2U+7wfxGYpZkOo= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644808915780605.4356911510935; Sun, 13 Feb 2022 19:21:55 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271078.465497 (Exim 4.92) (envelope-from ) id 1nJRvi-00020x-7N; Mon, 14 Feb 2022 03:21:34 +0000 Received: by outflank-mailman (output) from mailman id 271078.465497; Mon, 14 Feb 2022 03:21:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJRvh-0001vp-HS; Mon, 14 Feb 2022 03:21:33 +0000 Received: by outflank-mailman (input) for mailman id 271078; Mon, 14 Feb 2022 03:21:31 +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 1nJRvf-0007B4-6i for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 03:21:31 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0602.outbound.protection.outlook.com [2a01:111:f400:fe0d::602]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3366048f-8d45-11ec-8eb8-a37418f5ba1a; Mon, 14 Feb 2022 04:21:30 +0100 (CET) Received: from AS8PR04CA0182.eurprd04.prod.outlook.com (2603:10a6:20b:2f3::7) by DU2PR08MB7311.eurprd08.prod.outlook.com (2603:10a6:10:2e6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.16; Mon, 14 Feb 2022 03:21:28 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f3:cafe::a) by AS8PR04CA0182.outlook.office365.com (2603:10a6:20b:2f3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18 via Frontend Transport; Mon, 14 Feb 2022 03:21:27 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.17 via Frontend Transport; Mon, 14 Feb 2022 03:21:27 +0000 Received: ("Tessian outbound 18e50a6f0513:v113"); Mon, 14 Feb 2022 03:21:27 +0000 Received: from c188c6299f47.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E6604294-B868-450D-BE46-4DF1C63FEED2.1; Mon, 14 Feb 2022 03:21:21 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c188c6299f47.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Feb 2022 03:21:21 +0000 Received: from AS9PR06CA0332.eurprd06.prod.outlook.com (2603:10a6:20b:466::11) by VE1PR08MB5743.eurprd08.prod.outlook.com (2603:10a6:800:1b2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.17; Mon, 14 Feb 2022 03:21:18 +0000 Received: from AM5EUR03FT025.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:466:cafe::a1) by AS9PR06CA0332.outlook.office365.com (2603:10a6:20b:466::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:17 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT025.mail.protection.outlook.com (10.152.16.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 03:21:17 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.20; Mon, 14 Feb 2022 03:21:21 +0000 Received: from penny.shanghai.arm.com (10.169.188.91) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Mon, 14 Feb 2022 03:21:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 3366048f-8d45-11ec-8eb8-a37418f5ba1a 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=2d4IKv3T5/Hx+dqQ3Y2Ud1C+n1KbiL2IC5h2n3T2Clw=; b=8QGPLPeWSQYc+vJdmdH/ZbZiK+Y48Dq3ktEpUJqc+/JAVbibI6qsAjrCa/RU97Bzy6DX/ZbxfsIrdobbmZrPFh0V5BuRvGLUX3Y8y2Oo76R253udOyutw5ajyIHQUIDQQDwY3QPr2yEGiVaOverr/TVoKXNfYNeeaXSTPdIeZhQ= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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: f4c5b5180ddb3c01 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e/6Hi8rKArxLn20nBH1w4wA/pmdRyOCbk4QbSuEmQR4NKTqiedXz2Lf3QDxDz3PJQft7bdf5BW10bSu5jswvqqZQOte//bggJUbRoxbiLJpEACoe95uXK6Hao8qZzvjAyykJ+qQENGWeDvyGnQieockVzA3QbRUNnYK/h81ENXvFIS4U+uZtXzDFhW4DGexSTm+sfetpH780spKdWTtRf2a1iaCnDO0ZynNOHV2Zw2sg3nCHLXH9B0hwa87ZvgM7OrfjhTYfnHUqRqt/9uDL3itqQLVubnL19d37k1G3Fhz7AO5ycv26Ip6tmhbj5TJKEYLIWDEqzN88uYBnGOmRIw== 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=2d4IKv3T5/Hx+dqQ3Y2Ud1C+n1KbiL2IC5h2n3T2Clw=; b=hGxWDzkQHr6e3/xqOQKa97PhE1jnejsPhubxmRXryL4FUlOTfehpT93jRJl+wpjKip73JenCfdHAAynPMzlBe1UdxaL1mmOkjsoLgyDDW1D1vzdkxN9C9UHCGwKY0axieYh3wrGmhk6QxQI8cNWltbnOROJdHXgi+4eBgXCFcvoZwfV2XF6izg0rbaHgqqrws5liWTOPO3WfZAVG4VeYK/ue29/Sy4ReE2GV9hp6I0CsyBDsC1Kb50NlxtOFumNlMQgBzo1CNBZvx8boSTlxakkqWKLLbAyFYjzJxb4ZGAiBIPS+DQYt/v4NNnGT/K7VCbY9gwQZSn5quqkuuMxumQ== 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=2d4IKv3T5/Hx+dqQ3Y2Ud1C+n1KbiL2IC5h2n3T2Clw=; b=8QGPLPeWSQYc+vJdmdH/ZbZiK+Y48Dq3ktEpUJqc+/JAVbibI6qsAjrCa/RU97Bzy6DX/ZbxfsIrdobbmZrPFh0V5BuRvGLUX3Y8y2Oo76R253udOyutw5ajyIHQUIDQQDwY3QPr2yEGiVaOverr/TVoKXNfYNeeaXSTPdIeZhQ= 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: , Subject: [PATCH v6 11/11] xen/docs: Document how to do passthrough without IOMMU Date: Mon, 14 Feb 2022 03:19:56 +0000 Message-ID: <20220214031956.3726764-12-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214031956.3726764-1-penny.zheng@arm.com> References: <20220214031956.3726764-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: fc1a79dc-e9a2-431b-efa0-08d9ef691684 X-MS-TrafficTypeDiagnostic: VE1PR08MB5743:EE_|AM5EUR03FT059:EE_|DU2PR08MB7311:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1751;OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: WombyMC2bDJlw1FT3vngoMtKKHro+kaCE4NpYGnxtI3SiHgaqUkraK4E3/85N+tMS0oDfzIrmgS4eaZDtovISQ6ihAKT2FRo5OQwH4OFc6HLjTuADAVV1MAHRPzLjZtqFVLd5vxjkMgruYTJlghAt0cUP1fxHgsairttfUvW6hzjE3mo3jcV8oIIrssVUMtqZhjJEO1xL/eHGTyjaTQlC3n54/eyJOof8qn5AT22eowiJb6rvY0GNK1T6g7OXY/FV+xlQGYfiFPtis/C+4joNjlHp8HUBLmnDL2Otc33EheajX11jma7Rpe2H7SW4gZyrA/zH7E96lL7kQTCjwX0GFQS9/t7ZJso1/lhl67+O3ueI9lVz6NQjqHVV/WUXVDlm+wDPrwdZF6fjYivcVjLrPaw6Fd7Fv+sfHazo4rJBrrAmRmNx92tPQnIJjV3TNnALyKyix2c/xAdog9pEpjpafAFUD3sogNTLfDNq7+1wmcVoGYmGWtP5pk989At+STW7wz9BcTbZccVzZjLHiZB47u4Cp18i4X9irvkQYTt9egq6QXL/wHTBD98cZBTZJk83C/VIgcPdFDfSLDu2++co3AikdFtYuWBsw0EmODldMa1rCZh3KBqXHcbKO5/7hsTd36O6U59TN1MAqgfXF3v25AqPzw4jtJuchFZDW8BdGMH0zHj6BWJWTxUi0CRzZ8N 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)(6666004)(2906002)(86362001)(83380400001)(82310400004)(5660300002)(8936002)(44832011)(7696005)(8676002)(47076005)(110136005)(54906003)(508600001)(36860700001)(81166007)(356005)(4326008)(316002)(70586007)(70206006)(186003)(1076003)(26005)(426003)(336012)(36756003)(2616005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5743 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 397e7931-24d2-4804-7357-08d9ef691092 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DZU9tpJg6ddacCdSAtrFFAh1X3HwtCMOjhELwiqms7IWWdgEAECNZUGFsqMPFyl382WZsgBOoJa6Z5tI61JMFf6FvyhOZDmjfSZL+VpcyVYncdhkneo/QI9AKkrv95w5NgCUQujyDfOVSj5dmgTqWjQMVy2O0EyAkI5z7OV8oaLRrUm/Os8lVd0HFPAFC8CHDf6FQ/EluUUGxMUqjnFEuxhOpWIyMCNDSJ3FtJKglDRMbP7xH14pFv58ttfw9GUHJMG06wOIjvVmpPNBHvFYnem4N58RhRwheVqaDdrCWv9KSKywqNZN1RiFQw+yQKGO/uOX56s1OAgl2aWWEdCTankSJCalwQYWcyUAtcIEqq/6sClyMyosHKO03+wpApF7IS4kmlUnVw0IJmYVGXdQGitBVQJzRpez9QHe1l1k+hjXcSwMuMc1hU72oEbRx5HHHVulEhyQHxltLK3LXuj4uQQ06oeUfH+ppOvG+hQJ15nlydRbrfQbq9i1W964HctU8RIHljMZ5cTc1gezj+glPoctSFAgMSNC/FUhNeYvwYTV0wWW/LHpvkN9LChYmvLGdgcM/9LRp1Ha4qmqd6EHLiUrhMJBJbMWvs5OPoRO2v+CnEoR5gFFuNVWPCQhs5J+Cwf9/Dg32h8dKO6faOFtog== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(2616005)(508600001)(426003)(26005)(316002)(336012)(6666004)(7696005)(44832011)(36860700001)(2906002)(1076003)(186003)(36756003)(8676002)(5660300002)(70206006)(47076005)(82310400004)(8936002)(110136005)(54906003)(86362001)(4326008)(83380400001)(81166007)(70586007);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 03:21:27.7582 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc1a79dc-e9a2-431b-efa0-08d9ef691684 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: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB7311 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1644808917766100003 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini This commit creates a new doc to document how to do passthrough without IOM= MU. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng Acked-by: Julien Grall Tested-by: Stefano Stabellini --- v2 changes: - nothing changed --- v3 changes: - nothing changed --- v4 changes: - nothing changed --- v5 changes: - nothing changed --- v6 changes: - nothing changed --- docs/misc/arm/passthrough-noiommu.txt | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 docs/misc/arm/passthrough-noiommu.txt diff --git a/docs/misc/arm/passthrough-noiommu.txt b/docs/misc/arm/passthro= ugh-noiommu.txt new file mode 100644 index 0000000000..3e2ef21ad7 --- /dev/null +++ b/docs/misc/arm/passthrough-noiommu.txt @@ -0,0 +1,52 @@ +Request Device Assignment without IOMMU support +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +*WARNING: +Users should be aware that it is not always secure to assign a device with= out +IOMMU protection. +When the device is not protected by the IOMMU, the administrator should ma= ke +sure that: + 1. The device is assigned to a trusted guest. + 2. Users have additional security mechanism on the platform. + +This document assumes that the IOMMU is absent from the system or it is +disabled (status =3D "disabled" in device tree). + +Add xen,force-assign-without-iommu; to the device tree snippet: + +ethernet: ethernet@ff0e0000 { + compatible =3D "cdns,zynqmp-gem"; + xen,path =3D "/amba/ethernet@ff0e0000"; + xen,reg =3D <0x0 0xff0e0000 0x1000 0x0 0xff0e0000>; + xen,force-assign-without-iommu; +}; + +Request 1:1 memory mapping for the domain on static allocation +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Add a direct-map property under the appropriate /chosen/domU node which +is also statically allocated with physical memory ranges through +xen,static-mem property as its guest RAM. + +Below is an example on how to specify the 1:1 memory mapping for the domain +on static allocation in the device-tree: + +/ { + chosen { + domU1 { + compatible =3D "xen,domain"; + #address-cells =3D <0x2>; + #size-cells =3D <0x2>; + cpus =3D <2>; + memory =3D <0x0 0x80000>; + #xen,static-mem-address-cells =3D <0x1>; + #xen,static-mem-size-cells =3D <0x1>; + xen,static-mem =3D <0x30000000 0x20000000>; + direct-map; + ... + }; + }; +}; + +Besides reserving a 512MB region starting at the host physical address +0x30000000 to DomU1, it also requests 1:1 memory mapping. --=20 2.25.1