From patchwork Fri Jan 26 21:39:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10187097 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 6847460211 for ; Fri, 26 Jan 2018 21:40:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ADDE293D3 for ; Fri, 26 Jan 2018 21:40:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F5AA2A866; Fri, 26 Jan 2018 21:40:15 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 3E860293D3 for ; Fri, 26 Jan 2018 21:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752268AbeAZVkM (ORCPT ); Fri, 26 Jan 2018 16:40:12 -0500 Received: from mail-by2nam01on0070.outbound.protection.outlook.com ([104.47.34.70]:19812 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751940AbeAZVkD (ORCPT ); Fri, 26 Jan 2018 16:40:03 -0500 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=/V6oMu4ipF2//hm4AY93m36whIVMmh/9merznxt2x5o=; b=4k3zWjiPjrhU0IXDhMQeTYn8BzWJbIjZCWiKuPkaAlT+xZyWDWLFV7UXR5ABaMkz6MPmDSnEU+ueif7AP0g9nawyM4x+201ayynf1PhMVMmLT4TjOoUIzlMNCVhZhW7tVzv86kXTSwLg2kJ18EJOuXJUH+o1ImYszRye0bLJztQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-pyp0.amd.com (165.204.77.1) by DM5PR12MB1769.namprd12.prod.outlook.com (10.175.89.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 26 Jan 2018 21:40:00 +0000 From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, pixo@polepetko.eu Cc: mtosatti@redhat.com, babu.moger@amd.com, qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [PATCH 3/5] target/i386: Add support for CPUID_8000_001E for AMD Date: Fri, 26 Jan 2018 16:39:42 -0500 Message-Id: <20180126213944.7594-4-babu.moger@amd.com> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180126213944.7594-1-babu.moger@amd.com> References: <20180126213944.7594-1-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY4PR04CA0064.namprd04.prod.outlook.com (10.171.243.157) To DM5PR12MB1769.namprd12.prod.outlook.com (10.175.89.150) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b492f597-ed3a-4f29-dba7-08d565055a5d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR12MB1769; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1769; 3:nDHtUVHOFvn1OtEoJiE3PyaLDV0eOzbLpYTzl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PpPaK3xNjuda1oku2wm/ONmAcoo/zBbUTY2kmYfnfD07hysHlhkcWbjrzPf+0tSB4NuFJ1HZqxNq9LWv3HeRN50pOf41+eKNkm1SB/IT72kziMiHfxrfz0uBf1VqHSdT0RgqYFkzPJUackEN0zDQHoXXf8O4brZDQWL7v8C2PUi7+HsX18I4rM4KmJ33HPRt+P6J4k62z5g3o740y1OVNVzAFbdA60FLkoepfgq3LXSUNTFudqRzkSXYfU05fRmhtCjGkRX8bo0AjG6fYcL0uZpKVeb98VPgTIGtR/K0zHZinm/l7oAgwyA0jQ+M1JkebAyf1N; 4:8d04+7gx4xGXrAmxRxPtksPNj7EN9gscChjfAxGkjEW1dwfkgLrCZ1/+2JTFYJbF/DlgheJnnJGvBXeOv3RyhpEThUQ31QG86fUXYhb7mU5/CLKj/xuux4Fx4oZOSoYJ42gb9Vnd7+Bd6L5QInJhUfSa5yKieP64T70DMbW9guZ+FdYXeHTY5udmLOtRfcxyyMp94AkL1K4YYJWuAS+Qh5uKXQJrZD1cxMsOLm//gXGzytuOz0egXra0DVcO1478LjoSZNZsc1e6EW3fez18RCZ8kkAme6K4vNqTi1NdFPqUdgBBH4EWiNnVjzMcMAZX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231077)(2400081)(944501161)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:DM5PR12MB1769; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB1769; X-Forefront-PRVS: 05641FD966 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(346002)(396003)(376002)(366004)(189003)(199004)(5660300001)(106356001)(51416003)(7696005)(52116002)(53416004)(8936002)(68736007)(386003)(105586002)(8676002)(81156014)(81166006)(50226002)(76176011)(53936002)(6666003)(2950100002)(6486002)(4326008)(16526019)(72206003)(36756003)(86362001)(1076002)(186003)(3846002)(305945005)(2906002)(66066001)(6116002)(47776003)(50466002)(48376002)(16586007)(97736004)(7736002)(478600001)(26005)(25786009)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1769; H:linux-pyp0.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB1769; 23:16b4xCEL0MuisKqhUtM+qoBO+o0fIkG28QAgf3JRW?= =?us-ascii?Q?AMQg79Gq+6rGyVbvzFTwLk7eEl/0HBrl5PzK5TwxFLCHMv1CvsxYtGjw6hf+?= =?us-ascii?Q?iX1KqLKprkksIL54tY3/AoP4g1cMlpdhGdryZ7o5X1BQOx7qaBq85KQhWJx1?= =?us-ascii?Q?CSI6zYFyapDIHrsh2T1vuvcrZbp/vQgdRzdS7KbgMzkENfiWwRj0buNrdyJ4?= =?us-ascii?Q?qvG/A3SOSjlx2klldNEMeelMRcuYAU59THwt0espYHNsiXWU/n6eIjYkcg2Q?= =?us-ascii?Q?FV7rUsuUeBt3Rq3XkpnF+S21QHA/FJHzAzCGu46U0jgMasB4KoP8GTpN6Rq1?= =?us-ascii?Q?VsDK9vva5VHV5plE8YkslzGbIRrkyeLcD+Zs+Dv+D/n8J5LAxfdATr6C6SfO?= =?us-ascii?Q?p8XKOuxw3RwZMBSK9TW5tWRWWyUQ1Xc2MMaswxvU6PEwBrhyCYGfUVNhiyp7?= =?us-ascii?Q?YPhc0AQue/TLxay9TeddzTNatKxs0KVBGUuaKLu5rrRlg0Vtz37igh2AVGgS?= =?us-ascii?Q?JlUV7j5ZSrX9R8D8y2jQx/kaEuErbMqAs0lNkk7D21ZIW/RYPjj8/LLmLfTB?= =?us-ascii?Q?blnYq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=; 5:blciVdWnGTNmUACQzmrfzWOdyixUvHDa3SJ8nLgFg6QigGW3TbjdmebMZ2MqlUGoKNnTiAd5uKGFW3Wqj+1v9cAzLcVUz3eaTE8vL1Diopnltf1VEpmOo2kMNOdLDM+lKYyKJRFXjz77ZKmFOTFCczWOACO+WkYuieLyuVkEpMo=; 24:r4d7lmBNGSojb5jZXYX3hmL0nCeWtdsyLOC80ly6JTg7yv680DQCH6yDy3m4u3vKbfFcBKaOlhrfFDWWggUNpiCAhrLDarYjcxibJ8xA6Vo=; 7:58N3xTcWV1QI/sqK6Wa1mrNKu6Ca3A/HxJc5ZzrI9NCdDZKDT0A+3+wFiCMpB/oP1Qd7Sq67SoWgWnF6PdLCfSqO72K5Gak3jKaE7yMMNSU1wLXLkuHBvH3L+kctIgjH090/9rGgcjUdA5yAz+0MrT+FqKOrkpKarvPLkoyN4BjUrsZ6lxxQs8TsodOXUSMrBrqEXsN0W2Tyn/qBbbRsSaos98+tvUzR8WiXvbJ4q7dDlAslzyU2IeiqM3sScHJp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1769; 20:YGcLLeZ/DokZCp990EoqZRBkP4ztiINlrzJBNeDd5aMhPDruLRSAcb/x/2xiqDXL2RYC6ovA9p9cYL5fCmMZ/u7Wiybjid3Aumj/WM72Mwuv3UlaUswRoZuxUyB/YDLjx8EdBJ8gRo9qXwZ0GyMl344rRHouxoWzAdhGjil5yomhO2veHWWp+zM9I179ui+4bC+tIN5X5Jc4x8jIn1jRTkzVLXtPsTj5GfD/Y+Q6uNSv7n0ilahsy/JxtdB2ti5x X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2018 21:40:00.1573 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b492f597-ed3a-4f29-dba7-08d565055a5d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1769 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stanislav Lanci Populate threads/core_id/apic_ids/socket_id when CPUID_EXT3_TOPOEXT feature is supported. This is required to support hyperthreading feature on AMD CPUS. These are supported via CPUID_8000_001E extended functions. Signed-off-by: Stanislav Lanci Signed-off-by: Babu Moger --- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 31ee746dac..52591a1486 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3219,6 +3219,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *edx = 0; } break; + case 0x8000001E: + if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) { + *eax = cpu->apic_id; + *ebx = (cs->nr_threads - 1) << 8 | cpu->core_id; + *ecx = cpu->socket_id; + *edx = 0; + } + break; case 0xC0000000: *eax = env->cpuid_xlevel2; *ebx = 0;