From patchwork Fri Jun 15 17:15:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10467143 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 3514E6020F for ; Fri, 15 Jun 2018 17:16:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2672928E14 for ; Fri, 15 Jun 2018 17:16:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B38328E16; Fri, 15 Jun 2018 17:16:27 +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 8DC7628E14 for ; Fri, 15 Jun 2018 17:16:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936343AbeFORQF (ORCPT ); Fri, 15 Jun 2018 13:16:05 -0400 Received: from mail-eopbgr730085.outbound.protection.outlook.com ([40.107.73.85]:22816 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936047AbeFORQC (ORCPT ); Fri, 15 Jun 2018 13:16:02 -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=Kho/kKDdrXaIDYo5gGxvSTqKGAiUjrXNofmbuasyhIQ=; b=joA42B1Xogqoe9K/aCseDMiE3k9D2lVCF2LiW4kOa0Ks3n8zf+h0ds5FOSy1KoqkUuZodbuY3cyQdEYK++wsFtTK2wgeL6y703TSyOL46LfjzRjbFeujPjN78C9AEvdU1b1wzq/WV8H1hiPaC2DjvwdYWKJHqDN+WSvCJLqwUTE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-h3ml.amd.com (165.204.77.1) by DM5PR12MB2471.namprd12.prod.outlook.com (2603:10b6:4:b5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.14; Fri, 15 Jun 2018 17:15:58 +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 v15 2/3] i386: Enable TOPOEXT feature on AMD EPYC CPU Date: Fri, 15 Jun 2018 13:15:46 -0400 Message-Id: <1529082947-60001-3-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1529082947-60001-1-git-send-email-babu.moger@amd.com> References: <1529082947-60001-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0201CA0010.namprd02.prod.outlook.com (2603:10b6:803:2b::20) To DM5PR12MB2471.namprd12.prod.outlook.com (2603:10b6:4:b5::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3285b20c-167d-43d2-03bc-08d5d2e3a9f6 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:DM5PR12MB2471; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2471; 3:QiD4ZHvg7f3s5tjEu5Bz0NIj1ahoXq6Z+Y+mlk8qizf233I8k47v+hnwaYrITSz+gcH+jWDapCTn4mQyE65q12inubFR/rMEA1ktjl2QkMheq9irz4ZZU11N4HTbefEdulajxfdJKO0Z+O9MHwuxYW+NyiyCwirvoLysgk3xN3DrOgznD8x8w2BTA2/Go2GIRW81qUkno0d/2D2xwIqhGJoWdSAWJqw4uR9CARzDarD+7ESAOCcHQ8bEd/WYFslW; 25:MAvYou+5GxejCRavOQX6JaW9tFDkMyMTvwz4Jp9g5phCRPsyK5eAcJgvlZxMUbmPAsJQW8i/Rl4RAS3QoU1ekNjOzC2uNrmUZvY96olb2EOxcvSDsGSTZDVY9G2AkjD3nSRB/gyzfPEetQr+BnK9tJzjIMqXjmBKIIOh9rxngoBlQpucSZ2oib2OvITpqexT90F+eri9vIClhdQBMduDcVKJn/B4s/Ott5xnAyj/aUTEDTAEy1YfSkA0Z2mFyLmpkgkklFHuJLj8p1nHwEHLsWtp0cU2vHzJ6e49wUA/IryBCn242OIzEeBGW1Ed3c79GOfWiU/N663UNsTGs2Yt2Q==; 31:X/zNay+RFp5VN/Hwx2ieI4X/iqbBp2/qKxMPtt+r9KHoFwaNQ6cxTYQ9aIW6k7xSTeimKl8cuac/NnUf9mUBLW1nmKXJBG349jOo+c+peFFq5P0p7gX9zsO4cv6HT403eQW+4OFKcvqT8IhmxaiwtkJ/pf1xBfYtJy7j55HONoY5l5sdY3/Km2yop2NgEaagWsiWCLCHOYCQ7RjeyibGJxuFiVDDQE3pQW/SVxuaIvs= X-MS-TrafficTypeDiagnostic: DM5PR12MB2471: X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2471; 20:cHEyD/OFDey0YmIGFM5rDA3fYTs7IFiKU1vW7nwBtdnZo7sLXfNGh9Ngpq3/egr7qpCB55TSpLse2sbCHV5/IyEIL4dVKHRQPSeFWpX+fYdBLso4+ebsDOCbZQybQmP+dvKo+5059ZJq7OT0MyMP7d0QYbTsEw4Jgi2UJ7jOmAkponVp/MqoL7lKeAS0Vgepwf2LqT5Ldufx0ckw3fXj4lJE/Xs1SMaEy3Suv+6DkfIwOy+QDCld1aiE5XeWl/kUgCBAjwyd/MM7FglF8FiThLyBjHicwgTkxNEUcPMmF6dg1YeHh52n6sHSvDsjYsgLohQcv8SQVoEON7yO+sQFQbrhtOxJqOiunfIyDU7NjZflT7v5y/ec1wstlbznH24B6gKIWcHmFy0HgZ2YLCY4504Moy+IMCJtHvuVHnbg60cv7MWLx6zEE/T1RiLPG+sK7OgTh9w4CATf/E3VPXTXl8Du2ftoa9JgCTMURKsR+ER6Ad4G8TKMfMrOt5RuOorR; 4:LGNAUldrh50Jop3+07pEYzqLcfm9n13r5R7Vu+RPU5VuboeGY/Ee1awPKCE/KYPBaVWE0N+dHXWbopkexYyhGAdDdLbWWqREWv+iBZb2CuN6m6SCJphmzSxO+g5cWG3E8LBOVi8hmgGBbknMEY9+zvEpFqZ4CjIpanbASvvCUbMVgmQFNwuZ8zhnN69fH21n67UaZY5pSuzelrfyBBiKq5HcEXzkyXnPuKmff3s6pVbXZtc8lIEOWiVvTcn1hxnni6Lcn+CfYbxHlFrnbT0YIvt/Ma7/sfkzt3q6SehWnwgdBwZFI5GLc56EDUDPzZY6 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)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DM5PR12MB2471; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB2471; X-Forefront-PRVS: 0704670F76 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(366004)(39380400002)(396003)(189003)(199004)(186003)(66066001)(6666003)(86362001)(575784001)(5660300001)(8676002)(68736007)(47776003)(36756003)(478600001)(7416002)(81166006)(26005)(50226002)(48376002)(386003)(6486002)(16526019)(50466002)(81156014)(4720700003)(72206003)(25786009)(76176011)(51416003)(316002)(446003)(52116002)(8936002)(7696005)(4326008)(53936002)(3846002)(11346002)(305945005)(6116002)(7736002)(956004)(476003)(2616005)(97736004)(2906002)(486006)(53416004)(106356001)(44832011)(39060400002)(105586002)(16586007)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB2471; 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; DM5PR12MB2471; 23:FysHzy3q4dgm0KlfHhTKMIrsBOUA0ssXqp6tEeQzA?= =?us-ascii?Q?XmdER0VLLNxHglpaItFJ0WPs1UYb+8384D89VGTuk0/3eqjKPeMjDRIw8IZF?= =?us-ascii?Q?Z8gTbFWtv5iVCau9bww9DZQkuqTYWJB682/Lhf5ZMNIo+ef/inlYE/0GHtbk?= =?us-ascii?Q?DSGN0cU6j0tupVM8oyEtEtr8UKcge/quVm2PyvGn+48yj8c7YYeG0UfAp8GO?= =?us-ascii?Q?xPPvohCqLpyFe2CG0ldctFTBSDJh3kf2iHjptMy4S27YAE/mGQm7Q7wP1pon?= =?us-ascii?Q?XqYjewA9t2osgnGrLkKvWDJVHUQm6jlwPhVHBOkpttoV62F4tifS0yeeZmAZ?= =?us-ascii?Q?ytNdfLwoSXleT/E7MxdTOdiAvjReeKEuatnzYz+ooFHG6DXt/FLWHSDUjxMx?= =?us-ascii?Q?3oOq2wms9zaEaQlTJ6mZEav7q9wSozAkjhgOK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HEcM=3D?= X-Microsoft-Antispam-Message-Info: 1qoHwdCvtYsfkZC3TFbOUbj+FkukBBR2IYL7Ili/7lnfJLhsT/YqiZsKklHr9TZgH8BhgCjNaALUqY0pKE2bGAfppQHKB+wFXo9offj1k9cB58yvq1FD5kCy2uzbSNusisFKedmVQ//avaxfIewN5CSSIpueL0ro7yfFe/cLtgbt7WT/E9eXt/IhQq49OUrA X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2471; 6:t/K9zfvuTEy4IXftjg4HVOyKszSabqfRU6SyQrsl6anCYi2Du5eKNE/U0YzhFx0UhyknBbgL0CEVrWOVsEhPthSvLpgmUKypSXPJvPN4LAVOWrQ3JFM29U7JrZ5bMs6ozFHjUfY58FuZ7LRkiSkwZQyu7hXtAY9ASIYPSFCAEhTcuR+CXg+IV47TrGQLP4Rpz1dRvNs6kxyvcaIJzZ0CQSuEsd27UsCYDNg93fy7rkqMk+gOilhnwTmfaNGLB+Pm2v+AgGnPvw0H0cRpGvYPAgf4/+rDRygDTdmuaN0FRChvtjKMp5gfdPDGxQtS9NjQ3NqI1wI90SXrb2S2CZtR16mgnV5ayraYasRHiB3t+oYAIxg7XyfMuVtET31C2eG3ZfDFZV+nHQooiQ4KeKWpfP4BOGo9jWSOZ3vJB2dwcnsdXTqPz4eWnOQmXRKsGItwvvff2Yd3pjl9ufLWSC6jtg==; 5:Ql/NHNDzmWmfXi+zHIMWOhIrdUMuB15SYl6B6BGdDuOWNSeE04PGiAwET1aRoue3YBn/CfHujc7Ht9yJROKS5J0F0aDGjF5BFIy4EGn1HycXqcfIRcyXNc24Pbo/HxypvXpf7f72WnzO4MRnkbSP7/F7D5pU+vDs7l/djKPk1CI=; 24:WXdzq19YuFTxmIgHmtXDbQsbaGNiTfsFhiRDWIX2BcaO3TY+l2U59lv+2JNhmUACCcL3J3Rllzx3UrT0j0lww/dQzfmATk2JwIw21zf0rmI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2471; 7:p0k0C8XSh8aw7LjQt+K7vLqJ++6Q80nK+I3dQlZxb5ZdZH3zTJMFzT4M8YkFnDdOkPSM5q1WLCVEa7GhGRyc8YhsrhEO/jW5xJGVgMsK1UMfdphXEBcMmEKkRZcHhUyVYIWP0e8woHCPyfQadwyR5KGtjcp0uWgqGHerN4Kr4p7GqRszFHrLvC1K/vAdG+miaapbiVumnQFYc6bAyOF7GOZvYitg1ynOqJirHnHHmgkBVmuZ2yvo+dQI0Q2b/3+D; 20:9jx2aOHmO2KrlXehp4b+3m7/IOe4i5N4plDYpiOValEJqQSNXzY3QtZ6M195p8IeiSMUf3exQtrN5mXXIU9gKK3z0ySKaYtyt6pX/lZ/aAuyo1bXXSgmdIVOz6C53SSvoy4l5Q4B0Kvyg4GfGv61YvjgoX7H7Y598vRtfqiq0/mBX1Ngq3IzFwQswhv9HSVikYlL33790bHuquPzFm/Ud1sShdP3f/HAb4Kn5MvH41lfzsA4byLhwWnBquhswrBo X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2018 17:15:58.7130 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3285b20c-167d-43d2-03bc-08d5d2e3a9f6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2471 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 5246be4..2f839ec 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2576,7 +2576,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 | @@ -2591,7 +2592,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, }, @@ -2621,7 +2622,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] = @@ -2638,7 +2640,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, },