From nobody Fri Nov 29 16:33:41 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=1632366733; cv=pass; d=zohomail.com; s=zohoarc; b=eL5he4KEDF4zgnW3ZuoVRPxTcinPv7VQFKcjO3omo3c9KHyHFXk9ZX2Z3WnbDwXMgtCZ3j201+2sYdHym6g8DUDFNmnrLTMEuojm8OUx56HHp8jjpfdiD18LHiLgHeKZ3KmTSH+bpCQe9RzPX0yzWe0lrdDlq0Jd9dT49d9wML4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366733; 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=PxKTjjjfvwxRnsbZJKvjVjurClpiQegEoLdVtMIbE48=; b=UfQcPqtnK8OO6ascMinmhFIGMu9pZ0VAAcjAeNv2wkScN53WIqmn1n747dcgx6Dct7rvzUI7yYB/toxEEDzaFKQHnqZl5wTuPSUyoh+T+lmJtSshnL/3AnK6o15dOBKxIhtfH3yyaAowMrC/7rJ57yqEHEA0Z6t+Gk4Wp5p5yIo= 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 1632366733349984.7331836638431; Wed, 22 Sep 2021 20:12:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193311.344338 (Exim 4.92) (envelope-from ) id 1mTF9Q-0004kw-8v; Thu, 23 Sep 2021 03:11:56 +0000 Received: by outflank-mailman (output) from mailman id 193311.344338; Thu, 23 Sep 2021 03:11:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9Q-0004km-4v; Thu, 23 Sep 2021 03:11:56 +0000 Received: by outflank-mailman (input) for mailman id 193311; Thu, 23 Sep 2021 03:11:54 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9O-0004Qj-DU for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:11:54 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (unknown [40.107.14.72]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ff7c5433-1c1b-11ec-ba0a-12813bfff9fa; Thu, 23 Sep 2021 03:11:52 +0000 (UTC) Received: from AM6PR0502CA0043.eurprd05.prod.outlook.com (2603:10a6:20b:56::20) by DBBPR08MB4361.eurprd08.prod.outlook.com (2603:10a6:10:c8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:41 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::b3) by AM6PR0502CA0043.outlook.office365.com (2603:10a6:20b:56::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:41 +0000 Received: from 64aa7808-outbound-2.mta.getcheckrecipient.com (63.33.187.114) 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.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:41 +0000 Received: ("Tessian outbound c9f4ff96a6ad:v103"); Thu, 23 Sep 2021 03:11:39 +0000 Received: from 762f163a0586.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CA37131F-64B9-409C-B00E-9178C79C7F7C.1; Thu, 23 Sep 2021 03:11:27 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 762f163a0586.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:27 +0000 Received: from AS8PR04CA0068.eurprd04.prod.outlook.com (2603:10a6:20b:313::13) by DB9PR08MB7050.eurprd08.prod.outlook.com (2603:10a6:10:2bd::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:25 +0000 Received: from VE1EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:313:cafe::d5) by AS8PR04CA0068.outlook.office365.com (2603:10a6:20b:313::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:25 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT039.mail.protection.outlook.com (10.152.19.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:25 +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.14; Thu, 23 Sep 2021 03:11:24 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:23 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:21 +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: ff7c5433-1c1b-11ec-ba0a-12813bfff9fa 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=PxKTjjjfvwxRnsbZJKvjVjurClpiQegEoLdVtMIbE48=; b=qElmi03Ic9TwxR4HBSDJDhHEUyaifwF/YbkCtycl0YqqkWwGzfw2pp9sl8lenQflnfejBPLpeUMWhollJPPMpBf9fbtEpMIfh7Oz6U/4fy68ej7jOLJF1MYicEoQGzVOBdLhHy9O3+51QBZ4AnCYcfkiFK+5YzL7i/JRLtTdCFk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.33.187.114) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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.33.187.114 as permitted sender) receiver=protection.outlook.com; client-ip=63.33.187.114; helo=64aa7808-outbound-2.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 8097e4d4a45c9b09 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z/4sG/owxdNQwWePWv3Hu+IOHrYJI4SEQ0kMGZ33kq6KPEjC3V54VRPb7vohA45yATFGQG/ZSJCo5zLB/nkreEN4CdPi9ILYrYXjpAb6To9VFH4R6xPjhNin69WtwEOckwrX4FSnJnvkxj59goxbMymIswcPwjL3QBDw3YYC/Ikk9YXMJPOxwsose8WwkkPVsCzWj5YtVPWkjcgxqdgWvlv1qAy/K8g3/bjasuvun2tLohTW1dsTjGm+7aViotCEXQaT7xNZx6jis8jWwAQ0CT5PrxtxgJD1BGm2iaCVt70XV4YZRdrclrKmQEj1CISgJ1WV/Blx0d7w4bjyZffGiQ== 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; bh=PxKTjjjfvwxRnsbZJKvjVjurClpiQegEoLdVtMIbE48=; b=MInrOKf3N5TExZXY6p7tgfpXiMKVUmNsk5GzrQrPBrHcEq4D7Fq+c3zvLC6HmwzX15VjImnymsRTpQE3yC/Ohjw6joDKkyqc3hXlarodaaxrNXr5s7CJn0yHGMMm30Xfte2OhLVDrQIV8JJDuyRFqYbIb70RQq/f5pTNj8DQr71pDbwo6OINjiNHYkGRP+0VWey0qvhe4E6HCXsjNqkImf1QftZ5JFmEbmQia2ntnyNwentSsKYQ6ibuFLVSPd/wDNDcFfy8WMV4TMI4mzQxvcr6j33cjdAFixPXGQgcVcOfu/WRr/3TFWIvWYQjN2J0Mog0vHlrb9vUHVGE3cmbAw== 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=PxKTjjjfvwxRnsbZJKvjVjurClpiQegEoLdVtMIbE48=; b=qElmi03Ic9TwxR4HBSDJDhHEUyaifwF/YbkCtycl0YqqkWwGzfw2pp9sl8lenQflnfejBPLpeUMWhollJPPMpBf9fbtEpMIfh7Oz6U/4fy68ej7jOLJF1MYicEoQGzVOBdLhHy9O3+51QBZ4AnCYcfkiFK+5YzL7i/JRLtTdCFk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 01/11] xen: reserve flags for internal usage in xen_domctl_createdomain Date: Thu, 23 Sep 2021 03:11:05 +0000 Message-ID: <20210923031115.1429719-2-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-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-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8459c6c-cee4-4041-51bf-08d97e3fdd75 X-MS-TrafficTypeDiagnostic: DB9PR08MB7050:|DBBPR08MB4361: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: WIiGZflZU0eUsgMGCiC8xo9mr7vlf+kCGfnakbLFMgl7ZAZI2SE4mpkQ/0ToA07uOytpDqexWeNyvk9GDowhWwPsjbw0G5HjVAACXYyewYCXVLMIobrIpKcbdUIcJ2zEZ2vmvHWoJHQDtaxG3+E2j9GQI4zdBWJnOism3ZCy3O6hNDDtxlrVH07tE+/ZkJ+g6/dLqghS8K0rbRw9U1ZXec7aZRRea0XANvUhpSoAO7BJijyLLgy2/2KivJDybVQESLp5KrUGkex9ykz5m+AwTRfVe8zZmz1T6zudqxOuUO3yiJCGfxrP2hPIoZz71DFwZCbE0WwwGr1CUhp8slliL2YKd7KYki2PZsJuCO8llv3XLA3Z/P1MkIL67Puycipf1jFmhCZMBHoa+TbPc/NZ8ijsbvPhUO46/sYPA4KQMXHq2ozyFArKX4J+64zkQLmId4Ippk5kPKriZHL8hjNU8PFIBpRnkgeLb1UwjgLWvP2d8/Z55L02TWz+V3ZXPxlsu9EFc2zXQ3L8rbad/HQXbhYCjT0BM1Peox1Ye+nNX5rnCSVx+D9mAofFZzOFcB8srTvEDYZGZTV5S7JRrlqGOpcFb51mm8ILQJdtuI0JHwAICeulGLEjrt+QISfgHNZO+CUR2NBcedn6O90DLVeZZ4sOP3Z5VuOSamJmJuDEqfO2Y5WsZION++xxymhXDTacrO/XaqQTgM6yprWzV2lHOd8jM9fweyPYHP1YVOtuUE8= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(70586007)(2906002)(356005)(316002)(36756003)(7696005)(8936002)(508600001)(70206006)(4326008)(186003)(81166007)(26005)(426003)(1076003)(47076005)(5660300002)(2616005)(82310400003)(336012)(6666004)(86362001)(8676002)(36860700001)(44832011)(54906003)(83380400001)(110136005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7050 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: b13e7494-34b7-4986-5ef0-08d97e3fd422 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /q4d3YMs/iKQ0glHBwwvNkQoyTgRxELhoB+Joo1bAQYgNV9LdJ48XaouZeuDezpnlh4AnOtz7Ptnya/HreqIMo7vBKU5uykGoKuRQ3Ip3Ar/1xhKAqtOeJVK8uBMcXBwHORt811fE5YcEzNXHu0ijRIUe1EdLTdcdrUJisp53zyXj0Madn6nQgJ6crtzQ4Ucix0gsjyQP+i3JB3xroi//CrRpJCv5WQ8XW57b4RmCG0MWnlgMJyK2Qkn001zReFcc6XGohIanA0uOXRMc7C9/oyNIsTEMgkv1MeULw8nDo6LRMEW5ugG+ROdkNNOr1Qqs/K8Br6o6XjcJvC/4ivVEyXsVNQpOWc1cUq3UWpFA4O7r58W0mLeKYfOrmLQbd/LHYXwa5v/2cp4c0WZkomnuXqYZnP1H+aZR5c9uPJUGT77rbfs/1is/cWuw11PCMKlUpcOlOsBgcwenJQdYqTohe6ZsPiYo16y8JHFhhwdaFEZEk9Wa2KFAJrW+7q4moEfunU5qA5++YFH74OOUCUU3fjDsjHiHHWr+PRQ/QOpBmtghaL0KU6uJ0EF9A812ayfmPBBRIqNaoUMZU37D8VyFMBhoEx/9++d+8FG1TSBwVyZ1me4FCuwNgev5P2QXsGkuNdk0OZF2dP2o8Bjujp6sh4mU7IXesDXK9pxhQvxElTkX1IHyB2af+eBPTbi+dlqq1yfy1bB6D2aDsWbvlvd4Q== X-Forefront-Antispam-Report: CIP:63.33.187.114;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-2.mta.getcheckrecipient.com;PTR:ec2-63-33-187-114.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(83380400001)(70586007)(7696005)(316002)(70206006)(426003)(82310400003)(4326008)(110136005)(508600001)(54906003)(44832011)(26005)(336012)(81166007)(86362001)(5660300002)(2616005)(186003)(36756003)(47076005)(1076003)(8676002)(36860700001)(8936002)(6666004)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:41.2280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8459c6c-cee4-4041-51bf-08d97e3fdd75 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.33.187.114];Helo=[64aa7808-outbound-2.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: DBBPR08MB4361 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366734681100002 From: Stefano Stabellini We are passing an extra special boolean flag at domain creation to specify whether we want to the domain to be privileged (i.e. dom0) or not. Another flag will be introduced later in this series. Reserve bits 16-31 from the existing flags bitfield in struct xen_domctl_createdomain for internal Xen usage. Allocate bit 16 for XEN_DOMCTL_INTERNAL_ispriv: whether a domain is privileged or not. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng CC: andrew.cooper3@citrix.com CC: jbeulich@suse.com CC: George Dunlap CC: Ian Jackson CC: Wei Liu CC: "Roger Pau Monn=C3=A9" CC: George Dunlap CC: Dario Faggioli --- xen/arch/arm/domain.c | 2 +- xen/arch/arm/domain_build.c | 7 ++++--- xen/arch/x86/setup.c | 4 +++- xen/common/domain.c | 19 +++++++++---------- xen/common/domctl.c | 3 ++- xen/common/sched/core.c | 2 +- xen/include/public/domctl.h | 3 +++ xen/include/xen/domain.h | 4 ++++ xen/include/xen/sched.h | 3 +-- 9 files changed, 28 insertions(+), 19 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 19c756ac3d..7922249d26 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -623,7 +623,7 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) unsigned int max_vcpus; =20 /* HVM and HAP must be set. IOMMU may or may not be */ - if ( (config->flags & ~XEN_DOMCTL_CDF_iommu) !=3D + if ( ((config->flags & XEN_DOMCTL_CDF_MASK) & ~XEN_DOMCTL_CDF_iommu) != =3D (XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap) ) { dprintk(XENLOG_INFO, "Unsupported configuration %#x\n", diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index d233d634c1..8cc4c800e9 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2679,7 +2679,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); if ( IS_ERR(d) ) panic("Error creating domain %s\n", dt_node_name(node)); =20 @@ -2752,7 +2752,8 @@ void __init create_dom0(void) { struct domain *dom0; struct xen_domctl_createdomain dom0_cfg =3D { - .flags =3D XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap, + .flags =3D XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap | + XEN_DOMCTL_INTERNAL_ispriv, .max_evtchn_port =3D -1, .max_grant_frames =3D gnttab_dom0_frames(), .max_maptrack_frames =3D -1, @@ -2773,7 +2774,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); 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 b101565f14..6b7a1a3994 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -770,9 +770,11 @@ static struct domain *__init create_dom0(const module_= t *image, =20 if ( iommu_enabled ) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; + if ( !pv_shim ) + dom0_cfg.flags |=3D XEN_DOMCTL_INTERNAL_ispriv; =20 /* Create initial domain 0. */ - d =3D domain_create(get_initial_domain_id(), &dom0_cfg, !pv_shim); + d =3D domain_create(get_initial_domain_id(), &dom0_cfg); if ( IS_ERR(d) || (alloc_dom0_vcpu0(d) =3D=3D NULL) ) panic("Error creating domain 0\n"); =20 diff --git a/xen/common/domain.c b/xen/common/domain.c index 6ee5d033b0..5fcca9b018 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -475,11 +475,11 @@ static void _domain_destroy(struct domain *d) =20 static int sanitise_domain_config(struct xen_domctl_createdomain *config) { - bool hvm =3D config->flags & XEN_DOMCTL_CDF_hvm; - bool hap =3D config->flags & XEN_DOMCTL_CDF_hap; - bool iommu =3D config->flags & XEN_DOMCTL_CDF_iommu; + bool hvm =3D (config->flags & XEN_DOMCTL_CDF_MASK) & XEN_DOMCTL_CDF_hv= m; + bool hap =3D (config->flags & XEN_DOMCTL_CDF_MASK) & XEN_DOMCTL_CDF_ha= p; + bool iommu =3D (config->flags & XEN_DOMCTL_CDF_MASK) & XEN_DOMCTL_CDF_= iommu; =20 - if ( config->flags & + if ( (config->flags & XEN_DOMCTL_CDF_MASK) & ~(XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap | XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off | XEN_DOMCTL_CDF_xs_domain | XEN_DOMCTL_CDF_iommu | @@ -536,8 +536,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) + struct xen_domctl_createdomain *config) { struct domain *d, **pd, *old_hwdom =3D NULL; enum { INIT_watchdog =3D 1u<<1, @@ -563,7 +562,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 config ? config->flags & XEN_DOMCTL_INTERNAL_ispr= iv : 0; =20 /* Sort out our idea of is_hardware_domain(). */ if ( domid =3D=3D 0 || domid =3D=3D hardware_domid ) @@ -756,7 +755,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); if ( IS_ERR(dom_xen) ) panic("Failed to create d[XEN]: %ld\n", PTR_ERR(dom_xen)); =20 @@ -766,7 +765,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); if ( IS_ERR(dom_io) ) panic("Failed to create d[IO]: %ld\n", PTR_ERR(dom_io)); =20 @@ -775,7 +774,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); if ( IS_ERR(dom_cow) ) panic("Failed to create d[COW]: %ld\n", PTR_ERR(dom_cow)); #endif diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 12d6144d28..2ec6d454dd 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -431,7 +431,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_d= omctl) rover =3D dom; } =20 - d =3D domain_create(dom, &op->u.createdomain, false); + op->u.createdomain.flags &=3D XEN_DOMCTL_CDF_MASK; + d =3D domain_create(dom, &op->u.createdomain); if ( IS_ERR(d) ) { ret =3D PTR_ERR(d); diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 8f4b1ca10d..27d5bc2259 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); 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/public/domctl.h b/xen/include/public/domctl.h index 96696e3842..4d3fcd3bcb 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -74,6 +74,9 @@ struct xen_domctl_createdomain { /* Max XEN_DOMCTL_CDF_* constant. Used for ABI checking. */ #define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_nested_virt =20 +/* Flags from (1U<<16) to (1U<<31) are reserved for internal usage */ +#define XEN_DOMCTL_CDF_MASK (0xffff) + uint32_t flags; =20 #define _XEN_DOMCTL_IOMMU_no_sharept 0 diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 1708c36964..7ed0b62b78 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 +/* Flags are reserved for internal usage */ +#define _XEN_DOMCTL_INTERNAL_ispriv 16 +#define XEN_DOMCTL_INTERNAL_ispriv (1U<<_XEN_DOMCTL_INTERNAL_ispr= iv) + /* * Arch-specifics. */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 28146ee404..a659b25dea 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -664,8 +664,7 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config); * (domid < DOMID_FIRST_RESERVED). */ struct domain *domain_create(domid_t domid, - struct xen_domctl_createdomain *config, - bool is_priv); + struct xen_domctl_createdomain *config); =20 /* * rcu_lock_domain_by_id() is more efficient than get_domain_by_id(). --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632366734; cv=pass; d=zohomail.com; s=zohoarc; b=ewIlrqdSaX9GxC7fxxe1PXPmPgWrQ+T23hxn6Ny3sVm7Fw/gA/QFPux7Fbz595ltdBriyPQXiaH/OeBRyMAajFeLvuSspWEPlvAqXZZFC99/WW77nPyfGppk1D+XPk7EU2F2TK08ngtKgBU3i8L95iR9TBImtVr/7+S7oD7cXvA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366734; 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=qHVKimCebnfTnXl/cdcWvwlQTjDe3a3vxMZKNxFvmJA=; b=BK6O4aScQu5xOXMNBq50wivOfibL+OkEAa526nFm72C3Pf3Wf0z8ksN3mxwYNL+LfRcx0msGlYYmtoeNiwXP0ispF6xJQQ5QDkgeMOrh2VYt8ltBiQ3yTdt7ecY0p2OvI8TYPTgDeNG44tEeR5cydFk5HW2CQBwCpOuF8PJXgbE= 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 16323667348411010.4083935462379; Wed, 22 Sep 2021 20:12:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193314.344360 (Exim 4.92) (envelope-from ) id 1mTF9U-0005Mf-0j; Thu, 23 Sep 2021 03:12:00 +0000 Received: by outflank-mailman (output) from mailman id 193314.344360; Thu, 23 Sep 2021 03:11:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9T-0005LQ-RM; Thu, 23 Sep 2021 03:11:59 +0000 Received: by outflank-mailman (input) for mailman id 193314; Thu, 23 Sep 2021 03:11:59 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9T-0004Qj-DW for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:11:59 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (unknown [40.107.2.75]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ffdad977-1c1b-11ec-ba0a-12813bfff9fa; Thu, 23 Sep 2021 03:11:53 +0000 (UTC) Received: from DU2PR04CA0237.eurprd04.prod.outlook.com (2603:10a6:10:2b1::32) by AM8PR08MB6562.eurprd08.prod.outlook.com (2603:10a6:20b:355::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.17; Thu, 23 Sep 2021 03:11:43 +0000 Received: from DB5EUR03FT028.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::74) by DU2PR04CA0237.outlook.office365.com (2603:10a6:10:2b1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:43 +0000 Received: from 64aa7808-outbound-2.mta.getcheckrecipient.com (63.33.187.114) by DB5EUR03FT028.mail.protection.outlook.com (10.152.20.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:42 +0000 Received: ("Tessian outbound c9f4ff96a6ad:v103"); Thu, 23 Sep 2021 03:11:42 +0000 Received: from 328040812834.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3AB28AAE-394B-455B-9593-66F767380AEF.1; Thu, 23 Sep 2021 03:11:30 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 328040812834.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:30 +0000 Received: from AS8PR04CA0080.eurprd04.prod.outlook.com (2603:10a6:20b:313::25) by DBBPR08MB4521.eurprd08.prod.outlook.com (2603:10a6:10:cd::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:27 +0000 Received: from VE1EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:313:cafe::3c) by AS8PR04CA0080.outlook.office365.com (2603:10a6:20b:313::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:27 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT039.mail.protection.outlook.com (10.152.19.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:27 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:26 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:24 +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: ffdad977-1c1b-11ec-ba0a-12813bfff9fa 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=qHVKimCebnfTnXl/cdcWvwlQTjDe3a3vxMZKNxFvmJA=; b=i1VoeOZq/COXIp7ZbnpyZQVqsu5uUNZnHJaRzwrtdj9mPh/FV/aFfxwDlsBlGYBVCFKmrq7aGrF9PmuP909Zdbgb26BDFxzf5JbK0Pf7E+aItb8kJiPD1jxSwtm9NtRq1JpDJao7tsaaK2w6WM9D6vUETRL9G1xeHLv2M4RcrAA= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.33.187.114) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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.33.187.114 as permitted sender) receiver=protection.outlook.com; client-ip=63.33.187.114; helo=64aa7808-outbound-2.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 3c0ad97f2e027594 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hwY3/gCgm8FFI+//Y8bWgllcA4uiJCy5D//le6d3gRFdQ80qyseUmsGnxVdB2mwJJlWkUK1bfzDbopug7eYM66xknZHK2sz0tYd9i5aHjlDs48rnKIkoLKozMUQ7S1bNNtcb+Hn+6DhbLhYKh9fjqXjc3GzC6ornpAtRnfRM43yC6xxXBOH9BCG7e0Rghhvh+FeiCAo/Z5vYOx3XIok/diyWYKS156/fzPoB1xLMQqwQVunhnHWZtizM+YevLz5dc0d4OiDF2G7TlDLvbmVHqbgpIW1qI5yyImP4hHA4jt5i6pWZzOwo6IKeHPBrH3AxRXsmq/92UOJAvNS+en86vA== 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; bh=qHVKimCebnfTnXl/cdcWvwlQTjDe3a3vxMZKNxFvmJA=; b=AfgfBHyZVQf58vqVzf95ri3+Z+E0vfIenu7+wtaGtpvp10Kk8nUuV6AjKKdXTw+JOg7tEyHaFflftiClfBKVqMk6KL1CcACg+vyUNGccGyfvV/ewRBmMtx+eTvEDeWMTpNq/2vKLJJvvXpGH72ftIiBeBpXvd4YIRVQ4ot8mypQx5qQu8GAD3Zd5yFlYS0i2r1MvYnVxOrfUjgKf0vPeseIeom6S9ANHXDgFWC4Y+X8mzj3/1txiL38VObTKovXNVt5AHLgbC837DJ+qG+qFWDJQ9hG7b3MH2fBfCaHRou2a2USEeTikySxAlQJoV+HSusFZ6R7O/tQG7rpf4ewxog== 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=qHVKimCebnfTnXl/cdcWvwlQTjDe3a3vxMZKNxFvmJA=; b=i1VoeOZq/COXIp7ZbnpyZQVqsu5uUNZnHJaRzwrtdj9mPh/FV/aFfxwDlsBlGYBVCFKmrq7aGrF9PmuP909Zdbgb26BDFxzf5JbK0Pf7E+aItb8kJiPD1jxSwtm9NtRq1JpDJao7tsaaK2w6WM9D6vUETRL9G1xeHLv2M4RcrAA= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 02/11] xen/arm: introduce XEN_DOMCTL_INTERNAL_directmap Date: Thu, 23 Sep 2021 03:11:06 +0000 Message-ID: <20210923031115.1429719-3-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-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-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d7638033-1e47-4487-6928-08d97e3fde68 X-MS-TrafficTypeDiagnostic: DBBPR08MB4521:|AM8PR08MB6562: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:229;OLM:229; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: jtH2pJ/rqcJUjKN21pHyIOZmf6cu17r3p9OEYfYSXgyVmrpktCeFWsahkl/Zwy25iwD3zpX5b8luqiJ6o8vIM3Mvw8wHDzSGXg7ZA14nNL+f9xHAlSWgZaRyqkdMBOZWccd/Awnid/bFv/4jbkyJsrWOElkdfHHNQRXA/bzv5aFRBbJlq0x2y/HgWzdzEcb33DacVx/6hD1m8jG9+9ZmHvhw7sfhQ5fbOfcJ36lca8NlYLKG/tBc5EFVmfAMwUxDT1GISY4z15uGemW4GXoC4XwTtnzlF7NbCxIMW3piceTmkTkh+mzFEVHqVp8fh/7vkhYG7gQtGDaloKCyASyMXw4bgMgATBF7v/c1noeAkMLPScdxK8WtZWWAw3MpdzBqCOuF+4EWnEfswfz9DD4AVwZOIhXdTxKpJBRlAfPMGPOdIEdXifFDBH5hPyJ77rfWT72cwKwZM64zvLqdO81louCYpnIxDTNwxfj/c/fiRKTfMl5/j5WUOokRA/66AsSVeKRIx88RbDRpAEVddjORoH3fVYQVvXEDDm4Ue0Ogs0eJhQHAzHw7Gn7Vu5MSaVsNUsOaTjX2bRsZuFfrP7Alid8jFRr3s0ombp3PhAug3J6C/IDlFIKRNHdzKi3zJIXaherUBde8v2ykAidhvBP815z3oujNcE3lssGaztVEb90PDlBtscjc3GDsv/lQ4d/ITJW56oFvshpahH8j4qbrL7K1Nrc3QSlGuci0YssLtns= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(508600001)(70586007)(54906003)(83380400001)(70206006)(316002)(426003)(82310400003)(4326008)(110136005)(7696005)(44832011)(2616005)(5660300002)(186003)(36756003)(81166007)(356005)(6666004)(47076005)(86362001)(1076003)(8676002)(36860700001)(8936002)(2906002)(336012)(26005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4521 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT028.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 09e2341e-c755-40cc-640b-08d97e3fd528 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YhFj2w7HnknwFrSWixp24/IGxrJuy/fM8XHWkDJfWrUMVmKJRD+ZfjPq/kAi2SR/mwjEpZJHKjeIo4lNN/cWvhEz6jNbiRo3PxuBLJudhfzkI6Hqw3j6kk2kblCjD4Zx0T5a+wzDyBeoA4UqPkOFra5dbauhWkrDROwfMLFh625bBrZEegO6k5/PbNEWreGUJxiI4bomlLqqGeMoA2yK6iZdBB6PQnHwRbWLRMVJaURmjBZRDcosj4hHFVer/Ka3GKXMYiGhdHy315abftfYPgFv90NjsaGCxR13KcdDD5281Fdk5WV6pqVQOUzBCNfbu+DMYamWZH7ZwIiTv//SXoNlmV+Dj9l6IE075ICMkZ3NWuDDvhFBYeB0/Q4NVMmVG2jpW3dKvEAHYMjY1/NOTWsZta9fQAPhcbIN/LEyIyij0hHo70v4m1bWndkAi14D/G7Jq/ixgfxyo08tk54AEE57ZnZBfUf92b8aJYBKx1lyZXVM7iQ2Q9T7vJUsmyXMtRq3g15pbUEbNohe7KWGBi/T2siQF6c/92Q2hArVUHXgnF8hO4wGty3hWauH/CDM2ayhWzRNAKXDZpJWTXDiFruq06uncditSBIBLBMKIHqNYNlCZgvokrKpFR+aqRKEATBxpOwqQw2kiyrdhCCz0B2AB/7/v/d8G5hshV0RxFXucM0yEihmV42Vb9HJMoH62dLx+5xINjwstvsBbqaRVQ== X-Forefront-Antispam-Report: CIP:63.33.187.114;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-2.mta.getcheckrecipient.com;PTR:ec2-63-33-187-114.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(44832011)(8676002)(81166007)(36860700001)(70586007)(186003)(8936002)(70206006)(82310400003)(5660300002)(86362001)(83380400001)(426003)(26005)(110136005)(7696005)(2616005)(47076005)(36756003)(6666004)(508600001)(54906003)(336012)(4326008)(1076003)(316002)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:42.8989 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7638033-1e47-4487-6928-08d97e3fde68 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.33.187.114];Helo=[64aa7808-outbound-2.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT028.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6562 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366736359100009 From: Stefano Stabellini This commit introduces a new ARM-specific flag to specify that the domain should be 1:1 directly mapped (guest physical addresses =3D=3D physical addresses). Also, add a direct_map flag under struct arch_domain and use it to implement is_domain_direct_mapped. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng CC: andrew.cooper3@citrix.com CC: jbeulich@suse.com CC: George Dunlap CC: Ian Jackson CC: Wei Liu CC: "Roger Pau Monn=C3=A9" --- xen/arch/arm/domain.c | 1 + xen/arch/arm/domain_build.c | 2 +- xen/include/asm-arm/domain.h | 9 +++++++-- xen/include/xen/domain.h | 4 ++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 7922249d26..0b3cff8a40 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -696,6 +696,7 @@ int arch_domain_create(struct domain *d, return 0; =20 ASSERT(config !=3D NULL); + d->arch.direct_map =3D config->flags & XEN_DOMCTL_INTERNAL_directmap; =20 #ifdef CONFIG_IOREQ_SERVER ioreq_domain_init(d); diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 8cc4c800e9..21d8a559af 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2753,7 +2753,7 @@ void __init create_dom0(void) struct domain *dom0; struct xen_domctl_createdomain dom0_cfg =3D { .flags =3D XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap | - XEN_DOMCTL_INTERNAL_ispriv, + XEN_DOMCTL_INTERNAL_ispriv | XEN_DOMCTL_INTERNAL_directma= p, .max_evtchn_port =3D -1, .max_grant_frames =3D gnttab_dom0_frames(), .max_maptrack_frames =3D -1, diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index c9277b5c6d..a74ee5720c 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -29,8 +29,11 @@ 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) +/* + * The hardware domain has always its memory direct mapped. And DOM0 shall + * be always been set as 1:1 direct-map domain. + */ +#define is_domain_direct_mapped(d) (d)->arch.direct_map =20 struct vtimer { struct vcpu *v; @@ -89,6 +92,8 @@ struct arch_domain #ifdef CONFIG_TEE void *tee; #endif + + bool direct_map; } __cacheline_aligned; =20 struct arch_vcpu diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 7ed0b62b78..6c2b07eb42 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -32,6 +32,10 @@ void arch_get_domain_info(const struct domain *d, #define _XEN_DOMCTL_INTERNAL_ispriv 16 #define XEN_DOMCTL_INTERNAL_ispriv (1U<<_XEN_DOMCTL_INTERNAL_ispr= iv) =20 +/* This flag is ARM specific */ +#define _XEN_DOMCTL_INTERNAL_directmap 17 +#define XEN_DOMCTL_INTERNAL_directmap (1U<<_XEN_DOMCTL_INTERNAL_dire= ctmap) + /* * Arch-specifics. */ --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632366736; cv=pass; d=zohomail.com; s=zohoarc; b=dLHXgkv94cvBZ6ROln2G2p4+QhxBK+HW2PBfaWC57XVcNMpe2CYfrfCm7H173l+SJ1j9vtm8eyOYJGWAu+vFW4WDMH7FHKoT2+rPWHeKC0GX2/LQ34toHwtz37gwXFlEr7iaPrkjMDL4erHEKyt2TJejVoAjE6ngSoqEiMCSbaU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366736; 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=cXV5Lffa19mU+2iwdP2TQ82Nx4ZrJiOJhVjvupxNFvU=; b=jnrXWSMA/Gqli+1UVX/BcmDt7t2gAbfPPJHOO5PR/yK4Btsu5A9HizpNZVgdZ9nUi/qsOkAjnxTC4hQcVBjcBA2YhIXlgAg8EQ40ilffYuPNBc+8TtUB1dyd8IzOxraFZAlMQAYPvUabRWgMbYAkvVjnHLXdYLhzf6BKLfrTb/g= 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 1632366736852227.63439447147152; Wed, 22 Sep 2021 20:12:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193315.344371 (Exim 4.92) (envelope-from ) id 1mTF9V-0005hH-Im; Thu, 23 Sep 2021 03:12:01 +0000 Received: by outflank-mailman (output) from mailman id 193315.344371; Thu, 23 Sep 2021 03:12:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9V-0005gE-9y; Thu, 23 Sep 2021 03:12:01 +0000 Received: by outflank-mailman (input) for mailman id 193315; Thu, 23 Sep 2021 03:12:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9U-0004kC-B3 for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:12:00 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:fe0c::624]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e6959f0f-a5b0-421c-a025-dc6fb36d9bcd; Thu, 23 Sep 2021 03:11:54 +0000 (UTC) Received: from AM6P194CA0029.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:90::42) by HE1PR0802MB2540.eurprd08.prod.outlook.com (2603:10a6:3:d4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.17; Thu, 23 Sep 2021 03:11:52 +0000 Received: from AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:90:cafe::c7) by AM6P194CA0029.outlook.office365.com (2603:10a6:209:90::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15 via Frontend Transport; Thu, 23 Sep 2021 03:11:52 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT054.mail.protection.outlook.com (10.152.16.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:51 +0000 Received: ("Tessian outbound 71ebfb754289:v103"); Thu, 23 Sep 2021 03:11:49 +0000 Received: from 02875dfcb4fc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 54E4DF64-BF4C-4AFF-B8B0-218451B1D66B.1; Thu, 23 Sep 2021 03:11:34 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 02875dfcb4fc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:34 +0000 Received: from AM6PR01CA0042.eurprd01.prod.exchangelabs.com (2603:10a6:20b:e0::19) by DB6PR0801MB1944.eurprd08.prod.outlook.com (2603:10a6:4:73::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Thu, 23 Sep 2021 03:11:30 +0000 Received: from VE1EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:e0:cafe::fe) by AM6PR01CA0042.outlook.office365.com (2603:10a6:20b:e0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:30 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT043.mail.protection.outlook.com (10.152.19.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:30 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:28 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:26 +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: e6959f0f-a5b0-421c-a025-dc6fb36d9bcd 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=cXV5Lffa19mU+2iwdP2TQ82Nx4ZrJiOJhVjvupxNFvU=; b=u3vK5WpREiAZkA12VE6wgC1OepCyGY4Eulp+pSMoc1/08chn2y1uadcFgtfMXrxKEWgRxUfQX39hohbxkfiA1Htg6F3ljf6XlF9j79iVRfy0NgM66u95OmuW/XH/JxOqEmMFZDZ4VXWkQd635kQ/k3w2EL7q9P8f5UnPoakEjwc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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: c826ebf4bbbf4bb0 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PJVKCqT/pGIrTwjTY1VJGO5SmMpxKe+V28PjeZD35AaZxe07UsS4CFGrcQZ6tmSlUo6fJIkkTxxW14DAFx0yKjT2FBhWv+yZxwog/lqQCF0yZ8PDP4940kqIOhHKhLxJG8LTx+0PtsRjnAEeLXF+hvFMA0m8cqFTJ5Sa8gDXBsqLfIn7RuXROEiCDuFN+/fCeusPwaY0n8FGIXmgL9woKQLdiykUtmlnPAKHr7vFami4U67mEf0pXD8+4kl31JKrqznvVLxltQ+jx1+txGZNooJgE1zjMw0uH4Jf8j8LBxbF258YSoy0KqJgoptqvh0FukKDERgtQqIZEKDWdvVFQQ== 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; bh=cXV5Lffa19mU+2iwdP2TQ82Nx4ZrJiOJhVjvupxNFvU=; b=Kl4h/Joyu9Z40IJx4ZSl0IvqTEOYscNOh8JUjfezIlb6mlmFSrlUAjefcKnkBT2u4ZLjLGBl6kDsYYS6E8w/hiyZPAzE09u0aRnCn3gXLfTmBDZrIgsYkWxD63Atr56sab0YoL0+GOhsvxJ0jeLR4E6LkrmoLpCPNuTCzJmfK49mTVKLzHlezy8NEeEHfxkqh6F0A22jlIuFLj7hi92ENIpPV6VAmkoUgHEYmoN/OrK17lREKLjBhRGCX6Hw1VsYSNdsaeSjDEtMYPJm5FctRYV6D86yhFCiumf9UvQg5Jajg6Z0L1avO+3PDAI+T/2sHJ2BjZ7oblAt9lL/+3JyUQ== 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=cXV5Lffa19mU+2iwdP2TQ82Nx4ZrJiOJhVjvupxNFvU=; b=u3vK5WpREiAZkA12VE6wgC1OepCyGY4Eulp+pSMoc1/08chn2y1uadcFgtfMXrxKEWgRxUfQX39hohbxkfiA1Htg6F3ljf6XlF9j79iVRfy0NgM66u95OmuW/XH/JxOqEmMFZDZ4VXWkQd635kQ/k3w2EL7q9P8f5UnPoakEjwc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 03/11] xen/arm: introduce 1:1 direct-map for domUs Date: Thu, 23 Sep 2021 03:11:07 +0000 Message-ID: <20210923031115.1429719-4-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7c77710-aad9-4476-f8b8-08d97e3fe3b9 X-MS-TrafficTypeDiagnostic: DB6PR0801MB1944:|HE1PR0802MB2540: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1775;OLM:1775; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 6AQ8kthB+tJZm9n6CUjNlHXgh+/MTN9V7hUEu4Us+XL60lMqpWrwpR/yXgDSxa+4PBzukkbP77oSJ8ORD7VrtKW1zLoEUd39BNpBc99PP8CeoUk25azucU+/UUREtPVYbfO+faVi+Otvs8DZeYo+qWh5LHG6uV3inwUUwqhPviiUJebkTPwleioVIg0QyRI49ml67SIWG3fHzfHyPhCpqzPmgYixZDFVfYDKzm5qcecG52lGMtC9LDH/ETI8fFd3/cB63uNHcyjgUvwBX+ZhhevFSoI3HwOEIL77yve93TwyjbEHi9JC3QuapxJYg6G/5ZpPvY/ZJUjHrL8s7+knQsmfssp/8NpiyQIsLjfUYn/Z9T7wq7oxV7bsOLkP/0ROiA0MS+naYm9pYHyEeUog4TObSbnLk9iFbH5PYAguQ91ChlJt2cMd8cy1n0ppp6R7BvlKHWYKnUA2RK2YWPnMBVeT0rgkk6WKaYw2MGBA8e1BH4gz210GVlOjHAyOlBGgjaH4DICT/JXDUYYniFIolqW/80Ew86QWNr8egN72FMS/SyayAZ6povPcHWne0AVg5Qvs3nq0Yb9AVfvzqvzOY2xKWPkjmOPR9xAa1UsnAzMT32i6b9VEenS3twuhS1AGpkfNWW0wSgaCQaEch6aN7ZzGUUZmkMTS+e8HmA4wTJs/7LFomrqgGZ+r1Ngio290mb2gfMO9C3shYAhoPeV3yvkCjlNQ16ReeBWQDXzcbeg= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(36860700001)(2906002)(8936002)(5660300002)(508600001)(316002)(82310400003)(44832011)(186003)(8676002)(6666004)(1076003)(7696005)(54906003)(47076005)(83380400001)(86362001)(81166007)(70586007)(70206006)(36756003)(26005)(426003)(2616005)(4326008)(356005)(336012)(110136005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1944 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 6bef1812-7ebd-4191-99dd-08d97e3fd710 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qon82hJ+m+y/Qe7jLVr3phHxpqfnDfPTE2IB8xRnY91ep3vsp1HzXPw/Tp//zWT9115JPbPjn0NQmVA1IqzHhC9XPuEwB+u1kpZme1EUUxG3byC7amXccvYBknL9+1HhSYuzEkcqYiOJoMT1GOLdx/bmFbU+9LohpNcW74Hw9Zoq8LJuMF0Ha96pfAyMIe7hAYRc8+m03iNApO0A/kBkjktY6F4iw3PPpTTuq55Cl2LK0KamHA0djFyULJsTacetZzt6UuUFi8UtPObKrF0RUMWxT1yBe1IH08dRKIEpoLWk05LUeK/rR4rvuaLKy8++QMo1g8SghhxMC/MXtYduY2t7PJoi9EIFpBQ9Z0j2KxQfPgEKTepbjB/DFrxot3RCCkaG2ySFe1J0iW/rxp31nUxRKmEUTGQJVUd6dYG59EV6ApePm3glyGYPYknPTqvoWu9LsHhEXWGT4R7GPsmZ1gNiS3LbL65fEVInJacs9jrCmetjgEJYWuMmyTGTfLXtAbeYqH9QNcEjKYhpbAm7Q0f3WMiU4WOlZWEtQ+HqeSbuOOIwD9IBVPZcimyLc9rpHapicgoeVqYdgqxXOtwVy3ZCHqt6uwNYzIn5fbaI22kPxlR+/xgguEbOFthMZaMmVEBfJ2Hfqrkp+MBhH/A5LAtCUAJ/vB8ran58CcyONolBE0Jz1tTXo+ZGULunMdU/JJ8TAVEaxTt9PlQMmZ5Kgw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(5660300002)(508600001)(110136005)(36756003)(82310400003)(186003)(83380400001)(26005)(2616005)(1076003)(6666004)(47076005)(316002)(54906003)(426003)(70206006)(86362001)(70586007)(4326008)(8676002)(2906002)(336012)(44832011)(7696005)(81166007)(36860700001)(8936002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:51.7431 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7c77710-aad9-4476-f8b8-08d97e3fe3b9 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: AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2540 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366738474100001 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini Cases where domU needs 1:1 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. *WARNING: Users should be aware that it is not always secure to assign a device witho= ut IOMMU protection. When the device is not protected by the IOMMU, the administrator should make sure that: 1. The device is assigned to a trusted guest. 2. Users have additional security mechanism on the platform. Given that with direct-map, the IOMMU could be used but it is not required. This commit avoids setting XEN_DOMCTL_CDF_iommu when the IOMMU is disabled = and direct_map is requested. Since, for now, 1:1 direct-map is only supported when domain on Static Allocation, that is, "xen.static-mem" is defined in the domain configuratio= n. This commit also re-implements allocate_static_memory to allocate static me= mory as guest RAM for 1:1 direct-map domain. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng --- docs/misc/arm/device-tree/booting.txt | 9 ++ xen/arch/arm/domain_build.c | 117 +++++++++++++++++--------- 2 files changed, 85 insertions(+), 41 deletions(-) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index 44cd9e1a9a..3d637c747e 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -164,6 +164,15 @@ 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 + + Optional for Domain on Static Allocation. + An empty property to request the memory of the domain to be 1:1 + direct-map(guest physical address =3D=3D physical address). + WARNING: Users must be aware of this risk, that guests having access + to hardware with DMA capacity must be trusted, or it could use the + DMA engine to access any other memory area. + 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_build.c b/xen/arch/arm/domain_build.c index 21d8a559af..213ad017dc 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -488,8 +488,14 @@ 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; + + if ( !is_domain_direct_mapped(d) ) + /* Infer next GFN when GFN !=3D MFN. */ + 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 ) @@ -537,14 +543,17 @@ static void __init allocate_static_memory(struct doma= in *d, } reg_cells =3D addr_cells + size_cells; =20 - /* - * The static memory will be mapped in the guest at the usual guest me= mory - * addresses (GUEST_RAM0_BASE, GUEST_RAM1_BASE) defined by - * xen/include/public/arch-arm.h. - */ - gbank =3D 0; - gsize =3D ramsize[gbank]; - kinfo->mem.bank[gbank].start =3D rambase[gbank]; + if ( !is_domain_direct_mapped(d) ) + { + /* + * The static memory will be mapped in the guest at the usual guest + * memory addresses (GUEST_RAM0_BASE, GUEST_RAM1_BASE) defined by + * xen/include/public/arch-arm.h. + */ + gbank =3D 0; + gsize =3D ramsize[gbank]; + kinfo->mem.bank[gbank].start =3D rambase[gbank]; + } =20 cell =3D (const __be32 *)prop->value; nr_banks =3D (prop->length) / (reg_cells * sizeof (u32)); @@ -572,42 +581,58 @@ static void __init allocate_static_memory(struct doma= in *d, printk(XENLOG_INFO "%pd: STATIC BANK[%u] %#"PRIpaddr"-%#"PRIpaddr"= \n", d, bank, pbase, pbase + psize); =20 - while ( 1 ) + if ( !is_domain_direct_mapped(d) ) { - /* Map as much as possible the static range to the guest bank = */ - if ( !append_static_memory_to_bank(d, &kinfo->mem.bank[gbank],= smfn, - min(psize, gsize)) ) - goto fail; - - /* - * The current physical bank is fully mapped. - * Handle the next physical bank. - */ - if ( gsize >=3D psize ) + while ( 1 ) { - gsize =3D gsize - psize; - break; + /* Map as much as possible the static range to the guest b= ank */ + if ( !append_static_memory_to_bank(d, &kinfo->mem.bank[gba= nk], + smfn, min(psize, gsize)= ) ) + goto fail; + + /* + * The current physical bank is fully mapped. + * Handle the next physical bank. + */ + if ( gsize >=3D psize ) + { + gsize =3D gsize - psize; + break; + } + /* + * When current guest bank is not enough to map, exhaust + * the current one and seek to the next. + * Before seeking to the next, check if we still have avai= lable + * guest bank. + */ + else if ( (gbank + 1) >=3D GUEST_RAM_BANKS ) + { + printk(XENLOG_ERR "Exhausted all possible guest banks.= \n"); + goto fail; + } + else + { + psize =3D psize - gsize; + smfn =3D mfn_add(smfn, gsize >> PAGE_SHIFT); + /* Update to the next guest bank. */ + gbank++; + gsize =3D ramsize[gbank]; + kinfo->mem.bank[gbank].start =3D rambase[gbank]; + } } + } + else /* 1:1 direct-map. */ + { /* - * When current guest bank is not enough to map, exhaust - * the current one and seek to the next. - * Before seeking to the next, check if we still have available - * guest bank. + * One guest memory bank is matched with one physical + * memory bank. */ - else if ( (gbank + 1) >=3D GUEST_RAM_BANKS ) - { - printk(XENLOG_ERR "Exhausted all possible guest banks.\n"); + gbank =3D bank; + kinfo->mem.bank[gbank].start =3D pbase; + + if ( !append_static_memory_to_bank(d, &kinfo->mem.bank[gbank], + smfn, psize) ) goto fail; - } - else - { - psize =3D psize - gsize; - smfn =3D mfn_add(smfn, gsize >> PAGE_SHIFT); - /* Update to the next guest bank. */ - gbank++; - gsize =3D ramsize[gbank]; - kinfo->mem.bank[gbank].start =3D rambase[gbank]; - } } =20 tot_size +=3D psize; @@ -2638,6 +2663,7 @@ void __init create_domUs(void) { struct dt_device_node *node; const struct dt_device_node *chosen =3D dt_find_node_by_path("/chosen"= ); + bool direct_map =3D false; =20 BUG_ON(chosen =3D=3D NULL); dt_for_each_child_node(chosen, node) @@ -2658,8 +2684,17 @@ void __init create_domUs(void) panic("Missing property 'cpus' for domain %s\n", dt_node_name(node)); =20 + direct_map =3D dt_property_read_bool(node, "direct-map"); + d_cfg.flags |=3D direct_map ? XEN_DOMCTL_INTERNAL_directmap : 0; if ( dt_find_compatible_node(node, NULL, "multiboot,device-tree") ) - d_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; + { + if ( iommu_enabled ) + d_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; + else if ( !direct_map ) + panic("Assign a device but IOMMU and direct-map are all di= sabled\n"); + else + warning_add("Please be sure of having trusted guests, when= doing device assignment without IOMMU protection\n"); + } =20 if ( !dt_property_read_u32(node, "nr_spis", &d_cfg.arch.nr_spis) ) { --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632366746; cv=pass; d=zohomail.com; s=zohoarc; b=em3yqR8X1lMeUNP/WUKAgeb/myvaE0pDkYGH6gL40UN9zkratjaRjoChrgHZ5rTCgm+xwwwq63XKaQsAvWsGhbJ5w6wC1tEZ1EFcE1igPRKilnXAFQGSlOQkheKgHwR97X5eqo6XAaMxe/BHTE6pr/d2peZF1xHjF5Ud+HWoQyM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366746; 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=IvsXP25FrtNtNR/vVLA1gpBc4hkPTM/WhSOqFIm620Q=; b=Jq5+PytK5jgxdquppl+o3l+IEc9MZvJ0tzyJvmb5/1HOtGl1mUOq5klco+ino0xrunDywDYeG4oi7AYhJddqDz23cGP9MuJ8qMqB67k+fOo81U3LLvgt5Lq8dmI/uwdrY5HT1sTWu3Lah7x+b+gXkSOhVe6ZWmq5GaeaO9Fncoo= 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 16323667466528.150623829721098; Wed, 22 Sep 2021 20:12:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193319.344393 (Exim 4.92) (envelope-from ) id 1mTF9f-0006sJ-EK; Thu, 23 Sep 2021 03:12:11 +0000 Received: by outflank-mailman (output) from mailman id 193319.344393; Thu, 23 Sep 2021 03:12:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9f-0006rv-9A; Thu, 23 Sep 2021 03:12:11 +0000 Received: by outflank-mailman (input) for mailman id 193319; Thu, 23 Sep 2021 03:12:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9e-0004kC-BV for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:12:10 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:7d00::620]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d7b3318f-daef-48a0-8d6d-121684e888aa; Thu, 23 Sep 2021 03:11:57 +0000 (UTC) Received: from AS9PR06CA0111.eurprd06.prod.outlook.com (2603:10a6:20b:465::17) by AM5PR0801MB1650.eurprd08.prod.outlook.com (2603:10a6:203:2f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Thu, 23 Sep 2021 03:11:47 +0000 Received: from VE1EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:465:cafe::d4) by AS9PR06CA0111.outlook.office365.com (2603:10a6:20b:465::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:47 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT050.mail.protection.outlook.com (10.152.19.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:47 +0000 Received: ("Tessian outbound 78bf72cc015a:v103"); Thu, 23 Sep 2021 03:11:45 +0000 Received: from fd11e5c1008d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1A0D787A-399B-4616-AB80-4A7C3AA939A5.1; Thu, 23 Sep 2021 03:11:34 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fd11e5c1008d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:34 +0000 Received: from AS9PR06CA0295.eurprd06.prod.outlook.com (2603:10a6:20b:45a::12) by AM6PR08MB3221.eurprd08.prod.outlook.com (2603:10a6:209:49::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Thu, 23 Sep 2021 03:11:33 +0000 Received: from AM5EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45a:cafe::42) by AS9PR06CA0295.outlook.office365.com (2603:10a6:20b:45a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:33 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT023.mail.protection.outlook.com (10.152.16.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:33 +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.14; Thu, 23 Sep 2021 03:11:31 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:30 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:29 +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: d7b3318f-daef-48a0-8d6d-121684e888aa 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=IvsXP25FrtNtNR/vVLA1gpBc4hkPTM/WhSOqFIm620Q=; b=55QgxqE2cFizlZ8kNtpKAh568tZfqhHm2ey89kHnlpZvQUxIPEtL5sGBmTmzdTYu7pPdAD7UIXroCDLXBwz6H5GPisevhKsqK3Xx6LwtI/VNuavLNb5AG2nTqsaBE4SJ1PyOQIezMUnSxwVZPKroAlgeTp14z2RGkekgkEAyj8k= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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: 988e15c28dea971f X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLzx9KM4JSp1NdRqDOXe8Q6BKLxzJlTJRqf0UQ0DmwlSFDcKT56CJJ5d1+6kogBd1FGsWzD8F343u4MaFk71+kcqd93S9gmX9SIyb8W3rMd8mt20sT2JOXqbRjAnoIk1IBj1nhdeciwuOvSzpNcCprTZgJQySbyaAbvemX9eCVx5ZiSvHJPpfqwl01upB7o7wSQXHqymfeEut8/wLodEtZfDPnQFUn1Ta21WFqGwe+4nje6ZOpjmi/yfpirRbRgQMN2DZ7RCSF0c8S+p6sp23A3WMHGn9XEV0pNzvNP/t65/X9z7AbETAwpeZXq3LCy88x/KTwwMssfpW7IdhmRyeA== 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; bh=IvsXP25FrtNtNR/vVLA1gpBc4hkPTM/WhSOqFIm620Q=; b=K5STUHFGi5ZICjkb9l7fa0giC5YJIwXMPV9i0sKzOgBnp0VTO2/byidot0W6jCUAi0v8BFglVVdNIyKX4vE1CNFCCJ+Rw2wo33MbAuAtzF02KOVFgM1aDqZoC5hkrpx9YqtXPcpyNleg18nNTYKeyMyP5bKe3zLLV9l8CuZTG3PXxjTlI1P1MZBsxR2iYxP5g4BkeGmiZWMoDGcTHgO04xL2n2Jbq9ZN2jaRsqVMNy/q0c5hvy/Pwq7ypaN/qx9aj6Ycr8zKvlaKVInJkm39q0BIhY5AXypvyz1ywIGzq2ERDhpVKe4NqiVf3QehmY3Axn9bHV4hIXkIMmNQ3pkgfQ== 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=IvsXP25FrtNtNR/vVLA1gpBc4hkPTM/WhSOqFIm620Q=; b=55QgxqE2cFizlZ8kNtpKAh568tZfqhHm2ey89kHnlpZvQUxIPEtL5sGBmTmzdTYu7pPdAD7UIXroCDLXBwz6H5GPisevhKsqK3Xx6LwtI/VNuavLNb5AG2nTqsaBE4SJ1PyOQIezMUnSxwVZPKroAlgeTp14z2RGkekgkEAyj8k= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 04/11] xen/arm: introduce accessors for vgic dist, cpu, and rdist base addresses Date: Thu, 23 Sep 2021 03:11:08 +0000 Message-ID: <20210923031115.1429719-5-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a3d896b-0906-4419-ddd4-08d97e3fe0fb X-MS-TrafficTypeDiagnostic: AM6PR08MB3221:|AM5PR0801MB1650: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:163;OLM:163; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 3oj82O+hzAwwN+0MZhWDjXpDvx2bWfSrU2AMJiVz+xCzac2sRZY8/N8yVEficc1fb6/VJ55+IE1M6b/XNhFxQ6NjhYh7WAg8bDShvhBaISaeeDPaCTNboXj6tkNdpAQuh+KEVgbmYElWr07GqHpdBQghNh1ZBOY+8LFjgo2/UEnwmyu4265d4FiVySO9njjidb3ZNdFEy2SjtxXIE5/Fr5STDgcNQD27XtRjNJoVr9qs7ckYWbpIDuH+ubbUQbNhhSE4K75y9ZlySUyESWGnFazvXG4jaCl8TCdyqKOB1WS3tzWr/lzhbk9aW/T6S9xbTRDOtKtzi5ID7UMF4pdCnX/LTmLQV7JQgFIdri8Q7Q2TtNm3iL4Fxjh9+G8aDfvT2jzZJoAvRzNDEyJ38y3jNkH1Zj80VR1dM4w5hfhzMZbEeIaejvkTagx2654bN10WZncLt5DW79kT6hruB8k1lJJPJuXs3kcrP1OPoGMU6RrQT50ck4TG3rEqWfPb2SjGUdVmaH8vvkYaFJ4SpMWL3P9Xe95O7/adxbJzFEtvAkIenaXKpi/wX1/TdP4ypdMLPRClb6z9tr6hIfeAl/1Wyw+z/vU4I1U7UGIh3rY5J82laYXBhAtE3/MoZvhZPp83Q9SQ+t/EPUf4YJcfYli+xiaGVAhiJGgdQGccBg0D6B1Xk2uvLEEM8hjnEEIzeRn+yNneQOScmCmnOhuHKOmpDxCHxeUnZdOYLyGFJSIod3A= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(83380400001)(44832011)(26005)(2906002)(5660300002)(2616005)(81166007)(4326008)(336012)(8676002)(70206006)(70586007)(36756003)(110136005)(54906003)(356005)(508600001)(7696005)(1076003)(186003)(8936002)(82310400003)(36860700001)(426003)(47076005)(6666004)(316002)(86362001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3221 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: e09a20f9-2044-4964-ab9d-08d97e3fd89e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WGI6Mv/R8w+zpoI9En/0iMdIRs0ImFzletsm3W3349YfDALldtd6QdjrccedLsXpxGm/N7nIHSWpm9vvv83bwUMGJ2psCp9zSzmrTS5d45G6yV8JQAzr2h+bU+s6/HlaCVdkfNOHVsbFqHbpXbKnAyLaiP9IeZmP2AhBJ23GdmLt3z5zZ4NO80rhlkFQ9D7ZpXn3Og8Q9j4dEIuwIWU6Iu3oO0rC7Nje7mbA8TmXzgSMvRfUmm7xdrKKezAULDfPSpG1nafg9EUdGDi3VXmnheZkl23hfJJ2x1C5XpEH3XPzSB8mlOQZbjAX1jOb0aEd4CN6kWuGxIXmHnxaquKjUANJLV3Y7zZ6R5IfLSpqxkvVg76OAoecYB9bzS3Qm1d/TO2bcOI1tyOwLWamiIG+BB2OB5U+SeVhP9QJJLLj+5PWfdAFGa7aFYuMBHwm9bsF6FGPMlXXrtPAosuTgfmki7KMHeQqZHDXgmPR2xz3C6oJAgc9bCwvqfoWRCXaxhT9TdAo6BKAODsalWVYOSlynYoyksr16zgZRiEX1rhbYLxC47EgN1dIe7Vd3+aRUwY7cV1mOrxnvyRTk7+RMV7W7ambwncwKqZjiKoFmbTSBy/w/3pdGM33msw/SmdudQhbxHw+FiGSG2fcU1/9rFu+rq00H/DPamJFNPzEpiamBOHTsPhzPTrCNWv3A97C1JMCcl/vj307E3xI5KJ/ErSsdg== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(336012)(426003)(2616005)(2906002)(8936002)(6666004)(5660300002)(110136005)(47076005)(508600001)(81166007)(83380400001)(8676002)(4326008)(36860700001)(7696005)(316002)(44832011)(186003)(1076003)(86362001)(36756003)(26005)(82310400003)(70586007)(54906003)(70206006);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:47.1228 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a3d896b-0906-4419-ddd4-08d97e3fe0fb 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: VE1EUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1650 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366747645100001 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini Introduce accessors for vgic dist, cpu, and rdist base addresses, on all gic types. Use the accessors when making gic node for device tree of domU. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng --- xen/arch/arm/domain_build.c | 21 ++++++++++++----- xen/include/asm-arm/new_vgic.h | 24 ++++++++++++++++++++ xen/include/asm-arm/vgic.h | 41 ++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 213ad017dc..d5f201f73e 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1802,8 +1802,12 @@ 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; + struct domain *d =3D kinfo->d; + 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 @@ -1825,9 +1829,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) @@ -1852,8 +1856,12 @@ static int __init make_gicv3_domU_node(struct kernel= _info *kinfo) int res =3D 0; __be32 reg[(GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) * 2]; __be32 *cells; + struct domain *d =3D kinfo->d; + char buf[38]; =20 - res =3D fdt_begin_node(fdt, "interrupt-controller@"__stringify(GUEST_G= ICV3_GICD_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 @@ -1875,9 +1883,10 @@ static int __init make_gicv3_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_GICV3_GICD_BASE, GUEST_GICV3_GICD_SIZE); + vgic_dist_base(&d->arch.vgic), GUEST_GICV3_GICD_SIZ= E); dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_C= ELLS, - GUEST_GICV3_GICR0_BASE, GUEST_GICV3_GICR0_SIZE); + vgic_rdist_base(&d->arch.vgic, 0), + vgic_rdist_size(&d->arch.vgic, 0)); =20 res =3D fdt_property(fdt, "reg", reg, sizeof(reg)); if (res) diff --git a/xen/include/asm-arm/new_vgic.h b/xen/include/asm-arm/new_vgic.h index 97d622bff6..9097522b27 100644 --- a/xen/include/asm-arm/new_vgic.h +++ b/xen/include/asm-arm/new_vgic.h @@ -186,6 +186,30 @@ struct vgic_cpu { uint32_t num_id_bits; }; =20 +static inline paddr_t vgic_cpu_base(struct vgic_dist *vgic) +{ + return GUEST_GICC_BASE; +} + +static inline paddr_t vgic_dist_base(struct vgic_dist *vgic) +{ + return GUEST_GICD_BASE; +} + +static inline unsigned int vgic_rdist_nr(struct vgic_dist *vgic) +{ + return 0; +} + +static inline paddr_t vgic_rdist_base(struct vgic_dist *vgic, unsigned int= i) +{ + return INVALID_PADDR; +} + +static inline paddr_t vgic_rdist_size(struct vgic_dist *vgic, unsigned int= i) +{ + return 0; +} #endif /* __ASM_ARM_NEW_VGIC_H */ =20 /* diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index 62c2ae538d..e1bc5113da 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -277,6 +277,47 @@ enum gic_sgi_mode; */ #define REG_RANK_INDEX(b, n, s) ((((n) >> s) & ((b)-1)) % 32) =20 +static inline paddr_t vgic_cpu_base(struct vgic_dist *vgic) +{ + return GUEST_GICC_BASE; +} + +static inline paddr_t vgic_dist_base(struct vgic_dist *vgic) +{ + return GUEST_GICD_BASE; +} + +#ifdef CONFIG_GICV3 +static inline unsigned int vgic_rdist_nr(struct vgic_dist *vgic) +{ + return GUEST_GICV3_RDIST_REGIONS; +} + +static inline paddr_t vgic_rdist_base(struct vgic_dist *vgic, unsigned int= i) +{ + return GUEST_GICV3_GICR0_BASE; +} + +static inline paddr_t vgic_rdist_size(struct vgic_dist *vgic, unsigned int= i) +{ + return GUEST_GICV3_GICR0_SIZE; +} +#else +static inline unsigned int vgic_rdist_nr(struct vgic_dist *vgic) +{ + return 0; +} + +static inline paddr_t vgic_rdist_base(struct vgic_dist *vgic, unsigned int= i) +{ + return INVALID_PADDR; +} + +static inline paddr_t vgic_rdist_size(struct vgic_dist *vgic, unsigned int= i) +{ + return INVALID_PADDR; +} +#endif =20 extern struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int virq= ); extern void vgic_remove_irq_from_queues(struct vcpu *v, struct pending_irq= *p); --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632366733; cv=pass; d=zohomail.com; s=zohoarc; b=hERs6c6r8EjcX/gbrQwO7agBpeV2IV+Y/EAk82fYOdfADombSUtZnTEzhXLw8o0tVLlqUAlvI+cKvO6btrjL7LcFZnJu+9KhhRDgyTNHHQgfjFuZ+mluT5uCvgH5m8uMnSXz0QfpXOaBY/N7dfm+Uq1iCdaSKiULxsPFpkKLjVw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366733; 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=8mymiVU6RzNe2URN+GFVNzglxdb0Bxcz77lG7C4aSLI=; b=BkHdu4mguTWZnHBO2d1ktj0B2aEuz2ND4ytR0blZsjrwKpeeItMl5kp2Hg6UrLBvh2MZAJPw0kP7S6eAsGTACIN/EZyVYwf6A4TTWa0dZu6V4VnSlLgNBKFDd+oH4CmKAQH5EA3VZOR19bdWmWVCzMaEFAB06sBaPjTe56dw9X4= 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 163236673333138.905193763139096; Wed, 22 Sep 2021 20:12:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193310.344327 (Exim 4.92) (envelope-from ) id 1mTF9K-0004RQ-VR; Thu, 23 Sep 2021 03:11:50 +0000 Received: by outflank-mailman (output) from mailman id 193310.344327; Thu, 23 Sep 2021 03:11:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9K-0004RJ-S0; Thu, 23 Sep 2021 03:11:50 +0000 Received: by outflank-mailman (input) for mailman id 193310; Thu, 23 Sep 2021 03:11:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9J-0004Qj-IH for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:11:49 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (unknown [40.107.1.50]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fcac06c7-1c1b-11ec-ba0a-12813bfff9fa; Thu, 23 Sep 2021 03:11:48 +0000 (UTC) Received: from AM6PR0502CA0045.eurprd05.prod.outlook.com (2603:10a6:20b:56::22) by AM6PR08MB3301.eurprd08.prod.outlook.com (2603:10a6:209:47::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:45 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::61) by AM6PR0502CA0045.outlook.office365.com (2603:10a6:20b:56::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15 via Frontend Transport; Thu, 23 Sep 2021 03:11:45 +0000 Received: from 64aa7808-outbound-2.mta.getcheckrecipient.com (63.33.187.114) 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.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:45 +0000 Received: ("Tessian outbound c9f4ff96a6ad:v103"); Thu, 23 Sep 2021 03:11:44 +0000 Received: from 7c3ccbc109e1.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3601AE50-2D27-433A-9DD1-36EFAED7F40C.1; Thu, 23 Sep 2021 03:11:37 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7c3ccbc109e1.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:37 +0000 Received: from AM5PR1001CA0044.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::21) by HE1PR0802MB2300.eurprd08.prod.outlook.com (2603:10a6:3:c5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.17; Thu, 23 Sep 2021 03:11:35 +0000 Received: from VE1EUR03FT046.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:15:cafe::20) by AM5PR1001CA0044.outlook.office365.com (2603:10a6:206:15::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:35 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT046.mail.protection.outlook.com (10.152.19.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:35 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:33 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:31 +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: fcac06c7-1c1b-11ec-ba0a-12813bfff9fa 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=8mymiVU6RzNe2URN+GFVNzglxdb0Bxcz77lG7C4aSLI=; b=dxA0TeTBVgUDOEWhgjUD7WpUCdGHpIG0fdiIBqQueFcErs6GiHr6N34IvznhF2mocSJFrS1Imsm3INSOTicGcbEvSm/PMmdzdyvpdxasMWptvh0t0jqFpqaYQjigg5Lfqu2qBQ79rx6kK2lWwiivilLybPDHlrJjlF6NiaIu8xw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.33.187.114) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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.33.187.114 as permitted sender) receiver=protection.outlook.com; client-ip=63.33.187.114; helo=64aa7808-outbound-2.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 78d99569b4e49507 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kp7JW3SPkZTY5hxQi8HAeL0s7uw8wnulE0FaPPL8AjcvN0DrZoKlufiGxpu9UKXI09K3q9J+y70unC9EFlYkqlWDQXHcLlYcFakMHcCFY/hANqI2+/29MbNiq8Om+F/ytolv9hTyWlKxRADUDP14ef01+JvR1b6+5C94zcvBjQTq0uV4q8k+Ixlblvmwy64kJIPyUB9sGtArg1HHK2cPbA4eSOz+yVOIcGuWI3udj5nei6slZH2P6ZRquHT7P7j8d/tJf+hzOzxlPau02UIuxUif695u90IX2k4ZSUYVusW84+5Q5m2xTiXYPQi3QvHYxx/g2r3FDBMSqe8CPID5IA== 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; bh=8mymiVU6RzNe2URN+GFVNzglxdb0Bxcz77lG7C4aSLI=; b=TCiv/3ClcRi+R9WXzCpnoN3MYeWqX5KUQeED5q7b9AwXS/WIG4mElCxKsQb4RWW8Iw03BbL+ATCIiaeYcxiiPt6FFCDvzgsSz0cdB5oDuUkuN307Gh8ZxD0KlBS52Ax4T2byVXjOiGUdA37BUzV3ydPBaeGQXe+UgdMrtBsKklZN8dEpKhQ9oqsZzLaY+oRE7Y7lr46AjavlSdRkw3GuHBmqdUdjDtNzFevfWgw0UvCGbsI1DWWgHKBBGhtUAU9Oe07fxs+m7ot18IFmrKYw7BEyY2KcQd3jaiETPoAkqPz/oKqr2YRVwufmNq448qqc2Opwi81t3LdvNLlSUS5Xgg== 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=8mymiVU6RzNe2URN+GFVNzglxdb0Bxcz77lG7C4aSLI=; b=dxA0TeTBVgUDOEWhgjUD7WpUCdGHpIG0fdiIBqQueFcErs6GiHr6N34IvznhF2mocSJFrS1Imsm3INSOTicGcbEvSm/PMmdzdyvpdxasMWptvh0t0jqFpqaYQjigg5Lfqu2qBQ79rx6kK2lWwiivilLybPDHlrJjlF6NiaIu8xw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 05/11] xen/arm: vgic: introduce vgic.cbase Date: Thu, 23 Sep 2021 03:11:09 +0000 Message-ID: <20210923031115.1429719-6-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44e16a65-030b-4bfe-3ac7-08d97e3fdfe5 X-MS-TrafficTypeDiagnostic: HE1PR0802MB2300:|AM6PR08MB3301: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6790;OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0DVkdkx1a7AggDmFp3WKDFBdv2YkJ7Juar9krB/+s6hCz3JySXZv6AtIHDPw9pwFWwdDthDdantcFNtUoQIjbaVZr6hSuHRpC6CMu2tZvZ9ie4y7VBjwKEDvDrYYydLH9r4z4Y3GBmziLPySaP+Yh2kbjzfWRzXuTts6n+T2qq1y0749Sv0uU/BGvSSZHFBwGPSId0fEefZTJLRTRQK/JYkxTQ1HsEt0oitVN0CCt8Lv4SsTrOsKJPhKoTbePRULUtm4OXBLvRDUjonYNJHzk/hh737zNLfoLbmKw4MBs/EFY/qo9R4eDBdH3x35p3XvnrgTSU+h1O+L1D4XWOvAeuZV0hZVHiBCLiE349N4d48UR3KeW0/VQNZZL3qJ+kbWsJ7qjhDMkzlxTFAvH/TgzxfGCsT0HEQA9iAlBUa5l1rXVnLoH7nh/RJ74Sc5J7/EsEBWm7jDPmBBDi8h3v7jOfLLtM5soY7NYsfgiPiZOKcc0oTG9LBYq9sC8tBFjhbibqLGDjRVeERldBJd4S8hlS6Ib94ra5KInZfVV29vfun3EJYvfvOfShRw1T/Rq6MDYve2dFTL9RkUWEw6acUjk/zr6a9DWANwuc9AO1EzaOXI+fd4XeLlSgZWKMmMBZxNq38ViMjm3cEInq1Ac1J4+Ylw2XDECJ5QpNzUz1g4aLMkcVjPO9EsVOCnT57QFofoW82+uB5sh/kNS22MhN/EqadvkfRJIaQta8U0gH40Tbo= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(86362001)(2616005)(47076005)(36860700001)(81166007)(26005)(7696005)(36756003)(356005)(508600001)(8936002)(186003)(83380400001)(110136005)(70206006)(8676002)(44832011)(426003)(54906003)(336012)(4326008)(1076003)(6666004)(2906002)(82310400003)(70586007)(316002)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2300 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 413c93a0-b8ba-4117-b2d3-08d97e3fd9db X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ssivSYRW/dvVt5d8EiHGb5YaRrbbDmchSLxVgoD9BheiAJ0aAr35JUaf+GXEqMPOtjzg2IBeEMGPfzgOCygdBtrng++wlmHL09FmalHks7MHKOcFevm16CbjhksQijn/S2H0Y1KR7SRaATKbjFma3nzORHIAlgOIxck+o56+c3R8QhcIrI+biQNPN8yMh8K4od16kkPrvtSkAIsLKnp08eA+eGZ4jOKjG997UjpzlAZO9MoBQWc5kELtONuLGQIea+TCvSlGlXBky1H6Wq6kq2tj5Z5zr8oUwBObgKhBN8mzBI6M3VcChLxY0mNJ7WhMI0Qyngyrcwl2RuY20HTzTDHBw2c2zSHGpzYpHfFc69REuEEd6vOmM1Omkf6gk4iHZr3/xAqmkx9CrrYXQvxct6eeB3Nv0VLdf3NlkMXFXa/dO2aNkytmzuZZ6VVAtSDwbQAslJXf6qT/PyYuBBXXSyd8RKeRZydyJ97S09bk8RaqOWaWZ0jj3HAV5cgzkPaD/D8Yz+EpcLSJx6UQUtcbVfhqSuTyEb6MAynUDQ/CTHWkkqk9asPMIC4d5+s5TrnPvl4idCUOLbMvvJ+OGlIDAcmwTFTU8CHCOoA9ZtmUrgCb1//IAJQEIoRtsAQI0PexWdsXfMSuXP0Kag55x/3JJGzCPCynU4ucRrndEOwbuomNYdtj0ixJDJyByBNJB6Xqo2cd8ONH0QsThETQ//Qp4A== X-Forefront-Antispam-Report: CIP:63.33.187.114;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-2.mta.getcheckrecipient.com;PTR:ec2-63-33-187-114.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(508600001)(54906003)(8676002)(70206006)(83380400001)(316002)(426003)(26005)(82310400003)(336012)(110136005)(7696005)(70586007)(44832011)(2616005)(5660300002)(186003)(36756003)(81166007)(47076005)(86362001)(1076003)(36860700001)(2906002)(8936002)(6666004)(4326008);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:45.3373 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44e16a65-030b-4bfe-3ac7-08d97e3fdfe5 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.33.187.114];Helo=[64aa7808-outbound-2.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: AM6PR08MB3301 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366734679100001 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini Add a field in struct vgic_dist to store the cpu interface base address, similar to the existing dbase field. Use the field in vgic_v2_domain_init, instead of original local variable. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng --- xen/arch/arm/vgic-v2.c | 10 +++++----- xen/include/asm-arm/vgic.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index b2da886adc..b34ec88106 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -652,7 +652,7 @@ 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 /* @@ -669,7 +669,7 @@ 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; } @@ -683,7 +683,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; } @@ -692,8 +692,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/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index e1bc5113da..d5ad1f387b 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/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 */ --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632366760; cv=pass; d=zohomail.com; s=zohoarc; b=cHdvyBhUi3Fjyao6iinT87xMyfHrPZB2RLa/3NThUNmpeLVRVUa9kFXd/zDT4Q6rTUKcPeTAZTbkFbMYd4YZHGgrsz/Y92nfL4s2AdCH/h04IxqPkjbq5lmHawJrXwWTVVfdRDlnXcNnL7qY9c5Zc2wGz9VGMzh8hOlNQJRCfVw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366760; 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=qC0WX9sJbstRrjXlzSjejZBynjOxc/CK8y9qTDR6lQ4=; b=Yblnnh1MqYpMbS0GK7G306K6PqeVap59ciSKSS2rYxZr0sf8itHZeukOWMJzFIzvE3nqCBuSRJpt6ewjENPYETtWRfRwKyz77vcMYhhJjXD4iC7ib52WLszSAL8ZDRaCxXWyRZqMm802l5sBbAWrPh4/nOQimJmT6KOyDQ+5ryI= 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 1632366760025753.6815738268126; Wed, 22 Sep 2021 20:12:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193328.344415 (Exim 4.92) (envelope-from ) id 1mTF9u-0000AB-Bt; Thu, 23 Sep 2021 03:12:26 +0000 Received: by outflank-mailman (output) from mailman id 193328.344415; Thu, 23 Sep 2021 03:12:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9u-00009n-7B; Thu, 23 Sep 2021 03:12:26 +0000 Received: by outflank-mailman (input) for mailman id 193328; Thu, 23 Sep 2021 03:12:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9t-0004kC-CQ for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:12:25 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (unknown [40.107.1.63]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3eef12a7-de91-4816-ab8e-198bc8c41755; Thu, 23 Sep 2021 03:12:02 +0000 (UTC) Received: from DB6PR07CA0054.eurprd07.prod.outlook.com (2603:10a6:6:2a::16) by VI1PR08MB4573.eurprd08.prod.outlook.com (2603:10a6:803:e7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Thu, 23 Sep 2021 03:11:58 +0000 Received: from DB5EUR03FT016.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2a:cafe::50) by DB6PR07CA0054.outlook.office365.com (2603:10a6:6:2a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.7 via Frontend Transport; Thu, 23 Sep 2021 03:11:58 +0000 Received: from 64aa7808-outbound-2.mta.getcheckrecipient.com (63.33.187.114) by DB5EUR03FT016.mail.protection.outlook.com (10.152.20.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:58 +0000 Received: ("Tessian outbound b324a1dbd9be:v103"); Thu, 23 Sep 2021 03:11:57 +0000 Received: from 198723602d40.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F9D104AC-E4B8-4AFA-86B6-D6B946F524CE.1; Thu, 23 Sep 2021 03:11:46 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 198723602d40.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:46 +0000 Received: from AM6P195CA0016.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::29) by AM0PR08MB5153.eurprd08.prod.outlook.com (2603:10a6:208:163::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:37 +0000 Received: from AM5EUR03FT021.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:81:cafe::35) by AM6P195CA0016.outlook.office365.com (2603:10a6:209:81::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:37 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT021.mail.protection.outlook.com (10.152.16.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:37 +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.14; Thu, 23 Sep 2021 03:11:36 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:35 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:34 +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: 3eef12a7-de91-4816-ab8e-198bc8c41755 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=qC0WX9sJbstRrjXlzSjejZBynjOxc/CK8y9qTDR6lQ4=; b=Gfs4QB5l8MAA0dweywDLLlgFiSLA2/af2fo75Ni1hwK/0nc+4YFdMpa+r6jvArtfXllOEO9A/39VUJFykBbZFZZXx0sEhn1+Q6daBkUgBX4ejafzwGaiKj8VWrNe7KdGS7VLNZ9Wku10UUl/ylz7DlJhDAnbCGjmRBUyNqmx0mw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.33.187.114) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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.33.187.114 as permitted sender) receiver=protection.outlook.com; client-ip=63.33.187.114; helo=64aa7808-outbound-2.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: eb2696ad9cb63629 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PxXRhu7kduSPdz13U+dMnxRE6p4Yw0a1TbfNuvbJFtDLttKzocU4WnaxLb1ocJS6zrGcXiCWMoTCYgm2pjmkxB09Vu0TRg9cvZJZSPtqeWUtfgalqlmXKI6inwmpEXMYv+4QWh5nYWlNvvG4LXxnKPUMvOcyKgOb/fuQLg8nZql7MkhL92nlWyaZc4/NBtUA0PDeFE7let5ha1QVHCEoFZex2168adlyzeA/XmMLreW11w1vg8urwLjWtl0hqLIra+D9Y7vjS8zsuhKoal82HcZ6/ksTblFdfvVjY806cLa6dsQBCxbmIdmBxv3udTVrYr7JxF0bNAO7FZyAgvg89Q== 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; bh=qC0WX9sJbstRrjXlzSjejZBynjOxc/CK8y9qTDR6lQ4=; b=kFknQQB/tiF61OPW+ctwU2+t2YP49sbpNus/4Fv90UhC3uDKrVdqJS0INicbYoJiP4pJGSrW6CNM5IdZF6wcY8wGQ+jaYMKXdJXpU/VCnbu13GxLOHkvL8JU0GxPCHGnavw7fom15zUaj3V+O/Mc8VJuLzwAwprhX1vSVjc/57/HGo0ltowpKrLh5m8gQK2z2JHvrYwE88ZMwWWqJArwFI6vLnEY/qz/dbwjLFDV0GaB79y148Js/k0IfXjRMH7DqOaY2CsRef/B9X+/C7EffWJf48fXfmoEnJy69zn+bHdzXxWmN0duDW8qsn6SwxAU0ZGN2prTU7fuOjJf57GYFg== 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=qC0WX9sJbstRrjXlzSjejZBynjOxc/CK8y9qTDR6lQ4=; b=Gfs4QB5l8MAA0dweywDLLlgFiSLA2/af2fo75Ni1hwK/0nc+4YFdMpa+r6jvArtfXllOEO9A/39VUJFykBbZFZZXx0sEhn1+Q6daBkUgBX4ejafzwGaiKj8VWrNe7KdGS7VLNZ9Wku10UUl/ylz7DlJhDAnbCGjmRBUyNqmx0mw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 06/11] xen/arm: new vgic: update vgic_cpu_base Date: Thu, 23 Sep 2021 03:11:10 +0000 Message-ID: <20210923031115.1429719-7-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b464054-658e-4d32-8440-08d97e3fe794 X-MS-TrafficTypeDiagnostic: AM0PR08MB5153:|VI1PR08MB4573: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6108;OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 4M0NxTjWlG1Ilt6az62awmewDr3GItBbAXJHmqHmB/cxObbHKzfmFn3mul+vTirRds0AXVJfnLbselQdSkaXQcre/gs0hwnyZT6OML7IW1CtB7hqhbIbKEt8vQStDTrgrSi48zPxG1vWiT/wFM4Fu6UlLd+3jOm5QnCKmKJNNHUWi3jC9gKAAQdUCHdG912HlSFMsrtCa3G/49OhEkMOYxracn1bHFQ74M/SOKCDCRq6jeGp2JuoewLZq4/lGi1WWNvUl4cYUuDynFCkG1que+I86HqjCk9bfLZ0O76GuBxcXT4xv63wklxAVDOCdDpKCZ/IA291T6be3Iq9XsXoY825v7XMhwGEZ38VXIr7M/jRs6LWfHQUoTdJppbYRxSC3xG9sXY0wO8PSxUh+ylUJQ/d914U3WqakO5imbDtOPiDKBtY2CiBGKQqmhhOtYR8vS4lF3Vaje7horSPDcR2BdzrojJoJlw5UOn7NDbdG5GhYhpoEC0igSoNuRqIsiXY4JOWeVfMcURVqCWTAecQOKYIV9azpEi6dogn/q0EwqKzDN71eFlvLqtg4BTDDiGm3t8K6i1fQ8v1TY8Tr/Vy2MNj3JoO5y/1CPlYCAJcNlu/qozb0P0K9gR3iSjyTwawlS5oB/c2S9eZN/8X8bT55cTdN8AC11DtQ1rvxYLSqgQSKP21FiyfutgBj67rKeJEGDxa1Qk+Yok0FQ6ZF765DjGyGpahUTm03e1s6wJj6EM= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(44832011)(316002)(2616005)(1076003)(54906003)(110136005)(8676002)(426003)(336012)(82310400003)(508600001)(5660300002)(70206006)(81166007)(356005)(70586007)(7696005)(8936002)(186003)(83380400001)(4326008)(86362001)(36860700001)(26005)(47076005)(2906002)(6666004)(36756003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5153 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 3f7393c9-fdd9-4779-f8f4-08d97e3fdb28 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lpmazvuv7ipXPDHPZv3SEPH25U5DLAB3SNflQiGP1x8PQwoB0USRVfE6o5U494AVO3JqVPA0zZZDRRwcDe2Zxc/7xAbxmPuAkd1YQWWm+k1DOikZLmfr89DJOcOBn+D/PUS0Q3ScXOvwvfMwnynwiez/WFQcUoszbTsDBo38sTqpGETkXLf2L5IFqQr3y6D5g9lE4ZfCwmgjLh6JjIft92hci1fAjY/Y6eF3ccarcpbVGTHNS2EeQiaqIccqWJqTDrGpSh0ferrRPNEoFKjWtn9zg4i2BPEIG8KHmRjic5lT98LUuhIaIKlLndtNwWE1rAJn7KP+bBB6qymz633Lsx7VDeQk/rKvjd8FzBdVsSnifqJ0ld7rnSSTjW5UBL9IWMBvB5pChO7FwfX4kUHLRsX91y35xSUrgPYXWVKybGIa719oKft7akmtXa3wIqyTdF65AnQu82Xz0AdkbwX1lUv76y+QhH9WBIwB0yMFd5I0BPcJBcbyUjyECpXSZ1ElFV0IctCttqMvwo3Lf+fjKsyxivF5xbirvpzc+Yjp8aDcdTuRSoSdJOQJSrVW0C9vEFI0x4kpcwmnaR7x6VGpRGS+0wKilfov8Qf6yksBH7u8hak1Za84vO2ZnG8sk16eoF6uqJKb2dZ2JTQAjL7ZgO/iWI+ZxPHhbAZW1twS7+Lz8gaw4PoYA1+y3pk3HYBNEdPkXikVjmPRd7F34sVTiA== X-Forefront-Antispam-Report: CIP:63.33.187.114;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-2.mta.getcheckrecipient.com;PTR:ec2-63-33-187-114.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(36860700001)(86362001)(5660300002)(82310400003)(316002)(26005)(70586007)(7696005)(83380400001)(8936002)(44832011)(508600001)(1076003)(336012)(4326008)(2616005)(426003)(81166007)(2906002)(47076005)(186003)(70206006)(8676002)(110136005)(6666004)(54906003)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:58.2885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b464054-658e-4d32-8440-08d97e3fe794 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.33.187.114];Helo=[64aa7808-outbound-2.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4573 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366762203100001 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini In vgic_v2_map_resources, use the new vgic_cpu_base field of struct vgic_dist instead of original local variable. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng --- xen/arch/arm/vgic/vgic-v2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/vgic/vgic-v2.c b/xen/arch/arm/vgic/vgic-v2.c index b5ba4ace87..fd452fcb5a 100644 --- a/xen/arch/arm/vgic/vgic-v2.c +++ b/xen/arch/arm/vgic/vgic-v2.c @@ -258,7 +258,7 @@ 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 @@ -276,7 +276,7 @@ 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; } @@ -290,7 +290,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 +308,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 Fri Nov 29 16:33:41 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=1632366732; cv=pass; d=zohomail.com; s=zohoarc; b=NLIaE2J9cxsy5zzjfQ3ifhgfZcSR6wPu++1Z2CSrRjEAyovLNdT8aNWJqiA/Aw2qgEDXEkMXzqMbauj97TZ7QYvz09X8Jmx3VGHFSfFcTPT3ysF2YUiTppE2s2oTzHw3+lo+yWdnVVPQOE5E2B1PnabLZZSnxWShnvlbcAbam9Q= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366732; 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=e41YLk3dIbgdmwmpIt94ilkD1EszsH0czIzcF48m2hU=; b=haSTAVLZ5UlIgtmqzL533i+tulre5YN2Yz95sVvr8Xllabl8lEb8t1xrTcsry4eknMpI+dthu1vG0XXi0reh/uLhxg53oK3thyDN6gcq+a9m33DptTo9+pCdHAF4qUselHvyKJwh9xM6OZ9B5b68vJkjJqvKmhrVPDQADsUOsMw= 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 1632366732850886.9872605691361; Wed, 22 Sep 2021 20:12:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193313.344349 (Exim 4.92) (envelope-from ) id 1mTF9S-00054T-MK; Thu, 23 Sep 2021 03:11:58 +0000 Received: by outflank-mailman (output) from mailman id 193313.344349; Thu, 23 Sep 2021 03:11:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9S-00054G-HY; Thu, 23 Sep 2021 03:11:58 +0000 Received: by outflank-mailman (input) for mailman id 193313; Thu, 23 Sep 2021 03:11:56 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9Q-0004kC-Mt for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:11:56 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:fe07::623]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 778e0bce-ad3f-4456-8a34-228c3e56888f; Thu, 23 Sep 2021 03:11:54 +0000 (UTC) Received: from DB6PR07CA0101.eurprd07.prod.outlook.com (2603:10a6:6:2c::15) by PA4PR08MB5887.eurprd08.prod.outlook.com (2603:10a6:102:f2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:53 +0000 Received: from DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2c:cafe::30) by DB6PR07CA0101.outlook.office365.com (2603:10a6:6:2c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Thu, 23 Sep 2021 03:11:53 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT060.mail.protection.outlook.com (10.152.21.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:53 +0000 Received: ("Tessian outbound 78bf72cc015a:v103"); Thu, 23 Sep 2021 03:11:52 +0000 Received: from 91027c4583da.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0A2E9B97-84CC-48F1-B068-6DF3A2608A30.1; Thu, 23 Sep 2021 03:11:45 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 91027c4583da.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:45 +0000 Received: from AS9PR06CA0264.eurprd06.prod.outlook.com (2603:10a6:20b:45f::9) by AM0PR08MB3137.eurprd08.prod.outlook.com (2603:10a6:208:64::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:43 +0000 Received: from VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45f:cafe::cd) by AS9PR06CA0264.outlook.office365.com (2603:10a6:20b:45f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:43 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT035.mail.protection.outlook.com (10.152.18.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:43 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:38 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:36 +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: 778e0bce-ad3f-4456-8a34-228c3e56888f 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=e41YLk3dIbgdmwmpIt94ilkD1EszsH0czIzcF48m2hU=; b=DpeA9lX6eC9cJYKShAaXaM0mb2wSy4r7+a/sgcrVzireNfDh9QhtjsyEMQr98V1+/tsw2J6MSJA6M9feJfJtofmubAdRkusSnO1QgTWFF5rqmb3mrHh9/B1T6AfvHNGEgBBkS6rp+lAEFclfPn9rJOyTTM2wzAMsL/NC2g2KQaE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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: 2e3f64499d581046 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lOgeWG4uMUCwoCIp0NFyr9RuM1AhSE6MHUBa89vTqSxCSDJJWPulZqY9vCZaMkMiH7wGCD40UWDWQ28FlqVU8fCoaaJL+DR9TFDTemRo4MGMCHXsHrROUdyJFLnBxjvarRur9/+QEmBMarM2i0RHdG7ZehXvrQxJy4JamRNyuED4Nsf4EfF+zbkUr7hfulHYJCIWs7/9S9/A+A3zE9U19QeE4jh/0S7+j3N2cvKYo2W/D/uurZ/Opg/IS104+zPqcqybEfWUSoUi/TYwHBZ4thrxLlxvdGmUQd8QhhHtiSgRivX6OTYJo4l2OTSzNPvsefoxsp4JNIXrSBCcEnlfjg== 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; bh=e41YLk3dIbgdmwmpIt94ilkD1EszsH0czIzcF48m2hU=; b=jYzuEPIVgk3hWoT0P6/rYgZfZlkV+qQJ1W7E/Kw5WhvuSgk15Y1PqJDXKEALKXjARQ6OSKLSzDU8n2RX0I/e9lKDnLlbU20+QEWG4Ipzp6rmWRIDP1ILpgMqQS7zipCykZ/bPHyjOi4sMVk+aZbmftI6YlHwueryphYqLBvCUPuUPzgjac13Q2Ehm6g7UFRykS27O5H6/5UL/AJPPZvl5n+X7FN9YN2PfXA6sA3FXGO0EtodaMllcg+rbJFCJUKNT7o2BmJb591sOBEDaN75PUZHIHlBGCX1LxSuYGng8r549y5bM8jvMwsh7GQRCFWlw35ciBNWnRzBjpsr8qJblg== 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=e41YLk3dIbgdmwmpIt94ilkD1EszsH0czIzcF48m2hU=; b=DpeA9lX6eC9cJYKShAaXaM0mb2wSy4r7+a/sgcrVzireNfDh9QhtjsyEMQr98V1+/tsw2J6MSJA6M9feJfJtofmubAdRkusSnO1QgTWFF5rqmb3mrHh9/B1T6AfvHNGEgBBkS6rp+lAEFclfPn9rJOyTTM2wzAMsL/NC2g2KQaE= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 07/11] xen/arm: if 1:1 direct-map domain use native addresses for GICv2 Date: Thu, 23 Sep 2021 03:11:11 +0000 Message-ID: <20210923031115.1429719-8-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6142d902-90fa-4d54-2c0e-08d97e3fe47a X-MS-TrafficTypeDiagnostic: AM0PR08MB3137:|PA4PR08MB5887: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: FLiKy1Ir1H1QB01hK7TC2sRyFE97xkd/sUGW2vJEg9VBp+lbrcJs9sV7PvWJTcNIU08VsDlCVD6AsXQ/UdiwiWrBH424rHh2xwokZk333SW0wUubIWSpCg8MIbuqL4UimhGBjR+CxeAi6IzZyrsMEq389TRKo53ETecWGgnBWxY9+ZOUr1EUIo9mOQ+rKM+zwUOpsK54FPW2ndtY2cmc9guostmSV+Qx6cQRQ5/DJcRi1FBk01mxfe2FjOuKyuKDrVPKXf1Q+7drg+ZgZlXbcMFeeRGajd9TYv/iw4QueIGEQthYUynawkV+ZoXk2YCNl7Au1GuDgSkkTx6NYG+x6Umfp+Wfn/HuTqqth2sCimWtEiD4XH5NMLarTQDVJA4YB2Pf237JPrVCsJccl3iw0sbke2TBD1h7wGpJ6vOhXjDMRE0V+HfDOhjPXsjRmodmOLU9+ZaFcd68ePGmoer052B3hBlnlVfNPqaEfqfyv7uZ0CxHsEZNQ+V8K0NdVBbE1ivwC6hGn/9EXnSPtFseV0Pl9lJozAs0n/csyhLsIgCqIZLpKlnqSUoCfwIsKQf7oY4CHOJyQ2MqRG6vQ5HFuonn2VwMxDFVK2fv8o0kTCwUtB2W9pZCW+aZY8F4jbITLr3w1jIQAA212vTaxnedX1BEVCxE8WNn2/K3S0jek35MMJ8QL8RKUlgiZlfhHeM889HIssstCuGg2bLgOwvWmSDY5gXkgAH5AtNc+xguVgM= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(47076005)(2906002)(2616005)(1076003)(36756003)(82310400003)(4326008)(316002)(54906003)(5660300002)(8936002)(426003)(356005)(508600001)(26005)(6666004)(7696005)(86362001)(36860700001)(70586007)(186003)(8676002)(81166007)(70206006)(44832011)(83380400001)(336012)(110136005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3137 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 1c52c898-0a8f-42ee-5ee4-08d97e3fdece X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jb2aR2oLJpNDTd2Tej4BUq0E7WiabSnCIXC1K01W1KfpFLOH2Zls0ngOIBzaGodYcA5mdeKxhB6I1J9SWDwbo34gTml/YYpGaurmJb75sMlizWlBTvC4il1eqF7A1QhcuLczXZ4DNGSsyxG6Ig8otGhaWGcV0gEODf+k2+tK1jbaBuYAstTzO037+dGzdlIvIwwaivMw6bsabErx2TEcg2pwIVjODnO9dyVxKK5T9dg5FTgR0pEsXJUVnNgZwegV2xLXgwEti4thF/dDW2i1zXPtRL3zb0lJjk0LqJnQNuuBG4PyMvTxXSMP++jaTFKdKork1Um294C1KWNAcwb9yS8SIm2DMMD9AmV+bw8SvmgDwrIP1R5zxxBhdS+rIecPEnDfs6SXJnzXgru6voGBg56Gm2K5xL9NYR4SIs2BFxQR6yb/BVmV4X1aCOfl4cqQcvK0RVApJcll4XOn04jujUmonrGuVkl2a9ozd61jyJyRhxEkc48uLLJ/j7iloKCMAOu9QJFG04GjHYGCgTwnHsUU5dwDALsi9trUyuJawBEShRH+fyKs6sgkvLezcaP1Mh+FFi1C4wsCiNOUTZesOLujruMcrrqEnyA7iRlntCoaL6MmheDYR+SBNcNIXIgbX6NRyzXkKn8L8mi+x2j+mjBAuD837H3CCUExYuORzvCfAKcK8bipYYCQItuNVX75QKdJcZ3ZwZBynvQK1WxA4A== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(186003)(26005)(7696005)(70586007)(4326008)(81166007)(36756003)(8936002)(5660300002)(426003)(336012)(44832011)(70206006)(82310400003)(8676002)(2906002)(110136005)(2616005)(316002)(508600001)(54906003)(1076003)(6666004)(86362001)(47076005)(83380400001)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:53.0817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6142d902-90fa-4d54-2c0e-08d97e3fe47a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5887 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366734694100004 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 1:1 direct-map(including Dom0). Update the accessors to use the struct vgic variables to provide the updated addresses. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng --- xen/arch/arm/vgic-v2.c | 16 ++++++++++++++++ xen/arch/arm/vgic/vgic-v2.c | 17 +++++++++++++++++ xen/include/asm-arm/new_vgic.h | 4 ++-- xen/include/asm-arm/vgic.h | 4 ++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index b34ec88106..a8cf8173d0 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -673,6 +673,22 @@ static int vgic_v2_domain_init(struct domain *d) csize =3D vgic_v2_hw.csize; vbase =3D vgic_v2_hw.vbase; } + else if ( is_domain_direct_mapped(d) ) + { + /* + * For non-dom0 direct_mapped guests 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 + vgic_v2_hw.aliased_offse= t; + 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; diff --git a/xen/arch/arm/vgic/vgic-v2.c b/xen/arch/arm/vgic/vgic-v2.c index fd452fcb5a..ce1f6e4373 100644 --- a/xen/arch/arm/vgic/vgic-v2.c +++ b/xen/arch/arm/vgic/vgic-v2.c @@ -280,6 +280,23 @@ int vgic_v2_map_resources(struct domain *d) 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 non-dom0 direct_mapped guests 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.vgic_cpu_base =3D gic_v2_hw_data.cbase + + gic_v2_hw_data.aliased_offset; + 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; diff --git a/xen/include/asm-arm/new_vgic.h b/xen/include/asm-arm/new_vgic.h index 9097522b27..0d16f878eb 100644 --- a/xen/include/asm-arm/new_vgic.h +++ b/xen/include/asm-arm/new_vgic.h @@ -188,12 +188,12 @@ struct vgic_cpu { =20 static inline paddr_t vgic_cpu_base(struct vgic_dist *vgic) { - return GUEST_GICC_BASE; + return vgic->vgic_cpu_base; } =20 static inline paddr_t vgic_dist_base(struct vgic_dist *vgic) { - return GUEST_GICD_BASE; + return vgic->vgic_dist_base; } =20 static inline unsigned int vgic_rdist_nr(struct vgic_dist *vgic) diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index d5ad1f387b..92f6a2d15d 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -280,12 +280,12 @@ enum gic_sgi_mode; =20 static inline paddr_t vgic_cpu_base(struct vgic_dist *vgic) { - return GUEST_GICC_BASE; + return vgic->cbase; } =20 static inline paddr_t vgic_dist_base(struct vgic_dist *vgic) { - return GUEST_GICD_BASE; + return vgic->dbase; } =20 #ifdef CONFIG_GICV3 --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632366741; cv=pass; d=zohomail.com; s=zohoarc; b=MIs4gp7NIsPI1MkV85/Tjan3qEtDZpWl4aPeakdPTvlx6uA5D0pleNodJSTiWHy3hu3UTVDk5aZu0etUmqrPNn5i7wDxVoqjZbNM+1lmaiGp1t5uAAH8Xlz1rNkDkTHfWpwuGXfymLDHvHq+coFBYMT7EH10fKYYdczbKMdsypE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366741; 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=5lLs6y6VFPvynadLJUgwDgvXXXwXXf0+4A9GvM2TqEE=; b=EVlyyCRjq1+wv5BHU+qmDvmO+jm/1b4MxIAqA0UoTOQHM3JunyMQy+qjOG9lhMsYTxsCb8bQWOvcJCJH2cdBYPUVsg76u+NAEO1uZE7wfqxdXBedGEZ7Gu/5+YY5plh9brN2h4X3Fk0ygDY7TthzQFGDbQY1Id/xHZkJ2giha0s= 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 1632366741288914.0350090462031; Wed, 22 Sep 2021 20:12:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193316.344382 (Exim 4.92) (envelope-from ) id 1mTF9Z-0006CX-SP; Thu, 23 Sep 2021 03:12:05 +0000 Received: by outflank-mailman (output) from mailman id 193316.344382; Thu, 23 Sep 2021 03:12:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9Z-0006CM-NP; Thu, 23 Sep 2021 03:12:05 +0000 Received: by outflank-mailman (input) for mailman id 193316; Thu, 23 Sep 2021 03:12:04 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9Y-0004Qj-Di for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:12:04 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (unknown [40.107.22.47]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 021986ce-1c1c-11ec-ba0a-12813bfff9fa; Thu, 23 Sep 2021 03:11:56 +0000 (UTC) Received: from AM5PR0701CA0023.eurprd07.prod.outlook.com (2603:10a6:203:51::33) by DB6PR08MB2853.eurprd08.prod.outlook.com (2603:10a6:6:1d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.21; Thu, 23 Sep 2021 03:11:54 +0000 Received: from AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:51:cafe::bd) by AM5PR0701CA0023.outlook.office365.com (2603:10a6:203:51::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Thu, 23 Sep 2021 03:11:54 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT043.mail.protection.outlook.com (10.152.17.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:54 +0000 Received: ("Tessian outbound a77cafe56b47:v103"); Thu, 23 Sep 2021 03:11:53 +0000 Received: from 411708d2965c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id DD49CD68-F329-4C2A-A160-F534F2D25831.1; Thu, 23 Sep 2021 03:11:47 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 411708d2965c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:47 +0000 Received: from AS9PR06CA0264.eurprd06.prod.outlook.com (2603:10a6:20b:45f::9) by AM0PR08MB3137.eurprd08.prod.outlook.com (2603:10a6:208:64::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:45 +0000 Received: from VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45f:cafe::cd) by AS9PR06CA0264.outlook.office365.com (2603:10a6:20b:45f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:45 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT035.mail.protection.outlook.com (10.152.18.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:45 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:41 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:39 +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: 021986ce-1c1c-11ec-ba0a-12813bfff9fa 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=5lLs6y6VFPvynadLJUgwDgvXXXwXXf0+4A9GvM2TqEE=; b=RBFJYUdcqwvg5nHkBFWQhi9Qy96m0cWqQhOZ+zwSx8cAyY879YhxDPAexj58TwvuUZ8iBpXP8g7WsCnCrP9HNQRbTAgfhnXuwMwHVvkq+LMi+tIQq9Gx8yvoqldQIhxbbTzvfwxP8uTbGXD9ZgIrWb4cMnPRP1yv0trxW+tXFEg= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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: 884e471e58809d3d X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DjNUESi2rHxnEPZeGfnLKd4GgpOc9UfXRO1QwVVKOZD9FTQ/q1rnMRXRCzvzH9m0QycM7/1RfXQiaEqfagYd8qhZWV4DBJd2cqsnsAbIW6HF8Qmth56j35wd27xJsHBYth68r/ORmUzX3EFOynxiZelbGjRkxhu5HUpavLo8AZWNtTtVHcQZuOktT7CJAWTUqyBnntoj6LwzulFxLpXDV+ReeSZSsD0tZD3moZrS/W/0lvQb7702+qm9jtA5TuaFr/kPBXkJP80rzU/gtM0NZymiRZ0RSaMNKK/berYCAZTB5eY20JVkwRr3c3BTV1QS8ZxUSfZwlWI+4Sc7r5ZXkQ== 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; bh=5lLs6y6VFPvynadLJUgwDgvXXXwXXf0+4A9GvM2TqEE=; b=mSnK3DeJFCdlx03HfEF8Z5Eccl9ZChoY6EH2sL8vKJ00CMoKp3pQvm5yAUgm508u7WZURnt4nHdWF35BzwAoL+SECT5qSSV9S+xB740apKLsiNZrxgiUtZpJck2BkE7BSaGc1Q9AsEYDag+tR4yYRxrsiCh0DhmTgZoEed6ASbtQ9VxFjLw8HHGwZgB2XONKpAYfoip/QynIn2/g1J/vvoNP1kOyD24hsqZ5UbWcBag6P+LFZ1KV1oR4SBeDtTDGON+dItcH0WNGxaPGwDP13hlfW2v8KMULp/lvfyS7maqjP5fon0tHl6w3wyjVivDXnVXwPjpTTA3ATDNvck6StQ== 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=5lLs6y6VFPvynadLJUgwDgvXXXwXXf0+4A9GvM2TqEE=; b=RBFJYUdcqwvg5nHkBFWQhi9Qy96m0cWqQhOZ+zwSx8cAyY879YhxDPAexj58TwvuUZ8iBpXP8g7WsCnCrP9HNQRbTAgfhnXuwMwHVvkq+LMi+tIQq9Gx8yvoqldQIhxbbTzvfwxP8uTbGXD9ZgIrWb4cMnPRP1yv0trxW+tXFEg= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 08/11] xen/arm: if 1:1 direct-map domain use native addresses for GICv3 Date: Thu, 23 Sep 2021 03:11:12 +0000 Message-ID: <20210923031115.1429719-9-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7bb2667c-5ca2-406e-e8d2-08d97e3fe51f X-MS-TrafficTypeDiagnostic: AM0PR08MB3137:|DB6PR08MB2853: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2276;OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: D7UrfBhVRKuFyLkrALiRKovZ1ZO8JfuXMVO4SNvQhhn20j/cWSi58TkyM0XyCNDU0n/caJusRTAgifPaAyyjMml3MYgyERh0BJrUdjXPnX6jwH4c3uYzhJUzLU/r9Ul4ThjJkvf4kG2e6V6PXw82aXo/p6UhjYBVUbzyueJ7GnqLv8toGagMBFllVU3baxWlUmD1s2CYV+aOTI7SIWSOCSd3lsVkUcXLn3aC9JO1SWLpC+CiJEFUd7CLjjchUwyKThD5lqXe0umPukJodUY7hb4GXZ1Js4J2MCmvDz7HXq+KHEsU1aoNOU/iNRpi2SlIs6Yhn1YaEk90ZvCJHmNS4VHKGv/ZFc0APULdwpJ3F0M8iz7RtLiQXR9XonvJ+0aKyypWpudbH2NH7NQ2bGn3EK6BsaYijXeXOO/NsmDvC5yckhAxL++pz06O0y3gCLgbNtiUBk2Uu0HjRL5r+itJxIgWpP28R01ZY5zsPYO3c1GyTw+AV2ikWLDeBU9aGlr1YZ5AzLHj+TzWHMEl0JYlE8ByK9bXygAL3hcpnhM20gssjlf1K/o8l371plRb2qHcWk9ufuGp7zBKLxqf7RU5C9i7gdaC9/Lgf+8nK3ayJWGyqEK+3YmrOXMRvEjATCY8Wayu4tSqWy5tai/TZK0FeYsR5cFa6SP6Wbjiy6+UCYNNu6C0HCgipjqUIWQU7i551lUyomLNDT/QkCSB+99W0I0Bey9p3t0rOd9dkZCjP88= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(47076005)(2906002)(2616005)(1076003)(36756003)(82310400003)(4326008)(316002)(54906003)(5660300002)(8936002)(426003)(356005)(508600001)(26005)(6666004)(7696005)(86362001)(36860700001)(70586007)(186003)(8676002)(81166007)(70206006)(44832011)(83380400001)(336012)(110136005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3137 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 96aa237e-049f-4675-d87e-08d97e3fe01c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F44Juwe6mcWX8MwUU3kdEOwM3Qethn/8DixsoH+IwUq6tTSt/FHf8q9g0f0A+SufREBJSVU91kIanPGKtIFReCXquzzi1tEy2EEbbFHDKa8VXW4tVCTkat6C263aNK1D9ZN5RQzgLS3Pqm5bMBrG2zOkVxBVpdSHs+jvJucqAGbmHieI+AC2qDMvN607EnuTMs+cu42uxPWXPXjfAnyBTwxEYEl3lTs4TyKwdmnHNSrrEb1wVmOpiyK1+FWNlFSFlg4WieqhnHVRe3Nd8vEu2wCZ6kxQ/FeUO+mCd5/8jjiFT/+Hgjb+sKnssgYZ6+NbJoSd4ZHL5OQE+J5k/DykkKa4Gx0qU5RHJaPan5W/iOms6xqIJGGB1FSlG7OM+Xmx6UPur1lqmf78obQr/Q3JUlN/pZM3RQgsqJx3EGrmKq+BvkhFyoGhgtECymTWkTID0Y6NpUzxCyf7C2b6IVgJNwwFtMtOun+u01rvlu+QIF0ZnwvGJ5/sS2siOJ88abA5eI36SmuQqrU4DmIDscrfetllqd4nxtm04p0fXLDF7IKxW2eNWfZQ/LMQ2etQNz48xwkC/See3RD+ZG4J4Op1xMeztz7WvjLXWpj0Cl72OMwilqWgsnIvPA3ZiEXQ5bfgSFndAoJbzKSSHeJZDp0aK0sVAKtMx6o/r7P7BzO2GKX8ZCE/tXC2T7CYx8IAbpkpeGabnAwIoZoXTKFbRvKLcw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(70586007)(8936002)(316002)(426003)(4326008)(82310400003)(1076003)(5660300002)(6666004)(2906002)(7696005)(86362001)(44832011)(8676002)(54906003)(36860700001)(70206006)(508600001)(2616005)(110136005)(36756003)(47076005)(26005)(186003)(81166007)(336012)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:54.1079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bb2667c-5ca2-406e-e8d2-08d97e3fe51f 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: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2853 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366745352100001 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 domains that are 1:1 direct-map(including Dom0). Update the rdist accessor to use the struct vgic variables to provide the updated addresses. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng --- xen/arch/arm/domain_build.c | 32 ++++++++++++++++++++++++-------- xen/arch/arm/vgic-v3.c | 10 +++++----- xen/include/asm-arm/vgic.h | 6 +++--- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index d5f201f73e..120f1ae575 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1854,10 +1854,11 @@ 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 *reg; __be32 *cells; struct domain *d =3D kinfo->d; char buf[38]; + unsigned int i, len =3D 0; =20 snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIx64, vgic_dist_base(&d->arch.vgic)); @@ -1881,27 +1882,42 @@ static int __init make_gicv3_domU_node(struct kerne= l_info *kinfo) if ( res ) return res; =20 + /* reg specifies all re-distributors and Distributor. */ + len =3D (GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) * + (vgic_rdist_nr(&d->arch.vgic) + 1) * sizeof(__be32); + reg =3D xmalloc_bytes(len); + if ( reg =3D=3D NULL ) + return -ENOMEM; + cells =3D ®[0]; dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_C= ELLS, vgic_dist_base(&d->arch.vgic), GUEST_GICV3_GICD_SIZ= E); - dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_C= ELLS, - vgic_rdist_base(&d->arch.vgic, 0), - vgic_rdist_size(&d->arch.vgic, 0)); + for ( i =3D 0; + i < vgic_rdist_nr(&d->arch.vgic); + i++, cells +=3D (GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELL= S) ) + { + dt_child_set_range(&cells, + GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_CELLS, + vgic_rdist_base(&d->arch.vgic, i), + vgic_rdist_size(&d->arch.vgic, i)); + } =20 - res =3D fdt_property(fdt, "reg", reg, sizeof(reg)); + res =3D fdt_property(fdt, "reg", reg, len); if (res) - return res; + goto out; =20 res =3D fdt_property_cell(fdt, "linux,phandle", kinfo->phandle_gic); if (res) - return res; + goto out; =20 res =3D fdt_property_cell(fdt, "phandle", kinfo->phandle_gic); if (res) - return res; + goto out; =20 res =3D fdt_end_node(fdt); =20 + out: + xfree(reg); return res; } =20 diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index cb5a70c42e..83f996b46c 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -1647,8 +1647,8 @@ static inline unsigned int vgic_v3_max_rdist_count(st= ruct domain *d) * However DomU 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 is_domain_direct_mapped(d) ? vgic_v3_hw.nr_rdist_regions : + GUEST_GICV3_RDIST_REGIONS; } =20 static int vgic_v3_domain_init(struct domain *d) @@ -1670,10 +1670,10 @@ 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. + * 1:1 direct-map domain (including Dom0) gets the hardware address. + * Other guests get the virtual platform layout. */ - if ( is_hardware_domain(d) ) + if ( is_domain_direct_mapped(d) ) { unsigned int first_cpu =3D 0; =20 diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index 92f6a2d15d..0f7cb32c58 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -291,17 +291,17 @@ static inline paddr_t vgic_dist_base(struct vgic_dist= *vgic) #ifdef CONFIG_GICV3 static inline unsigned int vgic_rdist_nr(struct vgic_dist *vgic) { - return GUEST_GICV3_RDIST_REGIONS; + return vgic->nr_regions; } =20 static inline paddr_t vgic_rdist_base(struct vgic_dist *vgic, unsigned int= i) { - return GUEST_GICV3_GICR0_BASE; + return vgic->rdist_regions[i].base; } =20 static inline paddr_t vgic_rdist_size(struct vgic_dist *vgic, unsigned int= i) { - return GUEST_GICV3_GICR0_SIZE; + return vgic->rdist_regions[i].size; } #else static inline unsigned int vgic_rdist_nr(struct vgic_dist *vgic) --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632366753; cv=pass; d=zohomail.com; s=zohoarc; b=nJ3b0Akky61xZg0YpoZlmnF80jpgp9G+FERdoYW7CNBTyHzH8kxAgJx+6rJZWQbZVkzqtZ42fpOAFxTWf9VEWs1aeVT230ZvPIlU2W6Z5MnpwyMwkCVUqvZ3iNvI1dNxBMrmruFP2PsqayZzZHQr5fckR58GizG1ImFu0Dsa8iQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632366753; 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=bAbBmE5YC0L/wCZCeTP5xeKcnHHT51Doj9fGx2jLAUo=; b=cv7hfLFPIDIO9ObuW/QFYLoD0QZjFS5E0/nJeD3OgyexROOeXeb3x8hZtjXA6FgbPnm3xo72Gw7hKvUZq31N5kVTv5x/IFR+syxOumRoPrJxmA9YUNN1znK+9z0i6JSa1kleq8LsBodokeYwik1PkatvdNjuVv/FNFXDrB9s/LA= 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 1632366753037832.3040863937263; Wed, 22 Sep 2021 20:12:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193321.344404 (Exim 4.92) (envelope-from ) id 1mTF9k-0007eY-Pm; Thu, 23 Sep 2021 03:12:16 +0000 Received: by outflank-mailman (output) from mailman id 193321.344404; Thu, 23 Sep 2021 03:12: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 1mTF9k-0007d9-K7; Thu, 23 Sep 2021 03:12:16 +0000 Received: by outflank-mailman (input) for mailman id 193321; Thu, 23 Sep 2021 03:12:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTF9j-0004kC-Bo for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:12:15 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (unknown [2a01:111:f400:7e1b::621]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f8101ccc-0dfd-4e35-a006-8d585399b83c; Thu, 23 Sep 2021 03:12:00 +0000 (UTC) Received: from AM6P192CA0048.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::25) by DB9PR08MB6876.eurprd08.prod.outlook.com (2603:10a6:10:2ae::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:57 +0000 Received: from AM5EUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:82:cafe::33) by AM6P192CA0048.outlook.office365.com (2603:10a6:209:82::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:57 +0000 Received: from 64aa7808-outbound-2.mta.getcheckrecipient.com (63.33.187.114) by AM5EUR03FT008.mail.protection.outlook.com (10.152.16.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:57 +0000 Received: ("Tessian outbound 1fd2edb24cb2:v103"); Thu, 23 Sep 2021 03:11:55 +0000 Received: from b3afd8bf3d71.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FCDD71CF-1E59-4F18-8D71-18350386DE32.1; Thu, 23 Sep 2021 03:11:48 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b3afd8bf3d71.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:48 +0000 Received: from AS9PR06CA0264.eurprd06.prod.outlook.com (2603:10a6:20b:45f::9) by AM0PR08MB3137.eurprd08.prod.outlook.com (2603:10a6:208:64::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:46 +0000 Received: from VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45f:cafe::ae) by AS9PR06CA0264.outlook.office365.com (2603:10a6:20b:45f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:46 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT035.mail.protection.outlook.com (10.152.18.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:46 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:43 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:41 +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: f8101ccc-0dfd-4e35-a006-8d585399b83c 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=bAbBmE5YC0L/wCZCeTP5xeKcnHHT51Doj9fGx2jLAUo=; b=ybdTvmcD1KnSg0dXZBdL2ulsqEH70PJ0fBkuFVwN45EZaQBLH6DwUCuQRckO7VaXWdFI1qN0tYvGytfHZdQ0SapoTANkFbEyi0QW/AFiqS8qLXN34b3GXBwurE7hsF3f4CP2TA2Wzm6DgylgHYdkwtA0cQv32bo9jRW8q6Mwa5Q= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.33.187.114) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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.33.187.114 as permitted sender) receiver=protection.outlook.com; client-ip=63.33.187.114; helo=64aa7808-outbound-2.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: a97663ed7ac83a69 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zaz15hzZZSlMhQ4YFfEthi4nY9dElSqwFpV2sHFsYWlxwwjFGm4VcYfh5f5nDjVhSOg3Ae7IPuQMj4rWB1S3HHmb1jEjl0Etft+uf54B3piG+E16TrHfCaoy5C5Og2uBNkZh0iFLRCP1gcosc5IKpX5hpLI5sHdFtSN3VUYEiATrLg2QlX2FCkj3jqG9hrf/3KLOifAmUTFqyVuU8NoYd6q4hDhdlgYYVB/Au0JBmRqdo35TR3Ht12HIuljrFnj2hXjB+DaYz4zgXa4Nce7fBYAi8ox1y72W1Bg9C2aEd++6RYSioQxwAT+X95Hu4RRYiTOk0xQ2lHshnZ9WldlqCg== 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; bh=bAbBmE5YC0L/wCZCeTP5xeKcnHHT51Doj9fGx2jLAUo=; b=KXAf/Oa/kU0o/AzsXWmE8EzUSqCo1gzQVDv+XP6pELLejgt7LdcI0jErGYiwfi9RNbhTWtfqMb+MK0JZY4yfbxfDutZtt4ZP8qM5fXdwt73jlPojHdjjgr2cY3Y7CjX9rdtPPr8L1ZJQqZVXqX0XcoHcw/4/mXZilLQ3nq43gru98EWeAo1RzGxdi4voaR+tHEwvs21+U0X0EGutVL8R4XtD10yHyHU0pGPWCfgLRvg9XWCi56rDBxqBhDVNBcI1B3RCFezx2XitgA5mMiW9KO5BRD2dT+kSOOjIdegUSBqkYPrv2/ocUKZlu11tIg8Llq0Iw4RU0iNCCA0tSGp+hQ== 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=bAbBmE5YC0L/wCZCeTP5xeKcnHHT51Doj9fGx2jLAUo=; b=ybdTvmcD1KnSg0dXZBdL2ulsqEH70PJ0fBkuFVwN45EZaQBLH6DwUCuQRckO7VaXWdFI1qN0tYvGytfHZdQ0SapoTANkFbEyi0QW/AFiqS8qLXN34b3GXBwurE7hsF3f4CP2TA2Wzm6DgylgHYdkwtA0cQv32bo9jRW8q6Mwa5Q= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 09/11] xen/arm: if 1:1 direct-map domain use native UART address and IRQ number for vPL011 Date: Thu, 23 Sep 2021 03:11:13 +0000 Message-ID: <20210923031115.1429719-10-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 35b66eb1-e189-4e68-bb77-08d97e3fe6f4 X-MS-TrafficTypeDiagnostic: AM0PR08MB3137:|DB9PR08MB6876: 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: +gvpXnSrQEDEXBET3ZqY/6IWO7ZXSB6V8r7f9mJ/vxxWKulcYBDZQZPItP/x0FubJB3sT+m7wWKuEsAnDy9asxpXhtVkOFujEjA+FdTJL+vJYR3b5EE2TLVfOtIsFeI5E5CfjDSAyQOIT6booKtYnk0Jizh+FfNX0hXoFJPHXelZqM/1pQWaGWAv1bsg0PKIu6blYDKWZ+aATvnbxKRSj5RgHhcJeAu5NfTyrGTXeTTT5n1gEZRKbQE1kNIzPnq9xHtzzb0TbcFnBlPhDjwB3w0FIgycFGyPTxjtUfz9Y8aiGK2uvmNd2aOnMhWh6vp0Sc4TgSEe4/juxGMY/RMKLZHrQjAogJSCkORi6+BZ4MwFxi2nFbLbToibCcp4LVlL4teSZAyBRfi7tmookYvtdcxZyS8iYYCx4CPq/IDVYk1ttqxs6k+JzQtJEpFLbh7cNpgIfxZ0+U8a5ob3KvbTrT1jlFn0KfC4NipfGhTie+xOg3ufFCzHPQLG2gOuL2AD0gt+CQgVaA3vvM6VfhTLe285DfQzVgPDFoQF6L36zXhZC62KEVI4X2L1giRfALEa0qA1IYGX7zU1iwIzWtkXx+bL1Zg4FAx7UR1iwiFlW6jg460vbo4OMnWWmXtueOv4vV8XzGxRJdfuKz2FsMpxuIW7J/iMSEYDxXlKZFL0jHL7nKkZFAV+kYaKLNbtLT9WPuWj1e4kPQKQr3OZG4eNAjHyjVCet7FIgYQweLhAjKk= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(47076005)(2906002)(2616005)(1076003)(36756003)(82310400003)(4326008)(316002)(54906003)(5660300002)(8936002)(426003)(356005)(508600001)(26005)(6666004)(7696005)(86362001)(36860700001)(70586007)(186003)(8676002)(81166007)(70206006)(44832011)(83380400001)(336012)(110136005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3137 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: a16817f1-73a7-44f2-73f6-08d97e3fe098 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BdtXs0k4ZcwUxSCMSJ2ycoT7Tj4RYPiJDnzof3W/VGq+GiOK9NLqP/xu4trwAVggUUXrj4MQ4SCNfGklBVtB+FUSsKq+zLr1CaCaa3hd5/J3E48z5ceQNemk1YSTXQcdrOUae0kVWp15UxVNBnVHfDuoHeMCFkjR5nGzyez3xDpXBtO0Udz5oO40u6NhlgADfjORHpIJHX5A1G2RjjFmfBkWDMKk3Vov8QhAkuItjXDBjsERoSSeD/qFqsVklhzkEtJwwGX9RZDc1QEhuvfeXfVZGnteFIrPbObap/tEdUiWvW5Ce0eyRIOuAd7ElNrbHPAwx09ABNpdJxJvPV9RAA7CE+wikBaxJAQblSssE+/9SVRJKudwxNOaZWjKtoAbhPCH3+veTmS2bflCjYBucA7dJpZxitm11vhHY1z2jcM8OvuWGjMpsWlAJfdoysKzVjs2G1BavAlJsMV6F/l+bS8kUGUdzEPNKwiWUXKV9giOcY60v4zUryvCeWk8ZBfDHD65QWsZxfveMcDBQmL4PCRF4WuIxVJfJ2peZy1QzgOLudEZPpdTQSQCSPkNwYkkl5xvFZdtBiv8YOfaQ6TwhCkiql+2tupVBYXYFs36mXSxZBj9juHWw58HA6iG4aCXAIw6G9YNcj/8eJktC+M8isaZlBwkpPcNDo+qz14qrK6LPPTS6VAqeGtXTyafqpWXM+WAh24ZHRuD4vh+iagIxQ== X-Forefront-Antispam-Report: CIP:63.33.187.114;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-2.mta.getcheckrecipient.com;PTR:ec2-63-33-187-114.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(110136005)(54906003)(316002)(44832011)(2906002)(186003)(86362001)(508600001)(81166007)(26005)(7696005)(2616005)(5660300002)(4326008)(70586007)(36756003)(336012)(426003)(8676002)(70206006)(82310400003)(8936002)(36860700001)(6666004)(47076005)(1076003)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:11:57.1714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35b66eb1-e189-4e68-bb77-08d97e3fe6f4 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.33.187.114];Helo=[64aa7808-outbound-2.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6876 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632366753947100001 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 domains that are directly mapped. 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 --- xen/arch/arm/domain_build.c | 34 +++++++++++++++++++++++++++------- xen/arch/arm/vpl011.c | 34 +++++++++++++++++++++++++++------- xen/include/asm-arm/vpl011.h | 2 ++ 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 120f1ae575..c92e510ae7 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); @@ -1942,8 +1943,11 @@ 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; + 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 @@ -1953,14 +1957,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 ) @@ -2670,6 +2674,13 @@ static int __init construct_domU(struct domain *d, else allocate_static_memory(d, &kinfo, node); =20 + /* + * Initialization before creating its device + * tree node in prepare_dtb_domU. + */ + if ( kinfo.vpl011 ) + rc =3D domain_vpl011_init(d, NULL); + rc =3D prepare_dtb_domU(d, &kinfo); if ( rc < 0 ) return rc; @@ -2678,9 +2689,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 @@ -2723,15 +2731,27 @@ 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 in + * set, in which case we'll try to match the hardware. + * + * Typically, d->arch.vpl011.virq has the vpl011 irq number + * but at this point of the boot sequence it is not + * initialized yet. + */ + if ( direct_map && serial_irq(SERHND_DTUART) > 0 ) + vpl011_virq =3D serial_irq(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/vpl011.c b/xen/arch/arm/vpl011.c index 895f436cc4..10df25f098 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; @@ -622,10 +625,27 @@ int domain_vpl011_init(struct domain *d, struct vpl01= 1_init_info *info) { int rc; struct vpl011 *vpl011 =3D &d->arch.vpl011; + const struct vuart_info *uart =3D serial_vuart_info(SERHND_DTUART); =20 if ( vpl011->backend.dom.ring_buf ) return -EINVAL; =20 + vpl011->base_addr =3D GUEST_PL011_BASE; + vpl011->virq =3D GUEST_VPL011_SPI; + if ( is_domain_direct_mapped(d) ) + { + if ( uart !=3D NULL && serial_irq(SERHND_DTUART) > 0 ) + { + vpl011->base_addr =3D uart->base_addr; + vpl011->virq =3D serial_irq(SERHND_DTUART); + } + else + printk(XENLOG_ERR + "Unable to reuse physical UART address and irq for vPL0= 11.\n" + "Defaulting to addr %#"PRIpaddr" and IRQ %u\n", + vpl011->base_addr, vpl011->virq); + } + /* * info is NULL when the backend is in Xen. * info is !=3D NULL when the backend is in a domain. @@ -661,7 +681,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 +693,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 ) diff --git a/xen/include/asm-arm/vpl011.h b/xen/include/asm-arm/vpl011.h index e6c7ab7381..c09abcd7a9 100644 --- a/xen/include/asm-arm/vpl011.h +++ b/xen/include/asm-arm/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; }; --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632367042; cv=pass; d=zohomail.com; s=zohoarc; b=jMvepGqmiQNuSGl4nj9Ws3XF+Le0F+yY0fwnYviSCM+lzG5KKc7jRWdoNrvsQoyhxedgDdLcnYYBU+tuYZfmgESzNmvImYy9nkUuDbNUtdOtriwSDsbp83b5mM5FGxD2c2WXnrhlitGsp65JB4PJAZkW/xjc3TlOHUPwtXccvzM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632367042; 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=5SA4d2GeBF/c/7lvVqfUDdcRMEVLTNcBLtAK0ks8Cfg=; b=G2MblvW4FStPFBrAOBjaId8Q50riX/uSFY2+K9zLKRJ5mwKmVbfOof5aiGFmYlONpi+iWv6Aj7xa7l/VAwIdSTR287FiyVp663VHrZTj6zClufcA+h/+aK1P8mdfGkhTXqAtpjqN6BScreBU/MeXwbHK4XePexX64ufhUI6op5Q= 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 1632367042766338.7766769459191; Wed, 22 Sep 2021 20:17:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193343.344426 (Exim 4.92) (envelope-from ) id 1mTFEN-00026N-0v; Thu, 23 Sep 2021 03:17:03 +0000 Received: by outflank-mailman (output) from mailman id 193343.344426; Thu, 23 Sep 2021 03:17:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTFEM-00025l-RL; Thu, 23 Sep 2021 03:17:02 +0000 Received: by outflank-mailman (input) for mailman id 193343; Thu, 23 Sep 2021 03:17:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTFAX-0004kC-Dn for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:13:05 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (unknown [40.107.3.50]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fb3b812b-6dd4-4371-b27f-310d578d9eb4; Thu, 23 Sep 2021 03:12:10 +0000 (UTC) Received: from DB6PR0601CA0019.eurprd06.prod.outlook.com (2603:10a6:4:7b::29) by DB9PR08MB6428.eurprd08.prod.outlook.com (2603:10a6:10:263::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Thu, 23 Sep 2021 03:12:07 +0000 Received: from DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:7b:cafe::10) by DB6PR0601CA0019.outlook.office365.com (2603:10a6:4:7b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15 via Frontend Transport; Thu, 23 Sep 2021 03:12:07 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT037.mail.protection.outlook.com (10.152.20.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:12:07 +0000 Received: ("Tessian outbound 45760a30af4a:v103"); Thu, 23 Sep 2021 03:12:06 +0000 Received: from f22e634b0734.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BD0D7A2A-0C9C-4596-B7FE-4BD63411E029.1; Thu, 23 Sep 2021 03:11:55 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f22e634b0734.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:55 +0000 Received: from AS9PR06CA0254.eurprd06.prod.outlook.com (2603:10a6:20b:45f::29) by DB7PR08MB3259.eurprd08.prod.outlook.com (2603:10a6:5:1f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.17; Thu, 23 Sep 2021 03:11:47 +0000 Received: from VE1EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45f:cafe::6f) by AS9PR06CA0254.outlook.office365.com (2603:10a6:20b:45f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:47 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT035.mail.protection.outlook.com (10.152.18.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:47 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:45 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:44 +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: fb3b812b-6dd4-4371-b27f-310d578d9eb4 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=5SA4d2GeBF/c/7lvVqfUDdcRMEVLTNcBLtAK0ks8Cfg=; b=Ur4Mcgrca3EVT13PDYApcCW+O3mXljiraAtQZOSqoZWUnCSSoZhb0OSuPKkpBzjt7FplnRASaZ84gtsr5P2a6UGQoVSYxDrV5/11dLvkdS+rafDKzYzbgoykxfIyKgueJCWzZj7bSOVQqk+y8W6TgRxJv9jpRK5f+QJ9GorDqt0= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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: cf5a9cc62c8cf42a X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Utw3mh2tL9u54gxSJBfNFCpBgsU32aT5P4B4Jk7bJsV426RPe1lcZi6dP/BtGat2QDEczgHJNq41eBxAmJDcSEVYZ0N0uuBIC50qEcxcnZHlj76P/FDjer+Umky9nld0J9PMxWLRl/mj4uwtAD6wmkq3ntzMItbDIuPMBMNgapyIBu0Z7LIzA6jfOge87o5vp2yXuXL7lA/6HFt6vGypk8z4TIS74HZwQDds98DI9PiTctA9sWR7whoLa15jz0yhlsBX+AgdmjOG6SUvoCQ7M5k3PsNJI7DHFl3/7AP7+noPPddieH3YDw8hE008gxKdwcLfrLtlImEUL7hohWfkCA== 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; bh=5SA4d2GeBF/c/7lvVqfUDdcRMEVLTNcBLtAK0ks8Cfg=; b=cg0STODoC+kwN6BBhu+tY1r8ABimttGv0/VdcXdREYEbl9W3JwdBQGaacTncHMwXpE3DyncCt2vi63IAdM8hMqPcTNQaIoPLl/rrN4ryplZQr+8FzHxZGf/dv2mJqxKkEwHoGQIwWH1cKJ/e6XvB6t0fu3+WnAilIyJW0KbBoreof/JODSwhiWCE+W3nqcA24yMysssbTnQSQkQGxHD6rixBDVCXs67TgfeF6hL2ulQEnaUhAPWreNCHWJa/OysbNcCh9tDjgrHLjSDvM/SYgWoELYwBwhh2EgcCBuE2R2wwp0pjgmC2Kp4cD+R+AbaBcPBwl5YWGsRz+TOLYB9/4w== 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=5SA4d2GeBF/c/7lvVqfUDdcRMEVLTNcBLtAK0ks8Cfg=; b=Ur4Mcgrca3EVT13PDYApcCW+O3mXljiraAtQZOSqoZWUnCSSoZhb0OSuPKkpBzjt7FplnRASaZ84gtsr5P2a6UGQoVSYxDrV5/11dLvkdS+rafDKzYzbgoykxfIyKgueJCWzZj7bSOVQqk+y8W6TgRxJv9jpRK5f+QJ9GorDqt0= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 10/11] xen/arm: device assignment on 1:1 direct-map domain Date: Thu, 23 Sep 2021 03:11:14 +0000 Message-ID: <20210923031115.1429719-11-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2df8bc4-31ff-4b02-8d2f-08d97e3fed10 X-MS-TrafficTypeDiagnostic: DB7PR08MB3259:|DB9PR08MB6428: 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: mC71vN8PmQhpFwfMtuEw25+9nkVlkF1H6N8g4warMvgpphEbiMth5DFk7ZddUe3Ei37ELoJuRVHrGEx1NHMTiYTN46MpNR95YXL42EblJaIk5fO/e75lN3DNzgrnY74lN7nf2YBClspzZo/dvA3QUqR/vdbyzOdJZcn+i2b260pikRQTxeQb6dOFuNts+0g11PS4x7YeibFMhaAxotzTJE+X93MMPdk1zmVclR918DrDlVtsOeEvfytc6hHDvE9XkVsguavhTbct4aiJRP23sicz0X/RtImu5tGBOMU8liH5wb46uBVVxEOjud+l47uHH3vOIVMVLSJ01RihWoKmdVFevKk4Cx9rmyoBcNn/m1EkBUOcFYOk0252ytfEryP/ClMLuzpLtf6A66nI6J9GtjwdFucN3Dgp9hLEVtvoDqgx1cIQeQj2u9O7ZXx7oK7QOLlf+/+CY5P9cFo39PxWLxg2hOXwU8Ypb1D4uz5Iw93mAla1Klf/zkOEdwu0uyOZeJ8EA24vY/ai23VuINrNzy9PH4WDmFcmRJgfXmS392jPXj3Ci4wM8p7LzJw6yumc3YcF7kIEbV66xR25LNfrxfA6A3qg0vUgamcM1TPPAa5pFUyb74Pp+KG9eWYLXmuY0vo3JiPIEj0PpTKU2f/juKG/ys0ylA2UEbv4FwrTYlC75ZRIvheu3FQU1bxm0zYQ7ul8Y+M18gdPc86N5cYRMCvxoTXQW96OIGbH2HoD5XE= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(508600001)(82310400003)(2616005)(7696005)(47076005)(336012)(4326008)(2906002)(426003)(86362001)(44832011)(8676002)(316002)(36860700001)(1076003)(8936002)(5660300002)(6666004)(83380400001)(110136005)(70586007)(36756003)(26005)(186003)(81166007)(356005)(70206006)(54906003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3259 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 4008d624-2b61-497f-b4cd-08d97e3fe12f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +mXLZhU8nfvo6aDPST20DoqJwMn/6reOzzOmVo5Nw0yMJDc9X8B8eDKs+MgNYI6mCDT/rW3KELft2aQJuW/51rtK5oqYEX13+Khktdb+GGUAcmcX3F66x1x/SfBHmPSq4c+eF77UlTatDUY9flktSo2kncYv1CDNXZFCXsAzHIkIM/AcQbuUPEC5AzBKS+xJyZbI0Rn8Agn7EbqlGnEo4OphI0vn8W98y/6uJLouc0xTaYh4/lRtnucOF0OCEb/ypcfCc3kGDJyVa02Myy596a4fM4I0qZHzpvip1V7IplEkTcCN8jyS277eUms8GnQ/qCzrRRKsk8D1f9sUsco31fpbHC2zHSU5j8eiIbCpqVcxUil7OOxjkwL0BTE2MbWZ7ncY1dzvVlLZ3K1DsM0T5szLOxvkIlEh/RLqAUeODF/kvcm/bCHHfNQpTzV9HF+JmDiDS9dZehjs7VsoFtaGkVdnTx8cYZd1RcQA2hq5bZxqf0gSLNS01LVpqBW1qimP3xnQF3RZ0j4i0yPTRz7sS7o7ZIIPlNYgR49mehhk5LdbJkI7wIB/o2xYx27Hdh8/37OGMqZW2OruIpkZwfco/n6rmMfrXsMVKXQhFo1gf9PErQlj9um2hN79ITEE5929N84Km2hdLldLHtu1xWvBGbxjZX7ObSSoMJwKbPG/hSDGG01xJ58yYhgB40Al2L0RyZxqQVUnTiJrHyvtZNrbLw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(70206006)(70586007)(81166007)(508600001)(426003)(54906003)(83380400001)(336012)(316002)(36756003)(8676002)(82310400003)(110136005)(5660300002)(2906002)(6666004)(26005)(44832011)(36860700001)(7696005)(4326008)(86362001)(1076003)(8936002)(186003)(47076005)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:12:07.4890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a2df8bc4-31ff-4b02-8d2f-08d97e3fed10 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6428 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632367045153100001 Content-Type: text/plain; charset="utf-8" User could do device passthrough, with "xen,force-assign-without-iommu" in the device tree snippet, on trusted guest through 1:1 direct-map, if IOMMU absent or disabled on hardware. In order to achieve that, this patch adds 1:1 direct-map check and disables iommu-related action. Signed-off-by: Penny Zheng --- xen/arch/arm/domain_build.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index c92e510ae7..9a9d2522b7 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2070,14 +2070,18 @@ static int __init handle_passthrough_prop(struct ke= rnel_info *kinfo, if ( res < 0 ) return res; =20 + /* + * If xen_force, we allow assignment of devices without IOMMU protecti= on. + * And if IOMMU is disabled or absent, 1:1 direct-map is necessary + */ + if ( xen_force && is_domain_direct_mapped(kinfo->d) && + !dt_device_is_protected(node) ) + return 0; + res =3D iommu_add_dt_device(node); if ( res < 0 ) return res; =20 - /* If xen_force, we allow assignment of devices without IOMMU protecti= on. */ - if ( xen_force && !dt_device_is_protected(node) ) - return 0; - return iommu_assign_dt_device(kinfo->d, node); } =20 --=20 2.25.1 From nobody Fri Nov 29 16:33:41 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=1632367046; cv=pass; d=zohomail.com; s=zohoarc; b=ZWHBgt43t0I9vJa8Pj449UIkaOc9LAB1Li4y0tgTxXSIZUCwgHSW+dg7af+0PMaqokJ20vsD5givx0nZZKNWtzLFW2W5MZIS3ifna0Zpz8/ryxV71SYggZCmRGrN9GUAYSSGqpP38av4x+f/3q0hrk58tt90JZU4GEzzgBE9sfs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632367046; 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=RUJuKpAtpsPU2vd6yUZACXFm8wINo0vkIbxoIx5eFVM=; b=mmL3bTswgGhTJnzRSCn4AJc7Q/n2SYPlV50iayM/Bv7uVsE8cs32WMzlvquRDYs9v0vHItfxc6jTOPsOQLUbOpo3y+occlkjYv/WFcM3eZJPP2vVJLiq/YDz19+o4LN/YSjFIJuqD/QotsJ53kBrLGQDXIUyUW7Hln0Q5M0ppuQ= 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 1632367046491722.0298194863923; Wed, 22 Sep 2021 20:17:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.193365.344437 (Exim 4.92) (envelope-from ) id 1mTFEV-0002Xt-7b; Thu, 23 Sep 2021 03:17:11 +0000 Received: by outflank-mailman (output) from mailman id 193365.344437; Thu, 23 Sep 2021 03:17:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTFEV-0002Xh-3o; Thu, 23 Sep 2021 03:17:11 +0000 Received: by outflank-mailman (input) for mailman id 193365; Thu, 23 Sep 2021 03:17:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTFAI-0004kC-DH for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 03:12:50 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (unknown [40.107.7.40]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1440ab9d-f2de-4053-afbd-a762e60e0d86; Thu, 23 Sep 2021 03:12:08 +0000 (UTC) Received: from PR2P264CA0035.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101:1::23) by VE1PR08MB4927.eurprd08.prod.outlook.com (2603:10a6:802:b1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:12:05 +0000 Received: from VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:101:1:cafe::f0) by PR2P264CA0035.outlook.office365.com (2603:10a6:101:1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:12:05 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT006.mail.protection.outlook.com (10.152.18.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:12:04 +0000 Received: ("Tessian outbound a492f2284909:v103"); Thu, 23 Sep 2021 03:12:03 +0000 Received: from 7325449563a6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3642A666-F715-4B71-9D5D-AA48DAE3704D.1; Thu, 23 Sep 2021 03:11:52 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7325449563a6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 23 Sep 2021 03:11:52 +0000 Received: from AM5PR04CA0005.eurprd04.prod.outlook.com (2603:10a6:206:1::18) by AM9PR08MB6644.eurprd08.prod.outlook.com (2603:10a6:20b:30e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 03:11:50 +0000 Received: from AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:1:cafe::35) by AM5PR04CA0005.outlook.office365.com (2603:10a6:206:1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:50 +0000 Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT014.mail.protection.outlook.com (10.152.16.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Thu, 23 Sep 2021 03:11:50 +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.14; Thu, 23 Sep 2021 03:11:49 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 23 Sep 2021 03:11:47 +0000 Received: from penny.shanghai.arm.com (10.169.190.66) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 23 Sep 2021 03:11:46 +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: 1440ab9d-f2de-4053-afbd-a762e60e0d86 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=RUJuKpAtpsPU2vd6yUZACXFm8wINo0vkIbxoIx5eFVM=; b=ypSDbTU8t9Xwb5caDPUzAwZ6mMmObt51t5Wce17gQJ36XEHQoO4UF1jS24nL43tqIISmAurDVGgT6RXUZQ4s+o8EUoQWElq814kCrgnrOJ98g/VYlgE3ddXvF5i7VkBTPSecieN7ELAXfM53SDWgzLSwQp5P0WNlobjqvw8pAJM= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (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: 487e76dfad220cde X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bq2Zpaw/e9e1p1xcN78eXrjRSnjtprwT6B7MaIiPQ38naQONa81rVczoNTbhMzi1n/iwKWKjrXnJrDp+y4XqayaS3yDY37EHAWMDdfXi3oDP70vYT7md+7QiHzu3O/Ojm/zIQJcd6+xmwByXLt4xLVVEyRM1vlgNrDYcMXcTbbhj8oaoQTM/QNh+q/JN5NA6j1ovikwgvuSCCsmNrDwBcx5m+bOollfoqNTWeeh4fx9vs7QrHy+NPbi2U7jcs1Zftc9b9MXgQEqWY/8kMZpiAWzeQaYCquaCB4PicelM+wSpY884BP6JwJVSISmDpAleL5V97imKWQfRWC7Cv1/gmA== 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; bh=RUJuKpAtpsPU2vd6yUZACXFm8wINo0vkIbxoIx5eFVM=; b=h9rJhd93Bpcl7698BBThJLkAX3cxhPcMzqD8I8smmAqbx9JM8Rh6tUMjmQP+pors0wzNC9zOO6vCMhj77ns15Fj58tUt3wDsd25VgNMYtFsTeiJQ5RpxKIAFWK2V7M7FuMwMa0tSejXe+cKVCMR44NkbuB+4flC0Q3Wg7amew8FwTEJJ75VrAyYJQbTCqNJCv13WyISAX2v84YCRp/sHEa2UWak7TfJmPnCRxEnFmsvQxUSfGQGlkDr+l5HoCgiCWRwZKioCXMBxgZmiW1N70GYHs4piSH6+ll0wctMc+IBgtl1f+9l/CI6s7DAnq6Z/mwoVjL00Uh+g91PDcQeX0w== 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=RUJuKpAtpsPU2vd6yUZACXFm8wINo0vkIbxoIx5eFVM=; b=ypSDbTU8t9Xwb5caDPUzAwZ6mMmObt51t5Wce17gQJ36XEHQoO4UF1jS24nL43tqIISmAurDVGgT6RXUZQ4s+o8EUoQWElq814kCrgnrOJ98g/VYlgE3ddXvF5i7VkBTPSecieN7ELAXfM53SDWgzLSwQp5P0WNlobjqvw8pAJM= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: , , CC: , , Subject: [PATCH 11/11] xen/docs: add a document to explain how to do passthrough without IOMMU Date: Thu, 23 Sep 2021 03:11:15 +0000 Message-ID: <20210923031115.1429719-12-penny.zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923031115.1429719-1-penny.zheng@arm.com> References: <20210923031115.1429719-1-penny.zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d862402-9c47-41b0-0b5b-08d97e3feb73 X-MS-TrafficTypeDiagnostic: AM9PR08MB6644:|VE1PR08MB4927: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: S0mO2j1P9agY2idP2mQTWaiKi+dMeW0y3fZg2Ubl9IzhnhYufsj3KwoXioheiXCUHt+eS80R0WjPY4o9fCMgM5iEFuIR8Lr4sbacS2sfQXDQu+erv0aOZ3Mps0bxvxnEonlOPJvuxuhzRvXmNTS8CuItWiJPuYxwvGkJnYp4UtxTIuUIYgsNCaYIbo7sP/vLZrrvm2PFLoJogREBk4jxsmkmLzXlTWQ42EdO93n4BeetvKon/kA62ZiPov8AjPtALtV24GlHmYHawGn/Y7EaV8qYVPaK20lHwVALaXEwSHN+Gtn15JMT7TdmU3PnhM0U7gXEWpA4ZfUMAkeI5V4cFZZl/vm4wgK0kx4uAYB9wLD0/svpDzYrPnBKY+sL1idwD45yqR6GucLSu8M1wJpcazYt8h9yCk2wHgszHY0F9YGq7RW6p6fuVU4k7gRl9zCxn7MiSLfQSuH0dS9d3fHrAKWe8rECyuoVp0GdoxThnS5LAcnPAXunTcc6JMsHp/yJpTHpHdyXtlpeVUcoxv8kMLnDtOdSobE9koz8N+fQEKe31ck6hN/6lmjAMpZIjsjMHYN5fCars2a5OuBDzj7a4kylH1+rLOFDuRa5zt8gb+ue5z95o89OFTMPt8AOi5tT88hD+WubnXEf+6Dm8Ib5CyLOkI5v08K9shAjH2W4eAm8FkYelwwCDzcC7EzTAFQ3fOu5q6Ke9yaULajFS1wtiy9/Pi5Oqs+MdNtVZC/DG2A= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(70206006)(47076005)(2906002)(2616005)(8676002)(356005)(7696005)(4326008)(82310400003)(70586007)(5660300002)(6666004)(44832011)(336012)(508600001)(83380400001)(36860700001)(81166007)(54906003)(186003)(8936002)(1076003)(316002)(36756003)(86362001)(426003)(110136005)(26005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6644 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: db3771a0-69b3-494f-7eac-08d97e3fe2c4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sIx/sxz/+QFN0YlTZd9vWuRFe4Oz3B2WdnIzdbXHfErI5uJa/4l1lbg1iurV9AC33foj5twiXemyyol3dQnEp+zVFdKMjhtKaabm2PXiuma9Jxb2NVnAdQkiEk+LwvpvKzP9RlXiQFaCdBV0yif/PwO/93P96ZTahsqRZow1B3lHOQkr4EX1ckAs+oOCn7g3cn5QgrGUMaVP86cZ4hbyXSFkGG1aQNxX6etWWEu3+HjWI0e0EqvfZ9jqsUjC/hyj44gqpY/uM0On+h78Li4/xaH2ZbLcpCDzM1d0VRZJboCc+kkH4Rmgequ9F/RvEKd8wmWRWQaB9o4Awpfr/jA74gN5gkFeRanhKkIOqYBcOaj0uvOOowyB0Kn+uP7HRT2OZnMc9YkllxHaSPVi1pcAB4t7xHAiFr2tnZd0Xv5GDHKQNkNsJG2T//oOFXj8q1708Se5XHJE5E0yE/H1Fq2ngDlG3OrgYOwJYU0SioTEpxtURPCkmNbfJoRQlYrvNLgs0AyNR3cx/+LuMGRPkIM6FFzEVnsvXfj3lZliahZl/EnIz5bXIJf760fPlBW2y9uyAjzgVGHpIpE28Je9EAqqck74fuYQ+d0u2w88rHZyig29Dvl4gJFic0avJDaru8EWTepfFMCTpuH7PJvh4dO+tgQoQ7Qzmbl+ngoxi4uvQPU83ER2hFx5pcudMbmDugGcnraUXFfAlPM91Dp2mNKynw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(508600001)(7696005)(81166007)(2616005)(44832011)(36860700001)(8936002)(8676002)(2906002)(5660300002)(83380400001)(1076003)(82310400003)(86362001)(110136005)(47076005)(316002)(36756003)(6666004)(26005)(54906003)(426003)(186003)(4326008)(70206006)(70586007)(336012);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2021 03:12:04.6851 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d862402-9c47-41b0-0b5b-08d97e3feb73 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: VE1EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4927 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1632367048641100001 Content-Type: text/plain; charset="utf-8" From: Stefano Stabellini Make sure to start with a WARNING about security. Signed-off-by: Stefano Stabellini Signed-off-by: Penny Zheng --- docs/misc/arm/passthrough-noiommu.txt | 54 +++++++++++++++++++++++++++ 1 file changed, 54 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..61aeb8a5cd --- /dev/null +++ b/docs/misc/arm/passthrough-noiommu.txt @@ -0,0 +1,54 @@ +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