From patchwork Thu Mar 8 12:48:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10267989 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 C4F5D6016D for ; Thu, 8 Mar 2018 12:55:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4C3629905 for ; Thu, 8 Mar 2018 12:55:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A923A29907; Thu, 8 Mar 2018 12:55:47 +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 C1DC729905 for ; Thu, 8 Mar 2018 12:55:46 +0000 (UTC) Received: from localhost ([::1]:38494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etv5F-0002E0-9A for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Mar 2018 07:55:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etuzn-0005K7-EO for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etuzj-00046K-8s for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:07 -0500 Received: from mail-cys01nam02on0057.outbound.protection.outlook.com ([104.47.37.57]:36832 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 1etuzj-00045m-1k for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:50:03 -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=MV9AfVIf/UOwrkRosiG6fqDXGPY3pU+ODvAUFFDiTOUdDj7eUYmYwn9c8XCPm3U47RzxRrIAdvtl9Ehm7hK32/AuLXdrM9xL2qn+EoVzXeKJWmMvtGy8n+7K7ovXtj7Vo/HeJXfGrBKydECMWEgX/2lg+GHlg+xojS3yQISUA0E= 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:58 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Thu, 8 Mar 2018 06:48:47 -0600 Message-ID: <20180308124901.83533-15-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: a88b7171-5b70-4f7b-da68-08d584f31aa2 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:wW8S6Y3gFIJq1N+MDeIWguDucDOnINGNwQAp5jMTQqvuakTv1utv0eaXOJ6nkjSYhKhwNnVKw/F6tljgXN+EdGOV811OIftaCcnbVBPD7DUSK3j9daGYo4wTSeHZYeUtP+LbJlINOKHrlj4bBgelJkMeGlW37cYEfyITK0UdTOvkkBjwMxjhhYQBLAZxY+3p4hINg3j+k8cTYmRotDflxzjJU1XJJ/7zvkv299rgBH4ewI4xEjZwMLUpi46GXt0N; 25:KMpYfIMsxOxJa0hNuqEs/q09oV2PCGUlMfHrSu/lcRImJaIDldKCIlKREFIUTHqSSUzmeNGOwGJc3Y1I51i0tGj3PM2MbLgx5pCKcXPxQWf0Dxip1kjVTyyHamyw+b8Bf2XOI2MUIQ0NfHAvtm+VxhJvSFJsblf70LYLVcrjN1+8Tv92Y05nc+/3Lef2CIA2uC6dJpLD+JAvmX5i/ZH2FHP0gdsZdW3BEoJFOWLGria+JkK+3ijKaP2UwAM1jg5OUkzEepfSyCIS48o12FhAoouAxVyjTS1FXS+2RZZMEF6pjCU06KMdVoXGgDLqYABuDXBPuEQ7tn8TQExLxUS5Eg==; 31:/sSOxTOuPvT9I2MT0Uez+o7FIM0QGiuDV+MlmDuh/PHV4Czx8/1OPU2PLCXpnT9JpRekp1P9O1iJq8gEC8vRjhSskkyaguWrQ73muSFEaxYZ5JyFV3vGlcb2Y9khdhAnNLyyRVJz8DAttn+QKWa5HUPI2CM35PNeMtzYNMlphlsaoBAIm/Kt2Tv2sYxaWX8VfOtX3QGazBgL4qnyLq1pBMTDoTeOmsRLxKgqI4QCwFM= X-MS-TrafficTypeDiagnostic: DM2PR12MB0156: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:KiNvOHvUGUOC8gej91UykALyDmjbgBNawzMpTiqMixSA3A0kYGlQFdUgvXEq4chBSSFZq723ceApKl2jd3+WjyyaLpbien2sXZfGcwY8GgoGi0RgU46Vg8vvKf/Z0BjT4+8vOj+A+a9g95dSaA7Weiz+gvVpyyiMRk/qxraRGM62YGYSkO5WrSgSO6iBJVYt8HuXyTjBcTYc/eUhPZSQ+0mo8h0YV79IR/jXw5k+07vaStR1rfsc8IsY7AkLEM6/si3p9jUeznuNcN12emA8PC7bGe8agioV3SYF/5DvfFNpAQ6OG716IkiwPUsdugl/FmKKlmeJmCpuOIhXthhWfRP0gBA02PNDSrqa0vutOq0eNgkA9jpfvCyNlh4IKF88FOHicoI4V1cIrwRDdUPPj8bGevD4pcC/46YaeRJtrFL7/dEOm/fZ8bjxlp1byd1l/kJBcR4gGvuf6/Sya6o9aZaN+gxQfhfe5VoRJjyS9Dsx541N8FiXOnJ3xJPaEq5Y; 4:APWQxOrzuPxaxp1qYP/7V03dSxxJWGcV+dsCFRy7qQjS/wIr9y+KhqAZogF3FP8sIr7RXDrq6aOfqeauCcXhMi3Ea7JmOufg483OovB8UdfzENdx4i5fWvEdiNt6W13/pFJGPbZOAq/6xtzJH9//eXqjv1RBcNuupDapmIfnfMfutDS5soUTu/yNGWiL+P4r76Dc/SdMqk4IblNEMIavH4CoiwZa+aizAGq+t+om2ebzV8PxRbS/Czjgs8v12yOkN1Qp0Y8oI0zGmNCbSdAkjdY6CkLGRFnO6FQjgeqKfPVkat8CX8E2zy8MG787Hchz 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)(1496009)(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)(575784001)(316002)(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:BCEbTO6jzPmt8pK10ItuyTUs52PpPHndrOq2d93rs?= =?us-ascii?Q?iChTIQXOiLT7tKiSFuQA1ktiUoOu/Yh/lZ5H75D15ENtpns/ywzBE8NUYnTu?= =?us-ascii?Q?z9YEqKDdc6YbrosbQDuyC89I1umn/MuCz/uNxy8ssl08h40LsE0xBCBLZhvo?= =?us-ascii?Q?i3QiuqRLlnkCgRg9LKkysVNSBkkEs7n5Bs1EXjgYRNgBjCbA2oJvIe+Xnvjy?= =?us-ascii?Q?FBUAndhb/B8rGumdWEeBTdd/Kcp6RvVFvQz5BcBEDah/mQ9GhQoQlut4ITqa?= =?us-ascii?Q?ayS1q2CK8HWaOhPGUjG+Dze942EjRwNllJbcvp1hSKdjz1bCBHKJz0mdNPyR?= =?us-ascii?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/kj0BaYuwPeYlKeqoMxwmmOO6p67x+PJNgzPwyvUhLNWWugpsQMCGfdmL0tQB2W4qidphiusJFj9ndp3WSqyWCbwNFtEMl50V5gwr1QHVlYADsEKpPxGsibwotmAydxmQaWZrrRgEJdUq6u34jBVmLGAdgF2FV+ynI/bwTRZ+ZsLcJ5pCd0mbsDEaYKSvp96hU2MrLl5dHCA9E7wge SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:2FUSfPJEBe6gphgnxBJzOBeLtKakQsjWM1AkGYMRV0ZLDw+Nrm/OpkMEdzqMTJaYh+nagtOSJmvS2U8tZ7rYSrDvqipt5KeqALdxF0xh9CM4WEVusSMwnCl76O2J8MSyXf0kwQVIMaprf2OdP08QgQiGk4sw7tS2zIYQKwNOaHzKlQ/p0A8XGwgPrR69cnDZjdnMiI/3wFXDksIiFGllohUy5uzIdVHLWbHgXkEIdRNlaIjVT1vhdti+jfVrBPj5 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 12:49:58.0811 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a88b7171-5b70-4f7b-da68-08d584f31aa2 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.57 Subject: [Qemu-devel] [PATCH v12 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"); + } +}