From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.85]) by mx.groups.io with SMTP id smtpd.web09.604.1604685254789661470 for ; Fri, 06 Nov 2020 09:54:14 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=ih3XKpqi; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.223.85, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xpa0/yzjcwiiSh1onTE5cuBLiagcYY0YRnpB49q4891751Q/Szs2BhD+k0Rp+jARIN10JtlySlIoRptndNyqHtOtBB0uXntz+hp50DXId0JRqbjpr+paMqxjUtIPecHdua1o+H/2EnbFaY21A499lS3G03lxLVAs/AGcnmUMbKfWfmllpjXOdr7Mq6kTY92LJa1A/hZzf9e54Sc5BzectHYle+eqYuzxKiu6H0nB0QK3f79ejOiMC3vzgVB9lNxbnLA0Vs8fqEgyPU1zIkZTM0O30MLdtJ/TGKk1jJ1sgyzwGRjKAA6s29NHr2faGgssbQAgra+WC8h3XGXH7WlrYg== 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=SgZCc6wxVnz/Nrtf4qAOaxmDIT+GUm4Z4PAifjXDTCA=; b=XBqWXWpuN1AwRXhpCyQ2XgBGLX9DtzwGDzs1ZwSvo27Jekn8tQqD1xf2dLnp1/wOIOKRLpkFJbRn/V55HbE618+9jZWJKf5caPjOKMol3WyBBNW2dE5NLoe1nuQ/9dkczWbSftFIqdYdHahyeW4PAC8fUxIJPwsL4WTFk9f5CtpShUv2coTAEbr+BQtIca8Ik0K3FwQsqqZcWKB59GWhs/EKrYGKXv5u1p+9IbdgivhXp0Wbx8s6ReFnHRanTFs4078lyeHx7MyeaIz+K3oeLnCBWIcDzHuv87t9oTvgHDL2ckflb/gCZV0Y+jYsVEwFnyLwEJoWsFRGk+Bg93J9+A== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SgZCc6wxVnz/Nrtf4qAOaxmDIT+GUm4Z4PAifjXDTCA=; b=ih3XKpqiGEE54/F13Sbm78JzWdn6+aeBqCP6GCR1snm0Ucbpe7nlM7N7XEDiZCScXQ48LNWUt+zstPhz50W9B3uU3wEBzhYi8ymwp8a0rg+gA7pH4bfzQ9uccx+VsymzxY2ZIrSg6O9145vfT3/GKn3RDpXDm/pqH9+GFuy2HXw= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB4385.namprd12.prod.outlook.com (2603:10b6:5:2a6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.21; Fri, 6 Nov 2020 17:54:13 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::e442:c052:8a2c:5fba]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::e442:c052:8a2c:5fba%6]) with mapi id 15.20.3499.032; Fri, 6 Nov 2020 17:54:13 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [PATCH v4 06/11] OvmfPkg/VmgExitLib: Set the SwScratch valid bit for MMIO events Date: Fri, 6 Nov 2020 11:53:08 -0600 Message-ID: <45ccb63c2dadd834e2c47bf10c9e59c6766d7eb6.1604685192.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SA9PR13CA0131.namprd13.prod.outlook.com (2603:10b6:806:27::16) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SA9PR13CA0131.namprd13.prod.outlook.com (2603:10b6:806:27::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.10 via Frontend Transport; Fri, 6 Nov 2020 17:54:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d0eebd41-3dab-47fd-8862-08d8827cf8c2 X-MS-TrafficTypeDiagnostic: DM6PR12MB4385: 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: BCL:0; X-Microsoft-Antispam-Message-Info: ChLNTK/SUadA25LMh/WF4E9vf3m52pM/9ncWjvNdKot3GZodRlm99dac/y5JpeFRGCqzMMkL3nJTo8gygkXzeNYZeH8wcQ6K+TjaTokKx8xDqjlvchsVSyJYrdOVEVM0jEQElBGzE5hI/aTKk2WNdIHj7OwNFRVYXXs47pef0Lnp04ssC5MkW0DDwb9ntuUQ1bPe68O8Vl1uNSKQIziPjUc0+LWp8joQ6xpnkAzCwU5MEVLBiEBaSeFQWajiuiqoffPEyQGsOUS1v6uTHJcpD2TbZ8PxVN1OQ6CTMSj7xDA/t6an53nL1t9dmWVgbQAgsLYOf6y9h2W4QgP0wjFITrzBzEpWeD1WfNLhK53GdrXOkfyJ/n2qyEEX9h+SH9jesrIQjheoDTb11cJjhMU1Xw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(316002)(966005)(86362001)(52116002)(7696005)(66946007)(5660300002)(6916009)(6666004)(8936002)(36756003)(8676002)(478600001)(66476007)(16526019)(26005)(2906002)(186003)(66556008)(6486002)(4326008)(54906003)(956004)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: bKgqQV2RE1/x83Swj+tMe9crBp5KY/qxmfnpOrYS3EDdZs/E0NmvDY3/n9pP97OJTLGICX+DkiFHSf77mzRq4afhlbFDnL6FM1wtQrcwg9LfY2p/xiBiULkOZpyDvye0KQ6TIJ9RU0zfJ6Ji/2bI8fk6bOc/MJZgfL2QJn+564pB+JEKu/UaH23FRglGYw7W7z0e+Tdaj+PXoizl2St1W9JbcllJ+zu8q6tfnDWGFvOYfjS6QHRArIhyZV3QEperPlWPsF0QovJtwK7b1HuodjwNmbH6N4TaMWs2OiBbrL8ghhwO6lz9fQYz66SXvewvbb68Rw1DH9yLp6Ob4q37L3w8R2ZLBak7B+5XsibpE+/aZvX6hRtktVbrRGLpA4xXWgsdTtVTlGB7XKUKNjjS46Mj+tEJfdsOeH9ooe5SULAsSrplfTLW9dnARfkfjfpH12o1inukygQz442NbzAcT79wDn5wfdlPZFXzNrI0MdOKfIZWBsQSEx4NCne5FDZEhip/bj1X6iqxrAc5iEIkXQf/osOPlU4X+bEMSaMQmOmjKWrJhSztZr9MPo5k6uuIydgTTfKy++jcK2Ja5w6LbV80kZN13fXejwn3hzBAjp/9yWJpXZnY7xwk5uzm8nKT39hFicM1p7fUbIIe/ftPgA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0eebd41-3dab-47fd-8862-08d8827cf8c2 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2020 17:54:13.6038 (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: qPwTWuRq37+Xm8eEuj6ZYnXxMBwmauoIi3WbubLS1bvJ1Ul2mBkvhd0fO/goOzCtj73OJlLenGnRZE8/r0le5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4385 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3008 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: c45f678a1ea2080344e125dc55b14e4b9f98483d Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Tom Lendacky Cc: Brijesh Singh Reviewed-by: Laszlo Ersek Signed-off-by: Tom Lendacky --- 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 e5f14035b06f..9bf9d160179c 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -664,6 +664,7 @@ MmioExit ( CopyMem (Ghcb->SharedBuffer, &InstructionData->Ext.RegData, Bytes); =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + VmgSetOffsetValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; @@ -693,6 +694,7 @@ MmioExit ( CopyMem (Ghcb->SharedBuffer, InstructionData->Immediate, Bytes); =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + VmgSetOffsetValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_WRITE, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; @@ -725,6 +727,7 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + VmgSetOffsetValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; @@ -755,6 +758,7 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + VmgSetOffsetValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; @@ -780,6 +784,7 @@ MmioExit ( ExitInfo2 =3D Bytes; =20 Ghcb->SaveArea.SwScratch =3D (UINT64) Ghcb->SharedBuffer; + VmgSetOffsetValid (Ghcb, GhcbSwScratch); Status =3D VmgExit (Ghcb, SVM_EXIT_MMIO_READ, ExitInfo1, ExitInfo2); if (Status !=3D 0) { return Status; --=20 2.28.0