Message ID | 148846788726.2349.3437191329307712811.stgit@brijesh-build-machine (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <kvm-owner@kernel.org> 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 236C560429 for <patchwork-kvm@patchwork.kernel.org>; Thu, 2 Mar 2017 16:06:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 113EE27BE5 for <patchwork-kvm@patchwork.kernel.org>; Thu, 2 Mar 2017 16:06:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04A54285B6; Thu, 2 Mar 2017 16:06:08 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 348DE27BE5 for <patchwork-kvm@patchwork.kernel.org>; Thu, 2 Mar 2017 16:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752890AbdCBPfx (ORCPT <rfc822;patchwork-kvm@patchwork.kernel.org>); Thu, 2 Mar 2017 10:35:53 -0500 Received: from mail-by2nam01on0075.outbound.protection.outlook.com ([104.47.34.75]:41376 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751995AbdCBPfh (ORCPT <rfc822;kvm@vger.kernel.org>); Thu, 2 Mar 2017 10:35:37 -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=XNAOm6rf6XA4sedVa0ni+WcqUVybqcKliw09MxuMpZc=; b=vAEsk1B/X5X9CYkMELkUtxYUEr/dkcwH0QlHCtmwTcUHY8IvafMr3tlVQXJneVpNehtn4NS7OOAtr1LmE9ev0AnicbBgnl8hAFJji2VgGL1is+psFuOFcRKLus1HSniBdi6r0utaVVK3+NhNuziY3HxEj4db/hI1aUsVPDsBbhY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from [127.0.1.1] (165.204.77.1) by BN6PR12MB1603.namprd12.prod.outlook.com (10.172.21.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 15:18:09 +0000 Subject: [RFC PATCH v2 28/32] kvm: svm: Add support for SEV GUEST_STATUS command From: Brijesh Singh <brijesh.singh@amd.com> To: <simon.guinot@sequanux.org>, <linux-efi@vger.kernel.org>, <brijesh.singh@amd.com>, <kvm@vger.kernel.org>, <rkrcmar@redhat.com>, <matt@codeblueprint.co.uk>, <linux-pci@vger.kernel.org>, <linus.walleij@linaro.org>, <gary.hook@amd.com>, <linux-mm@kvack.org>, <paul.gortmaker@windriver.com>, <hpa@zytor.com>, <cl@linux.com>, <dan.j.williams@intel.com>, <aarcange@redhat.com>, <sfr@canb.auug.org.au>, <andriy.shevchenko@linux.intel.com>, <herbert@gondor.apana.org.au>, <bhe@redhat.com>, <xemul@parallels.com>, <joro@8bytes.org>, <x86@kernel.org>, <peterz@infradead.org>, <piotr.luc@intel.com>, <mingo@redhat.com>, <msalter@redhat.com>, <ross.zwisler@linux.intel.com>, <bp@suse.de>, <dyoung@redhat.com>, <thomas.lendacky@amd.com>, <jroedel@suse.de>, <keescook@chromium.org>, <arnd@arndb.de>, <toshi.kani@hpe.com>, <mathieu.desnoyers@efficios.com>, <luto@kernel.org>, <devel@linuxdriverproject.org>, <bhelgaas@google.com>, <tglx@linutronix.de>, <mchehab@kernel.org>, <iamjoonsoo.kim@lge.com>, <labbott@fedoraproject.org>, <tony.luck@intel.com>, <alexandre.bounine@idt.com>, <kuleshovmail@gmail.com>, <linux-kernel@vger.kernel.org>, <mcgrof@kernel.org>, <mst@redhat.com>, <linux-crypto@vger.kernel.org>, <tj@kernel.org>, <pbonzini@redhat.com>, <akpm@linux-foundation.org>, <davem@davemloft.net> Date: Thu, 2 Mar 2017 10:18:07 -0500 Message-ID: <148846788726.2349.3437191329307712811.stgit@brijesh-build-machine> In-Reply-To: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> References: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR03CA0027.namprd03.prod.outlook.com (10.175.124.13) To BN6PR12MB1603.namprd12.prod.outlook.com (10.172.21.151) X-MS-Office365-Filtering-Correlation-Id: 2270ff8d-a2ba-4864-3148-08d4617f574d X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:BN6PR12MB1603; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1603; 3:4LwRKun2V7RW2pLaanzllykO18B/Klx4baS+V6qfJujto6PpnjARbRV/ucp7yAAq7wdra+k7rcg3MdfE8YWCRKr1JNcvu2pzONawjU+DFhQEkdBqhWBLdd4HprDK8kweUJx5IZzTkSF14BAU9sYV9oC1WkJviBVTcPOEIVShf084SRZ6QZii2hKtgbFpsWIGBODfzg+dig65TkX6hfGTjS7jhqJVFmhWfI11+dEJPPncAaCU3/vQDJkMp36AXHKZQUfuPJCZMPqYk1L2VvfCSAxFczbcpyTkesukc4yrj5k=; 25:zC87AYzlku2HTUH7yNz+1a9xTzr0QPvt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B8YIUOxore5RxYCcg3fH9Q548pcR4jn1Jb3p/hyzTjDkkHXkcm9hHLaotpC52TiC6ciXTjv79qZDucFxoVZU1ZMrlLmEoJFp/nRD85F+g+R+Yz1opC1Lz4hfU1VE+Y4ninFguEAQFtG2eMzRKlfEqhCONvwxREmkgyj0Kd49DjPH/FBltH4Yox/Il X-Microsoft-Antispam-PRVS: <BN6PR12MB160325588A8D6664D7E480CAE5280@BN6PR12MB1603.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(20161123558025)(6072148); SRVR:BN6PR12MB1603; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1603; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1603; 4:zlqpcpJsLvp0/2EEUuBsYN8LIN3p6b5UI95FpEe+7qaiS88ntL4fjg9gulcuriOjxtHVSHQqX9w20eUs7Apgti61LYsG/hkDdlol6avjbEREyfKA5GnLOAwvBcjvjyH/CTRbxflNKZLDInsv1xRASKOEhgtaivdWM8uxa6H+VdiXoyjMiqTav92OPqx+5Mg722eWPcZIQfKMSpDyDmxArw9SrsWNZG3CSdbdcHIc7KfT6GQzW7REiri8FkErMoc8Tm+Z6ef/ZMBfejWHpEq/n39XQeDoUVbrIooXsmJPi4ToffAKRjkaOC9oCuHAeSpZLxi42kQeGWoyp1g1hn0e6S8kLCclZGINF0FepuX1v1pg66HpYaD6lsiPXGMR+KjA2syBeWUULTgeUk91UWfXY1jhLvY7ZMuA85NeZoqtpowG8usmvR9+9jj8BlCrKdS7XDr5FJGwLR94EDd5keuhkDpAvcu/yB7uAr/DwMnqyjPmkV90uibv6d2fV/1tcoIrp4Mutj3uP0SBKI5xiCCjdxhdHySgNGWkJ5swLhx6pJIFZg3kfn8WdDd/oaH0AapLXMhLFp3mfffo2kgyxAwc8XW2cjEVyzMj2ycsCYMgJjyAKl0loWtSvTBMKrnk1TOSKAD7LR4/Dwj7eFgV1zARXCkDc0iq0wqHWxxoHIp9RNI= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(39860400002)(39840400002)(39850400002)(39450400003)(39410400002)(9686003)(23676002)(86362001)(5660300001)(305945005)(103116003)(7366002)(7416002)(42186005)(7406005)(25786008)(77096006)(1191002)(6486002)(90366009)(81166006)(3846002)(230700001)(6116002)(8676002)(33646002)(2201001)(38730400002)(189998001)(7736002)(2950100002)(92566002)(66066001)(50466002)(54356999)(50986999)(33716001)(53936002)(2906002)(47776003)(76176999)(83506001)(921003)(2101003)(83996005)(1121003)(217873001)(84006005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1603; H:[127.0.1.1]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxNjAzOzIzOnk5d2g3VWhZaEdrdmhBdXRCOWQ3RU5KNWVL?= =?utf-8?B?S29VZGR4R2IwWnVrbk9GUCtZeHRsVnZ2enp4cWRDb0RDVllnVjcvMjdENDVS?= =?utf-8?B?TXNaYVJiZ3RlSDFIMWF2cUc0RDFZZ3VCYThCV3c3TkpmSm4vU2pNQmhPeFpw?= =?utf-8?B?akZZaFFObzJBTmhYR05rUFNjODMzdXZXVThHYTBVbnZ6bFNYckE1S01FVkZM?= =?utf-8?B?RkYydXRvN1E5L0RxeWxQVTU5Rm9XSEI2M2taY3JwTVFMaGVxaThVcFc5UVFq?= =?utf-8?B?aTg0Qm92R2pmeEVIcGpISzIxR09DN0xPSHp3Wmwya3F1SnNoWkJaK2VibUdG?= =?utf-8?B?UkRvTkw4WkQvd21CNkFoUHNpQWNuU1VzWlpSNnFtVVpra25TOTcxTXM5ZGI5?= =?utf-8?B?bnNuejh5dTlyZ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Y/schYmg==; 24:KfLRQWmzgJM9ykclNK4x/WloC6hkuYWEP7AP+a+JtOIRFKe5BTrQNmgTcdVoHndKWI+DeP5vYMgbbSnLrxc1Ey1o+I/LFG0Jb/Np3G1dwJo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1603; 7:zEOg+L3oR1AXe5JqHuxNyz7JT9qWGlPFTvewmkhZeP0Dz6QSIiYxJLzYQMhZSaw25KLH7/MP4Z9cbYb58rAoIOl1kuvCDxaOIkH575F16Tf9jrJdHUMTV2/qvepXixo+xapxO0eJqPI6nRvkAVDslYwgqxtMvQW952X04gstzgw1fbypiIo7YKAbLbocVg+JZ1H/Y8M5AoR4ksqRyT5OQWSD93RsTVl9FKciWkBTBd7G1zdhb9ktJLQRp8PuvBJ7DKsS6Wt71HZYWXADOvPGADUcw+PZdYeSegh2EO7jHCPYlmuR20ofrQZS1GLRQsKx/4MaGOH1fgEyoj4qmhyXiQ==; 20:OuUrQSGaKgh9f4Z3SdYanJllck1ScX4guYxWXFugqu9Ncz9vuFklR/kQ6WX2ueZTprTLgeBNq5Hp3OgVefMd4FAsNv+J3dQqtsNf6ttdhHMrxrmV5kzrn/yP08DQGW8C32pVpMVd895OaOg+opfRMC9on1CXUYICAc1VA5ybiKcYLGEZwjeRKplQsGDwDhCPPaOIg4YBH83+0hjd0xBivIln1jIIhgYLFPfQAff6O7TVpruzikEcnSzNCR9sO78M X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 15:18:09.4499 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1603 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: <kvm.vger.kernel.org> X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index c108064..977aa22 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -5953,6 +5953,39 @@ static int sev_launch_finish(struct kvm *kvm, struct kvm_sev_cmd *argp) return ret; } +static int sev_guest_status(struct kvm *kvm, struct kvm_sev_cmd *argp) +{ + int ret; + struct kvm_sev_guest_status params; + struct sev_data_guest_status *data; + + if (!sev_guest(kvm)) + return -ENOTTY; + + if (copy_from_user(¶ms, (void *) argp->data, + sizeof(struct kvm_sev_guest_status))) + return -EFAULT; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->handle = sev_get_handle(kvm); + ret = sev_issue_cmd(kvm, SEV_CMD_GUEST_STATUS, data, &argp->error); + if (ret) + goto err_1; + + params.policy = data->policy; + params.state = data->state; + + if (copy_to_user((void *) argp->data, ¶ms, + sizeof(struct kvm_sev_guest_status))) + ret = -EFAULT; +err_1: + kfree(data); + return ret; +} + static int amd_memory_encryption_cmd(struct kvm *kvm, void __user *argp) { int r = -ENOTTY; @@ -5976,6 +6009,10 @@ static int amd_memory_encryption_cmd(struct kvm *kvm, void __user *argp) r = sev_launch_finish(kvm, &sev_cmd); break; } + case KVM_SEV_GUEST_STATUS: { + r = sev_guest_status(kvm, &sev_cmd); + break; + } default: break; }
The command is used for querying the SEV guest status. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- arch/x86/kvm/svm.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)