From patchwork Thu Mar 8 12:48:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10267981 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 5A9BE60211 for ; Thu, 8 Mar 2018 12:51:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4920C298FE for ; Thu, 8 Mar 2018 12:51:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D18929902; Thu, 8 Mar 2018 12:51:29 +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 95AFF298FE for ; Thu, 8 Mar 2018 12:51:28 +0000 (UTC) Received: from localhost ([::1]:38468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etv15-0006So-R2 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Mar 2018 07:51:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etuzT-00052U-Ik for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:49:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etuzQ-0003pC-CJ for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:49:47 -0500 Received: from mail-co1nam03on0619.outbound.protection.outlook.com ([2a01:111:f400:fe48::619]:54942 helo=NAM03-CO1-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 1etuzQ-0003oH-2B for qemu-devel@nongnu.org; Thu, 08 Mar 2018 07:49:44 -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=FFCItbhe3z5LnOPkxBvVYDwqD9Hfm01bHo8CiUMEhsQ=; b=iw1+lsPMEhqRTXv2en1wFEJZAlBm5ElLlDDOduhbfdat47wO/Qgz3Cy/Af04JsMA1EiatG5VfWehteTqlHSgyxtyGMuMuLw0UyRRDUJA5Kmb+h8oUbFrzHmlTUILeGM+BivcHyj4qo8BJoCJOWCrLXEwD/zeeTSNMVpzHJ5PgJs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Thu, 8 Mar 2018 12:49:36 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Thu, 8 Mar 2018 06:48:39 -0600 Message-Id: <20180308124901.83533-7-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180308124901.83533-1-brijesh.singh@amd.com> References: <20180308124901.83533-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR14CA0031.namprd14.prod.outlook.com (2603:10b6:404:13f::17) To DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1eeb1508-edb5-4a88-0623-08d584f30e09 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM2PR12MB0156; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 3:4LK6U+kMkeaJwGkyMjsbcTZnxmTdOo80OY9e+DTK83Y8+i3cBHHsXxiJRAuzwpPadEfxydQtncVbS4z/q2L1ajAlHScIzVxRpNRjXUQES0nm+IBtH4hRfe4h0unzSIrgQSN/v6SRWf2rGbEihXSpRwtizwvHsg5HR1U5nmtR8mOsffaTkNyi4G9XlorPdnrivsxIBcaFBIvaSpKUtpbL7QGOELnrA9CFXQlH3tfGnyEOL21UX+GzPw+FNs477rPx; 25:zAWkF8JdxA8qme7sWMLaa/e3QBWfAaiWYkqf9y0cDLGfJh/m1YOo0FmX/RFZ0z2Mj9cJJkb6VI6ZlRz1BDmMFt1Mn3TM8M6S6uarkff6qHLARYJ/i+shfMumXunTAoYHU/hnwnbqwSO5gt4/39Xs0xXTnV6/+qoNQ8UYdsNHwBSsNyzEhMOt8kgfJZekEkiumdRJU+wXNx6Tc+dTqZwKJA1io4r6bf14OwGcHD8ykifKc6p5+o2jgziiKRBQjaklG7JFiq1ylZIPIxSJ49b7UYwSURgZjpxJPiATPf+TMAkuQKVV9DlvvZn12u7Bt/a2OYc7e8vRASc7WmGuIQfnag==; 31:8ZqRdbbzBCZllrFwi7QVzIgPa4oSJiQtaiB4MpcpVhWQhitsTymOTvBRXugaB213dmkLT9wjwUCiFRYbiY6hWdP93BMwGhesB/Gxu6Uc4I9BmxfQbDjMpR46DwT9o0MvSEQn37bpQipfge36gvpkN7IUohp/HjZj9yGRKbgjecAorXMlNB+65eN5lpWCREz2c5a+T96I/f5GssJcC9ufz3etCcscrvNtuX0nYx5hP5Y= X-MS-TrafficTypeDiagnostic: DM2PR12MB0156: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:ZuOdAnrjq6n66CbZTaPGM26yqalRPNQ/v9hiZ/rsrV6wtnofVkryygSiO4M3uaqIjQ2kcUiI/HxgT4jPlEOaXo/9dLBZMcTs2CWGYbi2sybR0rIoYWfxX81is8ibvpx7KdhfemAlNwtTSDrIe6oNrMS2ip1qijRFuzyCtrPJzFbAnEP5sC131K5QsEvN+klIYpABysIBQnjrV03D8PPaQ1zpgvUDzvl7TxXDq7pMQkmnbXjKzaJpvq+he22OjDL9mW+SLKtsVNItWOZ5nihXjBjMHXDUv4jFppz0oW83yB1DuFHTne2tcEsInY8doTT3kMW4NB0KQigQeJkrYMZ//kJ56hICVWLkjr8za1dwpckeWo89N/ZVB4CvavipQkDp4Qf3bHbO5ksqAGHLoHQ2PGQstsG4AJG2V9dqWfCmS0RUBHTiNth2zzGIAHu0as9doHfopMUY3W2X+xDX+f2yAvMjnqyCxdo1uk5/VM/LxXj0QlibFInki7CawvY/2RD+; 4:cVZCqeTy53nMAYCcheq4C2DbYClzCIUSjcV2SguA3E6b0j41GhgkXscfxInQGxC7RCytPN5ZQVcT2uKhwNaXPmGT+bBmUxsWOPlDu6kfSIExLxfy72YKTt0QgaeYz1+5fqupnR+kz+yrjYYe60jeBKtKc0v9JKM2AFzr6h1EoArVyFCEcGooZxUWwgFS5HydqgXWFchwJMDTw8COn8Z5UdMncnk2tc6qvZjg8MdwLdSHHbAgalYU9rJr7AsPzmsMiXq4hED2BF2Hnk7ygSGIAoMGgst+c5lWBeVWDpSZhS7dI560yLKvhpurhPuMh/Nes9uIAD9nfe+vnZEjsHcy853x+I5MYEDN6l20CvNmjUb+rVYCbXXm6KJYDgCJUz3u X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(190383065149520)(104084551191319); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(3002001)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0156; X-Forefront-PRVS: 060503E79B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(376002)(396003)(346002)(366004)(199004)(189003)(15650500001)(50226002)(53936002)(2950100002)(6916009)(2906002)(2361001)(2351001)(106356001)(81156014)(53416004)(8676002)(81166006)(7736002)(36756003)(305945005)(8936002)(105586002)(48376002)(50466002)(68736007)(97736004)(47776003)(66066001)(25786009)(4326008)(39060400002)(6486002)(7416002)(5660300001)(3846002)(478600001)(76176011)(51416003)(7696005)(52116002)(6116002)(16586007)(16526019)(186003)(26005)(1076002)(8656006)(386003)(54906003)(86362001)(575784001)(316002)(59450400001)(8666007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0156; 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; DM2PR12MB0156; 23:UtZX8Z/rWE7fqZ+VkYdt+xIqi00qk8JZxb/AuVURS?= =?us-ascii?Q?nJpEKd/VrMIsX8kJ8wdjQHYS65ORhFM/JPm1TAWHRfb0Ep2y6oAtE8miWVls?= =?us-ascii?Q?O0VvBeURxOUECGOkEEGOMdTWZsihfwIte/JcyBiOSJF+KEUhlmKU9nTaAulv?= =?us-ascii?Q?PFTA6VmNBzVQwkElthZ3ly8zpZPoc5ziscDAkG20hwbDSXoxhB2VZC2f2EGW?= =?us-ascii?Q?PGRRReaO4nR2Dyist6xG6uHwkyzAlTBuSIF9WgtTDEErVUk1PJqBZ4PvmVa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zmVQhSx574pJ//Uv/krSDoq11tKR9ZFQc1e84bUUCJlxf/vITyg=; 7:1Gpxpf5uHpJ4V3lgtStzZXe/tPn3QUnV7NKpX0fD3mLulj0Mw5mK5LjLqd49ajZSxbPAb4fy9FQZIfhyUxKUB8AwPtDFbrgs1dKvioRJNiTGSYPDt8QPgpGsBVo9HihfRHpZJuAso74WI0UJaeztGptyp82VqVFNsa28bNOjkVcn5rDtyIqbki82TUvMzyLrdVbRFWvRZ2jI2hGYiex8P/+IRt0239JULjTsSRg9LJWmkpGzLx1nX6NgENa+29/f SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:2SuWOB/l1q/43G+VIYhdz7C2AZkaIrAtOStEqnrG/tJIm3tNKBDOd9ndn/avD5HKn5OZDoYyLdcZhHh0W/deguXDbnm8zRhrXjQdxlhPH5y3PzulN2teHzdVNHwUwSFD8ctq6AHOFZcgE6knUieJS1IrcwQ4e3wXlXp++D8buc2ZZGfPxq/6XKqCG2x3QbUmn7/XiV+hQYarc3WT7bgKGBekN1NuRwXrDB/3Fg/CavNHidzIuYsGRImRjPGuH6BU X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2018 12:49:36.5497 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1eeb1508-edb5-4a88-0623-08d584f30e09 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe48::619 Subject: [Qemu-devel] [PATCH v12 06/28] 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: Peter Maydell , Brijesh Singh , kvm@vger.kernel.org, "Michael S. Tsirkin" , Stefan Hajnoczi , Alexander Graf , "Edgar E. Iglesias" , Markus Armbruster , Bruce Rogers , Christian Borntraeger , Marcel Apfelbaum , Borislav Petkov , Thomas Lendacky , Eduardo Habkost , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Cornelia Huck , Peter Crosthwaite , 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)