From patchwork Mon Aug 22 23:29:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9294655 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 88C72607F0 for ; Mon, 22 Aug 2016 23:30:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7847128B03 for ; Mon, 22 Aug 2016 23:30:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C41D28B0E; Mon, 22 Aug 2016 23:30:25 +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 535FD28B08 for ; Mon, 22 Aug 2016 23:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933019AbcHVXaG (ORCPT ); Mon, 22 Aug 2016 19:30:06 -0400 Received: from mail-cys01nam02on0064.outbound.protection.outlook.com ([104.47.37.64]:36177 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932578AbcHVXaB (ORCPT ); Mon, 22 Aug 2016 19:30:01 -0400 X-Greylist: delayed 337 seconds by postgrey-1.27 at vger.kernel.org; Mon, 22 Aug 2016 19:29:59 EDT 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=gz5Rr3ObRyGijrpXsZMUFcqGhFINygVcZswsu4JYkO4=; b=hUQN1JzzCbPw/QpPGCLuhwHJSBVdZ0BlSMj8zX9yIooYQjfO+LPaGVhg5IsgnDhjMIiYAieS9NbxojnNfaOcHONxSwoP9mA6xqR0bOLe/FXIBG0nVXfbSy4XUim84h/IgD2FxFuEuKgd+6LlPjcZmhPXb6PWHuN+8/by+lLOl3c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [127.0.1.1] (165.204.77.1) by CY1PR12MB0665.namprd12.prod.outlook.com (10.163.238.150) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Mon, 22 Aug 2016 23:29:49 +0000 Subject: [RFC PATCH v1 28/28] KVM: SVM: add command to query SEV API version From: Brijesh Singh To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 22 Aug 2016 19:29:46 -0400 Message-ID: <147190858654.9523.6224226679168122395.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 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN1PR12CA0001.namprd12.prod.outlook.com (10.162.96.139) To CY1PR12MB0665.namprd12.prod.outlook.com (10.163.238.150) X-MS-Office365-Filtering-Correlation-Id: b20ff69e-4e8b-4560-8fee-08d3cae436c0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0665; 2:AHeiTdixy/FHizfB9fbgOal9E+nkywZahgoWdhGqlsk7mIN7iV30lFovCAiT33JMsXEex+YZ+QgierlyBqztm+L27msHd2ZawVwkQN8e5YAApfUNrCk3lRHQAC7S78U7Mv5F74pXZRIsqEzjP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vrwJ1SJkyssqsMDzqfDWcMKl732FcAZDmIRBoXdqZrxfdeqZea78ciJS/pMGoozk1bdKaDdXhev5oTW7JOTZcDwfQxSOG9pUrTTKqHxBDfzymyJ1XPbwgCkgxgcwWQHGHkrydjZ7JlQYxzbeEX0zHwFt2DEbjMQ88teXJWIbKDajYJvRgxOxacdXCULCcYD7GLO8Qevl+TKFMtp/h7OGg272SPAy9A8nW5fZkJ1ArKSd1waLFKaIGjaUxYAMsVxDkTgnEtK1Tn0Zoz0TKItWbhuLPxzaqln5QF0v6Rx6ff4qd13DEbm/9yv9v/cEWdLsT3edW9pNrnPgzZXj0Luw2IO99L458FFmMZTkG9nzjF+VBHjQ7tFQMExtAJ9 X-Microsoft-Antispam-PRVS: 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:CY1PR12MB0665; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0665; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0665; 4:4Je3uS3ANUMaL2WC6dVjETn0O8egD+Cvs6cLSB0KfIkyOlg7zy4azK1hehkwUIQVIQhzdwvlJIzzGl9djyAB3nSlWTqWnX5h1dUxy6NHKV4Qhr5PxnHRkOl3m/v7TLqvHEg6qlG+q1LqSTddu/mlgw83FSv8UmHs48SK0bCKI0AcPP4kVsIPEdND0suSXIQqQG050/GDVwkPCulJREx3nLnbkkSEcBkE6a4D5Gl1y/lBv/5k1kr3A7Av4RvdVlQOcwzvajiD7KM9TU2Ouk2be5zpQtIcDPuuZYyxAaaM9yjni/cC8YDSqvHHqOEm6CnuQQVsNlXR98QXGu1nrxctJGFc+flgobYJGt1PVBG7tL8eUbjYWoCiKiE7yAwMtkaaCPXfuVwzoz9fBt9it8N4xrTsGhnO+9kkzCgSkvDbpjYD4/spnQ5jI6nl2Id39iIp X-Forefront-PRVS: 00429279BA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(189002)(199003)(107886002)(50466002)(189998001)(4001350100001)(42186005)(19580405001)(33716001)(5001770100001)(86362001)(47776003)(97736004)(101416001)(229853001)(23676002)(54356999)(7846002)(50986999)(76176999)(8676002)(7406005)(7416002)(81156014)(5660300001)(2950100001)(81166006)(586003)(2201001)(19580395003)(105586002)(3846002)(7736002)(305945005)(83506001)(92566002)(77096005)(66066001)(6116002)(230700001)(33646002)(103116003)(2906002)(68736007)(9686002)(106356001)(921003)(83996005)(2101003)(217873001)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0665; H:[127.0.1.1]; 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: =?utf-8?B?MTtDWTFQUjEyTUIwNjY1OzIzOnB3Z20yaXhaUzFoYzBJdkxBYmlya3JhT2NX?= =?utf-8?B?bHFiY2dFZjg2N2NtNWgxWGlQODZ6RVFhcTliK3U4NFVFVSsvYU10dERyNWpj?= =?utf-8?B?UFBoc0wyNFNLR1h3WFN5RDZVZVJsS3Fpbml5M0c1VWdNMjNLOUJxS1N4YkJ4?= =?utf-8?B?Zml4ZTJHa3NmMmN5blAzUW5iV2w5ZnhMQzFSS05EOGZvV1ZXcC96YjlxV2RJ?= =?utf-8?B?ZGRaMFNiN0F3U1grRzJDWmdtclJkc0paUUdRWkR4UFQ0VXJFS21yRlIxL3BB?= =?utf-8?B?ZnQ0U1c1RWxQZHo1SG8rOGhGZ01aRjZrNld0L090dTdHYTB5S3hocmdiNm5H?= =?utf-8?B?MUlxeU1pQkxGODQxVTFsaDJTaE1USXh6dWlhdm01VXB0VE0vTkxGZnVFOHFx?= =?utf-8?B?ZUxLRzNUdVQ2NlFWK29sUVlNRWV6TkhVRDdoZitBMnZPNEFPOFc4RlBxc3k2?= =?utf-8?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8g==; 24:58e+yA/AvOUqnNAHos5Uu9Hb/PReCzS/fgJigwAKimwlVDjY05iHboWvcsTv5bsPW6m39xGI2coj0Rwz0Xju6MuWOnMWGpb340QPuuhPRlo=; 7:z5cbT4S7dyJqA6v6uKCx/GrMgxC9pw4TgE50LZ889fyp+/7cUIgKlEzFgyLbCMvkQjttzqxY0MYIOjIPMuMz5e67XrLZrrH0na/gYXJ/IDvYL+lVpCS6W484vh53aHgu/NUqQN2O3DGbn1g/oinr1j54/UUBkPOAcoq5VSl05XjHSmzJS2SdvSx8EPGTKj/hKpN6Lz3vQdc8CZ3vFKgpXCD33k9Q5/uEKF8oqfpF85EaIWBFLVvCo+VQ9cfLB8cK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0665; 20:ePc+F3cePvjqVCPDqqbOU4vyZf9mK9u3YODzQwcg2O9JFfXCw7/w2vTBxdTaTHnKA1wpOxwDoPyjOs6x5arhRTLkvf4tltgGaPmMB5mvApUe2ILWn+mgO7WkZ0doMrCOWajxV8mOu/8fzu5wTLKAKhJuyoQbhWXI4bCAocReI5/f2+CfZE6WTf2A7XD6Hbv37mx1TyN5J8VYIeZpr59nxGZGQvVV6tOaUmcozvSy7mPI2ejPa21NRf2s4cJyB5Yb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2016 23:29:49.1230 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0665 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 4af195d..88b8f89 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -5779,6 +5779,25 @@ err_1: return ret; } +static int sev_api_version(int *psp_ret) +{ + int ret; + struct psp_data_status *status; + + status = kzalloc(sizeof(*status), GFP_KERNEL); + if (!status) + return -ENOMEM; + + ret = psp_platform_status(status, psp_ret); + if (ret) + goto err; + + ret = (status->api_major << 8) | status->api_minor; +err: + kfree(status); + return ret; +} + static int amd_sev_issue_cmd(struct kvm *kvm, struct kvm_sev_issue_cmd __user *user_data) { @@ -5819,6 +5838,10 @@ static int amd_sev_issue_cmd(struct kvm *kvm, &arg.ret_code); break; } + case KVM_SEV_API_VERSION: { + r = sev_api_version(&arg.ret_code); + break; + } default: break; }