Message ID | 147190854977.9523.2458628974170220401.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 5AC66607F0 for <patchwork-kvm@patchwork.kernel.org>; Mon, 22 Aug 2016 23:29:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C0F728B03 for <patchwork-kvm@patchwork.kernel.org>; Mon, 22 Aug 2016 23:29:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FE6728B0D; Mon, 22 Aug 2016 23:29:43 +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=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham 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 9385928B03 for <patchwork-kvm@patchwork.kernel.org>; Mon, 22 Aug 2016 23:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932867AbcHVX30 (ORCPT <rfc822;patchwork-kvm@patchwork.kernel.org>); Mon, 22 Aug 2016 19:29:26 -0400 Received: from mail-cys01nam02on0042.outbound.protection.outlook.com ([104.47.37.42]:12384 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932578AbcHVX3W (ORCPT <rfc822;kvm@vger.kernel.org>); Mon, 22 Aug 2016 19:29:22 -0400 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=j6FTBudbrD8tPa+/cSnRD2qTfBwKCDp+JJnNBzDi84A=; b=jyb5nxSj7yoxzkLIyEIWRC63TEf6REwpWw2hryGpiRomvj+DSm/c4LR5uC87CyU5UE+6KAHdQruM4InTVESGYLI1AeoBMM2Edya37KrqLlnQIrFVQ81joRSLEYMtkSnm3nPmf2pqkm+gQotyvMLTFzQqyhi9rg5lRNL4uVjHTjk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [127.0.1.1] (165.204.77.1) by SN1PR12MB0670.namprd12.prod.outlook.com (10.163.208.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Mon, 22 Aug 2016 23:29:13 +0000 Subject: [RFC PATCH v1 25/28] KVM: SVM: add KVM_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>, <linus.walleij@linaro.org>, <linux-mm@kvack.org>, <paul.gortmaker@windriver.com>, <hpa@zytor.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>, <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>, <toshi.kani@hpe.com>, <mathieu.desnoyers@efficios.com>, <devel@linuxdriverproject.org>, <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>, <linux-crypto@vger.kernel.org>, <pbonzini@redhat.com>, <akpm@linux-foundation.org>, <davem@davemloft.net> Date: Mon, 22 Aug 2016 19:29:09 -0400 Message-ID: <147190854977.9523.2458628974170220401.stgit@brijesh-build-machine> In-Reply-To: <147190820782.9523.4967724730957229273.stgit@brijesh-build-machine> References: <147190820782.9523.4967724730957229273.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: MWHPR07CA0020.namprd07.prod.outlook.com (10.172.94.30) To SN1PR12MB0670.namprd12.prod.outlook.com (10.163.208.28) X-MS-Office365-Filtering-Correlation-Id: 4eca610d-7e50-4bd5-1199-08d3cae4233f X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 2:m1disKBGy6sQ015iO/Noc1vEaJ0IvYKl6c1yt0fI5l0p0Amnpz7CiLEYGlctV+8sEMbTSeNa5+j6mgNcFhTG2Y6y0VIBzKtaA0izlhQkKuhKtQgAn/VpIYw+ydFIbg9xp7YMCAhMxuyW/QngJZGZX2Ff4gxD4u6gYSvnZXIKM713kaFV0WzvNweJsZFtO8VJ; 3:Ax56PhDGRn2ddnjyp/ul2QcvL2cqQWSRy+wTvnYrKaQ1twACcMPI9ZiE9JO/GSubl6YKqhICzIwiSJKla4Va9n/EFY63g/ysdjmBGr/3ywqYQHS08mnK1qymrSqdFrzQ X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0670; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 25:AMuoNc7f5bX3+LQGNIhJiUrmO+F4xqIfS0VmCucg4kMJulXshHzTdAMqzDvSaCJfGRSN2owEq36hW6n2WnCpjX98eaw63L2K1iPQ/4IqL/LNR78KvtNAJxOnN6YNo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hbtqla0e6BM+mooq6XWGNIlK2j5KeZ2nWry08kKzqTGDXJtjV8O7ht5+ebqHHzRs8hUXOdRd4rlaa8QmjVudbCkJsPv7BvWC6zUw6XOtsmWqpynW1QJ/lptLtgLI9m0SnR2/YAJkkNRPf8JcE4jE7SFouZiae5nepNjd5m5f6zENcuC8k64PrpjA4z5JRkTiYMa0ur/gmcmJ6K5hVEryxNoGKX2SpQsXmP2F0ArQ4YGTvt23XKByMGfBiBeTb9FYW8q4ykarEplduXhsZjqb0ZxNZ+hfVJNY7UDi5QIbehoV/yX78ZXx/BPH3xlwA1Jq0zvburqN3g06x6C3NMENdWf4lNoWcrhE/I68ccTAQCzMrJwpQrU+tiecAyHUyR8XNl82QRZbdUWVBRq9Ez0hTBSN9nK2DtXVBSX1KZ X-Microsoft-Antispam-PRVS: <SN1PR12MB0670ABFC642CFC9EDC24E3EDE5E80@SN1PR12MB0670.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:SN1PR12MB0670; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0670; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 4:3r2gdnHL3BLFTh1PMUMZWknYzNsoknkldsotqVhjWRYxkgPeKQU8hR4x69/IKejO7FKamNOHuT3MDVwCyrqW9SKpIKmoOhK2/s9GQ4RlHt2SSqlLegCiNLQiZCuagaCb+VILihjbKQwOHLPq0RaWOPmLY7aDob56OjFUmZGiBEjx3awr5FGevgb+fn6APlRpnW3zEhOwpNAPnoB2D+096iUI9wK3UazFTTKJL0v9ifLPTQ4JMPKtAv4HEBl31++cdWoc9+e9V4zug6aC8tnQFzlQmKGP+ymg3DK41FibhT5GbLxcyjaJVWBDEx/cGenU+2WaAE+3omX3+XZf14P+WPX6ePZIoHBUM27Qgm4OwC5bD3vjqAPxrOb6a8/z3HZEzR57mLa2+Kefthjz2dXmXm5+Eb5giYHjsplkXUz6G0a9yXN1bpT0+o0IAOxKX/rf X-Forefront-PRVS: 00429279BA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(199003)(189002)(2906002)(15975445007)(230700001)(9686002)(8676002)(81156014)(586003)(81166006)(77096005)(105586002)(33716001)(103116003)(42186005)(2950100001)(3846002)(68736007)(6116002)(305945005)(101416001)(66066001)(7846002)(7736002)(83506001)(50466002)(92566002)(19580405001)(19580395003)(97736004)(4001350100001)(5001770100001)(107886002)(189998001)(106356001)(229853001)(86362001)(47776003)(575784001)(5660300001)(54356999)(7416002)(7406005)(76176999)(33646002)(50986999)(2201001)(23676002)(921003)(1121003)(2101003)(83996005)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0670; H:[127.0.1.1]; 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: =?utf-8?B?MTtTTjFQUjEyTUIwNjcwOzIzOiswcEpHM3hMYXM4cHE2MUk0NEVrYkxUS1Vv?= =?utf-8?B?cml1N3V0dFRqRnd2T2ZGdkE0enlHemRKWklaalp5cVZDQmExekJTS0t2NXZi?= =?utf-8?B?WlhJcWJzM09hd2RleUlsS3ZBR0FhbGZEekszVUloL2JTaGlHRDJvTUdCU3dh?= =?utf-8?B?NHdQUkpnbE4yRW94MUg2ZEpEQUZqa0pXRm9zem1JbVdaR2RsakljUjV1KytG?= =?utf-8?B?QlJTQlJ2U3orZG5VV0txNkNFYmo5eGFpM2hUbjZzdzlmUjBOS0FYRVFLTFVT?= =?utf-8?B?aGJ1UXVXeEgwRVk4NVlzRDVhUm9SeXdzbFFGbUpCS2pKc2RnSE1RZ3VOd2Vk?= =?utf-8?B?TzFpUjlhcnozQmhlYVlTbmZkTHBaV1MxRlpuSVhlcXJE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bYeOrj5qoxonyMx67CuBhx/xb8mnzIHE5T3S7Xj+vYw==; 5:Olq3ARZn1rGD0TiYhTp3DADnIZcV46VCRtPbFIj/Q31Dtyr7ebuWTv93fpl2EzfmwQdHKJOCgr8FAIhAMQhlQQvu/mrW4+bExjK3uOElwK2JS2nDT+gCBDUrE30DuXHFsxlhvt2+eqr3hZV5/+iHIw==; 24:/kSdu58zWcVpka5z1o8qRTTgJwphldyRDQ9trYTq8U+zuTgfMTJUsMGbYlIoPtFzElTxpzVhf6ruWijby7CpZHWE03MfexQATe98ao9yxuc=; 7:WPh7uIUuVMuj/bsaSlaaOMv5Rlc5TyLl1HKvwNKKKnLTim/UbyyQaIAdYArDvBvIJa43lbgc01repwi4FH/G+srkVAHTwtOUEGz3/GynaT9puEPZJdCBzOV/3nF8MWL9IWzGcUI/3TKwXMF3WYhZiUJqZZP0E19jfLwW8SVzgbntkWgUOaj4lQ405lghHJOKRUCFeRq3mGmq0GLQplos4ciq5O2GyHVSJbLVYVyyMl5U3BGK133v88+CyTI9JaPh SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0670; 20:1v8Z/JvwD/qd4gQ4a3cq1eTCHhxnR+T5f3mKofpAlm1meqTFU+EyRKA/aoGuK5luOxPs9uL35jLG9bOHTYpqyhSJgQfS0FzW1dp5wEZ0hrmOY7Rfdyvk7G2iFsZDuL2OkCqQIqKJ9BjjjQYPPWG1XLLEOYiK9Mo7WIEQtK/TqboJ7xWm+CdplGIyY2rCPWsirKbslAkzhInPH8Q4G+cBdy+34zrXTsyUREEJZNVr4MlM7Nezx0NDuib4xhaxBuYC X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2016 23:29:13.8046 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0670 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 60cc0f7..63e7d15 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -5570,6 +5570,42 @@ err_1: return ret; } +static int sev_guest_status(struct kvm *kvm, + struct kvm_sev_guest_status __user *argp, + int *psp_ret) +{ + int ret; + struct kvm_sev_guest_status params; + struct psp_data_guest_status *status; + + if (!kvm_sev_guest()) + return -ENOTTY; + + if (copy_from_user(¶ms, argp, sizeof(*argp))) + return -EFAULT; + + status = kzalloc(sizeof(*status), GFP_KERNEL); + if (!status) + return -ENOMEM; + + status->hdr.buffer_len = sizeof(*status); + status->handle = kvm_sev_handle(); + ret = psp_guest_status(status, psp_ret); + if (ret) { + printk(KERN_ERR "SEV: GUEST_STATUS ret=%d (%#010x)\n", + ret, *psp_ret); + goto err_1; + } + params.policy = status->policy; + params.state = status->state; + + if (copy_to_user(argp, ¶ms, sizeof(*argp))) + ret = -EFAULT; +err_1: + kfree(status); + return ret; +} + static int amd_sev_issue_cmd(struct kvm *kvm, struct kvm_sev_issue_cmd __user *user_data) { @@ -5595,6 +5631,11 @@ static int amd_sev_issue_cmd(struct kvm *kvm, &arg.ret_code); break; } + case KVM_SEV_GUEST_STATUS: { + r = sev_guest_status(kvm, (void *)arg.opaque, + &arg.ret_code); + break; + } default: break; }
The command is used to query the SEV guest status. For more information see [1], section 6.10 [1] http://support.amd.com/TechDocs/55766_SEV-KM%20API_Spec.pdf Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- arch/x86/kvm/svm.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html