From patchwork Sat Oct 7 01:06:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9990989 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 2ED0660244 for ; Sat, 7 Oct 2017 01:06:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2033C28B20 for ; Sat, 7 Oct 2017 01:06:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1518228DAF; Sat, 7 Oct 2017 01:06:27 +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=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 125D328B20 for ; Sat, 7 Oct 2017 01:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752685AbdJGBGX (ORCPT ); Fri, 6 Oct 2017 21:06:23 -0400 Received: from mail-sn1nam01on0081.outbound.protection.outlook.com ([104.47.32.81]:49120 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751869AbdJGBGV (ORCPT ); Fri, 6 Oct 2017 21:06:21 -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=qoZ4n3qtKDwx4Za9S+bVHQT3gbkSxc1OoyDQ3Z5AcPI=; b=sX05Zhnbxq99mjJhlmK0z8ms++FWHK9ldgftVDfuCDYBiBOj8iJ60SC8IXjc+UFXiv5TwYPu3HnvPetYfC12VZ8eN+OfvWi0Edus1EJY9v915pX3gxHGZjnduFYGn7HwAyMr58asa1sXqWtStSdQ8wySpdffBx5iKEQIU2b1ZCY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from ubuntu-010236106000.amd.com (165.204.78.1) by CY1PR12MB0150.namprd12.prod.outlook.com (10.161.173.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sat, 7 Oct 2017 01:06:18 +0000 From: Brijesh Singh To: bp@suse.de Cc: Brijesh Singh , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Herbert Xu , Gary Hook , Tom Lendacky , linux-crypto@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [Part2 PATCH v5.1 12.2/31] crypto: ccp: Define SEV userspace ioctl and command id Date: Fri, 6 Oct 2017 20:06:00 -0500 Message-Id: <20171007010607.78088-2-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171007010607.78088-1-brijesh.singh@amd.com> References: <20171004131412.13038-13-brijesh.singh@amd.com> <20171007010607.78088-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0085.namprd12.prod.outlook.com (10.161.151.157) To CY1PR12MB0150.namprd12.prod.outlook.com (10.161.173.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa52b772-0c93-47df-8f17-08d50d1f9dd3 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:CY1PR12MB0150; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0150; 3:ilafPzINoZJWtLjtzFOFfXhjYndLUXQg6eSbBYyrjHbLTSuqT1i9PyyytKVz1Lyp3yJGCi7Y7iZVyiXD3ksnmB6IxWKwldkI14owSzQORSXLUPRaECooXtsBpNhk4rY0bQCyOISDChpVfl4a/8TP16Y3kR5ubilgDq15TJw/0EHaTrn+cbO1ppiojXMTmPie8do5RxNQM3Ip0qcz7UwY25Z9+beTNRihotRjtA70hDBUF/T9kxjcb3CX28XL+pXR; 25:B0QT7BLC44+ShvnCN21XUm1KFr7YFwsX4gbF3As9eOZiVss2Zkv0dr6pBLg+YZ5S3hJAXvclmrNobKO6BXCbcbnCUyugKgVJDzAW4MW+rZ1gW1PPR7iA8THQaqvWF4SqNXX7vSJnRyGY3MpMb7/DrK0itQvuYq8oCFEajKczxMJk1AO4exjjrN+os0lzZpHDuqonJTCuE82JTgvLSSt2RcompOkxH3nXAB6ZN7GD/Bsq997IG25ReWXBvHpv+xQaTDfil2j7MjKnKq8xrs89+rrpfeDsiaxTGpJnQ15WWtkN3rka4YOxcjIbh/wecLPeNIK1wiDZ5myJvW2MIX5lMA==; 31:LO5p9yY67+KbmfnJyD8pRROhQjHQQyxM1HAQBmxoMYxLEa0rWspCSJUN4qGJw4cigiTlV39jfxIM4TWgWEOKUSfeIMSX0SKVsI5DuJuYC1nyWbHBHjQGHFIrFFGvyAuQWYK3HPPN0A9o+Ahy4nKd7bVNbXSAdlCo5+WlNpMUc+qeV718vWe8brDY34MiDETOs2dijaA0Y/9gmaFeu3cZcD6HcD6eaBx1RkO6QWNJK/k= X-MS-TrafficTypeDiagnostic: CY1PR12MB0150: X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0150; 20:vL+KMKQb/lJjwzpRCKE6grnCCjLt95oCCVu7rU5xRBn7F2e2swqFjDHsCyFg7FgPTU63Xf8hcFLAoPiP/dlJJAeovGyF5do5Frlik50DhgIh5jg2c/XlPN/BPk+3Pvrf+Xnr6oIjIezjU5b42ynsAZEU2p0SFmamSSD+4in54Wkmsd0qZlHtkPpHbVKjlqF9W86a5LyDVuJ9lAHOm1Jzpx27uBm+U4DKK/5qURtdhEystT0Na8AoxqlwnD1l0vfx+Y4J9KEQiAnSqnqbGrv0DpwZCuH1VSkxnwSxJqWr7OrxRg2RTm0m6I0zRZgN//eJXiDYTEgntnZVR4LMPhaz+X+tRg76Vnth9TzaLJ1OeHb5Nfu22+QnkxE7la/QXqS+Q/J6hGM8xZom1waxSnp2M+90/aUfmoV1lubE+Xh+6dsQK+54jGASRgAB8n3/FXehdAeJ4MFSLoqb0InuxAdyd4H6dsEhmSYZBH+J4mJHRDoKesUN2pyFHIInAYlOoVQR; 4:KFXCaP0DLj+P7HCDP60zduzuN0Rtyxx0DwsGyXtbrAOrzfx91tx8n6nDRXdp18exoHDLVrL5y5ilZLp3fTlnFY92Xxp5XW1gHsrJyyY9U1foCppBYQeAtMmbM37h8HhUmiDYCZmMCF1sQ4BhGrC63flO8Qr/jzIdenxjFIRapDVm8MGKBgWmMpYuZ4fYb9tYuMyb4K1b1suScHzWw9ywYPfFUESdO8Is1Qpv9TRz6z/x8V0khSROR1xolXT4ioqx+oQ2WhH5N3Q7PUQbrsri3mMhjjR3oG3odYeBN3DSo5D8fIF1eB2vzJuyVVqwPDNR X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123555025)(20161123558100)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR12MB0150; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR12MB0150; X-Forefront-PRVS: 045315E1EE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(5423002)(199003)(189002)(966005)(6916009)(53936002)(316002)(50466002)(36756003)(6486002)(25786009)(4326008)(2351001)(16526018)(478600001)(5660300001)(2870700001)(2361001)(2906002)(6306002)(47776003)(54906003)(53416004)(6666003)(86362001)(76176999)(6116002)(106356001)(3846002)(105586002)(66066001)(81156014)(50226002)(68736007)(101416001)(8676002)(97736004)(305945005)(1076002)(33646002)(23676002)(50986999)(8936002)(189998001)(2950100002)(7736002)(81166006)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0150; H:ubuntu-010236106000.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: =?utf-8?B?MTtDWTFQUjEyTUIwMTUwOzIzOkw0bmlXSmxmQnNmNDhETW85akdFQ3dwYlJ4?= =?utf-8?B?RXZodzZucGlzTGFNL0sxWE5oT1hUYlFLZ0YrZ2tiRzJ4NFJtWE9UNGc5dWNh?= =?utf-8?B?Skh3cjQ1OGZxR256NWdvUXQvUlh4ZmlPekhIajFBVXdCMXhzcVNsYWU1RGdB?= =?utf-8?B?dzRLRzBHdFJKZEpIRHB6OHJMVklBWHY2clo1L25aRiszN2tnWHVpRFM5NHBT?= =?utf-8?B?aVVoRHd2ZHNRZE1pYmVoY3BNcTA5d3E1NG85ZDhwelhHbG9kYzk0amJsa0lo?= =?utf-8?B?RXZhOURtYStncDJ1SkNaT2pucllGZnc4eTRESjAyK2tOQ2R2MHBMelRnRDVs?= =?utf-8?B?RnFCWWhCUEJVSXpTWmcxdUtidHk0RXk0Z1UzNmIyV1Yya1JXZlpWSm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chme4TCtk/pS3u3PaH+vPGucdHMRUojCGgUpQt0V6BC6CFf+7hVtRFK0rFov93hi0dDhNlbIcqxhmNs1EHYuO6gDwUAPtX4s+p1rwgkHxTOY36npOsf43PgwBvVmC/Xkx80ojSro4wRMZuFph6XInquKw7qaDBs7h3tosK3MSc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0150; 20:F0xu7w7QTpBcsISMlI0wzNGIHA9e2+MXI/KVTKao7PIjhLFSfNx0g/1JI//BS+twwFbgHQX6/VG89MSotmBUQW5I2D7CXxAzenrTPUP1OpyWoGRoniPRGw5dmxRnD8hTs3C+aEYRjVaT0hxMApAIuSw8aMd46glqJKD8lYuWR2vnB7mbZl05qdm2ysz10fVk7IGA+u0naGEgYKIs8DCDYbObm8CBfuaoNl8rsHJ5CRtCCKwtgoY6TwowUv/1JtYi X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2017 01:06:18.0828 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0150 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 Add a include file which defines the ioctl and command id used for issuing SEV platform management specific commands. Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Borislav Petkov Cc: Herbert Xu Cc: Gary Hook Cc: Tom Lendacky Cc: linux-crypto@vger.kernel.org Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Brijesh Singh --- include/uapi/linux/psp-sev.h | 115 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 include/uapi/linux/psp-sev.h diff --git a/include/uapi/linux/psp-sev.h b/include/uapi/linux/psp-sev.h new file mode 100644 index 000000000000..a385bf2b8d2a --- /dev/null +++ b/include/uapi/linux/psp-sev.h @@ -0,0 +1,115 @@ +/* + * Userspace interface for AMD Secure Encrypted Virtualization (SEV) + * platform management commands. + * + * Copyright (C) 2016-2017 Advanced Micro Devices, Inc. + * + * Author: Brijesh Singh + * + * SEV spec 0.14 is available at: + * http://support.amd.com/TechDocs/55766_SEV-KM%20API_Specification.pdf + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __PSP_SEV_USER_H__ +#define __PSP_SEV_USER_H__ + +#include + +/** + * SEV platform commands + */ +enum { + SEV_FACTORY_RESET = 0, + SEV_PLATFORM_STATUS, + SEV_PEK_GEN, + SEV_PEK_CSR, + SEV_PDH_GEN, + SEV_PDH_CERT_EXPORT, + SEV_PEK_CERT_IMPORT, + + SEV_MAX, +}; + +/** + * struct sev_user_data_status - PLATFORM_STATUS command parameters + * + * @major: major API version + * @minor: minor API version + * @state: platform state + * @owner: self-owned or externally owned + * @config: platform config flags + * @build: firmware build id for API version + * @guest_count: number of active guests + */ +struct sev_user_data_status { + __u8 api_major; /* Out */ + __u8 api_minor; /* Out */ + __u8 state; /* Out */ + __u8 owner; /* Out */ + __u32 config; /* Out */ + __u8 build; /* Out */ + __u32 guest_count; /* Out */ +}; + +/** + * struct sev_user_data_pek_csr - PEK_CSR command parameters + * + * @address: PEK certificate chain + * @length: length of certificate + */ +struct sev_user_data_pek_csr { + __u64 address; /* In */ + __u32 length; /* In/Out */ +}; + +/** + * struct sev_user_data_cert_import - PEK_CERT_IMPORT command parameters + * + * @pek_address: PEK certificate chain + * @pek_len: length of PEK certificate + * @oca_address: OCA certificate chain + * @oca_len: length of OCA certificate + */ +struct sev_user_data_pek_cert_import { + __u64 pek_cert_address; /* In */ + __u32 pek_cert_len; /* In */ + __u64 oca_cert_address; /* In */ + __u32 oca_cert_len; /* In */ +}; + +/** + * struct sev_user_data_pdh_cert_export - PDH_CERT_EXPORT command parameters + * + * @pdh_address: PDH certificate address + * @pdh_len: length of PDH certificate + * @cert_chain_address: PDH certificate chain + * @cert_chain_len: length of PDH certificate chain + */ +struct sev_user_data_pdh_cert_export { + __u64 pdh_cert_address; /* In */ + __u32 pdh_cert_len; /* In/Out */ + __u64 cert_chain_address; /* In */ + __u32 cert_chain_len; /* In/Out */ +}; + +/** + * struct sev_issue_cmd - SEV ioctl parameters + * + * @cmd: SEV commands to execute + * @opaque: pointer to the command structure + * @error: SEV FW return code on failure + */ +struct sev_issue_cmd { + __u32 cmd; /* In */ + __u64 data; /* In */ + __u32 error; /* Out */ +}; + +#define SEV_IOC_TYPE 'S' +#define SEV_ISSUE_CMD _IOWR(SEV_IOC_TYPE, 0x0, struct sev_issue_cmd) + +#endif /* __PSP_USER_SEV_H */