From patchwork Fri Jun 8 22:56:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10455299 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 33A0360318 for ; Fri, 8 Jun 2018 22:56:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22F961FF40 for ; Fri, 8 Jun 2018 22:56:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14EE52943D; Fri, 8 Jun 2018 22:56:54 +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 9DEEC1FF40 for ; Fri, 8 Jun 2018 22:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753116AbeFHW4w (ORCPT ); Fri, 8 Jun 2018 18:56:52 -0400 Received: from mail-bl2nam02on0052.outbound.protection.outlook.com ([104.47.38.52]:52759 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752918AbeFHW4p (ORCPT ); Fri, 8 Jun 2018 18:56:45 -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=joF1mS6fZLNhN/CoPsLVv0okD4MpfoWpG3An75Vq62Q=; b=AQa00OeAnfrvASrjbwQKi7/vRYiNjkJGRDsKEgddEeWYkzp6pPNAHfr4VPSdxvFa/fhhunWMLN3LPwkVDYIAlRIH2vsaR1+wY8+7gr1hR1smdyhb6wrd6IvD3w6ucuejpSujNBksUXF+Mymy8cgePqXKF8fIZp7XlRYTh8DcXrY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-h3ml.amd.com (165.204.77.1) by MW2PR12MB2473.namprd12.prod.outlook.com (2603:10b6:907:9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.14; Fri, 8 Jun 2018 22:56: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 v13 3/5] i386: Enable TOPOEXT feature on AMD EPYC CPU Date: Fri, 8 Jun 2018 18:56:19 -0400 Message-Id: <1528498581-131037-4-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1528498581-131037-1-git-send-email-babu.moger@amd.com> References: <1528498581-131037-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0401CA0034.namprd04.prod.outlook.com (2603:10b6:803:2a::20) To MW2PR12MB2473.namprd12.prod.outlook.com (2603:10b6:907:9::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MW2PR12MB2473; X-Microsoft-Exchange-Diagnostics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qbDPdNIDx82Pde0OZAOjf4IByCv3VkAG4UW1bZRIetLpRH4liKuHiWYQog6gDbcELd4knKNzQDuT6UxfbWuRI/hLg5xeUEl2CM3QQDGHy37qvVPLq1nbxbW1yj23lNJ8ENWxOqeK3hBnRgEuWloqJvxTGehUU0krerae0vpnaS7MuTXxdw2wRm9ZHZTxLBGMP05oswyxHhaVujM+RNXmbMqxKcBOtFeWYRq3a9j1BVzl3/BEEsaH1vn/gtRBt5wnf3zsMPkCs64BGiA0mRSaj+59Kn8DzKOb1rx3MqEKyTyIOKIoUcBQHlVRtqQhmkPTvacFftL4WvwAr/vgG4a+hiYmJw66Znt4fmDDymVRR; 4:s4rHV486mjFR9C4Dz6qBe4duPTIEPfuYJMwfD5q4RYli3V7Olr0IZiw4Hr+1PBQwDCRRDisTTm8UEwey/Uo2OlqhT2yumuHtVkCyjGNj8UeicRd1tG/JPiFWExxaz6SDlBiHovSU1/YZUPaHWqctaxUx3uYzrmtm8BPqvYK5G48vssaK7iGOEPHfGXR3y1f5ri7O4qXHN/z5WR6vBNRa9PtsFkWjf8+Y+5IX2LX07UWfNxamswQE9O5VDCsPwmj75bJSUGCM83zwUoxiPsvfi+6ti56i737DIDE8pSVJsXCVL2zyJyH8C44vy/7tGtcF 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)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:MW2PR12MB2473; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2473; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39380400002)(396003)(39850400004)(366004)(189003)(199004)(956004)(7416002)(305945005)(6666003)(4720700003)(7736002)(53416004)(53936002)(48376002)(26005)(16526019)(105586002)(16586007)(106356001)(386003)(316002)(186003)(7696005)(52116002)(39060400002)(50226002)(51416003)(66066001)(47776003)(50466002)(59450400001)(446003)(8676002)(11346002)(8936002)(81166006)(81156014)(76176011)(4326008)(44832011)(486006)(2616005)(36756003)(476003)(25786009)(5660300001)(97736004)(6486002)(3846002)(6116002)(2906002)(86362001)(478600001)(68736007)(72206003)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2473; 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; MW2PR12MB2473; 23:/iZkN30DAw33C1nCslW7uatYhLGmrIGtwq1wZGgXx?= =?us-ascii?Q?QT1s2gvoBnPD7RHPFuo+84ZJGoXxFrZOxfh05zByhhXlU03etI6eSvu3CsOw?= =?us-ascii?Q?97XdHzemOs3Cu0e2x70+WWUH4/GM2w7uAFBAkFSUIUB8sHvm0jbm0xJTgLiH?= =?us-ascii?Q?udDzTiC8k1srE5EE5q10/lmV1VFS1kqBKoyiov7HeK1+FJ8qhYhT+7hTyB6y?= =?us-ascii?Q?+RhW4ILTV409zecKWpjxC094u4v0iw7xwaFWD9wgZ1p5exCKvHeAGaQZhAhU?= =?us-ascii?Q?EXYALSim4TOa68hS4W5YWdDNYaQx7sxHij68ukVL1cKgfzi78r9bg9aQA0EI?= =?us-ascii?Q?+bKyJikdowONg7lw79g6ny2Zq+aJL3/aTtxyPRULfB897Zi0W/AU/DPucYBl?= =?us-ascii?Q?R0TaKLC057AJvastSRAt8epakR28IGLmg85BHBDAUs3QPXO+5QToccs/XN8W?= =?us-ascii?Q?9QDzTyzbV1Ap+PO88woCT1xeNEd5aDjOpeC6JW4R2PEbR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sL2X7OWJtGGklN7i2C3CFJb6joFAJzDPsfVkgpcuVn27u/PB1cTRQgehg4cvbvf7DUILzZLmtKl4CTEtdXHFsPwfRxBH4ZKLs6W2EmFEMiTZ4In0hiIztV93je/EiO/DY09ZSUahe9PCVKcNE3pjOrXf/OMDyiAoaokZwjNZOKhAbwllRf X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2473; 6:BpNWtnnmsnESkRUaV8eBv1vTqH/tDeq6TTLteoD/4u/1fbpkOZv5ofY/0U/iLPyIzi+7kNkeEbUVfsjpLq2aceRAhxdjKzH9JtIhlczTdAEXfSL7kKQGkHz8qJwalhgMzNdl7B48ByZL4iG78ZAhybHO4f72bj+sHbG2vU7YMUqfs7hP25czrRTTjddf9+WSUrLqxmonJfNF7Ds0nbh8n8p8Z9fSrHINtNNbKDubCI5yt1kwUhk8VmQhvE6NClOiATbT5j2NyIVDZVIPL6Y8RlyateEnt1++Nt6TF+5+vvvRN/3m6yM3+35zmVJFQN4GNv0Fwc9Tke/9Bompvar0XeFJzfTb5qxVr0Sj6+HizBn1xD4whWgBUXj/z/hyoKe5dEvk0S+bMyo13l0awkJycYrg4iXlaTDpKrXjd0sux6EwuxOtanldb+/MGHMf20KUtroEr5HrNjzgz7kG3Z8K0A==; 5:S8N+CSZ+mx3OriA7lTtPUV8VvS3BIzETnvee7I6ebww6PxYw+uBHH9WCKjnH+obyg3Wo9dGPFxon1XKJdF6OLuY/L0YF7uDyBv+RNCXe8JU60XVy74eojyS1hIVSksyWeVjziMCvCppToJDbBXRQX3N/P5+REbSGACucbtPEAvc=; 24:redSOyXtJ2Okv4ramGqjkkW0CzMEPs1fqRHyWhf0EOqwwX6tMjyl1nrfaCW/bDtWr53KOjMPLnWsRm3/xUTh87WK/rqEr6Ji5hJSNiGl82M= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2473; 7:MrgzikkS+Hwi7gk+4romdCSjiKeyK7p5sEDKIWi7JEBf07N1Dm/JzXDdcwlIQtejPiV6itA/WQVWDfR33rQBbDRHTQ3Mp6gqI/EaA29wa8roLtzYV7MsqRwGdN5UXLzr8JtjRfJ8moGnMAvkvsxyMYGyGTHQQUFQ95M8BHCd97qIb0mHKbr382EyPO38nLuxl1c5BNcLHBF7l+m/46qFNm81BKulQFKYaIjHN/ffONaHWJ/rpKbhnbbC6Ga7dvY2; 20:6YuQZKVoe53458Sfp9iOFXS4C+84zMzwH2rh7VcyFVaUaobvG2Lv9rrp2h5tLbtEu7OyAwK7LPyWhnY86EmTgUJebhUGSncOrE4N2GyzHOc0L6iUYc8a7OVdJoHWIXvxITobUtPCVzDZOqdzAWe+U6tutblUT2oeCMxgfduDuecpCaE7WD7zmJGaBjHqV+SVO9ixSvRoMLmXeZ7zum6rpVVv4gW+XbN8OoRyZqK9rIEWet1EYY6tygTeOdeMDRbh X-MS-Office365-Filtering-Correlation-Id: 84a31d1c-b34c-4b83-0a3a-08d5cd931977 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 22:56:40.4384 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84a31d1c-b34c-4b83-0a3a-08d5cd931977 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2473 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. TOPOEXT feature is disabled for legacy machines. Signed-off-by: Babu Moger --- target/i386/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index d3411ed..4dd9a82 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2574,6 +2574,7 @@ static X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x8000000A, .model_id = "AMD EPYC Processor", .cache_info = &epyc_cache_info, + .auto_topoext = 1, }, { .name = "EPYC-IBPB", @@ -2621,6 +2622,7 @@ static X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x8000000A, .model_id = "AMD EPYC Processor (with IBPB)", .cache_info = &epyc_cache_info, + .auto_topoext = 1, }, }; @@ -4672,6 +4674,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);