From patchwork Mon Mar 12 21:00:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10277479 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 BBFA9603B5 for ; Mon, 12 Mar 2018 21:01:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE6EB286EE for ; Mon, 12 Mar 2018 21:01:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A306F28B59; Mon, 12 Mar 2018 21:01:20 +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=ham 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 DDEBD286EE for ; Mon, 12 Mar 2018 21:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932580AbeCLVBO (ORCPT ); Mon, 12 Mar 2018 17:01:14 -0400 Received: from mail-co1nam03on0064.outbound.protection.outlook.com ([104.47.40.64]:9617 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932405AbeCLVBL (ORCPT ); Mon, 12 Mar 2018 17:01:11 -0400 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=LAVkOy+6qSw9XWJCwdeteEQ3yhicYO+GQHZlgrwDEog=; b=y/E3kjegHyR3Mezpinv08BZZffAetbLdspoRP59q0pWCTYnBab3WfaPiI9lUKU0knL+wX3tSnYy+yIouYxUAsVgGUT7jxALizz2mYXwINzpsJfNTHc4Y3soEzwuaFIECxw4hAKgDbHOCdrPB+lUoorXhE9oRsHhBJWYIaDQhgzU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-pyp0.amd.com (165.204.77.1) by MWHPR12MB1774.namprd12.prod.outlook.com (2603:10b6:300:112::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Mon, 12 Mar 2018 21:01:08 +0000 From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, rkrcmar@redhat.com Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org, Gary.Hook@amd.com, Thomas.Lendacky@amd.com, brijesh.singh@amd.com, babu.moger@amd.com, kash@tripleback.net Subject: [PATCH v4 4/5] target/i386: Enable TOPOEXT feature on AMD EPYC CPU Date: Mon, 12 Mar 2018 17:00:48 -0400 Message-Id: <1520888449-4352-5-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1520888449-4352-1-git-send-email-babu.moger@amd.com> References: <1520888449-4352-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR1201CA0019.namprd12.prod.outlook.com (2603:10b6:405:4c::29) To MWHPR12MB1774.namprd12.prod.outlook.com (2603:10b6:300:112::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 37e5cf74-e526-489c-2a02-08d5885c61c2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MWHPR12MB1774; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1774; 3:WqiD+M/t/41rr3A9YnMZuULNhSfI1Y4eItD7pMPUcDVp8liytqQEp9El9xq1e6KI7EqMO9rxGzaet6mMb/vA2MbRGI5i55+QYMJTW9RkRCGXnuKuy3mcEwlxD93de4Q/SGdr1vmD1sTPdT4TlQfdoSXhtZgyVrdlAu8DGeETSCC/ya126a4W1GS2rTOMwd2sswyXmBSKKL+eipRQhDrR4os6qf/hz8F/+56Ra5pd7UHnmEKLj9Bft9QBgVIJJeST; 25:1Sg3VFA92rUakm1luiyLuOV0y0Tij3lYUe+cgMBwVZKbSRJGHoLjVgo7gvZNedK+gf5R/jDYzk/unMvHIotkc6ncVvH4r0MUVleQcQ69CqNKoc+wUZydywZV7ukurClpAWB6A01bEZjrPfDS9/hivdoy6cyx9qNnzLg66BcTboiA0Z4iAwnERRsi+Gw1tMEP94oYukKiFrhY1f395f+A6mUpg53vsw0eTyHvAPNgQkCgcMhcpvyo+ruSr3d110cS423ffSjOATf7fG9RFkfsNc6X0CUGhfmeKFipzoG4i84MqVT9vCU7p2rP12SyK/k2OIgxuUA4G2cWiEwFQuN3og==; 31:BUHaoRtgEU6pHpaHf3+BfZrr5w7RQ+Lj6DR8pIai0PrS6NZqkDaCnq/lzEhs5hXCk2BMak0xEU3TBUPaU9CazbZw8MWGLkAXADFUEDpc/g5TgH0zyuZ8O2M7G3+FOXf7Fxoc/RNU0qloSHgN+rPQupBh3afZ1q+cVPOKXWr2RPIPcaD5lIFlkGWzH4z7R+4T1MW7GKSumIoC0HnPE+agl7kdM8MNLfMybmTbOUQ7F/c= X-MS-TrafficTypeDiagnostic: MWHPR12MB1774: X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1774; 20:OkKd3NYCE9Bo2p2L3rtov3A5lWzGMGLZOWINLoZpettwQjcuNrjQURFtQCNoUKPZAa42QR5wX5+/lFf3Zk4GWgMbEmUhHAaSobNskcmUyYcOtXAB993EpQAwYqjcoZm/ztumoQOFLGZj/OTwyRRFTSoUUB+Uha037DK4YtuGAJX1N6oNUzpzs7JQE+PjFz5msYi1qJ6g6d0P3gYMXjFnXzWfCMlMi7v1t1ing2fEoLwx5quaWhy3Q6Y1i8DXn3xjprhq0mE92PnFkwX64w49TA1n+GlNf9yCjC3epgT2UqBaaHNmgxe7BVB6fnBWR+6IXvODzTEi8a7Uko+Se8IYkhWzqzQ1pRNdFklrReuQcjWTCpfEMTLRE+dKpY00TZr/oxRkwOCvI1UBgHJUKtCMPqT8xOu36XD/h7qrLtPoqu2zSTBraybyFb5yUUCI9A4XvWlMuHLluFOGzfWJINKPohy2bhgq8Sx9rSeI6Y6sRlw3/Yh+4heqUzu0rldJfRt6; 4:lOqemKhRoG5cvhDJ01BsEY4uiTED33mpWdGv2Ogz8MQaiE0BHo6bQyJ8A//5T+WI2UwqUg7/NwE/BuVpMJHaxO8kvMWd3A64skcRxf4/IUZv0CnKEeHzp1TuTUsY9JpgoibRLF/ykAp3gZ/l3eChP/OK2UXB/ZdAXjxNC552kQvmb3rDBbKHPa/+bhFh7LVE9svzKtFRklpfUvrEJcl7zFjwZB9XVNZMUKbXGqSatItlqX/Sjboq+NSEJ+4McYyN79MylyOGWt9KJgOfCqOF/wRWr/D9YCVckthwZMxIEAozmKSY5QepYrficSot1kS4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501244)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR12MB1774; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1774; X-Forefront-PRVS: 06098A2863 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(366004)(39860400002)(39380400002)(346002)(199004)(189003)(6486002)(66066001)(8676002)(81156014)(59450400001)(76176011)(50466002)(316002)(47776003)(4720700003)(6666003)(50226002)(6116002)(8936002)(106356001)(2906002)(2950100002)(3846002)(48376002)(16586007)(25786009)(53936002)(81166006)(7696005)(4326008)(386003)(51416003)(52116002)(478600001)(72206003)(186003)(97736004)(5660300001)(68736007)(26005)(7736002)(305945005)(105586002)(575784001)(16526019)(36756003)(86362001)(53416004)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1774; H:linux-pyp0.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; MWHPR12MB1774; 23:fi6TgoWkPBhWvB3NR58aL4HyZ9eqAV5BJc38ra6hI?= =?us-ascii?Q?kSZw4AnwVBzEVjQpM23E4gIc3xS7kBa7vYY5Q5852IJf3DHLuqiwZnZt5+ko?= =?us-ascii?Q?Ndnt5TM5bh+dqafF9qf0tmS0fF6H3pZiWVYwkkmjZuheLR44pfjLGcXDPNCW?= =?us-ascii?Q?w38IcL29yccAYh5HnWuwQ8MfbSDsl6EavuN1PDvvrR88MQorGbnaY8gPlPAI?= =?us-ascii?Q?UesotgIH4pRJER95ZDyCuybi6NWDCpO0tggBdTSVDfZtn79heO/6TzL48eai?= =?us-ascii?Q?QjuQ5uT9/dWNxIAQBDvwRkHs8R2d2B3cyr8NQ5HmN6H5C/jAlMmY3DBeQtts?= =?us-ascii?Q?GgnPYMHwv5AlVl9TOLlpY/T6IOWdaiMcdWYjcBiLI8BjKYZRqcGFKtuiKSui?= =?us-ascii?Q?kCyB8VaoJnTFuKPqZbJYslGa6/58DuyL8inMTFbyMEjJhpgfV55dK9NihkUA?= =?us-ascii?Q?tZpuJJ2fGIP6BOspHwiPgWvvqxH/OZUqi0KZ79LlqDrSb8nmySIAe9fQ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oRsfebOwv X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1774; 6:6aTsrx1t3JfBf4kqXHInY8hKf0bREDSQQERUIRasWKM/NwGXRE8Fb49PeStZ5wRu1z8AXvQBqIQoF2VjgN2zfJczynIZ5KLeYrc6BRCAtKbNmE674rPv95fcPq69gF4cUOgdsE3yedoQFBNE+ePS+vY/N4hnQzOiBP4aBxsQSC1yRb7Se9/8OeF5pMdBD6x/qExXyls7WGl9cqzG7Mohf+aw33zNRFtaBNzobdVGdcaywtVf5BxxtFOGMhyW3xDKcXf0RpKe44detvE13tV6ziO8Kp2SozIfQs45fd+5lYS2RP3vxNnp32fkQpfuFyeGjVoqTXfL1iQ/sEih+U9wUG2XuhbIHU98OZ+j5YY9EQ4=; 5:awL29hQUriNScaXp7kGuOi8Oljs7Ur0eckCVEyR6HTScE+PEjvI/Nqh3KATK+vorzAz20hXFV3II2ldkNAT6RpPjAdY7pQjdDHBOLI8w5iDzGTDUWOdKp/H31H5rHhw57S9p8KwBGv97swX/Lx4e/ytq6lhAgZ787msLIMx+5n8=; 24:EauLLc1jAowYk2+bkdwn1v67EnhpGNWYlVlLW7Sz9ZOkgLeaDA3CdSbXmhbHuUVp7fkFwtCHZ6Y+M8ViQUx0i7jut7jPsx/vizkm734EZ18=; 7:WjEd045na978LnT+2w9cnDWRxJFz3WZrEobQDO14SUW/njmjgArYNlne11YqH1JBwINs6mu6sCQLfB58kBdHLmxAyw6v0B6kzWdtjrVXzF5X0okBa3D52+7jBAl5eL/vB8nBbWZSfCCcHfAydzbJub7yM0giY5UNxwGvw0zWxeuzZQ+DqvbZyecsrhB4ZZTa0K+QOtADQPUPUwMEa7Y8c2zZSvTuiXSFVLGG3NkGbIIlweX2jEr9twGeORYGLsFn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1774; 20:Wg4rCIivVZzSFMDBv99+fAb727YRN0l7aoihvTFLiv4UBuFlImzgiOzzprbO4nxHwOMqFJ8kl0m3nPTuAeEzLHGWpR7/lzQN+XQR+8d2AlwtTAhz/T4p37ul+2ymRtcC2PbYc1WPRSP2v7mXmzmI8ZSAkI8aY1PQc7TeRICEG02XYDYeSAl0zvmm/UB7af5eOEwtlm38EC5UfEr2r7SzWcW+P5exsZKTnNPIY6EweSLg1ttDQjgPEIfkX8vdsLaS X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2018 21:01:08.4245 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37e5cf74-e526-489c-2a02-08d5885c61c2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1774 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Enable TOPOEXT feature on EPYC CPU. This is required to support hyperthreading on VM guests. Also extend xlevel to 0x8000001E. Signed-off-by: Babu Moger --- target/i386/cpu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ba63d0c..ade272e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1955,7 +1955,8 @@ static X86CPUDefinition builtin_x86_defs[] = { .features[FEAT_8000_0001_ECX] = CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH | CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | - CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, + CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM | + CPUID_EXT3_TOPOEXT, .features[FEAT_7_0_EBX] = CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED | @@ -1999,7 +2000,8 @@ static X86CPUDefinition builtin_x86_defs[] = { .features[FEAT_8000_0001_ECX] = CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH | CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | - CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, + CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM | + CPUID_EXT3_TOPOEXT, .features[FEAT_8000_0008_EBX] = CPUID_8000_0008_EBX_IBPB, .features[FEAT_7_0_EBX] = @@ -4113,6 +4115,11 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp) if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_SVM) { x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000000A); } + + /* TOPOEXT feature requires 0x8000001E */ + if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) { + x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001E); + } } /* Set cpuid_*level* based on cpuid_min_*level, if not explicitly set */