From patchwork Wed Feb 28 21:10:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10249861 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 F096060362 for ; Wed, 28 Feb 2018 21:32:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD23828E9B for ; Wed, 28 Feb 2018 21:32:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA1EF28EB1; Wed, 28 Feb 2018 21:32:21 +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 58C8E28E9B for ; Wed, 28 Feb 2018 21:31:23 +0000 (UTC) Received: from localhost ([::1]:47070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er9Jq-0002MH-9d for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 16:31:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er90J-0001Kh-ID for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er90G-0005nd-J2 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:11 -0500 Received: from mail-dm3nam03on0070.outbound.protection.outlook.com ([104.47.41.70]:21753 helo=NAM03-DM3-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 1er90G-0005mW-8b for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:08 -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=tglDSRA0Wf3d4LuSlxSwjpbPm2ipKj4COIAm3R1QIiE=; b=0lZIOhuku/imNZ4/GmSeO+pRNai24lTXdrACGpcniZMbbauxR1s6HH7nlC/E2yH049WadIbMvQORLu8juQsCCTV6I/+y1/diYVxG2nlq1JumzBD47qEOJE6J7nJyzVcvwk8JJn2jGbKdavT7YLBC8xWc0HdPZ0Dr4ly+aXX9zMU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 21:11:05 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 15:10:14 -0600 Message-ID: <20180228211028.83970-15-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228211028.83970-1-brijesh.singh@amd.com> References: <20180228211028.83970-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR10CA0008.namprd10.prod.outlook.com (2603:10b6:4:2::18) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a38fb40a-0088-483a-75d3-08d57eefc833 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:JOudQtP653F+wbf9dcIvAnKIexWed6OSegUDoRn32xjzzi9xOy4ZNTRjDVcdAtlnZBkczOARqN1sM6i5txlJ6PQvvboBB0U4oD0XQAMHCEMaja5oXLs4XihJnk5vEwkldnJoh1JcHs7YOQAAt6KLYsq7e0GsXF6hnDh6DFLvH0H4jYIFkuYhyLeTRC/iThVrH2ig2Ku2OhRHELaM3YoHas74KPRp+3louIAbegJtnEi5sHJSRvuWQSQTZjrWsdb5; 25:qVOuVxAPpSDdW/YjNs01pNtE8qv3Op2EZg5kmkYf9a28OUBRNjV6xyJWOCS4N3HRdbC6MLfiUBQBIaal4hONxJBX/+VDr4AtBuVCDAJXB6jqkSSjbKw0LLM5wOBlj7v31bE9kGYJREFX+An/jUXZXxSPwp5dDPUfX4AHNKhuAc6m3I/cZWMMwgaQxlCh2FeA1DDzVI9UbyrZInog6FvZTMhJaseF3Bm6VIVKiWM8Vis2lGMKb0GE9huWTmRLQZ1p/pnh+33pJ4rQ7xZkNcAlTmKAygr6NKdC9Ak+aubdIRxNHKg2rQ/Ft3NOpgClVjAe/oRBdgxy+PHGCZQgI9lWcw==; 31:kR09fzIPUySOAOzKrDDVqUAKyBvWHsw331NPcO5oLmKep/o1VAKMhWsZdYm8ltqcLZGp5ipwW1Tgn6tTHM7Gqi8lWQLPaSIE1FF7vzmGk9YOc4blYD9nqiu9aQKZsDPlrWwuwH2H+u/MfHVjhGnRwEeQfISgF6q9uhoaWQPqIahkCj5c9yIpw5FQBD+BfcLn2CpLBhy/jegTgbFidlSijLw/EFTFvZO5WVi1M4LC4xw= X-MS-TrafficTypeDiagnostic: DM2PR12MB0155: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:5KW4B2pcE4cJw1vl/aaONnS5QB05qGziDyduEN45sRymlPAxFkjCLPTtLO0JxeCqC51zwZQETJyklmnp5eiRbNYMszeU2zoEyZDXoLwC3bTXvI+PM/kd27/10M7dpiMXEO4C5GPHJK8kxtgwJyVySOEDvbU2ysi/LgVoMjpIHbdnXzNkVO/Jr0H+S9fLJ6xIWgPIkkL7TK6ypyoP5QSfCs0Txkt1scH7ra9GneEM6fvoZHxQAg+zveuNNFiZ3WWSkTX3ZSaD5Plj+fhMcpflzOQ6yKvTPmZuek+eSk7c7ywsc/XMdh3yjQizLnwj9IlRKfZjV9N4VR8XxP3BHjcYBTp83IzH2D0rXsmdW4CjmcgukWsF1DWI4JPARKLMrpt1JiYiygW7VnCWgUYfJgVmycNqnwzVSrVMF7fIuRO8xYI5Ak1ns1XMS7q6K+zb/p+7gu8f2YtXOk6fP5buVDQNtSZ+I3wC0C1QgF4HatUaYCbOThr2Tc+IUrq6OJrnJBf2; 4:flyK29JFeWwkg9koTP8ja6n04ZFQkMedgn/7aXizPORcCW/zmphsoEGVaCl0UL0JCNjKHHoAVmCe3R+l7S+3BGfTjJkSxBsRSgW2GY8esafJv7b+ftbpJhEySB9P7jjzB6vGVNn+B8JOLuZRUCjyK4NjiUhUMp6+nUraP6ISUvviuzigV/RxrIEdPDgKvOZGWqeIoVoewWCsobjC3tLEO8+AYFpgJghn1zA7aCw6qzeo62soFWAi0KSVP8Rz6w7OACCkjI9+mOEgKYnCTmEyvbb13gFd43/WGkDXB/vgER9mMRAuzxGPRItu5JOx0Vmy 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)(8121501046)(5005006)(3231220)(944501219)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0155; X-Forefront-PRVS: 0597911EE1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(39860400002)(39380400002)(396003)(346002)(366004)(376002)(189003)(199004)(6486002)(6116002)(1076002)(2351001)(36756003)(16526019)(54906003)(53416004)(26005)(53936002)(66066001)(186003)(47776003)(2361001)(478600001)(8666007)(316002)(81166006)(50226002)(8676002)(8936002)(386003)(106356001)(2870700001)(97736004)(5660300001)(2950100002)(6666003)(23676004)(305945005)(4326008)(76176011)(7736002)(39060400002)(8656006)(105586002)(68736007)(50466002)(7696005)(25786009)(52116002)(3846002)(2906002)(86362001)(81156014)(7416002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; 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; DM2PR12MB0155; 23:cLGO0WbiU0YzltpCTLQ247k3+3ks6wX6YXIusMM5J?= =?us-ascii?Q?IwZ+hixwteIo9zeFRCpSVU5nRGWoqTaJqBclMWCDmp7YcuyC6OHEvdQeurzX?= =?us-ascii?Q?h0gjCLrQ6oEoSwugP+2awoyLSU4+Aq5CQeZZBdlGT/oZ1mhRnxvXdnbste96?= =?us-ascii?Q?2GMMKWthsMh/xE69gH5DhxPfrFQQuxXo8/bKSENdH5CHAeH16pMXN4MGHUUy?= =?us-ascii?Q?pn88RipngouS79LYAswN7aWoCuFnK02t8JHSRCrWtWCFgInun6BvvB2Wa0j/?= =?us-ascii?Q?m6D67gUL/qBkWpmgyPj3pov7+q3bJleihr24ayO9Sx9z+JWdQe9Bj7lj0diz?= =?us-ascii?Q?NCTQS+V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ata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:yr+inPVd6aPm95NEmAznlUO7GQZIbPnEC/mV/VvuyRDaWGlUyu3jy68qaNZwXFn4+wgqxPgji48Igi5NeEoCUlroNG4a4ueQpZx0VhMKQdtIis9ZpMF0yjEt4r1lLbfq8xKv12YpN8w52FKziKTf1Nh+cdCutJv2d9UxsBApn5VDJesgtq+4H0OaHxQCbH9hBn/2tzl4DVHUVxUCZPLFdz49FP4hkZ5ZCCXLoTeHs22z7petzhP/YipZ1t8akjqZ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 21:11:05.6236 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a38fb40a-0088-483a-75d3-08d57eefc833 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.70 Subject: [Qemu-devel] [PATCH v10 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 Reviewed-by: Dr. David Alan Gilbert --- Hi Dave, I updated the patch to address your comment on making this x86 specific, but still kept your R-b, if you don't agree with changes then let me know. thanks 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 1143db44a760..4ca1a77b2c1f 100644 --- a/hmp.h +++ b/hmp.h @@ -146,5 +146,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 e2f02c4be95c..e664030dbd72 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 "qmp-commands.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"); + } +}