From patchwork Mon Jan 29 17:41:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10190227 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 9FA3A60388 for ; Mon, 29 Jan 2018 17:46:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9785D251F9 for ; Mon, 29 Jan 2018 17:46:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B8E125F3E; Mon, 29 Jan 2018 17:46: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.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 E28B4251F9 for ; Mon, 29 Jan 2018 17:46:31 +0000 (UTC) Received: from localhost ([::1]:53666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egDVm-0000xe-R4 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Jan 2018 12:46:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egDRR-0005YL-5E for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egDRN-0003L3-4L for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:01 -0500 Received: from mail-dm3nam03on0061.outbound.protection.outlook.com ([104.47.41.61]:15872 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 1egDRM-0003Je-Ub for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:41:57 -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=/nNCoPUZrKZzcL91NskhvyIWoMhnaclKHaJahtQm5rU=; b=ZiDlqbgXoZibyQUG8U9O8fDKVocJbFFh4Ka/+/VTQ/w+DmyjQ+Snd20RIOlaoRh+FNoWdGt+O8xkEMOYUM6MWaiQ02R7y5QBSfu+a84wN2s7Z7iCFHXCu+vTWqpDKdkI6tQmFdilSEK5eCMVcX/ZdwcX9xfuv75/3elY+9AUZOU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 17:41:53 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 11:41:14 -0600 Message-Id: <20180129174132.108925-6-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180129174132.108925-1-brijesh.singh@amd.com> References: <20180129174132.108925-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR17CA0018.namprd17.prod.outlook.com (2603:10b6:404:65::28) To DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 07863f07-9f83-4145-8824-08d5673f965c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0154; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 3:TkXbV9XW3Zu8qraDpa+En5Neo5j46J0XcZd+IJQveaoVIqypOjJ+Tf/Uaect3lUpiZ0n56THuw4exa9zcz1N8nKuh7vkjrX/skWG4Xd1HszXhyiIdpVBpz5W/AvupmdbLNGGHhe1NGmJ2TuOu4T1U1Ks525qlNbLg7vFUKNw+8zJaYBF3Wn6TiLEUJ79qj48i7MzyK6++L6ty0BGbHbKZuGYOw3cgas4PlLI/XedmcbkPmgEy3+gCSzJ7sp1W62y; 25:aEs+eX2gmQA+LjlbgWFxxU5XiE02g7s6s21inIjEdOzSv8nVNIXDfjOyYp6qmIC75NJOsDHVn3trD5cYm6NwVvQ0GzNzMktWFwePX5kn+HX86luEwcXaCGIrYbUI0I8niVWA8qnPvrC3Md1oUHEH1py0r3DWQht829dzESq8Q4q29SSaY1yBQtRUFT3Zqk5Q1lgfBxEcmpFvqKPPMUK6FHZlykT3U3E4AvtdNnS0EPfeGYDFCWjnPiuI44+nTXxkkJob5e05+1ml12I5TXLdfKVtiELcPKT5M76Un7+EtOScDSNnL4gy1D94e2XJDPzHfLyqPDgBhavuvQmc/0jrGA==; 31:jk86cRHnXhBSpUr0f0QKozRB5lf3nkO8Iy43cS3wPDH4h8zhcMw7uMiXqbA9rb6n9VHw74By1nrzD9w+xmD0OJ/JzEgjvlyR1qVPTo8QeU5kF1cmy0vHqgdZUvbGssVl14jssDZT6pPZNmGXiT2E70eyKv2jf6Q+2Mt1EgnnHJIoWMpIRD/iDsMCuEaNyI0VTNnl7AyCFDqdBDXox/PIlZBEtdBQQZWPmLx7xvm6jpM= X-MS-TrafficTypeDiagnostic: DM2PR12MB0154: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:ux7L7dq91gVDCP6h7mdlbEWwRZpTJJCMWFKQkO8sRXeGIo7/Z3ZhB/iNzfrr/18bO0Zh/oSTinEL4OuAL5DC+DxYJvjM9G+nCjThczyuVU0j16vfz2+PNDwCCXH2NrmRRXNfXR9pNKq5wDhVc/EflkcgJWPk2qThLnGSEs3a7PTJWZR0a95SQ6yx3O2yfZRqgmiUJM6NhT63iz40GD2YSNF0WVu2a5mJQBTRpvlm3au3bWuzFtIKZDQpz6I72C6O5D3z4Cw6QouxCIJSTz6Spp9osRHEdm5P9cW9H2qP3ZWvH2Aya+XxC5YP4tmPRa4sbdpnPG0PRaPDMBPN8d2MYk053pQtkAv/HVHinhwF7TNKoiWlPPya1R6opMigPSahuM21ptfSfI1BmKV6lCmuO2veLuISi3I8GIOmE+4yXT4rkmLqhzYlDmwCUD/0TN8Msb3AhovK8QjfL8pBcORgT8WoYOr5XpFAEJ+Bcq/whJHVOLY+lpH1ODQlxyhNZlJu; 4:Vq1/g85hBbGq1Voris82FAv+rkgOdTjUOhEcubvkCvqAfokQr3n1dGAYo3nP+He/cShGrvqDO1BreoDLmDWFaI2tayH6RIwSI2kQIGi01bP9CL4/Wb3GXzmCRKZIq6OLky4W9bMvJJdGKbCzMWGFmJYqDVMfTQhldSDxv3VYWbo9Z9Xg6fuNafEFNVgdLdn4Jlov98qrTYSDXolr04kPgqru3LDci9/pOzNRyKQjGjGzxVtWrFXQUhq5cLmQ6gJA4d+F8arNo97o6M5HvmeYQY896u3DCRwclcF5SEDQPiEjlk7ctMal/u+cEWmc4/45 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)(10201501046)(3231101)(944501161)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR12MB0154; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0154; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(39380400002)(396003)(366004)(346002)(199004)(189003)(48376002)(8656006)(39060400002)(4326008)(6486002)(68736007)(36756003)(478600001)(26005)(97736004)(16526019)(6306002)(53936002)(386003)(50466002)(86362001)(575784001)(25786009)(8666007)(16586007)(54906003)(186003)(47776003)(59450400001)(316002)(7416002)(305945005)(7696005)(105586002)(106356001)(76176011)(51416003)(2906002)(81156014)(66066001)(81166006)(8676002)(2361001)(53416004)(3846002)(50226002)(52116002)(6116002)(2351001)(1076002)(8936002)(7736002)(6666003)(6916009)(5660300001)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0154; 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; DM2PR12MB0154; 23:5HnwjBF5hxs7ux2VAUaM96fr9jbGjB3sD7+jO6HiU?= =?us-ascii?Q?abI9aGkBHK0had7jBX5CxzwwKgndNBatOYsRSaOEFMEhDlSVR2OsBAphNbUy?= =?us-ascii?Q?IXA+Ax3D+uNKEPEvQpgVQH+3UbQ5GGM+w7/P+Q4ozxj+wDowvXhb8bvs02Xb?= =?us-ascii?Q?E6mXLPQfhgHKtuXFoOrwKcB8EaoS8E1HLlZPiotFSbaqkor87G80u52ng9SA?= =?us-ascii?Q?Xeu2CdEcj4PyXv/DVEngpHBkpw/1X/FuG1mjy6f9i8pybFMgPCfAQEYWQ8Mi?= =?us-ascii?Q?ctJZsnQZV5Z4joFxJd0zbXzLo5oIYVIxpkhQ6XfEK4Hu1QYM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CRdyL8+C0M5AXPDEuYNd1NDUnTct4R/QcA+yaBnbmR1Sj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:dQox3IxF78ojUcyv/F7QjvqX94gzkslgKxTjL28CwbmhbXau4X27Kv4cOH7xnVOcGaXIlvOx4W4RBFkTd0qg3GqWhuWA9UiswSFWkFWowqu2s2tM9YUC0yJr2oYi1YBjCIAwJCaOuHCsZXfquvldg2uh9vg4sEpjwWkyvGmUZbM8MPbVp0D5PuOQyFmctUmGWjN89RVVSN7pw/jjsezdGSje9Q4YdFyq1TRKZgJ4d+UhmpXNjFmIExN4vbgYI78c X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 17:41:53.2602 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07863f07-9f83-4145-8824-08d5673f965c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0154 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.61 Subject: [Qemu-devel] [PATCH v6 05/23] 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: "Edgar E. Iglesias" , Peter Maydell , Eduardo Habkost , kvm@vger.kernel.org, Tom Lendacky , Stefan Hajnoczi , "Michael S. Tsirkin" , Richard Henderson , "Dr. David Alan Gilbert" , Brijesh Singh , Paolo Bonzini , Richard Henderson 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 (http://support.amd.com/TechDocs/24593.pdf) Section 15.34.1 Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Signed-off-by: Brijesh Singh --- target/i386/cpu.c | 36 ++++++++++++++++++++++++++++++++++++ target/i386/cpu.h | 6 ++++++ 2 files changed, 42 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index a49d2221adc9..4147eb6e18a9 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -234,6 +234,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 | \ @@ -545,6 +546,20 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .cpuid_reg = R_EDX, .tcg_features = ~0U, }, + [FEAT_MEM_ENCRYPT] = { + .feat_names = { + "sme", "sev", "page-flush-msr", "sev-es", + 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 { @@ -1965,6 +1980,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_SME | CPUID_8000_001F_EAX_SEV, .xlevel = 0x8000000A, .model_id = "AMD EPYC Processor", }, @@ -3589,6 +3607,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; @@ -4036,10 +4067,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..f7a0ab20fdd1 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,11 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS]; #define CPUID_6_EAX_ARAT (1U << 2) +#define CPUID_8000_001F_EAX_SME (1U << 0) /* SME */ +#define CPUID_8000_001F_EAX_SEV (1U << 1) /* SEV */ +#define CPUID_8000_001F_EAX_PAGE_FLUSH_MSR (1U << 2) /* Page flush MSR */ +#define CPUID_8000_001F_EAX_SEV_ES (1U << 3) /* SEV-ES */ + /* CPUID[0x80000007].EDX flags: */ #define CPUID_APM_INVTSC (1U << 8)