From patchwork Thu Mar 8 12:48:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10268057 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 4F77B60211 for ; Thu, 8 Mar 2018 13:19:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36542298B9 for ; Thu, 8 Mar 2018 13:19:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2890829905; Thu, 8 Mar 2018 13:19:43 +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 6263E298B9 for ; Thu, 8 Mar 2018 13:19:42 +0000 (UTC) Received: from localhost ([::1]:38773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etvSP-0006eJ-LC for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Mar 2018 08:19:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etv09-0005gk-Q7 for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etv05-0004Ko-LI for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:29 -0500 Received: from mail-cys01nam02on0085.outbound.protection.outlook.com ([104.47.37.85]:63040 helo=NAM02-CY1-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 1etv05-0004KP-9c for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:25 -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=/pwiFzm9XLlAcYuv79istr6t1tp11+uEJEkKvsJE90Q=; b=WtYlTA+OD+W0H3uwFLXQ5nHd4mANlF7lOmTk5cAajnC8+xf1gnTdGB5S0FX3uH+pHHSk4fy6wrW8hz/EjBW+1vWEVoWWdKROxj14JK6w+zYjIPuoKyFcgxfl+D5UIVElhy7YzU9PwROtrN0thZ0a8dgI3dyaTMLS5202+7uAK44= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; 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 12:50:20 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Thu, 8 Mar 2018 06:48:56 -0600 Message-ID: <20180308124901.83533-24-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180308124901.83533-1-brijesh.singh@amd.com> References: <20180308124901.83533-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR14CA0031.namprd14.prod.outlook.com (2603:10b6:404:13f::17) 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: f6939de4-daaa-4987-32a8-08d584f327c2 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:ObgucBGkPvDT56juNudUU4Rrza9uP1M+ZiUMkf+6LCPjVCMR35stIFWHlaExsp3HT90aWb33K7Sz4Sxs22EQyCvyszq7+EV7MIs/RU/zi/EdESnEr0khgBUiAbYHQ8M4kSQQ/5tt71EKi89TqMDzBClqFL8fVWtvbgrqEqmaDzovRMNO4NhqvWKgERRG8NdP7ZWVzaomlZuS0VO81F1cgANT/Yxt+XV+km7cjhz+yznLKLshokjLH4Zb2R2pCYMc; 25:QgO1fDOouIdnFI4m6iYvFVl8DIT2vPfgt4xuaxv2oWbeilaQKyqc4paI6eaI1FcJVMzbjFhKSSWFd5XfOwGJLuemNdjEU07gs3QOwKv8Wpc1yXCSE6TA+OrQxSctzkeeM8i6SoCQ2yVDWgF4L+aKZh2kjbzP+M3CzycO84kCqAheCOsBxewHyvlrwz/k2OYQDEQZycPfdGk/mSyYaz4qeQEASEk2nOgUETFYVAU1QLgtqJ8gXoDICzI7oIKpGU6R4hETTxdeHtemYHWifEZ314wkGCDL1iLmsj+HK1nhvnZQovryiWbKu80hejqj9tbbk0+B5tl/8kn/zzxm5dsY9Q==; 31:OzcDdOfeXk7g/izKmveu34+0EFh9dh9z/JQeg+CfqCkQq+bVvlAB5e+M4NqmuuoWd8jqtat/7DVPL47HJWHBknHPou1GXujH6Fc8RwBIlPxXYBuX6+jq5BGEY0D8WTNrCwgAm+KpwJzRKhX3EOS5iISLjcADzq1zczg6J5McnbCvTicHeQmHIKVkyqo1/+keCx9W9W49HIue5mH2mbaXskWTyef0vvmil60IPGIfbnQ= X-MS-TrafficTypeDiagnostic: DM2PR12MB0156: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:8mCH1pYbYTpW1I/+8Fqb4B8ZH6HzO/4gS9VhpbL/NtQWfPQ0xZf17ce6sfoTvfX250LutSq0tQ2WxkFffk9jQZgzkHw2xdyGKiRDoEAu4PqO197aDHhj03f52ZN6sjblL1hmosNEayN5cvPRQzEqSJt51QFjL3MBCdbcoxYWsQdzJupOHHMl5KDOSidd/c271rZRIyHYM7fQ65zUHFDNJqGY3clOoBi5Z1w4R0DBy4nmwBpkvph2xGs/Fsvid5UX0qjx63DGQzL3OwLRkYxtL0iqm7XtiqomOu69O2T55YA+jmkKIvCiNGYGchojFvRNTqIarB2dAO2eh6XTVL45vXcxUKCZxqf0x4XCq1Y5PtkyS+WWJ5VEkpZZKhnAmiKMC59XaPlfaFFsvjVmJ2ohSWR6HcjcBr9piSZwf+RRe9FFisGplLIUea+HptRhRVU7JJbfSBw5oA33hgttg4BTDdSBrMwCwwIo4LavTRcv8cVDSy5UHWcqG7WkrVgkV8Si; 4:4AOXnXuGjU2thOSyNs5tlPrEvDdtHl1D/14i+32NIPJXGdcgdJmeBkOTkx294awAnkPZHLlonrj4RurC/nOMMIUJp3EfGskQiH9b6c7KTzLiqk1cGpqFSaJoaDvyh4GRXnMjaDMMAduUIKpTX7EGaZc1vwy9NjUvpeTH5zQTnr3SKkDlx8L0nmll0ObqqmfIm1OOZzNQuoRS+CRihadFU00vj1D4h5i13VHVdGLXqGfFaUhExVIkG0n/BnDVXeE9ZKVBPcOc9DhoFHqFdte/zfkVRijSYANtm9Wtn5TwToHAK/nb+sBnfMoviZRWIFnx 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)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(3002001)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0156; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(39380400002)(39860400002)(376002)(396003)(346002)(366004)(199004)(189003)(50226002)(53936002)(2950100002)(6916009)(2906002)(2361001)(6666003)(2351001)(106356001)(81156014)(2870700001)(53416004)(8676002)(81166006)(7736002)(36756003)(305945005)(8936002)(105586002)(50466002)(68736007)(97736004)(47776003)(66066001)(25786009)(4326008)(39060400002)(6486002)(7416002)(5660300001)(3846002)(478600001)(76176011)(7696005)(52116002)(6116002)(16526019)(186003)(26005)(1076002)(8656006)(386003)(23676004)(54906003)(86362001)(575784001)(316002)(59450400001)(8666007); 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: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0156; 23:yMLFFSFU82wppGr8QC69zZqhTXYFwwcr+MgqYnnHs?= =?us-ascii?Q?O9+9cRcSW0Iw1cOw1YEiY/iAsO1AIXJoC0i6j4NHVQCRGBDuqElmknlZ/lLp?= =?us-ascii?Q?6ohPA/RfjxiuKyHrUG2bhuc5dTT/18xsbFgyy2smFh3EZpXyj91vLW9v7Ltc?= =?us-ascii?Q?MftbPKUUghvzMYgEZQJ5oiMTWiVYXQFwOglP5UeLFRYiS1ildxMkbPFSuY7J?= =?us-ascii?Q?g/PMuJyZ149NWDQ+LSs7wbqLxqNsFtvJggbRAd37viS2xsxv1ynQkl1HcAzp?= =?us-ascii?Q?Dwhax1m6pwC7k4Rf/tU6OEjSt7rjfROgvFNsxApZuQDqJbdVIxmCn+AcLXl4?= =?us-ascii?Q?MJcatkMHV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plyTD+3GdX5VRQ/JxGIZc9oRgVru/97IigbUO5cRlFt74vUWMggKYc/Evnm7nXxrqyZARTAoib4C26NNXWv/MpHUlq6zl8MgPwm0SK1kc/TTe4YmTsQtEQ9ZFyZ2aHcyjp3lwSy96MSf66vWZZBcLzpM75bLNPvU1u1Q4w/QqF+VVcjVw6XtaqLJd6jluQ6/1nwXT1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:aHs3CWKxw1uGUG7VUygca+pAl8HNHCqJW7Kn7gYNuVyTAhP2IOIrA3UgZKqJnwTLY8I43kOY+LkDAjD7qTBYa3kc9QLpRJcfRMslVFQa2s0IUzU9zyvwHdNOk8RQ/7eElHQ/pXTVjSwH/uSHU6bwZke542z/mb/jbjMGVxSl+FdGGdyOTD2gwYUs13YAKkibmjJgslIE9pozV3YohDksJqmHAsklAbMiGBPaHsv4CImXa3eBZHu+my1T0ZHilxVZ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 12:50:20.0969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6939de4-daaa-4987-32a8-08d584f327c2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.85 Subject: [Qemu-devel] [PATCH v12 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 Reviewed-by: Eric Blake Signed-off-by: Brijesh Singh Reviewed-by: Daniel P. Berrangé --- monitor.c | 7 +++++++ qapi/misc.json | 29 +++++++++++++++++++++++++++++ target/i386/monitor.c | 17 +++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/monitor.c b/monitor.c index 2225cf5030dc..d53ecc5ddab3 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"); @@ -4110,6 +4111,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/misc.json b/qapi/misc.json index 14681729f8fc..a39c43aa64b1 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3277,3 +3277,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 7df31c3cdf1b..e5596bbc0fc2 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; +}