From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.49]) by mx.groups.io with SMTP id smtpd.web11.102.1649179962453761436 for ; Tue, 05 Apr 2022 10:32:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=xAb5PYBE; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.236.49, mailfrom: ashish.kalra@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5jMhAK/vu9/rIPAKe8c9T4SdNQygud1SVdx1xWtcVbvgqSTGFdA5TS/cZU/srGTPlLKkgsh3suVhP/OxCbBnfABk0RtI0s2CoKFpqZ3PxBxk7b5FZzD0stfmnEq+akI/Kt2qesZEGWLnIh3BRb521oTcvRIP9XAUfHjIzYbXUunp8BpGhGV+QdIYkmgFIPRIcwipWJj06l0COHwBMD6BReoNwdFuIGZGHTuRMGT2lys9/lNjgDp7C1MZVb3DQle2Fr5xj+7k+DEQPbyKJTy38OgLaHbCsgDUR01bD4H1Wb9dw4+aR6+8+85kR0jBxRuHbXEOBLkI0tSC5jjnGofSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XRi3UVsdNHvhHvRzWUIIZROzFaaaBlJzv3tWoB0DICU=; b=BAQNrpT1bI47PjQa7yDhfxbb4LYFIEhFsU5pLRzZTKK6OE/B+OH8zPE/noeORCp4dU3g642DlR6LrvQtfVtkv95ikRIu04qwk03q/xL8MBXk0+/BqUh79faXV758bvI5BpCC5i+eRnc3BEDkFQW+TxQdZaa1mfrSVYPOqUaU0IiDvKnlHzIERQ/lJutTRA3A4Ygfx1nChCwNPdyGFf7Mx+NMebZ5oGjrgBgSjB2CDQo+ZFTpKt+9X5gDrwka3CLOQDA+vtWOdxklpMLUiY6cX3AxpEMGpTs3DlVVMqGc7I9ajdsDZTzUilSkJk/4to7VW2T8CiENx8TAnL0S9w8U/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XRi3UVsdNHvhHvRzWUIIZROzFaaaBlJzv3tWoB0DICU=; b=xAb5PYBEyoT/V/AMR7apW2FbtY3HkFqj546XAmsHNl24LNMlCFv7lqPdqFUWv8kDyhM2i3AxLK3kbhyOAMRSe+P4PiDJ+vrUq1DZttB8oQe8OVFj50LZGhwAKLLV1q2UFv93Jn3gWx9LzvX2OqL63OSpALwBRjzrNKUq/Be+fYg= Received: from BN6PR1401CA0001.namprd14.prod.outlook.com (2603:10b6:405:4b::11) by DM5PR1201MB0043.namprd12.prod.outlook.com (2603:10b6:4:57::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Tue, 5 Apr 2022 17:32:40 +0000 Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:405:4b:cafe::98) by BN6PR1401CA0001.outlook.office365.com (2603:10b6:405:4b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31 via Frontend Transport; Tue, 5 Apr 2022 17:32:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5123.19 via Frontend Transport; Tue, 5 Apr 2022 17:32:40 +0000 Received: from ashkalraubuntuserver.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 5 Apr 2022 12:32:38 -0500 From: "Ashish Kalra" To: CC: , , , , , , , , Subject: [PATCH v8 4/6] OvmfPkg/VmgExitLib: Encryption state change hypercall support in VC handler Date: Tue, 5 Apr 2022 17:32:27 +0000 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Return-Path: Ashish.Kalra@amd.com X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83436486-65a4-4bf9-0802-08da172a48c1 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5GkaY+irdRUUhMgcx7eKkIiQK5Mro5ZgCVAzqTZKQfd10QZoIaENiuKyCrdgGnnM4lCtL5vzozQVBIA0uxoCxmc7qH8Q2ukojYpMPBVwFaqfJuyXj32skk/Zf/yDFHOG/Mjw9NsgGRLR0iuDFcPDbgve4wnfid09rY1ecgVe0auk5wHKaPCSmQzFOE9jNHc3ZJQG3XyzaqlewWFT1vpkUyA9GeeFou4b+y2afGaZik7gJWVSrObOOhCh+OjbLuMp4DQPlZLOfEpw/QWSNfl31Zr41TIt/RRkDzRRN7fBeHojXx/Lwf3WJmdcGoZeenOA0l0u5gv1vXEl6r8Hk8kUlqW/J6NuqCjI9/cjN7f4PmDAHEmL6Tj+12x4FwvxnC3oGF0dQC6cjo2O9Xt7ytLPN7vPxOGIo03zVrcbwA/ZJODhfH3NXTr0+uYIUDSI6KihKqnM/l/b80I9nMmKKqwBJtIeedRKFCVSQN3n5u9LJxu0a/dxgtU0SFW3zT6z8L8OjQdOwNH83UQpyFjk5CYJ7M1DWOaR5q6uRf960wgPuSp5xK68DQDLxOESh79PB4o3O8SSX2rdjHOrSFtjqrc1Yp7oNXdrE3bH4whVk0/aFgBbUhGDj7+/k0elvSx2Vm2+HeWAvOAgjgCfJgWRnC1tsonOAYQ3EhXXC+Y5jDdFa+T63QTY8Snt7onQzOQWtHQ1iTp7V1k+pR9kg7tuwakvGQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(426003)(16526019)(26005)(186003)(336012)(36756003)(47076005)(70206006)(4326008)(54906003)(8676002)(70586007)(316002)(6916009)(82310400005)(2616005)(8936002)(40460700003)(86362001)(356005)(81166007)(2906002)(508600001)(36860700001)(7696005)(6666004)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2022 17:32:40.2241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83436486-65a4-4bf9-0802-08da172a48c1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0043 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Ashish Kalra Make the #VC handler aware of the page encryption state change hypercall by adding support to check KVM_HC_MAP_GPA_RANGE hypercall and add the additional register values used by hypercall in the GHCB. Cc: Jordan Justen Cc: Ard Biesheuvel Signed-off-by: Ashish Kalra --- OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c b/OvmfPkg/Librar= y/VmgExitLib/VmgExitVcHandler.c index a4393dffbd..ee213ae2cb 100644 --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c @@ -1211,6 +1211,19 @@ VmmCallExit ( Ghcb->SaveArea.Cpl =3D (UINT8)(Regs->Cs & 0x3);=0D VmgSetOffsetValid (Ghcb, GhcbCpl);=0D =0D + if (Regs->Rax =3D=3D KVM_HC_MAP_GPA_RANGE) {=0D + //=0D + // KVM_HC_MAP_GPA_RANGE hypercall requires these=0D + // extra registers.=0D + //=0D + Ghcb->SaveArea.Rbx =3D Regs->Rbx;=0D + VmgSetOffsetValid (Ghcb, GhcbRbx);=0D + Ghcb->SaveArea.Rcx =3D Regs->Rcx;=0D + VmgSetOffsetValid (Ghcb, GhcbRcx);=0D + Ghcb->SaveArea.Rdx =3D Regs->Rdx;=0D + VmgSetOffsetValid (Ghcb, GhcbRdx);=0D + }=0D +=0D Status =3D VmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0);=0D if (Status !=3D 0) {=0D return Status;=0D --=20 2.25.1