Received: by 2002:ab2:f03:0:b0:1ef:ffd0:ce49 with SMTP id i3csp41340lqf; Tue, 26 Mar 2024 13:41:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgT4MtXbT2QbAIUH+PzflnOjIMKtdxdlqLSIDaPl+BUKTgPbEB6SSdNlRqsQ8ccziPd8W8CYHmtPXFnjzcZtiCafDTMtR/Ow17Lvtt3Q== X-Google-Smtp-Source: AGHT+IGqIUTkRvyrRyFQnlJpW7fUhyEzkoHRzppxYSaeynA23vUw5zJ933M7IU5pJ7NnB4XFWzuW X-Received: by 2002:a17:907:868d:b0:a47:5351:e8a8 with SMTP id qa13-20020a170907868d00b00a475351e8a8mr3646010ejc.33.1711485713959; Tue, 26 Mar 2024 13:41:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711485713; cv=pass; d=google.com; s=arc-20160816; b=RCcF14zGjXQDQ4YiYzgDAp/S4lbMZVL9+YUl5BxwT/1ejPoFgrk0CDZELauGK3XH2f Yj1kyFHlGf3Mx3wDhx7adShSN0eeGIh4NGldUziY/AWHDN4jvDF6RcWm/TfxN3xRWHib y6mUFLsDwJDYhcxYNPQ2is/B5ptM5XqRPK3+QSlc/dUT4FjQVnTzGInhUip+EmZHW8cY hyHis9C0OYhJOei9fTxF2BejUdGQFGNzqBPuUVXNhaiXv4DQYf74+oJpgl0bPrEY7CXb 3vHylAJ9ucOECYxsmtPrrKaBP+eGnF5SYtWEnpZBmDfwYeFIluZtSZmAra5Gwkbxz9NG UKIg== 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=nkW4taJQaUsRU866lha58WkbM4sO1ApMx1WOQCLwoj4=; fh=Dii/wXcZb/mJUCmsdlZbBl/o0XRcaQ9S/xOY9NGTLc4=; b=P1drov1QH7747yswUjhoXbz3kUZrK81Q0iwlxPDi4RN/juQkf5H7moa/5gge8Wypw2 2tcxOxhb0qNhwufL0y98c71K4OM4g5A0qXvZpzRFbvjU3rFKKTbjYxrTf34Qe85Fwcsj dPcu3jvLaFWwcmbmZFIzdDf/4KulaLcBOPypHFgXsjQ9xxq2f6TSOy85xyRS9vRCtgNj AI1vIYqtFfjX9EXXzLgwTiUR0fAIzG9+AETcFN8w4u4p4vnkKdNx2P+PvcdJwK5iDWgS QAapwfb6KhSGitD41K9fGZe+BleCE51MzX7Y/ixJKUXyoDewFsatrNvc1NjE1J2RfeKU oOdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm3 header.b="udukm/h1"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jH5GW2jg; 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-119934-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119934-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p22-20020a170906785600b00a46af0e677fsi3834873ejm.509.2024.03.26.13.41.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 13:41:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119934-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm3 header.b="udukm/h1"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jH5GW2jg; 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-119934-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119934-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A10531F85DEF for ; Tue, 26 Mar 2024 20:39:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C074E13E02D; Tue, 26 Mar 2024 20:35:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="udukm/h1"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="jH5GW2jg" Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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 D069213DDB3; Tue, 26 Mar 2024 20:35:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711485341; cv=none; b=ZfYGI6f5uGY03/qmKYs5a7qvA7QnYW7p5KRUsrW/1rAy4abl84n3oQsWXs9dkZujAjTREK5Rx+OeH1Rc3gLbSwTJjWGXmsWImqEbbqjl8E/pSDWI3Xmim5AvqLmZDpS31QWGGMrV9ypOsQguX2djtb5PHajUMbfzZuB1sQPw8XY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711485341; c=relaxed/simple; bh=hz1+11ATs0FhDts7x1BiLRiY/yQQgRHlTVt2M8apkkE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jq2lUbB9otEQBMN/L2690u4G2OL54pl2cQHnQTp05JCk+U6pobCV515mthzdlGOKe+MP6UrHDXTJc0cuHXOg1KuWfSqk9f7BYp5h9qIgD6hoQHaACZmoQCMoWb5TdELYvQ5JvExbj1gtC2g7tgWBM5stS4mzetCFl4J3BCTxQHE= 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=udukm/h1; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=jH5GW2jg; arc=none smtp.client-ip=66.111.4.25 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 compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D5A485C004D; Tue, 26 Mar 2024 16:35:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 26 Mar 2024 16:35:38 -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=fm3; t=1711485338; x=1711571738; bh=nkW4taJQaUsRU866lha58WkbM4sO1ApMx1WOQCLwoj4=; b= udukm/h1EBa78dAF1N0IXIcqtlkH/Tg/MPM0MY2FM2KZ38uhRebtHiaNYVdQqcAn DBy61vJL9xkAz00vHu57SdweSZuCWff4Fy4pvX988jUftdaKDQyRjesF+yXqmpdc 2DEZQ2s4erohuYtVhX5mrljspyVPCCC5S3JRy4fVpovRnqeSLRibf6rIE1Bi2x8o zeyE//wd12JKZGakRmaHbeyuf9I9HyldoWU7712e/1fWmyoIgvcev2a0aFn92QCL TuVP5v3N97lGwHut4ooUMmRbyCM0C9vzNqaAjHZwb6rrob3NkwRiIC5eE8BxBq+d KFyRLY0eAwY6Ck9XTiJljA== 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=fm2; t=1711485338; x= 1711571738; bh=nkW4taJQaUsRU866lha58WkbM4sO1ApMx1WOQCLwoj4=; b=j H5GW2jgzWBdjERxk+ziHwGTmzaovggqeiLBFKSpBi/trvWRu1/xqsIrPSmpEmd1B N/d0CRcNgvib/1771W6AQFkoPj3f6uRGa5/4Y34sKNMuqEmezwePNrfFchoImOzx RSTApQ5kFSXGOa6IUFsDNO/dOc5fazdstfLkHWo4DZgiWPSFEGNEI3AiL7nb8uHM 4fRQt8+eMBI/q7BM12j1dwCn+NFuwc+fbTCBDgMbWPi0JjKVCRqqzCWYbIZq+6Gv GJkAClF0VXHjcGlXK/0vybeHcTXzvBhb+2ZfHCinhFj+If0fq+0dX1oLYuysgRI/ vIFrQIi1LEN1h2nOxBioA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddufedgudeflecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhi rgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqe enucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleffkeegudeghfdtuddugefh ueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 26 Mar 2024 16:35:37 -0400 (EDT) From: Jiaxun Yang Date: Tue, 26 Mar 2024 20:35:35 +0000 Subject: [PATCH v2 3/9] MIPS: debug: Hook up DEBUG_LL with early printk 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: <20240326-mips_debug_ll-v2-3-b64abc76f2a1@flygoat.com> References: <20240326-mips_debug_ll-v2-0-b64abc76f2a1@flygoat.com> In-Reply-To: <20240326-mips_debug_ll-v2-0-b64abc76f2a1@flygoat.com> To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jiaxun Yang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1752; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=hz1+11ATs0FhDts7x1BiLRiY/yQQgRHlTVt2M8apkkE=; b=owGbwMvMwCHmXMhTe71c8zDjabUkhjRmw5linGyP51fNOPRFaN161WtVbrbfT55f5appEp8Rs 9rsaH5vRykLgxgHg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAExEXZmRYZuuhK/zser6+Tc+ 35oeJdqn+UV1pc/8oo2/5S4fb8j8wMHIsCtoWbi4wpf6hndMkSEm/xiVZi3YbPPJrlEpfGLp11f xbAA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Output earlyprintk to low-level debug functions when it's available. DEBUG_LL takes priority over platform earlyprintk because people must know what are they doing when they are trying to enable DEBUG_LL. Signed-off-by: Jiaxun Yang --- arch/mips/Kconfig.debug | 2 +- arch/mips/kernel/early_printk.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug index 892e31804982..6ef42edc7d67 100644 --- a/arch/mips/Kconfig.debug +++ b/arch/mips/Kconfig.debug @@ -2,7 +2,7 @@ config EARLY_PRINTK bool "Early printk" if EXPERT - depends on SYS_HAS_EARLY_PRINTK + depends on SYS_HAS_EARLY_PRINTK || DEBUG_LL default y help This option enables special console drivers which allow the kernel diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c index 4a1647ddfbd9..c3f3b0a930f0 100644 --- a/arch/mips/kernel/early_printk.c +++ b/arch/mips/kernel/early_printk.c @@ -14,6 +14,24 @@ #include +#ifdef CONFIG_DEBUG_LL +extern void printascii(const char *); + +static void early_console_write(struct console *con, const char *s, unsigned n) +{ + char buf[128]; + + while (n) { + unsigned int l = min(n, sizeof(buf)-1); + + memcpy(buf, s, l); + buf[l] = 0; + s += l; + n -= l; + printascii(buf); + } +} +#else static void early_console_write(struct console *con, const char *s, unsigned n) { while (n-- && *s) { @@ -23,6 +41,7 @@ static void early_console_write(struct console *con, const char *s, unsigned n) s++; } } +#endif static struct console early_console_prom = { .name = "early", -- 2.34.1