From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail03.groups.io (mail03.groups.io [45.79.227.220]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7349A9418FB for ; Fri, 12 Apr 2024 14:34:23 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=PVsbzCi9w+FzOFLT/D7rmzg+/5GL/XUFwdIiaOGQI7w=; c=relaxed/simple; d=groups.io; h=Received-SPF:Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:NoDisclaimer:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1712932462; v=1; b=X7/fvXuE/gwXhv7tBi+oVmb0j5aK/MAnqm3dIgMczRH8TdzzFHEX/5XJfdJ/85wPz7hxw+sc VtShWY/taRRNeRrBZVHujM8wSD+NoR3CFxbVpgK4wwbrpmaWI5mihUNvqqPdB+i7jl6EvoechDy 0oEC3Fu3iSklQhyZbYYg50IJ5KLiehQmopCwr7n/bLI09lpBsZdWdRUzzAJ9j0tJU5kT8/1sm+L II5CCbRQKz9AEp83sM+jjCEnXBf7P42RSFbpY4MtFVEX9C0cZhHIrQZO7qWTp5mHn3BbaOk7+Ts fscc+XTm1zLFXt1XgfuYNbTks0fTKdyO5WpTjg5oesF1g== X-Received: by 127.0.0.2 with SMTP id TQxlYY7687511xuhw6LbzuHO; Fri, 12 Apr 2024 07:34:22 -0700 X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.79]) by mx.groups.io with SMTP id smtpd.web11.47976.1712932450836588205 for ; Fri, 12 Apr 2024 07:34:11 -0700 X-Received: from DU2PR04CA0018.eurprd04.prod.outlook.com (2603:10a6:10:3b::23) by AS4PR08MB7555.eurprd08.prod.outlook.com (2603:10a6:20b:4fd::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Fri, 12 Apr 2024 14:34:05 +0000 X-Received: from DU2PEPF00028D03.eurprd03.prod.outlook.com (2603:10a6:10:3b:cafe::d4) by DU2PR04CA0018.outlook.office365.com (2603:10a6:10:3b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.39 via Frontend Transport; Fri, 12 Apr 2024 14:34:05 +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 X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DU2PEPF00028D03.mail.protection.outlook.com (10.167.242.187) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Fri, 12 Apr 2024 14:34:05 +0000 X-Received: ("Tessian outbound 9fd7e4b543e6:v313"); Fri, 12 Apr 2024 14:34:05 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8983f1c102212e50 X-CR-MTA-TID: 64aa7808 X-Received: from 41531f36cadf.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 473AF135-2EC9-4B47-9003-696C04D6444B.1; Fri, 12 Apr 2024 14:33:58 +0000 X-Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 41531f36cadf.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Apr 2024 14:33:58 +0000 X-Received: from DB6PR0301CA0082.eurprd03.prod.outlook.com (2603:10a6:6:30::29) by AS8PR08MB8136.eurprd08.prod.outlook.com (2603:10a6:20b:561::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Fri, 12 Apr 2024 14:33:55 +0000 X-Received: from DU2PEPF00028CFF.eurprd03.prod.outlook.com (2603:10a6:6:30:cafe::8) by DB6PR0301CA0082.outlook.office365.com (2603:10a6:6:30::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.26 via Frontend Transport; Fri, 12 Apr 2024 14:33:55 +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 X-Received: from nebula.arm.com (40.67.248.234) by DU2PEPF00028CFF.mail.protection.outlook.com (10.167.242.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7452.22 via Frontend Transport; Fri, 12 Apr 2024 14:33:55 +0000 X-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.35; Fri, 12 Apr 2024 14:33:45 +0000 X-Received: from E114225.Arm.com (10.1.196.56) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 12 Apr 2024 14:33:44 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , Subject: [edk2-devel] [PATCH v2 40/45] ArmVirtPkg: RMM 1.0-eac3 - Handle RsiSetIpaState() response Date: Fri, 12 Apr 2024 15:33:17 +0100 Message-ID: <20240412143322.5244-41-sami.mujawar@arm.com> In-Reply-To: <20240412143322.5244-1-sami.mujawar@arm.com> References: <20240412143322.5244-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF00028CFF:EE_|AS8PR08MB8136:EE_|DU2PEPF00028D03:EE_|AS4PR08MB7555:EE_ X-MS-Office365-Filtering-Correlation-Id: 510788a9-80eb-41c0-6cef-08dc5afd9b10 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: HxnxeTjUwCYcX9yQaTnrcbR4VdibBCSBO5fPaVzx/3+grLNqOEe7ZxQgxeRD1fluiErhsyOsZ8kEOu8cAbRJ/xsvblMt8cY5lcF/TokWdX8iGWE1Rtjfr7ZKy9Iflg6wf5TdbPiPuIcgHT4yCXzpZfwl0T5/W8nRUiVuvEfQIJgF91GbFju6/ClwvYf+Vn58BWPZwwInRcofwBCQnyakJ+gfdbPXhN2asX+mrYKCH4hU9P109fk+VQzizawsx0I/aJWg8JkBrv8qG7Ij1j2xP+Cx6ANrQYB9o3eJro4B25DktkQ8BDEqWIqmZDzIMcZbEhz7006oUMnq09TtY+tazrT8GGnvK1bpM4wCidK/CbKe+MT4JyRF49eMq5sEIAmz3Y6v6y4GhogaFWdY+jyZj3wF+/4A1OtnbBtUWDS35/7fS4t12p6uD62zaspo5wNNH4U9pZH8CV+Gec6zZOx+eCbtxe1m4sKmVl6tN6cgfvT67NC4rt5PLtCqzAaBuPajow/yGF01DnNBUseX4FUoeNSNrwlmPay1nst8bJ431KBcN/ihw1a+j1KdPrSRppBilai9xJR8JM0kcngh97nZCxHyO05Qdey5NvuIGU5fP41Q3/T9Tj3CjeSF7fuD6tqKkMOrcwwJdfbZFf2YgBckQMtvcY6dFXFAfj7GHiQj+h9QDHqyloz6OcQtSzY9VZ/RRDTAjbRVnVo1hv+VXYQ0NHjw1VI4+OKd3HINF/1CpHOlDJAV68mmycujq24Zmc1T 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:(13230031)(36860700004)(376005)(1800799015)(82310400014);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8136 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF00028D03.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5ae2a75a-8730-4f68-fb85-08dc5afd950a X-Microsoft-Antispam-Message-Info: e40c6WGs+tHjE3XQz1uVZCXaEUxt13zge6/bCAux2vsa/Wws3Q+6ujMf0+pSVkbm4FwIs43G3T2CuA1gwZIMc1OcnzRlSVECoKq4WMqT1pb5Bk6WlgX6MqYbAnpGvLT7sXXtYe24uYq8YQlw6T0lYo3iIoVFrcB9NP1WAjyR+pWc2xKTpZdTcUaeeAoer1FZXoxPmd1bRf2A72lbiAjAy0oXX4IWwe7YA1nGQbMJR7VTfsENqX4Efk2CpgqS4W+ahKuu9PMptsBIShJuom9Dm7+q/ARFvyeiKno6yygarpgNj5Kw0Fq+kPVyXWblOzlXZTEROuPT1cBPt26VX1G5ajmZuh12PeiqPC39re4xwiKwAHnlCr7UEhOV94tgtiMKhsZFv347ykemmG2Dy22RLW4DV3ypUI3KoKxFKjdbNiybMFzG0f1JHJVqUybRyaZVDuaePKMFADX3s4YhEGsNWRZKaBziMy7JlpoCQa45bSiilLzmMjozOvDIo71pD5BRQ1aVlD0yBs6f16ja1jpRimS9cJesQCayjfUZU3nnlbBzp6R4f6r0m5Ie1DSYTeY7KRX9flNrjuiMI9GBW/oV8C8ZYqilIKjx9PKT7Ic86cX1fSrZIcvzZEkRirkN8232ma8ThIKHa9i4abwTg2wZd25KzjkxS/4kTc/Wgn7Nwaj6qw5t48C8eBFr9bWIhkjdhaZV/GOyTl4gseAUQ0S5JwgabhT1kuraEOq+tBAX6hUvGB34+dcseG9fHsRGZ140 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2024 14:34:05.4382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 510788a9-80eb-41c0-6cef-08dc5afd9b10 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: DU2PEPF00028D03.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7555 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 12 Apr 2024 07:34:11 -0700 Resent-From: sami.mujawar@arm.com Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: MKJxQ6gk315ncUkzafkK95bQx7686176AA= Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="X7/fvXuE"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.227.220 as permitted sender) smtp.mailfrom=bounce@groups.io The RMM 1.0-eac3 specification extends the RSI_IPA_STATE_SET command to return a new RsiResponse value to indicate if the Host accepts or rejects the IPA state change request to RAM. Therefore, define the RsiResponse enum and return an error RETURN_ACCESS_DENIED if the Host rejects the RIPAS change request to RAM. Such a failure is fatal and not recoverable and the caller is then expected to tear down the Realm. Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Gerd Hoffmann Signed-off-by: Sami Mujawar --- ArmVirtPkg/Include/Library/ArmCcaRsiLib.h | 26 +++++++++++++++++++- ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c | 8 +++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h b/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h index 5c2f996d3b4376e831a901f2919780acffec3313..88351f53336c42c032fcff6ea97ea7728b917b76 100644 --- a/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h +++ b/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h @@ -11,7 +11,7 @@ - REM - Realm Extensible Measurement @par Reference(s): - - Realm Management Monitor (RMM) Specification, version 1.0-eac2 + - Realm Management Monitor (RMM) Specification, version 1.0-eac3 (https://developer.arm.com/documentation/den0137/) **/ @@ -91,6 +91,29 @@ */ #define RIPAS_CHANGE_FLAGS_RSI_CHANGE_DESTROYED 1 +/* The RsiResponse type is a value returned by the + RSI_IPA_STATE_SET command and represents whether + the Host accepted or rejected a Realm request. + See section B4.4.6 RsiResponse type in the + RMM Specification, version 1.0-eac3. + The width of the RsiResponse enumeration is 1 bit + and the following macros prefixed RIPAS_CHANGE_RESPONSE_xxx + define the values of the RsiResponse type. +*/ + +/* The RIPAS change request to RAM was accepted + by the host. +*/ +#define RIPAS_CHANGE_RESPONSE_ACCEPT 0 + +/* The RIPAS change request to RAM was rejected + by the host. +*/ +#define RIPAS_CHANGE_RESPONSE_REJECT 1 + +/* A mask for the RSI Response bit */ +#define RSI_RESPONSE_MASK BIT0 + /** An enum describing the RSI RIPAS. See Section A5.2.2 Realm IPA state, RMM Specification, version 1.0-eac2 */ @@ -209,6 +232,7 @@ RsiGetIpaState ( @retval RETURN_SUCCESS Success. @retval RETURN_INVALID_PARAMETER A parameter is invalid. + @retval RETURN_ACCESS_DENIED RIPAS change request was rejected. **/ RETURN_STATUS EFIAPI diff --git a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c index 0535254a3991bfe7a19b904e83b9482f801da20c..12636c484824426b2ea81ca007d962f5f7c58f8c 100644 --- a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c +++ b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c @@ -11,7 +11,7 @@ - REM - Realm Extensible Measurement @par Reference(s): - - Realm Management Monitor (RMM) Specification, version 1.0-eac2 + - Realm Management Monitor (RMM) Specification, version 1.0-eac3 (https://developer.arm.com/documentation/den0137/) **/ @@ -322,6 +322,7 @@ RsiGetIpaState ( @retval RETURN_SUCCESS Success. @retval RETURN_INVALID_PARAMETER A parameter is invalid. + @retval RETURN_ACCESS_DENIED RIPAS change request was rejected. **/ RETURN_STATUS EFIAPI @@ -365,6 +366,11 @@ RsiSetIpaState ( BaseAddress = (UINT64 *)SmcCmd.Arg1; Size = EndAddress - BaseAddress; + + if ((SmcCmd.Arg2 & RSI_RESPONSE_MASK) == RIPAS_CHANGE_RESPONSE_REJECT) { + Status = RETURN_ACCESS_DENIED; + break; + } } // while return Status; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117707): https://edk2.groups.io/g/devel/message/117707 Mute This Topic: https://groups.io/mt/105483451/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-