From nobody Sun Nov 16 07:44:18 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599047771; cv=none; d=zohomail.com; s=zohoarc; b=CTK3Djy2lZBuxipLj+MeRKuPt/Py56HQDsC4eSBOwPeVasHkpcf+68an0geLjIjmoela3ysHMpdhenLUCCRnMs0e9x5cMvRhfmSL+cLkNG19+7f7m4MOY6utw496w6alkbR3aIQmNsHYPtfT1ANgR4u8I0evdHHgXVq7bbdDSlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599047771; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+tzJDmrfARmapNMHmkPgKPN9tJjvVrg0jcjQsA6zfgY=; b=IY4sSsgNg/fUmXteEYS3nY2yiABTi6KwTfqhX0SL/irBN9rsIHY5q7ol5mRK+Eip2e/yh3D8PH/oUbbt5/wrsD2p2s/+22bm2r/l3SmXqrALGrRkKQUXkE3IjRXBaIklzrojXlNXdlKTPtAOa/GWs3YANYvSYa5zDHHn9gtVdzE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159904777162183.9455414545289; Wed, 2 Sep 2020 04:56:11 -0700 (PDT) Received: from localhost ([::1]:44112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDRN4-00072v-S9 for importer@patchew.org; Wed, 02 Sep 2020 07:56:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDRKo-0002Qp-AP for qemu-devel@nongnu.org; Wed, 02 Sep 2020 07:53:50 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:24686 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDRKl-0006wD-Fg for qemu-devel@nongnu.org; Wed, 02 Sep 2020 07:53:49 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-uTFbQUsPNvi2raKAsSpA_Q-1; Wed, 02 Sep 2020 07:53:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 85AC210ABDCD; Wed, 2 Sep 2020 11:53:43 +0000 (UTC) Received: from localhost (ovpn-66-226.rdu2.redhat.com [10.10.66.226]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54E265C1C4; Wed, 2 Sep 2020 11:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599047626; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+tzJDmrfARmapNMHmkPgKPN9tJjvVrg0jcjQsA6zfgY=; b=K/b0j20gJosuVw5IpOvtK3hjmS7ktvPTI57wUz/XJOIZy/4KPPfL+2pnxz6sTTFT+22PBw xy94DKbi+acyQ+nGou9zLF2HG4h1+W9nqWj8Rooza3VeJn+6HBnDTQG6LJh041Hc/dGo2y s+mK2mrG3a02XO0MXB5+FCIQNI+VNH4= X-MC-Unique: uTFbQUsPNvi2raKAsSpA_Q-1 From: Eduardo Habkost To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 12/20] Revert "hw/i386: Move arch_id decode inside x86_cpus_init" Date: Wed, 2 Sep 2020 07:53:15 -0400 Message-Id: <20200902115323.850385-13-ehabkost@redhat.com> In-Reply-To: <20200902115323.850385-1-ehabkost@redhat.com> References: <20200902115323.850385-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/02 03:24:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Babu Moger , Igor Mammedov , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Babu Moger This reverts commit 2e26f4ab3bf8390a2677d3afd9b1a04f015d7721. Remove the EPYC specific apicid decoding and use the generic default decoding. Signed-off-by: Babu Moger Reviewed-by: Igor Mammedov Message-Id: <159889934379.21294.15323080164340490855.stgit@naples-babu.amd.= com> Signed-off-by: Eduardo Habkost --- 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 6b708f4341..0677d6a272 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1556,14 +1556,14 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug= _dev, topo_ids.die_id =3D cpu->die_id; topo_ids.core_id =3D cpu->core_id; topo_ids.smt_id =3D cpu->thread_id; - cpu->apic_id =3D x86ms->apicid_from_topo_ids(&topo_info, &topo_ids= ); + cpu->apic_id =3D x86_apicid_from_topo_ids(&topo_info, &topo_ids); } =20 cpu_slot =3D pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx); if (!cpu_slot) { MachineState *ms =3D MACHINE(pcms); =20 - 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", @@ -1584,7 +1584,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_d= ev, /* TODO: move socket_id/core_id/thread_id checks into x86_cpu_realizef= n() * once -smp refactoring is complete and there will be CPU private * CPUState::nr_cores and CPUState::nr_threads fields instead of globa= ls */ - 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 !=3D -1 && cpu->socket_id !=3D 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 cf384b9743..3cc2318212 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -68,22 +68,6 @@ inline void init_topo_info(X86CPUTopoInfo *topo_info, topo_info->threads_per_core =3D ms->smp.threads; } =20 -/* - * 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 =3D X86_MACHINE(machine); - - x86ms->apicid_from_cpu_idx =3D x86_apicid_from_cpu_idx_epyc; - x86ms->topo_ids_from_apicid =3D x86_topo_ids_from_apicid_epyc; - x86ms->apicid_from_topo_ids =3D x86_apicid_from_topo_ids_epyc; - x86ms->apicid_pkg_offset =3D apicid_pkg_offset_epyc; -} - /* * Calculates initial APIC ID for a specific CPU index * @@ -102,7 +86,7 @@ uint32_t x86_cpu_apic_id_from_index(X86MachineState *x86= ms, =20 init_topo_info(&topo_info, x86ms); =20 - correct_id =3D x86ms->apicid_from_cpu_idx(&topo_info, cpu_index); + correct_id =3D x86_apicid_from_cpu_idx(&topo_info, cpu_index); if (x86mc->compat_apic_id_mode) { if (cpu_index !=3D correct_id && !warned && !qtest_enabled()) { error_report("APIC IDs set in compatibility mode, " @@ -136,11 +120,6 @@ void x86_cpus_init(X86MachineState *x86ms, int default= _cpu_version) MachineState *ms =3D MACHINE(x86ms); MachineClass *mc =3D MACHINE_GET_CLASS(x86ms); =20 - /* 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); =20 /* @@ -154,12 +133,6 @@ void x86_cpus_init(X86MachineState *x86ms, int default= _cpu_version) x86ms->apic_id_limit =3D x86_cpu_apic_id_from_index(x86ms, ms->smp.max_cpus - 1= ) + 1; possible_cpus =3D mc->possible_cpu_arch_ids(ms); - - for (i =3D 0; i < ms->possible_cpus->len; i++) { - ms->possible_cpus->cpus[i].arch_id =3D - x86_cpu_apic_id_from_index(x86ms, i); - } - for (i =3D 0; i < ms->smp.cpus; i++) { x86_cpu_new(x86ms, possible_cpus->cpus[i].arch_id, &error_fatal); } @@ -184,7 +157,8 @@ int64_t x86_get_default_cpu_node_id(const MachineState = *ms, int idx) init_topo_info(&topo_info, x86ms); =20 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; } =20 @@ -215,7 +189,10 @@ const CPUArchIdList *x86_possible_cpu_arch_ids(Machine= State *ms) =20 ms->possible_cpus->cpus[i].type =3D ms->cpu_type; ms->possible_cpus->cpus[i].vcpus_count =3D 1; - x86_topo_ids_from_idx(&topo_info, i, &topo_ids); + ms->possible_cpus->cpus[i].arch_id =3D + 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 =3D true; ms->possible_cpus->cpus[i].props.socket_id =3D topo_ids.pkg_id; if (x86ms->smp_dies > 1) { --=20 2.26.2