From patchwork Mon Feb 12 15:36:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10213415 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 77F6F60236 for ; Mon, 12 Feb 2018 15:46:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67463289EF for ; Mon, 12 Feb 2018 15:46:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B72228B0F; Mon, 12 Feb 2018 15:46:31 +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 D1B42289EF for ; Mon, 12 Feb 2018 15:46:30 +0000 (UTC) Received: from localhost ([::1]:45596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elGJJ-0001xP-Tq for patchwork-qemu-devel@patchwork.kernel.org; Mon, 12 Feb 2018 10:46:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elGBM-0003Fw-7B for qemu-devel@nongnu.org; Mon, 12 Feb 2018 10:38:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elGBJ-0003pd-1y for qemu-devel@nongnu.org; Mon, 12 Feb 2018 10:38:16 -0500 Received: from mail-by2nam01on0066.outbound.protection.outlook.com ([104.47.34.66]:37502 helo=NAM01-BY2-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 1elGBI-0003m5-QB for qemu-devel@nongnu.org; Mon, 12 Feb 2018 10:38:12 -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=hbEcZ5qwMWdvBqYdXLdTu+PBGZa31NPmOHqTZKHgONs=; b=njZ6fS1AdQYKt0F241lhKqKFhlabdqGfVblrAyrTZ0ZHB3m9WnH9PHuT3uMiNdDSmMKO2wMSynEM779hKRQ0tDBLO8FBkpyYYMjE4yphxPzbb5mxMEakHm3VhXB3gaHzluCuPq2VqfY0kFUFHP1034b7IXoPE2l2MRGSRIob3zw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by BY2PR12MB0146.namprd12.prod.outlook.com (10.162.82.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Mon, 12 Feb 2018 15:38:07 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Mon, 12 Feb 2018 09:36:52 -0600 Message-Id: <20180212153715.87555-6-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180212153715.87555-1-brijesh.singh@amd.com> References: <20180212153715.87555-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0801CA0004.namprd08.prod.outlook.com (10.161.215.142) To BY2PR12MB0146.namprd12.prod.outlook.com (10.162.82.19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c85611f5-6441-4f33-51e5-08d5722e9e4e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:BY2PR12MB0146; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0146; 3:jkiQ0tBnHem5OzTcYhqkJHreVxv0v3HhQ94gaXSgvdL4Cd0t+yaEZFP4YGCAkCnI0WD8xjRDcMKm+dVU5CsjpG3GOAaL7C4BusDH3nUMfsPTBpb+HMglt6aB/3LxSgh0BpudUvB/mceglw+OxvrOfmyifFPHwDNdiZ+EGEo5V+PUYCUJTR5x+Gd/9lriSuI2NL4kdKWUxu1p119qr+AsxJcnOOio6fAypXKTMQY83F3Z+o+dP//4kBqYJZ6GD5v8; 25:qdo3ActgxwbG4H/zy0d5DYQLzhBq+BfK413YplrSRVUjmsTqt8k6eFWM/xnBCXuPzENH1L6IBYpl/KPNALVbkJISaoZmHGi4dG3gvH+BGgF3l8Czv/rJv4TPd7ZnZn2Ix6UOJZZaRWjOVyQsnHNB5mzJdPbGcm1DFE7uOFh8pqLrjgzKUF/3JRNX/oW8g79MgtWE+HKhgzXrQ7XVGRN2g1xHI00b4upDNs9RtYrlGgliQaTCUs9od+bIY7FUL25XxpdiDTQnAcytar9/rhMKqs/WkJ063WKpJPCGuKtMT9vJnhLeZA1eneEF3h2niJzcjl0ft+X/wsEoV5M5NBGW2g==; 31:HN5nDKxuKb7fwoKWoCNVUpkFPBILsnnUa8+ms0AECKhRtuf9cOUJRzsLvFbVkTtFXGXWE/qP6sl9F12QAXhbyMPv0DPK7way2WoibjT6UAPpr/q9SJ9uPl23XCwcAimfAfuKYJpRCKEPKo39n6YWFPdGmaVIUI7OYh554u5wAafYm0tOcDc9WEWBuad30fP2w3yr13zAhyVCLcMyIJzBLmAdE5C90XAoX1DcolSmTd8= X-MS-TrafficTypeDiagnostic: BY2PR12MB0146: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0146; 20:vHIgo9AgYOTUGAuNnmfr4AqMjb+BO0svzPUO2VxLTWxe8Oaca76eB0tnjma8jUEkrWnC1XM8WbhqNDTBQoxX2qSpIzCXqlSqKtKv69kbeqfPpyEuDifl7N88nUM4EsXqy80IagBsi/spe37Hnlc1J0uftIzdh714OKPdjd2BVwSMjgSCL8U+HnrnIzn8Zmadfs2ND3xKShAUc307z29Ya9JT2D/28SQUWyaZor418TcImwGWxOgSXdWVBFjn7+Zpe0ADnxjdxJCKSITQGKmq7Q7ZQVdFc+GA18iSZkygXf7CL0bclZd2raex427yU79CI6W2g/AUsL6XDjeq99eQvZJcH/ziP0bl11UETSE+uEGqaEUFt76equ3/P4A6ar+WLvXY1XkZWLLMeYsyNZXvVOVZN6U2AWlUxUAAXLy0ZiWYO+fpu7zjDG+zC+t6AJkwdj6n6MCfc3BMtg86qHFX6OSBv2zo5gV4NwnutXmjBJU9vOp+AcEfcxUyzTctDFdP; 4:+iEgINmXH2JLhpm/JWiovdfz8AsNJEOPDBgSCJ7unbE3L+CXwVQ5jKfk582aPDi7dR9vDrJAHGANZkQGF0nFS1dVzLn3PHKecRUyXzYlqMzRXMTtfS/Qj4FcWzBBIgpdXOiQ5pISq6L+YMQIASyRFEa24vVjht/HgTVe7lkFdgQVfK5Ue5O1ZGrUyzbNHf5h/Sc4hbZjC7crbOgpcAuSh+LRX2UuzJmTCZvsMeozov/UKkWBFTqCBElnHdYRIg/TUzdy6hTel8cnRfM8VgxkCeI6Wy0uxgZmVY2xWcd/NOXui/S3tgoH+P0RoAOusL5M X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231101)(2400082)(944501161)(6055026)(6041288)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:BY2PR12MB0146; BCL:0; PCL:0; RULEID:; SRVR:BY2PR12MB0146; X-Forefront-PRVS: 0581B5AB35 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(346002)(396003)(366004)(376002)(199004)(189003)(25786009)(53416004)(66066001)(8676002)(7416002)(105586002)(59450400001)(81156014)(76176011)(81166006)(5660300001)(97736004)(186003)(16526019)(8936002)(106356001)(50226002)(2361001)(6116002)(3846002)(47776003)(305945005)(1076002)(86362001)(26005)(2351001)(7736002)(478600001)(51416003)(36756003)(4326008)(2906002)(6306002)(53936002)(6666003)(2950100002)(8656006)(52116002)(6486002)(48376002)(39060400002)(68736007)(54906003)(16586007)(7696005)(386003)(316002)(6916009)(50466002)(8666007); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0146; 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; BY2PR12MB0146; 23:+iFVR416bDZVRkCFhn6bOWTAfxMHSfoekTN//dtD0?= =?us-ascii?Q?c/nSW7gVGefloorWLd8zXQQ2jkFv0rgC77RN7Ov3WPSX3crNuqhoNY1U2ich?= =?us-ascii?Q?jQ7UMqdaz7KOhFhQx6DDveW6gvOIMXv9OfZbtciu/hZ2po3kFPYyoZt18qTJ?= =?us-ascii?Q?OPWdeOJmULwoAlrjFTCBsZ1IZE1nh8bEIDMMam2cUdf9ErPCklD0YV5TVAjV?= =?us-ascii?Q?EJQi5YjVJtzZ51OOr9ITiSH27QPqfPAI4EmaKLfGvgY3KlyqbxCkiZZ8s5pY?= =?us-ascii?Q?v8mI4VS0ozBMFRakbj5idadnS1FOwrrZ5AGMR8IxCc92ZVtGcEVf624az817?= =?us-ascii?Q?6w3LMypkb2NS4lu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nosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0146; 20:FE7KGcSrcX9UhYbX6ABzROuUFyw/lNYsyOxKgF6cc+QzdeMyLXiIuEChdVfdQP7SNXX67ckVYdoNoboln3jLSyy4xZxIE4h2GRtRbp760J3x/4hP9tvP2DcX+TBmH9JEcOOznb0ixRKBzSHv3+HqU2HnFkpls4nCaoA8JOrLHeC8gT+MFmbebflRgeRi+qtNoj37uJvEeWqrvbg1UQOtwn7pD7JjZqI3OQNsL2G7jEDkct+hqWXlgmgcJr68FrmG X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2018 15:38:07.8415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c85611f5-6441-4f33-51e5-08d5722e9e4e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0146 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.66 Subject: [Qemu-devel] [PATCH v8 05/28] target/i386: add memory encryption feature cpuid support 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 , Richard Henderson , 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 AMD EPYC processors support memory encryption feature. The feature is reported through CPUID 8000_001F[EAX]. Fn8000_001F [EAX]: Bit 0 Secure Memory Encryption (SME) supported Bit 1 Secure Encrypted Virtualization (SEV) supported Bit 2 Page flush MSR supported Bit 3 Ecrypted State (SEV-ES) support when memory encryption feature is reported, CPUID 8000_001F[EBX] should provide additional information regarding the feature (such as which page table bit is used to mark pages as encrypted etc). The information in EBX and ECX may vary from one family to another hence we use the host cpuid to populate the EBX information. The details for memory encryption CPUID is available in AMD APM (https://support.amd.com/TechDocs/24594.pdf) Section E.4.17 Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Signed-off-by: Brijesh Singh --- target/i386/cpu.c | 36 ++++++++++++++++++++++++++++++++++++ target/i386/cpu.h | 3 +++ 2 files changed, 39 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b5e431e769da..475d98a44880 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -235,6 +235,7 @@ static void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, #define TCG_EXT4_FEATURES 0 #define TCG_SVM_FEATURES 0 #define TCG_KVM_FEATURES 0 +#define TCG_MEM_ENCRYPT_FEATURES 0 #define TCG_7_0_EBX_FEATURES (CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_SMAP | \ CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ADX | \ CPUID_7_0_EBX_PCOMMIT | CPUID_7_0_EBX_CLFLUSHOPT | \ @@ -546,6 +547,20 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .cpuid_reg = R_EDX, .tcg_features = ~0U, }, + [FEAT_MEM_ENCRYPT] = { + .feat_names = { + NULL, "sev", NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + }, + .cpuid_eax = 0x8000001F, .cpuid_reg = R_EAX, + .tcg_features = TCG_MEM_ENCRYPT_FEATURES, + } }; typedef struct X86RegisterInfo32 { @@ -1966,6 +1981,9 @@ static X86CPUDefinition builtin_x86_defs[] = { CPUID_XSAVE_XGETBV1, .features[FEAT_6_EAX] = CPUID_6_EAX_ARAT, + /* Missing: SEV_ES */ + .features[FEAT_MEM_ENCRYPT] = + CPUID_8000_001F_EAX_SEV, .xlevel = 0x8000000A, .model_id = "AMD EPYC Processor", }, @@ -3590,6 +3608,19 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *edx = 0; } break; + case 0x8000001F: + if (env->features[FEAT_MEM_ENCRYPT] & CPUID_8000_001F_EAX_SEV) { + *eax = env->features[FEAT_MEM_ENCRYPT]; + host_cpuid(0x8000001F, 0, NULL, ebx, NULL, NULL); + *ecx = 0; + *edx = 0; + } else { + *eax = 0; + *ebx = 0; + *ecx = 0; + *edx = 0; + } + break; case 0xC0000000: *eax = env->cpuid_xlevel2; *ebx = 0; @@ -4037,10 +4068,15 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp) x86_cpu_adjust_feat_level(cpu, FEAT_C000_0001_EDX); x86_cpu_adjust_feat_level(cpu, FEAT_SVM); x86_cpu_adjust_feat_level(cpu, FEAT_XSAVE); + x86_cpu_adjust_feat_level(cpu, FEAT_MEM_ENCRYPT); /* SVM requires CPUID[0x8000000A] */ if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_SVM) { x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000000A); } + /* SEV requires CPUID[0x8000001F] */ + if ((env->features[FEAT_MEM_ENCRYPT] & CPUID_8000_001F_EAX_SEV)) { + x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001F); + } } /* Set cpuid_*level* based on cpuid_min_*level, if not explicitly set */ diff --git a/target/i386/cpu.h b/target/i386/cpu.h index f91e37d25dea..448b30f893fa 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -483,6 +483,7 @@ typedef enum FeatureWord { FEAT_6_EAX, /* CPUID[6].EAX */ FEAT_XSAVE_COMP_LO, /* CPUID[EAX=0xd,ECX=0].EAX */ FEAT_XSAVE_COMP_HI, /* CPUID[EAX=0xd,ECX=0].EDX */ + FEAT_MEM_ENCRYPT, /* CPUID[8000_001F].EAX */ FEATURE_WORDS, } FeatureWord; @@ -679,6 +680,8 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS]; #define CPUID_6_EAX_ARAT (1U << 2) +#define CPUID_8000_001F_EAX_SEV (1U << 1) /* SEV */ + /* CPUID[0x80000007].EDX flags: */ #define CPUID_APM_INVTSC (1U << 8)