From patchwork Wed Mar 7 16:50:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10264535 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 0E3A8602BD for ; Wed, 7 Mar 2018 17:07:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF25E294FC for ; Wed, 7 Mar 2018 17:07:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2C1D29530; Wed, 7 Mar 2018 17:07:11 +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 42478294FC for ; Wed, 7 Mar 2018 17:07:10 +0000 (UTC) Received: from localhost ([::1]:34431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etcWz-0003wJ-Ty for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Mar 2018 12:07:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etcHr-0004v6-W8 for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etcHn-0008Qz-NF for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:32 -0500 Received: from mail-bl2nam02on0056.outbound.protection.outlook.com ([104.47.38.56]:46551 helo=NAM02-BL2-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 1etcHn-0008QI-H7 for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:27 -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=3qGm+TWq/Kf/nWg0iN9IPswmQCboh7oypN5pCnKrcRQ=; b=YeYX4onZOL+PIhbcivPT0BvC0kauPVp0tPeJq/bUH0zPOzzgiaxK0IYUb8CKLOxjHbqeC/g0c2M5tw8dGImgdl9CIvUusLvS4dvt54RtxJybpvLDx2FLKWACDU3j6mGapqdg/Rprht0+mz/pCSUfbCofzYpVtALNfzWBjGljHwg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by SN1PR12MB0158.namprd12.prod.outlook.com (2a01:111:e400:5144::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Wed, 7 Mar 2018 16:51:23 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 7 Mar 2018 10:50:33 -0600 Message-ID: <20180307165038.88640-24-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180307165038.88640-1-brijesh.singh@amd.com> References: <20180307165038.88640-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0501CA0095.namprd05.prod.outlook.com (2603:10b6:803:22::33) To SN1PR12MB0158.namprd12.prod.outlook.com (2a01:111:e400:5144::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5bf68903-a39c-43bf-3afc-08d5844ba99b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:DCOvj9rWif1c7Km6WZzw7KmPK4Kx0A/APvzeYO+caPb+gBGdz2rOnVaVlsnI4XNfT1SQ/eShFhknSOyM4iW8c6kTj0TAk8ivTrgHtoxje2YJWhYzQ807xG5cs9kKORluuZkWpQ0TWnx7pBp5v+I6M/nlHqPVkgLLo/CSvWKAHL41mzt3BDES034CHOPS/JD5Vc/P25od0BG45VEGvYuf+FnxfEw93i/OJninI+y/cOWbOlOZhw6pQZRWBJ0Lw+Y2; 25:71/Cqqif65u0OacgwaOdNFdFAG9MuQuKCa9Zqs7b31EBg8nX8LxFaOZ1v/tbl3KqFJcGP+NsfuhrA+VL3zUWd45anM06odjiD8chHS9DrmlBJ9PbXVGJ2Nin+Ebxg4bV7beC8MEq/FrIK5ieJW0jy96fSFlfPLeomw61kILxQ/scRBWFKrW2ImNnGXfy3M0quZeA5+vufW3vYsYTviRlGRFF1GDhBItm2qTu/nMmQ/JymPZbO1lX4GKaJJ9+p6BbeoTITrvdZ2aQU8/zX+fBW912/rHfUSgWOJ3b62oAUbsI6uS21WAFaS0oi5o+NynHR5e7ADVoQlSuvh2vYM4AOw==; 31:qHPLFyBZIdCkjP99iyfig0bx2F8YcR/+thGT22emttY/XafXYhkwTJjJ5Rc/dAMg9yFTsTYpnVE6TpFjjOfkQoDWz93VxSVqAiH9ffNgzEYSC0ssi9fdTkz516geS1EthT+i9+ilDTkbX925IRnYtELSaNsm5INyU9OzSwWZ7i2NORMP+55HITP+DVhqQSX4Xyz6iGlutTPPxaEw0+m6/j30JTVATnUVgGY3cwL+l9g= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:z0Y/8mwrRkSMr5NStW5Hj7236JNrYJI64f+e/ZPyA8+2zNS0DMWsMn2Y2kEYFo/Q1xCuEAXwizWgJhoXRWbBdo7ZF105bMqarIRn+kd1bOOQ6Zs/4ftnNsxV3yYpfxsIJYco4yjhA/J0RhvwGpP2OXqM8wE8+gzbIna3cZMy2ksNT/t15++bd3RGfRbr/1gc18QaYlt24iwevfBXDKSZwM3lkib6VD2DjfHufEBGnPFJ9jGvgOT3kjblu+UrNU3v2Mz0vsN6JOwAZP4/rvK06D4y9XEAVn8IfZbqS2yRyt0Ax6f3ZE345xw+g7pCQQICjh1+Xlo4qWNUhXPlIdeecQjiaSA5BjBgcwV0jGllIe1lSJVzimgZ3I5G/CW+V3qioBsLCZiET9+X0ubWNw8ZFv2JezCibftoC3TCFLJI5TCBW9CnfIPD9NkCjtzo1tDwxzFbDit6OU/7GNodF2ct6wWoK6CwlzVxe5llZ+/i98o3rhPfw4RpQSXECkKru3Gj; 4:usFLaGOOKaqRCb9S8bmhrKlWSSMNI+crGbDlkgni1yXcSdl7u5B3URuuAgzJVJ434e9W7ZMzmhHjee9g9BnRbkip6ZDD6zI/TYOFveUuhH3RXtLnYoizdiRSFOnMac+KG4IFdjksOPe1qN19mRYqdCfZiQ2OxX7/8rSJansQf+nIbIx0Y6nH4u41oBEI1byuY0y3vgjONjKO24jXkC0GFmqg44tn3p+fRO6dqai2J635fMaAAT8lijJy+dIf5lWVCrmrrQjRQYeYhRwZS67BJ2eyOIO4rl5laznAJcsinOegU+xRxKCMAWgpmvnQOb8l 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)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0158; X-Forefront-PRVS: 0604AFA86B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(39380400002)(39860400002)(376002)(346002)(396003)(366004)(189003)(199004)(53936002)(8666007)(2950100002)(6486002)(6666003)(6916009)(53416004)(3846002)(1076002)(6116002)(4326008)(54906003)(8656006)(2906002)(2870700001)(25786009)(59450400001)(386003)(68736007)(478600001)(50466002)(105586002)(2361001)(2351001)(575784001)(86362001)(66066001)(106356001)(47776003)(186003)(16526019)(76176011)(52116002)(23676004)(7696005)(26005)(316002)(50226002)(8936002)(8676002)(81156014)(81166006)(36756003)(7416002)(97736004)(305945005)(7736002)(39060400002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; 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; SN1PR12MB0158; 23:MqmPY2hs+UiwM8l+MOiA5aLSM2s6cKrbxRmRU633U?= =?us-ascii?Q?Ed0x3hGVURPoDPfdnb4tYRtmhHax6qUPmvke9ELjtyj2q9NpW6wUHlW7LHJ0?= =?us-ascii?Q?1LC3lp0YEaIJT/cC7tNRFP7PgHvFCAyUD6X5fSw3zOShodZoRkTGLamSAewe?= =?us-ascii?Q?8DDEhCSMXbXFYu19OBdAIOl86zt3ayDK1/TMlYMsyP+CbsA/XWMfBeGEy4XD?= =?us-ascii?Q?atbwvWIOLhTkMQmil9YSHGa4RVuyPJ4w3/S/G6VLn41kvVH3S2/BA+NPLXu2?= =?us-ascii?Q?stM0KJ1U6tcsSF8KhmBrnb8uPAeFba96P7TbqP3obiNx8dJbvuFnka/ZcCuq?= =?us-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hBD9zLuHylR2aKtJxSh51YaizNF9R6?= =?us-ascii?Q?GlT8QADfKkXzIzuk98XieOgW9QzFuxnCpkmx3jl3nv2X8NuMpqiYqXKNpcMF?= =?us-ascii?Q?k4mTRIKPPJiFMlNJ9ANJvA=3D?= X-Microsoft-Antispam-Message-Info: Vt4pMvJUOGMtxQC0p2PNBMAdqQholQqw4+IYz1BjhSCwWqpLsq9hDJywsi9IB0eCt1fV04ywEKuPOQKXveTvvzzPEXkykitLyGngjoBo5xPgnyI/BzzOUdzNozeX3442k1ywKuHLs5pTQJVJQv6NVHR8jN7mIilY56OhjVKGUyAgjgE9smoI4yBd9OH1ZfBM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 6:Cuf4g/7mqOgBPxgUDrtbQNNbDadOY89IIjkWiW6XOd6M3/tE69EBmKX+lEJxq673eCYQkYUrFtzJ0mCUbOlYuhaI+tZAZeN6vkVLzI5Op0WBE/bF9TD9UH6e2zHNeVpInEve0YZcN6cqkUvTPD5n3aDw+y+7bJKnpHS5fllUsivWIXs4CJluANpvvEaJY4T9xWG7jSfoaewsSCJQMXOPwMBquxb30mw2s/u3lLks0QdzCx7hj124j9SDyxv0KlcaN/aG1OBolRo7K2on3emg1hLtKnrtp7XKNMBatcFva2bEWxvtyDfxjUnvxnHjme0GdYKoDSbKtQhQ6vzaQocZiUEutXpNP5vrw8liob9epJ0=; 5:yxaHaNtg3f51z66r31evwZxKHw+gPhTWP84Zt8NgfNrn98pScgejmeaD9UamTeICWG1JWetDGAF2y6UGxYC1FzUj+cHZsSvHxBnksDht/rinap/HDrVQ+u2bKuyBXlpvhegCBokDy4BGLYntsVac+HdX976t8q/K7E+01Czclrg=; 24:3UFRqjV9atQCId2eu3oid0rZUWctQVt/HKIG1rZSjKlpszpujYkl/N6ZgbKg6boq/WSW6okN00uvbbkIUPj8/o9anwwZnpzkTJzUnSKhZNk=; 7:yUliIMHdZGE+a6n/TPJb7e2Ut5eNd+BeHPJVi0a/bKTz8kiWtogdStOdpCF57IMAUGW89nYwW4j5gUhiEVh6LYtWCyilIgspD+P/8SlCooxx7I9Qc/dtKkx+O45meDe3EUnUZU6YhIeeeL32aBasQtjZF/aqRpywx/3r/Cq8IMxuO8+B8pXXdJ5u7V5qJVVLmYpTIHuzaPDH6YcR36wjjlR4YnNdd3XHQxA3CHOAzVdk92X4Vatbic8qeMUCSeFq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:lWPbXk53T9VLuT3+sKJ2RIjrrqPBJnc5qn7yU7qmzoos6R3LMfRMUOeOfcJ0ZFmtk8reOslApos/Vhtsidl/GKezN5o2D92NL657MMJv6Spg7fANmjYdPu5Lu5lr4jJO5ZhSGQkyl7cTRHxVWUFKIyBD1xgNikhpZuwtmG9FPhQpbFNXTPiusW2U6FVIafg+e8Chy8y6bgZvITBWIa2L4pS05vvYbe+mI7JtO3tJyFwEb3g1waZ3oHIEVKdW4SJg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2018 16:51:23.9167 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5bf68903-a39c-43bf-3afc-08d5844ba99b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.56 Subject: [Qemu-devel] [PATCH v11 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 --- 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 fcf3bfc66a15..66c8229ec406 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3275,3 +3275,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; +}