From patchwork Thu Jun 14 01:18:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10463151 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 31D35603EE for ; Thu, 14 Jun 2018 01:18:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2056528C3E for ; Thu, 14 Jun 2018 01:18:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1470928C5A; Thu, 14 Jun 2018 01:18:58 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, 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 A0D0028C3E for ; Thu, 14 Jun 2018 01:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935786AbeFNBSq (ORCPT ); Wed, 13 Jun 2018 21:18:46 -0400 Received: from mail-eopbgr700079.outbound.protection.outlook.com ([40.107.70.79]:4864 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935725AbeFNBSo (ORCPT ); Wed, 13 Jun 2018 21:18:44 -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:X-MS-Exchange-SenderADCheck; bh=lz6qrv5B5zZbZzExwTxDWSxiox4MLAm2l2YttHxdHDM=; b=AMwpDdvjZKXLmb/2nZ5DEkd7t/YNyy/a8sDcNDizIhgoTS4egW69lQ0BqTPkK3vnlTPfa4/erIzIZEA9aC0qdr7JCGIDnJdjenXjlqu6eXwVE5U4egOuhx9JtaCrYh/X5mjTAHJdgISXCAONJwqWHQmByFEZnnNJSYyk8Q48l2s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-h3ml.amd.com (165.204.77.1) by SN1PR12MB2480.namprd12.prod.outlook.com (2603:10b6:802:29::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.14; Thu, 14 Jun 2018 01:18:40 +0000 From: Babu Moger To: mst@redhat.com, marcel.apfelbaum@gmail.com, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, mtosatti@redhat.com Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, babu.moger@amd.com, kash@tripleback.net, geoff@hostfission.com Subject: [PATCH v14 2/6] i386: Enable TOPOEXT feature on AMD EPYC CPU Date: Wed, 13 Jun 2018 21:18:23 -0400 Message-Id: <1528939107-17193-3-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1528939107-17193-1-git-send-email-babu.moger@amd.com> References: <1528939107-17193-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0201CA0064.namprd02.prod.outlook.com (2603:10b6:803:20::26) To SN1PR12MB2480.namprd12.prod.outlook.com (2603:10b6:802:29::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31a42387-e6de-4fd9-1ef1-08d5d194c3c6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:SN1PR12MB2480; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 3:mTaCs4CgGQ4PLkkNGBs98+ZY/o31WVOPn0mnMy/XYkKgPyjhHexQukF6TfDJFPynXZ0AR3xnC6u+qd+feWzREyHD0RjilswjraBzTFWULjzWlwTAtdW9tyZdPMTfJ5OxLZE9vtDAp1jih86X+9yFvDxiyG8DxsFZaF9yWoIC5xB41BGTxPgZnb95wpha7CObzww1CjCC3W1Sp4NgoBAYuDRpTSpiQSSdzbqBQHKNm41BpU6TELHEbcOSUKxCg+2q; 25:NElAayKOQ7Ye9I/WtRsgHDdxpOpzumt9xCY0hfegJdGGCoWK8aL8MZGrqcmRyZu0g79bHbbgM/+vok6b4bQzmZNzkiukf4+4LWXiReCW/cttcay/2USgryjPQfjAUrOScU56xnLBm4rJn9CBhFCXNxphC0OtSLUP0WVfdIAyjAs4GbuuT2b5Yn3bbBheSz2NZE4Xg0sj77pQm3TzB0SyTPcmN2nDZ5ijOWToyEO2snB6eqzBl2eXInqWkeZqXOSrThcNeOxy7VQi0QYIHPKaGHmGh0GQQy00X8CIq2jkUc/dnM15NyQHCC2fmXovfZPLpmR0WDrHTvoiGrYPSCXdPQ==; 31:pYk+rr7A3pcLSm7+65NAj7Mxt2//+fxe1OGmJM0pYM9nAzzA1pyJTs+eYYDhNaGBwcEYmDF+9HkjWMQrqpKQx28Aik3p/1jD9qWJmkXJc5kiIfW3T+RgtjZ5cT9NAfL/V3Azm5G8xLk7v81B3d6xWLQk+7e1CCafeRJZCnWT6Syw9hGx7Osyv+0WJIxksm8MQ7cFa1goUBDhNV7SoR+/NBO1kFXvqZebTtWCldffofY= X-MS-TrafficTypeDiagnostic: SN1PR12MB2480: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 20:XfByEYHzHPL3KqP3sQT1wzFIZQHM5Hqlqi0C8/XXk5OOLPt0RfzZkEilVu0YCBZRFkIBuX0i3Ofe6/bPfe7c7yX3kYPae1WVw0UfjzvjATAK0IjxOmjsaNUYv6YJE4dbsynMrVtgrwUR9zIb9VgFNp9Ho+mepOi2poGG1cElDwRoJmXabKnCb1Eycs0B2hAxIWCc+ueuzKQD136o2HWNU+BYxa+9AHpJxV4RW14UBoocSY3DLfHf42WTvpdksWNrYVvZY04LoZz0nXgSdVuzCOnisNgAtfBLCrOoGbMVYhVy82tUvejaULrq+a2SQ0o5caFuPwCO5KHilZM9agZfkwZx+p/SLL5VuaGnKcx+WHsjKgV3/KC8JVBTT1qVhBXORevlRBDv2g3hmn0kK2XmtEny19myw1Q4VhiW7UL/EEaAclxSD3qFMvRBbyPDuPtm6hwUsVMNY8BVdv0RHBr5pNycV1uV+DCqWLYOg8Z9hLmDmmOAXyyZa86zg930qT+Z; 4:jru8b4zzh83RCXXoabypm7T+4bxN1rRgMbCwT+abZw4cFxvCKWrjhWYAZi1glJ4FURt1C6akm+I43HhUnOHp90CvIrgRVWGy23WPnpmYnjhj6jbowdEudDDxGdhtvqHj9d2JHj5lBST52yu0Kq6eh1BMK2r1ihe0nwBEIoijRHw9LFgVWGGJhUtjvEN64cuhdgoahdlLgYnXOctn+3CfsyYZLTotjEiRFVTmUoU4NCRemKuiMn5ALJAFWzWS+k/0lfPaqmqmFuOHlnCPdcKe4Fg4OPXnW3E59kmOCMdJQFQ+bCJKmSlebRDmi0rBYNlh X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:SN1PR12MB2480; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB2480; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(366004)(376002)(39380400002)(189003)(199004)(68736007)(2906002)(25786009)(52116002)(7696005)(72206003)(51416003)(4720700003)(956004)(6666003)(2616005)(11346002)(44832011)(486006)(53936002)(7416002)(476003)(446003)(76176011)(6486002)(39060400002)(36756003)(478600001)(4326008)(6116002)(5660300001)(7736002)(305945005)(86362001)(8676002)(186003)(97736004)(16586007)(66066001)(3846002)(53416004)(8936002)(16526019)(316002)(386003)(48376002)(26005)(81156014)(81166006)(59450400001)(50466002)(106356001)(50226002)(47776003)(105586002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB2480; H:linux-h3ml.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB2480; 23:w/eARVa8UF+2qPl5fSbsFQGUIKI1+3y3QTBqMaJBd?= =?us-ascii?Q?HXYUY5Gn9wMlkw2LE9ZwBSnGRZRBIdeCx9xdd93EU5QpHBBKhRez60Rtwe/W?= =?us-ascii?Q?oozrpIE8PfIns3Ek6aDkA0yX4ObR/2WpeciARnNfI/OvyHW4HAh0BsTlVS0O?= =?us-ascii?Q?hNDDwjlthqI4jPU52twIAnePxVB9SZ6iAkhOMQA50i1LkNdoof3QdJdc79wv?= =?us-ascii?Q?Bw+bdyVzwQAF1/+uX/EC9WaA0+zU0vXo75WyZGloA84OY0MAWnPXsRsz3kX6?= =?us-ascii?Q?AIHb2g5VSBGiNyC4Xc4GO2z4S399Tw3qaiXBPvJLbe+F0z6iuugM8B1Hfz20?= =?us-ascii?Q?xEdsgWKmvZxp2CqMv7FxnOo9osfCRncnHEoqUpouAAvu/eYy7SkYuSo6xuae?= =?us-ascii?Q?VCLPAmbt4PG9C8SEf/VApHMmkgA7yqiYKE/MLqOW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DiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 7:Fcxql/vpxATH1QRKZPkC7BammAGGbyh2nf7lhHzEMN2e/j7cGRMGhslCc+r07dYnyr0OIUr9R7r2ZBzqQBEKqpFvh3PmkBQItH9KhIidMTXFiJjsO147ocm0y7G/7+rsy2ndFIdF3TEakRltRrf+6WxkFbK5mo4pKyuC7w5dq3ejS1ktcKxVMK+l/JOAU78Q8v9hUGKsiXeQoK3QdLaUh8MUA+IhNHXJ3ejIPz7pYHiP7Z0faCxfHTGtQA50mMNe; 20:tHp36U5bHYc4ubf/IFhU9PK+s7KiJJGOD89TBylV+FsJPigCv9ZWLs2UNvGq3czh3BsYMaOuEjGni24XiSqT7JqqPstgnoBVgX1bWpCzoWAvBqhdh/ibdsOGqXxl4575jhCHYfY6NSgsmnmZWG4+d744wR7/5uBZiTr8IiC+BrvdTn8VN/5NU2bYKh8bitWjbibThh5hALml9pdhHZVX4MzTRlokv11o8EYsXsGbdhirEvsXJuSPryPACXPoigDZ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 01:18:40.9327 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31a42387-e6de-4fd9-1ef1-08d5d194c3c6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2480 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 86fb1a4..2eb26da 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2554,7 +2554,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 | @@ -2599,7 +2600,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] = @@ -4667,6 +4669,11 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp) 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); + } + /* SEV requires CPUID[0x8000001F] */ if (sev_enabled()) { x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001F);