From patchwork Wed Feb 28 21:10:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10249819 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 32F3660212 for ; Wed, 28 Feb 2018 21:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21903286F1 for ; Wed, 28 Feb 2018 21:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 161FF28DB9; Wed, 28 Feb 2018 21:15: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=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 6C629286F1 for ; Wed, 28 Feb 2018 21:15:24 +0000 (UTC) Received: from localhost ([::1]:46971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er94N-00053U-KS for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 16:15:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er90A-0001CP-K4 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er907-0005a2-IN for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:02 -0500 Received: from mail-sn1nam02on0055.outbound.protection.outlook.com ([104.47.36.55]:37280 helo=NAM02-SN1-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 1er907-0005WK-95 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:10:59 -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=e1ZsnuNgZ5l9g7kDvigBzuQ/3sabovU7I5pL+BoBWu/McmrTZzm7q2ek/dCif/KtC8oHQnceWSrnb5eJBkktrGjDY+ys+wbBd4qKT5LA6mrOz6uptHxKK2nfIWuOYSIdrKeEDgyiTGOELHnjc6CFkqeoO/ghn1nDaxWxODfpKPQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 21:10:56 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 15:10:06 -0600 Message-Id: <20180228211028.83970-7-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228211028.83970-1-brijesh.singh@amd.com> References: <20180228211028.83970-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR10CA0008.namprd10.prod.outlook.com (2603:10b6:4:2::18) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c44f2bfe-6afd-4a06-40ee-08d57eefc2e9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:/cMauwqCjAyl3F8C/PKK+s06iXxO4nPpCPK3eAeEEKlS0WfQRgP7ue1pZ2XIUMPPo8h/Ipwl8NHJ48qiA4CPSmbk6MeqEVq5F5yO6Svb+8moUQXcSu3YJlv3TJAaPx5+Q+suEbLm+sLDndNZQ0fe9RzWYlLo+VhuYNFPMa7Qa98i8IWwkm91HCoWKvOWcpr9EbR2qLSYcCvfngoqVC7RZGZ8aAV1Zl56A2ZpcQv0TIjL3CyBYT7BXUembhUO7OH/; 25:xs/GC0Cg+ptnmhfQv7mLKTswZuSIlmSiwgyw3skXRL9VGyCnEQjqhpwvE1gZCDfsjV2Xi9a8XWRMR5FT8N0GQskdlzzQyLAh41qt2bB9t2NU1WI2+LPjntJHMU45j49V7Mqqp2IygQD/LBrepAiUYhZFn9r7K9vadMb//qxrLQJNB2rrEeqeS3aqGB4Sp+jOhFMOI8lwf2oZp82+PUkWCE1vDNCDQzSAZBcLuAtP43h8FDUG03we5AwkUba36HOmzPSYuTfZnQPzzNCqtCBLu8Nbyh06uYDYsWknXnj7+F0qGyuD2nHjIMZ9LmA1C9PBHYZ5HHidvt0BAH2ZlMsEmQ==; 31:bA8bjz9GQACbknusntU5i2CVljHei18rWi/cCtStY6UniG0CfQ4dd7r9br1V9o6VA90d8hGl8YDaTxQI87SSrbatx8DP8vcep50NtE0toJ5HXrmzYiHWyO4UwNJIYGxXgFPLKpDHWNkJbj0d+kMNXSf3nYwMUtE1uFnq9ar1Prw3LVNrRR5dNg87+/uOO86HuPslsLotY1cVgO2ilpLEeFPUFJerVzl4lYNV4g+G7zg= X-MS-TrafficTypeDiagnostic: DM2PR12MB0155: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:O2VjxWzQ7JdyreWlTc4M9mylRI9I9EUjMT5ERvSud04FvwkC7wtJEzDuKWwM/1TtDSzm8zuF8Lcr0gZ+OUbPlwd0X9zsvUO9S0sIp1u7/e2EpwSUqKqPS84vIHyMvpVcU8Z7gCIntvFxuUIAYMrP+dMrmTQhNz0X1xZLHpkFdvjJY9Dm7+GuHvshSOjMH0yQx7gL4tlooEEGivoz6cT+AvX1tfncwEj5imiI3CqfHfiImWKPpKuZQLzCb0TzE3dSQuN5qFgRogC49kmu+67TqtI1QwLMtn/iePSKV6pYET8hQYpWJk6ShsyAbdKlzut1hO6mwzeJ0t4XCPWDjAOj/Hnys7gYKG1ww1FOsWX2fcV6yWN5PfIHSjM7bamHWdKkBlDszSYrMwtMy7muI7TAuQaMPWVEXIxAcNqtH1GDBczZJ3Uwxg7FiGAuLPtSg8mzr0Kzy/Llt1APGZVPer7L0WI3hUQV4Bon1Fn9Uq4o7KtYoxqYI2MqYxIfgJ69Gild; 4:SY/SFmU882BC1hMQi+1TVHsojj6XEiTJUvB1KnyPEBnJfh0618S5cKKDsfc9ZyyAy6FZuTamM/RXTSl8CdupCa0UHaNezV8SynDLugnhRz09ZZcwOw7muFQd/WgvTJCa2LtM5DqHcbmpZUM6+GHVdx4jFJsKQ+i1Ha+xw2ufGU/7KqRgsWZJt5RWg6Lfph8dQukomnHQbqvnpmUgZLfjD/bTGxNhWe2F4woZ4aFEFDqzHG1k01PA/O4YisMQvvkwrSsic9bKYehFZ0JeW/NITnUPVt+p86APGMR+eGIdBcaC7Hui6TtFglCno1dYNiaBIUEUlD+v3v9BOGNaWa+soBVMJEwFhlz2uKLYSig06f5iQ99Ps0+v2HofK3PrxqaY 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)(8121501046)(5005006)(3231220)(944501219)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0155; X-Forefront-PRVS: 0597911EE1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(346002)(366004)(376002)(189003)(199004)(6486002)(6116002)(1076002)(2351001)(36756003)(16526019)(16586007)(54906003)(53416004)(26005)(53936002)(66066001)(186003)(47776003)(59450400001)(2361001)(478600001)(8666007)(316002)(81166006)(50226002)(8676002)(8936002)(386003)(15650500001)(106356001)(97736004)(5660300001)(2950100002)(6666003)(305945005)(4326008)(76176011)(7736002)(39060400002)(8656006)(105586002)(68736007)(50466002)(575784001)(7696005)(51416003)(25786009)(48376002)(52116002)(3846002)(2906002)(86362001)(81156014)(7416002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; H:wsp141597wss.amd.com; 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: =?us-ascii?Q?1; DM2PR12MB0155; 23:ICiVRZOACfBpcOrFr1WAtyyBPT7KMGLr/J9l18INk?= =?us-ascii?Q?QqKNF1MfvOo4ZxKKfOXtHy4ZcV8EcmajUMUAt6ofFcXQmjUvVQ9tDTBGYfu4?= =?us-ascii?Q?aykelvN3ZA0Hg3vVP6Kq8Jj5kUqySAjR0DxWkWYh+z0XB6Eivu0pQ8fZgdxS?= =?us-ascii?Q?RD7aDKIYvqW8kp+haIbHzi2oQcKhUGhdycZ4do9dVEOJGAXiljhltYXOlB+6?= =?us-ascii?Q?Hp/t8R9UhfIVaev64HjbXt05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n0Fd8uSHnlgfuvY2qfHXBcqUlHaNxjt6j0AwX6a+Na3pjiIeApWTdJsQ1NDff7wGIM0gySlgb5DAEJbg9srBDFAn0qUTM4rQKZB+anco0C2Uk/UkoK5J4LwagLRPIDuK0ynOV7ZndJHr3FZTj+k SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:vvld7UyH1vVivyjD/8U7acFazOth7XkBeVQnYkeIGCkMN3P9Xow/QWt5nD1tTZzl0YZb2dEq0Uj0GWUcVTCHAYwPe5eZS3r4tr2XC4qUDDbRlNCZmmJwuoxOmt015sB7YG9mriGacA0yHu2GhDgNpKeSORhS8hb+IQ9fxii2kLaZJCj3pk/yBuF3JJQBZnGgDVaCZiCU8t9lzzXPxhXCxN8UxggRs/kIDil8u8/E51DdwhCkd0FTov2vz8C7dSp2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 21:10:56.8268 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c44f2bfe-6afd-4a06-40ee-08d57eefc2e9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.36.55 Subject: [Qemu-devel] [PATCH v10 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)