From patchwork Mon Jun 3 12:36:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Lynch via B4 Relay X-Patchwork-Id: 1942902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=nUHu0LRe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VtCsz2h3yz20Pb for ; Mon, 3 Jun 2024 22:37:25 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=nUHu0LRe; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4VtCsw1kmHz3cZy for ; Mon, 3 Jun 2024 22:37:24 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=nUHu0LRe; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=devnull+nathanl.linux.ibm.com@kernel.org; receiver=lists.ozlabs.org) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4VtCsZ1MY3z3cVh for ; Mon, 3 Jun 2024 22:37:06 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 2698460DC4; Mon, 3 Jun 2024 12:37:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id CD1C5C2BD10; Mon, 3 Jun 2024 12:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717418222; bh=oAKe/MZ3tR47DDZ2heNnBxB0yg+CgNoEoBrTtI0v7tk=; h=From:Date:Subject:To:Cc:Reply-To:From; b=nUHu0LRegUkVVhI3VwkAa5zhJHTOxwe1cHn8ZFahOpoWLk3pLqshv9t8jWFAlrLEQ 8wTWejbDYGh14CbVxCGw2nQjtsVo0mIGf6Bhvhu80dZ9k4NZiv+rohmM45R9VsakTI sudAco9/wblrug6EPr8uAox++UC79ZIDtjcm7YUiZPpVI/2R8TA3qZ2SuLBVvxn3Eu pKcgd1vOijfjF3Be8Qejjfvl6lQ9fmqplDamCrqLVdgeqx7yEzZoEp082Gv3YCNrBH cWVFPjxrlk13hcRfMdBw+twUjhmD+D2VNwHrhrwVH5Hx1bzqYVX/owtJ+k2QmW1nT4 at/9gb1dopjIA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3112C25B75; Mon, 3 Jun 2024 12:37:02 +0000 (UTC) From: Nathan Lynch via B4 Relay Date: Mon, 03 Jun 2024 07:36:55 -0500 Subject: [PATCH] powerpc/prom: Add CPU info to hardware description string later MIME-Version: 1.0 Message-Id: <20240603-fix-cpu-hwdesc-v1-1-945f2850fcaa@linux.ibm.com> X-B4-Tracking: v=1; b=H4sIAOa4XWYC/x2MywqAIBAAf0X23IJmBvUr0aF0zb2YKD0g+vek4 8DMPFAoMxUYxQOZTi68xwqqEWDDEjdCdpWhlW0ne6nR8402HRguR8WiclYas2o/aA81Spmq8Q+ n+X0/9BJQQ2AAAAA= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717418222; l=3146; i=nathanl@linux.ibm.com; s=20230817; h=from:subject:message-id; bh=SQnZP+ZOaYpUBVE67R7Naoxs8zF7WUELrUitKXSzkQo=; b=kex8twhSTwz7JCEdCgt+lv2eZJg3+g76PRp7iEaHc3gjXRMkzCEWD/Xti0OzvJktwy6bmdoJy 3vFgu3J/qnnC9oDqMIv/FG6aLM5KlNzPXSXtZErc247pegq9Fdx4Z82 X-Developer-Key: i=nathanl@linux.ibm.com; a=ed25519; pk=jPDF44RvT+9DGFOH3NGoIu1xN9dF+82pjdpnKjXfoJ0= X-Endpoint-Received: by B4 Relay for nathanl@linux.ibm.com/20230817 with auth_id=78 X-Original-From: Nathan Lynch X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: nathanl@linux.ibm.com Cc: Nathan Lynch , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Nathan Lynch cur_cpu_spec->cpu_name is appended to ppc_hw_desc before cur_cpu_spec has taken on its final value. This is illustrated on pseries by comparing the CPU name as reported at boot ("POWER8E (raw)") to the contents of /proc/cpuinfo ("POWER8 (architected)"): $ dmesg | grep Hardware Hardware name: IBM,8408-E8E POWER8E (raw) 0x4b0201 0xf000004 \ of:IBM,FW860.50 (SV860_146) hv:phyp pSeries $ grep -m 1 ^cpu /proc/cpuinfo cpu : POWER8 (architected), altivec supported Some 44x models would appear to be affected as well; see identical_pvr_fixup(). This results in incorrect CPU information in stack dumps -- ppc_hw_desc is an input to dump_stack_set_arch_desc(). Delay gathering the CPU name until after all potential calls to identify_cpu(). Signed-off-by: Nathan Lynch Fixes: bd649d40e0f2 ("powerpc: Add PVR & CPU name to hardware description") --- Originally sent as part of a RFC series to update the hardware description at runtime for live migration: https://lore.kernel.org/linuxppc-dev/20240118-update-dump-stack-arch-str-v1-0-5c0f98d017b5@linux.ibm.com/ Sending this separately as a standalone fix before I take that effort up again. --- arch/powerpc/kernel/prom.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- base-commit: be2fc65d66e0406cc9d39d40becaecdf4ee765f3 change-id: 20240603-fix-cpu-hwdesc-1dc055b3f93f Best regards, diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 60819751e55e..0be07ed407c7 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -331,6 +331,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node, void *data) { const char *type = of_get_flat_dt_prop(node, "device_type", NULL); + const __be32 *cpu_version = NULL; const __be32 *prop; const __be32 *intserv; int i, nthreads; @@ -420,7 +421,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node, prop = of_get_flat_dt_prop(node, "cpu-version", NULL); if (prop && (be32_to_cpup(prop) & 0xff000000) == 0x0f000000) { identify_cpu(0, be32_to_cpup(prop)); - seq_buf_printf(&ppc_hw_desc, "0x%04x ", be32_to_cpup(prop)); + cpu_version = prop; } check_cpu_feature_properties(node); @@ -431,6 +432,12 @@ static int __init early_init_dt_scan_cpus(unsigned long node, } identical_pvr_fixup(node); + + // We can now add the CPU name & PVR to the hardware description + seq_buf_printf(&ppc_hw_desc, "%s 0x%04lx ", cur_cpu_spec->cpu_name, mfspr(SPRN_PVR)); + if (cpu_version) + seq_buf_printf(&ppc_hw_desc, "0x%04x ", be32_to_cpup(cpu_version)); + init_mmu_slb_size(node); #ifdef CONFIG_PPC64 @@ -881,9 +888,6 @@ void __init early_init_devtree(void *params) dt_cpu_ftrs_scan(); - // We can now add the CPU name & PVR to the hardware description - seq_buf_printf(&ppc_hw_desc, "%s 0x%04lx ", cur_cpu_spec->cpu_name, mfspr(SPRN_PVR)); - /* Retrieve CPU related informations from the flat tree * (altivec support, boot CPU ID, ...) */