From nobody Sun Feb 8 16:53:12 2026 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 368E427811E for ; Tue, 4 Mar 2025 23:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741130406; cv=none; b=O/+bnkrXuaL1qILooyalpE/VjECqHsSNUftnvuiwYqn0M2VBEIUpjrq503ClTXC5/+X3I6qKB4b2ekWEeaVXy0APZHaM7qEWv6rQlhFaZqBj0KQA+0xv4k7SUtZOGQQMHZVWpaMFmhZo+bqHzsgDTy/PddgmUFN5We7W/PDAiEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741130406; c=relaxed/simple; bh=zj/1hg648gPj2/H3MIvqSLwL5kgx31RsIUiX/gZMNZI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aTu2ouO3J4jPnm/ACquqTJ+U5EbFHZg0Lgke0VoUwfrmplgtsQw5jNBjk8MFcOq+vgZZYkPyUjbWlitHE1vf+Pvgj3qciaaP27s1ugR/qekSa8GrMzGf57oNipDEPKHVsu4GobPTHa4Fk6U7HWkCYa7MOlmMI5afViNZczad0ZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Z6rjw6nlzz9stH; Wed, 5 Mar 2025 00:00:04 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BLfibhs76Dlw; Wed, 5 Mar 2025 00:00:04 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Z6rjv31DTz9stG; Wed, 5 Mar 2025 00:00:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 537F88B776; Wed, 5 Mar 2025 00:00:03 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id A0eNGyMj1i94; Wed, 5 Mar 2025 00:00:03 +0100 (CET) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.202.221]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 70FCA8B763; Wed, 5 Mar 2025 00:00:02 +0100 (CET) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Naveen N Rao , Madhavan Srinivasan Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc: Fix address calculation in clear_utlb_entry() Date: Tue, 4 Mar 2025 23:59:56 +0100 Message-ID: X-Mailer: git-send-email 2.47.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1741129197; l=1214; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=zj/1hg648gPj2/H3MIvqSLwL5kgx31RsIUiX/gZMNZI=; b=9R4+xIsE5RbZ7e//sO6xPodl1H9aLYMmhkehdnx/c98wFnoNGl6DsVCXQ31j+Ofnli45EUKzC Jxv4xV0nXrrBre25Jwmd4k9ocgYsDz2urrKguoXJLjyh7ucKQmAodPU X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In relocatable.S, function clear_utlb_entry() goes into real mode. To do so, it has to calculate the physical address based on the virtual address. To get the virtual address it used 'bl' which is problematic (see commit XXX). In addition, the calculation is done on a bad address, which may lead to unexpected behaviour. Fix it by re-writing the code so that is goes via another path which is based 'bcl 20,31,.+4' which is the right instruction to use for that. Signed-off-by: Christophe Leroy --- arch/powerpc/kexec/relocate_32.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kexec/relocate_32.S b/arch/powerpc/kexec/relocate= _32.S index 104c9911f406..dd86e338307d 100644 --- a/arch/powerpc/kexec/relocate_32.S +++ b/arch/powerpc/kexec/relocate_32.S @@ -348,16 +348,13 @@ write_utlb: rlwinm r10, r24, 0, 22, 27 =20 cmpwi r10, PPC47x_TLB0_4K - bne 0f li r10, 0x1000 /* r10 =3D 4k */ - ANNOTATE_INTRA_FUNCTION_CALL - bl 1f + beq 0f =20 -0: /* Defaults to 256M */ lis r10, 0x1000 =20 - bcl 20,31,$+4 +0: bcl 20,31,$+4 1: mflr r4 addi r4, r4, (2f-1b) /* virtual address of 2f */ =20 --=20 2.47.0