From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66100+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66100+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602346053880741.8980431359931; Sat, 10 Oct 2020 09:07:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ARLGYY1788612xpRcdaJTTGs; Sat, 10 Oct 2020 09:07:32 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.81]) by mx.groups.io with SMTP id smtpd.web10.9728.1602346048983524589 for ; Sat, 10 Oct 2020 09:07:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MvmfkIvVR78dgh4gYLhgGFSbceOSxurNjgKV2X93FuZP5mXuQeFrJ6g0QAKQC4GlpQ9okDLAoZpdURq4TMLGaMDWnAdwBLeEXH53ycJhXZ4oKei6AlBWUXZ7eeas66V+uX2x8jGx/aX4PyFn8D9xMnIQghoHKzRRdijiqwGZXUbzTpY/PVM/SSlOrA7XUEHYxljMAF9gXS13mM900YLl7+dk78gtnP/D9WVoiLusLwWWhRRJ1KPhhaKGkttSZqs1CGw8jJOCPrtKdiLTyg2pIPXu0zx1KoZkuc5qFHZ7C0Z/f9DjIxvye0JzRy9dpeqGXLfp8a3vnF3uNjM4ybaDKA== 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-SenderADCheck; bh=ipkFKQlJ+B95zh2YjPoN74zzBKiElWg+C30hrjvz2Fc=; b=c42kzQ3b6SwEpEc6DX9mj9REWrKWCuWNSu/X4i0z/Oxkz7KtKK99u5RgLGwPm9U1sAQLv7KnnJNJFCTxIkdlkbssZdmX+T8x91N+tRLD8lOsbHi/z0OJZcBkrFakwtvJDDbQM1CxyoJuTgQ8HaQqqfr7miHTTRDA+8I1QyFZaKoI9qutijXOVIzM+k0uyk2mB1UZNJJmTypoD6mS3EMYsnBcRjerblAdSszqAgZdoWnnzAwFjHI/geIA4FIw4TfnLWthFgtTuWBUcpKo7HREClUvsnYzGcsx9xeHDyxyiMj3GrIdrrv50sW2/aYM02Qn1sm81hVlWdNycMlBDS0oCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:07:27 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:07:27 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Michael D Kinney , Liming Gao , Zhiguang Liu , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH 1/9] OvmfPkg/VmgExitLib: Update ValidBitmap settings Date: Sat, 10 Oct 2020 11:06:59 -0500 Message-ID: <2f5fbbbe7183109a3ec28f17f0810032476ddbc3.1602346027.git.thomas.lendacky@amd.com> In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0501CA0135.namprd05.prod.outlook.com (2603:10b6:803:2c::13) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by SN4PR0501CA0135.namprd05.prod.outlook.com (2603:10b6:803:2c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.13 via Frontend Transport; Sat, 10 Oct 2020 16:07:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 00c087c4-c746-4e7c-abe3-08d86d369512 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 3qAHTeB1I+U1V2ZQV4KzD7y+AIQQquc7U1Np1SInfRCzDNys1HPt3yMvOEVBZVOiOr/hyBH76h9hP5z6YWCpWkvkPbIPPVNmdI5/AfIAHdgzT5JMF/4GhYHbdmN4Xl8f/1GqCpvj7IuKLU/C6ECesmEOJ2W+w3FPcBu2jSVazaBs0NrbBhgbne8PeRGyzowOXywQhd/URBCfaVaZqEAZ9Lwi6CzvD4dHpeBgtDPcgCI32olkAqtxdId1AMQDcrnMsS1IBVLUWuvulVLCP1SrQf2Lj+AzqNsYTW47agQXdHm9+Bk3Pj63WeD168GvVToUSP+uOWIh0URxlE2g3js0Bg== X-MS-Exchange-AntiSpam-MessageData: j75PleTdQ6aI4isSFEaKqC3ElvxBkz5L8xF/Yd2OgM0vATRh/A8xqgUzWks3yv6ew1K3W12OT0b9vXE5+E2enjC7ntT/036PdXOvklvgevsYGhY3Buyb8DcCBqzyDbp7gjmAKeH89yYB/1lTQ+RSdikdWB1dAIEJXgiFauFlMR6lymKRhPXQWFlc20sT+aLYayh1FGM8g4hFXqIpOq2wlpxfX1HSSgBUh3CHrk71esqeP4zKjxsUVA0tif7rj7o/eZtO3T1KBVz0uGJrF4Hjo9JnJv6eV2qaHsDsV8VVgxo7c73Yc45QpLMHb+VPsP6MCbbm4jT/PDZIiIJais9YRR2KiiwCd6OFTE0i6GN04on40gc3UkI+W32SxnwmBXfUHyc/x1Ca8XOgGx/OE/dne9VOoALEE+t1C24sld8obOWB/fOJNQmsMeyAhplnawsOyjdj8YuKMO/8xm+FaWOuGpzPtwaqsm6GET3LV47vbEkVGn+VOVbB15OhcoeeloKqYTWQacD9fTduKRtUU7XnVVLr6xCbi7Yjx49oIiXvBIXM7zmXi0aw+oYKBqF6ye28D3qc9N7poHb/nUGm0EW8Q3QfZM34iNqTz7rbrGdwmNEz9civEXgG4GMfmzF5Cbu9PGSQN/P8PypYlI5rsF5MQw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00c087c4-c746-4e7c-abe3-08d86d369512 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:07:27.2484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RH9JnT7Rm6h0gtz3+mdZSEBNTNaIm9jPPZeOmkyq0YHPGJb98Rq5iehtsKW5u5yjPkXUUbux552PrRFs+IWEjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: 3QUtazIFDOrx2I0bD4be30Lxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346052; bh=R8ioIzl/JI8ey0dl2pM0Pw/wDRcpNenbWj599DxRSJg=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=hhHB60QlSjbg+JsrAwv/YkxdA+Q8OBL+oeDmrNMzMExCDZuqRC5tCqmDgHizgHHMl7j YyBk06JNR0CkkN8Os5f4v835TfbQlEujWIqrHm+av2ebMrkfEu3YFRpgK7OlW863HVuDn FaV9N1DFGg94zZ+8OseM9LGkz4UG8er3gOY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky Use OFFSET_OF () and sizeof () to calculate the GHCB register field offsets instead of hardcoding the values in the GHCB_REGISTER enum. Rename GHCB_REGISTER to GHCB_QWORD_OFFSET to more appropriately describe the enum. While redefing the values, only include (and add) fields that are used per the GHCB specification. Also, remove the DR7 field from the GHCB_SAVE_AREA structure since it is not used/defined in the GHCB specification and then rename the reserved fields as appropriate. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Tom Lendacky Cc: Brijesh Singh Signed-off-by: Tom Lendacky --- MdePkg/Include/Register/Amd/Ghcb.h | 48 ++++++++------------ OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 4 +- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/MdePkg/Include/Register/Amd/Ghcb.h b/MdePkg/Include/Register/A= md/Ghcb.h index 54a80da0f6d7..33c7e8939a28 100644 --- a/MdePkg/Include/Register/Amd/Ghcb.h +++ b/MdePkg/Include/Register/Amd/Ghcb.h @@ -82,50 +82,25 @@ #define IOIO_SEG_DS (BIT11 | BIT10) =20 =20 -typedef enum { - GhcbCpl =3D 25, - GhcbRflags =3D 46, - GhcbRip, - GhcbRsp =3D 59, - GhcbRax =3D 63, - GhcbRcx =3D 97, - GhcbRdx, - GhcbRbx, - GhcbRbp =3D 101, - GhcbRsi, - GhcbRdi, - GhcbR8, - GhcbR9, - GhcbR10, - GhcbR11, - GhcbR12, - GhcbR13, - GhcbR14, - GhcbR15, - GhcbXCr0 =3D 125, -} GHCB_REGISTER; - typedef PACKED struct { UINT8 Reserved1[203]; UINT8 Cpl; - UINT8 Reserved2[148]; - UINT64 Dr7; - UINT8 Reserved3[144]; + UINT8 Reserved2[300]; UINT64 Rax; - UINT8 Reserved4[264]; + UINT8 Reserved3[264]; UINT64 Rcx; UINT64 Rdx; UINT64 Rbx; - UINT8 Reserved5[112]; + UINT8 Reserved4[112]; UINT64 SwExitCode; UINT64 SwExitInfo1; UINT64 SwExitInfo2; UINT64 SwScratch; - UINT8 Reserved6[56]; + UINT8 Reserved5[56]; UINT64 XCr0; UINT8 ValidBitmap[16]; UINT64 X87StateGpa; - UINT8 Reserved7[1016]; + UINT8 Reserved6[1016]; } GHCB_SAVE_AREA; =20 typedef PACKED struct { @@ -136,6 +111,19 @@ typedef PACKED struct { UINT32 GhcbUsage; } GHCB; =20 +typedef enum { + GhcbCpl =3D OFFSET_OF (GHCB, SaveArea.Cpl) / sizeof (UINT64), + GhcbRax =3D OFFSET_OF (GHCB, SaveArea.Rax) / sizeof (UINT64), + GhcbRbx =3D OFFSET_OF (GHCB, SaveArea.Rbx) / sizeof (UINT64), + GhcbRcx =3D OFFSET_OF (GHCB, SaveArea.Rcx) / sizeof (UINT64), + GhcbRdx =3D OFFSET_OF (GHCB, SaveArea.Rdx) / sizeof (UINT64), + GhcbXCr0 =3D OFFSET_OF (GHCB, SaveArea.XCr0) / sizeof (UINT64), + GhcbSwExitCode =3D OFFSET_OF (GHCB, SaveArea.SwExitCode) / sizeof (UIN= T64), + GhcbSwExitInfo1 =3D OFFSET_OF (GHCB, SaveArea.SwExitInfo1) / sizeof (UI= NT64), + GhcbSwExitInfo2 =3D OFFSET_OF (GHCB, SaveArea.SwExitInfo2) / sizeof (UI= NT64), + GhcbSwScratch =3D OFFSET_OF (GHCB, SaveArea.SwScratch) / sizeof (UINT= 64), +} GHCB_QWORD_OFFSET; + typedef union { struct { UINT32 Lower32Bits; diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Librar= y/VmgExitLib/VmgExitVcHandler.c index 8e42b305e83c..c5484a3f478c 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -153,7 +153,7 @@ STATIC BOOLEAN GhcbIsRegValid ( IN GHCB *Ghcb, - IN GHCB_REGISTER Reg + IN GHCB_QWORD_OFFSET Reg ) { UINT32 RegIndex; @@ -179,7 +179,7 @@ STATIC VOID GhcbSetRegValid ( IN OUT GHCB *Ghcb, - IN GHCB_REGISTER Reg + IN GHCB_QWORD_OFFSET Reg ) { UINT32 RegIndex; --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66100): https://edk2.groups.io/g/devel/message/66100 Mute This Topic: https://groups.io/mt/77425908/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66101+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66101+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602346062497935.171700054778; Sat, 10 Oct 2020 09:07:42 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id FCD2YY1788612xK1Lx5G8RXC; Sat, 10 Oct 2020 09:07:42 -0700 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.74]) by mx.groups.io with SMTP id smtpd.web11.9747.1602346056643230342 for ; Sat, 10 Oct 2020 09:07:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W9PGgLkXYMvVTGZrofgCJA+7yqegmU/2Wf6KFtfz+dI77ZPuWKFiY0tKCsYlpgDO9Df/bUeZN8XNxe+D7JI5niFltRFx1LAAGsCTmF9iyaWYxFsl1Jv69hRU2tOJpBvBZxRTaa0Qvk77xnpnQ+GTTJVKzDDlrvZG98eJ4uFO8atjlL5a6VkD18OonoAGxFzUNgIG0bJdbueU7C0DdmfGz6pZptiM+SWd4QLppupAijuF7ByMAl+gAkvWHDRYzYpdwO1/aeeJcZvwA5hGxaUwlfnJpI+q2995jNOjPhi1yN8r5gtj1TPrvOa/geKAvv8bE1T44DDeeXxNQsDAhslAHg== 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-SenderADCheck; bh=6K/VeQTzWQKcvAdYO/HjNZmJPx8yAJjXGZANXE/G3H8=; b=JyFkFxGTG52rybz0/wrr9daZEiB0IRie9vw+WRwDlfaPai7SbzD/aTeRLnzRfOJ8e//X4Hz6DKWs/NpsAo5VTHX/J6TD735aYrzbr6B11wcRX5xeipKaU0Ar/tuDhrpnR5KJjo04kpOfjZPy+tYBPOwWyKdn/nqGPWGiXQzlXh4Mtr/M/SRyNnSXGoT79ZZRMa/aMcAR/hJAEkhR2HZBbBjEPD02wCEK33Il1S/rz500f1PZ6Rj91WENGGXbQu1L2JdCH/eY5otZ5qJBx3B+kiJFJ24SaRXpmt+FoiQuAfiDWNi4Fk9H+5xyUG/grT8Fb3NIBWXb9iA3LsVwQf/JjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:07:35 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:07:35 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH 2/9] OvmfPkg/VmgExitLib: Set the SW exit fields when performing VMGEXIT Date: Sat, 10 Oct 2020 11:07:00 -0500 Message-ID: In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0401CA0002.namprd04.prod.outlook.com (2603:10b6:803:21::12) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by SN4PR0401CA0002.namprd04.prod.outlook.com (2603:10b6:803:21::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.21 via Frontend Transport; Sat, 10 Oct 2020 16:07:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1b7da30d-90b6-4637-0e7b-08d86d3699e1 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: p8XBZ6glw+QAwX8xne5HdR9oXzT1wqjfqfviT+TgblTsiXCfW1EDLrgo8CciJsZJzdT10DjS2pfsNDxb0KrqaOqpkKMblynZxlntGdEsP671KnmP6LV95fZYZxDG++ps9bCT/clnZrYSz0SiF5XkWOW7HVwt+DBqv7hUm231ixjANWIkkZNxrnuH0xK2r2EjskrQD6IUpbHNN+RKnPs4BLEOhBwLPC0IDKUgxTF9zT8wW4WyQFzrRO9rTrpZN1u5riTBEmmKNTdz3v/A47lvw6RW1DKtoaxp0wX6UV/Jqq1vt8rHoKk0GZ0qzzugjwK/dk8Hq9nsyV/wl9yFigNlbA== X-MS-Exchange-AntiSpam-MessageData: 9U6vjRhYlwINUzxM2HnK2u7X1dt8GrtRrgN3/wu2O0ZcPvldd4FBS17U5EpsEcIcXVPrpCvJ99egXbUmnsDgXlQUn9s7jVoCRiTZuNbSOQntfw2cCtn4KT8JElWGlinB9KzYL7xDY72EmfGI4J0gdjP9lQ+jsgXZZ/2VvwuCjbH98Nz8Id3bZdPbXPqUED39rrB42CPxU21ZY6cRhHRkFboB0KlQcfp/2WAyCiBPT5d9fSoLIu91biSbxoLQXXayZWccG0H3dAhS3G1J9qKPZIP6iKeBxhuXJ4UMIcmWTERI1OnnLimJNyHke7+72SRDYX2oiaN4+WsSoMq1GpHZ7FI55s0Y+xNuVw6jxz/oVs77Gaol5Uw9TS7pBuEomgFfyB8xdpT0qJUfwQJJeLEezo/ICNtlwi+FJC8SuqDx1qHPKvCCh7M9j7pS/ExWbwG6foFPt/5AJ0OZXIkHTwkMNh+MFMszw5roWoSxlwaM6ALODrmxMHwJy13ayTURAHED2aP9qaNAi5ajx9bS5E94F1TpoYnEwYocZBVYPqiz8Y5BeOJszfASfKGmNW0id3pJfg1awtPovbLI7IAzSCKhwaYK9dBnTToDLqe0XYtmt5hPqw7BuaKjo6gp/0n8WyfBIK4x1Tkl2owwAq4wEXQm6g== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b7da30d-90b6-4637-0e7b-08d86d3699e1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:07:35.2329 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /tH8CS5/AaUTuxvSEsSoJ7XWYsZ4eZa6UJgiU6u/xlDiD8JtTHm5Gww9cPa95ZMWUOlXKe65y8xbTBMKW3AxQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: 0qEcjC0jDh4s6SHZlOilp3Wbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346062; bh=4PmASWCQIcwDSahM0JmVwhd1LmC7WzA77/VfuhY++5M=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=oN8kihc7BZAo3cNgcKLI/S7e/fxIXkBKmdA6/0miExRtacSnJ0IwytowXR/T+Q4FHRu NcMduVpIMWRqonj76EEPeXCpiMWY9cxiPA0V+9/jpBBJV/EG9maBg6C/yz/Ni77D+SIYM DJd/aA6SNt16YLitTR7uwzpJDL1Zge/Hk68= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky All fields that are set in the GHCB should have their associated bit in the GHCB ValidBitmap field set. Add support to set the bits for the software exit information fields when performing a VMGEXIT (SwExitCode, SwExitInfo1, SwExitInfo2). Fixes: 61bacc0fa16f ("OvmfPkg/VmgExitLib: Implement library support for Vmg= ExitLib in OVMF") Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Tom Lendacky Cc: Brijesh Singh Signed-off-by: Tom Lendacky Acked-by: Laszlo Ersek --- OvmfPkg/Library/VmgExitLib/VmgExitLib.c | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitLib.c b/OvmfPkg/Library/VmgE= xitLib/VmgExitLib.c index 53040cc6f649..6cf649c6101b 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitLib.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitLib.c @@ -78,6 +78,32 @@ VmgExitErrorCheck ( return Status; } =20 +/** + Marks a field at the specified offset as valid in the GHCB. + + The ValidBitmap area represents the areas of the GHCB that have been mar= ked + valid. Set the area of the GHCB at the specified offset as valid. + + @param[in, out] Ghcb Pointer to the Guest-Hypervisor Communication Bl= ock + @param[in] Offset Offset in the GHCB to mark valid + +**/ +STATIC +VOID +GhcbSetOffsetValid ( + IN OUT GHCB *Ghcb, + IN GHCB_QWORD_OFFSET Offset + ) +{ + UINT32 OffsetIndex; + UINT32 OffsetBit; + + OffsetIndex =3D Offset / 8; + OffsetBit =3D Offset & 0x07; + + Ghcb->SaveArea.ValidBitmap[OffsetIndex] |=3D (1 << OffsetBit); +} + /** Perform VMGEXIT. =20 @@ -110,6 +136,10 @@ VmgExit ( Ghcb->SaveArea.SwExitInfo1 =3D ExitInfo1; Ghcb->SaveArea.SwExitInfo2 =3D ExitInfo2; =20 + GhcbSetOffsetValid (Ghcb, GhcbSwExitCode); + GhcbSetOffsetValid (Ghcb, GhcbSwExitInfo1); + GhcbSetOffsetValid (Ghcb, GhcbSwExitInfo2); + // // Guest memory is used for the guest-hypervisor communication, so fence // the invocation of the VMGEXIT instruction to ensure GHCB accesses are --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66101): https://edk2.groups.io/g/devel/message/66101 Mute This Topic: https://groups.io/mt/77425912/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66102+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66102+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602346067001502.39232868850695; Sat, 10 Oct 2020 09:07:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6f7bYY1788612xl41IVt1vXx; Sat, 10 Oct 2020 09:07:46 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.82]) by mx.groups.io with SMTP id smtpd.web11.9751.1602346065941820546 for ; Sat, 10 Oct 2020 09:07:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XwNuoEZnOE01eqlC1nvN/FdUSeuoghM4te1w52UffCAzhyGfUpKSWtn542xPKK2PTA3cp1Gs41Cxh6pOYpp3X6F29NyhQI3isyojrmt77+7wdkd6B6KHqnc6tzzwNGbWokrhkL61mg9mAka4+efFG+ecXIf6vtQ7m5uH+PMRwOKBE+VwWy5KiGd+Mdgz548tlVmHDD5Orna9kxR7YtI/yR7+iXJL6LjcDoQ4PrndWGZVRJvGxtNw6ERZtk2mg5O2CGjwRFSJMazO2V+Dm6+OXtFns2quKk9KPbCjldQM+ZIN4Wi58jDiBh1zqMw8ad7h3oUaOxgCqMfrnMQXTsRVKA== 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-SenderADCheck; bh=56YhNAPoxgXoPuaIFQxTAdpXEETGZcaZb/FvMjnf/BI=; b=F8F3Z0e9GlHDFh3zkuC0E7D98otwbUNzJZSUuDGphznw3i3T3FtCztYtiZp36vVXU+aRsfNdiDMA1EeHhFmEosQ7+DWAZ/fuPf4BfB166Acaq2AWCVLfR2DN0sNkUczfsYoK7GhVwQ4D0NROCgVLVRCJ6KKgTeOHlm/S5YV+TN7wDiuDzU09ApGbpIHiRyHWxZF38hSD/7E6VSxgPepMYUrE7/n9qy7aZyFZ9JhH6O7eXV1nk4dojrlC3JYqDe30/tLWKq/dkDPRpcPIPEBAMvQeozol/DYGFvIOWDkaSal1G1BWrgul6h9y2bekRg2hXMR6/kEXHI01Oxi0TLtqXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:07:44 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:07:43 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH 3/9] OvmfPkg/VmgExitLib: Set the SwScratch valid bit for IOIO events Date: Sat, 10 Oct 2020 11:07:01 -0500 Message-ID: <40baa962280b2e0f6e13d79c427910a223c77283.1602346027.git.thomas.lendacky@amd.com> In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SA9PR03CA0022.namprd03.prod.outlook.com (2603:10b6:806:20::27) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by SA9PR03CA0022.namprd03.prod.outlook.com (2603:10b6:806:20::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28 via Frontend Transport; Sat, 10 Oct 2020 16:07:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 865d2526-a36f-45d8-60bc-08d86d369e93 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: J0YQX8C/tz/cHsgYgqe66ECYymRW7bXY9LvJKPVpRYe4S5oiauJf8sp8vsKzE5lDkfjD57BNWLjat56hvAa46w53u3HwMWxpx94uMn/vOIBT8Aqd0xxHHXjO2NHCFQUfmK25fA9l0CCl3QwtQz8ZbaDsaOVSEFtVrFlwINDg5GCKNqeq59ghAmco9f8ixWy79E77lo2gedoeLWRKGVIBhXIjPCU0Et+uywBM1H4+/EbRlOkRNsPiPHevMk7RZOBQXLSW/gTfxJrq6lK9FhX8UNT296L3kA03S0FyfaO4lgjBTFCcI8IgKSlJUKKZpNKeZHcEshUGHZ8azqz1wLuDrw== X-MS-Exchange-AntiSpam-MessageData: F++1iM4hMHIdlbvLfm8cNuD5IRkflusqD99V1tkL0JyWjzDo5SMh1D0lqxAxXrATp4zKSnG1/A5JZaQ9J7yjZxATDDpe7Hxg1ZhUL3RLycanipv0sA58Mn1cn8g6+sI8HuFyE62wdAdrG9JfYvC3FvluVtvUJUB8jDmTU6YK3hPxxOTE8fDWvUKL02MdNRnvTPhET3W3vhK31umFrOJ5W4xWccbq1aHqFPcwSOpxK6FJ2UcX2qexZRMFaP8xmruNfhAiobiSLbEOKKy9PuexH+HJb4BG63U5aR9Zn+a+WuUChDKipPkNGfCooAHd/eqqTFsd7LQwcUs82WkzFcU5txZgr9kxGmapHJs8ALNITbZorpvcVmYjS+f0VaII343wCftKl5JxLkQY/B+WbAG0CXXfrzhTSBrooFIAQzh9m7arhnBFQBi/smikjzkq5z7F93kiLVgkeryf3bv0pBsVh4UYmg0JR77dhVS0v+GjZPceSAnoc0pU6A/9/e1BOWL3FfCa40a09XetViUam2oLh8XjlrLd6fI2HkmJsk9tmLlMzbVuoUTIFFiKFvmH1VixmzOkHI8nUhwp+tRMZGF7bOV3vczfW4xQciAMCNCMTPZSQ7g0gBaMCf/JhSNwOLygpEBZDJ4tO4X6atMkvZwGJQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 865d2526-a36f-45d8-60bc-08d86d369e93 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:07:43.2323 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XybvJ6gMW3yoIQm4RIV6RGLv8HWj9vqbo9z4zcl+apodcsMNhwr3KSt7c/IjNUZ6Qk10W9yG3BI2LqvMphtiTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: lydJH7Xj7LI7uHMhXTBTKEX7x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346066; bh=srJXWvgQK8OnUCM4ILsxE8Sf4igyjHKi6wGqHrYdiMw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=VkuI7yJEl5TNm52aSVijJYwsAlCKf+wBkM0chHPnl4dD0MJejGQBNp0gP7+hYgmgdRp 7nQImzJDpyUOpBNt+yVtpXL0ysEuaL+3wYGOZyIqtlyTBN2gV8yy520MRUfDWrT3sTJ0z 5/RW2pNvrs5XPtUCMaLqyxAWOD70rJ5RXGo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky All fields that are set in the GHCB should have their associated bit in the GHCB ValidBitmap field set. Add support to set the bit for the scratch area field (SwScratch). Fixes: 0020157a9825 ("OvmfPkg/VmgExitLib: Support string IO for IOIO_PROT N= AE events") Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Tom Lendacky Cc: Brijesh Singh Signed-off-by: Tom Lendacky Acked-by: Laszlo Ersek --- OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 1 + 1 file changed, 1 insertion(+) diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Librar= y/VmgExitLib/VmgExitVcHandler.c index c5484a3f478c..40120e29af18 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -1289,6 +1289,7 @@ IoioExit ( } =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + GhcbSetRegValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66102): https://edk2.groups.io/g/devel/message/66102 Mute This Topic: https://groups.io/mt/77425914/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66103+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66103+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602346078334378.348918264944; Sat, 10 Oct 2020 09:07:58 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id U4NuYY1788612x9VyWKJV66u; Sat, 10 Oct 2020 09:07:58 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.53]) by mx.groups.io with SMTP id smtpd.web10.9734.1602346072505678686 for ; Sat, 10 Oct 2020 09:07:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FcWHpHI1znxcv7fFHJV5qfrb/wLF9NTMm0+ioPjCv7tNrufS9geSqBGIelOaUlJAYvJpJ9RD+oBt2zKOm3+xvU3gYH6GEgxC8v1MjA42t0uAQeaFKOQ/1F5t1y0RvrHp1L9o0ZqFIOEfZ5LKF9tiTtiqR+FqHelulCD8uagaMZuKwW9Kini0a70tirCeggr0pYauXevCYJdwmRbRC8EqSDycFn+S8yudGL424NciVrrdPJ4dhTBUoqllY4UHKvI+8hjrvkAc2pknfvyUVVq3bsVF+9pfJShY0OaYCbWDClCVyamz/LCGSjcAMdi8Jx/KQBBWEJFNkW9QvPTAkx4mgQ== 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-SenderADCheck; bh=JH3mKHCPevyjnN7jm1S1lygCkWy+5mN2HfpAPYvijEg=; b=HSu7fup+a/I6R4PQ+vO8QVCRSHCFh/c3QYYrEz1oAphUlTiAdU25nRG5eNx/NLf3buPe3dlCbBIM9a4U6IsngH/0wWI2gXWkiF9TH5i3hOixxLl9jZDG8+YC8haD7NNt73O0B5Ve/hedarJ0fIGH+uxHnnR8ZB5tl0b2QKP65driPaIm8f65ZizUniMfUCrcuMgUvlPrnJrE7aDVFL7HpFcGbb6Q0oSlGkA/DivsFX1Z5JE47qJ1uJnrua0xT6CZDJ6qirMyDFaP+HVEvEFkQI8jc8OkXKeg/y9K0TKrMTKFgZ5qPw9gjOD1HBo31xCjQ2wZupdDIVVXCM0YEmS+IQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:07:51 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:07:51 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH 4/9] OvmfPkg/VmgExitLib: Set the SwScratch valid bit for MMIO events Date: Sat, 10 Oct 2020 11:07:02 -0500 Message-ID: <6c91fcb168d187ff21f753b59c67ed9af0f23f1e.1602346027.git.thomas.lendacky@amd.com> In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN2PR01CA0075.prod.exchangelabs.com (2603:10b6:800::43) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by SN2PR01CA0075.prod.exchangelabs.com (2603:10b6:800::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23 via Frontend Transport; Sat, 10 Oct 2020 16:07:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0b3e2b08-a20d-4bb2-c76f-08d86d36a368 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: rz/VfjJVXeVnPn8DC1MLna3+NBmSd6uLKoQv+YjjLu6Jw0a0KqxNaY/3VXaKDurKCzoIjFonYT5s91acWK3JQguLnRddbD2lqEbhWHNmox8vlNVrfPqv4OQiHYpf+zizdjf++2qhhaXauiX6BkeMvBq81Vr2yxl2me6L3mk/LE/7msVgdmB0m9yFCXA0mIeKOpwSoZq38xRy/Jsi0/kVwed2wQFDRDGDROJIAxS63bFzVGjA2ktc5RKmJfC1Hja+ppNOX+3TbrAy9tqO++D3Cv87X6XWQ+IjM0U3xUTQQk0YXET0x6JRXfNjfz20hUaUdKClfTNult73LL3UAnxSQg== X-MS-Exchange-AntiSpam-MessageData: +cLcOPBCUjcQX88DU3srVVuhDMU05EOF1p9SNpwSQ6Wbo1hp/EdzV50bOpO5dHWZogZyCA9MtlfG9OD2XQbk8MS32PJjShFeKDXZfz7POa1II1LsL1Z2BtX86Ao0vK6ZA4ol4c4Vn7keX6FWgf+L4+tp2kEUdIV/NzRQww63umZ3OPY3/p4DdMJ6hTub9keLdI5m9PIHLyRI/yubzeDKKfdRr1SEN8VU9UoRy/RKMt6gQtfroaGmEiEOnePEUlJs/RjnrSGMu8pXNNHha5cqxQW4CYv5bZp7qyTCAzQ6M8LXVr13oo0hX29pBGl6E+5akVylWt4QvB+HUZUa7Rw4jezdLEF4mTyMc/Y6v/ZzknGXOSYNKi3EP9Tw+mfdkxNh7Yg/IOlt/DZP3xItj5l672wC+sSrh4STgEjNGkSjeXdsFtZZy0AvuUtMI783I9pikYozAfQbZClcRxAK/YDtyaj2HrvwaOKVriwVp5p5nSyFh270DL3mzJv22fRnP8xHLmyIUxxtUdpsbfBq3uNK6MQf822RWcI+Njz5iAkWcU8xPW0Q6Tqj+2eTV7JvP2fzJwVRpcTLZk6g2BD1gJy2EumZAOanHPHDYM8kF6GzhNvLLZTw/sXtk1AGZMoG36JelEQRkpiFkgYXT5Aim069Qw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b3e2b08-a20d-4bb2-c76f-08d86d36a368 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:07:51.1639 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 73oDwJ0NKzooBx5tu5dbZYguPWz2qgEz5IMAbTvWHsZrdJittZFDbSDqHnwHwvDzmOlng2V7CSIDxWO6or0OSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: sG61SdaxcEuPnlewZJBJzT8kx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346078; bh=wo/37dsk6nkHlMQ4SCwnLttihlkMvSuyuw5/8HbMFWk=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=HoEUgMdUwZvX0VQ7oKYCoL+MbsImA9QdT9JPwwBtKUtmui+NoPzoOShYPRwJf++FQoF Mzi7ROf1NeokOWvQw9pN+/C8Grune+3htSBVm8HmBztlKAknSNFNu3EwCcH0/p0YbvUnV O0/PDgnwlzvv6ffQK32RWVNgVLNqS5Tt6aU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky All fields that are set in the GHCB should have their associated bit in the GHCB ValidBitmap field set. Add support to set the bit for the scratch area field (SwScratch). Fixes: c45f678a1ea2 ("OvmfPkg/VmgExitLib: Add support for NPF NAE events (M= MIO)") Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Tom Lendacky Cc: Brijesh Singh Signed-off-by: Tom Lendacky Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Librar= y/VmgExitLib/VmgExitVcHandler.c index 40120e29af18..6d6fe6800031 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -720,6 +720,7 @@ MmioExit ( CopyMem (Ghcb->SharedBuffer, &InstructionData->Ext.RegData, Bytes); =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + GhcbSetRegValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; @@ -749,6 +750,7 @@ MmioExit ( CopyMem (Ghcb->SharedBuffer, InstructionData->Immediate, Bytes); =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + GhcbSetRegValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; @@ -781,6 +783,7 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + GhcbSetRegValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; @@ -811,6 +814,7 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + GhcbSetRegValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; @@ -836,6 +840,7 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + GhcbSetRegValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66103): https://edk2.groups.io/g/devel/message/66103 Mute This Topic: https://groups.io/mt/77425917/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66104+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66104+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602346081543580.2271672316496; Sat, 10 Oct 2020 09:08:01 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ANdwYY1788612xXFctxzmynx; Sat, 10 Oct 2020 09:08:01 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.61]) by mx.groups.io with SMTP id smtpd.web11.9756.1602346080563250529 for ; Sat, 10 Oct 2020 09:08:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RPohHryA2fbv3pmaJH2GCADo122Pw9Ek4tRmWpEozTF9WJ1NvFfZbSl/zOIVWfPhx8H5wX3wA+CKgo4zPm+0WkClyeLaflCfGKlUxU8HN7cef30Nj9XoHro3w4D6cGDDFDI310QHGFhieGPn9/mpOFl2vhWHBSDE7K76GriVNPuH48SZs5rXOTUuQvyPwDDMPEjm2lL1P8OTgC8eTDi7DXkhLiRdjJ6AGhCtqj8Iu9rjVwQ5doVIEWw5/Hc5hyqWaZbJAxjSVOWD0HMqpBBm5ZeI46FwvSnSGv/tVbbC4YTEgAtrRmTfcbcxWSWu5oFEfZZGUx1f70Bsz0pxiwguGw== 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-SenderADCheck; bh=YDWSZVPqGtaROeShxydZVGUgvwykwDUoCraolw+xenI=; b=LIu/SbqyxqEsPOoEHVEmlDglJzsCQxmevYgu36D4PqkMI0ZZaCicWFrcBnyEim6/kmC2pW7Z9zkdhDXmir+CHtEvj0awsucm5qIuujVCWoNUTmrPTWDYo8PNS6HKb/ASKPkt1CKyyYroSe3TmsBbdjYsaYj88DWJIpDJcAE26ybx7LCAGnxIjjJJ1KZnIt9kqBbyr/M/d2pa/HqgIrtCyCI1xB14rpG7XPwh3U33U49Mhp0d0Nik12Kvp4HiY2wsoRjyBGWDlAjnhz0sC9IzpoL1Aj6pLImzReqA+sTvbAkrth1QPlsR0YKOo0l/AFiDWlpYpLuf8/wBeSyI4yFmPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:07:59 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:07:59 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH 5/9] UefiCpuPkg/MpInitLib: Set the SW exit fields when performing VMGEXIT Date: Sat, 10 Oct 2020 11:07:03 -0500 Message-ID: <2c01c358aea038dcc09eb1b46af19fc1278adb93.1602346027.git.thomas.lendacky@amd.com> In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM6PR11CA0027.namprd11.prod.outlook.com (2603:10b6:5:190::40) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM6PR11CA0027.namprd11.prod.outlook.com (2603:10b6:5:190::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23 via Frontend Transport; Sat, 10 Oct 2020 16:07:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d7b35ef0-681d-43d8-fc1c-08d86d36a804 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: RHDz/4Yw55flC4nIVc9ypqE52laQqHqkRODZ8e2TOmLP1TooIUxwuBaK7Of14/Mop9oWmJLCJM0ykF+/HTsKMmKvRdmbvGN3pdw10k93UjKdD7ePIJbV4wxXNOJu69Hjk9bnbBE7+dq/Ca4GZA8SO2V6BaPIYcUYgVPklZ/x2MaL+8Qy3RJFLnMe/DtxJVdXALttkXi1HzPXfbC5LxMbNrDwuc31BKAt1MlGFGWO+sFPMB4HqD9QgJ7YjCdOYtYDr+t7EJgiuoNf3kbUFreXx3eg3iNyCcgsTSVzZBfTcOYGR+c8kTTJsFsMFocT06htZBpkOgQrIjPfXKaGEKU4+g== X-MS-Exchange-AntiSpam-MessageData: GN5Sba5Kh4boVtJ473bPtp4AFnQkySspBWdkxBG8JPrNjfVW6wTXyXfW4IqSNk5Q+ywF9vbCHcfd4lY0/MajL5zm1smk8SfPrwxvgQXGpzKPb2t1UIWwnUzHpecMP4CdWc63HyeNKgNfNDbXXSGIgXvi/e92mEmsed83ZBC3ur1hizw3N1EyfadoX9AK3aiRu5SkR5ADBCF95g0cF91iMv9IBD/pVZCiDIAKhfV4CzYfWy0So4Q+wG4/nZfO2a2mh5VKg/4+b8ltMC7/obN6iELuw3YoSDfFEYlbwuKR3uAkehBv/axoomN7wT4gorbrQC5y5ySOT+aawunZPGlWIOltJdsD4NHtF1Qfz2hSEw1ATlZtjt/zWbFPiWCDRZIQQUqOEukSoCsFVFz4KPJLHg/1zkztDmGRc/lKOGK1UnDUsOnEZqNnHqnkPbWuQ2mecTGa30u5fwXPG3XshwS9tv273V5kZpkC3HjXLYGWvVIuHI9O3WZ+rMMYdLJgQSuwaHwjREGmivHECzhZK7huPW7x5Q7V32prfK6ePBmmgGi/cZx2utL07wtuIoOVOwho7wsSy7y09SCrd1C5RAqgcmMDIf5NqhCi8Rf/yDVG++FTNWINGO0hOA7+C0t3hBivxfgyRzvrJ+8Lw4x4hJXH+Q== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7b35ef0-681d-43d8-fc1c-08d86d36a804 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:07:58.9394 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: n8lH6a3sGOL2yHSo2fN7zVJuwcBkxclv9yzOgK6Y2JIdDcSif+2HAc/FE4r4DDPTvP8iRb0tQ44994zXXrjA4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: 0NGgrZt7c91ICTFwnqr5EAVVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346081; bh=Uld6mCqJAJkxv/vIp35NS1g0hE6HDtTM3yNKq5l5nW8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=cL7f7tO4W/kll3YlFoSQmrb0XKKmMNxfyhR23l0LC5iTgz1dw18vzRmBAeLQOhoKJ3X /hzh53LfuOrhgqI+/Nc2ULXd9LaQJhq9/vMuLtZfoPGKA4eyFxJW9MRZQ2Q+H0OPUE8Zo HZIlHoSdoBuewJY6GI6in/6KiCRih3BcZcI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky All fields that are set in the GHCB should have their associated bit in the GHCB ValidBitmap field set. Add support to set the bits for the software exit information fields when performing a VMGEXIT (SwExitCode, SwExitInfo1, SwExitInfo2). Fixes: 20da7ca42a33 ("UefiCpuPkg/MpInitLib: Prepare SEV-ES guest APs for OS= use") Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Tom Lendacky Acked-by: Ray Ni --- UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm b/UefiCpuPkg/Lib= rary/MpInitLib/X64/MpFuncs.nasm index 5d30f35b201c..5532a1d391bc 100644 --- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm +++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm @@ -533,6 +533,12 @@ BITS 64 =20 mov rax, 0x80000004 ; VMGEXIT AP_RESET_HOLD mov [rdx + 0x390], rax + mov rax, 114 ; Set SwExitCode valid bit + bts [rdx + 0x3f0], rax + inc rax ; Set SwExitInfo1 valid bit + bts [rdx + 0x3f0], rax + inc rax ; Set SwExitInfo2 valid bit + bts [rdx + 0x3f0], rax =20 pop rdx pop rcx --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66104): https://edk2.groups.io/g/devel/message/66104 Mute This Topic: https://groups.io/mt/77425918/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66105+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66105+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602346094074119.72480547482633; Sat, 10 Oct 2020 09:08:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id wQS7YY1788612x8hyXcPAcqi; Sat, 10 Oct 2020 09:08:13 -0700 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.82]) by mx.groups.io with SMTP id smtpd.web10.9744.1602346088161265665 for ; Sat, 10 Oct 2020 09:08:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MMmLz+EaDtt7P3U3ezViS/59TS5SK5TFD2KSqtuSQVwNJOvdf/URMVhB/aUpTfzr1q5KUraS87navhP98OU6jZaVrMDHsGMnt7wJ2DbHVG9Nyt9AX0DSfHwtONMm/agbZUhQUioxaW6mozMpbXeW3TwjY5mPb0NRGRJ/aT1ueawvJxoqGXmtSSsFw80GGYyiYu7uYC0ATVJIssIkZw7x1BCYN4ijDYV7gHC/elw8qigsHFbmrbhwChjwk2sfI+Xd6xFdIsO79NuAiAwEqfNE55plTjAmn5AdNH781K7n6dnFAV7mqibXaOCAktkz8t/Zk6tsU8gYNuzsqVJv2XJbiA== 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-SenderADCheck; bh=FoEWNi4W4MamjJVj57cIp9PLaCuw5iJbVDkBZcEyOgs=; b=Xy5/Tu5Cu86QETlxEvsIrIkmwoVkUqlE2+HuGiGg0UpWsoTZjaGeWuhDQLWF2b2KGWWQcxpnzuAODV2Y9xcPJ6ICKzcp0gwENiEWsXGzAQ8dG6SllXgMG8JSyaNCnWBv10gVH2goAtn8jBkkqQwraQEyiE5yt3p/3fWIMwUHYOG08zaavQwY9OQP+FKTu+OzrFGzg8LgcQqYO9LmlkDSSV/tJSaZl9dEDRa1E3zUl3guXscO3pr0xzqDCtJH2ACQFkRCmG1GpL85GDBjmjpmRpJ4i062+SIHMUfhXriAEEypype2IvQFFWj1AOYAh5lnbOV+eu75HKXpqxaapWaBEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:08:06 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:08:06 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH 6/9] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Set the SwScratch valid bit Date: Sat, 10 Oct 2020 11:07:04 -0500 Message-ID: In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM6PR11CA0033.namprd11.prod.outlook.com (2603:10b6:5:190::46) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM6PR11CA0033.namprd11.prod.outlook.com (2603:10b6:5:190::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23 via Frontend Transport; Sat, 10 Oct 2020 16:08:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: abc97712-8f55-43af-a9fe-08d86d36aca8 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: zD5hZ/eqOiVW6HUMwpafQ6FdbHeNeh78NUkoytSe7ll0nzGSyFzX6UKaf7uwkqAUwlk8JmUv112cSoh8yUr2tau3v7j+grtDFG8I+rckmhXP2Jsl/6aLcSFHiDGJhLpkD0aFFtBHY1ULoURfbDsaGd+Kty0wEs17nx5AfABw+3rZvNh5CiTx9CYS/gHEIa67XNRClkDWwTETVOYbSTgzKMFDFd7bt+EMRpl9cq48FLCRh78iTDTzI4dvqi7iSGbhVBz+Txr/ExaMrcptbXeUl9bIxEZhUUCE3VeXLwKdbxyK+2yA13DfRpxWe2OJBTjvnIlUBYyRRzZ5Bpr7b9EYkbBS0avkGQzuOpyHRZtI+S8K86rBx4tRtYPGTwbRgwtl X-MS-Exchange-AntiSpam-MessageData: qkphZBCUrvNMg8YYqufd892Ao4qXHCVVePSKsJMkVY1hs+m26FZaGLL2faFpPCJn5Q7UVNVh7LHJMrVVlaxOROSNk8Hh9Uwfsn2BI3MA6gpzGGd5n/3JB39leDC2YWuPvhR5hXySiiCItrZtTOUMLDd+BryOKMFl/EgvFCt1o9QAqkSl9TkfR2IcSS7oQ/iFqYz4R73NkecbJv0u1kLtr3hz/vW7gS4n0xpah/EVrh0b8Las3xGJ0dO6u0xJc86UYIvA+ABwhzrnDsE9cQSyuyD8eTyUYRDZvPupxcIQ0bSHqwB2BRxv0L7qzXqLT1a6JhMzm+rvhUL32T+W7sKkiPdEr9115lCukERrO5EsojmMC30ithTsi5bGhD/5HZdPCenxDRRvJRqP0Hnj/mnFDRpgkmoI2co+MUs61rs5WdLu/CCmOQab0wh9mpNgZvkPjYVgX3Vh7zTDOHtc/uVKqZEgzqmh2QYGFfQ6hjjh7nAoo3TRUP28BxTGZaIWJRrGNx2KIIx9E3E44qaiwfSPaT4bHGyk/4AKCBZ9pQjLgOdQGK26CCqC7GzFX5KO+yu/9SNYrTnEsz/FxOSnsotGWvLQ75tvDYgfmxJ7H5Ti1Qab9Jb/BA+PV4FAbqa4CbRmBSgDt9mlr4Lm99eLS/fKuA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: abc97712-8f55-43af-a9fe-08d86d36aca8 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:08:06.7490 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zWGkl8KirZLVXZOOifPcQTrAVrSfXUqz/D5hTquuCGPBi9VAz3i5wYveeVon6n/56Fr9Ez+c/1cTrstVV44/mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: VQjX7a2rCUiX9vqE36TMFl8bx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346093; bh=p98m51SxNfNumcZP5RYufguepfcNqXD/kYZnmwqROSc=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=M6Q3vZCDt2paJlWA9mwkShgWItoQqnhyiMV5269NaquGbWBt0FeiFP4J56spX4R7QGC gos0XloOfO86H0sneGVJYrhLjxOZ6NeoHt4ZVBcVdpNYhfE/LPPeCI4gHSdgKzT0rrYP/ Wq4lHRbWgli0K6cpnoJSWLPcbbK7gT5zuX8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky All fields that are set in the GHCB should have their associated bit in the GHCB ValidBitmap field set. Add support to set the bit for the scratch area field (SwScratch). Fixes: 437eb3f7a8db ("OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash = detection with SEV-ES") Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Tom Lendacky --- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c b/OvmfPk= g/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c index 565383ee26d2..5d5a117c48e0 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c @@ -52,10 +52,15 @@ QemuFlashPtrWrite ( if (MemEncryptSevEsIsEnabled ()) { MSR_SEV_ES_GHCB_REGISTER Msr; GHCB *Ghcb; + UINT32 ScratchIndex; + UINT32 ScratchBit; =20 Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); Ghcb =3D Msr.Ghcb; =20 + ScratchIndex =3D GhcbSwScratch / 8; + ScratchBit =3D GhcbSwScratch & 0x07; + // // Writing to flash is emulated by the hypervisor through the use of w= rite // protection. This won't work for an SEV-ES guest because the write w= on't @@ -66,6 +71,7 @@ QemuFlashPtrWrite ( VmgInit (Ghcb); Ghcb->SharedBuffer[0] =3D Value; Ghcb->SaveArea.SwScratch =3D (UINT64) (UINTN) Ghcb->SharedBuffer; + Ghcb->SaveArea.ValidBitmap[ScratchIndex] |=3D (1 << ScratchBit); VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, (UINT64) (UINTN) Ptr, 1); VmgDone (Ghcb); } else { --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66105): https://edk2.groups.io/g/devel/message/66105 Mute This Topic: https://groups.io/mt/77425919/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66106+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66106+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602346096599424.34077108616407; Sat, 10 Oct 2020 09:08:16 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bnfjYY1788612xBIfdAyoiR0; Sat, 10 Oct 2020 09:08:16 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.44]) by mx.groups.io with SMTP id smtpd.web10.9748.1602346095645589579 for ; Sat, 10 Oct 2020 09:08:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=htyw+6UXwPD+DnhPGuhJwAy7WVobcBzi1uJ+KlwHlXZ+izFW08NhYInwj0z4NC9zHzbFOTzO3wn9oOpW0Qcgo97YGLOs/lyYapc6d3gqG1vb2/qnFVvc/bp4/qVN6Rt1i1s6UIWuufyIsejpJJHyHFI2X+8FxnWckrYAqPqhvc+y02nFICEuiHaeIGsq59dSppe1Bh3+W+WjNFAJAoCpZQgmiRApH9//gS/6fO955eXYZID11bk5gvyDWk03IOevMDsjMrPhv9Tsj5xhSsIZR0czkY90/1lSrhEi2agUCKydcc+fbESrfpmlr9nf/8gp3pALyPT275EU9eVKdavYfA== 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-SenderADCheck; bh=+weVdUrQCbq90S8cvTftILwsAk2pj8d2L21Ax9oE9mQ=; b=Gkmu0fEMyV+yaO9oi9vLGfZJu88iIDtImNTOrDEnwkuT1I74Cqz+P7WuR88Zj0FNaiovjJazxNKeme3q7Qlz6qzbJQ1/hs2DVwkxgDUKoLZ55D01nQt1ERchci7yLnnkG/9NUZv0eXBoEsRy+YSSuynUp4Ra5/8PJc/1tYMMORsaFnO7bk85wb3mC18PaOdHgG0CRif5AJfdvjRrTFs3DSWLHEmlJsul46P17fjrrA9iqLN6L3j7wYE+7C0VdxZ+uEJHTNduo6a0vKn0eF9G9ASQajjkatDO+DeW2og4Ccq1OLlEz5L6PHm2Zo7NjRF8b5t9zr8hD3XSYhQ5jILQmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:08:14 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:08:14 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH 7/9] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Fix erase blocks for SEV-ES Date: Sat, 10 Oct 2020 11:07:05 -0500 Message-ID: <9d802710d0a2de6032bf3d645d72a8f90f12a235.1602346027.git.thomas.lendacky@amd.com> In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR04CA0037.namprd04.prod.outlook.com (2603:10b6:3:12b::23) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM5PR04CA0037.namprd04.prod.outlook.com (2603:10b6:3:12b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.21 via Frontend Transport; Sat, 10 Oct 2020 16:08:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8c4a0b36-91d0-4bb3-da98-08d86d36b13d X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: nzWV/UiM5f874nDR6C/Th5WkICjNF2HpkB/W3JbusXI7EB4X7teeXObnfxg8+F9U33F5npL7sDD4DuOVsyPLCr5N3OQs+soa8fhOCaKbmnfPz2qXdk6vhX0bibPdNFvvcu3Omsm7tVKcNfK7sbQ7j2WCd9WOLc/SsyR+2HM1gdTnO80txx2fVCGX+2uup7Aiv+M8dmpFZTS5wBRRg9xgt3aPdLhd1OVufJc8DAiNJhLP46+uaBVntItEyS28YF69dChhQ376nwJn3fQ572SnRQsH8xntro2IsEubFUKXJ0EnAVIOXCWt3Qv5tL0tB1FMg5SFPP9bx+Hg1/m7SGM1j0fTnQaC6jYK3wt7Sj21/qT/ocY3ljkrZ2fGRiqgQrsv X-MS-Exchange-AntiSpam-MessageData: QS/sEQJifyZWdpTKqbw/uOULvcQ5xuOOTnDpLyAS9x74HpQYA7uhpLS1xRBbpAdYMusHQTE/N0tRjcvlgpmISxl1SC6cV0X5no9tFyTrjW1x5S+NGvKJc0Sj6ulXe8YlAVvGCeCEdzGDTeGp5OoNUcnuv5MUSbB5XT14OAAWjHU+hy0WDZit0Y5NnaTVHQOuuJaU7YTI+ztWfCDmbWszG4wS3YzJKkFy/QP84xJ0Fbe8+IW5F2+v5Wh9kH9WyyuxLTifwk8NyUiMBxe8t96xmtqeETNcWBh7VrzalIpF7Y5d4en186hGLXCvVBnIgRwDSwzlR0zQ7YgSt/qprJ1JxRKbjqHVfmULTUf2Uv6vmeFIq7xY2l+vwHH+H4Nk00U3GvkZ1r7sEV8Vg/0iwn2mC2dd53Kpz3ETyIU22obf/MjG5keZhLNpqOFTzhFvSVNwReMIRJjxAJnJIrZne4byOZWPZn8k7mdEaROvihcDagZllp54R52GOLCmK1waB7kiZdtnjyT1qncZkwQGkVHrSndG5ixQtZbSwdQp8fJXl8uK8K6eA6sW5gbhflcCfWTEWqKMFV0ITIi/dALGjTGqr8AL5EUwh3jAMeoN4RgMzfcmZbFH/nKPBG78qoqeG1KYUStvi8CP8We3C3l857d+XA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c4a0b36-91d0-4bb3-da98-08d86d36b13d X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:08:14.4146 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YWB30LZkij1gr5UKljVRLsjboKXAeAt7KAXAXGILw7e+FocqXSC9/F61Vur2NXM8sBXgven9LLSBM6ZE+G+OUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: 01wioAr7aw3HgfubaHG7T0LLx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346096; bh=GIU4sodWa/0htHueopIGjcOJ8M4L+oeWBARGyW933bQ=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=HVHz71YWS/gkxmhPgNS3X6cso9e7/lW5EPAfAv0zHjRh+r9dqT1JuMgpO+W7ymCg5eu k4Scain+m0nJgPaatr9HzE7Ujei3wIPaMCzeREABq/CcfRTLI3AyJdCSdA+Dq7ptKcXHG O5mCR7+VaM3DyZNKPSB0PvxcztbRexQhl2w= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky The original SEV-ES support missed updating the QemuFlashEraseBlock() function to successfully erase blocks. Update QemuFlashEraseBlock() to call the QemuFlashPtrWrite() to be able to successfully perform the commands under SEV-ES. Fixes: 437eb3f7a8db ("OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash = detection with SEV-ES") Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Tom Lendacky Reviewed-by: Laszlo Ersek --- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c b/OvmfPkg/Q= emuFlashFvbServicesRuntimeDxe/QemuFlash.c index 0d29bf701aca..d19997032ec9 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c @@ -232,8 +232,8 @@ QemuFlashEraseBlock ( } =20 Ptr =3D QemuFlashPtr (Lba, 0); - *Ptr =3D BLOCK_ERASE_CMD; - *Ptr =3D BLOCK_ERASE_CONFIRM_CMD; + QemuFlashPtrWrite (Ptr, BLOCK_ERASE_CMD); + QemuFlashPtrWrite (Ptr, BLOCK_ERASE_CONFIRM_CMD); return EFI_SUCCESS; } =20 --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66106): https://edk2.groups.io/g/devel/message/66106 Mute This Topic: https://groups.io/mt/77425920/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66107+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66107+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602346109487544.8117223942633; Sat, 10 Oct 2020 09:08:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id xZCrYY1788612xXUssWl1ECO; Sat, 10 Oct 2020 09:08:28 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.60]) by mx.groups.io with SMTP id smtpd.web10.9752.1602346103450810039 for ; Sat, 10 Oct 2020 09:08:23 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CwnpRT84W80gBDFj71knxNHSwPbuvTBbu5z6tITnzw4L/Dnz/fYHEdzNwlQyq9baepvSQpXlLyaOKNqtekkPapE+ExjKHIM/+lN1Tw/Xpbtx+81GUAnVKzrY3sZyo1VG+sd12yMZoEDK1MsbBa6pVxvKwIWLeXRRJIAXkPC+vZS2rIKB/DDbGWIa2c45zoacrIAAhjSNEyDq9OwlR6NhLi6iGuTkWrCQ9T8xPGpTvDRAafCGLYjYnJ7m9Wv7vDhz5M6CN2/1L1ts+4V0ywrpqyFL34sHiHh160jSrghlL/8ckPsza+vbGi2M5R9Qpmg/jBC4ZvfhHdjJd6QvEF0qEA== 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-SenderADCheck; bh=ZWKO99vuI9u6gOfSLlNP9EGF193B7P1aOtRy2IbJtHw=; b=lWvrU++bdeRSjcCL7q/Oy8tAuaw7A443Leq0G2/qTu9uVrrcJdw0cPGi0SA3sFDCXjk+7woYqv7jHccKnOVoBVI+YtjNKA9PzMcb1R3h9egPzRPBoXKM9wEsOb5CER9wVyKr/1xbRsosbnALSnR6cQrYw/Gsg/MJhfkLyZ/U+yVUAiosBcieFhDLxLBaJx0Zdjttf8VYdbtF99BAg4tc7VOpKmq1UpeVoHM+CcPeACOGqoOhLgRpBQlcNQuRNKYyMwg1zQWtTuQXO1i2fg6tiqhqIAMKEQNy+SU61ibqUFhZ1V49pX8yhNCmZp8xtbhQ3xCV4f09+staT1ykSpxdtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:08:22 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:08:22 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH 8/9] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Disable interrupts when using GHCB Date: Sat, 10 Oct 2020 11:07:06 -0500 Message-ID: <4f66dc48ae127d8b42313e7a0a8c7cf10667dcb3.1602346027.git.thomas.lendacky@amd.com> In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR13CA0001.namprd13.prod.outlook.com (2603:10b6:3:23::11) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM5PR13CA0001.namprd13.prod.outlook.com (2603:10b6:3:23::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.11 via Frontend Transport; Sat, 10 Oct 2020 16:08:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 30d4158f-7d32-4277-66ca-08d86d36b5c4 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: WwgZc6cJdVNkkzY09+kH564ZpZ6a1lpBtuwQXygVVs4yfHxY6z4+X5ijny+/6Xs2cNIUwRceRu2WpE9efRp2860xeXahhIRkZs3jVp4EdOpS+l2LE3+SoY5WvVVODdeRYMi239KGFaquiFmDZUlTRR9PUvu3AtpocQVooF9ohTmYpsE5A1Cs5w0YZ4WME5vjLFdcNV2rKhiX31SCjxW5ci+yeel9g7dJCnsEYeQT4NCc/pmYnV8wBCmCZjEuUQcmZ4YTZUpSOhHqH0tv1v5BfAfM2o70JTBiJa+1z1i8UhOAY13vFlGypog3LKur7f/QP2UTsKN0Uc1utInQRRbn3GR31etyFTHZWLkI0E7YPoeSaGz7OZh8OyeLVGSCAVPI X-MS-Exchange-AntiSpam-MessageData: w/tuOOy5hXDjJ9ZLhR9l8ZK8yDdbS8AuzMcOWrjljCZYTaUkFoxohxiIqtEg2wulKDXW4hCB5tS27ckJTPCAtfH+M4LUjVyGT/a3Cth4PsG0JYDzqYh318VLgbeFVvQdrXHsl8i5pygu9LsFfL0MsBv6S9c8q+ffi/cddUfFGgrrP8OebS1TOy9Qw08YuMeDVEtHpQyAKwCR30koknanoS9NQfCrjGj3OWmKnW5ME53QPZ/jyb6Ieszh58W3uON8Ff7b75p2TgfoPV8NOvVp10fGqbX9Hfpd1jsZr3dcinP4VRcs9KNEEMegfHFdX7GR9rDYNjgbhFkEtIqFBhE+RQmAOyfwd2IJHU2R1EFtTzu/sccryQc7+h+JGMoqMphuEw1h4xT9ddNHTTL211cbh6747iNNHGlSewQw7cM6eG+HHT02GRY26WQKzr5ZMI9SapoWfnxu2Gq6iNksLK9NLv65XRr79NP5RBYEWPF4LUlZ89QsEaPa184KKUSyQ6F3Zb2kbDHDPO+rGi1i/Jt/fG8j/C/tmDutJ7ZECkyFI82gpSmBSbs9xn5/bycjeRz8yyRxvxyzPh0sN3rp5hPvd/mJgV5QAElOe44SZ+JQQdby5I+MDawccErkWg3CRHJmrRKzbeiBJQlMsy/eJtkRVw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30d4158f-7d32-4277-66ca-08d86d36b5c4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:08:22.0803 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Wr7LWy7+1OdlNAe192jUG+rfejUUk7au8p2UpT5mH//dEhdaW0Mk0k2OQ03pzfC93QUo88wmfu4082GZbnehCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: 89PoBiAM55IvYKAwkh0H3gJNx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346108; bh=/Ca+TvupAbEnKamzIwa/hLZtqMwnRWYkGwGDhsXVOw0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=QIEes4fO78Nu3npnu1Obc5weTkpomoD7f03WOI4Za5k6aE3NNs8NjtVNucYOThvF+4I VTtD/rIDc5KLpsAi0B7RwdIKGb1kudWTuN4weXJs0n/tuXRS6YoK4J6ZM2jOTTZURKoos 7bqtISngPgtUiYXi068wc1J0C2CTo5I1FPs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky The QemuFlashPtrWrite() flash services runtime uses the GHCB and VmgExit() directly to perform the flash write when running as an SEV-ES guest. If an interrupt arrives between VmgInit() and VmgDone(), the Dr7 read in the interrupt handler will generate a #VC, which can overwrite information in the GHCB that QemuFlashPtrWrite() has set. Prevent this from occurring by disabling interrupts around the usage of the GHCB. Fixes: 437eb3f7a8db ("OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Bypass flash = detection with SEV-ES") Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Tom Lendacky --- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c b/OvmfPk= g/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c index 5d5a117c48e0..872e58db7cc0 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c @@ -9,6 +9,7 @@ =20 **/ =20 +#include #include #include #include @@ -54,6 +55,7 @@ QemuFlashPtrWrite ( GHCB *Ghcb; UINT32 ScratchIndex; UINT32 ScratchBit; + BOOLEAN InterruptsEnabled; =20 Msr.GhcbPhysicalAddress =3D AsmReadMsr64 (MSR_SEV_ES_GHCB); Ghcb =3D Msr.Ghcb; @@ -61,6 +63,15 @@ QemuFlashPtrWrite ( ScratchIndex =3D GhcbSwScratch / 8; ScratchBit =3D GhcbSwScratch & 0x07; =20 + // + // Be sure that an interrupt can't cause a #VC while the GHCB is + // being used. + // + InterruptsEnabled =3D GetInterruptState (); + if (InterruptsEnabled) { + DisableInterrupts (); + } + // // Writing to flash is emulated by the hypervisor through the use of w= rite // protection. This won't work for an SEV-ES guest because the write w= on't @@ -74,6 +85,10 @@ QemuFlashPtrWrite ( Ghcb->SaveArea.ValidBitmap[ScratchIndex] |=3D (1 << ScratchBit); VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, (UINT64) (UINTN) Ptr, 1); VmgDone (Ghcb); + + if (InterruptsEnabled) { + EnableInterrupts (); + } } else { *Ptr =3D Value; } --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66107): https://edk2.groups.io/g/devel/message/66107 Mute This Topic: https://groups.io/mt/77425923/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu Mar 28 21:54:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66108+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66108+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 160234611789760.542614982347345; Sat, 10 Oct 2020 09:08:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id cBI0YY1788612x5rtNNac0Qs; Sat, 10 Oct 2020 09:08:37 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.50]) by mx.groups.io with SMTP id smtpd.web10.9754.1602346111191266008 for ; Sat, 10 Oct 2020 09:08:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hyViYrFXgpbCYQZxQFMmC3117p1+/bRrx1gSR3f88BobRd8MSAWXc5kRRDCbSkGBCGwZlA1ifpDyQkr85PYHgvgMLvXGdvac/ccL1HBPusKulT+A5tULF79aU3resFeZUYbtFVewRMMOBW8MwYM+4rW/ysz4eERW7D1IWhpenZTY97VRhC+eFpOOYvWOgBo9g5kbRao0r67EWP1vswn/Jpo3kVfFe2dNTYIhn6zH34DxdswZR3YQkZeSco94IpMR3Xcx8DvR9KThTXl0SKHJ+PV9xhTATVihEGBTd5hUlGl6EN3gyH0JFe/6anusQXVsnSyL7tcQudsF3RqsEiKKGA== 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-SenderADCheck; bh=8A24Hh4xqxH9hO7Yt35i7yX4z09mfgND5ZElxVjznuc=; b=kg9/LhFoGCzjGLfPz8L7G/fpxVnfUAqFGgEyvjYmlmxEDvb/BYwvR/xMa81cSnLtaqprtg3cJQdXEyXM00yTyWT9fIdvQ3F6ECJ+8vkY1bkakrMnlkDXV6uVxjOz3h+9V/1JjPejhldJcKhr1niMfEltepiQeykmpmSxyCrLSQzHlidii60+XunqMFoYyzmDEWWE3xtHFE3ScWLTo9/4UZpJ1txtnZo62oLgEx02K9frMsQh8PS2NSrpE6UE37F/bCX8PhnF/uVSkbFUbATjY/DgRNrQxMYFkAaxT8CJvy4xy9Waq/6Q+rajVc0Cj2D7+8joUZDqHU1XrlurPfeL8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0122.namprd12.prod.outlook.com (2603:10b6:4:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Sat, 10 Oct 2020 16:08:30 +0000 X-Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::4d88:9239:2419:7348%2]) with mapi id 15.20.3455.026; Sat, 10 Oct 2020 16:08:30 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH 9/9] UefiCpuPkg/MpInitLib: For SEV-ES guest set stack based on processor number Date: Sat, 10 Oct 2020 11:07:07 -0500 Message-ID: In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR04CA0061.namprd04.prod.outlook.com (2603:10b6:3:ef::23) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by DM5PR04CA0061.namprd04.prod.outlook.com (2603:10b6:3:ef::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23 via Frontend Transport; Sat, 10 Oct 2020 16:08:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3036dd46-9fac-4996-dd3b-08d86d36ba6f X-MS-TrafficTypeDiagnostic: DM5PR1201MB0122: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: ES+AShF7/O/6M/pR9OfbTyXEY8zxmc83MPh2d5epUdxhy+K/loNWYDk1/WW1ZILwBCDK+mlpqUa3OATzjVJ7bUUV5DZ+mU7mfPk2kr23Ts6naYc9o1H3Nz/8Zlg92zBAZSO3U2MVAb+OItc7HMCfGwqsPlWQwrTQrZl9W2j4fah9vJlm35StmI1nBrvTgixbNXXRe59QtVBRM8RsyqujHlesqY+Le1h2qJXgqmZF2s4QnK7uoyVNmaXDruOiqSpRd8/aR2g0CNbCjn7wr5odeHAFpfrN9J//yMPXPjS29OXr2AwuD3iCRbUNNMXWSK0QF0SkqJsc0aOC7Vlj14luGw== X-MS-Exchange-AntiSpam-MessageData: ZeJVS6WHn8UjidVQ+VhpKmI8/zy/TOCPPwXYSXYdpYjduFHgtCM4Dm7+wL3PG07YZIQaHCXLL3LI+vyo5vZYd5RtTyltboMni01VrVIy9Jc1YSk6mRTxV7kpDbxVvvX3lkNVniQBe+wIyj8UpvWUH679KVXGeflW2BA12t9mjlCan0R+GNzSQSRv6yPSzoNjxiyIO4JfXz0zEfjVeS9jax8f9K7pU1qpg5/FcaRnq5g93N21kbbycseAnvctJIL9T55BvUtYBACqxRzdHccDSPA3sBUqj0XqbWXSGOFgNoAKZvtNBkyK14V1Vm029+skA5wiO4YP97kukuvAI1LiBFF+8GrOqLCBIZR1lBSN3el6/+AQdcL+fACcgaQbTCQhqQkqSYxKsDz10t2ltO4/Pt/2DSIb28O3rpOrYIQQlHEhWRrKt+YE0+4i0PjbBcM3nknoqtLjo1E3Fo6e1+3MBjYT6zovxoR2GcvZhcCXPyq+vLFZU7/5ZAKWSye3sk8UhMzuVsYKanrOK1fTDlH7eMcnuVTso8xBRjRzv+dMy5PjnX+u1b/UVTaH6OAjPUICNRS1oAyvBUbMSGfqIPsPyB7h8PAVNV5fYKLqu/3OiVNAXpljgh0H9mn2o6XkIM6qOvA8Oe8oq9kkMk8tdo9JlA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3036dd46-9fac-4996-dd3b-08d86d36ba6f X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 16:08:29.8889 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +uAGyLIv2YSHc1eZP4tH9iaZDg4Bft2dGMpbmH54EmKHmXZu0vlgwZDpTEzRg6KearOyuziYoOcSz2eXlFJI9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0122 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: qjygpfgHGnVVU8AszDdf3BiTx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602346117; bh=pfml9t0/enA6aFuC8UZhdZ7l7tt95G9TQ8jKjsdDxog=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=dBf5+LZsfIduV+0eNs3VWkBfWRSJ0q4mhOglxw3V1eyNfUjvrtz0Amaxp3pozEHPL4J 99moemM6jFYG8svwMCi65Z3EEsFw1Cw1Z5oPq5G0x2QjWJkSBN3/iojjn8C9fYkkWJCWa 5MXcO0kqvNOfPqhAwovj8HsMwVN10Cw0EAc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky Set the SEV-ES reset stack address for an AP based on the processor number instead of the APIC ID in case the APIC IDs are not zero-based and densely packed/enumerated. This will ensure an AP reset stack address does not get set outside of the AP reset stack memory allocation. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Tom Lendacky Acked-by: Ray Ni --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 07426274f639..71922141b70b 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -680,11 +680,16 @@ MpInitLibSevEsAPReset ( IN CPU_MP_DATA *CpuMpData ) { + EFI_STATUS Status; + UINTN ProcessorNumber; UINT16 Code16, Code32; AP_RESET *APResetFn; UINTN BufferStart; UINTN StackStart; =20 + Status =3D GetProcessorNumber (CpuMpData, &ProcessorNumber); + ASSERT_EFI_ERROR (Status); + Code16 =3D GetProtectedMode16CS (); Code32 =3D GetProtectedMode32CS (); =20 @@ -696,7 +701,7 @@ MpInitLibSevEsAPReset ( =20 BufferStart =3D CpuMpData->MpCpuExchangeInfo->BufferStart; StackStart =3D CpuMpData->SevEsAPResetStackStart - - (AP_RESET_STACK_SIZE * GetApicId ()); + (AP_RESET_STACK_SIZE * ProcessorNumber); =20 // // This call never returns. --=20 2.28.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#66108): https://edk2.groups.io/g/devel/message/66108 Mute This Topic: https://groups.io/mt/77425927/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-