From patchwork Thu Apr 26 16:26:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10366335 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 0F092601D3 for ; Thu, 26 Apr 2018 16:27:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 020EB1FF29 for ; Thu, 26 Apr 2018 16:27:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA1A328A14; Thu, 26 Apr 2018 16:27:44 +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 79B1D1FF29 for ; Thu, 26 Apr 2018 16:27:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932277AbeDZQ1m (ORCPT ); Thu, 26 Apr 2018 12:27:42 -0400 Received: from mail-sn1nam01on0058.outbound.protection.outlook.com ([104.47.32.58]:3008 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932276AbeDZQ1X (ORCPT ); Thu, 26 Apr 2018 12:27:23 -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=HJW38t5G6BaTV+1iaz2VP8VakpWdp8Db6XQNnE3bINw=; b=o7KLaq5NV6TtUHW/odaY7GU6vkT99GCXGIBfSQDy3LRog8wUHfBWemMf1fwr4QhFPC7WPFlPbm3gdrYtWHn139RWVkCAJtGHMcyfXk3yqpQbbLyLdufRpaQjxa1oOPYhnhs/zK0DoqzZu0/FJAsI2wb0XW+ez1npEdTSBfFgoHs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from bmoger-ubuntu.amd.com (165.204.78.1) by SN1PR12MB2479.namprd12.prod.outlook.com (2603:10b6:802:29::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Thu, 26 Apr 2018 16:27:07 +0000 From: Babu Moger To: mst@redhat.com, marcel@redhat.com, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, mtosatti@redhat.com Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, kash@tripleback.net, geoff@hostfission.com, babu.moger@amd.com Subject: [PATCH v7 8/9] i386: Enable TOPOEXT feature on AMD EPYC CPU Date: Thu, 26 Apr 2018 11:26:48 -0500 Message-Id: <1524760009-24710-9-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524760009-24710-1-git-send-email-babu.moger@amd.com> References: <1524760009-24710-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CY4PR1801CA0020.namprd18.prod.outlook.com (2603:10b6:910:74::33) To SN1PR12MB2479.namprd12.prod.outlook.com (2603:10b6:802:29::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:SN1PR12MB2479; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2479; 3:8D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oOihhiHGmccY8DtK4p+M8H6igCzDcgSUHezsYeIkGKiLUfhxzJvWrnw8Sxgm2vLtY0/OYODg0ry8Oq5K6XVJggM9GUixPODcYkdVkkeqt1UgN3GBLBXGL11GDH3CtAQM1DLK0U1Lx0+910mliQBEk53pv1HrfLnvtXYpPDd1wf8sZvhhIJym37LodNJuLcOWL5BoNnX1qMY9JIoNKSlDjY5vBM/PuJ0iKEne231SmpRk/aNcINRaeJSzTblnkTwoaLEn/4O7VRkzOEbx1uPsBkbq5k+dt9pVY7pOm+lDWeWI0+rbiGXpXfTNXST9M28bsQTgV7k4WJa+9CK7VEP9oLmG; 4:/rll6zL7UE71ee1riEyZqwUD0vzKs4EOKMacpXJma/eNnESQiDHiTBnXhmDMXLpf/vqcYZh6IKh405HB7hQ+oMmMrioKO6xrJJ01NQM7++Vgq9WFLEZNuL0c6Yz+3VFu2N/nJ6ZS8GlRH1jKk4/6G0Rej3bEeOt3740sNdBpfk4oNc7p/eqPgLLC2DgcLskkKx901tmD9zroNjnq7gSAMmGXwI4yQqFWucVdv1Wfhir29MQQB5yVt0xpuBxbKoQkJ4oMO50W5Of3AD4NR7IFM/mVcIVZAVtyDWRZPFKndF8Fn4W4M5YfzfwCsOiVmL+5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231232)(944501410)(52105095)(6055026)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:SN1PR12MB2479; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB2479; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(376002)(396003)(39860400002)(346002)(189003)(199004)(68736007)(8676002)(2906002)(6116002)(76176011)(8936002)(5660300001)(316002)(3846002)(4326008)(81156014)(50226002)(81166006)(386003)(956004)(16526019)(7416002)(52116002)(476003)(97736004)(59450400001)(186003)(25786009)(86362001)(446003)(7696005)(11346002)(51416003)(26005)(48376002)(36756003)(16586007)(47776003)(53416004)(486006)(44832011)(106356001)(7736002)(6666003)(72206003)(2616005)(6486002)(105586002)(66066001)(478600001)(305945005)(53936002)(50466002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB2479; 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; SN1PR12MB2479; 23:haeEABl5hU2G+c5DAy/UN95KvECEdB8QnN1+Gr0nt?= =?us-ascii?Q?z48+EK6gRMjD9qYg3O+ucFEHqFaM7/CcupKkRNh/2/l/qZLPJjZyzoWqs1br?= =?us-ascii?Q?zejM1hepUdX2luJqRSLxKsQr46nwoC1FarAeb9TjiNzyEzJUQDmLJ18g1HOI?= =?us-ascii?Q?1S9k6XN/+Fk4j/6UPPHj+CFhFrnjitfGUduH0ZS+O54W5sqTztEv/Yodt5UL?= =?us-ascii?Q?MY7nHXvI1ow8l6wIyLrdsrhyEeQ1/dPpSBJH9kqJGTVV6bioenroalJXhkpE?= =?us-ascii?Q?bnXnO9fPY01LbVjv+KTblmImIAMiUw49F2HoVMOBFI0qmmR2AeSYEWtVacB2?= =?us-ascii?Q?cPvdK1jMFv178tCe0XNuvflJx2ds0Mvg0g5L6gQ27xXJcoFXsnLxB6mTJglx?= =?us-ascii?Q?g8d59tC9N86CbWkwSK6BRBWj4SzQkiL1HhzIw/yD1WR08J/YQX8HNMbUdlRh?= =?us-ascii?Q?PLUjY64U3KEiNUTfdYtMrSYjr0eBgWIFpuTxZ1R915oGxgw5vNzBV6TmS2cF?= =?us-ascii?Q?9PBD1KQ088YAntaB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Mndbr1YmFsa0WaCVPDj31zjLwIZDesvcxYbcQxbQX14+eQd20k X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2479; 6:AJaAJ0lp9qqKWNiNjLH9qYOa0P6lZDGK937TbAduZpkyCu9/hqv7d0QphmG9f9P3O6wBSJNbDSQFwTXVQnEzdJ+l9wdMvOfjOf22ktA9qeoeOMnVNymAqalSoe7Tw59xfsLnmT3DgeIs7QyTPJWkcaHwmS5wzd3i080Q/p0JY+u5pH2dgZXYSkTfgpwmVsSfRo8aJ/mNQ9QkLWSfIWwXNVONG1KYS1jbQcmoBVHxLXar646WDqBnsGVF9fy5WtrBNJIs2f4seLi0c7eNkFOJRuc3btRTf0z/O7yvqLp91XPjhNZeOUJ9axkux4WZ0mYbYBSymhNrqPyOCmZ19XNeLG9agywG/por9YcjlmOwCx/UMKokx5El/PimjseGyibbL/s9LlkKbCspkfL2gZvoS2nDMmS2Njdns0HFAmKHRLd2Fc5pFJSs/8MjCxKC4Vmm1f9rnokpLZv5QQldog/FPA==; 5:eT8C5EKpegUlKhE3o8QSI/j8lhzDD6sAUDzx0gqGTA8vDzWWda+OQTuWCA/GWGAdrE5YXuh5lKb5Aplk8TOCZslwYBBmzDtu/RU7roqAn0fZvOyLz3VlzsAedsuKNz42G89x262HGjcvU1rDb2AIEIlSegXZQWF8aWRTBN9slko=; 24:w/wRpzgq6xBrK+WCkYnrcf3hmRe2pjgCo1UrFFvz+O7UIqMR3oBy8auSXlrLXeVUlWArLBZoXNgPBdk4dCm5UEbyazPwgaAkJFEYGpmiax8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2479; 7:Kw7xF1UecV0eFt7pXvfnoireHgIsJZQ/K2tie9P23fECX+1VtP0eVC94XL8Z0l8/UrEiKHMjwKhYO0GkFIM+YQ71oLfve3EJ21FtPPh9Yml9jABADxgd+36xF9541TI9kLB+3OCpQNWq//Fjj2Z5za47uVfIUvmS6WybEi0A+ZfeKjQGRKEg75MGGEWqRW1T2BrzMa/GkocWNTvVMetph69svccKOla5MwGJyoRWA/cVnCbXZkYAeUr9acNWMnBu; 20:sSNJbl6trNd1zsA0VH+HPuSVmyjOM1aRqD4hlipxhv/k69IBfmyEtMTHVqugXFN3AyiDKeQCCjbfxS4DH2rLMRArD+5Zf+bO8tcoEQF5zbG/hLHhwXsfGu8sgGKAzVXqK7zZIOhSDIHL183lEgVhFO4bwCOSZk05mHJ0bbP0ECy0qhQ2Audn8lSwtkBuGHUxAM+Jju9CwD8dE2ww/ApiSErQVedvOkaFsxYssc9rtoBi14me6Thzbo1z07OXttRJ X-MS-Office365-Filtering-Correlation-Id: cfe79b2e-59c0-46a8-3a47-08d5ab928e7a X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 16:27:07.7992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cfe79b2e-59c0-46a8-3a47-08d5ab928e7a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2479 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 1b15023..6ebbef2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2334,7 +2334,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 | @@ -2426,7 +2427,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] = @@ -4580,6 +4582,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);