From patchwork Fri Aug 21 22:12:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11730629 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82A36722 for ; Fri, 21 Aug 2020 22:13:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4918820855 for ; Fri, 21 Aug 2020 22:13:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="yJYYD6oy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4918820855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9FI7-0005Tt-IK for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Aug 2020 18:13:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHV-0004B6-4t for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:05 -0400 Received: from mail-co1nam11on2076.outbound.protection.outlook.com ([40.107.220.76]:40513 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHS-00027r-It for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YnXI9vrWY2TW+jWTsahh+KSBAvqADqDcxAcERTiPeE9xyApL+E14zjKoLfZQSe8Xspnp0/+tVv4Fg3dYVseh0Ko2q2nNSNnDbA84SPgfwC0SgfJUuuAjbHiwSiyA8zHWxnh4NCq39vr6JDUtydKq+wV54kEacador77/1FoQ8+vo9ruOjB00Bx4fzDXcsivHsqiu/gWbYU9AUyVoqNhqjdqOBsGK1SnOWhnOGD8RYio6Z2GBnHj3SFecZ3tIW+AI8xgn+5Gq18yLCc2y+mP6fNhb+jz1a5M8sVxJkOj2O3k2D4L6AxZqWgnwJ+X8DAiIisWFCUEdvIPf3u/YY6M2PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r/+GPq0tMiDVqTmTmlHX3zfJu1ZVTco3skOgXWktpJc=; b=NZGH+fwckcfDq9Ui80lBB6TgAk1lM6mJ6YO9kcQPaLvJOtOTGQs5Z3xKBd8rYA267BiMbIzhkoKImL0dBAXkqdd9rhgGQM9lJ5G1sISni69aixiwCfzxyIaNgpeAUa72hsiYaIl4YAmAP0RGLOKNMy/LpVneB9zs6ctZ07lh86HOnj0IKBJlAyuCT/CRjafkHj+Q2P+cFmdmOvOiK5loThYsGekSYt7pvCDZQB7Q7ES9hW2pEwql9DGf956A9QrrjSvPwHjGcui4gBvWq21e3AI96UyaqvKOy+V03TZwFSvxIYD7T27OSbk1qhbjTxTfPnmdH7cxOSBY319qtM+a/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r/+GPq0tMiDVqTmTmlHX3zfJu1ZVTco3skOgXWktpJc=; b=yJYYD6oytsg5i9O2OVrE9ysCgzYJXw4K4u1cmOmMlVzqTQBm3U3sPep9BOOTIoDdaCaQzsfGri12+9TT32fEdQisU35vcMCsxdHvku/I9AOvnHv1LKk55FbmnaMlazlp5q/QmX1fgropfUo0onj0k2ByABWAesKOT65xIJC1XCM= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN1PR12MB2383.namprd12.prod.outlook.com (2603:10b6:802:26::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 22:12:26 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d%4]) with mapi id 15.20.3305.024; Fri, 21 Aug 2020 22:12:26 +0000 Subject: [PATCH v5 1/8] hw/i386: Remove node_id, nr_nodes and nodes_per_pkg from topology From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, imammedo@redhat.com Date: Fri, 21 Aug 2020 17:12:25 -0500 Message-ID: <159804794520.39954.435753698576266461.stgit@naples-babu.amd.com> In-Reply-To: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> References: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> User-Agent: StGit/unknown-version X-ClientProxiedBy: SN6PR2101CA0002.namprd21.prod.outlook.com (2603:10b6:805:106::12) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by SN6PR2101CA0002.namprd21.prod.outlook.com (2603:10b6:805:106::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.0 via Frontend Transport; Fri, 21 Aug 2020 22:12:25 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6cf49585-792d-4345-fcd6-08d8461f4953 X-MS-TrafficTypeDiagnostic: SN1PR12MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1332; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S7skliowSqtDE7bGOKnuLB1FHfAxxs6Nq/EOBvFEFeJ+o+R3k44GqJyKYmMO69IjvxS8dwKubz1GWwrgQr0vtNobXUYIQ25C3VX6kbGJOmi0nFgeOc5CGwVoKHqvZd4/dnIvCqeyiGLq4H5IOJeIplqOwlb1WkbTPh9S55fT3FS8Qr1gSjDFP/KHxfSRaKDemBOlfrmykQQqLQK2fpmw2YqvfjQgQrebwsLsJxsxrqX/IMFvPhOizC0EwWciArIRqlmaC0sKxDS0vPUJBKAlYWE+lPpaP/5nOrz9b+bg0bQiXIN4bFDIcwTVlzgL0jPnm7ZIBdabvYNYO7LRvH5nlE3nXXGASjiVxTyK2pN1uENmmubGVQizweDQGxdL7AIcitXQqtwo6MXehLeJYjaWocpC0Lv5BuDa7qAlhAdHb1eGOvAjazst03G0qIP6/2wMiyDRtzhsw62E5eXlZizMaQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2560.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(83380400001)(6486002)(2906002)(8676002)(103116003)(956004)(8936002)(44832011)(110011004)(26005)(478600001)(86362001)(966005)(16576012)(316002)(52116002)(66946007)(186003)(66556008)(30864003)(66476007)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: BKIlC93F3sh8knAKYkocmOD0ZhOeQzQtcw1An2GY2SqH3b41Gq28EA9TT1SyJ+EvpJiQUw2XF7oJS0x7nFoxoR89w3bmbRq/LbmoReyDK9nxh1oKjkKmntGJQPDFHHU/yHzDgq4KhJRZeAU6bXxlq+/irRa6YdBecycEHKiWb7k9oty0ReI3QjN1lqxXqRUlfSqfwnQZMQUXobFaJGsy3D9UlZuiQiGhoN/agkfpled45sgxaXfYxW6K3DnB2I1prEWXO61PPAAP46XphIuF3KilvuhQYQCi366ZeP38C+7Q0g6obsLdSBFcNOQwMlhA9YTaKaQZVG7R43mTTDOlS+2L8zQqhW2z7b8+3C1tm+yxaneqMxfwr4LMQi2G23kt2zQBNeu9cHZxGM7cwiY+rC5iOQJbLzwlib4rRsqLAsA7Ujf6OFpmFoxfbLyMVbBCWGvD4btKCAracwec0DgZILNMniofa2Avw/Hg6Jw7YT57xSEEADfrCn/BKhBACDoF5f9jsAsPxGBTgENo1oPtNNjsrjeHi/snjqG5AvYHadLkNbtp/lThapdv+KwMTRV33HvAY+XXFgEkLX73K+ngARSDeu3c+RpUvgQ2nMU+BOvjidSe0tMijQ449g1l0sU4iraRtzARn2BoZIzl19LikA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cf49585-792d-4345-fcd6-08d8461f4953 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 22:12:26.4674 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iFEBdFKZVxi0Ov23G+OZD5y7yOnrexvhIgPbYib0E2qPZcDuTbtX8IBHBfNmn8p4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2383 Received-SPF: none client-ip=40.107.220.76; envelope-from=Babu.Moger@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 18:13:01 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FORGED_SPF_HELO=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_ILLEGAL_IP=1.3, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Remove node_id, nr_nodes and nodes_per_pkg from topology. Use die_id, nr_dies and dies_per_pkg which is already available. Removes the confusion over two variables. With node_id removed in topology the uninitialized memory issue with -device and CPU hotplug will be fixed. Link: https://bugzilla.redhat.com/show_bug.cgi?id=1828750 Signed-off-by: Babu Moger --- hw/i386/pc.c | 1 - hw/i386/x86.c | 1 - include/hw/i386/topology.h | 40 +++++++++------------------------------- target/i386/cpu.c | 24 ++++++++++-------------- target/i386/cpu.h | 1 - tests/test-x86-cpuid.c | 40 ++++++++++++++++++++-------------------- 6 files changed, 39 insertions(+), 68 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 47c5ca3e34..0ae5cb3af4 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1498,7 +1498,6 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, init_topo_info(&topo_info, x86ms); env->nr_dies = x86ms->smp_dies; - env->nr_nodes = topo_info.nodes_per_pkg; env->pkg_offset = x86ms->apicid_pkg_offset(&topo_info); /* diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 67bee1bcb8..f6eab947df 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -62,7 +62,6 @@ inline void init_topo_info(X86CPUTopoInfo *topo_info, { MachineState *ms = MACHINE(x86ms); - topo_info->nodes_per_pkg = ms->numa_state->num_nodes / ms->smp.sockets; topo_info->dies_per_pkg = x86ms->smp_dies; topo_info->cores_per_die = ms->smp.cores; topo_info->threads_per_core = ms->smp.threads; diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h index 07239f95f4..05ddde7ba0 100644 --- a/include/hw/i386/topology.h +++ b/include/hw/i386/topology.h @@ -47,14 +47,12 @@ typedef uint32_t apic_id_t; typedef struct X86CPUTopoIDs { unsigned pkg_id; - unsigned node_id; unsigned die_id; unsigned core_id; unsigned smt_id; } X86CPUTopoIDs; typedef struct X86CPUTopoInfo { - unsigned nodes_per_pkg; unsigned dies_per_pkg; unsigned cores_per_die; unsigned threads_per_core; @@ -89,11 +87,6 @@ static inline unsigned apicid_die_width(X86CPUTopoInfo *topo_info) return apicid_bitwidth_for_count(topo_info->dies_per_pkg); } -/* Bit width of the node_id field per socket */ -static inline unsigned apicid_node_width_epyc(X86CPUTopoInfo *topo_info) -{ - return apicid_bitwidth_for_count(MAX(topo_info->nodes_per_pkg, 1)); -} /* Bit offset of the Core_ID field */ static inline unsigned apicid_core_offset(X86CPUTopoInfo *topo_info) @@ -114,30 +107,23 @@ static inline unsigned apicid_pkg_offset(X86CPUTopoInfo *topo_info) return apicid_die_offset(topo_info) + apicid_die_width(topo_info); } -#define NODE_ID_OFFSET 3 /* Minimum node_id offset if numa configured */ +#define EPYC_DIE_OFFSET 3 /* Minimum die_id offset if numa configured */ /* - * Bit offset of the node_id field - * - * Make sure nodes_per_pkg > 0 if numa configured else zero. + * Bit offset of the die_id field */ -static inline unsigned apicid_node_offset_epyc(X86CPUTopoInfo *topo_info) +static inline unsigned apicid_die_offset_epyc(X86CPUTopoInfo *topo_info) { - unsigned offset = apicid_die_offset(topo_info) + - apicid_die_width(topo_info); + unsigned offset = apicid_core_offset(topo_info) + + apicid_core_width(topo_info); - if (topo_info->nodes_per_pkg) { - return MAX(NODE_ID_OFFSET, offset); - } else { - return offset; - } + return MAX(EPYC_DIE_OFFSET, offset); } /* Bit offset of the Pkg_ID (socket ID) field */ static inline unsigned apicid_pkg_offset_epyc(X86CPUTopoInfo *topo_info) { - return apicid_node_offset_epyc(topo_info) + - apicid_node_width_epyc(topo_info); + return apicid_die_offset_epyc(topo_info) + apicid_die_width(topo_info); } /* @@ -150,8 +136,7 @@ x86_apicid_from_topo_ids_epyc(X86CPUTopoInfo *topo_info, const X86CPUTopoIDs *topo_ids) { return (topo_ids->pkg_id << apicid_pkg_offset_epyc(topo_info)) | - (topo_ids->node_id << apicid_node_offset_epyc(topo_info)) | - (topo_ids->die_id << apicid_die_offset(topo_info)) | + (topo_ids->die_id << apicid_die_offset_epyc(topo_info)) | (topo_ids->core_id << apicid_core_offset(topo_info)) | topo_ids->smt_id; } @@ -160,15 +145,11 @@ static inline void x86_topo_ids_from_idx_epyc(X86CPUTopoInfo *topo_info, unsigned cpu_index, X86CPUTopoIDs *topo_ids) { - unsigned nr_nodes = MAX(topo_info->nodes_per_pkg, 1); unsigned nr_dies = topo_info->dies_per_pkg; unsigned nr_cores = topo_info->cores_per_die; unsigned nr_threads = topo_info->threads_per_core; - unsigned cores_per_node = DIV_ROUND_UP((nr_dies * nr_cores * nr_threads), - nr_nodes); topo_ids->pkg_id = cpu_index / (nr_dies * nr_cores * nr_threads); - topo_ids->node_id = (cpu_index / cores_per_node) % nr_nodes; topo_ids->die_id = cpu_index / (nr_cores * nr_threads) % nr_dies; topo_ids->core_id = cpu_index / nr_threads % nr_cores; topo_ids->smt_id = cpu_index % nr_threads; @@ -188,11 +169,8 @@ static inline void x86_topo_ids_from_apicid_epyc(apic_id_t apicid, (apicid >> apicid_core_offset(topo_info)) & ~(0xFFFFFFFFUL << apicid_core_width(topo_info)); topo_ids->die_id = - (apicid >> apicid_die_offset(topo_info)) & + (apicid >> apicid_die_offset_epyc(topo_info)) & ~(0xFFFFFFFFUL << apicid_die_width(topo_info)); - topo_ids->node_id = - (apicid >> apicid_node_offset_epyc(topo_info)) & - ~(0xFFFFFFFFUL << apicid_node_width_epyc(topo_info)); topo_ids->pkg_id = apicid >> apicid_pkg_offset_epyc(topo_info); } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 588f32e136..3c58af1f43 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -345,7 +345,6 @@ static void encode_cache_cpuid8000001d(CPUCacheInfo *cache, uint32_t *ecx, uint32_t *edx) { uint32_t l3_cores; - unsigned nodes = MAX(topo_info->nodes_per_pkg, 1); assert(cache->size == cache->line_size * cache->associativity * cache->partitions * cache->sets); @@ -355,10 +354,9 @@ static void encode_cache_cpuid8000001d(CPUCacheInfo *cache, /* L3 is shared among multiple cores */ if (cache->level == 3) { - l3_cores = DIV_ROUND_UP((topo_info->dies_per_pkg * - topo_info->cores_per_die * + l3_cores = DIV_ROUND_UP((topo_info->cores_per_die * topo_info->threads_per_core), - nodes); + topo_info->dies_per_pkg); *eax |= (l3_cores - 1) << 14; } else { *eax |= ((topo_info->threads_per_core - 1) << 14); @@ -387,7 +385,7 @@ static void encode_topo_cpuid8000001e(X86CPUTopoInfo *topo_info, X86CPU *cpu, uint32_t *ecx, uint32_t *edx) { X86CPUTopoIDs topo_ids = {0}; - unsigned long nodes = MAX(topo_info->nodes_per_pkg, 1); + unsigned long dies = topo_info->dies_per_pkg; int shift; x86_topo_ids_from_apicid_epyc(cpu->apic_id, topo_info, &topo_ids); @@ -408,7 +406,7 @@ static void encode_topo_cpuid8000001e(X86CPUTopoInfo *topo_info, X86CPU *cpu, * 3 Core complex id * 1:0 Core id */ - *ebx = ((topo_info->threads_per_core - 1) << 8) | (topo_ids.node_id << 3) | + *ebx = ((topo_info->threads_per_core - 1) << 8) | (topo_ids.die_id << 3) | (topo_ids.core_id); /* * CPUID_Fn8000001E_ECX @@ -418,8 +416,8 @@ static void encode_topo_cpuid8000001e(X86CPUTopoInfo *topo_info, X86CPU *cpu, * 2 Socket id * 1:0 Node id */ - if (nodes <= 4) { - *ecx = ((nodes - 1) << 8) | (topo_ids.pkg_id << 2) | topo_ids.node_id; + if (dies <= 4) { + *ecx = ((dies - 1) << 8) | (topo_ids.pkg_id << 2) | topo_ids.die_id; } else { /* * Node id fix up. Actual hardware supports up to 4 nodes. But with @@ -434,10 +432,10 @@ static void encode_topo_cpuid8000001e(X86CPUTopoInfo *topo_info, X86CPU *cpu, * number of nodes. find_last_bit returns last set bit(0 based). Left * shift(+1) the socket id to represent all the nodes. */ - nodes -= 1; - shift = find_last_bit(&nodes, 8); - *ecx = (nodes << 8) | (topo_ids.pkg_id << (shift + 1)) | - topo_ids.node_id; + dies -= 1; + shift = find_last_bit(&dies, 8); + *ecx = (dies << 8) | (topo_ids.pkg_id << (shift + 1)) | + topo_ids.die_id; } *edx = 0; } @@ -5489,7 +5487,6 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, uint32_t signature[3]; X86CPUTopoInfo topo_info; - topo_info.nodes_per_pkg = env->nr_nodes; topo_info.dies_per_pkg = env->nr_dies; topo_info.cores_per_die = cs->nr_cores; topo_info.threads_per_core = cs->nr_threads; @@ -6949,7 +6946,6 @@ static void x86_cpu_initfn(Object *obj) FeatureWord w; env->nr_dies = 1; - env->nr_nodes = 1; cpu_set_cpustate_pointers(cpu); object_property_add(obj, "family", "int", diff --git a/target/i386/cpu.h b/target/i386/cpu.h index e1a5c174dc..4c89bee8d1 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1629,7 +1629,6 @@ typedef struct CPUX86State { TPRAccess tpr_access_type; unsigned nr_dies; - unsigned nr_nodes; unsigned pkg_offset; } CPUX86State; diff --git a/tests/test-x86-cpuid.c b/tests/test-x86-cpuid.c index 049030a50e..bfabc0403a 100644 --- a/tests/test-x86-cpuid.c +++ b/tests/test-x86-cpuid.c @@ -31,12 +31,12 @@ static void test_topo_bits(void) X86CPUTopoInfo topo_info = {0}; /* simple tests for 1 thread per core, 1 core per die, 1 die per package */ - topo_info = (X86CPUTopoInfo) {0, 1, 1, 1}; + topo_info = (X86CPUTopoInfo) {1, 1, 1}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 0); g_assert_cmpuint(apicid_core_width(&topo_info), ==, 0); g_assert_cmpuint(apicid_die_width(&topo_info), ==, 0); - topo_info = (X86CPUTopoInfo) {0, 1, 1, 1}; + topo_info = (X86CPUTopoInfo) {1, 1, 1}; g_assert_cmpuint(x86_apicid_from_cpu_idx(&topo_info, 0), ==, 0); g_assert_cmpuint(x86_apicid_from_cpu_idx(&topo_info, 1), ==, 1); g_assert_cmpuint(x86_apicid_from_cpu_idx(&topo_info, 2), ==, 2); @@ -45,39 +45,39 @@ static void test_topo_bits(void) /* Test field width calculation for multiple values */ - topo_info = (X86CPUTopoInfo) {0, 1, 1, 2}; + topo_info = (X86CPUTopoInfo) {1, 1, 2}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 1); - topo_info = (X86CPUTopoInfo) {0, 1, 1, 3}; + topo_info = (X86CPUTopoInfo) {1, 1, 3}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 2); - topo_info = (X86CPUTopoInfo) {0, 1, 1, 4}; + topo_info = (X86CPUTopoInfo) {1, 1, 4}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 2); - topo_info = (X86CPUTopoInfo) {0, 1, 1, 14}; + topo_info = (X86CPUTopoInfo) {1, 1, 14}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 4); - topo_info = (X86CPUTopoInfo) {0, 1, 1, 15}; + topo_info = (X86CPUTopoInfo) {1, 1, 15}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 4); - topo_info = (X86CPUTopoInfo) {0, 1, 1, 16}; + topo_info = (X86CPUTopoInfo) {1, 1, 16}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 4); - topo_info = (X86CPUTopoInfo) {0, 1, 1, 17}; + topo_info = (X86CPUTopoInfo) {1, 1, 17}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 5); - topo_info = (X86CPUTopoInfo) {0, 1, 30, 2}; + topo_info = (X86CPUTopoInfo) {1, 30, 2}; g_assert_cmpuint(apicid_core_width(&topo_info), ==, 5); - topo_info = (X86CPUTopoInfo) {0, 1, 31, 2}; + topo_info = (X86CPUTopoInfo) {1, 31, 2}; g_assert_cmpuint(apicid_core_width(&topo_info), ==, 5); - topo_info = (X86CPUTopoInfo) {0, 1, 32, 2}; + topo_info = (X86CPUTopoInfo) {1, 32, 2}; g_assert_cmpuint(apicid_core_width(&topo_info), ==, 5); - topo_info = (X86CPUTopoInfo) {0, 1, 33, 2}; + topo_info = (X86CPUTopoInfo) {1, 33, 2}; g_assert_cmpuint(apicid_core_width(&topo_info), ==, 6); - topo_info = (X86CPUTopoInfo) {0, 1, 30, 2}; + topo_info = (X86CPUTopoInfo) {1, 30, 2}; g_assert_cmpuint(apicid_die_width(&topo_info), ==, 0); - topo_info = (X86CPUTopoInfo) {0, 2, 30, 2}; + topo_info = (X86CPUTopoInfo) {2, 30, 2}; g_assert_cmpuint(apicid_die_width(&topo_info), ==, 1); - topo_info = (X86CPUTopoInfo) {0, 3, 30, 2}; + topo_info = (X86CPUTopoInfo) {3, 30, 2}; g_assert_cmpuint(apicid_die_width(&topo_info), ==, 2); - topo_info = (X86CPUTopoInfo) {0, 4, 30, 2}; + topo_info = (X86CPUTopoInfo) {4, 30, 2}; g_assert_cmpuint(apicid_die_width(&topo_info), ==, 2); /* build a weird topology and see if IDs are calculated correctly @@ -85,18 +85,18 @@ static void test_topo_bits(void) /* This will use 2 bits for thread ID and 3 bits for core ID */ - topo_info = (X86CPUTopoInfo) {0, 1, 6, 3}; + topo_info = (X86CPUTopoInfo) {1, 6, 3}; g_assert_cmpuint(apicid_smt_width(&topo_info), ==, 2); g_assert_cmpuint(apicid_core_offset(&topo_info), ==, 2); g_assert_cmpuint(apicid_die_offset(&topo_info), ==, 5); g_assert_cmpuint(apicid_pkg_offset(&topo_info), ==, 5); - topo_info = (X86CPUTopoInfo) {0, 1, 6, 3}; + topo_info = (X86CPUTopoInfo) {1, 6, 3}; g_assert_cmpuint(x86_apicid_from_cpu_idx(&topo_info, 0), ==, 0); g_assert_cmpuint(x86_apicid_from_cpu_idx(&topo_info, 1), ==, 1); g_assert_cmpuint(x86_apicid_from_cpu_idx(&topo_info, 2), ==, 2); - topo_info = (X86CPUTopoInfo) {0, 1, 6, 3}; + topo_info = (X86CPUTopoInfo) {1, 6, 3}; g_assert_cmpuint(x86_apicid_from_cpu_idx(&topo_info, 1 * 3 + 0), ==, (1 << 2) | 0); g_assert_cmpuint(x86_apicid_from_cpu_idx(&topo_info, 1 * 3 + 1), ==, From patchwork Fri Aug 21 22:12:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11730633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4304722 for ; Fri, 21 Aug 2020 22:15:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A83420855 for ; Fri, 21 Aug 2020 22:15:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="F2ie0pjk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A83420855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9FJS-0007s6-Pf for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Aug 2020 18:15:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHW-0004EC-U4 for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:06 -0400 Received: from mail-co1nam11on2076.outbound.protection.outlook.com ([40.107.220.76]:40513 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHV-00027r-Di for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZBi2ja7TXHapD+cyS9W7J0e1a4NBPeJzXtRGaVgFxTCqv0VwYG5HzH6aWvKB82oraKjD6wCAIF5cT1q6XAuR9cBsjW6azScjMrD5u1gq2ncl+QNvHtY3SE+zos57E90N+9qucP+8haMsWAc6CX9wmOGkvunL2dvpZFrJ3nd0VxZ3lE8ozEHutuwduL7x5ZzzUrutqp70r7MsPt1S2eStGTa1RhsMkZK0TZa0cDJwM7KG7hgdRp6M9OYxuCOsNrWizaJ3pgb2SVCa1PFNwgo/ZNCYaGnfpZDW2LcqW9RNSwfyj8qdaqKMBfqkR1dpwQQCnQ4hh5dcIotb3QYzgvYmYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VRB2EacYzITbRHvEUQQ3PMzS9D+xC703UcygNoIIGZ8=; b=RlXCutVEnm+R6OEOYbcx1v93btHzSG2e16sqEfnVt5gPH2S7q2UAye8kVwgR84YkY2gxJTNXedS753aOc7YN7oXMFrM58reXSh6TJ+0fYjuMKf4R0UgyThRut/Ce26WoqqPiMFdbtakgP0DHEH67/xyRuiTkVOyd1mUbsLRmcjeBsQL2kYW5R+aub7uauh10+e+Sy92Hc4eQ9s46GU6MJKLg8rBVmTGsAMymWPqZSvQsT+aG8WPOBs6up2CkpvwMvQ7Tmz+5laeT+guc/qtdAwwZ09pvoUKIpTL5AdHs0qdVShx7eTPY6X+qpKERi3XNy4LaXWBpNUojMNWpfOxP/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VRB2EacYzITbRHvEUQQ3PMzS9D+xC703UcygNoIIGZ8=; b=F2ie0pjkIsljEK5scCoxEGr1IVSYEVJoKM8HAyHb3bLxWOhk814lLWAqCokv7XTeUiF+2xWs+Y1MPeHexSHXlEADWfnBh6Dsovb275WsVEEubdv8ao7sQ8pBqORvmxBavhXE2RH6n66nbBk69VcsTYLheC77gXy9gvy41j0m92M= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN1PR12MB2383.namprd12.prod.outlook.com (2603:10b6:802:26::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 22:12:32 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d%4]) with mapi id 15.20.3305.024; Fri, 21 Aug 2020 22:12:32 +0000 Subject: [PATCH v5 2/8] Revert "i386: Fix pkg_id offset for EPYC cpu models" From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, imammedo@redhat.com Date: Fri, 21 Aug 2020 17:12:31 -0500 Message-ID: <159804795162.39954.4500271462124021596.stgit@naples-babu.amd.com> In-Reply-To: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> References: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> User-Agent: StGit/unknown-version X-ClientProxiedBy: SN6PR05CA0019.namprd05.prod.outlook.com (2603:10b6:805:de::32) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by SN6PR05CA0019.namprd05.prod.outlook.com (2603:10b6:805:de::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.10 via Frontend Transport; Fri, 21 Aug 2020 22:12:32 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 27e01fd6-56a6-4e4f-28ae-08d8461f4d19 X-MS-TrafficTypeDiagnostic: SN1PR12MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:206; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bgTBw9dH8SsvDpKu87sh8Z7cdDQr1Fz/hrhDQhQPTrfP5pceWL7MUZSbwx/mpP5dy66D6yNwmzRQKuFeU0MH/3tuWCV+WeglHAjEEbS8ZojFwY7PFppRR88dPWDSqNurWxGLZPofFWJrrLMrnZQnXQjP8kliljuMBMcwINMVHbJNzCTacZylqOIqJwx/uyfxHeP3f/XBRcDxCA+y5KHQQCJaScvgK3LGVIyH0Guj2GMAPAFYBW/7jGtWCdaVKVR3ycPQMSZmj6Q2+hu9jMAKKT5lRrx7bxaQ7gFkraxnCqyh7J+CWaaurJUlX9q3aU6zZqLcXjm0if2JGdcKm3a7yzq79VXkw6R/z4P8ZLuUbP5shpaLM4Xs2WUXxco49Mnp X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2560.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(83380400001)(6486002)(2906002)(8676002)(103116003)(956004)(8936002)(44832011)(110011004)(26005)(478600001)(86362001)(16576012)(316002)(52116002)(66946007)(186003)(66556008)(66476007)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: VJzDXHmYbrFhmDNGi2/DD0YSWXp+/WPs+o5lvSOT6MennK8a8emQDpmDQCmz7B5QtjCyFa//aQdA8NNPneFsckoFPjc5K0tyn0WWtLhDe9aYbqGhFXRtjSoQ4rZd4uGTrrQfM/Cp+e6VG79ulBxmtM3fPWxiTIlT99byRCLWPJKhPpbowTXE1RV7mjUObn1vm4wflfRL3pTvtzt8w+Vp4ertRcMRf9PVJKDcIQ0Bdb68tufZTXgmMUBy5gJvpdv4QS6H6FVrx0DuDgn3xWVBnspZ4WMtc5Jvsj34cwOH9uz8sxclAErdzkiCbxVbAC9axHR//5LsK1tdOEQEisK7ZoJtosKqwFdbMeeeoYaB2U8MFLunIWmucKvv0GTjGlcsfoVW93VKjv0aLE8iKs/MFesR5/mSYwkStFv6iMsAUkgbXQPbHjdQ+dDLWPn2tO0WT5MOxDGzZwf0maKFBEJUU2HVEolCL6k8QCMxLxtEFsH8UXCfNwI4qcOuJTzBZvbt0aqmzR6R1DG+iY8ETihUscXpLU+T5QK4tjuOBnoZQUZyghk+/r1h0IJiZ7kQ1QODce8W2nqC8+0zNHtWHnmLqeOu+mJyo8ZWtqTiMU2G7QinzLuUQ+2S9dUyYwbMjd672cJqNacFLJ5Xo3asIR+Srg== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27e01fd6-56a6-4e4f-28ae-08d8461f4d19 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 22:12:32.6378 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EC8eoYTxuXn8DuctgvUdwvGiZuhFoDfeXtt/5b4h0F9OvR8C6u8bz+XYOpPb9J6X X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2383 Received-SPF: none client-ip=40.107.220.76; envelope-from=Babu.Moger@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 18:13:01 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FORGED_SPF_HELO=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_ILLEGAL_IP=1.3, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Remove the EPYC specific apicid decoding and use the generic default decoding. This reverts commit 7b225762c8c05fd31d4c2be116aedfbc00383f8b. Signed-off-by: Babu Moger --- hw/i386/pc.c | 1 - target/i386/cpu.c | 6 +++--- target/i386/cpu.h | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 0ae5cb3af4..e74b3cb1d8 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1498,7 +1498,6 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, init_topo_info(&topo_info, x86ms); env->nr_dies = x86ms->smp_dies; - env->pkg_offset = x86ms->apicid_pkg_offset(&topo_info); /* * If APIC ID is not set, diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 3c58af1f43..83acbce3e9 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5675,7 +5675,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *ecx |= CPUID_TOPOLOGY_LEVEL_SMT; break; case 1: - *eax = env->pkg_offset; + *eax = apicid_pkg_offset(&topo_info); *ebx = cs->nr_cores * cs->nr_threads; *ecx |= CPUID_TOPOLOGY_LEVEL_CORE; break; @@ -5709,7 +5709,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *ecx |= CPUID_TOPOLOGY_LEVEL_CORE; break; case 2: - *eax = env->pkg_offset; + *eax = apicid_pkg_offset(&topo_info); *ebx = env->nr_dies * cs->nr_cores * cs->nr_threads; *ecx |= CPUID_TOPOLOGY_LEVEL_DIE; break; @@ -5890,7 +5890,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, * CPUX86State::pkg_offset. * Bits 7:0 is "The number of threads in the package is NC+1" */ - *ecx = (env->pkg_offset << 12) | + *ecx = (apicid_pkg_offset(&topo_info) << 12) | ((cs->nr_cores * cs->nr_threads) - 1); } else { *ecx = 0; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 4c89bee8d1..a345172afd 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1629,7 +1629,6 @@ typedef struct CPUX86State { TPRAccess tpr_access_type; unsigned nr_dies; - unsigned pkg_offset; } CPUX86State; struct kvm_msrs; From patchwork Fri Aug 21 22:12:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11730639 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04AC013B1 for ; Fri, 21 Aug 2020 22:16:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF81E207DA for ; Fri, 21 Aug 2020 22:16:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="FzaVjeti" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF81E207DA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9FLA-0001qF-5s for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Aug 2020 18:16:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHY-0004IC-M7 for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:08 -0400 Received: from mail-co1nam11on2076.outbound.protection.outlook.com ([40.107.220.76]:40513 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHX-00027r-5N for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/bH96aH5drgTX1q1jEpI2ZAiFA7EPPggnwVGbvCVH1Zg6KLLQZ5uT7G5Unx5wHyN2UnTIYAlSG0rvG7CdXbUbC/l5pATsAtcbbxhM1zl3VBM5BYQ1F44Nb/I8JZknmqp/M9l/VnRWQSQuul/VnkhRhyoC7zojCAuSrTWjiAknZBU82C8/g++SYijr9U6U4/X+jZxTAlZacJ1lxhK9Luq2cXD0tRRVU1Ijah8b2eyOXqmd993OTBNMHKzaBQ+OGnYYf7aDgIUqHTRQLQCPmtp9D3qEadWQjLj/vsoCfrEjvQ/CAWQSsO8D1693CbHM35ZYFhDucyBn8G1hjLQSaCEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h+KgcY3+39eWLChOdc11dtZyVc/j1j90PkNlEF+TcjE=; b=ltjCHQv4S9S5yAU70Oy+UC4oMO0RZIQeAtKz4V3K/r5uDOA8sL6Vp7TaIico/CHCX35Z7WVEO+VdWU5f4n/f09A9gWQoUXi0wjhae3Pu18RmaGJDOyeEFIn8+dFCtJqTL4/+Lw4vkkHA5RbbkxhMc1CaZ2kVfyMwJhNuYpU2maW71dDjxOW3gEN+BtrXAnUUYpmzIPDnXiX5Qwa4/oXioed5fdVI9skqT7Edzt1Aq5KJ315s6gFFazKMvZov4bL17YnsFXVJ+CoqVtivOORImY0WpFqgfTE6Qpf7EKPvTsflNKaoL96QIeqX7HwO2iSo2CxyNj8/t42DEQOQwIAj3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h+KgcY3+39eWLChOdc11dtZyVc/j1j90PkNlEF+TcjE=; b=FzaVjetiXxvGb2oVLB9gByOHQo3A12p/1lCIeOrp42LspCfYnCncbmwz5ZBs1vmRXHMhWMrH/5pW8Xf9LoLHj9OS+O7U/aS/qCvtqU8AYFDC/U9LDaWFEPTx07nL62a8xz6/T1yoSqKvbGMt7plUpUtyTsmnpJRWSyz8GMR+5wU= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN1PR12MB2383.namprd12.prod.outlook.com (2603:10b6:802:26::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 22:12:40 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d%4]) with mapi id 15.20.3305.024; Fri, 21 Aug 2020 22:12:38 +0000 Subject: [PATCH v5 3/8] Revert "target/i386: Enable new apic id encoding for EPYC based cpus models" From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, imammedo@redhat.com Date: Fri, 21 Aug 2020 17:12:37 -0500 Message-ID: <159804795781.39954.6498589500212777914.stgit@naples-babu.amd.com> In-Reply-To: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> References: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> User-Agent: StGit/unknown-version X-ClientProxiedBy: SN4PR0501CA0112.namprd05.prod.outlook.com (2603:10b6:803:42::29) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by SN4PR0501CA0112.namprd05.prod.outlook.com (2603:10b6:803:42::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.10 via Frontend Transport; Fri, 21 Aug 2020 22:12:38 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b2bd546d-cf71-4cfc-4487-08d8461f50cb X-MS-TrafficTypeDiagnostic: SN1PR12MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:126; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: moOn2tbsfANiqbbgn28eud7PFuJHELZ++oWInXwp0WfKz4vg0Gwo/e6O8GLhZAc3SWZRKqIpv/YDJH90/k3XK1fGODr0VDcK7jhNVyOuLPPepzoAQToohkxy5UA9O1D025UGndjsoyOLedYBYb+IaYTHmlcnn8aA/ruzLbvt3q0YHekV0NZ+GgxLGD0HP8ib3Ru1HX/3pXVUXT6JE8Eb+x+t82eykrLDhrXdwZobr838/n1KpExPaW2axGR16Os6RdFImIU7YXLfjrbpLgbqu51OezJPMxSz78gwITo3z8ntz+uTlepIJMjQr4zcjKrI3xpSZx9zd2/jn3h99nGCJtq0ovEAQpQ5P/HOMcvP+fx831Yu9T5gR+3LD2Yv+6kL X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2560.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(83380400001)(6486002)(2906002)(8676002)(103116003)(956004)(8936002)(44832011)(110011004)(26005)(478600001)(86362001)(16576012)(316002)(52116002)(66946007)(186003)(66556008)(4744005)(66476007)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: l1oW36W95D5KMzRiWmpkxWYsNoMyvJ5QWe0Dcd4C7pYNViT7c2RZKa+ZXWj0PW0kyz4KhLTpYsrRYfbj56qxaBNlU5D+4BrgFHmS2XBuVTYLF+QdmS9Moh5a99xirpcMd+eark4hgf0igs66qZXa+EUshP7HkM1wVqoy5PB4iYPP5xi2EmCLzp0kdZ9RVPC9WFnKGj9OvkAA+m1gEh2nA1XBqYMNwKYJHTDo4+c1/NUY00Sy2G4aOBiF3BZHc1xm5I9ciUL9987nIPpDEoIcK1dVhvcBmvV1XPY1Uv5aZnbsPF9h3cIcN2ZjiT2+xEqd397oxk1W3cQ1ZvODaVLrwEwe8lwQR6AjsEVilUKSXZkBQRpor0DhBx7AuYBLp9a1RNOkjDnDqc6LWl383LVYMLovtIEuBT9OJ9WOcF5i6W0pZr2zPtoY2QphhmXaSzSEEngZzSY/VRU6LmDts3CGYhHfP+cE7Ipn4Nf0SsdLq42G735XfaAKoW/wMh/h4TY8Gtb4DoLInY9K3W5RWxte05Hab59rFi0HFoQVv5g6zszRGL1MfF24rmMErhtRW1ab86UIl1X2AS6koVnM22XJdBEaHzXRkGM0IQT25PSwjJ2u+qKJQEE/WjZWnZK+pK7Xu3T83qUIdwiZoImi2m/rwA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2bd546d-cf71-4cfc-4487-08d8461f50cb X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 22:12:38.8243 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DUJGOJDZ2V5glj3htkawrPPlV0yQJBSYQCU3gxQfYnZoKsLHIpXH6uiwKTffuu/B X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2383 Received-SPF: none client-ip=40.107.220.76; envelope-from=Babu.Moger@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 18:13:01 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FORGED_SPF_HELO=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_ILLEGAL_IP=1.3, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Remove the EPYC specific apicid decoding and use the generic default decoding. This reverts commit 247b18c593ec298446645af8d5d28911daf653b1. Signed-off-by: Babu Moger --- target/i386/cpu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 83acbce3e9..567d864051 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3993,7 +3993,6 @@ static X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x8000001E, .model_id = "AMD EPYC Processor", .cache_info = &epyc_cache_info, - .use_epyc_apic_id_encoding = 1, .versions = (X86CPUVersionDefinition[]) { { .version = 1 }, { @@ -4121,7 +4120,6 @@ static X86CPUDefinition builtin_x86_defs[] = { .xlevel = 0x8000001E, .model_id = "AMD EPYC-Rome Processor", .cache_info = &epyc_rome_cache_info, - .use_epyc_apic_id_encoding = 1, }, }; From patchwork Fri Aug 21 22:12:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11730625 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB34E913 for ; Fri, 21 Aug 2020 22:13:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 71CAB20855 for ; Fri, 21 Aug 2020 22:13:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="UdDaPpEZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71CAB20855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9FHq-0004v3-Nf for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Aug 2020 18:13:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHG-0003nl-Nu for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:12:50 -0400 Received: from mail-eopbgr770088.outbound.protection.outlook.com ([40.107.77.88]:43270 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHE-00026u-Gc for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:12:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m3udcoKL22Tpsqm7Vx8DKLgeh2ymD6JKT/LhP8Ukd5oltuyBM+duWKGgZW/KyUIqfOCJl9uX/ajBiU96hhxt5BdD1iqX5WHh/iNXQupQB2uC9ZQgXDyQhPgmLmwddOUUHv6c3OJ2v4XoybuSN293RJRj8NzlLd4pQzsny7XUYM4SSEyWKTdENfgqHTI/6fVc0/dLw6wBB+OECh/0i9sZonzDDdLgGyQ3QGoKNSlXsQcb7mdoyvtsqxxVvGAzzzyTqnib8P6Syjlu6dJIa+VW8fYPpLOdDNbWJakJ7079zMHZi7hvtRnVAxh436LaIoq2a2qDzFAGdTfBs7e3VAuL9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YrNbCRUfb1bckqbwMDMEDWp67q/9G4cwOe1N9qLlaqU=; b=NKCy3hODEqZ+RXCmQ2E1SU6VTE9dV2sDgBeDdgOciIznGs/U5KjS494PQ7AqkULEC5uphnqlg+EsP/BIRqyzJ3CblxyTlrZZqGCI3GLrmZjI7wYypZuBnwI125r3A25g+UVBUHTe+Gj4mxKvLRAyiLPYKoqE/qV32lKzuvPEHkwxs932CWQ1LyhNxbDAzk8rEBRUwhLqHJAsLj8LFqIjsxCxBYKqqe7BvaV872aXZZC6lHyah3MS1tR9+tUqeVlFneIh4/2RDtiM3PNkYq9BBf35nM04YOBpkdUw/2keEcDPpxXwLr0LNEKFmnpSDiWl/sM9K5wp2axHuNJ8VwL65w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YrNbCRUfb1bckqbwMDMEDWp67q/9G4cwOe1N9qLlaqU=; b=UdDaPpEZnh+YGG+ygYz8PZNh13vnqLMjm0D5yrdEt5kV4ElA130Uz4G6PoBpGeoogBZ8vXPu37BSqj+P3cbZakTMebQBrpeO0zdxDsrKwnk9gtWZ2+MICsrJq/+4yDFLvm/DieO3N61D3Gg26gqPU91WWeLteo5l6WAuiExlfg4= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN6PR12MB2670.namprd12.prod.outlook.com (2603:10b6:805:6b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 22:12:45 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d%4]) with mapi id 15.20.3305.024; Fri, 21 Aug 2020 22:12:45 +0000 Subject: [PATCH v5 4/8] Revert "hw/i386: Move arch_id decode inside x86_cpus_init" From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, imammedo@redhat.com Date: Fri, 21 Aug 2020 17:12:44 -0500 Message-ID: <159804796398.39954.2535043746732107351.stgit@naples-babu.amd.com> In-Reply-To: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> References: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> User-Agent: StGit/unknown-version X-ClientProxiedBy: SN4PR0501CA0088.namprd05.prod.outlook.com (2603:10b6:803:22::26) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by SN4PR0501CA0088.namprd05.prod.outlook.com (2603:10b6:803:22::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.10 via Frontend Transport; Fri, 21 Aug 2020 22:12:44 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 20dbf6ca-5339-4e05-b064-08d8461f5462 X-MS-TrafficTypeDiagnostic: SN6PR12MB2670: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:162; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sn9N1oRAB5l7i8Tpj9ZKD95BBAXAZfc3f1BJBYcGq3tskMTpFv1mBC4UOfNjcL6tDMXBXj+X+YcxGS0DL1b0sSL5QycL2xP/VGt45nDidVxoNMX6yuEELRd4695jeo/j8A7dIct2IS2AEA0YKbgD6nuMvZ2jNIKIKEggnTWo0Szqp0QKbt/iPmn2Zh2eGcxuLEpYWnS7uZWcOWtCeMRq9bV4z1TrgBPJoD50NNtOPki7BWh1usscfFPLvNXqCy/gg5X9proR3BoP1PnHIgmh9a9FAVcmbwY68oFOSP0K1vSbzcnLwbvr3QmwYLXJ9ssudx4VbeUwdY6eNDPcIMUjapsJ0Df3sLxdVs+J4ImAzCDA+AYo8xe6BU+ShUyl5vTh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2560.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(39860400002)(136003)(346002)(396003)(4326008)(5660300002)(83380400001)(86362001)(52116002)(110011004)(8676002)(316002)(26005)(186003)(956004)(478600001)(6486002)(66946007)(66476007)(66556008)(8936002)(44832011)(16576012)(2906002)(103116003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: CGan5VUfGf39yXs/o54KO4wbRpcs/HMdilvPNe8j9067cpEz9O798Bo/OXUqEaiZd7GGuPXqjFik7irsjzVzEy6nNwC7gRlXDEa6/Pk2FkZyeSghz1b7rpY0YH8E/OFiV9IiRU56tKhBRD7tJLGwsTB9DRsS4Pjs3GoXdcQfa+0biVCnoG/GEDV2Wv/LG6FX2K6aV5j90X6d5fTG/A+Sm/KVM1BhN2llec/OAnAEf8lcasqNQJBtcDkR+isvao9LBwzx92j+l0F5i4Y9YQTNDu29dvT3C4jOmGwZvuSdZLJKGRozcsWuMacmuS1kAUVH+/Kyb59SHmSMyGLhrJFLq1FvDkN8HoN9HWtNWJij/khzUGJw1GHUE7BX5LUm+QbvB+H4n6vXqIMawm6CDCzlEgfBvvCmYBEdxDsH7r5NKia/oWjBSncyjea07vhEuwp6IudjpbERpr3mwU5DT3YgBFL3VVYYSSNs/gB4m7NF/K3eB3P7IgB4nldms0zvaGPNO7dR3yBNDvnRvgPm4LXgB4U3Zlu17x2cKpvI158RWXQDCMGXaB4dwbukWQYDxkHOZkoj9KesdK5w2LzX3dGDOyg1/ZIlcY1evbrNakRbrajTO7OslL6pEdHpL3DlbeX+aT4Gd/8+0uwaneXWSHtP0Q== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20dbf6ca-5339-4e05-b064-08d8461f5462 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 22:12:45.0357 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0LFzBH4c3zpWrqs0LZwCDKc6sAKKr0P6UB171W8YYwyjG5p66Vr7vWyo583qNo0n X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2670 Received-SPF: none client-ip=40.107.77.88; envelope-from=Babu.Moger@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 18:12:46 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FORGED_SPF_HELO=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_ILLEGAL_IP=1.3, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Remove the EPYC specific apicid decoding and use the generic default decoding. This reverts commit 2e26f4ab3bf8390a2677d3afd9b1a04f015d7721. Signed-off-by: Babu Moger --- hw/i386/pc.c | 6 +++--- hw/i386/x86.c | 37 +++++++------------------------------ 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index e74b3cb1d8..6abe7723e0 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1552,14 +1552,14 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, topo_ids.die_id = cpu->die_id; topo_ids.core_id = cpu->core_id; topo_ids.smt_id = cpu->thread_id; - cpu->apic_id = x86ms->apicid_from_topo_ids(&topo_info, &topo_ids); + cpu->apic_id = x86_apicid_from_topo_ids(&topo_info, &topo_ids); } cpu_slot = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx); if (!cpu_slot) { MachineState *ms = MACHINE(pcms); - x86ms->topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids); + x86_topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids); error_setg(errp, "Invalid CPU [socket: %u, die: %u, core: %u, thread: %u] with" " APIC ID %" PRIu32 ", valid index range 0:%d", @@ -1580,7 +1580,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, /* TODO: move socket_id/core_id/thread_id checks into x86_cpu_realizefn() * once -smp refactoring is complete and there will be CPU private * CPUState::nr_cores and CPUState::nr_threads fields instead of globals */ - x86ms->topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids); + x86_topo_ids_from_apicid(cpu->apic_id, &topo_info, &topo_ids); if (cpu->socket_id != -1 && cpu->socket_id != topo_ids.pkg_id) { error_setg(errp, "property socket-id: %u doesn't match set apic-id:" " 0x%x (socket-id: %u)", cpu->socket_id, cpu->apic_id, diff --git a/hw/i386/x86.c b/hw/i386/x86.c index f6eab947df..0a7cf8336c 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -67,22 +67,6 @@ inline void init_topo_info(X86CPUTopoInfo *topo_info, topo_info->threads_per_core = ms->smp.threads; } -/* - * Set up with the new EPYC topology handlers - * - * AMD uses different apic id encoding for EPYC based cpus. Override - * the default topo handlers with EPYC encoding handlers. - */ -static void x86_set_epyc_topo_handlers(MachineState *machine) -{ - X86MachineState *x86ms = X86_MACHINE(machine); - - x86ms->apicid_from_cpu_idx = x86_apicid_from_cpu_idx_epyc; - x86ms->topo_ids_from_apicid = x86_topo_ids_from_apicid_epyc; - x86ms->apicid_from_topo_ids = x86_apicid_from_topo_ids_epyc; - x86ms->apicid_pkg_offset = apicid_pkg_offset_epyc; -} - /* * Calculates initial APIC ID for a specific CPU index * @@ -101,7 +85,7 @@ uint32_t x86_cpu_apic_id_from_index(X86MachineState *x86ms, init_topo_info(&topo_info, x86ms); - correct_id = x86ms->apicid_from_cpu_idx(&topo_info, cpu_index); + correct_id = x86_apicid_from_cpu_idx(&topo_info, cpu_index); if (x86mc->compat_apic_id_mode) { if (cpu_index != correct_id && !warned && !qtest_enabled()) { error_report("APIC IDs set in compatibility mode, " @@ -135,11 +119,6 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version) MachineState *ms = MACHINE(x86ms); MachineClass *mc = MACHINE_GET_CLASS(x86ms); - /* Check for apicid encoding */ - if (cpu_x86_use_epyc_apic_id_encoding(ms->cpu_type)) { - x86_set_epyc_topo_handlers(ms); - } - x86_cpu_set_default_version(default_cpu_version); /* @@ -153,12 +132,6 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version) x86ms->apic_id_limit = x86_cpu_apic_id_from_index(x86ms, ms->smp.max_cpus - 1) + 1; possible_cpus = mc->possible_cpu_arch_ids(ms); - - for (i = 0; i < ms->possible_cpus->len; i++) { - ms->possible_cpus->cpus[i].arch_id = - x86_cpu_apic_id_from_index(x86ms, i); - } - for (i = 0; i < ms->smp.cpus; i++) { x86_cpu_new(x86ms, possible_cpus->cpus[i].arch_id, &error_fatal); } @@ -183,7 +156,8 @@ int64_t x86_get_default_cpu_node_id(const MachineState *ms, int idx) init_topo_info(&topo_info, x86ms); assert(idx < ms->possible_cpus->len); - x86_topo_ids_from_idx(&topo_info, idx, &topo_ids); + x86_topo_ids_from_apicid(ms->possible_cpus->cpus[idx].arch_id, + &topo_info, &topo_ids); return topo_ids.pkg_id % ms->numa_state->num_nodes; } @@ -214,7 +188,10 @@ const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms) ms->possible_cpus->cpus[i].type = ms->cpu_type; ms->possible_cpus->cpus[i].vcpus_count = 1; - x86_topo_ids_from_idx(&topo_info, i, &topo_ids); + ms->possible_cpus->cpus[i].arch_id = + x86_cpu_apic_id_from_index(x86ms, i); + x86_topo_ids_from_apicid(ms->possible_cpus->cpus[i].arch_id, + &topo_info, &topo_ids); ms->possible_cpus->cpus[i].props.has_socket_id = true; ms->possible_cpus->cpus[i].props.socket_id = topo_ids.pkg_id; if (x86ms->smp_dies > 1) { From patchwork Fri Aug 21 22:12:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11730631 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF67C722 for ; Fri, 21 Aug 2020 22:14:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B506220855 for ; Fri, 21 Aug 2020 22:14:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="tGeUCdus" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B506220855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9FJE-0007TX-Vb for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Aug 2020 18:14:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHL-0003uz-F9 for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:12:55 -0400 Received: from mail-eopbgr770079.outbound.protection.outlook.com ([40.107.77.79]:39278 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHJ-00027D-Vb for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:12:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aR3QyxsahycDNEBj83Zl/WxSJhQavgnvENqm0p7sioEzIwPaM5hnvj7RiKkdeVR9GGfiSzUPjy0SeEDvVkbOv+igO7Kz0F5aMXH6MepR9z6BQKdf7M2r9Ra+pC5KNt9KyVcEFEPn0k6cGcnaQg2FLAmJ4QwkKWUUusmE5uECaatrJuHv0AQ7v9zJDPYJvW6cbvkJ7GRQGpZMlgaPnAFMUmFMcBJEoLk2hZkIjv5KQUhtlBwFdI3EaNkp8Zy1dqkB31JkYpOogx3DR7OS938c63+BebCeViX8cPxz+a6r/wVZIkszBKzt/583pI3uQhUvN9+cOZHlr/lSZPD2zooMHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4nY66Q6E0+u4nlcfBduANiuFue7ktD4Eg/ps+SWWevo=; b=Mlaoob7wR/EZ+uv5DeCT+oBG84TB8tQMOOjn+vJBzxNrTw5HIKBUyA5Be6LB3e+RwEFJaEHU3KCzUWgRSH1UBWNLLWKdYNZyatWBIe6F7YNKgKLu4YSGD9yHzShUWhZTq77vXUDxSMYlTlCu+vnXvUWWyd4J/GzxS7MN3+xz1iZsVaYKWByU6I8rJnGnIrmQgI7rOT0p4sa4AoO+/5riCMR3QGXut+krJydpcazl2w7qNa95WM6ODJHO08FuoxbDOGtfHYfiTLwLBh1AGsGbL0OJMaIOnYOt2aNF0dhYYzDQpKyjq1SOWwKaKc+uzkem11Nb22eO56HGP4scZVB06Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4nY66Q6E0+u4nlcfBduANiuFue7ktD4Eg/ps+SWWevo=; b=tGeUCdusoIVhhijMhuocv5YnOLkVZIdES5f428ZAQamjHdymRjmV1JCpxjdIpKyXX/AeRIMZqYxvCzTaD+6D1HTXiMbQnie1ozOw1qP/NZOafy+NGCNE1wcM9M9Lir3GTNL1eeQbsoOKCYrN/nfAlOqueB+79WFwFR3N6SMelYQ= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN6PR12MB2670.namprd12.prod.outlook.com (2603:10b6:805:6b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 22:12:51 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d%4]) with mapi id 15.20.3305.024; Fri, 21 Aug 2020 22:12:51 +0000 Subject: [PATCH v5 5/8] Revert "i386: Introduce use_epyc_apic_id_encoding in X86CPUDefinition" From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, imammedo@redhat.com Date: Fri, 21 Aug 2020 17:12:50 -0500 Message-ID: <159804797021.39954.773444808887474448.stgit@naples-babu.amd.com> In-Reply-To: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> References: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> User-Agent: StGit/unknown-version X-ClientProxiedBy: SN4PR0701CA0042.namprd07.prod.outlook.com (2603:10b6:803:2d::16) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by SN4PR0701CA0042.namprd07.prod.outlook.com (2603:10b6:803:2d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.24 via Frontend Transport; Fri, 21 Aug 2020 22:12:50 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ef2f307c-5d9b-4138-c908-08d8461f5841 X-MS-TrafficTypeDiagnostic: SN6PR12MB2670: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tLG8w6eWbPTUIMqotwhP7e8kj4m9mVpzJKdIoh+FSnp2WyFzXUu/g0WHvRcHRwz3njmWgHq/vw1Pw3W+9jv70yZy1LBv/ARJ93S9UiH1ky/qMZXwT1yZXYSEDpuTuaRj6kBrm8/A5pUTl5gObSu4f+ciASPmC58VWqZWg368GWMIhmQaKxWkMQKxv68Qz7l1p8MC2BXwESrhW1OtRmJ/QTQIcg5achUlQ7TgY+l+u4Ai7+/91QtrQQNmXsxzBGgv1yFSZ6Sj5F2hQLTFVvrqgWtYjktZrMYu23uaSu3jFCJLnunytx3PJe39ZobA/Yjy+NCoJd+QIjepCQM3HMM6YQ35vNUx9yJNN3pXD7P0swsjg40xqri2Yuu+g0rIsxvV X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2560.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(39860400002)(136003)(346002)(396003)(4326008)(5660300002)(83380400001)(86362001)(52116002)(110011004)(8676002)(316002)(26005)(186003)(956004)(478600001)(6486002)(66946007)(66476007)(66556008)(8936002)(44832011)(16576012)(2906002)(103116003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: b8QvrEvQIUZ9rs00FRRB+CTlbdC3AYUJvtGr+JWvGHRtZxqXIH/50q5AVOJN6TWtLfpblNakjsdQNQDffrFVO51iRnmRDWYPMHMcivrnGYpX+JverBHQLh92jrfz30HISxr0sYwFsyLpj5iuzuvjYMmyRLnwmPE/R5l0rBq88rgicklUf6I7lczl24Yo9RG9BRynZGQ8S06k5XGjVYQIdR6AkEVnARh6U1SAjFRY1IA5KM5SeS3suAwRPtgihzS5EIocIxMMU/qPw4oojFsnPfTi/oU0ZmoCeDkYNIq6cVM2cvIBpBIAEJBqxb6ruz0307ydth1noK7/11sc8d0cXRni5FLoNubj90WUHjKCQzDdYdejMrw2GIDvwE+PUOlPBQYikISkp0PBY5iXWTbVb70wdEiOVhPO4dmvHAo6yh8wsdi3CIxwbW8wz8VKvmoKPyQ4mbwlm5yImVwyvWvxG+MaUwsLQXYmXCH79PvR37+aruDsu4iP+Y7+Hksa1NtkGfy+izXUZETDuKDThMeWpWlv9Hg5d+dFAyFkTjDzVtIQm+epPZ4xfNULkPRQiojeOXLuxRgbWdDFNooKhjYv7y3ONZW1tyh+aUbd7djMQ8AhTKJhSN2HO3P9ZXuMZqLkG/yZMFnm3tzBEi1+HHX/tg== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef2f307c-5d9b-4138-c908-08d8461f5841 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 22:12:51.7238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DaKJAEInc5d/ztHS2810Q9eB8D6HZJJNyJ3RVXYhXxq8bnFPnq2838QCFEv+ooob X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2670 Received-SPF: none client-ip=40.107.77.79; envelope-from=Babu.Moger@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 18:12:53 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FORGED_SPF_HELO=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_ILLEGAL_IP=1.3, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Remove the EPYC specific apicid decoding and use the generic default decoding. This reverts commit 0c1538cb1a26287c072645f4759b9872b1596d79. Signed-off-by: Babu Moger --- target/i386/cpu.c | 16 ---------------- target/i386/cpu.h | 1 - 2 files changed, 17 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 567d864051..19198e3e7f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1636,10 +1636,6 @@ typedef struct X86CPUDefinition { FeatureWordArray features; const char *model_id; CPUCaches *cache_info; - - /* Use AMD EPYC encoding for apic id */ - bool use_epyc_apic_id_encoding; - /* * Definitions for alternative versions of CPU model. * List is terminated by item with version == 0. @@ -1681,18 +1677,6 @@ static const X86CPUVersionDefinition *x86_cpu_def_get_versions(X86CPUDefinition return def->versions ?: default_version_list; } -bool cpu_x86_use_epyc_apic_id_encoding(const char *cpu_type) -{ - X86CPUClass *xcc = X86_CPU_CLASS(object_class_by_name(cpu_type)); - - assert(xcc); - if (xcc->model && xcc->model->cpudef) { - return xcc->model->cpudef->use_epyc_apic_id_encoding; - } else { - return false; - } -} - static CPUCaches epyc_cache_info = { .l1d_cache = &(CPUCacheInfo) { .type = DATA_CACHE, diff --git a/target/i386/cpu.h b/target/i386/cpu.h index a345172afd..d3097be6a5 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1917,7 +1917,6 @@ void cpu_clear_apic_feature(CPUX86State *env); void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); void host_vendor_fms(char *vendor, int *family, int *model, int *stepping); -bool cpu_x86_use_epyc_apic_id_encoding(const char *cpu_type); /* helper.c */ bool x86_cpu_tlb_fill(CPUState *cs, vaddr address, int size, From patchwork Fri Aug 21 22:12:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11730627 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19401722 for ; Fri, 21 Aug 2020 22:13:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E46C520855 for ; Fri, 21 Aug 2020 22:13:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="tOPYNnMX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E46C520855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9FI3-0005KG-6H for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Aug 2020 18:13:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHS-00046j-Fl for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:02 -0400 Received: from mail-eopbgr770078.outbound.protection.outlook.com ([40.107.77.78]:21363 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHQ-00027k-V6 for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CywvoWnv64u+7sblI70mETPGHlOSm9n3xaJb/4MD5sjJEHvbfX2nHZvXh+0Y+vCxD2pbh91+7i7FxvMC1TZnsujvrLojboelRAIfjzccG8khclMqY8Sl0iujXLGKDS9tTfMN4JG/Uh7pew+A+ShAbzbeJLJpMRTm3IT2G7EwyaAG3OB4FsJBV6drrkAecqMTaoQzyoUQXzsiEWMpy45lnbwq+Uq+LwcKuKGgEUhvRrJrR/vm6MvXO2r+p9kEJaPjW5lnvAe+AGxBrB38Dh1x1VFu6spG/wEtWyRnDoeP05W1rjDDxj+o03b9LisYaBMq58gLdt44DGkFZc4WYT950w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DqeDoUw2ATwU+l1GtZvpMYQ2cs1HefxOr3fZQp6qa0U=; b=bIFMfn+jBTG9J4/o3TadoqQvb3QjNTWABTZP9pnDiPooSt+KvbrKRXwARFGbMV9ZMmSZ5qXL+dhu94+szQiClWXhgUJ/xYhWWBoDC6FXmMexWLjIhCtAT6GgWLPfmqPy3wzAFsA14gCxFhhMR5gqTpUPQ5uEXV5spnzDjvZE4Tqh5GNuEkRH82+ZhyRelbh1HvQO2AyUnxFUBAsKFv/j3gnM7o0pin/MvGoW+IxnqQlaYJBXk2i4WDBSSV9VDT3oOrPTiCAftSgfY08Ha6Xs6cWDWNdybYPbW6+L2RwW9oQZ7h/L0bhO677uaFjA5TeIWF0mGuYgmKQvyUffhVaPzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DqeDoUw2ATwU+l1GtZvpMYQ2cs1HefxOr3fZQp6qa0U=; b=tOPYNnMX0SQXuym7YP2fZYcDDkbgS2JIPkxryMaGywmXbfBeStcGLervfunsTxOEOXIfsWkOpdqYozsh2uU88BKNZ82j4LUZC7A3Tl2kZ5JGHM3Cv5Oahk3icMfEPnSrIhU+rEIfnQ6McLN4x5Sk3Kas9uMlYgnQbYiw7ygyvhw= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN6PR12MB2670.namprd12.prod.outlook.com (2603:10b6:805:6b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 22:12:58 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d%4]) with mapi id 15.20.3305.024; Fri, 21 Aug 2020 22:12:58 +0000 Subject: [PATCH v5 6/8] Revert "hw/i386: Introduce apicid functions inside X86MachineState" From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, imammedo@redhat.com Date: Fri, 21 Aug 2020 17:12:56 -0500 Message-ID: <159804797689.39954.15208502866023220930.stgit@naples-babu.amd.com> In-Reply-To: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> References: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> User-Agent: StGit/unknown-version X-ClientProxiedBy: SN4PR0501CA0029.namprd05.prod.outlook.com (2603:10b6:803:40::42) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by SN4PR0501CA0029.namprd05.prod.outlook.com (2603:10b6:803:40::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.10 via Frontend Transport; Fri, 21 Aug 2020 22:12:57 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7623b940-6965-488b-68b4-08d8461f5c19 X-MS-TrafficTypeDiagnostic: SN6PR12MB2670: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:175; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RI0TQ5img1zPMtrDmo68dMIWGVR9gKrbDy7pOGql2n0UElY4wj9ygqfFhskOF6ZLmzrSZ8NSrG1jVlrZe2N4NUq2qBVNDExZdHLObEfNg2E9fd7AkLKgNilp0z4frRh3cxa09eefJjDl1CQBtw1rVCGhyTsRwltscrmF82WCXIH9+Z4cweVtpFDzVdeMfLZUdGm5MNFPZXjRivN7D0w2boV6fi9SKoK4dAIABhEW9eGWyUA4J+NZvRSDS8rayYKH8dVi2Yi4pBRnjq3WV4mTtNr+4fkLe3zDRbyKw92DxHnVMDkQST9FYjj0aMU8ShBVnvi3Tj6UQNvQdwgIPGBbPkM+WvhhnM5OSzDZVLfB0m6G7Av4OtsiqgaorYqw6KZt X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2560.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(39860400002)(136003)(346002)(396003)(4326008)(5660300002)(83380400001)(86362001)(52116002)(110011004)(8676002)(316002)(26005)(186003)(956004)(478600001)(6486002)(66946007)(66476007)(66556008)(8936002)(44832011)(16576012)(2906002)(103116003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 24w69tlpkJvAGHFuxVbkL/DfBbOkeC8hEa2OUSWCkBkXFrpXFDPka7zjWejeus1SlJQB9nrDZtwRoFc81cu3DN4WOALI/0Kc+7SCgtcH8OJjfwCmVWyoDtbHS1qFkoVNnISBXobuZH1tG41mFreT8bjECUlddh8wALNjRfNb8XdeD35K5EjWGZ4Ep+dy9yiO9AVUOUDPkLNE9de7vo7LfOYdLf75wxLTNiWLCTxUAGqNOgKdbAwmQiVkNGEN1zhji2m2USe49BXisPyqZxUMrs5viJYGQeHDpvYhoO5skw97BSj7b0R0Y6FOYRu9PJNlZGEnq2NO/+M4GT3ZptHSWOK2dNki1XALfOnJX12pODsPn6GHjkM6k2mJ6ONnT5Y5yUsOD0aoxLLxvKZJnhUgSwzguXGR+LxBZB9Pw3duEhnteC42mIbDn6RwfhX5yzripWd8HEdAqTJsKNN0xBzgwwh1iDpp7fqCh2+ApdjgXpqQ37wWLxHcwJZpf32XxbbELO209nn9CcBxt0aFNqxHLn0ip6W3ALTxqFvvkgCcrRCviqDLoDu2o2abXWBvdbrOvnzDp0oLoVrP3Tlzq8C0pjUfQE1y5I0kJPIQkk3gnZ9D/YW55tADS5wZzhMwzuKArWL+9dpwx58mVlARvFoNAw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7623b940-6965-488b-68b4-08d8461f5c19 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 22:12:57.9392 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r7EBLLQY/qA0Yub71BOvD0/F25A8kb425wzXzLz65wX9IC7yXYTNYbGNa4e0r+zt X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2670 Received-SPF: none client-ip=40.107.77.78; envelope-from=Babu.Moger@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 18:12:59 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FORGED_SPF_HELO=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_ILLEGAL_IP=1.3, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Remove the EPYC specific apicid decoding and use the generic default decoding. This reverts commit 6121c7fbfd98dbc3af1b00b56ff2eef66df87828. Signed-off-by: Babu Moger --- hw/i386/x86.c | 5 ----- include/hw/i386/x86.h | 9 --------- 2 files changed, 14 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 0a7cf8336c..c9dba0811a 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -895,11 +895,6 @@ static void x86_machine_initfn(Object *obj) x86ms->smm = ON_OFF_AUTO_AUTO; x86ms->acpi = ON_OFF_AUTO_AUTO; x86ms->smp_dies = 1; - - x86ms->apicid_from_cpu_idx = x86_apicid_from_cpu_idx; - x86ms->topo_ids_from_apicid = x86_topo_ids_from_apicid; - x86ms->apicid_from_topo_ids = x86_apicid_from_topo_ids; - x86ms->apicid_pkg_offset = apicid_pkg_offset; } static void x86_machine_class_init(ObjectClass *oc, void *data) diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index b79f24e285..4d9a26326d 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -63,15 +63,6 @@ typedef struct { OnOffAuto smm; OnOffAuto acpi; - /* Apic id specific handlers */ - uint32_t (*apicid_from_cpu_idx)(X86CPUTopoInfo *topo_info, - unsigned cpu_index); - void (*topo_ids_from_apicid)(apic_id_t apicid, X86CPUTopoInfo *topo_info, - X86CPUTopoIDs *topo_ids); - apic_id_t (*apicid_from_topo_ids)(X86CPUTopoInfo *topo_info, - const X86CPUTopoIDs *topo_ids); - uint32_t (*apicid_pkg_offset)(X86CPUTopoInfo *topo_info); - /* * Address space used by IOAPIC device. All IOAPIC interrupts * will be translated to MSI messages in the address space. From patchwork Fri Aug 21 22:13:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11730635 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E67C013B1 for ; Fri, 21 Aug 2020 22:15:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BCDAA20855 for ; Fri, 21 Aug 2020 22:15:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="u0GsYT6b" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCDAA20855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9FJY-00083j-W3 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Aug 2020 18:15:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHY-0004H8-5l for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:08 -0400 Received: from mail-eopbgr770088.outbound.protection.outlook.com ([40.107.77.88]:30117 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FHW-000289-DH for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZsUfeaKm3uzATpUBoXAFeIfziTJyVWfTkqXnnEyb20qDYB/tvwc5KVH1VKhjJ7lQOVTtgoZNI0D7RJ3VKMeuXpaff/71aSbIHk1H2wkANmyrvUAdM5Adt2iPkrfsNGvVM/wzoYbcdTONTjL9aevGwVx87XNB4fVefJGVkFh/omgEoKQwD1YC0BIMuFP1nGB70zi88KPUTsg8RtwGugVxeJDBy8loONfElIe/8kmcaOyNCbtQQCksjS9j7kSTZcOBdqSbamRXh40DaBF/WRKD0lSJssnDzArzfmJm6MNY/DKFtxdIYsmhfd/cQuVK8aRr3psgObJ3LO2ME/26FHPx1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mBkqZudWToFHDCYyzU0iuzhMlRS3dxQow6d0kA1PyBo=; b=FR4iT2Qp/dOF9V6QdBlUvwf2nIlwgQmrWplJYojUOATEEXIZm1QWet2mNTi0ueKCLIVFrLXxkpMkRlWwE4c6+X4Mf93dY7ye/dwA/MXAbCtokI5vcme5xL1XbZOWgH7Py6yuDzTmG/mwMmTbl91NxzPeVTLJPmGFDpgtXCWKg0eLQsAF5tO3Kcd4CEL3BlnQMoyN6BkBctgBwjqdHkETtZZr56LoxOR0XC8Tvz8iNIyAadg4WyHG62y/u6sYQUs/Gbyf3k8KJrRmDmSqbVTCvBIrIGpEye8DkH+XJqDmazZApku8zmDloSOGp+lwZugFA6czJlj4OVcmXJbOpqyX8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mBkqZudWToFHDCYyzU0iuzhMlRS3dxQow6d0kA1PyBo=; b=u0GsYT6bARueqd84iT8ZhA9S8sn+LPlk5dKeDZqqm6/Cro0MI5Q2s2qI+Zs4hhKxmCkRZ+QLXh7qiA6lJrNsm55xhs4L/g072G1cxjNsI2cIRsEAkDM9rtv7fSglcgZVS9yjkg/rgLZpqMlCRsTWVEbLSKiSg6Hk84+dioOsuyw= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN6PR12MB2670.namprd12.prod.outlook.com (2603:10b6:805:6b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 22:13:04 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d%4]) with mapi id 15.20.3305.024; Fri, 21 Aug 2020 22:13:04 +0000 Subject: [PATCH v5 7/8] Revert "hw/386: Add EPYC mode topology decoding functions" From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, imammedo@redhat.com Date: Fri, 21 Aug 2020 17:13:03 -0500 Message-ID: <159804798309.39954.1879996211709102099.stgit@naples-babu.amd.com> In-Reply-To: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> References: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> User-Agent: StGit/unknown-version X-ClientProxiedBy: SN4PR0201CA0035.namprd02.prod.outlook.com (2603:10b6:803:2e::21) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by SN4PR0201CA0035.namprd02.prod.outlook.com (2603:10b6:803:2e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.24 via Frontend Transport; Fri, 21 Aug 2020 22:13:03 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 088e003a-c075-4493-e7c1-08d8461f5fd3 X-MS-TrafficTypeDiagnostic: SN6PR12MB2670: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:268; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dmcgtwWPWP8zG5fVQO3Sfkjj0FvCByJ7ibrCTM/4tqSZ6BhjkH9TLuGEB+kk/u/Yx5YfYVOm1KTkdVED3MbitexoqrkDRj4jiZAUsKGTp7L1Jv9IqpN80QQcMDs20gRNYT7ptPrJHP1VuqlAiokya7VzUDhOa3GWBR2MLV6mfQr6YBKPKWyElx3HilOBOxAJKf6Js8XldyDcL1ikb2qytsKE0IagpwOCroIUgLW+44A20/RwDk48CXArELdj5ct+USMDvJRaHJkn7gJqn3uJa7oANn2QWajWkdh1odV/bF80g/Evr+KbgBGNjSPvhVK88kkpx7t95eCl25J50LluX2VZFpAv+t7FipwzYvnpXd56r14zmpMv0ya0MHYgXuP+ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2560.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(39860400002)(136003)(346002)(396003)(4326008)(5660300002)(83380400001)(86362001)(52116002)(110011004)(8676002)(316002)(26005)(186003)(956004)(478600001)(6486002)(66946007)(66476007)(66556008)(8936002)(44832011)(16576012)(2906002)(103116003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /PkbBWJTLQHrbtMhcJz+DD2Gfh6x72v+KHxQ1riqx66uJ88VKKH+TeblTr09qQ75uvFxw2IEZjs03Txzw3BifpkMNIMqt6rBbgUQvFIyQjT50xHIV1hmSPxpQPMmENAZ63sEv08gUPQd+2Af/oGGhpMA6pY6SrcJWkC0wKAEaJO/KYFp6tMMKEFvEugO9ij8sCFVjr5CH0H+/yQoFE6obR7Vw9n+H4dRSkPDAVOziQieHSoD1xpfz1ALXnB/m8XIfez+3K3z8k6tTu8MuQLSLiLRhc2Zqiko8HH5/Gw3ypYiWQLi/zOl5JH4bkk5gR/p7lYJndXI454UKtMJUNT025P+V6TLxr8uSfPLnbXd4C5b7MQZb9hQ3jUDBD18WlhuA+iN1VML327ptnmy5kMNdcRBa15K2ovhqoSSmALiagwMphqiMogpVssi8VJWdOJNC/7YJ2n5+O+9Upvg+o93m5Efu+1UatCghfz9Zx76N67Dy3zCcW5Dje6y2k/jprzPV/RBFkXBuzLCo03uVTF7BVAzhdss5TOKFxaeOWSzV5tLTMTFTrIDPesp7pFYi+rKKXTj6bkmgbiw5E/PxRNTJF/WYaJO6Gl73bR73aA4lkXKn34NX/NqWic3M7Z25Zk02tR3XdbenEz9PmIUVHt2xA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 088e003a-c075-4493-e7c1-08d8461f5fd3 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 22:13:04.2096 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7fBKsqcoY7cNeIOnmjyZvo+fAz+veHq2lDSMlXpWfYC4qXiWLbiXSZI9mH1mU+LW X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2670 Received-SPF: none client-ip=40.107.77.88; envelope-from=Babu.Moger@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 18:12:46 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FORGED_SPF_HELO=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_ILLEGAL_IP=1.3, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Remove the EPYC specific apicid decoding and use the generic default decoding. This reverts commit 7568b205555a6405042f62c64af3268f4330aed5. Signed-off-by: Babu Moger --- include/hw/i386/topology.h | 79 -------------------------------------------- target/i386/cpu.c | 2 + 2 files changed, 1 insertion(+), 80 deletions(-) diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h index 05ddde7ba0..81573f6cfd 100644 --- a/include/hw/i386/topology.h +++ b/include/hw/i386/topology.h @@ -107,85 +107,6 @@ static inline unsigned apicid_pkg_offset(X86CPUTopoInfo *topo_info) return apicid_die_offset(topo_info) + apicid_die_width(topo_info); } -#define EPYC_DIE_OFFSET 3 /* Minimum die_id offset if numa configured */ - -/* - * Bit offset of the die_id field - */ -static inline unsigned apicid_die_offset_epyc(X86CPUTopoInfo *topo_info) -{ - unsigned offset = apicid_core_offset(topo_info) + - apicid_core_width(topo_info); - - return MAX(EPYC_DIE_OFFSET, offset); -} - -/* Bit offset of the Pkg_ID (socket ID) field */ -static inline unsigned apicid_pkg_offset_epyc(X86CPUTopoInfo *topo_info) -{ - return apicid_die_offset_epyc(topo_info) + apicid_die_width(topo_info); -} - -/* - * Make APIC ID for the CPU based on Pkg_ID, Core_ID, SMT_ID - * - * The caller must make sure core_id < nr_cores and smt_id < nr_threads. - */ -static inline apic_id_t -x86_apicid_from_topo_ids_epyc(X86CPUTopoInfo *topo_info, - const X86CPUTopoIDs *topo_ids) -{ - return (topo_ids->pkg_id << apicid_pkg_offset_epyc(topo_info)) | - (topo_ids->die_id << apicid_die_offset_epyc(topo_info)) | - (topo_ids->core_id << apicid_core_offset(topo_info)) | - topo_ids->smt_id; -} - -static inline void x86_topo_ids_from_idx_epyc(X86CPUTopoInfo *topo_info, - unsigned cpu_index, - X86CPUTopoIDs *topo_ids) -{ - unsigned nr_dies = topo_info->dies_per_pkg; - unsigned nr_cores = topo_info->cores_per_die; - unsigned nr_threads = topo_info->threads_per_core; - - topo_ids->pkg_id = cpu_index / (nr_dies * nr_cores * nr_threads); - topo_ids->die_id = cpu_index / (nr_cores * nr_threads) % nr_dies; - topo_ids->core_id = cpu_index / nr_threads % nr_cores; - topo_ids->smt_id = cpu_index % nr_threads; -} - -/* - * Calculate thread/core/package IDs for a specific topology, - * based on APIC ID - */ -static inline void x86_topo_ids_from_apicid_epyc(apic_id_t apicid, - X86CPUTopoInfo *topo_info, - X86CPUTopoIDs *topo_ids) -{ - topo_ids->smt_id = apicid & - ~(0xFFFFFFFFUL << apicid_smt_width(topo_info)); - topo_ids->core_id = - (apicid >> apicid_core_offset(topo_info)) & - ~(0xFFFFFFFFUL << apicid_core_width(topo_info)); - topo_ids->die_id = - (apicid >> apicid_die_offset_epyc(topo_info)) & - ~(0xFFFFFFFFUL << apicid_die_width(topo_info)); - topo_ids->pkg_id = apicid >> apicid_pkg_offset_epyc(topo_info); -} - -/* - * Make APIC ID for the CPU 'cpu_index' - * - * 'cpu_index' is a sequential, contiguous ID for the CPU. - */ -static inline apic_id_t x86_apicid_from_cpu_idx_epyc(X86CPUTopoInfo *topo_info, - unsigned cpu_index) -{ - X86CPUTopoIDs topo_ids; - x86_topo_ids_from_idx_epyc(topo_info, cpu_index, &topo_ids); - return x86_apicid_from_topo_ids_epyc(topo_info, &topo_ids); -} /* Make APIC ID for the CPU based on Pkg_ID, Core_ID, SMT_ID * * The caller must make sure core_id < nr_cores and smt_id < nr_threads. diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 19198e3e7f..b29686220e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -388,7 +388,7 @@ static void encode_topo_cpuid8000001e(X86CPUTopoInfo *topo_info, X86CPU *cpu, unsigned long dies = topo_info->dies_per_pkg; int shift; - x86_topo_ids_from_apicid_epyc(cpu->apic_id, topo_info, &topo_ids); + x86_topo_ids_from_apicid(cpu->apic_id, topo_info, &topo_ids); *eax = cpu->apic_id; /* From patchwork Fri Aug 21 22:13:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11730637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37188722 for ; Fri, 21 Aug 2020 22:16:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D4C0207DA for ; Fri, 21 Aug 2020 22:16:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="VF8xTNyI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D4C0207DA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:44018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9FKo-0001QI-Af for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Aug 2020 18:16:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FIE-0005jm-1H for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:50 -0400 Received: from mail-co1nam11on2088.outbound.protection.outlook.com ([40.107.220.88]:26369 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9FIC-0002AI-92 for qemu-devel@nongnu.org; Fri, 21 Aug 2020 18:13:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LS/nJjj+n2uDzx7+/8K0RWDtefHowclLOw6zNgVEounf1kPBBBzkUyYmNO6nFEP71UofVBnGrg4ewoG5n2f9XNzo6v1sAOzOfXZ+Z2VB0tw7oqC7/xahsKhhvATMMmMOoMeitPfiRsiVfX5dIjEeZXvu1a75ohkDN7dEqT6xgiN/BHvPNisYZIm4NHipJiKv/QPwUYgO2bwaWo/lEAuDyEewoBLRW1KeH6vN3EgVLgv5G5VOkItP0kRzv90HhZtT061CeurkE9H9RRBRZ3l/e/mdeyncvQwcLBmGNP19o2jdDfZoQ7EC+ihyHyK0UUeWKXG57QgD7+sGkKb2hofvpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ajB3IXkdasp7HSg1LuxDW2TgICDFokJPRSZaL1+zbTw=; b=ZxqKTlWx7VfwHDWFYq2yA/IxdKAFhq7tDbQwmUbqsdgM+7gnIxf2ImLRCIDjGb8br5Xy1TDzNoxFntNz43TP0t0BzyJb8T+JeLAKb46fo1ngFpEpw0tcal28n4cfNgZS0ZPHYIUIXyFm7hqneB/F7wRRoemtnrhzBuo+f8TcGDS8V4wyOlPB15LG+JZTAavfbHYNJzfEYqn292tyJ8VSx1mPAyku6CwFsc81hRy3u6Sk7A9A+dvSwh0ikgyuD5G3hKdetvO3dz/RXNEo0pDCeVgW2T1LEvs1gEX+eIAccCgoP2xSE8hZ9uvZxdiHCsXyBtKsNN67KDWXQ6Sw/L6p9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ajB3IXkdasp7HSg1LuxDW2TgICDFokJPRSZaL1+zbTw=; b=VF8xTNyI5sd7O65m4D5Kihl3WeNakBsXa83vwOJ/fpimO6SziqtNXA39Jm2WvT94CNglyWpuMCE//xFCc72on/Ry7kSckAfoUuz96fjnaBmPyu+KJ+bnQ/NFsJ7ZeUzFX4j8LEuPqKzfnSJlmzNccPJ59RPtKAhisJZ2mbUKP4A= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN1PR12MB2383.namprd12.prod.outlook.com (2603:10b6:802:26::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Fri, 21 Aug 2020 22:13:10 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::ccd9:728:9577:200d%4]) with mapi id 15.20.3305.024; Fri, 21 Aug 2020 22:13:10 +0000 Subject: [PATCH v5 8/8] i386: Simplify CPUID_8000_001E for AMD From: Babu Moger To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, imammedo@redhat.com Date: Fri, 21 Aug 2020 17:13:09 -0500 Message-ID: <159804798946.39954.6416009204638021915.stgit@naples-babu.amd.com> In-Reply-To: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> References: <159804762216.39954.15502128500494116468.stgit@naples-babu.amd.com> User-Agent: StGit/unknown-version X-ClientProxiedBy: SN4PR0501CA0097.namprd05.prod.outlook.com (2603:10b6:803:42::14) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by SN4PR0501CA0097.namprd05.prod.outlook.com (2603:10b6:803:42::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.10 via Frontend Transport; Fri, 21 Aug 2020 22:13:10 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bbf86e7f-5d01-463b-d969-08d8461f63b2 X-MS-TrafficTypeDiagnostic: SN1PR12MB2383: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VkqN6JkVNNlVAjh72hJJk0dUknQ2CaJtQ/OC3pyT0vSu140tqcColuT7KdkdvgYdGtUdVSC+2ghcYynebfvqhi6W2ReKes4r1a0BGmNP/zs5XnA7Jp649012zTYNUWnauZHSzRKfccdfIH0/d9NvOANscB4hsK/+o3DRlmp0aRojtLMZHMbvzU8jluhi4BkpvmUNK0gVCfB0xL4/tYLZeKO+uG76l446ejaWUpB6XKQy6lauImLXz3nrg4TnSCSEVn14jIywzcUOBZu44f4aT+q+Y6Me6RT1Lhvuo+hhymOCkJCLEIrRsq3WeauQI9ne+B3cqYX+Zce1ikGgP4jYdb55aUWY1VfqtZLOCTYFG8VZf0f3sbKRQXnwmR6k7zeUeNbe2kD7xG+wo94cq24Pi7u13fIjsh2nkNsNxJT9pmARbTfXddfzuSRSBlzbF9yhe+f9cBIkfZJdfAzEL9BgYQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN1PR12MB2560.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(83380400001)(6486002)(2906002)(8676002)(103116003)(956004)(8936002)(44832011)(110011004)(26005)(478600001)(86362001)(966005)(16576012)(316002)(52116002)(66946007)(186003)(66556008)(66476007)(4326008)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WurHs2nvSDuZsABcunfFx9MkIoMq2vM8hBD7fJMKd9Xn/trCzWWJjN+uq1fai3s25Th7vFUnhCbz6b8WvL8wuSfaWs6Dt0RQ+4VzAoQ1ZiDJmvyMGu/U5TvMiv8n2pdy1lJCtyb6qLPKLn5729Ya16rCwJZoeSA2k5tJXdvbRnt5XOco5Lur4HB4VqwUCqBAx6mN3tuRAixi1BAFX32x/6jQiBJ5f87uf32o2Rvko+IaYbJe/WLwVZRk5DsPaYqiOgFPPTZB5DJQMyYgMIToQzyy9TPcfEMrlsvUh9KGs4oKhf5LT36kTyfSc5G3FMX92pHPmgMNBlCdKph+nsmFZRbCvWQD09zorIOYznlHWIHGfT0MrT0ngeeibsiA8eRBBine93xuD0eEjXv7CU/JCrAu4gxjyduveOFC+vrFsGWBwwbXLwS2+vOlS52E6sYZ0Jo+4SN9LCCB8dhqEQy44D8Ulz3buBhO6vapAsAiN8Ha2oArj3w9JPZHd24nin76KlFTDotDq7lEqpts05tiS1AZcBP51cbP7RJ4zKrW8Sr2bBzyt3/WKwcQ3DBOplR3AxgIzjV7OsCCSBnvzIsY5pKz91v6JJk25TNcBUb8WJfbbyntcBcQCIOLSrfVya/nejdY73fZLp0bKNfdzjgoXw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbf86e7f-5d01-463b-d969-08d8461f63b2 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2020 22:13:10.5390 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ATMt+9AyJADPj/2nmtinxkKXoYOHc5YxtWj6WsSYhNqtQMQIaI59jY7HuFWydDTG X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2383 Received-SPF: none client-ip=40.107.220.88; envelope-from=Babu.Moger@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 18:13:46 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FORGED_SPF_HELO=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_ILLEGAL_IP=1.3, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" apic_id contains all the information required to build CPUID_8000_001E. core_id and node_id is already part of apic_id generated by x86_topo_ids_from_apicid_epyc. Also remove the restriction on number bits on core_id and node_id. Remove all the hardcoded values and replace with generalized fields. Refer the Processor Programming Reference (PPR) documentation available from the bugzilla Link below. Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Signed-off-by: Babu Moger --- target/i386/cpu.c | 81 ++++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b29686220e..bea2822923 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -385,58 +385,51 @@ static void encode_topo_cpuid8000001e(X86CPUTopoInfo *topo_info, X86CPU *cpu, uint32_t *ecx, uint32_t *edx) { X86CPUTopoIDs topo_ids = {0}; - unsigned long dies = topo_info->dies_per_pkg; - int shift; x86_topo_ids_from_apicid(cpu->apic_id, topo_info, &topo_ids); *eax = cpu->apic_id; + /* - * CPUID_Fn8000001E_EBX - * 31:16 Reserved - * 15:8 Threads per core (The number of threads per core is - * Threads per core + 1) - * 7:0 Core id (see bit decoding below) - * SMT: - * 4:3 node id - * 2 Core complex id - * 1:0 Core id - * Non SMT: - * 5:4 node id - * 3 Core complex id - * 1:0 Core id + * CPUID_Fn8000001E_EBX [Core Identifiers] (CoreId) + * Read-only. Reset: 0000_XXXXh. + * See Core::X86::Cpuid::ExtApicId. + * Core::X86::Cpuid::CoreId_lthree[1:0]_core[3:0]_thread[1:0]; + * Bits Description + * 31:16 Reserved. + * 15:8 ThreadsPerCore: threads per core. Read-only. Reset: XXh. + * The number of threads per core is ThreadsPerCore+1. + * 7:0 CoreId: core ID. Read-only. Reset: XXh. + * + * NOTE: CoreId is already part of apic_id. Just use it. We can + * use all the 8 bits to represent the core_id here. */ - *ebx = ((topo_info->threads_per_core - 1) << 8) | (topo_ids.die_id << 3) | - (topo_ids.core_id); + *ebx = ((topo_info->threads_per_core - 1) << 8) | (topo_ids.core_id & 0xFF); + /* - * CPUID_Fn8000001E_ECX - * 31:11 Reserved - * 10:8 Nodes per processor (Nodes per processor is number of nodes + 1) - * 7:0 Node id (see bit decoding below) - * 2 Socket id - * 1:0 Node id + * CPUID_Fn8000001E_ECX [Node Identifiers] (NodeId) + * Read-only. Reset: 0000_0XXXh. + * Core::X86::Cpuid::NodeId_lthree[1:0]_core[3:0]_thread[1:0]; + * Bits Description + * 31:11 Reserved. + * 10:8 NodesPerProcessor: Node per processor. Read-only. Reset: XXXb. + * ValidValues: + * Value Description + * 000b 1 node per processor. + * 001b 2 nodes per processor. + * 010b Reserved. + * 011b 4 nodes per processor. + * 111b-100b Reserved. + * 7:0 NodeId: Node ID. Read-only. Reset: XXh. + * + * NOTE: Hardware reserves 3 bits for number of nodes per processor. + * But users can create more nodes than the actual hardware can + * support. To genaralize we can use all the upper 8 bits for nodes. + * NodeId is combination of node and socket_id which is already decoded + * in apic_id. Just use it by shifting. */ - if (dies <= 4) { - *ecx = ((dies - 1) << 8) | (topo_ids.pkg_id << 2) | topo_ids.die_id; - } else { - /* - * Node id fix up. Actual hardware supports up to 4 nodes. But with - * more than 32 cores, we may end up with more than 4 nodes. - * Node id is a combination of socket id and node id. Only requirement - * here is that this number should be unique accross the system. - * Shift the socket id to accommodate more nodes. We dont expect both - * socket id and node id to be big number at the same time. This is not - * an ideal config but we need to to support it. Max nodes we can have - * is 32 (255/8) with 8 cores per node and 255 max cores. We only need - * 5 bits for nodes. Find the left most set bit to represent the total - * number of nodes. find_last_bit returns last set bit(0 based). Left - * shift(+1) the socket id to represent all the nodes. - */ - dies -= 1; - shift = find_last_bit(&dies, 8); - *ecx = (dies << 8) | (topo_ids.pkg_id << (shift + 1)) | - topo_ids.die_id; - } + *ecx = ((topo_info->dies_per_pkg - 1) << 8) | + ((cpu->apic_id >> apicid_die_offset(topo_info)) & 0xFF); *edx = 0; }