From patchwork Wed Mar 7 16:50:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10264485 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 811E7602BD for ; Wed, 7 Mar 2018 16:59:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EF9E29476 for ; Wed, 7 Mar 2018 16:59:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63114294A0; Wed, 7 Mar 2018 16:59:10 +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 D9D6829476 for ; Wed, 7 Mar 2018 16:59:09 +0000 (UTC) Received: from localhost ([::1]:34381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etcPF-0004Tu-25 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Mar 2018 11:59:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etcHj-0004mX-A7 for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etcHf-0008JM-41 for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:23 -0500 Received: from mail-bl2nam02on0077.outbound.protection.outlook.com ([104.47.38.77]:29824 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 1etcHe-0008Im-Tq for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:19 -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=kk00fjaCkCd86t3KZ7YoNb7fg7GphPAxjgTr1EqTI7o=; b=nBjPZN8ykF/Q6GD4+ayu8mMv5JnkBUDuV205F6PSBxbSVjPhe7O+ucrWa9ao7qqINFh1au9QVtbvGq9/NJO+9dcANvS+a5rx5FR4jpb4AvBpWdfg8Ow7ONspwHtIx7IvEIeUr34c06bs2n60t7A+rLSkUG1DIXaSlOfLo0QIunM= 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:14 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 7 Mar 2018 10:50:24 -0600 Message-ID: <20180307165038.88640-15-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: 67d9d636-fa02-410a-07ff-08d5844ba413 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:sZNmOadAuPJUvLXXodVvjyyeslu+80CAOKk2k222sA7NVr7ig3xtyfwqVohZgfQkaG2a2aQv5CwpxdHWlqmISkHQzNY8RNzjbUCXNvQF3KGtr6Y28NSdgfs6uB/fwBzMuXr7AcEr037vIKew8JHTbfbWvc6y0JulFf8UGWDB5p2Xe+90z6NkxMmQIQLFkndiuG0n9mxKNqdOwRY44otxE7Z3+7dunPkf3Ls0w6j5Ju4BrK5V0XBg3PFolUmRNT5X; 25:S/eZS0Bah/QQW2cGK9mwvF/dW7BUN4iQQ9az+W4v184fiaC/OrpZlrWSGBdGbdQj0/3IFv9HXLl+19bpTzDLWW70iXSTh+1VS24ZgNvSZF5Lh4jyYNJLLQVxZ1DGzz+8f/kTvJoqDzF+s3+zV5AuRo8hPRvu8lkwuRsxJka/aM5jm/iJ56+6L5zwoMFk/wOPdDZAoazFbffrD632LIHa8FZtGUIN88TahD+nQMBSVtyyvZq6l2O7GMg3LlAIs0M7KHYL9TUQImdowTA6OaL7zKNflcDv54wYDSLVGRUyIjtIw2qDRAuwNkcNiYE5Qr0H+S1L1G0cLdsecnvFdqdsaw==; 31:yL+ohitEE3bOHQIwTx2airWAQr+fnxeKcOOefuQBhO1GLnqELAKUq6Sk1ez3aeAno6SGU/iOUyQj1ujCJZqZUeo0k4mzYuddm7XStkqKlMzeSgy50wFJrT8lLzTHosyKyRwTxco6X4edQvcliT6PSZX8WPJBZQ4fpf0I6dXPzyh2Tiqd1kTVxYO67/pyrFnrnb7KYcW7chRrcEe7WjNV5qMvyAo8umUOEmEcw3ggDL8= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:SarS+3QQJRsQonVeEGst8ngAZGzwdFGI0t1PCi+1hapFKY2wMw0hWgasqlpSDVfPlucXY+SNcVOLx6VXfAu07oHux7OnUF8n2aQItMOXxuMQqAuXX03kQX0lkWpzEexSuc6mDrZJo6Pheonr4bOCsahB1Ev2DhxsMQvE3dW6EXQS8Y9iwq3siu68fg3xkwEu2pX8ilqo9KTGZJXAQng9yk6mfzF1T8R/QzvCte/FmLrWqyYxhqsZrlCjhaW1g3c+cTbwOs5HRWyP8ld39AZUJ0eiiSRLcLfKBOS826EqqzwkTENSBr2Uqdfe9h2juSppEwIB5U3ailGTzn0xf4p10R3Q4ZhFjuzQS/lPCUDydxR+iVYJ2AzXc9Y06d14L8jYihC/+I3KeHe8CYhU7oyyvwMgo5xIwSAGtMJzf5oJrnek/Fa4OZ1D9RHI9Vwk0dbmpOudn60L7cDBO8YJnz3RwjtOQ2xWh6GGDTDyDcFgwYSCZfy1j13qMbQSug7qU0wc; 4:PQNbxmayIjIAQ9HaWQYE3kqv6qdnojr37/Wg1NqF0PboGSt9gTDn+5sA3ya5fVJCpQHkSE5q7Cvn9w3anynxJrSWVyDJbPYesLDJv3VYyqFL8u6CfjQg/TzblH0HWS7Kmfb3gvb1snrUsD7IKeOviCnoNxQ14CRV7gBQtaFF8IR8vSbf6Grs5bnjhjm5CIKTqp5x5jT/l+J/l2xVJFl5xnmwxzT46bYtNJlOhQm2lN77RdBIfcrzlCS+NZo1Zrd7KsW1Wke+gs9y9O6iDtMIqy0JaDTwq7TlJp/Qrpip5WWKAjN5UcmCt48SmROAGh+n 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)(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:X5/kuUgkTqSzWMAI63Yxck66fTrnOrFM/w7ZC4g8J?= =?us-ascii?Q?3FtZmxC9U7Wekqz4bC4GU8WLIeIG1ec64bDTLxC39tVmWVHcXDVpbX8zktpi?= =?us-ascii?Q?kdUW+Kf+ceMbdj+CZxFTlRduXbR0nZ5oKA9EQWedOSnUjhRrT9jnswxUWSbB?= =?us-ascii?Q?ww9BIC3OfBz9wXQln+my5h39H2u2PkSx2+kA1Aa1CB+/8vpzTmIoKnFxCgxT?= =?us-ascii?Q?6qmDaO4ZS598ahCSCQfUPG5KFA4bAU2iXv2fXHg6BsDqbQfArRGH4Fu0MnJS?= =?us-ascii?Q?JFhr01RfrSI7vhrQDI99I20Lg0dqwG7+8dsayI/EDYJVH9g6qGJU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USytP9b78OfMhk1uYFPIkXSuWr9eUnirMkQ6iehMRmtAN1PCxoP6QXwfWNvMq28Mzv/842ryQ1mj83RQbR0xbi605QSpRUmU9vatja1cgLyMFxuThzi9h8UHLpvYjXIBQdf3gf4mifYRVIG1qXlOGRZxtO/kVumanvap6FxPmbtCAzmrMzOkB8fnzxcz81I9bXAQmXezjJxAddAuov7fzrJ/wtiq+FLQMTns SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:EZDcwxqlfArZ9wM+OTv9te1IZoohB42w7J5woR6z8+X8uhsjHRB+AKZnxcOgUkLId+TQYhRJu8soE8qC1Vr+mhdep8Ci431TyIbDiNZGCIDvW6DGXmDOf/BT7YK9PPcwSJBcSCMKdMAitpjJBuDTi67Zt7JuWtPxUTSlaBGh9EjsLLSaVQc6cLewd9yVUHBAPOvtUh6Gdv68ftbrQUitGNFj0il8dLChLS7dnlB3Efk6u5yo1BMHyPxhNIq1TugD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2018 16:51:14.6823 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67d9d636-fa02-410a-07ff-08d5844ba413 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.77 Subject: [Qemu-devel] [PATCH v11 14/28] hmp: add 'info 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 command can be used to show 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: "Dr. David Alan Gilbert" Signed-off-by: Brijesh Singh --- hmp-commands-info.hx | 16 ++++++++++++++++ hmp.h | 1 + target/i386/monitor.c | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index ad590a4ffb2b..ddfcd5adcca6 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -867,6 +867,22 @@ Display the amount of initially allocated and present hotpluggable (if enabled) memory in bytes. ETEXI +#if defined(TARGET_I386) + { + .name = "sev", + .args_type = "", + .params = "", + .help = "show SEV information", + .cmd = hmp_info_sev, + }, +#endif + +STEXI +@item info sev +@findex info sev +Show SEV information. +ETEXI + STEXI @end table ETEXI diff --git a/hmp.h b/hmp.h index b89733876de1..4e2ec375b0f4 100644 --- a/hmp.h +++ b/hmp.h @@ -143,5 +143,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); +void hmp_info_sev(Monitor *mon, const QDict *qdict); #endif diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 29de61996371..4d9019626031 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -29,6 +29,7 @@ #include "qapi/qmp/qdict.h" #include "hw/i386/pc.h" #include "sysemu/kvm.h" +#include "sysemu/sev.h" #include "hmp.h" #include "sev_i386.h" #include "qapi/qapi-commands-misc.h" @@ -680,3 +681,22 @@ SevInfo *qmp_query_sev(Error **errp) return info; } + +void hmp_info_sev(Monitor *mon, const QDict *qdict) +{ + SevInfo *info = sev_get_info(); + + if (info && info->enabled) { + monitor_printf(mon, "handle: %d\n", info->handle); + monitor_printf(mon, "state: %s\n", SevState_str(info->state)); + monitor_printf(mon, "build: %d\n", info->build_id); + monitor_printf(mon, "api version: %d.%d\n", + info->api_major, info->api_minor); + monitor_printf(mon, "debug: %s\n", + info->policy & SEV_POLICY_NODBG ? "off" : "on"); + monitor_printf(mon, "key-sharing: %s\n", + info->policy & SEV_POLICY_NOKS ? "off" : "on"); + } else { + monitor_printf(mon, "SEV is not enabled\n"); + } +}