From patchwork Sat Feb 24 02:30:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10240177 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 518156056E for ; Sat, 24 Feb 2018 02:31:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 428AA29B33 for ; Sat, 24 Feb 2018 02:31:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36EA229B58; Sat, 24 Feb 2018 02:31:08 +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 CAF5229B33 for ; Sat, 24 Feb 2018 02:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732AbeBXCbF (ORCPT ); Fri, 23 Feb 2018 21:31:05 -0500 Received: from mail-bl2nam02on0062.outbound.protection.outlook.com ([104.47.38.62]:45312 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752525AbeBXCax (ORCPT ); Fri, 23 Feb 2018 21:30:53 -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=X2u5A0OMLyo+e3cU+YhApRS5gRCLXswjEvnSfv1MJE4=; b=mioMMqSCEXEeVa9sxovg1OQUamvj9UuPSrLJ5vgOXSsSHK/HLev4RGNxmlb0FNCMiHrUQh5eDP3SUWMPU1olPQQFat1U7/x1ezNLvwrhN+nhPn3AFXfgE+pP78bUL5L8Qkqh1dvIB4xVt44rt9ZsQb3ER9Ooo8YdG2QKPmvluq8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-pyp0.amd.com (165.204.77.1) by MWHPR12MB1776.namprd12.prod.outlook.com (2603:10b6:300:113::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Sat, 24 Feb 2018 02:30:48 +0000 From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org, pixo@polepetko.eu, Gary.Hook@amd.com, babu.moger@amd.com Subject: [PATCH v2 3/5] target/i386: Add support for CPUID_8000_001E for AMD Date: Fri, 23 Feb 2018 21:30:23 -0500 Message-Id: <1519439425-27883-4-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1519439425-27883-1-git-send-email-babu.moger@amd.com> References: <1519439425-27883-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR06CA0061.namprd06.prod.outlook.com (2603:10b6:3:37::23) To MWHPR12MB1776.namprd12.prod.outlook.com (2603:10b6:300:113::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1dfaf74f-971a-452a-e3f6-08d57b2e9e37 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:MWHPR12MB1776; X-Microsoft-Exchange-Diagnostics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UTPzg4VOqglzFlnKFW/PtkpnhJEU734WXy+ce6b4G9/K4Q50vmyeSAfxn0vCtdwoHLv+iw6iRolw1tf2tYufs3b94KnLChqVJJAv6GiLA4D93gEMNmXokUMmt3she7trerEeihA/mC8Y/n2SA1p+Eu9EMB+W/KjNHT9wHOjq8WYdBQlI1rR4tfydSKAbUZgc/lIlZS5tVnRawG/Xf/6imqSSpErCCGLVd2unfnSauWzrKM1MO5yuSQT51EkTkzwdzZYXQBcPX5f9GyfmCfsn6OFPipvWEYmJM702ETP/VDFk8LcLeEcqXv3YHsVawat0RxS8wxFbLdu2/DV+UAmZ5ZZU3AweiBHuIDZ/WeL1j2FUF; 4:uLhfv1sy7JLYJlA+HzTj2Z9/0zPBlel5P0DDe9u9TMDQojHnlnPjS15dOF80lqRGjgbJPHDQVuo4bLEgIOEu+Kse4EgpC9Yz7/nn5YSJ2wLQ5jKtsdqxnIA7zPOWWHsy32wF3+bNTYY7yqRFa3wheaV3c+kUbwytM3SX5SIZiiKRw2mBLyTFO1b39Q7fqHTGiaB7jPLy2sKCF42ctDpyNfT9x45YZanJgsKNu39kwBvH/MTbO0o7jknLiEB05Uk0BxkfBU9C47JgmcuMjNCrySgiA4KJ5Af8S5CN74GJuP1n1ppjlrV5Oa+pHFe3T03H X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231208)(944501161)(52105095)(6055026)(6041288)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:MWHPR12MB1776; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1776; X-Forefront-PRVS: 0593E261C4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(346002)(39380400002)(39860400002)(376002)(199004)(189003)(6486002)(386003)(7736002)(305945005)(4720700003)(2950100002)(6666003)(68736007)(7696005)(52116002)(51416003)(97736004)(106356001)(47776003)(316002)(3846002)(6116002)(66066001)(76176011)(50226002)(53416004)(2906002)(72206003)(105586002)(478600001)(25786009)(53936002)(16526019)(186003)(16586007)(36756003)(86362001)(26005)(50466002)(8936002)(81156014)(8676002)(81166006)(4326008)(48376002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1776; H:linux-pyp0.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; MWHPR12MB1776; 23:VY26HwLPxiDG/ttSA5qKqGqaU/whvLKrHJ4ppTBNP?= =?us-ascii?Q?L/u66bELAi/rYuM8QN5kEJkvcTypN+mXpRvdHQ8GWHkZ+i0TVujs80Lmh1OH?= =?us-ascii?Q?ek33CxWnbGXE/k42+x+MD5JZlLN1GWqWgtKfy/8vdYeoyIAj9deaNOOJn84U?= =?us-ascii?Q?gL0KDa0ZvpC11/uI2gub3c37vvH5HxpeDiTAFqWohQUWUENc+gsGpX5G5InP?= =?us-ascii?Q?mjl4ydaOiOJ1xAzzSr0g8QNyCJL2qRTB79dn6BwxAPihutx5+9gLAv7lLVO4?= =?us-ascii?Q?yeIJQ5MJ501cS0pcL/CeCyRKRom9jMz+f7ZDPg86opDO+bDvSIm8RNPdnTLr?= =?us-ascii?Q?7+UJwz8yrJcUBJf0WodM0OdJoHbhmGTpBvm7qtFJ3g0tplY3wk+Zud9+VsBg?= =?us-ascii?Q?CdhrYP4DJiTEuq7+YG0ALfXnSnEGb2KXitAi4c7dnrUkIeRplR4aWIngJ0oZ?= =?us-ascii?Q?knKs1fYatr2cRtYfUZSPXqbHrUu7L4uV9S95DeppvcFggTL2TDJKf6xhefnY?= =?us-ascii?Q?k8glK8qyzFwxp/OxNkbr+SmP6dF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cLMT4q8ZDHikVfOf2mDmk2ukClU11zAx4WLBUhMxCM42axCQkAmtwHQ7Q0i+0birbIWA=; 5:wJUTxB6ZQDdjgDIocMPV+7IihPhUVHuIKvXBD+Lyt47zQCEby6SIv+y3+jPAjQPl6RkUOjxnzOrQZt6VJBtine6XnSgg1V4nGgi8gMAAFIbj+BwBkM+Z5X7rTLhaJBXD5P1bdJ5jQV6VWEefJrxaArLPIpXmZblLDQdT0x2aPdo=; 24:C1kg99pXN9oDEoT3NvGPdrb5kVr9Pwr3KJNbeLDK9NQ/6UjJB1cpb2qc0rWli/dWU25dXtaxTBgxA8laCE6/GjHyTCsihJr9LBOye7K8Z9M=; 7:bKGdsLYS+ZX5B5Kz+2zmnNsUeJqrTN2aGX4A5J9RmNgnr1Sehp7CZ5L+oiCxaTc/uBNzo8X0pZMvcd6P+t9hRICcCbpFUY3edW8DGuJ0t4z//8Y8my3ybZsujLN6LbmRjJ7fMT2HPwzJ8z/UYsdNo9PHRjrKy5oGq48dM+BTkpfuXpG6n5mUU7dOM7sjU1eKaYZAxek1B0k2uJW3/vuzJuOej0ZM/s+O0NLjMCB+LmKrx7VpsqV7on0Y3K+fyv/B SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1776; 20:qD4d0BMicUbjwzDJfo72o0UzHGgunYc7GcaLrZv5z957y/vqBuaXoWMjiQexL1taug0vldhaGYKHS9hOAxe3VM+njmwFvVW8fW25Bk/3WKTpgK30wz5fjftgH9iH+wK2oKd/I8j3UcjKHeRzVDzsHHz0/M6CqfB2E6p8mYZWpbKcd8QaOkQuAQyDHfn6CDrubiQb9UYrfrOcRb89d02xVeqGyFxUNciApemnUprvuZSaOQpH1YfGZPpEQQc4vo+F X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2018 02:30:48.9718 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1dfaf74f-971a-452a-e3f6-08d57b2e9e37 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1776 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 a5a480e..191e850 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3666,6 +3666,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;