From nobody Fri Apr 19 11:27:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1520529229195598.1310996287505; Thu, 8 Mar 2018 09:13:49 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D63D2D1CA; Thu, 8 Mar 2018 17:13:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4EF027DEEC; Thu, 8 Mar 2018 17:13:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B4582180613A; Thu, 8 Mar 2018 17:13:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28HDT1D014144 for ; Thu, 8 Mar 2018 12:13:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id CDE6C84701; Thu, 8 Mar 2018 17:13:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF243190C3; Thu, 8 Mar 2018 17:13:14 +0000 (UTC) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0043.outbound.protection.outlook.com [104.47.37.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06DA07FEA2; Thu, 8 Mar 2018 17:12:35 +0000 (UTC) Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Thu, 8 Mar 2018 17:12:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XfxigtRL+/8jKsrEa0Z+mDmP2o9hoWCJxQOUUsWyToQ=; b=PQTEuwrFJgeP+uqRnC+5fCCfKQYqY7p6ca6yE5V6LxQ6AsWeS0APU07Q0RbuX/fYPgP4zp9Q5wrUqPa1yLWHRs5tPDHuAQYdkqrEgow9qHv8TLT75Pv+Ex0GZSFU9tuAhQCXD9jP6LYj3DTHUV6JBDaLiNqoXRnHwsj4EPD+MQY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: libvir-list@redhat.com Date: Thu, 8 Mar 2018 11:12:00 -0600 Message-Id: <20180308171208.54369-2-brijesh.singh@amd.com> In-Reply-To: <20180308171208.54369-1-brijesh.singh@amd.com> References: <20180308171208.54369-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR11CA0037.namprd11.prod.outlook.com (2603:10b6:404:4b::23) To DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9df7a171-76b5-4859-e52c-08d58517c7ba X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM2PR12MB0156; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 3:UrdsyGIZifPNFvLgKFS83aYsQSTESjgQt3LSaz2EEj1Fh6VchRHULO2rcQDb1w/D7GJw4ZuTxDWUBQgzWsJGDMpgr4Hw0L2MievVIFtxuPVE0NF2pXjcEe434GSYBW4MI83XkZw94axpv6Ek1MXVCY5R7VwoE7hNXzmHY1aJOds4HtYp82Ss/PZcUkflhkL2ZIGpyfaRXoQ1LtbBU7oO8KFxGw5+yIIMnIdtWrgKgjbUu9mP7MgM1olyo2OlwFGY; 25:165bvlOim6f6SCCn8ReUfoTcLNCCFjTGt2Ec7zTzGMhLDDcwHpxxsRN/nTh9e93VJ+AmuV3rDadrvi6dMZqL9V/vsxcu+E0N29Mm1LQvVDZ3swCDcL+snQQ/C0ssOzIqah0f9EPRMSwaGilwciuEd1oaPECQ1dLGXyAiQLS4EFml4n1z5EiKc4B8lmm/IF878l06rtAv6VztUlXlTF6VLxNE3UTaiXIx9oaKn0r6yAeIxnUmXrOADP4ierLeiSVRWrXyApkBQEmNoGTiMoCMS0PMOA7uMtaxrwW7m1uMR42KGuqNkfsIEYg8Xn+g7YjNfPCCAXUJxNv2oLW4HG9h+Q==; 31:bAbk1eFEnrpLDwuzdlOxvHp/tnhjAe8rtaAYjJ2Y8T+uVA2fK/la50AwgoOttW1ys8Z5uAACHxghecKje19SL/iaP/FGEweW8leWV/eInKsh9QLh2V70BbdT+ZXl9fhRzi/2nMFTYrdy6IovG6oOeZPZBhyh10nk0MtKk5NGO0nIEWaZj7QSY5AgQp6Lrq3cUL6k092dfFCNIdadB5qW1TWceTmTRzXnxs9sTYBTHk4= X-MS-TrafficTypeDiagnostic: DM2PR12MB0156: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:yqEUk4hmw0Ok0aer4P5+5mqJqpK7f+zQp4hTTfVawA3Z95gL3oXwZ23fftnPz5qS7zliXr3gHBocJVuo6RogigNuEeyzZ8NB3Ejfvud/gHNK1maDRq7LB/uJZopw3RuxhDgbdN2OKX+NwfSEfMXSq4Dbus01jjMIjw9muirMfx3NbI+HlWEQLSLDvHTEwD5DOU7iDgMRPK7NKPjRl/q8y1hXbPkTgVYdUYbKtjsplZg0nzj1j50Ow3vANZz/JUk1YSKMe155pXWxTAxMF5DciJWHRKyRcwWJGwejiVWi6fXexbwQkPV5VcUoI+2F7LnhlaQA5tNqwnhsl6Hal1oVjx6G+ExJL8OD4Y8vprlU8/KVHHrwHbWBagf9a6TKGCaPgSckczGAUbbOrnXSfdbfDoClsKW1T+KIJ0xrMMnxyLxEpHTFiK+GsgrKCDq4tU+/m9jnG86vPvL8hc8///5HqcgV1zOFjvM/heWh6iwApx/b7tLRwudH60gjLxpnMjPV; 4:JW+tFO5rOyS342sDhmdRhCsPgFYumZiwFOfaqcwpF5Yv026Xdn239RaQGb2mIkMFe9Otcnk1encrTWsfr1JiJkx7Fd2Kc0X1Rf2RhSg9UJPoW8P05rdP+NxAjN/0KptwnQDMGLhbggWpE0+koaQvN2pawXvzf1+9/47IoAvY6Pq7+YR78ONlSB1tDjiCRaKNeRcuLScvmDKo7qWdTetttbjRasonPmmhePo2GbwhCbLgkRV8ZAnW5j1oD0GiPKHQeZo182QOyQIOjODehjEj4A069G7Bx96I+MFcpzGthCglPneWSYIfnOmix9clWKgG X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231220)(944501244)(52105095)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0156; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(376002)(39380400002)(199004)(189003)(5660300001)(16526019)(16586007)(478600001)(3846002)(6116002)(7696005)(52116002)(51416003)(76176011)(6486002)(25786009)(4326008)(316002)(59450400001)(26005)(1076002)(54906003)(86362001)(186003)(386003)(6666003)(2361001)(106356001)(2351001)(53416004)(8676002)(81166006)(81156014)(50226002)(53936002)(2950100002)(6916009)(2906002)(97736004)(68736007)(66066001)(47776003)(305945005)(7736002)(8936002)(36756003)(50466002)(48376002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0156; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0156; 23:+zzYUfMtgnHjC/nKQEF4x9Ao/vMlRn2Z///bo3PY+?= =?us-ascii?Q?CIsX/rITLspprnvIY7hMPGVVeChgvB9vaZlyJ78ANqqP2cJwLo4cp8Bql0Go?= =?us-ascii?Q?BGbaeuPWwcN7t8ELdkbmgoZwAa6ds/zCS3z9p59AWXDz6ZQdlEvODfnkmdi5?= =?us-ascii?Q?64X9X7kEDQWz5IFtA22GLNTUZsuY3Qubp4gOT7GMaEuCGbBHtsZ8icuKvlD+?= =?us-ascii?Q?lODFQhmtnlm+u0CYIxNWQIWQrGrWZ7jIKS3vTzL/DnVt2cKEtzd5py1CA3VS?= =?us-ascii?Q?Dn/m8uLQcvR2PA+wJl0eOfAfMVL9Q0rhCZPnIV/B1AjxJgVRLrBDY0cCQIb0?= =?us-ascii?Q?fmCgWeUF+gz3Nu5jv29uqzb62Fx/SJNl/0y5XuiqqYxGrm4JJpU1rPIwOHlD?= =?us-ascii?Q?GiZ+0QHdkBqNVCNBFuPaUzy2fWgQqux+NEuJ6zfGShEXFViGmGr2ztmPFUcu?= =?us-ascii?Q?o3g7+mPe6J7cS5KsdueUcPzbaYplaaXPjCYmcA6+Os/7HXRnVObHqUd/iRT8?= =?us-ascii?Q?1OvpclpiWufbITC101PMV3gPh7sGydNveh9Szn36Om0F8NzNtOOBcmeMd5+z?= =?us-ascii?Q?g6Nm2FQob4tPhDT5kxdJpZaF6fQXFRbUoodI2lQZm6LdvkqsWG65IXk1O5dq?= =?us-ascii?Q?Jp1Sh0xsML204ByfCZnlGJuOlE+Mwti++drXGMcPqE6ZDiuififWbsnWtGMB?= =?us-ascii?Q?3hQafP1HsnRYFLIZYOebtAqfIyxgMbsXiY0s5+8xkHm6Lfl1lWCOVmdDz58p?= =?us-ascii?Q?IpNXcTQpigZIaVf6mO+sxuyNXgQEs1hkg1ppwVlh4rHX3QE87AN7WcXUUVdM?= =?us-ascii?Q?fj/R4/vMpRTsEiyGwvj4s8nk9kQ1NKe2CdF9OKee81jNEaz0VgsIY7hcY61q?= =?us-ascii?Q?jCchY+vUjxLJUycbgf/8gOX/DO51OI4T0ftL7aS1fzGrMPtn7hukF0XEGJn5?= =?us-ascii?Q?Z3M2zy2S7Sva6Ich4kiUBVwdyRHoFeHT1E+8JwZuoFw4HFWPlYguEFevVxlT?= =?us-ascii?Q?xvm4rTsjHWr/XIUexOmOB+uRpWb3Z6KpErxja4yBr1Er99fzZYUAt6W3c17J?= =?us-ascii?Q?eEoUJfJN6MpKvNpcT0s0gqPgNTE6N/B/bbpEo86/Am83YvdHX6Yw4Bewd+pU?= =?us-ascii?Q?VxAGW1I1ImFTItFLry4KCWdfOjKwGginELQpyzsxLveYZLypd7FJZgCUfT4B?= =?us-ascii?Q?d4BjrEwfxtQ22qUSjhhWwyI1DxogaZuwfBD?= X-Microsoft-Antispam-Message-Info: FGtSFGgYtbkigqQKa41XFP7P32YOaEuJ177oevE8PgmY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50E6Qu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:G70MhlLvdmJp7w7uiiFs3Z9uG1kKAoskjpoW25Z5ECAi9ng/qFCOxIZgNkcLR82Zh6WNPnMPTxNNmmtSdl3Od80gNbSfoGxpDcvpvxjl6Tj3Y0t4+P/7lyPFyuyA+laacWV9Nio+aqI+nUyPpd2YqsosRNLtQhIBI9TLi1cioZE4OgyXJycU3zPEZsxFX7Aqqwv8ENdNsYHRO8T7GmfXanYuvkOmjWGV8d6Dm6ozuZNb6CGm9Ie4Yp11BqLT07xR X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 17:12:31.5699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9df7a171-76b5-4859-e52c-08d58517c7ba X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 17:12:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 17:12:35 +0000 (UTC) for IP:'104.47.37.43' DOMAIN:'mail-cys01nam02on0043.outbound.protection.outlook.com' HELO:'NAM02-CY1-obe.outbound.protection.outlook.com' FROM:'brijesh.singh@amd.com' RCPT:'' X-RedHat-Spam-Score: -0.011 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS) 104.47.37.43 mail-cys01nam02on0043.outbound.protection.outlook.com 104.47.37.43 mail-cys01nam02on0043.outbound.protection.outlook.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tom Lendacky , Peter Krempa , Xiaogang Chen , Jon Grimm , Brijesh Singh , Borislav Petkov Subject: [libvirt] [PATCH v2 1/9] qemu: provide support to query the SEV capability X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 08 Mar 2018 17:13:48 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" QEMU version >=3D 2.12 provides support for launching an encrypted VMs on AMD x86 platform using Secure Encrypted Virtualization (SEV) feature. This patch adds support to query the SEV capability from the qemu. Signed-off-by: Brijesh Singh Reviewed-by: Daniel P. Berrang=C3=A9 --- src/conf/domain_capabilities.h | 13 ++++++++ src/qemu/qemu_capabilities.c | 43 +++++++++++++++++++++++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_capspriv.h | 4 +++ src/qemu/qemu_monitor.c | 9 ++++++ src/qemu/qemu_monitor.h | 3 ++ src/qemu/qemu_monitor_json.c | 73 ++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_monitor_json.h | 3 ++ 8 files changed, 149 insertions(+) diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index fa4c1e442f57..83d04d4c8506 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -137,6 +137,19 @@ struct _virDomainCapsCPU { virDomainCapsCPUModelsPtr custom; }; =20 +/* + * SEV capabilities + */ +typedef struct _virSEVCapability virSEVCapability; +typedef virSEVCapability *virSEVCapabilityPtr; +struct _virSEVCapability { + char *pdh; + char *cert_chain; + int cbitpos; + int reduced_phys_bits; +}; + + struct _virDomainCaps { virObjectLockable parent; =20 diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b5eb8cf46a52..68e3622a3963 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -459,6 +459,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "pl011", "machine.pseries.max-cpu-compat", "dump-completed", + "sev", ); =20 =20 @@ -525,6 +526,8 @@ struct _virQEMUCaps { size_t ngicCapabilities; virGICCapability *gicCapabilities; =20 + virSEVCapability *sevCapabilities; + virQEMUCapsHostCPUData kvmCPU; virQEMUCapsHostCPUData tcgCPU; }; @@ -2811,6 +2814,21 @@ virQEMUCapsSetGICCapabilities(virQEMUCapsPtr qemuCap= s, qemuCaps->ngicCapabilities =3D ncapabilities; } =20 +void +virQEMUCapsSetSEVCapabilities(virQEMUCapsPtr qemuCaps, + virSEVCapability *capabilities) +{ + virSEVCapability *cap =3D qemuCaps->sevCapabilities; + + if (cap) { + VIR_FREE(cap->pdh); + VIR_FREE(cap->cert_chain); + } + + VIR_FREE(qemuCaps->sevCapabilities); + + qemuCaps->sevCapabilities =3D capabilities; +} =20 static int virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps, @@ -3318,6 +3336,19 @@ virQEMUCapsProbeQMPGICCapabilities(virQEMUCapsPtr qe= muCaps, return 0; } =20 +static int +virQEMUCapsProbeQMPSEVCapabilities(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon) +{ + virSEVCapability *caps =3D NULL; + + if (qemuMonitorGetSEVCapabilities(mon, &caps) < 0) + return -1; + + virQEMUCapsSetSEVCapabilities(qemuCaps, caps); + + return 0; +} =20 bool virQEMUCapsCPUFilterFeatures(const char *name, @@ -4896,6 +4927,12 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT); } =20 + /* no way to query -object sev-guest */ + if (ARCH_IS_X86(qemuCaps->arch) && + qemuCaps->version >=3D 2012000) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SEV); + } + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup; =20 @@ -4951,6 +4988,12 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_CACHE); =20 + /* Probe for SEV capabilities */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV)) { + if (virQEMUCapsProbeQMPSEVCapabilities(qemuCaps, mon) < 0) + virQEMUCapsClear(qemuCaps, QEMU_CAPS_SEV); + } + ret =3D 0; cleanup: return ret; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index c2ec2be19311..02acae491ab5 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -444,6 +444,7 @@ typedef enum { QEMU_CAPS_DEVICE_PL011, /* -device pl011 (not user-instantiable) */ QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT, /* -machine pseries,max-cpu-= compat=3D */ QEMU_CAPS_DUMP_COMPLETED, /* DUMP_COMPLETED event */ + QEMU_CAPS_SEV, /* -object sev-guest,... */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index 222f3368e3b6..1fa85cc14f07 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -86,6 +86,10 @@ virQEMUCapsSetGICCapabilities(virQEMUCapsPtr qemuCaps, virGICCapability *capabilities, size_t ncapabilities); =20 +void +virQEMUCapsSetSEVCapabilities(virQEMUCapsPtr qemuCaps, + virSEVCapability *capabilities); + int virQEMUCapsParseHelpStr(const char *qemu, const char *str, diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ad5c572aeefb..195248c88ae1 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4007,6 +4007,15 @@ qemuMonitorGetGICCapabilities(qemuMonitorPtr mon, return qemuMonitorJSONGetGICCapabilities(mon, capabilities); } =20 +int +qemuMonitorGetSEVCapabilities(qemuMonitorPtr mon, + virSEVCapability **capabilities) +{ + QEMU_CHECK_MONITOR_JSON(mon); + + return qemuMonitorJSONGetSEVCapabilities(mon, capabilities); +} + =20 int qemuMonitorNBDServerStart(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 954ae88e4f64..1b2513650c58 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -755,6 +755,9 @@ int qemuMonitorSetMigrationCapability(qemuMonitorPtr mo= n, int qemuMonitorGetGICCapabilities(qemuMonitorPtr mon, virGICCapability **capabilities); =20 +int qemuMonitorGetSEVCapabilities(qemuMonitorPtr mon, + virSEVCapability **capabilities); + typedef enum { QEMU_MONITOR_MIGRATE_BACKGROUND =3D 1 << 0, QEMU_MONITOR_MIGRATE_NON_SHARED_DISK =3D 1 << 1, /* migration with non-= shared storage with full disk copy */ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a09e93e464b3..94a1af1d3f75 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6362,6 +6362,79 @@ qemuMonitorJSONGetGICCapabilities(qemuMonitorPtr mon, return ret; } =20 +int +qemuMonitorJSONGetSEVCapabilities(qemuMonitorPtr mon, + virSEVCapability **capabilities) +{ + int ret =3D -1; + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + virJSONValuePtr caps; + virSEVCapability *capability =3D NULL; + const char *pdh =3D NULL, *cert_chain =3D NULL; + int cbitpos, reduced_phys_bits; + + *capabilities =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-sev-capabilities", + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + goto cleanup; + + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + goto cleanup; + + caps =3D virJSONValueObjectGetObject(reply, "return"); + + if (virJSONValueObjectGetNumberInt(caps, "cbitpos", &cbitpos) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("'cbitpos' field is missing")); + goto cleanup; + } + + if (virJSONValueObjectGetNumberInt(caps, "reduced-phys-bits", + &reduced_phys_bits) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("'reduced-phys-bits' field is missing")); + goto cleanup; + } + + if (!(pdh =3D virJSONValueObjectGetString(caps, "pdh"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("'pdh' field is missing")); + goto cleanup; + } + + if (!(cert_chain =3D virJSONValueObjectGetString(caps, "cert-chain")))= { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("'cert-chain' field is missing")); + goto cleanup; + } + + if (VIR_ALLOC(capability) < 0) + goto cleanup; + + if (VIR_STRDUP(capability->pdh, pdh) < 0) + goto cleanup; + + if (VIR_STRDUP(capability->cert_chain, cert_chain) < 0) + goto cleanup; + + capability->cbitpos =3D cbitpos; + capability->reduced_phys_bits =3D reduced_phys_bits; + *capabilities =3D capability; + ret =3D 0; + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + + return ret; +} + static virJSONValuePtr qemuMonitorJSONBuildInetSocketAddress(const char *host, const char *port) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index ec243becc4ae..305f789902e9 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -152,6 +152,9 @@ int qemuMonitorJSONSetMigrationCapability(qemuMonitorPt= r mon, int qemuMonitorJSONGetGICCapabilities(qemuMonitorPtr mon, virGICCapability **capabilities); =20 +int qemuMonitorJSONGetSEVCapabilities(qemuMonitorPtr mon, + virSEVCapability **capabilities); + int qemuMonitorJSONMigrate(qemuMonitorPtr mon, unsigned int flags, const char *uri); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 11:27:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1520529246619817.351916256633; Thu, 8 Mar 2018 09:14:06 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B828066CB2; Thu, 8 Mar 2018 17:14:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24C1378A2E; Thu, 8 Mar 2018 17:14:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AAAC14CAA1; Thu, 8 Mar 2018 17:13:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28HDTGA014149 for ; Thu, 8 Mar 2018 12:13:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 76EAE7E67B; Thu, 8 Mar 2018 17:13:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 169E17E65F; Thu, 8 Mar 2018 17:13:21 +0000 (UTC) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0043.outbound.protection.outlook.com [104.47.37.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 278B181DEA; Thu, 8 Mar 2018 17:12:36 +0000 (UTC) Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Thu, 8 Mar 2018 17:12:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GSrnEWIG2/iHYjY3KLWkhedNTRLyIyAkkeqR07wcG0Q=; b=zu9xxyzTyXkZ0Fn8BtEL6W/CyEFMKyU1mVejSCB/ITZxo3pkdsNrgVvuwYAX67PcD3vhakL+N7MpWdpouhOVwkcvHK5WiQp2Pe+KCQdlVYHUodnwm31QoW0zDcstDpGy5hyMhyH1I5MmYRDQLw3WHgwGGDjYQRGbOP6HxYLnBtw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: libvir-list@redhat.com Date: Thu, 8 Mar 2018 11:12:01 -0600 Message-Id: <20180308171208.54369-3-brijesh.singh@amd.com> In-Reply-To: <20180308171208.54369-1-brijesh.singh@amd.com> References: <20180308171208.54369-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR11CA0037.namprd11.prod.outlook.com (2603:10b6:404:4b::23) To DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bec81071-bcff-4847-f134-08d58517c868 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM2PR12MB0156; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 3:oJaB9Lu/hCQqFYuFDMdiaWCOMDZOAPzLSxR5P5TxdNkY3g6himK2c/mWEiFwEYYxEIjjTCVV5SwX3to1ZP/fvXI55JqcbPDrIYHkAbr2TOb1hr4GFVY76p77bQ0q2VBj4ePuLcY30Vi0fWwY9y1+mGk6Yov7TOEsHnMORtHlAvmVyG8ub9SmN+GWmcwioMINyCioH0HwEiJegIGLhBWs8OiiqxYPemWNDMf/rfiKxJlcVWPA0AxjvERMmdjCW0YD; 25:Z3Yq3+kFQMAUpmLZy6n7fWGs5+H43rI+wbNO01bRiC6LLiJl6mcaNSWSyWCQ1GeZ//KVT80R6Dmh5MGqxBS1ci1u+WJqK3xB0qawqCRmo7v+EtrQfT4G/iD/i6IX7UPAJ/L/jvpu7h42M4dvvn/yoR5ahU4R94+JVuqOE3Pkypyn+wHbk/Vgtk0P5WZSlawriIDtgR2Jh9A4HnAFhW2Q8fnEU6cN7kowiAgz1VyptcIWgnqCPeC8ZPDR+99Dbt3tlEwyiOuwOG4xFbpYhIvExGyE4N/UrU1uDWJ3XHPiesk0YF0lbDeiveWNXHvvtWHbSqDH0JjUvhqMTn7E6LXvMA==; 31:IUnzHtpmgLQsC1rdFHyBjlXUj+tYZtuwNOyNJeowgZrSrKi0ofm0NYqXKO6kI84oZxhG4qX1yNHDilDwo9uVf1ge4CNk2Qc57ExtjR1oMy250mHScLIoS6R7UGElY6gERMJLtBnRwqAcF8sFHZ/QYQvIq+GTbTECFFAsHvx2crsLRXkBzFk/vT54ADZf1WQqWqfboDUG79jE/XbLY9egDQkTuZZbu+RZmLsYiTEdZJ0= X-MS-TrafficTypeDiagnostic: DM2PR12MB0156: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:T+4PMmUaKxm+O3swv7xGwJbOZ3eqK/eHyNlvPerGE8rRQ0IKLOOEa3Ne9Yf0wrwRLdEfOXoGV6M4CejobRsvGM/Ay6K08n/HXaeMMV5/DnSqo6jSaQ1bXWFMyRGHIQ3a39tcYUQ0JjP5zVF7WyOc4XFasvUw+rcu/jhZ7+MCxFNdPTGpp2t0OjligTrkSvPvbRafCAZkmSWZcuQdMwg3fgpOLRPPS1ZRq2smbVzNbOrL2dIHtN1ybqQcl3zN6ktiDas1xLS7LKxC5NJyH5oyb+qBPis+KEKq6sKUXA5UT3YMAqsHbTUR7vx49okdIU9/7t9dBPOlJVOGPgLWhvPCJxSOrOpwGeN/JfMjVX2QJ/OrEhGEFbI7k1yNrJDkDqkSmj1UGacnz90+O0Hr1ixXYYsJCcNrIWNp+P41MVhoddLQOztXIh9xG9liiQCS7o8cULjecsJLi6Nxtf4YFJikQBgGW9xb8mLAnKN4bulVqsdpKg+VYYa8TX2h2VvgrTgE; 4:TLyCueffHg+8ruNGEDgVBfZI4WHwkKtRzSpwvovqIFRLzcL+WZIfqyX2kSeDF14xB1Zqg4W+sPwj6NdlICn49MpDIAtgNJ/hHJg7BikTgy1z0/OeVV/Tygb3Mtltee0BSDg4UYYnFk8BrYoWp1wW0xowJTiMUfJiwDB9VDsdI/MZhh7sqfrYF3hn1G6DyRYVxk2TwfsjI/AbMz6p2u3ICAbtgJY6LV5fFGn11tgD60mmeSzhg0iJ2FqEroLmXs4GnbPy7MjnIyO4Dju1rhS3EW1j2OblUAGwCoboNWXKbojo/JizXR3qr62p7yfWB7QS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231220)(944501244)(52105095)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0156; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(366004)(346002)(39860400002)(396003)(376002)(39380400002)(199004)(189003)(5660300001)(16526019)(16586007)(478600001)(3846002)(6116002)(7696005)(298455003)(52116002)(51416003)(76176011)(6486002)(25786009)(4326008)(316002)(59450400001)(26005)(1076002)(54906003)(86362001)(186003)(386003)(6666003)(2361001)(106356001)(2351001)(53416004)(8676002)(81166006)(81156014)(50226002)(6306002)(53936002)(2950100002)(6916009)(2906002)(236005)(97736004)(68736007)(66066001)(606006)(47776003)(7736002)(8936002)(36756003)(50466002)(48376002)(105586002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0156; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0156; 23:RF+1vlROMcWnw6UJzncVZBhnPHcoS453MrVqH1Svk?= =?us-ascii?Q?s+9zvIA5fYAtpvH0x/HN0QkWTQVgQBGjzV3noBB0hcOUBMUd+GJL/+rxWlKG?= =?us-ascii?Q?xhlIGN4AfzEknbVKM9msgdf1kYjAPCshBCwueCUDqE1rM+0uqZZGS7UcK+2/?= =?us-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hDGyQ4DZZFrzk82DJQal8eDg+xz1QiOlY44a2Jaah/nbedMKXMb4ihq2fNgF3oLCzL2/e7pdV7yF6p0dsSAXRfKZBVuNPpN0yMuR/VVCbJdVn2gE8hg2p2xF6rDs=; 24:Udo2nSe82dG93eLnwg0yewqYz+FTaJZbw9kxblyBumxbIVGrknGYIm7iXkw0B8+eZEilxhoPSK9pCyfqj+z6OOlYJdc2Z8XT/EXZ+24nyfY=; 7:f7mH+ddowDRdEMUmt81YaQ9IaE547OGq8NK6AkXko0YQFdtJ/Sh3ixGJAqEf+9lgzdICScbrKqVcvBebzYKxa/+0X2pdB1bU/YCQ6EcP16pxfPpV7hawmazO1uLGAiM1RZRFPgUJgquNhG6NWsRotqpCLosZqZAevdtjpdMACaLa1DcUyKgevUE/BBP+n6eX0P9hC4ewsjvnDPmHN27uhiSgfmVPM54V2Acc93k6pQIiNTouPAPeSthIYdY8pfGm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:NylxEDsjoJt9pM0EtPN7SDTAspzYlJC0RSsVpcK9ocOMatXOJilDS4JaHjW1eVJ+nG4eDMjGaBWYPaKHHPviFrNkGJNC5jvqOGo0XnqAV79s/+J6lgDcKWvb3DRTlft4SdhZ4Cy+dAfyCglaeYQM9lhbTMuRqru7ILNi4nuMawFfJzVhAjzbDGo/hh0WCIM0g2yQjyk5ugQBGq3N1mOt7ZKMZXBDjrUM5XZqzDynbi2T42EN2Ifjhy3WA3N4AJ1/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 17:12:32.7262 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bec81071-bcff-4847-f134-08d58517c868 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 17:12:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 17:12:36 +0000 (UTC) for IP:'104.47.37.43' DOMAIN:'mail-cys01nam02on0043.outbound.protection.outlook.com' HELO:'NAM02-CY1-obe.outbound.protection.outlook.com' FROM:'brijesh.singh@amd.com' RCPT:'' X-RedHat-Spam-Score: -0.011 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS) 104.47.37.43 mail-cys01nam02on0043.outbound.protection.outlook.com 104.47.37.43 mail-cys01nam02on0043.outbound.protection.outlook.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Tom Lendacky , Peter Krempa , Xiaogang Chen , Jon Grimm , Brijesh Singh , Borislav Petkov Subject: [libvirt] [PATCH v2 2/9] qemu: introduce SEV feature in hypervisor capabilities X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 08 Mar 2018 17:14:05 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Extend hypervisor capabilities to include sev feature. When available, hypervisor supports launching an encrypted VM on AMD platform. The sev feature tag provides additional details like platform diffie-hellman key and certificate chain which can be used by the guest owner to establish a cryptographic session with the SEV firmware to negotiate keys used for attestation or to provide secret during launch. Signed-off-by: Brijesh Singh Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/formatdomaincaps.html.in | 40 ++++++++++++++++++++++++++++++++++++++= ++ docs/schemas/domaincaps.rng | 20 ++++++++++++++++++++ src/conf/domain_capabilities.c | 20 ++++++++++++++++++++ src/conf/domain_capabilities.h | 1 + src/qemu/qemu_capabilities.c | 2 ++ 5 files changed, 83 insertions(+) diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in index 6bfcaf61caae..f38314166ac3 100644 --- a/docs/formatdomaincaps.html.in +++ b/docs/formatdomaincaps.html.in @@ -417,6 +417,12 @@ <value>3</value> </enum> </gic> + <sev> + <pdh> </pdh> + <cert-chain> </cert-chain> + <cbitpos> </cbitpos> + <reduced-phys-bits> </reduced-phys-bits> + </sev> </features> </domainCapabilities> @@ -441,5 +447,39 @@ gic element. =20 +

SEV capabilities

+ +

AMD Secure Encrypted Virtualization (SEV) capabilities are exposed = under + the sev element. + SEV is an extension to the AMD-V architecture which supports running + virtual machines (VMs) under the control of a hypervisor. When support= ed, + guest owner can create a VM whose memory contents will be transparently + encrypted with a key unique to that VM. + + For more details on SEV feature see: + + SEV API spec and \n"); + virBufferAdjustIndent(buf, 2); + virBufferAsprintf(buf, "%d\n", sev->cbitpos); + virBufferAsprintf(buf, "%d\n", + sev->reduced_phys_bits); + virBufferAsprintf(buf, "%s\n", sev->pdh); + virBufferAsprintf(buf, "%s\n", + sev->cert_chain); + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); +} + =20 char * virDomainCapsFormat(virDomainCapsPtr const caps) @@ -587,6 +606,7 @@ virDomainCapsFormat(virDomainCapsPtr const caps) virBufferAdjustIndent(&buf, 2); =20 virDomainCapsFeatureGICFormat(&buf, &caps->gic); + virDomainCapsFeatureSEVFormat(&buf, caps->sev); =20 virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 83d04d4c8506..2239566105fd 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -170,6 +170,7 @@ struct _virDomainCaps { /* add new domain devices here */ =20 virDomainCapsFeatureGIC gic; + virSEVCapabilityPtr sev; /* add new domain features here */ }; =20 diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 68e3622a3963..f56e88032c06 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5975,6 +5975,8 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps, virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 || virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0) return -1; + + domCaps->sev =3D qemuCaps->sevCapabilities; return 0; } =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 11:27:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1520529224828917.0235151145708; Thu, 8 Mar 2018 09:13:44 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35BE426AC40; Thu, 8 Mar 2018 17:13:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9388E51DDB; Thu, 8 Mar 2018 17:13:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7DB374CA9F; Thu, 8 Mar 2018 17:13:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w28HDSwh014138 for ; Thu, 8 Mar 2018 12:13:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id D3A808470A; Thu, 8 Mar 2018 17:13:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18CB984700; Thu, 8 Mar 2018 17:13:22 +0000 (UTC) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0043.outbound.protection.outlook.com [104.47.37.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 799847FEA5; Thu, 8 Mar 2018 17:12:37 +0000 (UTC) Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Thu, 8 Mar 2018 17:12:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LS95IIfpEPP7GTEGqM+NH9jbYNz/KqQyAw7JuWZhp28=; b=dEIqSm75KjQDt0s4r3RtZp3OJv+bAAV9K05G6g1YOLkXsS9+iTcKX9GqiXCFYFiYNSdNtB3PizxLmhEr1eeyomuKcd/3enRstGfJ7v9lfDLajow+qpDRotwk6ZN9kKYOGePLmp6Dx3Z/P4GreZ1lbGhBxHTr74v55KF18AyOU6E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: libvir-list@redhat.com Date: Thu, 8 Mar 2018 11:12:02 -0600 Message-Id: <20180308171208.54369-4-brijesh.singh@amd.com> In-Reply-To: <20180308171208.54369-1-brijesh.singh@amd.com> References: <20180308171208.54369-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR11CA0037.namprd11.prod.outlook.com (2603:10b6:404:4b::23) To DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e5a96bd5-a0dc-44b6-3880-08d58517c912 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM2PR12MB0156; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 3:NFFxGUxhC1VJnIXmfaSRGhG3tHUY5Qjg+X/lFYbo/vjoxYTusfq+oyqCxr/Tml3LFN4lVej7fEw6Qt+hTBvReQaoobtssoe7tIp7Z2VNk8r6pGRF5lA56Qxo2jvlkq3gOlHmrWsMxdsW+qOC44sj6CWsPdwgY2AyeEswu4aWTGY5a0l4y8gdXCVwg6F33FlyCKtWqvJ+Nb67EzupV1fR17vfYwDVFv0nBKwNcenz9SkkzoxrOxnFTfTMRdgdL98y; 25:SET7ZegL+dylTa+vjmWNY9DTLQRSGnt37UuBiT5vXrlxWMoYLeL9k5E89HPb2DpmPE8ak0VAfPfGTgA8CfxKq2uirt5Sh8HwmwWsoX/QrCAFdTVJ2eIXB8k5IqMpUMULAtaave9dHWgvq9IUq/GhFgLZpfAaiQ3n+0eUZlMd2gtiP3DeiHh0T/F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1q6NvfHj8Q9MFuackJhh+yQlr8TYe1a3UEl5F04dQmYm83rxAgsyo/F2biCq8tq3iOoubVdd/q9oPupmC1RB9ZpYS4IqCjw7xBnnRH41X3snMEu8DQKSB8TMQspmiXaTgytn05Tqx5GRNzi6/cTS1rPChO7zJDFL6ji3bx1RjOq2lZi0iK3Vo48T3qm/G5hGH9G3E8W2loO+bNkqGu/k1rzmSINB3Wyk8uoRMYaeUNZ7iP8RbEyUIt4A/sFQD7NdSkQ9JAVkpoMJsIC+qI+AUX0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231220)(944501244)(52105095)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0156; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(376002)(39380400002)(199004)(189003)(5660300001)(16526019)(16586007)(478600001)(3846002)(6116002)(7696005)(52116002)(51416003)(76176011)(6486002)(25786009)(4326008)(316002)(59450400001)(26005)(1076002)(54906003)(86362001)(575784001)(186003)(386003)(6666003)(2361001)(106356001)(2351001)(53416004)(8676002)(81166006)(81156014)(50226002)(6306002)(15650500001)(53936002)(2950100002)(6916009)(2906002)(236005)(97736004)(68736007)(66066001)(606006)(47776003)(305945005)(7736002)(8936002)(36756003)(966005)(50466002)(48376002)(105586002)(19607625011); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0156; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0156; 23:owwWD2ca4yF+6q+bk0FNcubBrV03xekVv5Twjx2af?= =?us-ascii?Q?tYg9mWgTLvvlXMpRiM+020MeroV7iwlD6fnmLGasLHYDvXNVh+t36SPK+NI+?= =?us-ascii?Q?w5DwA7SnsB5uO2R3+HtSJCjxdF9HnV0L0p27DJ/jmfiGyjABnBn4N3q2/OhE?= =?us-ascii?Q?i16s44ZrZx8woy6bLaE3PSUFGp4rm1i1FbDOtbuwG20sb8WIpn+fjpO3ee15?= =?us-ascii?Q?4ovTdlqk5no/DX1fIkocR22BLYGN27K59hAF+2dgPLAOD0WfzEd1XsoORO0O?= =?us-ascii?Q?HfeYKKGIFuvwY1qn9Ehal5e6E08KnxQYneDZqqB3b5ZO9S9lvlmL79QFXElO?= =?us-ascii?Q?Xs9te4VdM2N6YUpfRRVVfQbDaPPgXvEDnBW0RMmQmOIpBkIX7xFfEya6WDv7?= =?us-ascii?Q?76yXG4LwPRtHIgPsYQS4qGf552Sooc3TU6Xjjgw+PAA4+CZeXiXaWjkMB+q0?= =?us-ascii?Q?ZGgPDpOWTts6EY6Isb311sGGegkUMT8IXdv46s48GIFeUXueIH4UMwAKok7w?= =?us-ascii?Q?pft4NpseWMaXRzIFY4HDbV5faHSLQU6sQSys1B+c0zvoRqj3AaIQNEwu+1Az?= =?us-ascii?Q?cej93WfAmTQKAheiPrwgvgmq0VYZe4yJ/Gl3gxzVjTwNvFHJwzm+WeSYEweX?= =?us-ascii?Q?8ZTWKNMKhV5AYlVRvKrHh8Vr87UqAl07qabe5uYTDA/BEuX81D6Z2hBccWyg?= =?us-ascii?Q?MAtetK53UxmBXiK1wdxlkvHIxx2oIh76jkHWLbOACjF37N5sEz6wEsv79S5U?= =?us-ascii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ogxwJ4H/e1ll2VWiUZGEqfgZEqG5ZjK1PZUmNjMFqDiKyJRwl7ol5WTftm1Zbtvh3Qgn1i6iTVigE/Nhnbnd8EunDdbnA/OLfsy+IoMAH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 17:12:33.8512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5a96bd5-a0dc-44b6-3880-08d58517c912 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 17:12:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 17:12:37 +0000 (UTC) for IP:'104.47.37.43' DOMAIN:'mail-cys01nam02on0043.outbound.protection.outlook.com' HELO:'NAM02-CY1-obe.outbound.protection.outlook.com' FROM:'brijesh.singh@amd.com' RCPT:'' X-RedHat-Spam-Score: -0.011 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS) 104.47.37.43 mail-cys01nam02on0043.outbound.protection.outlook.com 104.47.37.43 mail-cys01nam02on0043.outbound.protection.outlook.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tom Lendacky , Peter Krempa , Xiaogang Chen , Jon Grimm , Brijesh Singh , Borislav Petkov Subject: [libvirt] [PATCH v2 3/9] conf: introduce launch-security element in domain X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 08 Mar 2018 17:13:43 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The launch-security element can be used to define the security model to use when launching a domain. Currently we support 'sev'. When 'sev' is used, the VM will be launched with AMD SEV feature enabled. SEV feature supports running encrypted VM under the control of KVM. Encrypted VMs have their pages (code and data) secured such that only the guest itself has access to the unencrypted version. Each encrypted VM is associated with a unique encryption key; if its data is accessed to a different entity using a different key the encrypted guests data will be incorrectly decrypted, leading to unintelligible data. Signed-off-by: Brijesh Singh Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/formatdomain.html.in | 120 ++++++++++++++++++++++++++++++++++++++= ++++ docs/schemas/domaincommon.rng | 39 ++++++++++++++ src/conf/domain_conf.c | 111 ++++++++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 27 ++++++++++ 4 files changed, 297 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6fd2189cd2f4..830d2a3c59be 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -8195,6 +8195,126 @@ qemu-kvm -net nic,model=3D? /dev/null =20

Note: DEA/TDEA is synonymous with DES/TDES.

=20 +

Secure Encrypted Virtualization (SEV)

+ +

+ The contents of the <launch-security type=3D'sev'> element + is used to provide the guest owners input used for creating an encr= ypted + VM using the AMD SEV feature. + + SEV is an extension to the AMD-V architecture which supports running + encrypted virtual machine (VMs) under the control of KVM. Encrypted + VMs have their pages (code and data) secured such that only the gue= st + itself has access to the unencrypted version. Each encrypted VM is + associated with a unique encryption key; if its data is accessed to= a + different entity using a different key the encrypted guests data wi= ll + be incorrectly decrypted, leading to unintelligible data. + + For more information see various input parameters and its format se= e SEV API spec + https://support.amd.com/TechDocs/55766_SEV-KM%20API_Specifi= cation.pdf + Since 4.2.0 +

+
+<domain>
+  ...
+  <launch-security type=3D'sev'>
+    <policy> 0 </policy>
+    <cbitpos> 47 </cbitpos>
+    <reduced-phys-bits> 5 </reduced-phys-bits>
+    <session> ... </session>
+    <dh-cert> ... </dh>
+  </sev>
+  ...
+</domain>
+
+ +

+ A least cbitpos and reduced-phys-bits must be + nested within the launch-security element. +

+
+
cbitpos
+
The cbitpos element provides the C-bit (aka encrypt= ion bit) + location in guest page table entry. The value of cbitpos is + hypervisor dependent and can be obtained through the sev element + from domaincapabilities. +
+
reduced-phys-bits
+
The reduced-phys-bits element provides the physical + address bit reducation. Similar to cbitpos the value of= + reduced-phys-bit is hypervisor dependent and can be obtained + through the sev element from domaincapabilities. +
+
policy
+
The optional policy element provides the guest poli= cy + which must be maintained by the SEV firmware. This policy is enforce= d by + the firmware and restricts what configuration and operational comman= ds + can be performed on this guest by the hypervisor. The guest policy + provided during guest launch is bound to the guest and cannot be cha= nged + throughout the lifetime of the guest. The policy is also transmitted + during snapshot and migration flows and enforced on the destination = platform. + + The guest policy is a 4-byte structure with the fields shown in Tabl= e: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bit(s) Description
0 Debugging of the guest is disallowed when set
1 Sharing keys with other guests is disallowed when set
2 SEV-ES is required when set
3 Sending the guest to another platform is disallowed when se= t
4 The guest must not be transmitted to another platform that = is + not in the domain when set.
5 The guest must not be transmitted to another platform that = is + not SEV capable when set.
15:6 reserved
16:32 The guest must not be transmitted to another platform with a + lower firmware version.
+ Default value is 0x1 + +
+
dh-cert
+
The optional dh-cert element provides the guest own= ers public + Diffie-Hellman (DH) key. The key is used to negotiate a master secret + key between the SEV firmware and guest owner. This master secret key= is + then used to establish a trusted channel between SEV firmware and gu= est + owner. The value must be encoded in base64. +
+
session
+
The optional session element provides the guest own= ers + session blob defined in SEV API spec. The value must be encoded in b= ase64. + + See SEV spec LAUNCH_START section for session blob format. +
+
+

Example configs

=20

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 8165e699d67e..e3dcc69067c2 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -77,6 +77,9 @@ + + + @@ -436,6 +439,42 @@ =20 + + + + sev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +