Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1142035lqh; Sun, 5 May 2024 19:23:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwGNFOrnp8D9rxU8b3prsZmbpLmtNaOLREZfb9Rq09TSTEv10ZssWGRFTcvbeCDyHaSoLSApEeILPElNeM345AMrzeltJbIIYZhTQUrg== X-Google-Smtp-Source: AGHT+IHT+FTWqzuWjsYOz8iJduTGVr4qbN3Cm387keWntBU6wRS9ayyCpsHGjngN8L+eFMBuWmfG X-Received: by 2002:a17:902:c084:b0:1e0:11a4:30e0 with SMTP id j4-20020a170902c08400b001e011a430e0mr8394932pld.19.1714962220771; Sun, 05 May 2024 19:23:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714962220; cv=pass; d=google.com; s=arc-20160816; b=FRFzforkWj02IaV1uETQsvv554YGeNX7DK3zUHkaQLVR8kgPFnyB3G5QHzzhTDTunU /dK2GDUGKwqQ0s0RgQ27DQ41XugSlNhkpzkuEJXQ0LmN0362HAKru5ZGX5zubgBnx+dW A2ejCz8Y+N6XnrMBlpkI3irhdKXDzJn6NdvhydHkAvncjPsG3/yo/sgOo1pwXI8jAlAC UJRdgU9Ej2TXtNvI/7jikCQj0SLNalumYto+QfsBK+O6ZZwIJfpIOVwY1/7w9PQR0pfr w7nT3TIYAovhsei/E/6a3LgdhP9vew6qIMKOyKjrSLr8gXrTiT1+3OoZGUuY67vr/6BP osXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=LQ3scwYLoPMei8ryb8phE+FJFjgEcy7bl0P/q0SziYw=; fh=kW5fBm5d+xksCFad1TAAYS7gBvoz8HZAN7XvzlaEMvI=; b=v6oP+4STPheOdWcc3oBGW50TqbpSmS0ItD3aaek+2serAmoQOk8NWNxxdi7Ff5qpYJ mpBdvhsFEO5iqBe/pWKVP5LzBJlhkbWGYdFy1kyjhmoaxUdddlnyDoSMQniZk5LdRVlx q94pSRgBjlZtNEJMdIeY4g2g3gr9oVr8LmNRn+Sj6M0PAfA6kONrBSgnLoh9UDgJWd8o UgcaqYy6CcLBbi9HcIsoJsn//NmMnwF2mkxtbjhergThbmfqCtSLAfri55sewM4ftpX7 MW9kSdaupV/pj3Pkczcbx0Rgf2rv6g0eWWDh8srd0gJQn29AIx1Q3gcViUFMe4s+pL+N joUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=OCzXqYV0; arc=pass (i=1 spf=pass spfdomain=163.com dkim=pass dkdomain=163.com dmarc=pass fromdomain=163.com); spf=pass (google.com: domain of linux-kernel+bounces-169254-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169254-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b14-20020a170902650e00b001eb70eb2853si7382320plk.96.2024.05.05.19.23.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 19:23:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169254-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=OCzXqYV0; arc=pass (i=1 spf=pass spfdomain=163.com dkim=pass dkdomain=163.com dmarc=pass fromdomain=163.com); spf=pass (google.com: domain of linux-kernel+bounces-169254-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169254-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.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 2E532281ECF for ; Mon, 6 May 2024 02:23:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC6CA405D8; Mon, 6 May 2024 02:23:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="OCzXqYV0" Received: from m15.mail.163.com (m15.mail.163.com [45.254.50.220]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB3523F9EC for ; Mon, 6 May 2024 02:23:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.50.220 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714962215; cv=none; b=O2M7bKwsAtMAvrXzJwSHecDGme+U+F9ABTCGmTQq7VKf6oONAeOmipdd11uZzYMEG4Qxio67iW9Yf9N3MbHbHLSUTvv9ePDWTG+tnhMZgvJwDpC/Qj30uuPvKACjvMpX8ccc4FcZqHy185e42HAKXZvKkBfGeBamBMBFMStfue0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714962215; c=relaxed/simple; bh=kJ1EjMpssDBDjTJkBklj+X7w3qeQ1Fz7LV7FBdijZDI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=rk4vfzw7GTbovsUDmbld9+WITcjtc5hak76s/1oFFpvzJvMh/akUxXv3VE6GxVNQjr+A5wLoBj4kmfYAI7Af9r7IGAAfgIWZilEWRTuaVySPzTbD6s1LKQchj5J159GX5mIJ555R+MJ5lG+cTUzkCkpgd0z4BafcpaY4qiMHiDc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=OCzXqYV0; arc=none smtp.client-ip=45.254.50.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=LQ3sc wYLoPMei8ryb8phE+FJFjgEcy7bl0P/q0SziYw=; b=OCzXqYV0c5cwhTSnRg4eQ /PKEM4OKdSLpoUz8+Wl/WBNx5WhqN9Fa20CIXPVv2L7AU2cu1fRyAaTcOSc9Pn3m 9GjCw9xthoDG/O3L/Eion9Duw6YNyRngdgAYp/xAAcGSa4YZGcBt46bt3FLdbXQo tt/FWM+kG925ZIm/f7nsj0= Received: from yangzhang2020.localdomain (unknown [60.27.227.220]) by gzga-smtp-mta-g0-0 (Coremail) with SMTP id _____wDnl6fyPjhmWCzYDQ--.44974S2; Mon, 06 May 2024 10:22:42 +0800 (CST) From: "yang.zhang" To: alexghiti@rivosinc.com Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, "yang.zhang" Subject: [PATCH V2] riscv: set trap vector earlier Date: Mon, 6 May 2024 10:22:39 +0800 Message-Id: <20240506022239.6817-1-gaoshanliukou@163.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wDnl6fyPjhmWCzYDQ--.44974S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Gry8XrW8ur48JF4UGr47CFg_yoWDJrc_GF Z7JrWUWry8Ca1SqF9Fq3yfWw1jvw1Y9FWF934SvrWUuw4vgFWjq3WYg345trZ5GFyIgw4k J3saqFZrtr12qjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnXAw7UUUUU== X-CM-SenderInfo: pjdr2x5dqox3xnrxqiywtou0bp/1tbiJxnW8mXAlp9hTwAAsY From: "yang.zhang" If trap earlier, trap vector doesn't yet set properly, current value maybe set by previous firmwire, typically it's the _start of kernel, it's confused and difficult to debuge, so set it earlier. --- v1 -> v2: As Alex commented, remove the patch for supporting hugesize kernek image Add the omissive logic of set trap vector earlier Signed-off-by: yang.zhang --- arch/riscv/kernel/head.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S index 4236a69c35cb..03dc440e643e 100644 --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -300,6 +300,9 @@ SYM_CODE_START(_start_kernel) #else mv a0, a1 #endif /* CONFIG_BUILTIN_DTB */ + /* Set trap vector to spin forever to help debug */ + la a3, .Lsecondary_park + csrw CSR_TVEC, a3 call setup_vm #ifdef CONFIG_MMU la a0, early_pg_dir -- 2.25.1