From patchwork Wed Feb 28 21:10:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10249879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4938260362 for ; Wed, 28 Feb 2018 21:38:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36567286F4 for ; Wed, 28 Feb 2018 21:38:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2ADC7288AD; Wed, 28 Feb 2018 21:38:15 +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=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 51BE8286F4 for ; Wed, 28 Feb 2018 21:38:14 +0000 (UTC) Received: from localhost ([::1]:47111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er9QT-0006g9-L2 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 16:38:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er90T-0001UG-KH for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er90P-00061I-Nc for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:21 -0500 Received: from mail-dm3nam03on0047.outbound.protection.outlook.com ([104.47.41.47]:38389 helo=NAM03-DM3-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 1er90P-0005yl-GA for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:17 -0500 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=LwxFce27HulRljlKcrgU7P+t8JVWucZlaxzH3GOZJtY=; b=uuliEHMLuF9Pgd89UOGmh+ruNhVYpHngeIxg50FyWzYKSVYgxOzNN9TypUlpc/GrdNOm2ghsRtFzmZ+tvogJtafE2PSr2fkKLVcdUzEs2uDUkV9S4J45Bk8wsIBlCXWamtFGl1HjvCbTnsfBto0SwOoM5CZ2qNN4pktOPhpG+4M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 21:11:15 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 15:10:23 -0600 Message-ID: <20180228211028.83970-24-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228211028.83970-1-brijesh.singh@amd.com> References: <20180228211028.83970-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR10CA0008.namprd10.prod.outlook.com (2603:10b6:4:2::18) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bf8b86fc-95d4-4675-43f7-08d57eefcdd8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:uaXwph/a5LJgCHE4QEXh7SQQ5YVs3ZlGPVlEc4V6kYj7zkv1726oqodAygyiv1GwTM5oMgEs8dH4CK2Ahhu/S7Kj9IwE1nWxk2n1ajybJLqd8XZHw55i5lS2LUdb0J3NaOqbMgnLTw6xL6GjCvSpKpkTFfVqpYz7yn8FBTa7+ni3PwIeJ48E4RRg7VngldTyOsnERXKRHXfsfYZW7GV5tGugpNveeTZuQeyV8rbXbbsij+tF+8e+baWaW16JPCC+; 25:JroxBXMFBzLlOhP8NKDLIHN62ApR9vNa7Fmv5gvv/jI2TenHZjKKAPlptjgK//mi4r3KJgZCu7xH6UeQHBQwDgTJG651RzUuZwZgl2t1cW5IIzhXOYNRjUtZ/gjFzVdSOQVBO923LYLHYmKWUHT5/hXLh6e6khOl3nYlOAin02bNf4FlAfKIo8RV0Z8mz+TpBSIxY+/dPeokliAbgzWZAzd8RotYc0CUNa92O/fgEPzI+UG8DqMzjECXnGv7Ev0fnrU/kWENAh0CUs5bqFp81qw9cQL9sAVjk+dp8JUowXFbAIPpgldDSdwMK10hacdSYbhofBrtodUhBrWwSTNx1Q==; 31:WM+2hy55EJ1aAZQfdcLs2nZEgkC/Io6rfXkWtFSsdclBFM3wgaO3TTyFIYONfgMLu1mSC+5MOhiVa/fCjO29lgFKUWWJ+EtqVgYYh5hM1S2bRF4cXl4UnXaXVqRJsXB84OJ4MJwczr7dj+i0+yHIOR0srj/2d9ZOtPsjufFUdZv5VNF6SMuHYuzqO7eJCRXGWPoB570tMLxJqtoPCVB81yPxYNLDDWScVmlQbZNaX1o= X-MS-TrafficTypeDiagnostic: DM2PR12MB0155: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:VlSPDZu1ptpTp1R/A2vnw+PhP6qN+UPERx+ZS9L3fQNvyqek1IAWArBJkgoiFJ6u0ZULIJagXbdHPqYT1q+icgCw0heozQME0tZTNbt61KeNTd8xA16JnkWZV2dVRrwpFDm+B8WzaERC4hwcL1I3oFzMf+Gg3BJpSn1+wmfYau9WT7iUEcPyO7j67FYr7kPyvXAZrlqSTdy3npCQgy0Hfu5o2BUuJ5BnBtcNh+szrWOEF0YUIiqof4pmRwcSP+HpKyg04sU1JMFpI+KBx3JKMXz4rZ+GbSc7R51YPLek3Y5g7ppK5KvVZNz+YFUlZ4NJC7Z7JpU9GWmEnb8UhSFpSHibaJASE5JNMbuytcowTkfrTKtzxQnh0vw4JyyXXgkVdaMoVXPm5DjzEAQ4Xv2DA4XNjN4MIEc7avyU87y/UMr49EXV7RZZg6xho71oJvQC4M96ZTpTlAl8xTqsFhj1k+8R0RkHZIKeJDbHQghtg4VoW3rj/zmsmvW4V5aGQ582; 4:Lek1EOMefvVcM2InDeVWN5oVQ1CJ1zN9mfVVpUXRZAQ52a4xoUt13XcfTdwzt5Dqy2K8kLrKSAw3dtIt0VFFDdk98eRk6PSbncDpJHOwNCU5Ra15NSRNCRQfG3cRtJ2u2rP3ZEm6yKcZSd7ItqR1I+aICLnFTCXvfWIFmUo3gWneUS2A4J1pC1bbLd/shYrEUL78TRF5gVpFxLmKAJ1WXxLj12AYW4JXO8iqQ9wf/bOO59VnjvpDqEq4vP/JMj2KottS9kzKfi+4+L4ZRaRfjwHpBv+cTidckuyuhVLkEvf4Bh0o3lV8CTC/B+93dv9V 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)(8121501046)(5005006)(3231220)(944501219)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0155; X-Forefront-PRVS: 0597911EE1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(39860400002)(39380400002)(396003)(346002)(366004)(376002)(189003)(199004)(6486002)(6116002)(1076002)(2351001)(36756003)(16526019)(54906003)(53416004)(26005)(53936002)(66066001)(186003)(47776003)(59450400001)(2361001)(478600001)(8666007)(316002)(81166006)(50226002)(8676002)(8936002)(386003)(106356001)(2870700001)(97736004)(5660300001)(2950100002)(6666003)(23676004)(305945005)(4326008)(76176011)(7736002)(39060400002)(8656006)(105586002)(68736007)(50466002)(575784001)(7696005)(25786009)(52116002)(3846002)(2906002)(86362001)(81156014)(7416002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0155; 23:R/14je+TPVSF+yFbbbbJXjsuPXVOauuWJgQKA5JPx?= =?us-ascii?Q?x3J046JxfPKn0F586JtBFxRSw1T+4bE9zBUPA9IK42xYWCygzhxnA9UKRm1c?= =?us-ascii?Q?N9fB6qtNxa45QugoGOOQClr5Jb5IXJFjg39hoycMxv6et6TzF+qRnXkj8V9s?= =?us-ascii?Q?vRpYB1KzHrDLo+wHjvOOgch2x+dgZlrutCDTYXzTB0u8/k3toyf35JmsDwX4?= =?us-ascii?Q?i/IaW4yUm43P1PXTX3k+qRLmlUwZ3U5A/Yi4O39sU19uHob4GoXqbwyEIHg0?= =?us-ascii?Q?kAy3DWZ3d1ioaYWk1U+ziRD2O4oocVpMFGTUGL5ksJLrdXUm81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fQ12NNxedOqYFaBa60/IzykRKy9kFRnvOHmw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:KSBzV3Pj1KcQOftqJd7ynlRvGR7a4lj9XfN8YqZ5y2rjJMlFbhsZhuFtjJYTVXqKM6PMyXIWXH2ehtWDpqZXpMKBKdLCBuoDn3AGhHehdzqLjGGyTLxm5DyHBjzSMimSBwrBm2f7zgCho8NWSUmQvR8Tt17yvTt2OG4UyikwC140wUO1OSwnC7/+nOeKl8GVN5i3qThR4S/8muWqvjwkH9Gfbu8LxiB/j3WuCE4+c8hRuVVa5QBM3o6G3jqnFVwN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 21:11:15.0922 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf8b86fc-95d4-4675-43f7-08d57eefcdd8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.47 Subject: [Qemu-devel] [PATCH v10 23/28] qmp: add query-sev-launch-measure command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Brijesh Singh , kvm@vger.kernel.org, "Michael S. Tsirkin" , Stefan Hajnoczi , Alexander Graf , "Edgar E. Iglesias" , Markus Armbruster , Bruce Rogers , Christian Borntraeger , Marcel Apfelbaum , Borislav Petkov , Thomas Lendacky , Eduardo Habkost , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Cornelia Huck , Peter Crosthwaite , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The command can be used by libvirt to retrieve the measurement of SEV guest. This measurement is a signature of the memory contents that was encrypted through the LAUNCH_UPDATE_DATA. Cc: "Daniel P. Berrangé" Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Signed-off-by: Brijesh Singh Reviewed-by: Eric Blake --- monitor.c | 7 +++++++ qapi-schema.json | 29 +++++++++++++++++++++++++++++ target/i386/monitor.c | 17 +++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/monitor.c b/monitor.c index 356d550aaf2d..d0ebd5906d9d 100644 --- a/monitor.c +++ b/monitor.c @@ -984,6 +984,7 @@ static void qmp_unregister_commands_hack(void) #ifndef TARGET_I386 qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection"); qmp_unregister_command(&qmp_commands, "query-sev"); + qmp_unregister_command(&qmp_commands, "query-sev-launch-measure"); #endif #ifndef TARGET_S390X qmp_unregister_command(&qmp_commands, "dump-skeys"); @@ -4164,6 +4165,12 @@ SevInfo *qmp_query_sev(Error **errp) error_setg(errp, QERR_FEATURE_DISABLED, "query-sev"); return NULL; } + +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-launch-measure"); + return NULL; +} #endif #ifndef TARGET_S390X diff --git a/qapi-schema.json b/qapi-schema.json index 467a06460ead..facf2138df6b 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3250,3 +3250,32 @@ # ## { 'command': 'query-sev', 'returns': 'SevInfo' } + +## +# @SevLaunchMeasureInfo: +# +# SEV Guest Launch measurement information +# +# @data: the measurement value encoded in base64 +# +# Since: 2.12 +# +## +{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'} } + +## +# @query-sev-launch-measure: +# +# Query the SEV guest launch information. +# +# Returns: The @SevLaunchMeasureInfo for the guest +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-sev-launch-measure" } +# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } } +# +## +{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' } diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 64d459f80f0c..577d50eebaaa 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -720,3 +720,20 @@ void hmp_info_sev(Monitor *mon, const QDict *qdict) monitor_printf(mon, "SEV is not enabled\n"); } } + +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + char *data; + SevLaunchMeasureInfo *info; + + data = sev_get_launch_measurement(); + if (!data) { + error_setg(errp, "Measurement is not available"); + return NULL; + } + + info = g_malloc0(sizeof(*info)); + info->data = data; + + return info; +}