From patchwork Thu May 10 20:41:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10392439 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 D37886053D for ; Thu, 10 May 2018 20:42:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3AFC28CF8 for ; Thu, 10 May 2018 20:42:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7F1928CFB; Thu, 10 May 2018 20:42:21 +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 5150B28CF8 for ; Thu, 10 May 2018 20:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752267AbeEJUmR (ORCPT ); Thu, 10 May 2018 16:42:17 -0400 Received: from mail-sn1nam01on0080.outbound.protection.outlook.com ([104.47.32.80]:43264 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752235AbeEJUmN (ORCPT ); Thu, 10 May 2018 16:42:13 -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=eSP5pXDqBrVEdmdWHbVxugMddZv3eck/SxHlJ5TZ48o=; b=DZ7RRhpgljUihN1p2iK9XIRhbZulhpKzIBRtHgGX8Cy5UVJBKxbSUf43YLrRgqa8q/4/pQbQD4WjJqInun7xXmoraPN9zDMWMlgXS++cqpeTdvfu9Q5c6/jgP5tB+rdP/eJhHYTzrIWfJldTP9QQjKn6dyoU8tVfnRpb8NEX3hA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from bmoger-ubuntu.amd.com (165.204.78.1) by SN1PR12MB2478.namprd12.prod.outlook.com (2603:10b6:802:29::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Thu, 10 May 2018 20:42:07 +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, geoff@hostfission.com, kash@tripleback.net, babu.moger@amd.com Subject: [PATCH v8 7/8] i386: Enable TOPOEXT feature on AMD EPYC CPU Date: Thu, 10 May 2018 15:41:47 -0500 Message-Id: <20180510204148.11687-8-babu.moger@amd.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510204148.11687-1-babu.moger@amd.com> References: <20180510204148.11687-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0801CA0024.namprd08.prod.outlook.com (2603:10b6:803:29::34) To SN1PR12MB2478.namprd12.prod.outlook.com (2603:10b6:802:29::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:SN1PR12MB2478; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2478; 3:a2qFjgomC+m6kE0qL/dms6BMZZxJGhLrWGhp/wboQZa16fBAsP1RVa3QaY+jcwqIxngGZeA/TI5ugo88G9YbqutiVT5sGXkSKVJlrWox4vLotDqyaNbN/ZvShgndm3Hi/17rRkLBjxkNmO1fxNnv3j339gW1ZTzVqVU0jvEl9NYxMsw6sMH9LdUsWVLKBF7UaIf76bot80sSeLUCXlkyI9zSnX7WL0/e9F0r5uySvqHLU+NXy/YncvMGPkePO/hr; 25:RcPifoSXZdoDlHvXev6N1lr994rQt0P61TpjdlHePTMkk+FARzr9MDzadxtQRIQlebRpOLpFON3O5JeDlNvHFBQT1ys8r9R7KvNAbttl78XB/TZDPLZNeklQE+Hp0Qsztdndv63jMXHxxynRU4KweNG0rqmQhLjTZkFjjCHxRrZQG1qsnAjOtGmzZtur1WRNvsdAWZgkGvT142L8m+Q75ijyUlaAuoWRtWgLuPkXMihFOe3A30Btk+IvIT3L94BZRokBMazapqTsDuuhdp4PzL3n6uvb1FY6I1u2lYk25RwgdAElwRh39Qptyxn2VB6Js6CbHbXc07sPBmCI/yqcmg==; 31:IraiEHefkxuC3mkTiL+HN28QLW+5hYw1cshP2H/WIDmJw/cL0xuoh+dzQ2eVEa1zStKfBoj05lFTINvp52CghLopUl07IuM8CWnkUNvJ4tAY6sag1SFz/wqTb7bvpyNCCPiGEAD+PPFEBhDeV/fMdbzZDXqzr0axHz2u/XX2DtaoXVswqhUpM31AYopYj2KZo/5FNgq+MpMjTiIDp/84MtjaWw6gSfrocvO7Xht10to= X-MS-TrafficTypeDiagnostic: SN1PR12MB2478: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2478; 20:has0ea9TLb3IOHxsJ2MWOj3zSxRzP+V7eqw0IGL211ebrYuLQP1QnoRolY2bQnfrYma5QOo2eQYnAk2z7AqEzQ7VZjbVo57TVerlpuxiqWp14eKyKYKEAmqsbJsjjkIeKbOAWDWgq4QDVGn13+X1Iat+EZmMrTbhpe7ut+1nPYG9Rzc2Jh8mzQK/HGY4hpPi9fyvKI9VwwqFbVmW+LBgyTGadsefKhGfzfAm+LPCGWlF7UCXCqd7W+BFKrpPsH4XoH7+zTWVZhVamG4aqJsPxR3sra8HE40y0hPKz8WyAnLZ97oY9e5v8bvCNct3IdTvzoJfM62m3qLTNe/XWHa/vmvcJ7XFnoqwmFmkROjYALejd92IRtqzzqOHRH7JhXIHU7FOgL/2V8W5elAaa95CDygW5LIJqVkuZFcx5meGn3v1j+R2uNItOSSEbAJhIp6D68oimuliCaGgCrbMkaAXKh6yzHextkPNkMNA7vdLEJA7PpBLkjdtg6G3Kb5meltq; 4:/ggyr8AD2zC5BF7MzfBvKJPDgZOSK2mPZpQgSWFOy8JGkBLA8vcbKzTC6JSi+vy/zv9uGaT+xuWBo5N5Eun0PAhLIxwWtO0Vxx8cvVUi6sZgOQgRN1yENh1yBc/Uz4xzTKIFDm3Oq8iFaSBrJutbkdku++J6Acz6atY+ZCNdX0quEpf1VhBcCZ5xhzO4PucapJbtJGTVWzYiHQssiJ22ZTKENJaipdJmYpQjiw6lc891TF9C+1M3KGqivEt1x+Qfw3NeFq4R31zqfWWQmHjL+ZN8vrouPOI3lI3+o66SC3xSq5U/j1RX+JmHg4NPsowM 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)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN1PR12MB2478; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB2478; X-Forefront-PRVS: 066898046A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(366004)(376002)(396003)(39860400002)(39380400002)(189003)(199004)(476003)(446003)(48376002)(50466002)(50226002)(2616005)(53936002)(76176011)(97736004)(4326008)(11346002)(16526019)(8676002)(86362001)(186003)(7736002)(956004)(44832011)(305945005)(6486002)(81156014)(2906002)(575784001)(8936002)(52116002)(7696005)(59450400001)(486006)(81166006)(386003)(3846002)(26005)(25786009)(68736007)(51416003)(106356001)(5660300001)(316002)(36756003)(16586007)(105586002)(53416004)(7416002)(6666003)(6116002)(39060400002)(72206003)(66066001)(478600001)(47776003)(1076002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB2478; H:bmoger-ubuntu.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; SN1PR12MB2478; 23:q/d+AuBh7CbD97eZ9QnM6P+CgwKX42Rly70W2nCZm?= =?us-ascii?Q?ExyyhrD9Ljo6eG1SFM37Q3ngbNYIkXG936Y2mDmtdo2GIoBzM5RcEFgcoCSa?= =?us-ascii?Q?GpN23Rk4hNelMUcb3kUdLtS7Lth+gsZYGegGg0xGl5oBuZlMZK5LnsqkIDlG?= =?us-ascii?Q?Su43CNDwh8xhSWB4d9PpuTKcLe+P+l8odrb9Se6CMUUSAKH6ZBSZnzeUoWVM?= =?us-ascii?Q?ktC9jUhMQwGU86AXY6VGgXQPF5RwxDt7xifQ1AkEKddgnbDX2jl5Hkfj/BKD?= =?us-ascii?Q?E18RaBxQGQiKN73/YCkkT06Mf1y9RozLqCnkfZuFUNhAxMJTomyg2GCJWjCZ?= =?us-ascii?Q?s/Fb/+jV7svFew8SMuVbkdC+vV01/JGBVfZSnPirF6U/NK5ERoJvX7HO4FcA?= =?us-ascii?Q?Vl5WULJHlnYclf7WCHvMkWb5PTlfEgPTDom9a7DRxJcd1TKN+Dr03GeDj+mk?= =?us-ascii?Q?uTKsbg7MUL8quzOfezwhYH5Iy+bTIQGLll/QXIk0rl1YqJ88yoe1YoRfAI7Q?= =?us-ascii?Q?6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nzSegm2H9ChThGAsC6fCnFpo9lgocPBQD5vmuhpolAL53j7ouhzeI+PQOPPT75KpEVKC/x0ufT2DkbpyesRE6KcO9NysV8HOnrhYewA263XLJsXiKHRSEHDtWI69vFdkp+qo+CaFwGLmCg X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2478; 6:VlRSsmb2ymhJmJPRf7KrDwMO0wja6fb5kJxbUH2KOmERU1XRFA8gZ8fv4U41B5zViOXP41OKEJ8ToyGOc4nxIjtV5V+/TxCrMxoTHyomQNwinABiVo2oBi3ijMEPZzTAa+T+grqm4PFWvycqYiN96U9y66HnnA8vR9FmeWXp+A5/RVHX6kddrrsIZ15FpNG9JeLaxNGebcryU6oYfJZMMVhT6z9Ly3Etpc+jU4QdgFMmlOX+NzS28u8u51iD6Jcma6Zu8pF+wRYKAxjKlgZ2Og4XPPXh+q5od7I3iJCNkgJqGxnJjAMW1rPojsV+I1Y51ueAtkXCjl+yQgRFpkA4PCkqr5mfbqcsBcsk1a52OVeXRRcBT/tZlg/Rn672URIKQh7H8okVBjuAvHyvS2ZWlhUWEqhLx7YFLp7qJ2PkSb3HVwp5tzg/eVp+PVrN6dEu8hl1Nx3KFM8dpXBndquBYQ==; 5:TnHMWz/OOxLXthK75kuXdfBRU40Mi5NwuE6QW7SXxn/tRB2MHJFVPRiL6snh8GovkaSQoTviSYGJKwChq3x3FHTfrPwi5TTNN+3mWXZlqHS9y0JSMaO0n+htPlqRN8dVapb8SUIqP/+rnJztXMGPKT62AXR0U0C4SWtQL56Rblo=; 24:To4dnlmMEcuht3nDJdHIC6lYs6riIhnmiChILDMMwtNiJnOP815/FQ+Kv8Yhp/rKAYfhjRsjUF5ELK3OF30D6bIERJUxVe6XVc9bwFAYXh4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2478; 7:9WmoeQWEQ1242Zj1HsgIbyczQmVg7FyS3JlkoBXAg/dWk+7jUXDJgcuPkH8airxOcn1KdG8RYQ/BgfrLWb9POWJ07cLIZ5xlyZXnDwf2kkXXnLZEB8eZBHPIunJXpG7nsYdJHvWvz7JjQXA2xlZkHU6xGWw2LUYvkEs7SdlErod5348cLZGJJpVkDbW12GeFVgW+HVn4mFE4Lxx7lXci76pqpXIvkL23kmvrKkECAfMo48rlVXPy7TihCyf/m8g3; 20:+o1wUpWcd1Hdns2Mq+tQnNlvS66W7iNcHgEtIXpfzlU15nyckCWC7Eu7kR9wPhCrfi/OcZ7SQdWXw2z85EAIx+/ItiZ4wad9UlEUMsoTNStNiVLlcRKJbqN7LO+f7yfmLVNaT0nvi6nAcSYbhfgZXtqHTYlh7hf9NvER4OW0LMx88YgfouokciJj3TA6GGmOGqMx2ZmHB+SHSopGNcuZx5eh5e9+d6eaGGfAe0I8cDP/XYY5X+NT+1+wcDEFmJfT X-MS-Office365-Filtering-Correlation-Id: 990dfd3e-bcdb-40a2-db1f-08d5b6b67f13 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 20:42:07.2291 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 990dfd3e-bcdb-40a2-db1f-08d5b6b67f13 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2478 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 Tested-by: Geoffrey McRae Reviewed-by: Eduardo Habkost --- 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 5cfc7bb0e1..575f2416a1 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2382,7 +2382,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 | @@ -2427,7 +2428,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] = @@ -4540,6 +4542,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);