From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (EUR01-HE1-obe.outbound.protection.outlook.com [40.107.13.55]) by mx.groups.io with SMTP id smtpd.web10.83958.1682438689577562037 for ; Tue, 25 Apr 2023 09:04:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=HNnYgkX2; spf=pass (domain: arm.com, ip: 40.107.13.55, mailfrom: sami.mujawar@arm.com) 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=zYs+t6xNGTfl4IN1bhlZkSAtCbYaPyx8uPvN62D4sSY=; b=HNnYgkX2hn0lMZ5JjSFVZ8l669kjg8VLQGKfLIOvesyyc2WZ36TafYkJypUWnCvPyECkijrV/pqDYq95HQ8hEIAQ5/VNdTkyyn31KfxJCj1e1lQFVH6zC/OwTDbym3iqhGJYiEYeH/+8kBOJxaIKZ5ESB3Az5TZqQrS/CuIZZWI= Received: from DB6PR0801CA0047.eurprd08.prod.outlook.com (2603:10a6:4:2b::15) by DU0PR08MB9369.eurprd08.prod.outlook.com (2603:10a6:10:41d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.34; Tue, 25 Apr 2023 16:04:45 +0000 Received: from DBAEUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:2b:cafe::4e) by DB6PR0801CA0047.outlook.office365.com (2603:10a6:4:2b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33 via Frontend Transport; Tue, 25 Apr 2023 16:04:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT044.mail.protection.outlook.com (100.127.142.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.20 via Frontend Transport; Tue, 25 Apr 2023 16:04:45 +0000 Received: ("Tessian outbound 3a01b65b5aad:v136"); Tue, 25 Apr 2023 16:04:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a698bcb3c33f5846 X-CR-MTA-TID: 64aa7808 Received: from 0c64014b5260.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F505CDA4-E2DB-462C-8527-F1F05DFCB0F4.1; Tue, 25 Apr 2023 16:04:38 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0c64014b5260.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Apr 2023 16:04:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GNwpK1iwVScxEbZuUxspS711AQQ1C6O30S+Zx78jKLIPd8ZwOUgN57bV6mzS1fRGKHpFH4YlQQlzhqyvirwtL5OcVFd11QeJxTrMhW4TZzHrm4MAoVqZO9s6p314PA7Ig8E6/d2owiBBFjfSQlR+2zXlfyrjnDteZe98NMY3osOv87hx83+w2u7zB9pPdQWRIq+JNc/TLtOlRIMAjMafK5jYHOhK7H4aCmnDpiqIjOhzRzm2Tlp+pfYQ+ImHMet1fF4ZmMl+Ynvx62nAAvdV4VGRxFWuuLR/Umj1eYNz/TRuF3nWXWohyZYYepLhVViw4c+zXPv05E4A8GuGxmN4Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zYs+t6xNGTfl4IN1bhlZkSAtCbYaPyx8uPvN62D4sSY=; b=RWWJNg/T4GxwFPBSRjUftA0Ij9v353bB669pofdRT6PSdxk/+x0N6RHkRsuRcLrcgv5lvUkhbXXNbCQVJhDvXp5sLzGxp4VayRdOQs5qYYTyy2DvkMAlhLeoEm8wTgnQb9RPDqZbK0/ldNE4CWr4A4kHr3tZJ/FbMtx/uA101uGThN2Q9lJiFX2c8eDUrk4+TrYd0jBOhWtChyDKki0UjhNJxjjFtE/EG1dSJuY8a4wnMCT30IlSKLHhBvYCd1ObPGXyfC+DFejgG44z6yD64hiIRmOZbqIsdXafMJaHVI8bN/2YBSCScV/4I5UUwECnOdj41R7Nynlf8MP5s+Hm9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io 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=zYs+t6xNGTfl4IN1bhlZkSAtCbYaPyx8uPvN62D4sSY=; b=HNnYgkX2hn0lMZ5JjSFVZ8l669kjg8VLQGKfLIOvesyyc2WZ36TafYkJypUWnCvPyECkijrV/pqDYq95HQ8hEIAQ5/VNdTkyyn31KfxJCj1e1lQFVH6zC/OwTDbym3iqhGJYiEYeH/+8kBOJxaIKZ5ESB3Az5TZqQrS/CuIZZWI= Received: from DU2P251CA0012.EURP251.PROD.OUTLOOK.COM (2603:10a6:10:230::8) by PAWPR08MB8934.eurprd08.prod.outlook.com (2603:10a6:102:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.34; Tue, 25 Apr 2023 16:04:35 +0000 Received: from DBAEUR03FT019.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:230:cafe::3) by DU2P251CA0012.outlook.office365.com (2603:10a6:10:230::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33 via Frontend Transport; Tue, 25 Apr 2023 16:04:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT019.mail.protection.outlook.com (100.127.142.129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6340.20 via Frontend Transport; Tue, 25 Apr 2023 16:04: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.2507.23; Tue, 25 Apr 2023 16:04:34 +0000 Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Tue, 25 Apr 2023 16:04:34 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [RFC PATCH v1 05/30] ArmPkg & ArmVirtPkg: Make PcdMonitorConduitHvc a dynamic PCD Date: Tue, 25 Apr 2023 17:04:03 +0100 Message-ID: <20230425160428.27980-6-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20230425160428.27980-1-sami.mujawar@arm.com> References: <20230425160428.27980-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT019:EE_|PAWPR08MB8934:EE_|DBAEUR03FT044:EE_|DU0PR08MB9369:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fcedaa8-ce4d-49b5-c418-08db45a6c9a3 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: JyaPa8WJxmeycIil7fPQZ2BBXS4kCrMiWu9iJaHg0r2HRC2GcZEdxWz+g2eSNPOGUkghOkVCNeUy0O/EcULI2EHn3UYO20ERqti1a+usZzFLsw85HsBgZ8Kz7OW6C8dTKGRUg2Vx3awR0+DRasHybPp9HjpDcjNFbvqY2P5fvZRC3IRpSPT9Lr6KSbibbHCdgZsMxonT3RiXTdtuiP001X83PsLPe+hNA7LdzziSayHCymi1XvD3g8/7euPJZtL/xvHYrDSxXfqKfAX3SmY3HhTqfP3RoRxVB4ngyzDQIA1Kfn3foekyXO5KgSaizSVqlOpJEMQvoFs401AhicTlhOmsDlG6UN//zAy1PhuklEJxc2kjvY1PAVsm1OL0IdcL65oGXuZaBGuHrUK5617Y5XxlqUuXQZwjAFO+YZx+Mh5HQUxUgFAnEW/yq8yo5EaiyzNOfAv4QietOgMXfGzcwKfCV750Axl+T9c1YeofZYxE8SH2ltHAOHEZef9AZieGDJe45D6vlXkK0vMMBhPkWcfBKfLAfJ9k+W+MPsR12J5vD/Z8QhkqJLUF78koYgjoUbxYCrX65F0osCMxuwRYbjjBu0YpAU45qb648JHfRfe/uVx8pdADIgJQz0/suL4fH+qqDNXfz0eATSl4uIwc1M0tLkLab+//HwzDVJTSoayEu5NaTVgdMT4KJaE0G1J7MwxmX4EH5y47TMlY+4jDLyNN6ZIryz9+fL0Zucn5d+I= 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:(13230028)(4636009)(136003)(376002)(396003)(39860400002)(346002)(451199021)(36840700001)(46966006)(316002)(82740400003)(44832011)(6916009)(4326008)(81166007)(41300700001)(5660300002)(356005)(8936002)(8676002)(82310400005)(36756003)(86362001)(2906002)(40480700001)(7696005)(6666004)(1076003)(26005)(478600001)(34070700002)(2616005)(36860700001)(83380400001)(47076005)(336012)(426003)(186003)(54906003)(70206006)(70586007)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB8934 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 285e5e05-96a9-43ac-c730-08db45a6c3d8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BrtsfN/aj44AlnAnJbZblkbpELSdBQoLFTX23ZoyUN3Oh4kY/ivf3Ej3XDaV4n5sZTceMnkobdYacG0mlTIQe/wWem4JIU0CdkQQCH3sqjgYV9nIQg9jG2DQLMuCZicdRX++/G39i7poQj9o+HqwO1D4Tu2QVpvcg/nZ8NIb3qqVfrOCCJ8XqDnjwgs+LEp94tp6RJ9rrexZvFmye90o516bBkUruFiELiYHMb5pYtMXoPPPXH07GkKB4pnFz3WcBcOug8OpVeClalAEke0Xd/CMktVTCKG3bsmc+ZjW1RNdlh+XSdPCI3o5lGI9zkRxpPLgXKV0etbdW6K+8qKxMW5Dcu23/G1DZ/dofgVBRGSP6dFivKUHtoFM8inJbVkUSb6EgFqb3ii18S5JrV1v9tbpLipqPYuldzmy4DWTg5PI0xgpDZ4P6ZyVcKUNfPRgXshLjEAu2ZgtZck3T3NsNcRdAE4OkbSDYRA1c0wC/0mhv3HuHq/GrlmfRW4p8xHyHzyBtg5aO9Awgszp2ZkhykaNRT5uqEiiGHObNlwceCBeE+us7katu9cujCJ8g0sxu5M7iOPbxXePNmow9nF2F7/3xfK5cq3i2h40l1klIIVG3sS0LTYOdeimCFCUGvmI0nySryze24e6zaPJ8i5JCIiuFTZenh5ZTKzv4QmFRkBO5n3s1zqjYYmP1sDY6wG1OP2v8+M5alYYQ0FVYZSg/KE29vrKt6Y0G4Ri0MDNOWI= 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:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199021)(36840700001)(46966006)(40470700004)(36860700001)(40460700003)(81166007)(36756003)(5660300002)(44832011)(8676002)(40480700001)(316002)(82310400005)(8936002)(70586007)(70206006)(82740400003)(41300700001)(86362001)(2906002)(6916009)(4326008)(47076005)(83380400001)(336012)(426003)(34070700002)(186003)(1076003)(54906003)(26005)(478600001)(7696005)(6666004)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 16:04:45.2585 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fcedaa8-ce4d-49b5-c418-08db45a6c9a3 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: DBAEUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9369 Content-Type: text/plain The monitor call conduit is fixed for a platform firmware in most scenarios. For a normal virtual machine guest firmware, the default conduit is HVC. However, for Arm CCA the Realm code must use SMC as the conduit. To have a common code base for Guest/Virtual firmware to be used by both normal VMs and Realm VMs, make PcdMonitorConduitHvc as a dynamic PCD. This allows the firmware to detect if it is running in a Realm and it can configure the PcdMonitorConduitHvc as FALSE (i.e. to use SMC as the conduit when running in a Realm). Also update the ArmVirtPkg/ArmVirtKvmTool.dsc workspace to move the PcdMonitorConduitHvc in the PcdsDynamic section to prevent the build from breaking. Signed-off-by: Sami Mujawar --- ArmPkg/ArmPkg.dec | 10 +++++----- ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c | 4 ++-- ArmVirtPkg/ArmVirtKvmTool.dsc | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index f17ba913e6de1326d49b93d6a15378ff2f522d24..0730533e512d60fcba19c4cfa84944061d16f02e 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -139,11 +139,6 @@ [PcdsFeatureFlag.common] # Define if the GICv3 controller should use the GICv2 legacy gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE|BOOLEAN|0x00000042 - ## Define the conduit to use for monitor calls. - # Default PcdMonitorConduitHvc = FALSE, conduit = SMC - # If PcdMonitorConduitHvc = TRUE, conduit = HVC - gArmTokenSpaceGuid.PcdMonitorConduitHvc|FALSE|BOOLEAN|0x00000047 - [PcdsFeatureFlag.ARM] # Whether to map normal memory as non-shareable. FALSE is the safe choice, but # TRUE may be appropriate to fix performance problems if you don't care about @@ -393,6 +388,11 @@ [PcdsFixedAtBuild.common, PcdsDynamic.common] gArmTokenSpaceGuid.PcdPciBusMin|0x0|UINT32|0x00000059 gArmTokenSpaceGuid.PcdPciBusMax|0x0|UINT32|0x0000005A + ## Define the conduit to use for monitor calls. + # Default PcdMonitorConduitHvc = FALSE, conduit = SMC + # If PcdMonitorConduitHvc = TRUE, conduit = HVC + gArmTokenSpaceGuid.PcdMonitorConduitHvc|FALSE|BOOLEAN|0x00000047 + [PcdsDynamicEx] # # This dynamic PCD hold the GUID of a firmware FFS which contains diff --git a/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c b/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c index 741f5c615744dc5cc5381ff3848078f93858dd2b..221724125ce3a8f351a55a81f441409a99bcb5cf 100644 --- a/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c +++ b/ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.c @@ -1,7 +1,7 @@ /** @file Arm Monitor Library. - Copyright (c) 2022, Arm Limited. All rights reserved.
+ Copyright (c) 2022 - 2023, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -26,7 +26,7 @@ ArmMonitorCall ( IN OUT ARM_MONITOR_ARGS *Args ) { - if (FeaturePcdGet (PcdMonitorConduitHvc)) { + if (PcdGetBool (PcdMonitorConduitHvc)) { ArmCallHvc ((ARM_HVC_ARGS *)Args); } else { ArmCallSmc ((ARM_SMC_ARGS *)Args); diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc index d2228a95726b24fe5c2edfbc84b1f5c23a85feba..467e5c166e1bbad3acbae78f53c225f5bac525a9 100644 --- a/ArmVirtPkg/ArmVirtKvmTool.dsc +++ b/ArmVirtPkg/ArmVirtKvmTool.dsc @@ -117,8 +117,6 @@ [PcdsFeatureFlag.common] # Use MMIO for accessing RTC controller registers. gPcAtChipsetPkgTokenSpaceGuid.PcdRtcUseMmio|TRUE - gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE - [PcdsFixedAtBuild.common] gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F @@ -237,6 +235,8 @@ [PcdsDynamicDefault.common] gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister64|0x0 gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister64|0x0 + gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'