From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (EUR03-DBA-obe.outbound.protection.outlook.com [40.107.104.50]) by mx.groups.io with SMTP id smtpd.web10.83982.1682438716454100436 for ; Tue, 25 Apr 2023 09:05:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=pjCJMEwu; spf=pass (domain: arm.com, ip: 40.107.104.50, 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=iXkL80mLvvfVNU7tzwYg1I9T3hTIuFc8osZioFtNjHk=; b=pjCJMEwuYZ6riaLLxWyg8K2iXqMUysxKmNW9RxZnxsV/4ktdmF6gSIjUTY3pR5ok7clzcZPQF0t9Gc2FZkZ4xEgOHlHzSRoX1Qg+QcCmXtMxBoEtsSZO4JNk+fmm/Q6H10VYXC61D5gCm1f7T3OLSXUX3ODUe30B4pl4OsuPQOA= Received: from DU2PR04CA0013.eurprd04.prod.outlook.com (2603:10a6:10:3b::18) by PAWPR08MB9544.eurprd08.prod.outlook.com (2603:10a6:102:2f2::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:05:12 +0000 Received: from DBAEUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:3b:cafe::30) by DU2PR04CA0013.outlook.office365.com (2603:10a6:10:3b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.34 via Frontend Transport; Tue, 25 Apr 2023 16:05:12 +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 DBAEUR03FT048.mail.protection.outlook.com (100.127.142.200) 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:05:12 +0000 Received: ("Tessian outbound 99a3040377ca:v136"); Tue, 25 Apr 2023 16:05:12 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b545023850a3a37d X-CR-MTA-TID: 64aa7808 Received: from 88eff68a30f6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A2FFCE1C-6C63-4644-ABB2-7F78D4267360.1; Tue, 25 Apr 2023 16:05:06 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 88eff68a30f6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Apr 2023 16:05:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XptZUFWk+lacE0064cIfBtY+jsYOaHG0hQcA34j3/jugrYSgUfy4G5XbqWuVIC9KAZGDD7SSXGZ8QiyhSK/o/ATxZvgrsAVgqqZR6kg3Yi60Rd1w6aNaX8RG6y3t0xHJCxoKuKNyYMVcelOeHTdIw0rDoswDeYJcsoy427+a9RpqMepJpSnKB41/vG2LyUwnkJhZRTz7WsXaI0tfaM1lHWnI5AuF9W15XsqY2pRqlwFHPN7SN4ThUcel/U3De1yjKVa3dsK2TnJ3okTMJ1i9+VEOdVPY2MRl/sCyFB7gzSR312fDqZZoMf3z+frk37aR4obdnrXoDFAwLjDkEZ8frg== 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=iXkL80mLvvfVNU7tzwYg1I9T3hTIuFc8osZioFtNjHk=; b=ldi5pXIBbbSl7UwOrGiwk2GfFm8wac5bQ23Bp0KnNSjY2fMqoyvDZiOaDUM7ReT7jRstDyVtWaPjq9RqOWQdV6OzmrQrSKW4GPri4A/k3Q3rn7S1/lVIcb60Yr7ZSPsP0UTog+qoNeNKau9WZtMc5vKECqjPG8HBYr9jZZdYr/W6iyPuxVSAPJXCff6O2PZsNDQhC47iozlpCFVgBrgaU1oQsSK/AYTLwiY5O6jJSnuJPxdt4cGE16Am8vkRt+8FBiD/PFij6uXMSooXoQqgC54QyP4vOgCxDsSwXWFLj2KDP3Qsc5N+ZzfWktDMzTWm3FzMzu5CvPxTdb9JFV96mg== 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=iXkL80mLvvfVNU7tzwYg1I9T3hTIuFc8osZioFtNjHk=; b=pjCJMEwuYZ6riaLLxWyg8K2iXqMUysxKmNW9RxZnxsV/4ktdmF6gSIjUTY3pR5ok7clzcZPQF0t9Gc2FZkZ4xEgOHlHzSRoX1Qg+QcCmXtMxBoEtsSZO4JNk+fmm/Q6H10VYXC61D5gCm1f7T3OLSXUX3ODUe30B4pl4OsuPQOA= Received: from DB6PR0402CA0016.eurprd04.prod.outlook.com (2603:10a6:4:91::26) by GV1PR08MB8690.eurprd08.prod.outlook.com (2603:10a6:150:83::12) 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:05:02 +0000 Received: from DBAEUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:91:cafe::42) by DB6PR0402CA0016.outlook.office365.com (2603:10a6:4:91::26) 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:05:02 +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 DBAEUR03FT007.mail.protection.outlook.com (100.127.142.161) 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:05:02 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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:05:00 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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:59 +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:59 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , , , , Subject: [RFC PATCH v1 29/30] MdePkg: Warn if AArch64 RNDR instruction is not supported Date: Tue, 25 Apr 2023 17:04:27 +0100 Message-ID: <20230425160428.27980-30-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: DBAEUR03FT007:EE_|GV1PR08MB8690:EE_|DBAEUR03FT048:EE_|PAWPR08MB9544:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fe27b84-846b-4f59-6910-08db45a6da01 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: uc27lfKnTq2iEN83UVm+C/aKxCDsytATXNssQguAafBzreMAmvfyV59kxqoAz4l9kKyywXlMn9zKMUeqpRembd5RG3XmWb/3nATJubBZmD2isjVeNxB2fSrmvvCUKud2581zR9yQZVEAjF6eXQ0l/UE0m/iEJJHsRmZ4v5m7oXNoU5AM8y57P2KtJ3S1rstmTkLUoh/MwXHu43iqsj6fTBD0fm1owuv2jo55+6kBjyuvO6uvYUrJGNrdMUf5e12qIRh8tpFsAuuA/e+NXoSXF7k8G8vMT9kzHDJN6dqRqdisU0qi5AECxN6VMRy3bvoBHeo0f09stLynh8KlrC8KmZU+or6d8Altn5KbvcT9hRLIsPktXfhNovjGxIKJgFvLpgDipsTS+vkKglL/6Nugh3TGgSA0LuXpdXmfqAJIyFDJa6ufyvhqxiVMd2mqNwYTvuH5fErbsQndkIwGWn78Vgbr6NaRBlMfsmwrzRsZDn2Dap8sDBA7QSb532icNRNkeMklcvofE1a1qmtRTiCflxtF0jScVvRDkZXOJdHyDGeFru3DnxotvhIB7Nh2jNFHW4xfgsb5AyqslwfeLWeKVXev1yEMUtoHDr61lHBll8plLix7GTPeHG0hlvD6a4kg7op3VPt9suvX4hshaJQxW1rBCJ+PuZVgzRMKaoOH8DuQQyYh6E/7u6oB2fTTKrjguEl4vhtCWu6VKJfvi1fPqW/rVpAEHuukdbASO270TjM= 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)(19627235002)(54906003)(70206006)(70586007)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8690 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e6dc4010-3c0e-4cdf-651b-08db45a6d3ef X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D5+MHji0nF/yW2MqfRdS5qrQNHQIcz93a1OnaNcnrF66W54mHsKqgNQMEA8gmJK/+t5ZveKWVqUR4tJgfJSDBUqp1FqMzlgS8tsce8G9ApSeZIXLsnTjLW1bXYPtJH/gol06UBoi6th3NUoDi4Q9NROr0Ly3QETL9EiUp02zTiYntNa+GmAELcmRJHZOw1n7u07VI76PwWGlR005rEgvloDO4TaFEHAzHFXXIKdmbAR3CI6Uwl0OxTZJYneO5F4CP51QMu4emuIKLv5MA8Z6U3JeFMx5/wV0/CpLITneBWHF7dM556fXjcjHCbMrRlcHSGA9s5Bm/TG6eyqwkHyBWkMIUXk4+WGldjdVLjVqdL1mzuE++SHaGSOXjsDG9H27/XzAuhHAwhbLPuD3Mcl7MdsUx42nZVZfYMBQdmsC9MaWiJN7lAG2polSWdUa9e8Jycp6flVejMp48ibJD+MLsWscZRpY8nbsIBqFLyr7PVIJ/dZmFXYk7rRu+FcYrHPuqY66wAXDIKCNkNGgTAiu9eYbh1iekhheNT2AVFZwLb9Ru/UEM2Ge2cYJYRX7XZLaGWp6Ym2w2wqXp1eA+TofAezkgloGJFiiJXMXs19PrRmjB4F1geLcFvfO+kMt24MlE5uGmHj39MpRfgTk7HIX323CVFftAdeyC74Su6arnhunZ1ms5+hD+vWzzfgs0RFpoAanp2BM2VLrfNcRwzCSzYjs1A22/1DANMNzYxhFE2s= 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)(19627235002)(1076003)(54906003)(26005)(478600001)(7696005)(6666004)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 16:05:12.7314 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fe27b84-846b-4f59-6910-08db45a6da01 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: DBAEUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9544 Content-Type: text/plain The BaseRngLib library constructor for AArch64 asserts if the RNDR instruction is not supported by the CPU. This approach to warn about the unsupported instruction may be suitable for the host platform firmware. However, for a guest firmware the only mechanism to discover the supported RNG interface is by probing the processor feature registers. The guest firmware may therefore assume that RNDR instruction is supported and if the probe fails, fall back to an alternate RNG source, e.g. Virtio RNG. Therefore, replace the assert with a warning message to allow the guest firmware to progress. Note: - If RNDR instruction is not supported, the GetRandomNumberXXX functions will return FALSE to indicate that the random number generation has failed. It is expected that the calling function checks the status and handles this error appropriately. - This change should not have any side effect as the behaviour will be similar to that of release builds where the asserts would be removed. Signed-off-by: Sami Mujawar --- MdePkg/Library/BaseRngLib/AArch64/Rndr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c index 20811bf3ebf3e82d4037a617e0ff3c0336495a51..991adbf896bbb7b2b7d2cea03c75ecee0f284973 100644 --- a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c +++ b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c @@ -48,9 +48,13 @@ BaseRngLibConstructor ( // MSR. A non-zero value indicates that the processor supports the RNDR instruction. // Isar0 = ArmReadIdIsar0 (); - ASSERT ((Isar0 & RNDR_MASK) != 0); - mRndrSupported = ((Isar0 & RNDR_MASK) != 0); + if (!mRndrSupported) { + DEBUG (( + DEBUG_WARN, + "WARNING: BaseRngLib: RNDR instruction not supported by the processor.\n" + )); + } return EFI_SUCCESS; } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'