From patchwork Wed Dec 6 20:03:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10097063 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 62D1560210 for ; Wed, 6 Dec 2017 20:06:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 542F929FE7 for ; Wed, 6 Dec 2017 20:06:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48CC129FE9; Wed, 6 Dec 2017 20:06:09 +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 1BCEF29FE7 for ; Wed, 6 Dec 2017 20:06:07 +0000 (UTC) Received: from localhost ([::1]:57500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMfxG-0008V1-T7 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Dec 2017 15:06:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMfvl-0005tg-6P for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMfvi-0002TL-0B for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:33 -0500 Received: from mail-dm3nam03on0044.outbound.protection.outlook.com ([104.47.41.44]:26668 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 1eMfvh-0002Ss-Pg for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:29 -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=sSYlPcLH6dVQDCEsSSjknA/F7oMGCMfZuvAakeiTmpM=; b=LcduYb6ZyoJaVjp90TujiKXmlcYCXh66HnCT+BtrXjGpCXuTvHalvwiGDY+6bH50mOJYctVKairyf0JI856n0a0Mau0+9a4jHij80etd9W66y+UaW8TFkwZtAua3DVZZikxo0/KPxc1ldof458CUCyum8TIJI5ZxOlS2izuF4pY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Wed, 6 Dec 2017 20:04:24 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 6 Dec 2017 14:03:30 -0600 Message-Id: <20171206200346.116537-8-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171206200346.116537-1-brijesh.singh@amd.com> References: <20171206200346.116537-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR14CA0035.namprd14.prod.outlook.com (10.171.172.149) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6988fce2-0707-41d4-2386-08d53ce48d03 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603286); SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:zzBAzoFf2T8e+gAhvy5xhKxLVYrd00F2PbKf6V9jg98VXkc/bin9SmTvBG9UsXZ6+VKyiytIq0cIZA7Cr+M0CuDYrflvG24v3Romi+ahiusS9k68Cuxfbw57Y6+hhrvQMbaaUdmcKeuStP6aShhwfbOenRs6wcgd412uvoPGjxRoGyConBYXhbhOht+7tPWmdk0itAisr++/PImouDd+Ht4+A8LnAuriI2XpaUCVONIyEIvHDbTOjaUvcI6vbWvQ; 25:jutzq+sZTRWPuvmfhiJk8MzGtwmAelRlY9FjQVhKvmyft9sAH4r1VzmC1/JN3phDv1qOJw+OdiVOcMOY5vETqBf0iLVmBUAV/0pefzbCo6b6HCuTaDB60B81igz+uIDPb5RL2+Uk85SMUzVSxL+xNlyvheF0DB4FNtJKXaamiWB6QWdEZivBRmv+HlO8XtFFK3WfETnSwjHKXpVmi7H8ZWu9b31FzpDJW2SljsqLsyI8+8QxSCmkI+x2lGD9SfV7axeSGT2NWPsZpmzaAlcNflwd9i+B01kprC0q8D+3Ko0NtKToZdn3PvAOWWy/cAz8i+A0HCrTS4kjEl6Ln+IvqA==; 31:Ppb7SvPsg/ADZRMlk9sFiQ9T2vTd+2n8+DYloLVCwtwl2R7yDw6pWAtEVNBNH8N22Hy1Su9auf3k/y++8pATKPbB01ygvClFgVmZ0TVRfcMyF+nnHRo8UW5Ik7YhOD/mAr+Ji51oNhCoKgp3P98oV5RqDOOYE2NDBcEJ1B+mjRbv7dhzS+lxFqL+bZbv5PlTdgLvBa0wywFmCC9dtdQWSazOjnVK7/GmvBaYmcEsHs8= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:/Bs0c3jLFZ/jCe4cJl6YotGpJVBkaERh3/KYSVHM/3T9rXFHDWEcAcvnRhRF9PC1i0/a86ofvvlMDvxRiyC1kPjwTD7Eun2kZ14Toh6m7QJXv/70XgM0Vr2lKL5lP8DfHv8VcSSZacVbtUG4clfK4Ug2Ypry+qo3KXB37rxczr1CydfHHYW3P6EbceZcmpR9lmaihdcf77OEnmb8+iw8sbuOvmp139R32wCCef81inYjCNqGnAymVCtCSu/ziQaLtCSPhvMFhtpoZQ3JREBqVknFOPcJuU/Vnv+p1WBauzJiUIDP2OvA0aWwz+1kDzs8E2wwn6BEXLcsmSiKV1XBE3Sl8uS/osccrjs+Eshbqo1PEjXkkQ2Uodw+5SvlT1IKh0UaxKYIiAmNOX50Wf0fk2SwFVp6s+svRvzZFwuU9TYEUtW1UJfV6QJFb1vzuJhUQPDXqjO+HhWZnQy49ZOvSjQCg4WPAM1uDPXHgSemdgvW3CewW6q1Jbh8Le5ijdq0; 4:uNhsm5afZu89XvcX2+vSWE1X6/N+qBl4SbZ+trL4hZJQWkifF9ROfFycVpbBYmmrWAMzK5Xsd2LjQerbaPIhBbi+bDeFv93Vxn+1F9kiYC1b9+AOIWstKmx7/zFz3XvX/biZnCff5aURuolQmNyhZgXE0ANmS8w0zVlXy3+97knJemkY+bnlEapsN3yX+LLcDVm2de2/502pNz7PSzke1vkmTjvFq/1PGTCR6d9pJJkC7E8k4AiQD7r6BIVagfeg6T261a/WyG4Sci6Z3OoTigF+WDdzqhlsGduI0JSd3s+dJDxdi9A6i/nqEYGLwDtadFXLA8nYU26gNfsT63uICFWygdsiWBsuB40mv3218pFLxXNCiNsPcutJqxVeTrgi X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(190383065149520)(104084551191319); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231022)(6055026)(6041248)(20161123555025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(6072148)(201708071742011); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN1PR12MB0158; X-Forefront-PRVS: 05134F8B4F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(366004)(199004)(189003)(16526018)(16586007)(33646002)(53416004)(105586002)(39060400002)(4326008)(305945005)(2351001)(106356001)(2361001)(7736002)(7696005)(86362001)(52116002)(8936002)(316002)(53936002)(97736004)(76176011)(51416003)(36756003)(66066001)(1076002)(3846002)(25786009)(6116002)(47776003)(50226002)(15650500001)(68736007)(54906003)(6916009)(2950100002)(478600001)(6666003)(8666007)(5660300001)(8656006)(8676002)(101416001)(81156014)(81166006)(2906002)(7416002)(48376002)(6486002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; 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; SN1PR12MB0158; 23:B7tpZZfnz+uDRSm+HVsODrOu3rWw4Xd+UcKRvWfPr?= =?us-ascii?Q?UsQKAtMRnrdy4cDmqFjP3zs58C7Ihn3ZuIUgkkIWpgC/Yhqx+QiQCTDRP1Ti?= =?us-ascii?Q?KRXa1wB4n25zKK2t2CcmKqJZXKsBAs4t78WPc5xiZhpDIPK+i5ljKVtZBeny?= =?us-ascii?Q?L3vQqSrYpC3AM45FgAcduiLrUC75SwkjcbkmRiZDmb0dEgM7h43TCRs4sH0H?= =?us-ascii?Q?D5+rXQz9x3kQqj92rCHNbPPrwbf6KDhMnLdN8IrCHnHVXbqYR9wJZjk3ywr9?= =?us-ascii?Q?pnqcomtKMSjGjkf1oVftyx+nfy3wfedltIyOaNPm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osticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:K74Jv3pwCtVYsQyj3+0F3cJvB6cvgeCuY//jKsFB734UxQjRMSHzan4h3GQcYVty5oYLlB7ZX7OHgho6yT3+R8bdsZSzOGvUG/Py9+E3zNe2BGixHMzqEJplQFCZBar9vwopIFsgyQ2z4vksSpgN7/Cit8R8HD6bfI2QKI4Im0T12oDZL8TGJhi8nY8uV1Lr+51r6WdVrjrjxYfpoq55MhgpgqZIIb6Ifz713tNW7ZT4MWPU/7JQeOZxFgcKoAuc X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 20:04:24.1921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6988fce2-0707-41d4-2386-08d53ce48d03 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.44 Subject: [Qemu-devel] [PATCH v5 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 , Peter Crosthwaite , Eduardo Habkost , kvm@vger.kernel.org, Marcel Apfelbaum , Markus Armbruster , "Michael S. Tsirkin" , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Christian Borntraeger , Brijesh Singh , Stefan Hajnoczi , Cornelia Huck , Paolo Bonzini , Thomas Lendacky , Borislav Petkov , Richard Henderson 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 dd8a91801e82..04b5801d0354 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -1356,6 +1356,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)