Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3318064lqo; Tue, 21 May 2024 13:13:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1Yyt24Qy2POG5wtn4VpKlC42z+6XFJF/it8/i6Qdkg8/OUa7oWlzurShQsJy9aO3aY10zzjgEw0YPF0wxWW2s+EmeaZ3TV2/eVYGotg== X-Google-Smtp-Source: AGHT+IFv6lz8A0gM3g38Eon3MI3tnKgdveb9mtsIaNVmnZATo48w90X3kQbjpicrGE2Px9h81Mut X-Received: by 2002:a05:6a20:6f88:b0:1ad:85c1:2d21 with SMTP id adf61e73a8af0-1b1f874fd8emr93667637.8.1716322392666; Tue, 21 May 2024 13:13:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716322392; cv=pass; d=google.com; s=arc-20160816; b=xsKqSApKo+IU9xo30M/uqVM+OXN3OvkV2I/fE1P8hZCRwso2LtYrQVRm3XfQCr9Ntk w5zv61QW8xbT3fhP/qn+K0nUvuljF+HDwBrQdnV2YF2zyuwLrV786hO9/ro1DcnqJyGk m/enabSPfqkSiXpkZWzni6QoL63y2KT6yy42fD4q8s15mhtIYrS3e1mxK2KZ05npilA5 f160C5NgSm0FeJOU1/jJ0puXWag0/LTUnyLEUyXMGe8xhPD56xBunI4d9qkO1cyCdXlq yI9RzvTFuu9cGKuOa7v4IaMDO/X5Cx6X9Mcfmzio3r0JpV+nQkwFgfoLubs+1dDY2+n+ snHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:feedback-id:dkim-signature:dkim-signature; bh=iItfwyatQhlxt0H+NrF1YH5otFKvGeFUgxF05vMBPgw=; fh=dDGKIMcG3H+q3nWvOlO7AA2IrGQ/jjD28aNw+O4OeK0=; b=admzTzosK/mG8QNwkqqdz6iW2gulJia6fJk+Mg7leH0sMzGRwvEm1y5REUtxc5TIBx X5oIHnGZJm93utehc3co9YnOw1NMSJH5W3r8ULRFZ8ryPPtUlRpX9E4ppY7FefKiL++i bsYOqMYTT6DliKYw8KmCPz1a2yDvaKbXHUpeVrJDBt60oAFk6RsMhk/FHTo35dgAKMsF h6p9GZeUQcJXIKT+bjp7YZJre9tqJx0W6KGhVUWFr+d6YRToASJ8BZeaOooIWZ3Bxamf LVDJzRVkKCRmUE+a78I4ImasNYjX3yz85y9Y2+zYjlA/PppLOX0Aqol0b+TZjYSTjuod H24g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b="n/cgO1Fo"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=KnoH1UtI; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-185409-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185409-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-65be1e29103si10039494a12.179.2024.05.21.13.13.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 13:13:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185409-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b="n/cgO1Fo"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=KnoH1UtI; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-185409-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185409-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 47F67282ED1 for ; Tue, 21 May 2024 20:13:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B695314A087; Tue, 21 May 2024 20:12:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="n/cgO1Fo"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="KnoH1UtI" Received: from wfhigh4-smtp.messagingengine.com (wfhigh4-smtp.messagingengine.com [64.147.123.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EE67149C7B; Tue, 21 May 2024 20:12:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.155 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716322347; cv=none; b=qSP1C39hb+OBRXSvl8FHzwjsBqxrPm1s0IBjB/B8cJb84hxYzY1GxJE32NIAS+JecqiXLMn9rzlVx0ZF3Zy/TwpFyrEFrBYiUxHNbqCXWnwd4JkeUeyEhan/Do4j+gO92J/ZyA1EzCeCw4kyqJZs2+NoZDbJQr6NeRMNn2m+BF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716322347; c=relaxed/simple; bh=VkPWDIMyMkF8CH/V1HlgyS/GkNbF6V6iQ/qLTwf17fE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c64naOhTuMF7zlZnO91umLR+xnfUs1d4qZnRr/x20lQvvT2EOdGRN0jMW73qsyWcRkd21z8wB+BE6mHMNKGVRsxZQ+rUVGNmTY5YlncqdFMmr7A3lih04gki1FkihGvvBVVawKNhI/N0X83Zl1u8u+eqNWbLgKVG4j13wLIZS4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=n/cgO1Fo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=KnoH1UtI; arc=none smtp.client-ip=64.147.123.155 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.west.internal (Postfix) with ESMTP id 318D51800107; Tue, 21 May 2024 16:12:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 21 May 2024 16:12:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1716322343; x=1716408743; bh=iItfwyatQhlxt0H+NrF1YH5otFKvGeFUgxF05vMBPgw=; b= n/cgO1FoEgCjEVWerYjHHXBkTTPNXSdA0Zf6E9EXznVZXXHyvmPXSSNcHPsw1R7G IGsP9havV4TOK1nowRkE61thRIj2Bo1E+k8e7LWfhOf74nUoBXRlUI4XUyC4fc0S AJbG5KhLdqJTRDr7CQ98V+8K0G3MLMG9W8zpD9iSXLWX8oP4kjcMCxnPFm4qaX+w STmCDOZGfdQar/P9W4P9h93uNIhYwLd3CcbQFqdfC0ilgbDJPch53jJ+lvzVLx7Q TxBWJVxtZRsF4iPI4KO77UfnWAIUAAmGUGnnu2HATqS6Afvrf+MDAVhHqa+eCK8u t1vTHR/YoRE0L6G5WcfwPA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1716322343; x= 1716408743; bh=iItfwyatQhlxt0H+NrF1YH5otFKvGeFUgxF05vMBPgw=; b=K noH1UtI358WiL7PVlZyeVwMMu6sxXjv+LNKdAq1a9uIJTbKbWEkoOut6LPmY7+V2 zivsVJeDEHz2zXIOb1Oph+yHHi9Zk6t8k26fAJtlIEB67y20Ab5uBgzBxcM0Mg9Y uKEhC13gVM9EgawXsImT/7yjk0+Ga7QJB3Zjg/FaWpSVA+Q2Vf4bGp/BvLx1EMGY 3yOvZlGcvBISXf90ycr39HeFMn7C/sdjsZ4cIz4pvyHSWHntARRDdgBGeRtOjY1c 3e1MbOJckV5ureC2VaTEvD95LT2qa6JVLYG8821zxJHvT2Drcf8ULNZjy7FEE/Te 5pJ8xguMRgAYDNUNj3YZg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeivddgudegfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhi rgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqe enucggtffrrghtthgvrhhnpeehgfeuffdugeeuieevfeellefhvefhtdduleehgfdvgeev hfeileevveffuddvgfenucffohhmrghinhephhgvrggurdhssgdphhgvrgguvghrrdhorh hgpdhrrghmrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 May 2024 16:12:22 -0400 (EDT) From: Jiaxun Yang Date: Tue, 21 May 2024 21:12:14 +0100 Subject: [PATCH 3/4] LoongArch: Fix entry point in image header Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240521-loongarch-booting-fixes-v1-3-659c201c0370@flygoat.com> References: <20240521-loongarch-booting-fixes-v1-0-659c201c0370@flygoat.com> In-Reply-To: <20240521-loongarch-booting-fixes-v1-0-659c201c0370@flygoat.com> To: Huacai Chen , Binbin Zhou Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Jiaxun Yang , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1212; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=VkPWDIMyMkF8CH/V1HlgyS/GkNbF6V6iQ/qLTwf17fE=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhjRfBoXi3zbfTuuZOzPsUHaVZ1khFJ6t6XkoX3aXXsX5n UrH5JZ3lLIwiHExyIopsoQIKPVtaLy44PqDrD8wc1iZQIYwcHEKwERWxzP8L1tvr897w3T2ZWO+ r0zHtvjerXSc/fTTxRddZfrHBOIqDjP8L9yyIW7rpFatLOaYq6eWXuLWyGk4vTvlnsb8w9ETDnv 5swEA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Currently kernel entry in head.S is in DMW address range, firmware is instructed to jump to this address after loading the image. However kernel should not make any assumption on firmware's DMW setting, thus the entry point should be a physical address falls into direct translation region. Fix by applying a calculation to the entry. Note that due to relocation restriction TO_PHYS can't be used, we can only do plus and minus here. Cc: stable@vger.kernel.org Signed-off-by: Jiaxun Yang --- arch/loongarch/kernel/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/loongarch/kernel/head.S b/arch/loongarch/kernel/head.S index c4f7de2e2805..1a83564023e1 100644 --- a/arch/loongarch/kernel/head.S +++ b/arch/loongarch/kernel/head.S @@ -22,7 +22,7 @@ _head: .word MZ_MAGIC /* "MZ", MS-DOS header */ .org 0x8 - .dword kernel_entry /* Kernel entry point */ + .dword PHYS_LINK_KADDR + (kernel_entry - _head) /* Kernel entry point */ .dword _kernel_asize /* Kernel image effective size */ .quad PHYS_LINK_KADDR /* Kernel image load offset from start of RAM */ .org 0x38 /* 0x20 ~ 0x37 reserved */ -- 2.43.0