From patchwork Thu Jun 20 18:03:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 11007751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D78DC1398 for ; Thu, 20 Jun 2019 18:55:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6864286A2 for ; Thu, 20 Jun 2019 18:55:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3C5D28856; Thu, 20 Jun 2019 18:55:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3731A286A2 for ; Thu, 20 Jun 2019 18:55:04 +0000 (UTC) Received: from localhost ([::1]:52196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1he2D9-00084m-Aj for patchwork-qemu-devel@patchwork.kernel.org; Thu, 20 Jun 2019 14:55:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43365) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1he1cX-0005N6-L1 for qemu-devel@nongnu.org; Thu, 20 Jun 2019 14:17:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1he1PA-0003v9-IB for qemu-devel@nongnu.org; Thu, 20 Jun 2019 14:03:47 -0400 Received: from mail-eopbgr720059.outbound.protection.outlook.com ([40.107.72.59]:35920 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1he1PA-0003qK-Aq for qemu-devel@nongnu.org; Thu, 20 Jun 2019 14:03:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BtbcS6taWunpw+xfzVL8rz20+Hkl3yki0Z83fCyA7YA=; b=0NK7WofqT7iIMqf88sNQm1c0eL+qN+VDeMz7CeUMovgKyguTPulHf6ewzWZl4KZajTh+75/zjuV93Thr8YbkmQDxdVoKa0UgTq734ga7KNB85vVLMu0n5bloxcNya2WdQzYhAX/WeraWN4CGrtMtJ+f0jsTyWh39ScJudBGTlPA= Received: from DM6PR12MB2682.namprd12.prod.outlook.com (20.176.116.31) by DM6PR12MB3260.namprd12.prod.outlook.com (20.179.105.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.15; Thu, 20 Jun 2019 18:03:20 +0000 Received: from DM6PR12MB2682.namprd12.prod.outlook.com ([fe80::b9c1:b235:fff3:dba2]) by DM6PR12MB2682.namprd12.prod.outlook.com ([fe80::b9c1:b235:fff3:dba2%6]) with mapi id 15.20.1987.014; Thu, 20 Jun 2019 18:03:20 +0000 From: "Singh, Brijesh" To: "qemu-devel@nongnu.org" Thread-Topic: [RFC PATCH v1 06/12] doc: update AMD SEV to include Live migration flow Thread-Index: AQHVJ5Jwlsa+LcCsr0a3jwBl/wUS8g== Date: Thu, 20 Jun 2019 18:03:18 +0000 Message-ID: <20190620180247.8825-7-brijesh.singh@amd.com> References: <20190620180247.8825-1-brijesh.singh@amd.com> In-Reply-To: <20190620180247.8825-1-brijesh.singh@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DM5PR16CA0025.namprd16.prod.outlook.com (2603:10b6:4:15::11) To DM6PR12MB2682.namprd12.prod.outlook.com (2603:10b6:5:4a::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.77.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 67d5d913-5fc8-477e-c3be-08d6f5a992a1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:DM6PR12MB3260; x-ms-traffictypediagnostic: DM6PR12MB3260: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3968; x-forefront-prvs: 0074BBE012 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(376002)(136003)(39860400002)(346002)(199004)(189003)(2351001)(53936002)(486006)(2616005)(11346002)(81156014)(8676002)(14444005)(6436002)(446003)(5640700003)(50226002)(6512007)(476003)(102836004)(6916009)(99286004)(2501003)(6486002)(76176011)(8936002)(52116002)(81166006)(316002)(186003)(6506007)(26005)(478600001)(256004)(3846002)(2906002)(386003)(66066001)(14454004)(54906003)(6116002)(305945005)(25786009)(1076003)(66946007)(66556008)(73956011)(64756008)(66446008)(71190400001)(71200400001)(68736007)(36756003)(66476007)(5660300002)(15650500001)(7736002)(86362001)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB3260; H:DM6PR12MB2682.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: rhVm4gAuizhHs883mO6qAT9PjpfaxRtI52CJ0K6PPJbFuwlBh6GbTuT0CRIJI4bMfRiAOB0aybKZb6S2jQ/a+W+E6BKUXj2C8eAR9JDIxEdT+VKYunFZTGi3dRte0Oj4G7EG/gMKa6q+erA075KkEfNjnQNDqSyHcJuS4+uJ5ZlzgbzVnW/hKUnDFqWO4dBOQWUieyHnEGdfeGGTGQvOnljimU6h5AUHFbogKvm5nhE2/SXBVA6xrimWodkltEiVgnolnJ/KmKPmOEar+hEd6NG3YE77Aje1qsIsiajykl2oOFicHyUAHKlB51JHaF+WTrCHS4J8HCbqJH4xUr7oH/hh1F+fkxWNLAHOCq5IY5WBi+QaYk1xxyIt09a+PpBB72weMk2K52Dr/ey+GoOCpN14Qa/FpZyMaK7Eb3aTMgQ= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67d5d913-5fc8-477e-c3be-08d6f5a992a1 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2019 18:03:18.0545 (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: sbrijesh@amd.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3260 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.72.59 Subject: [Qemu-devel] [RFC PATCH v1 06/12] doc: update AMD SEV to include Live migration flow X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Lendacky, Thomas" , "Singh, Brijesh" , "kvm@vger.kernel.org" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Brijesh Singh --- docs/amd-memory-encryption.txt | 44 +++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt index abb9a976f5..757e0d931a 100644 --- a/docs/amd-memory-encryption.txt +++ b/docs/amd-memory-encryption.txt @@ -89,7 +89,49 @@ TODO Live Migration ---------------- -TODO +AMD SEV encrypts the memory of VMs and because of this encryption is done +using an address tweak, the hypervisor will not be able to simply copy the +ciphertext between machines to migrate a VM. Instead the AMD SEV Key +Management API provides a set of function which the hypervisor can use +to package a guest page for migration, while maintaining the confidentiality +provided by the AMD SEV. + +SEV guest VMs have the concept of private and shared memory. The private +memory is encrypted with the guest-specific key, while shared memory may +be encrypted with the hypervisor key. The migration APIs provided by the +SEV API spec should be used migrating the private pages. The +KVM_GET_PAGE_ENC_BITMAP ioctl can be used to get the guest page state +bitmap. The bitmap can be used to check if the given guest page is +private or shared. + +Before initiating the migration, we need to know the targets public +Diffie-Hellman key (PDH) and certificate chain. It can retrieved +with 'query-sev-capabilities' QMP or using the sev-tool. The +migrate-set-sev-info object can be used to pass the targets PDH and +certificate chain. + +e.g +(QMP) migrate-sev-set-info pdh= plat-cert= \ + amd-cert= +(QMP) migrate tcp:0:4444 + +Note: AMD cert contain be obtained from developer.amd.com/sev. + +During the migration flow, on source hypervisor SEND_START is called first +to create outgoing encryption context. Based on the SEV guest policy, the +certificated passed through the migrate-sev-set-info will be validated +before creating the encryption context. The SEND_UPDATE_DATA is called +to encrypt the guest private pages. After the migration is completed the +SEND_FINISH is called to destroy the encryption context and make the VM +non runnable to protect it against the cloning. + +On target hypevisor, the RECEIVE_START is called first to create an +incoming encryption context. The RECEIVE_UPDATE_DATA is called to copy +the received encrypted page into guest memory. After migration of +pages is completed, RECEIVE_FINISH is called to make the VM runnable. + +For more information about the migration see SEV API Appendix A +Usage flow (Live migration section). References -----------------