From patchwork Tue Jun 19 21:31:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10475497 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 3BD106029B for ; Tue, 19 Jun 2018 21:32:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A50828C85 for ; Tue, 19 Jun 2018 21:32:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CAC628BDF; Tue, 19 Jun 2018 21:32:36 +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 A296728BDF for ; Tue, 19 Jun 2018 21:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030478AbeFSVce (ORCPT ); Tue, 19 Jun 2018 17:32:34 -0400 Received: from mail-sn1nam02on0042.outbound.protection.outlook.com ([104.47.36.42]:7378 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S967138AbeFSVc2 (ORCPT ); Tue, 19 Jun 2018 17:32:28 -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=LKt38xu8Zefuzmj+daEztLUOHSPdxpFcznxbTSwMhdc=; b=ebcKoMmfcRzthjCyHlKR5UG/pp9DqbSTyzpDatgYEEh5obiC5sv7nejX7NgWU7VGxWx8MTGXHLNDoXPIVXYNHPSKTMLaUd69rm126wxqNyTq50L3wbRyxzc59lyuvyG6OPN7S4Ab4UvApg86l48S2tzjJAQJ3E/pMsbisNUW53s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-h3ml.amd.com (165.204.77.1) by DM5PR12MB2469.namprd12.prod.outlook.com (2603:10b6:4:b4::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.16; Tue, 19 Jun 2018 21:32:14 +0000 From: Babu Moger To: mst@redhat.com, marcel.apfelbaum@gmail.com, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com Cc: qemu-devel@nongnu.org, mtosatti@redhat.com, kvm@vger.kernel.org, kash@tripleback.net, geoff@hostfission.com, babu.moger@amd.com Subject: [PATCH v16 2/3] i386: Enable TOPOEXT feature on AMD EPYC CPU Date: Tue, 19 Jun 2018 17:31:58 -0400 Message-Id: <1529443919-67509-3-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1529443919-67509-1-git-send-email-babu.moger@amd.com> References: <1529443919-67509-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0701CA0016.namprd07.prod.outlook.com (2603:10b6:803:28::26) To DM5PR12MB2469.namprd12.prod.outlook.com (2603:10b6:4:b4::38) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 17d761d2-b954-4f28-862f-08d5d62c2027 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:DM5PR12MB2469; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2469; 3:Iqa61jb1Txjkz6QTs1iP8iyDUoRTaTpnbfiT5V3KFWVbL3EICzZsULyVDtKbNs3ukTzRptknklvjWyoXUwicns8tnilmdjCV0ioVb0QKMg8Em/iwNyf5GMl2NtWhoMTW2y5hWkmCIWrozeG334I64vvAaCFh9n7sHZfhKtl+XEr+Z9nmFvwN5yE5FyNpCocmy+RUs3glQL+UA7urQykRCKa8M0tLBBqBMuVoCbYiAPfj7gwLbH4I7MNnHvt82Hzi; 25:/Eb8oV32ypDr7NrJDp+ino/31gXDuPJTVXiedhu32cw1OlRhK+6t0JTYbutk+FiNnxXLOWow3i9rssK893pw/QwtE7BatO6HEBbJ7ZHtzb3MW+mK2kkHdla8nUJuz8+ONVXdKLWBG+OrLsu2ifGVMKWOqJgzVTrr+2nrMJLxKSUdcFH6dnQ8kOnsuU5ZQwUUVZiXltC36seEicUYwWh19FGpuxOd1dxO9/Z8lRrVgfw8OOcborxBFUF9SYLkJ13o+2g5blTmGCS62mkoANI+eSPaPLZhhjFo4+j6Xj5gpEyG7LbciJBCNyvBrTd2m/zrmP0eIuQ5v7efW0Cbm8ZAQQ==; 31:oN2jTJhO68FKP7hrfsUTBTp+dTqQh2eg5KYfdsFh/md8FGidXvosemew6aMEVI/vggZpqLZ4wbGrESGx1clcrEzJbwYMBfzmqqhwNASeF6DuzXMfbP4Zvv9SVav6NIAKuTQJTashvTsMvQznxbigw356lo2NBeJ54wrfU2Rs2SBbI++JpKBSCQhgO/PgdnSi6sadVX/zDgMd8sH3TiU4CBz1nyhMkzBMd65BR5qjNvc= X-MS-TrafficTypeDiagnostic: DM5PR12MB2469: X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2469; 20:NRgh3Fg2Ci0+YERqOtDd/XcODGYTTNR2BSGg5Gne5y0Fx9kRRXiQ099bliGepRxyV/ClotqF6UxWRyqxSttqUbL7NrPIgtwqmEbmRYoeooMWkj8si7nxQtNobX35ppEW1Oa6sV8E+ne11ZlMHgmracXnnujUM78Hj1Vbs4kL4Atm84t5YuHnUxu/hFDvYPXwhuTmJyrwtRy/xtMaDXY7bx1UkD19fLl5eoie+Az+Q+egKAi4zMVQ2iEn6wh1+6CLU+W6arXukT6tmX+HTkIEwDIbsDlc7RQW8NnDZmXGN2YDw3EbAFBFrr7nhcK5xAOrjX9/jmczl5oGzKGs4felNH4QjW5ApdIj8ZuhK/MsJyS4ktl/Kiub3TKGs1aqIMo+91gpdZvqbnCHgPJd4iMGHkYuvy6zb8JIiqZyP0b/WrKS8W3Lyl0Zi6kZxouraSBEsype5ZpzahIsQndxre2h2KTfCcUBkXEXjfocJCVQwwco4PDKVVZe1SZyox5YRz0r; 4:zRjH8DFzBNfF5oopYi135MDOHmnM4+sfRyLhOlGjFHjX5sZkvhh0WJjF6v6JQFJesXt0nOyF5kbU73x8XuRJ4zgrU4bPUG4vszz5Oqt9ai6m/W0oYBnO2Y9qLJxqGU/jyfY2Vy+wrpBmzrQtcr2X9pGTd/641qorEe3QYoStHp3BBrBBtkrT5X4nA9FtZVFXD63XTzZk3zZShQOTT3LDNEQZqWtRX9/JK3x7O+b/HpQckGCM62GaUGa1/KzorXojCeiQKzwyL5lu9p/0oa28skxlN7q80CiwCGDxrtAM2ba0hb4ksWgiEmAFfCJxzHBT 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)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DM5PR12MB2469; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB2469; X-Forefront-PRVS: 07083FF734 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(366004)(396003)(376002)(346002)(189003)(199004)(106356001)(575784001)(97736004)(26005)(386003)(76176011)(316002)(25786009)(4720700003)(16586007)(39060400002)(478600001)(6666003)(72206003)(186003)(16526019)(53936002)(66066001)(86362001)(105586002)(4326008)(48376002)(47776003)(50466002)(476003)(2616005)(5660300001)(53416004)(50226002)(7736002)(956004)(305945005)(36756003)(52116002)(2906002)(8936002)(7696005)(51416003)(81156014)(11346002)(446003)(81166006)(6486002)(486006)(7416002)(44832011)(6116002)(3846002)(68736007)(8676002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB2469; 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; DM5PR12MB2469; 23:hVP7u6cnmcfXgzIAbbJtn9Sh/hXD0v4PnXXCPyZdA?= =?us-ascii?Q?bxPX4OhW5iVpcEVpM++HgBk2vOvcIHG/dE64ayCtYNF057/iglY7PsWH/D31?= =?us-ascii?Q?gahXJKS9PkzOjjeL6IXyMy6Gey7jmI25IqlVpbMcVcISodv1ElDEahCH7z4j?= =?us-ascii?Q?deY/a53awHOSWxwZZtiSrzqG/uidqlzXiRl4esEXuz24aqfrPLpPFSls3Fh1?= =?us-ascii?Q?1zmfNg5MNRdEe1wtrQpHW2IhxaXjYlUZgiLZOYdPL2jPCawufCgOAO9JN+0Q?= =?us-ascii?Q?PuydKdtfrGpm3yyEfq+Q72Meaa5A9aauOyeA2ImscIWcnK8T0J4L4zgcZfL0?= =?us-ascii?Q?f8CmXWerkhL4xdAn6owh/QDmGkZMBz5dDr7mG5THjluR7mVGUs4gLcTP/MJ/?= =?us-ascii?Q?Lh1s9eNgbaza5kpM0iKA4Ork0bGv2bGuX7d+FwE7r11t/OfBc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9Sp9UM6whQvpEWtRmg0GKTSriqAMqBq0jlP/jQr5RwI82A2/1elq7QM7hNWWdU5ArTT3xRvOVscroWEhF++vdnOZZNvXc6v4n7KvwLw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2469; 7:tjQ5T3EWtrSdZW24kPelwSQ5+o+TY2DKeua4T71RcuFHRhwTpkwcJIQr/VsbrTkqL7LJAe+sBkZLSXJKAoyoWTdhYvXDZbncDD1nvqukkHWLMejP8V1JhwfSv0K5fm2SiyL/13VMKEvLo1GkDqu+YDg09BWD1xvKLjGs11A5DXRJXo66xpkz1N/+8w2XCwi5aO0NZwerCz7Fz3BTp9B0z0uJxebOvUz0AZLepOC0ZgdTNwBfVht5NWyao0+2A+PH; 20:yPegv1OEwJvv7EcIROh3nyvgeysoj+waWLtnLBFCxoCwUlzbwfjZZXpBYQbReFZOqDQLdedq1cvRsePPBxkZn5x10cp+kl63ucuIvWStkiw+DhK2iIuirNVaY/hkoAhD94Hv/ciO5obYgpTCp66rWdtLYWE+xkvO1nwrsDeQWDXWLGzju0skQyM80FbAqxsWO1pUtXiIAwlVOkiOrTcQczVg38uB2I0oCYvnX2mXUeE4a82igwDvUYMyI4KLn94E X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2018 21:32:14.2644 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17d761d2-b954-4f28-862f-08d5d62c2027 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2469 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. Disable topoext on PC_COMPAT_2_12 and keep xlevel 0x8000000a. Signed-off-by: Babu Moger --- include/hw/i386/pc.h | 8 ++++++++ target/i386/cpu.c | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index fc8dedc..d0ebeb9 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -303,6 +303,14 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .driver = TYPE_X86_CPU,\ .property = "legacy-cache",\ .value = "on",\ + },{\ + .driver = TYPE_X86_CPU,\ + .property = "topoext",\ + .value = "off",\ + },{\ + .driver = "EPYC-" TYPE_X86_CPU,\ + .property = "xlevel",\ + .value = stringify(0x8000000a),\ }, #define PC_COMPAT_2_11 \ diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 130391c..d6ed29b 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2579,7 +2579,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 | @@ -2594,7 +2595,7 @@ static X86CPUDefinition builtin_x86_defs[] = { CPUID_XSAVE_XGETBV1, .features[FEAT_6_EAX] = CPUID_6_EAX_ARAT, - .xlevel = 0x8000000A, + .xlevel = 0x8000001E, .model_id = "AMD EPYC Processor", .cache_info = &epyc_cache_info, }, @@ -2624,7 +2625,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] = @@ -2641,7 +2643,7 @@ static X86CPUDefinition builtin_x86_defs[] = { CPUID_XSAVE_XGETBV1, .features[FEAT_6_EAX] = CPUID_6_EAX_ARAT, - .xlevel = 0x8000000A, + .xlevel = 0x8000001E, .model_id = "AMD EPYC Processor (with IBPB)", .cache_info = &epyc_cache_info, },