From patchwork Mon Jan 29 17:41:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10190275 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 86CA960388 for ; Mon, 29 Jan 2018 17:49:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CCC625D99 for ; Mon, 29 Jan 2018 17:49:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FCAD251F9; Mon, 29 Jan 2018 17:49:52 +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=unavailable 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 01C39251F9 for ; Mon, 29 Jan 2018 17:49:52 +0000 (UTC) Received: from localhost ([::1]:53690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egDZ1-0003qy-52 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Jan 2018 12:49:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egDRV-0005ck-R8 for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egDRQ-0003OV-Sy for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:05 -0500 Received: from mail-dm3nam03on0043.outbound.protection.outlook.com ([104.47.41.43]:6400 helo=NAM03-DM3-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 1egDRQ-0003Nz-LW for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:00 -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=bv9dD38Hi2ZJVpK1Ti26yayRzMsB9n4y8krJha8CSr4=; b=mJEWvavxqiFOamgATNtoQku48Elg7ElXyolgI5AmwQKTo+1nkUyJnTWCMIfIDdL2J0PfEJc/c7Os7x0e3rqT4bBOa4VLujFQr1Jr3NYxKZiMAp5PU781/7Pe/n+h0T2Z2O9oN0xZRh4bKGTj9j/teDJ7214ap8b18bxZbEpMIVk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 17:41:56 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 11:41:16 -0600 Message-Id: <20180129174132.108925-8-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180129174132.108925-1-brijesh.singh@amd.com> References: <20180129174132.108925-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR17CA0018.namprd17.prod.outlook.com (2603:10b6:404:65::28) To DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9398ab5b-e4f3-4b4b-330d-08d5673f988f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0154; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 3:4wHEBx/UNy0156eeFcwTBT/d5glOYIShLpWB56Aco5RNnEAWtOVH/YgpXAW+XKZNs2KVy66Y8Sb0pk86Zrvczl98ACVtM5I9YnATfUD6vmNS7ppPnHRy1S2+JEeBheAEsWI6ILPHv4q9y+jiwOfmL2KG9CymVHrlQu4xVtb6CGL1Z3XKwNl5q0W1n/u6m0zcWt9JW+MsfVrIdKbOm4ze1gg8UFFagApbmKQn/AIpmJ/OKJlwfZPawpgcPkM3dusr; 25:FOV6RbHX98uJkkJH0VExx2KlWd6d4AyHe97J6VGIbal3Udd1bpfYXPzvaZS6SOf8HMe9dENIr+/UTYMyB/Q8bvxJ8QwMlkStJ1L6YmpCxPh/7Gk4nWF3QxwuzlBmMEJqgXeiY9wpoGPUqa008b21qxoYp+MHmxlUa2VGBRrvzjQR8fUFEvn9ZM3IEeoNxfmJ0cleixgvfSTjY90kOoGl0Wy1Prb9TeyozGcOiO0pPAZ4daJrnJUBGuF//VjEZdDI8X7lueZ7zmMl4Rns3wGbBAak+ivpuVQnU6VZW3gZQFaa180azg1on87O4mPzHA5p+hmoF8SRb+vMgt3DX8pgRg==; 31:BYSZQjAdnCMLdXUwmXrG8aaXVWUtTg/wnBOI4zB33hurZuxbGJwmYdW/3yX+eyufgAx+WXJVvdv9sQhs31kHYGgFo1MyEPz73k/YjuyDhNvt0oC/ndnHgFahiV+PGFsGLO0CENAY+VVkZcE5vNQfne9sJeisYqRlPj1nfwnXs29BO9XiTzfISsu3pxRTchLoboYf+5PXL37QoIQZlagTNvmgB/HhEm0XWWE1fPc6DFc= X-MS-TrafficTypeDiagnostic: DM2PR12MB0154: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:219krUL7vi+dDxL3dLfEo9sh83cX746mgeBZtP6rs6qV9OUrXBBUzIM5NPPjAB0OwW7ccqBK7/SBqCKLu6Di/agu+Jr19MekdIGOT/UrDcUrF3R4nhDfybYQ3Hw5Z/upvspu5qwYW9ZW4z5SuPDk9A0SxX0ND5iAnKmy0ELRuBkQWioyfVF7jykpsntve8D0Iz6LJnz+oQxKKiO9xKEreTSU3T5MPAPYSxpKtAGxGVlOSsBTf+BDZe3e1WG67QX+ltSc7/ZRWNgOSkl004SXPGeHQ9CSbYSkPkfiGaWC+OPVFQfVf4TSYi17xbqEPcu26y9nYzHnTjx8HYbBZe4ACK5VGjtZ/zVQ7hdjKvDU5DongKEXwUO/nvAD2dimX3qV63+OEY49ottwYs3noELX02I4nSveKb+sxxP55xi+o2hflikSp7eH4jpyY011RMkjQscEc+JABKgTK1yEZNnhr+T7xM7Yk+niSxHRxm03H/lNN5i8kZvKX9RlF7RmJPqm; 4:1enEtL7taj0efcme1FRXcOkDsvULeObHxyfQTc5kei13fD2wk//4yVCXSmEdsnB2vZG+ZLYFoo2xs9YTGfGtfbaFVhbo12doLnUZWwpwxLWA9sGHoM+hKBaGopNUp5aTYRK00yWUAtvmiHe7kTQhGlY/InWNkps8Voh/ShwhKrcJZw98yplZEOk/+mfVsoOM5gtUntsgiKITbz185wlPh+lNKA07j2ZeU5C8xn26Skci/RaJ5YHpv4T4kCCc+IJO4fICMKyYzjGPuGESyOxZDqwgR2B9sxHaKz9m6L4X8JPrmbsAj+4RwFNPTsL7txPZPBUEnESKe/kO9ysoipN9zS4h/z7W6qG7vn3DqpdXye7hQzNBqKWwK+/WMSXvlCLN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(190383065149520)(104084551191319); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231101)(944501161)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR12MB0154; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0154; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(39380400002)(396003)(366004)(346002)(199004)(189003)(48376002)(8656006)(39060400002)(4326008)(6486002)(68736007)(36756003)(478600001)(26005)(97736004)(16526019)(15650500001)(53936002)(386003)(50466002)(86362001)(575784001)(25786009)(8666007)(16586007)(54906003)(186003)(47776003)(59450400001)(316002)(7416002)(305945005)(7696005)(105586002)(106356001)(76176011)(51416003)(2906002)(81156014)(66066001)(81166006)(8676002)(2361001)(53416004)(3846002)(50226002)(52116002)(6116002)(2351001)(1076002)(8936002)(7736002)(6666003)(6916009)(5660300001)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0154; 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; DM2PR12MB0154; 23:mqDH4Hxm+eFlcBCc7zcZdinlJSxYoGZwDXhueQkbL?= =?us-ascii?Q?CkNzgp8qcKtEx5ukL+ShsckKeotlVUNitwbUvdv3v2BUtVQ21ir34ZXPshHl?= =?us-ascii?Q?kfBZLw0c1S/jXl6PIXse2KiVXjvlYN3jqQ1PccbG8Zg9iGKftebGFuycEWNw?= =?us-ascii?Q?lyTZo5W6h6zj0isAW+I96oez2C3oQOCXRnGHDHEw/Q8JW9NoI+QSlJ33hKIZ?= =?us-ascii?Q?/FrAFSGjjBPYGa5ZPaZdg1It5NzRUi+K7Np5NGZOCmpMOpZVI2kKHVD+1Vo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7+J3dBYUcZ+7g0NEjDDp1CyFTkX/U0bdVDCHP1W1+2ExxsfISP0SnQTY/RuD5ohWQkCYaAha+0qRRohQMgIPsWePI4zsvGqiKLDbe6VS1JMK1XETZ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:bPHGa4bngMVK9Np/iJNdnHjVGuInhwsxTJAeeKI0jJBMd+fqy1HgnrqP00CaKqSh2BKdduimLWbOBp002gDNJnBtLCMM+/DF8/k+bgG6MsY20gwnLLf5qtrE9twzRsBPDZqwUfoY7+FyiLIfD9WMhVzl57jjHtol2gFwkWQv5p6U5bt7iw35VQY6/aEtK5CG2hwl0SI1tRUt7LFJite8x+Fgw/u4bv2mexpJ2q0BzCmXYbhfm3tc4Di1F4Bj2GxB X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 17:41:56.5259 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9398ab5b-e4f3-4b4b-330d-08d5673f988f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0154 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.43 Subject: [Qemu-devel] [PATCH v6 07/23] kvm: update kvm.h to include memory encryption ioctls 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: "Edgar E. Iglesias" , Peter Maydell , Eduardo Habkost , kvm@vger.kernel.org, Tom Lendacky , Stefan Hajnoczi , "Michael S. Tsirkin" , Richard Henderson , "Dr. David Alan Gilbert" , Christian Borntraeger , Brijesh Singh , Cornelia Huck , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Updates kmv.h to include memory encryption ioctls and SEV commands. Cc: Christian Borntraeger Cc: Cornelia Huck Cc: Paolo Bonzini Signed-off-by: Brijesh Singh --- linux-headers/linux/kvm.h | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index d92c9b2f0ed2..aed22309950d 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -1362,6 +1362,96 @@ struct kvm_s390_ucas_mapping { /* Available with KVM_CAP_S390_CMMA_MIGRATION */ #define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log) #define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log) +/* Memory Encryption Commands */ +#define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long) + +struct kvm_enc_region { + __u64 addr; + __u64 size; +}; + +#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region) +#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region) + +/* Secure Encrypted Virtualization command */ +enum sev_cmd_id { + /* Guest initialization commands */ + KVM_SEV_INIT = 0, + KVM_SEV_ES_INIT, + /* Guest launch commands */ + KVM_SEV_LAUNCH_START, + KVM_SEV_LAUNCH_UPDATE_DATA, + KVM_SEV_LAUNCH_UPDATE_VMSA, + KVM_SEV_LAUNCH_SECRET, + KVM_SEV_LAUNCH_MEASURE, + KVM_SEV_LAUNCH_FINISH, + /* Guest migration commands (outgoing) */ + KVM_SEV_SEND_START, + KVM_SEV_SEND_UPDATE_DATA, + KVM_SEV_SEND_UPDATE_VMSA, + KVM_SEV_SEND_FINISH, + /* Guest migration commands (incoming) */ + KVM_SEV_RECEIVE_START, + KVM_SEV_RECEIVE_UPDATE_DATA, + KVM_SEV_RECEIVE_UPDATE_VMSA, + KVM_SEV_RECEIVE_FINISH, + /* Guest status and debug commands */ + KVM_SEV_GUEST_STATUS, + KVM_SEV_DBG_DECRYPT, + KVM_SEV_DBG_ENCRYPT, + /* Guest certificates commands */ + KVM_SEV_CERT_EXPORT, + + KVM_SEV_NR_MAX, +}; + +struct kvm_sev_cmd { + __u32 id; + __u64 data; + __u32 error; + __u32 sev_fd; +}; + +struct kvm_sev_launch_start { + __u32 handle; + __u32 policy; + __u64 dh_uaddr; + __u32 dh_len; + __u64 session_uaddr; + __u32 session_len; +}; + +struct kvm_sev_launch_update_data { + __u64 uaddr; + __u32 len; +}; + + +struct kvm_sev_launch_secret { + __u64 hdr_uaddr; + __u32 hdr_len; + __u64 guest_uaddr; + __u32 guest_len; + __u64 trans_uaddr; + __u32 trans_len; +}; + +struct kvm_sev_launch_measure { + __u64 uaddr; + __u32 len; +}; + +struct kvm_sev_guest_status { + __u32 handle; + __u32 policy; + __u32 state; +}; + +struct kvm_sev_dbg { + __u64 src_uaddr; + __u64 dst_uaddr; + __u32 len; +}; #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)