From patchwork Thu Mar 2 15:12:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9600807 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 DD53760453 for ; Thu, 2 Mar 2017 16:05:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC1A4285B1 for ; Thu, 2 Mar 2017 16:05:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFFDE285B5; Thu, 2 Mar 2017 16:05:32 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DF66285A3 for ; Thu, 2 Mar 2017 16:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753616AbdCBPf6 (ORCPT ); Thu, 2 Mar 2017 10:35:58 -0500 Received: from mail-by2nam03on0042.outbound.protection.outlook.com ([104.47.42.42]:30518 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751435AbdCBPfH (ORCPT ); Thu, 2 Mar 2017 10:35:07 -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=ycPd0xGQzyDX+BbrLYoqszmjYf5f6winz6a8Mjq7ncA=; b=kDGcZOeqjmlRo33Pna2UgBe0FMD+lfEafImoQbPVuZJVxQqzQLRAoqZzb0ZD/EmJZ5Qk7b6lmtAQHcn0tmLz9M4bNxihcfjILFkihCuJcywbP2cQkieH5ISMO7mzKFvfP/Y+QC4a39okn0GlmRRP922gPzmtqWFeTcuKo11aSb0= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from [127.0.1.1] (165.204.77.1) by CY4PR12MB1606.namprd12.prod.outlook.com (10.172.72.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Thu, 2 Mar 2017 15:12:51 +0000 Subject: [RFC PATCH v2 04/32] KVM: SVM: Add SEV feature definitions to KVM From: Brijesh Singh To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2017 10:12:48 -0500 Message-ID: <148846756856.2349.18360437323368784256.stgit@brijesh-build-machine> In-Reply-To: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> References: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR15CA0001.namprd15.prod.outlook.com (10.173.207.139) To CY4PR12MB1606.namprd12.prod.outlook.com (10.172.72.15) X-MS-Office365-Filtering-Correlation-Id: 121de954-c077-4e61-4705-08d4617e99b9 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:CY4PR12MB1606; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1606; 3:03Ogzi5GssKWqV+OaXkNsnonyU4zy8JLqU43ffgkNZPnOgt55tkyoCsaDh4rYnQ2CcNyBWknbPMeZHjJJYZgC9aKsaatmj2bb1uUpByP54+vlbE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u0jC5qr+aTMEHBSYGhfSbyy6GLjcW/IS58Z7+nnUn988Bcz/DthcMM3k6OerjLo62fNp44pLEJrBP4X3SAI2lVhY1KeQQrzKkVHAiRUXGs+57Dj20pCzSxtTMJ5QeYuem5DKz45YBeUR4BKBPDig2BYjxi/TN/1RJWy4ChFXE1gCVKSKbtdYw3rcsgG51vvBASQFVUqYDPgJwtB8VevcpJlI1KNLBZ6QzwiOp0quV2xeJTfHTpLgvhiINuheRAvVxq4UpUTC9wMiY3tfraNKzOxDc7/2r6RwwucMXHNqhN28kYzfDLaWL8u0IwRCkDLLOiYBydTL0nSsil+vBe/0nKdQ29zssKyulHj6SyWSDCZ46t5iSRBhJuCCcji4DGqysWLEK3v+ZaYS7OgZa7ow22nM X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(20161123558025)(6072148); SRVR:CY4PR12MB1606; BCL:0; PCL:0; RULEID:; SRVR:CY4PR12MB1606; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1606; 4:KR9zRVJu5nGGG9ei0RDRFtreQYJi/34meppG4i2iFmAVRNov8BkqCa/lxLctXhG9tz8SV62Ei9yTfruhQ+Z4jWbEOujJjgPXtygGLMLQiRQuZk1etCi8jTfqI4NdBwwiILKyfXM0sdL27KuKTU/QJ1vHdMhhUQwCyskBdZhG2pqWRHpaOHUJOgg0W+PZ+7KXX6K+c5G6mr/VjR/xnZySxXFElFfYmsQD5272GUE+wrMe9RPwubiaplR3HZjVJ6jcraOR5NG1IY5kKeEmCzHP9Jdc2Jli16SZmyapqOFMi15he6Rj5A6IZ/nfwmRLpCkJ1taF2ALzWhRVDpwzmhjprR5OjonaiCcDnwkezZxdO+5DNykqdQVtq8G7e1r7FPDSDXtjwM++3AbX5PqOyBLz6NWKhVUsOisQYeo+ZcFSZKR34HhpFbUzvWHl5+hB46/GbmYFboM2L5b31a95EV9qEyOYPn81yaoggwuY8kG4Kixw3X11CxJMxwr2A5ZJOxGA+HxW97oNVXHcu+5SIc7aV9bo1vnrW5/qg9xxYG09AiE/KEByVPcKiqrGTaWoYCSarpwUyCXdYoa/zYQKUpiRaJHVBywxBoAOpIhtMUB0ELAUw704hEfQSBrLjhWlFL9Am5PTW3h7dsIt0wz6+18uYajL9b6Th6ljZQ7F7ALmrh8= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(39410400002)(39450400003)(39840400002)(39850400002)(77096006)(6486002)(8676002)(81166006)(7736002)(1191002)(90366009)(9686003)(54356999)(76176999)(25786008)(92566002)(103116003)(6116002)(50986999)(50466002)(6666003)(3846002)(2950100002)(7366002)(42186005)(189998001)(5660300001)(305945005)(7416002)(230700001)(33646002)(7406005)(38730400002)(33716001)(83506001)(23676002)(66066001)(2201001)(86362001)(2906002)(47776003)(53936002)(921003)(1121003)(217873001)(84006005)(83996005)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1606; H:[127.0.1.1]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxNjA2OzIzOmtKN0plL24yY0IxMFhINmdXcThmcVVJeUth?= =?utf-8?B?bkQ3SWZaVkZ2eTY1S0lPT0hWOE9YYnNlVlhCTG5xS0t2ZlFBbW5BVHhEdDFy?= =?utf-8?B?VEJpSDcwQ0MvcDFBKzh4RTJtYjVicTZSRzdadVlGZjd4Sk5Da3NnN0NQeTAv?= =?utf-8?B?aDVyMG9CQ2YyOEd1emcvWlBnSWo4QjI2WDdHaG5sazZ4UDgzMldzb015MGxH?= =?utf-8?B?Qkl3TXhPNDZwL0p4dXhwQjNiS0lEYTJXbDNtOENOaVZ0OUhlbDZ3M3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VY5j2Mol4ENoud5gLxlZn2QhzubQ0rrCkFQUZC1tqzITFns8=; 5:GtiDR0+xI2jQenJX3qJbVmGcKOh8glEwdY4iLSyjmDClFaNxIz3b+i5SAfcG71gkAz5SUguJtw8M3dh/ndA98MHxH9zo/+4eBjz4u1IReUTm3KpIO+TIiVnWl98bjzlRERg8J3TUMEPFehP/rjQh0Q==; 24:yOCvisuYf7i1VyoROlhPQjwLlCCOOHDGKvbM6E6kEJxsqL3pas0jg6S/aOH2zPlSLPsxYfr/IAVsiGZf+VbGEklvVTfxydja91Q/ZhjV0RY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1606; 7:NZxwVcLmz/N4cf9vv7YN7oyw365lpmVtNfC8WliTbBSQk3fIdDZLsDD17tHiah4Lxw1+TD1QBZs03QDAXEYj+mYJqR367i5ccynsEw2fz+IvJXxPMQRhskClqCan3F+4VQd7U8KFgXQ6ZD6XquHj+l6+M/JrTxVTbqJOIPuBvJdyMmhKmXXdXfk+tkbvi8dOXN/cXM/qv5+1FhLE4viUnmzTv6Ugyx5lk7uBQLviLOs+ZvWOd3Zc4iIIaDAqJUGze9wnKfESZ9Sk4aawkib+yNURb9uMXwCfTbk4Nt0cx0Po0LmywY/IJRPHyN/Ov0YlhvitztLS9DhucdZ/OulJYw==; 20:qyAXDSCgahLr62ylKVAET8TDRAN0UazsQpm5bEKOXZzEH6VeWZi+6cttZTzbaCea4AnJOPCVpDgExwSbhMEqGG/lzE/ryNio1J9UR8kJ3RFFx82yfKy4XUHHbQGq654ou2fd4ZlwKoX7RNgHQ6bKQoHYSKWpSqQt7tKvv3Fz/1deiYlAgdDfGZOYge76+rHXedcrlUpKYay31074gJdjGTmsnAv7gjXFOGtWD8Iz6XrMKPU0kUaVmBtFr6ey9UgD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 15:12:51.8443 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1606 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Lendacky Define a new KVM CPU feature for Secure Encrypted Virtualization (SEV). The kernel will check for the presence of this feature to determine if it is running with SEV active. Define the SEV enable bit for the VMCB control structure. The hypervisor will use this bit to enable SEV in the guest. Signed-off-by: Tom Lendacky --- arch/x86/include/asm/svm.h | 1 + arch/x86/include/uapi/asm/kvm_para.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 2aca535..fba2a7b 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -137,6 +137,7 @@ struct __attribute__ ((__packed__)) vmcb_control_area { #define SVM_VM_CR_SVM_DIS_MASK 0x0010ULL #define SVM_NESTED_CTL_NP_ENABLE BIT(0) +#define SVM_NESTED_CTL_SEV_ENABLE BIT(1) struct __attribute__ ((__packed__)) vmcb_seg { u16 selector; diff --git a/arch/x86/include/uapi/asm/kvm_para.h b/arch/x86/include/uapi/asm/kvm_para.h index 1421a65..bc2802f 100644 --- a/arch/x86/include/uapi/asm/kvm_para.h +++ b/arch/x86/include/uapi/asm/kvm_para.h @@ -24,6 +24,7 @@ #define KVM_FEATURE_STEAL_TIME 5 #define KVM_FEATURE_PV_EOI 6 #define KVM_FEATURE_PV_UNHALT 7 +#define KVM_FEATURE_SEV 8 /* The last 8 bits are used to indicate how to interpret the flags field * in pvclock structure. If no bits are set, all flags are ignored.