From patchwork Wed Feb 7 16:06:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10205581 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 C7EEB6020F for ; Wed, 7 Feb 2018 16:17:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2A0228FE0 for ; Wed, 7 Feb 2018 16:17:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A66AE29029; Wed, 7 Feb 2018 16:17:19 +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 0006E28FE0 for ; Wed, 7 Feb 2018 16:17:18 +0000 (UTC) Received: from localhost ([::1]:55935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejSPO-0006aT-5B for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Feb 2018 11:17:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejSFo-0005y7-GF for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejSFk-0006vj-Gz for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:24 -0500 Received: from mail-bl2nam02on0041.outbound.protection.outlook.com ([104.47.38.41]:22992 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 1ejSFk-0006vQ-AY for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:20 -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=kNqhm/4h4hpYOzdM+YNKVF71uiw+nE06eOHBsQMOREo=; b=zTgIU/zmnqdQKYPX4xn9MyTZoN+CbLxf/aQUgb3c2A6ed03IsJ77fCnw3AntagDiWzwc9a70Fwb+8IaVNwSaC0LGddko/WXHLeWxPK0Wnb6v98CFkuwZoXODLWqmkEr0NtBzgFtqDsvQEtoj2TURZR6we1oBmyhNJvfJwc7/m+Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by CY1PR12MB0152.namprd12.prod.outlook.com (10.161.173.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Wed, 7 Feb 2018 16:07:17 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 7 Feb 2018 10:06:25 -0600 Message-ID: <20180207160638.98872-13-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180207160638.98872-1-brijesh.singh@amd.com> References: <20180207160638.98872-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0071.namprd12.prod.outlook.com (10.161.151.143) To CY1PR12MB0152.namprd12.prod.outlook.com (10.161.173.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7271deb7-ff20-4154-9bca-08d56e44dcf9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:CY1PR12MB0152; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0152; 3:nUqd/9k+5LdkUNfYFXAnYRi2UonqkFE0lAxp9oWC0JbLGz5mDQXZ4t0JamPILb+sS81XfddAuPqYHEY0icYBVjpIEP/3IaQu9AORg4quFc4+/zp00DIwm2snugnoqTsEh68EF1jL2ufyKSXnJ8DD52xVSqiH11QfQnuAEo0ZIN3ED0ePhgVBvzg0econdqjwOAxwLPSG0/dwUx0syBXegG81XiqhxEvW2CGnYa4D2FDo/XH9SO7ETr7QO1p547n7; 25:lumOcp9Nb2JMNBmCKB/STUQPABSFceO10roYKjRd/W2w4vVEQxwSu3GFOebKnM/okbhN3g6avdZOVnD9zKigFQ30wwMDxrfenQHFUmcsH/vYjM4hDkukK0+YKGSQoprXuqvEkogxOsMRFo8Fym/Sfr5n2a4LOR/8wQdfsF7BsxUtYKh5NyoyYeDYqxQp9poK9GWPUK0jenSmD5cEOA9l4ThPx3IdyLoqQbC/KfuhLG0fUO5LD+RQjcox1s6UlcKU5Jk81SN6TBZ9j453OrxTaWOhYVdw/piSInOI5eW5d6FKziEbnOmFZ0fPFQ6/PmEqazfgRz0hBYQiljxkTZgbJw==; 31:AVHmmLj/VfvLKBIKghkVKtrMD023rE2UCeXC1cB6ONL/uZ28j5YXZFM60AVaHd/YqJBEpL7VDyJE2WUuovf4GixAApGhcKGXtiG2rJnRXcnJcvp90ZNRYGyfXFCMOMAuHS9x/leDoMMJ+D1D5WokGMN0EM4pkbdgSuztoJo9JHSx/l0bF7CcId1gDBDCa6HJ6Y/X6vHkfYi53RPjLYdmU5OsEx87I9P7N2lhngTsUPg= X-MS-TrafficTypeDiagnostic: CY1PR12MB0152: X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0152; 20:5JKTor781uzcEuGIjFtoZU1p09Ica2+XQvMTB++NLvdlAqK97iezf0drBG9TT8SSwxJEZoeDU6gibjKY7pS5dbAtlIdP7Jc5pAOm8pILrSW1GejQrj1BvWL+oU3EFdBo2T5dzsn2gIx3S3QYPThphzLHbQFVQ8922wBWJeXft6VYEd7JYDI2cq6k57JcLKhwLzv0uEW92laFXRPOlRyd3zxJ+o6FGb/2YtVnZ+O6hLvB5c00LU8NA/GbpcYj+mXd8c/+fBPNmviCrZ0Plf8IntQT3lnAkGAzKMRbp/JHyji2X/glJUykq8yLztv35F2oUt/I2pTJudnOGjN1L4dQhw/LjEy9omcH0XuBGn/WyJAbTT2p3iHrjcrT8EAto5I4kRqpCh9YkEoOZOnX52BisXVZoNiji8xWKDMme9LI5LB8BxflGyz7j5Y9kYuSZ6FBHXAgNgRnL//OBAYqj86D1PXFVjoIyxu7LdOA15vLfbmElCFyYWZHIarVPPYM+Z+Z; 4:KEMu9JKWBnfcSgg/sSBQxKpTLyfwUNSaIOlsd/hDe40vz65pL1ZyfAJu2jHYK5Fj4p+F0Vs2uHEJIePUBCUhA4D83EnWaCUAnFYVfJ8615xPhO8BmjfvomOZCvJWR1T9WOjVHfIr+E09+IAtP6oi28ld5Mgtqcp0RrNAWT7ucFor9gxNlRsoUEhwdcrgNmq1Ub8JFV1yxD7nqNvK9Zu8d1D8cUCBoMR/otrrcBc9LcANTLK/spbAAtHg4G2PYPyBeP/5iLMgbvmwuO4G6L1r9pCdE4mY9i6GtmBvinrWtJdtzd6gsGqcJXwXLCoQeXYB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231101)(2400082)(944501161)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:CY1PR12MB0152; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0152; X-Forefront-PRVS: 0576145E86 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(39860400002)(366004)(39380400002)(346002)(396003)(376002)(199004)(189003)(50226002)(68736007)(8666007)(6916009)(7696005)(16526019)(1076002)(50466002)(6486002)(53416004)(7736002)(575784001)(305945005)(53936002)(8656006)(8936002)(8676002)(7416002)(86362001)(4326008)(81156014)(81166006)(52116002)(6666003)(2950100002)(478600001)(23676004)(2351001)(66066001)(2906002)(54906003)(5660300001)(106356001)(2361001)(47776003)(105586002)(3846002)(6116002)(36756003)(386003)(316002)(39060400002)(26005)(97736004)(186003)(2870700001)(76176011)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0152; 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; CY1PR12MB0152; 23:K5fG6dW7VetneY/D45RCi5u1ozqyzJhtcFeTKYOFI?= =?us-ascii?Q?C+QT8tNBRG41v/m+pe2dSeQN+G5OxrFYOoT31feZqB7fAknO02WwzjMxneTS?= =?us-ascii?Q?rlu7gNXLt+RkHjrkAg9MPsbzfqhabdGMgS/z+trsJ/Q+iwdNzaEmfB4FDx98?= =?us-ascii?Q?le1Hy8qOYnSpQiZkzJezlveqMSLRcitTiVaGjIW2TXZhUGIE/cx5vq3RS0ka?= =?us-ascii?Q?AaEWvQy+5inNr11GKMgL+kZrFyNCtWimpliQ38V4FMwk6YMaDXAEe7fx+geu?= =?us-ascii?Q?SxSWvGmqNW0+V6M2tfMYiX7e2AhGKyNFJrew2IofBYz2LebcVY7EcKR89vpd?= =?us-ascii?Q?/SH4cWncLj8TUZhNcreZtW53r9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-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0152; 20:A1/v12Xn2MwzfGz0xmCs2b/0yX6kpJhfRCzsjdKuv6Z/WpsK1pRxHoJ+CCP4K6eLQVByaRVMVMGzxbyAfdxMEf710aUAOxISE2/GjqHHoLo95AAoOw0DzKlPAqdZyieL6HvXDuzzpXOVh8KANRMXIyWoUvDnFF4KYOKN3hzPvO2rLtlJznu8irbpkN8NIVM/UtjKTipTCI0ToEyv/c2g61v90L4ViJ6OvYg8sv7f2cWmMLGBO0gaze4m2fHs5hZv X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2018 16:07:17.7595 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7271deb7-ff20-4154-9bca-08d56e44dcf9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0152 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.41 Subject: [Qemu-devel] [PATCH v7 13/26] 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: "Edgar E. Iglesias" , Peter Maydell , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcel Apfelbaum , Markus Armbruster , Peter Crosthwaite , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Christian Borntraeger , Brijesh Singh , Stefan Hajnoczi , Cornelia Huck , Paolo Bonzini , Thomas Lendacky , Borislav Petkov 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: "Daniel P. Berrangé" Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Signed-off-by: Brijesh Singh --- qapi-schema.json | 47 +++++++++++++++++++++++++++++++++++++++++++++++ qmp.c | 16 ++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/qapi-schema.json b/qapi-schema.json index 5c06745c7927..447ebb15266e 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3189,3 +3189,50 @@ # Since: 2.11 ## { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} } + +## +# @SevInfo: +# +# Information about 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 +# +# Since: 2.12 +## +{ 'struct': 'SevInfo', + 'data': { 'enabled': 'bool', + 'api_major': 'uint8', + 'api_minor' : 'uint8', + 'build_id' : 'uint8', + 'policy' : 'uint32', + 'state' : 'str' + } +} + +## +# @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" } } +# +## +{ 'command': 'query-sev', 'returns': 'SevInfo' } diff --git a/qmp.c b/qmp.c index 52cfd2d81c0f..1a5cfad09dd0 100644 --- a/qmp.c +++ b/qmp.c @@ -37,6 +37,7 @@ #include "qom/object_interfaces.h" #include "hw/mem/pc-dimm.h" #include "hw/acpi/acpi_dev_interface.h" +#include "sysemu/sev.h" NameInfo *qmp_query_name(Error **errp) { @@ -717,3 +718,18 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp) return mem_info; } + +SevInfo *qmp_query_sev(Error **errp) +{ + SevInfo *info = g_malloc0(sizeof(*info)); + + info->enabled = sev_enabled(); + if (info->enabled) { + sev_get_fw_version(&info->api_major, + &info->api_minor, &info->build_id); + sev_get_policy(&info->policy); + sev_get_current_state(&info->state); + } + + return info; +}