From patchwork Thu Mar 8 12:48:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10267995 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 D577F6016D for ; Thu, 8 Mar 2018 12:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C55B229905 for ; Thu, 8 Mar 2018 12:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B93D829906; Thu, 8 Mar 2018 12:57:06 +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 2009029907 for ; Thu, 8 Mar 2018 12:57:06 +0000 (UTC) Received: from localhost ([::1]:38499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etv6X-0003SC-7H for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Mar 2018 07:57:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etuzc-0005Be-Pe for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etuzY-0003xB-DM for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:49:56 -0500 Received: from mail-cys01nam02on0040.outbound.protection.outlook.com ([104.47.37.40]:4288 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 1etuzX-0003wA-PY for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:49:52 -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=ZPdB0kPhvRZbmRprteX3rhx9NKO+F1jQaSqHeMoGgbs=; b=okEHMrTKeojFdToiSdFkPapZY+PasL1toUmGFfyGE9z2dm9rKbyciPppXr4oQ/0klTNGrEdNrr/gOjQAuOt1PhnvNqet++KS+SytDLmTNZ9KqufafugRNQ36fRtxEDJA20GQht3y7U+Fu21keRrjhKayFf8LEYqbDZvMcd7/2to= 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:49:45 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Thu, 8 Mar 2018 06:48:42 -0600 Message-ID: <20180308124901.83533-10-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: 07fd7bd6-4fe5-4cb9-7d47-08d584f3132f 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:PSey1LU2VjLub+WDMYpIQIg6z0zdyDLULBui2COlzRelOdigyBIeXReNYTFwndG/5LtBzaKyELcjWzPB2qKBF1OTR1sWJCWJ6Vb++w72OoHCF0uLqi3SbQxdugh3mkNanil/YXW+SOo4yb8iI37nH6ajEOGgYr5ilqUHaVfKPw9ohawILqugu/cZxPEhhidtHjqEudL4yKd+JX35N2oDZEdRFPPMf98oSZCPh7xOU5nlKLcrMqUYg1NyN3pahWa8; 25:s4NpZI211wfONZRLtpyjr+dZnigb1+lDT92gXsyU57gbHh+c23xxed7oYtQuo3CVhl47eBqCEdttvetmQgxgekoGodzvaFf4cYyViuty3RuMiZ/YCGC2WBLsHkMxnF5+C+lDDNDAF+yHHQdEakfePfC+OjEiy3fcdggTGktJ/InAFQ8GFPpL38MjpDR+AqIyiyf/wW834JlkZ3ZP5w7E8nJYS/R4wVGA5i0kgVD8UalDThuc9Bzg1YdQYh2UY4Y4C0IaP6CgJJksl2TTnDvOQtWO183AoHxUGt0GFaRFJhi8RJ67a5ZS6iBM4uOhtEvzRg3IcwkNEnxAibRFEO86Og==; 31:foUH3xsdoMtjl+0rcnRomxJVuoaJK56C2fc9jNbcPyQ/HZYaNWGlVOwsajxxOScokCvj2g2dHDGdyc0AHoJuT6PQ0qKEtDDimRK6xPe8PM7HWbaigvOkYW3fUKKybZkVDC1GWfISQ40bMyPjkDSU6JlDUPgtgDGnMzqeJz1w6P5/ne+gvn0Guw+8tOibTBEcoHRAkbDLyoL+YpurHYhbTI0lLOSRTvgPb6tZ+ecIlOM= X-MS-TrafficTypeDiagnostic: DM2PR12MB0156: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:s0E5TN6HiaXp3JQ7dmSBFvZm/X+Wz3wX0uXART6u0T52+7Xg2+Heo1EkCETAvKe9FSg9jFFmeb1DzVLRYPXQ6M0SJ59E1g4W3BLkjocoupEDOF5uGQlQqekV0k13EqJjBCAs4SngxDMKdi9H6pq8yLsTgGnh7uazTkMNr5xL/fVzIB1pio3F8d9QqogEZFbc16X9zN/lgUq5TA+cs3xWT6FPXtDInTfDvbFajf3weOOKtSsOVGFKyBfSul0/HOJ6NJwCVXT2aWmPyXtaf+ImqB4DF26UJTK0jyV9Eo6WNlXU9W2cOiKIecK1h9TAAaYsitEe1x/0jKEooet5uGYkQUf3NbIPCUoNa5cPXwLYNyFpyf2hwCge193gTz4UpTHB0Qhbd7Lq/XTOAGPxIu6S6t6fEg7BKlseS7P/yNNXPvuWTKTRv27k74zZzCBe+SFSi9yuxY8bwonQLupWlAqbCewCxMvCNSkiNLIan60d8fsi1MYiVFr11KxsN+Xm/g8w; 4:2Nid85rUEs/ShY4W+dn3mru6FJ+fxMNfh0Sit/mUeXOpfHhGo7gWmhk/xf0GFRIO5YIbpO013CEMq1VZOY1w6DBY8BYZcEiygPNTQbT68UG0i1w7YNfbhD+DbeZ8d2Rum9RTa1BU5BPwy1McfHWP4zLrUJD3qUcyhaRdXVG4ID1W0SHRm+xtq/jLgXqJySWOnoL+4EX2RoC8KVisirtoL52TferOk/936Ux8kTminHSxR80H9/WcY2aXMtFYYV0yLRqDx1OWJQy1hllPBApF647Fw1l+1MJvYanJVKG6UKVs6DIt+GtUHPLD5yPZTO88 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)(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)(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:G1hSQjAPt85ixbZyaxB7ZgToP4kYItpCXVxE7xBvj?= =?us-ascii?Q?aggJzuNjw6RCXweFFLwsbg8lbExoyiB4RHrqrRPY4BGKGJFZlvnW5ksuB18g?= =?us-ascii?Q?D9wmcZ9jP9IZ74TW1BkfWQyXBiWG69nsoMmtbaqoghoe258h2mVFRvIUxHzd?= =?us-ascii?Q?TXMyX1hFII7bZKbm0oLjoucJp5BoMprmlDi/gjrLt5Ef8OTi59Rr6FY7WIHq?= =?us-ascii?Q?L9peecRmW/QrVpQTO+cEH9rJrD8xXk7DgNq8urRN44WfrW9zmTSSdTpkO4bT?= =?us-ascii?Q?oJJ/sBYyh9XC7lYZ7m+phDPqgeh7WdT0lNXNF6Hsl7fe0XQ95ZvQleFJUBiS?= =?us-ascii?Q?9oQe9s/3UIYKt+1/e0SSMNLq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BQjU4KZqG+Wu0lTUf52HPRykBU2QMT5UXPlo0z03tfe6iiDGfjviDeehIhZYseHx7eglWcdbWSWmoo4ybTn7OGht4gwwPzT+RSIEW7Bm/VO/WE0YA8LXoCMes+6lZdOX8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:7AjlPj9lfxR81OFM4Gbt2GcZEnTSYVUXzGbzYiCXDil6v8Ye23d5lDkxSov6q7to7XL6ahPjb53TJ3hMUzm3VWL/weKQN2omWvYh7EecF67sY0hP4t0rsERo7mxEawUKXyx+hm0P1hcS7aPW1GVsFJGWY/zWY1i/MZRIxoNoF2kYdwLznwlLYH6Yy1femc8/4RyYUbstMmk9LVWVZ5GuzuHS6uVy78sTSJ8R0hAiyozii28esPqianXVV5B/X6o0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 12:49:45.3935 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07fd7bd6-4fe5-4cb9-7d47-08d584f3132f 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.40 Subject: [Qemu-devel] [PATCH v12 09/28] qmp: add query-sev 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 QMP query command can used to retrieve the SEV information when memory encryption is enabled on AMD platform. Cc: Eric Blake 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 | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ target/i386/monitor.c | 8 ++++++ 3 files changed, 91 insertions(+) diff --git a/monitor.c b/monitor.c index 3f4ba902266b..2225cf5030dc 100644 --- a/monitor.c +++ b/monitor.c @@ -983,6 +983,7 @@ static void qmp_unregister_commands_hack(void) #endif #ifndef TARGET_I386 qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection"); + qmp_unregister_command(&qmp_commands, "query-sev"); #endif #ifndef TARGET_S390X qmp_unregister_command(&qmp_commands, "dump-skeys"); @@ -4103,6 +4104,12 @@ void qmp_rtc_reset_reinjection(Error **errp) { error_setg(errp, QERR_FEATURE_DISABLED, "rtc-reset-reinjection"); } + +SevInfo *qmp_query_sev(Error **errp) +{ + error_setg(errp, QERR_FEATURE_DISABLED, "query-sev"); + return NULL; +} #endif #ifndef TARGET_S390X diff --git a/qapi/misc.json b/qapi/misc.json index bd04469a4ba2..14681729f8fc 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3201,3 +3201,79 @@ # Since: 2.9 ## { 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' } + + +## +# @SevState: +# +# An enumeration of SEV state information used during @query-sev. +# +# @uninit: The guest is uninitialized. +# +# @lupdate: The guest is currently being launched and plaintext and +# reigster state is being imported. +# +# @lsecret: The guest is currently being launched and ciphertext data +# are being imported. +# +# @running: The guest is fully launched or migrated in. +# +# @supdate: The guest is currently being migrated out to another machine. +# +# @rupdate: The guest is currently being migrated from another machine. +# +# Since: 2.12 +## +{ 'enum': 'SevState', + 'data': ['uninit', 'lupdate', 'lsecret', 'running', 'supdate', 'rupdate' ] } + +## +# @SevInfo: +# +# Information about Secure Encrypted Virtualization (SEV) support +# +# @enabled: true if SEV is active +# +# @api-major: SEV API major version +# +# @api-minor: SEV API minor version +# +# @build-id: SEV FW build id +# +# @policy: SEV policy value +# +# @state: SEV guest state +# +# @handle: SEV firmware handle +# +# Since: 2.12 +## +{ 'struct': 'SevInfo', + 'data': { 'enabled': 'bool', + 'api-major': 'uint8', + 'api-minor' : 'uint8', + 'build-id' : 'uint8', + 'policy' : 'uint32', + 'state' : 'SevState', + 'handle' : 'uint32' + } +} + +## +# @query-sev: +# +# Returns information about SEV +# +# Returns: @SevInfo +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-sev" } +# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0, +# "build-id" : 0, "policy" : 0, "state" : "running", +# "handle" : 1 } } +# +## +{ 'command': 'query-sev', 'returns': 'SevInfo' } diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 55ea10deb8ef..27b99adf395b 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -30,6 +30,8 @@ #include "hw/i386/pc.h" #include "sysemu/kvm.h" #include "hmp.h" +#include "sev_i386.h" +#include "qapi/qapi-commands-misc.h" static void print_pte(Monitor *mon, CPUArchState *env, hwaddr addr, @@ -665,3 +667,9 @@ void hmp_info_io_apic(Monitor *mon, const QDict *qdict) ioapic_dump_state(mon, qdict); } } + +SevInfo *qmp_query_sev(Error **errp) +{ + error_setg(errp, "SEV feature is not available"); + return NULL; +}