From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (NAM04-SN1-obe.outbound.protection.outlook.com [40.107.70.87]) by mx.groups.io with SMTP id smtpd.web08.6627.1607040203785553005 for ; Thu, 03 Dec 2020 16:03:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=bMI8UO5t; 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.70.87, mailfrom: ashish.kalra@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bnI2lzyhh0RP5WWRdAvXfIU+/YSRobrRcazM0j3uh5w+uVSG8HXD3d2sZHE0tC+sriT1X25I1hjpvWeqkHCyBZg3Yi0r+643/UUhEiG7ekGv8uobCgetnDWv90UmYbLZDKb/A+iEs95v79Qb6ODRcDJy1c9zSrwZZdEbgfA/1n6W32fu0TM26+oMNoCt/3dH2HWu0m3t+L0aBie2HkvXnSGfpE+TJL3WYObLl1ByIQgExyX9Azm+rE4TIDP4m9AlGeUJzCTZXRh7iys4x8JsERenFL3b+0scJQWseddkcDWg9bRBhhjP6YCkOqbhj1soAbr8SEGziSo/JZlO9VI9PA== 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=yK6cuHdAOFM1GlbPYwJ5bIL8OJvRTpjRD+qv7RLmt5U=; b=PYvCga/x89bObIcMvrEWvPy2O8IACnLljSJ1e8jrQIz08lYR/8orC3uCa8/12DhaVjh14TRZnfDR+EZale9LbEtOasrOwREUQboIPuwwpCy8fhs3C9U9sNsEE1AYY/8LUR8lDnnYp8FRWExsjbnZaFV9MTeksqncKon3EAriiQjVEfO9LDUSp9lgJPg6ZtBL3nUtKNCtSeabpLe2ETG7dyGxjGLLVDwgeowxMnUlqE+9Q2QgYhnfZFGvfVHpIKr/fjTlgC0xipcALwmHEAYCE+kWx+kt5e9Mnoq/1WL0bb67f1ZyDayvVMIKSa8MQYngJPxQLOp3sj6bcx03jvwuTQ== 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=yK6cuHdAOFM1GlbPYwJ5bIL8OJvRTpjRD+qv7RLmt5U=; b=bMI8UO5tKxYMqP8gseyumL9gq3p52XKiYLbcjfSTIVKJD6i8D9e9/F65leF8JdMEVK/WcQMInrYFhe4o67f5/sQnZgjW+rcw3o6LYXgKx8n2AWkcgv/TDAUZ8RR+0tYuKw2351cJnt2rxBKq9B9o5SSipJeTUhoZxwmnus09X18= 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 SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN6PR12MB2783.namprd12.prod.outlook.com (2603:10b6:805:78::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.25; Fri, 4 Dec 2020 00:03:20 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::d8f2:fde4:5e1d:afec]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::d8f2:fde4:5e1d:afec%3]) with mapi id 15.20.3611.025; Fri, 4 Dec 2020 00:03:20 +0000 From: "Ashish Kalra" To: devel@edk2.groups.io Cc: dovmurik@linux.vnet.ibm.com, brijesh.singh@amd.com, tobin@ibm.com, Jon.Grimm@amd.com, Thomas.Lendacky@amd.com, jejb@linux.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, lersek@redhat.com, jordan.l.justen@intel.com, ard.biesheuvel@arm.com Subject: [PATCH v3 0/3] SEV Page Encryption Bitmap support for OVMF. Date: Fri, 4 Dec 2020 00:03:10 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0501CA0021.namprd05.prod.outlook.com (2603:10b6:803:40::34) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) Return-Path: Ashish.Kalra@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN4PR0501CA0021.namprd05.prod.outlook.com (2603:10b6:803:40::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.7 via Frontend Transport; Fri, 4 Dec 2020 00:03:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1328bd2c-03de-47d1-e961-08d897e80239 X-MS-TrafficTypeDiagnostic: SN6PR12MB2783: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zSC08kTI6QSi7MWHPzqVnQPqfTBx4SyKd3pkJnz/zjNRMfsksntQLejll+13onLoSFSSjC/DbugklUiLuz91Bo3Y8ous2JOafyaZ2aSBIQ9xogzmxGDDdZ7gjrOGtUDmCOeqHX0UEJ+/Fti57Qvpr253VBaYBFoJJfMKRqXEY0LQTkyH3HRlV34h4sRVUa2SEWjYQ3Vu4eDrk90ZSW7iqcvuLE4RUR6ZTjDntLP7X6NQJD8EyJf2gOydlHcHig2IHBjxChFjgt//CLnio1pLqprtkya7a4d018offQvlQ0RsrGc7FRjccwvdrUYjTGTq7pO1EAUEc2ub+rtVpM5UpdmyVbr1ZcimrSU3VUfoP0JjSB3pa5p1jIOAfA+0cLiLBFgAOkI/ZZ6+VDEQ7peizg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(346002)(136003)(396003)(366004)(478600001)(86362001)(66476007)(5660300002)(6666004)(66946007)(66556008)(956004)(19627235002)(2616005)(966005)(7696005)(316002)(52116002)(2906002)(16526019)(8676002)(186003)(6916009)(6486002)(26005)(8936002)(36756003)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?mb3cFV/RGpJF53uSopOD0/5jnCAUyBtxwbt1j2Qpiwz3g+GhLni2dZ/S/aWo?= =?us-ascii?Q?MHDGDUBgmnor2Taw3vMTvshjMScRpfqg6Xaz+Zq+fKniiAGvLKmAuEH6H6C1?= =?us-ascii?Q?1tT2rG60BbWoAbNKbu6SubaRjm1ZLssziIqDM1zMvBwjlwBgN2HKpL+qMMRf?= =?us-ascii?Q?7HvkZnuLqd9TibOyvL/hG8jTap9goh2N4TlKqdWkb5jMgd1XSeW7eUPVBaH7?= =?us-ascii?Q?yQGER7fe776sWuiU7fdQ3M0jo1YChTufz8FcdDXF02OB5zwKDgX0xNpkxa6n?= =?us-ascii?Q?y1tgZIgNpW/p1clH01TI88npvUyoc4yfSTMoqh+1MJ1vwLkX7QOp71j3ztjK?= =?us-ascii?Q?S7LgzrXNUOwU0/wjpZxFBEdjrYDHraAo5dm1KPrdEB3E2tQL2jpAOQHFpS6g?= =?us-ascii?Q?lS5vIRyf2dOi2oTdakICmKscmefw/2GxJjs9aZSXkNPWVK80OzrxZ/JVSOSG?= =?us-ascii?Q?G36uMLduSCpGiKNw9ne/5ySyK5fPc/QckaktLL0WZKLU8OS4XvxQKdQxXvw9?= =?us-ascii?Q?TTNhHqzhyb++eISGINoNgpoZqHFRPHF+gpfRllFhO9GetCNekBeqN9ivYme7?= =?us-ascii?Q?EDzN7YEOMXg1wHgB8d7M33a0m+TxzMXPOesJ0+LN4G5TihrnF3SLovk229ok?= =?us-ascii?Q?oCjXFQzSaQE+CszjTPgvfKElrY4y7STg+G1btBLhTXjUC+SwY5YTVCpDLKdm?= =?us-ascii?Q?DxMqPok1xQevAUxIgZPPw3HU3U9EuKSAuJ3UWVvWzxwUC0IBDuNpTRQXkvfa?= =?us-ascii?Q?aYlEDRXlTcPiQbI4gvgLlQ985DG+9G1m1TXyBA48G/HDnkuA7NfS5HLF0mZm?= =?us-ascii?Q?tMvH8RyDJyvKQhsck9xOltdzHf2QyIm7mQGMnGIAZ0CT+kY8ZpAZ88eKPkUa?= =?us-ascii?Q?rOE3JREDhrVnpZxyfxgb06avl6QRD/Bedz81sfTfDKyhkJzh4m8hcGhVeXrk?= =?us-ascii?Q?dYnoKZSe4jub/+Q3g8T7hHzuf0B8qhyAHBakCxmluWdQVD/pXwYPLLzdUBRe?= =?us-ascii?Q?oUc3?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1328bd2c-03de-47d1-e961-08d897e80239 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2020 00:03:20.1060 (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: DBhHrdWCxIUMRfbNhpmZdCGQkrPQ3/B24FAhX+RDDvCkYA2DQxZeLPFrBK1ZPUZl1uD91QSxJwlk6SKLQg/e4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2783 Content-Type: text/plain From: Ashish Kalra By default all the SEV guest memory regions are considered encrypted, if a guest changes the encryption attribute of the page (e.g mark a page as decrypted) then notify hypervisor. Hypervisor will need to track the unencrypted pages. The information will be used during guest live migration, guest page migration and guest debugging. The patch-set also adds a new SEV and SEV-ES hypercall abstraction library to support SEV Page encryption/decryption status hypercalls for SEV and SEV-ES guests. BaseMemEncryptSevLib invokes hypercalls via this new hypercall library. A branch containing these patches is available here: https://github.com/ashkalra/edk2/tree/sev_page_encryption_bitmap_v3 Changes since v2: - GHCB_BASE setup during reset-vector as decrypted is marked explicitly in the hypervisor page encryption bitmap after setting the PcdSevEsIsEnabled PCD. Changes since v1: - Mark GHCB_BASE setup during reset-vector as decrypted explicitly in the hypervisor page encryption bitmap. - Resending the series with correct shallow threading. Ashish Kalra (2): OvmfPkg/MemEncryptHypercallLib: add library to support SEV hypercalls. OvmfPkg/PlatformPei: Mark SEC GHCB page in the page encrpytion bitmap. Brijesh Singh (1): OvmfPkg/BaseMemEncryptLib: Support to issue unencrypted hypercall .../Include/Library/MemEncryptHypercallLib.h | 37 ++++++ .../BaseMemEncryptSevLib.inf | 1 + .../BaseMemEncryptSevLib/X64/VirtualMemory.c | 18 +++ .../MemEncryptHypercallLib.c | 105 ++++++++++++++++++ .../MemEncryptHypercallLib.inf | 39 +++++++ .../X64/AsmHelperStub.nasm | 39 +++++++ OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/PlatformPei/AmdSev.c | 10 ++ 8 files changed, 250 insertions(+) create mode 100644 OvmfPkg/Include/Library/MemEncryptHypercallLib.h create mode 100644 OvmfPkg/Library/MemEncryptHypercallLib/MemEncryptHypercallLib.c create mode 100644 OvmfPkg/Library/MemEncryptHypercallLib/MemEncryptHypercallLib.inf create mode 100644 OvmfPkg/Library/MemEncryptHypercallLib/X64/AsmHelperStub.nasm -- 2.17.1