From mboxrd@z Thu Jan 1 00:00:00 1970 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 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=O2tLQrzb; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.244.53, mailfrom: thomas.lendacky@amd.com) 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 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=JH3mKHCPevyjnN7jm1S1lygCkWy+5mN2HfpAPYvijEg=; b=O2tLQrzbtfcUHjwKCJCYoTIM5HNCaEDLDF0ruRHamPOiwC/qvLfUYnS7+NvzzKTgKH7dk3DUKFOkREdDdaLos+WUTFKElNi281ZiA+tdrIBT3XiYcDT0U36Jafn08Ipl+bacO0crhNo39f5Kqqj6dQAdNKiDE0DsHVM965LmWwY= 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 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 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: [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> X-Mailer: git-send-email 2.28.0 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) 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 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: BCL:0; X-Microsoft-Antispam-Message-Info: rz/VfjJVXeVnPn8DC1MLna3+NBmSd6uLKoQv+YjjLu6Jw0a0KqxNaY/3VXaKDurKCzoIjFonYT5s91acWK3JQguLnRddbD2lqEbhWHNmox8vlNVrfPqv4OQiHYpf+zizdjf++2qhhaXauiX6BkeMvBq81Vr2yxl2me6L3mk/LE/7msVgdmB0m9yFCXA0mIeKOpwSoZq38xRy/Jsi0/kVwed2wQFDRDGDROJIAxS63bFzVGjA2ktc5RKmJfC1Hja+ppNOX+3TbrAy9tqO++D3Cv87X6XWQ+IjM0U3xUTQQk0YXET0x6JRXfNjfz20hUaUdKClfTNult73LL3UAnxSQg== 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)(136003)(39860400002)(396003)(346002)(366004)(376002)(478600001)(4326008)(6916009)(2616005)(956004)(86362001)(26005)(54906003)(66476007)(316002)(8676002)(66946007)(6666004)(66556008)(52116002)(5660300002)(2906002)(36756003)(6486002)(7696005)(16526019)(186003)(8936002);DIR:OUT;SFP:1101; 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 --- 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