From patchwork Thu Feb 15 15:39:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10222007 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 396E1601D7 for ; Thu, 15 Feb 2018 15:45:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2924529427 for ; Thu, 15 Feb 2018 15:45:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D8E72942B; Thu, 15 Feb 2018 15:45:05 +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=ham 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 A7C6E29427 for ; Thu, 15 Feb 2018 15:45:03 +0000 (UTC) Received: from localhost ([::1]:60738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emLiY-00082C-O1 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 15 Feb 2018 10:45:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emLeK-0004Aq-At for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:40:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emLeE-0003PO-Ii for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:40:40 -0500 Received: from mail-bn3nam01on0056.outbound.protection.outlook.com ([104.47.33.56]:44256 helo=NAM01-BN3-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 1emLeE-0003PH-BO for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:40:34 -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=4GYJcBA8Yih0eKc1zrXWFXIpJuC8I4vkIn3JGbn1PmAcnxRlbzRgL3lI1rberUWejVEwR0eyXClB7jkwWgbJHYfi/5hyU8igB0AjPqzXUahDfzkX0VbmMilOBSs7yWF7XkbmDFdSgVzWXoS6+xUxee1sU5YIdqGa/JJwYon4euc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by SN1PR12MB0157.namprd12.prod.outlook.com (10.162.3.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Thu, 15 Feb 2018 15:40:29 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Thu, 15 Feb 2018 09:39:32 -0600 Message-Id: <20180215153955.3253-7-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180215153955.3253-1-brijesh.singh@amd.com> References: <20180215153955.3253-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CY4PR04CA0044.namprd04.prod.outlook.com (10.172.133.30) To SN1PR12MB0157.namprd12.prod.outlook.com (10.162.3.144) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 998582af-1511-4aa3-a150-08d5748a7254 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:SN1PR12MB0157; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0157; 3:hMJFSqWn3qFK/ymmihDFChvhIA2dXc8HEsWE8AKXaygxOm0okSCFpDIFWUIabJXvLDteB06GFt09XhSs1ucCkMWZf93a38zMH0mmX0GtBIVXmMgdfTVVHl/9fCzSdHEADrtjdbbkvfcmupfeyxlFS6oLTbhIymBI5tymJHzDVsZAhRJoLnhj4aXGgtHkWibhPVJX0FrJ3KyIKMEnzTS8YCwhyIk2DZWctwrBffbwMB+Bvfn9Gn8LHkWyLtM0tV6e; 25:QUFZR6BjzMmCVWBEs6QYUpMXXaQFjCrdi6XQ3+kY+cyaO6C4ovev1GpPM9O5wWsJpb4lXr41UfAR1wiw4V+dSZp8ob5ECvH+rPO0jBnCSUmWLJi+8/jQcq0ITP1t0SK3l5X/rrzXpdss0l+qN/9uT1PkAuvr5atcxIR6BiLFv0RFPEdlJlvRhoFepXy099FywdTtjeVa2LTNXK2p9Qp8vBTsafFUYoCQOfTVX5oms/wdz8XjgZ1GNOFgiEazqN00HpDkRhdWMGoHjkoVQ1KEh+Co8Wf6iBXuezS96S6o54te7BkVLcC8b80Zqwpo6H+mNJkmyBXbp++5wAWHF1xhqg==; 31:Ieos7oOhKJHlJoQuTWmmZvA/vrJxJfPaIOvgKf8f6UdRHUA/TxbX9gxHd9xu/Jj78Ig0pkK99zM7W/HGajqddqAwWA8/x2z7q3Nn3FlSKrRoYBkwRNNOvz88Se84OYB2XvDpffVhQliK1h94bzUNKycGBNXYaFNjgzKSHiLI7Imh/mPBQp4KBARBHrRZzwYIrxv8JOU7Rbt4L7gjeUXcgFpH/IvAraGbSHlxJixZkoo= X-MS-TrafficTypeDiagnostic: SN1PR12MB0157: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0157; 20:SXWnlcRnjY+xXazirh9aEUkbgL7nJwmPBzkGsDj9rWhf2/E1jEN914lfijUAzcXjjxJR5qHZkLHEFBlbsBF4PA7BJR6MbjatgeUwdmvzclg6KhcqPiIEWjzPuHJxT7WZEdz2q8yopS161Xb6GeLMp5EwlUmADdLGdFIVwmgrkbX1xyB+hXIvh9CqD74pgInW1B9rTqHznH9h4r2X4SeVASC4EZBn8r/82B9DNSR2u/rQTi0s0JWFTRvoJ8KXZhXqvIMwkaHrqetVZZ6yaSjH9sol4eFRbjUnkTYj6wLE4Ogj2Iknyoqxz6XLLAW6hOg3Q2IjRPbKTf7PCB17cElMzVkU1pFSZUgo4GsZBQd9PYO/CuO5DfsqSeYeUE/W/ms+3k8k6iOsIlfUh6kApPat16EX1+ImwDc+iLeYmEKJLpyqK7iODku1CHrksGUZzCegipKWIieFVAhSrQeuTtg9P3KNHczYgM8A8vEJZtrLT5irshFN0/Do9HK9ehaLsbBU; 4:wbalEL+STUCTEFbXkAofHPc0lDbcuMaLFS37uBpUY6FrgDvXj2cxGGO8jO9+TkupaFiSAHP7EciAu1bYfpeFcOzapS1ydAQ3qju6FUI67hGAtoxOk37IeHQ1XZ99hsU/F5vYfT1w+GvP+b1Hx2dj2X7R9yWsHPHGA2kLir/Tu6BciimE7DHVdGX0rIoJnFCS41/JcN8gTYaUYJKlEAXhUgh426ksDRHclboYFIso/YLGZ2kTABw9vUumphJpL1zcY7EqS31VI4lXG3UuzrDjn8ZDQ+uCwgA/fZhn7GlD8MFQSLSUbtn6tv/1d2rxqmQhbuwavTcAxWMnhC3IWh73GlWfQlpM4h8jsJBGmBirG/lXQsJxKyiLM28F6E/Q2XRR 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)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231101)(944501161)(6055026)(6041288)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:SN1PR12MB0157; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0157; X-Forefront-PRVS: 058441C12A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(346002)(396003)(39860400002)(366004)(189003)(199004)(26005)(3846002)(386003)(8936002)(5660300001)(186003)(16526019)(316002)(6666003)(8666007)(1076002)(54906003)(6116002)(48376002)(50466002)(7416002)(478600001)(59450400001)(8676002)(68736007)(86362001)(575784001)(16586007)(2906002)(50226002)(15650500001)(39060400002)(2351001)(6916009)(7736002)(106356001)(51416003)(8656006)(52116002)(25786009)(4326008)(97736004)(2950100002)(6486002)(2361001)(36756003)(76176011)(81166006)(53416004)(66066001)(53936002)(81156014)(47776003)(305945005)(105586002)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0157; 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; SN1PR12MB0157; 23:n9X3kUb2PZXlNSN04eH1/4yUTEXgarJ3uI8MD7isX?= =?us-ascii?Q?U7vdHiPekIkx/Uq3D2Q/4FiI5RQ+0OrLIiGZ/goWx7YLwpO4CmDSOdH8mzHP?= =?us-ascii?Q?JYK8J8axGopxPYTVcicBl3c6EwqnaWJ2TtMKVZZXc3R32sdkewmnVNgSgtEy?= =?us-ascii?Q?Xi4JxNZte+YwW5Z6w3cq54RnzLYHuMZdRJLcz4k3VJLZhtlQrgpx48fAIXbP?= =?us-ascii?Q?e0We4uTVs+KlkdwU26Q0cCdaeVGupZr3RewUc5GARJDzbjEGBosXxnDAFF/g?= =?us-ascii?Q?GN762+XY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zjIgJSDMIsEMnKX42Zqz6YVFTRLUDNlKw7T7Ad7nmrvMUpj2ogCqgP1W8XaDd1fEF4mJ3kSolzW0VtIhH2BhkKZal+YqBniqB SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0157; 20:gDtPQWhcP7UNC461FROOf/rCEQ0bmx/2b1WQ8h0JmVrbx9EIw9siunxTQ3ybY6AsTs5nRRYKymLqHEEMbs3f3WiVlsZ6GZX4wFwdJtWJBBxxQjoHm0SLBvDQESTbOmOClPEzOHXl6iT2HgiMpkanIqI51iPeuz9Ppet8o2F5rJ9OMPtfInBgu+St/gQo1UHSzJFXM8MjPgewnFXiTApz0WO2B2srVrUAwuyLXPOu63DhpQVi7pWSk/o0ykxmR26/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2018 15:40:29.9157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 998582af-1511-4aa3-a150-08d5748a7254 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0157 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.33.56 Subject: [Qemu-devel] [PATCH v9 06/29] 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)