From patchwork Sun Oct 29 02:53:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13439787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E9C9C4167B for ; Sun, 29 Oct 2023 13:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230133AbjJ2NqB (ORCPT ); Sun, 29 Oct 2023 09:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230132AbjJ2Np5 (ORCPT ); Sun, 29 Oct 2023 09:45:57 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A1B4C0; Sun, 29 Oct 2023 06:45:55 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 73D683200914; Sun, 29 Oct 2023 09:45:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 29 Oct 2023 09:45:54 -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:sender:subject:subject:to:to; s=fm1; t= 1698587153; x=1698673553; bh=nkW4taJQaUsRU866lha58WkbM4sO1ApMx1W OQCLwoj4=; b=W70be8GJ+XiQ5Rpdfmn+3ZRG050zZEgnxWKfzqBC1btiaMirs9e kJW2XMWoBb39R3GrNlSYQ7ISgI3E31TSDxw+iCKyz9xv5k/B/a2BEj2YadjufXkZ O7i1PGWJciX3esg16b6/HSlbsKnM33KCQi5pPPehsb9tIJzn04JkT8bRXpoIQd6/ DsdU8z9ykJGlapb5M/kBfn3a1ldaB/YTqqG6VqeSqEYoasWgTxMDbbniV1qtMsjS YJRwr4TBckcxObIjjedu8P/2SuIVYA5Vd2D36PHL8I2sbFp5rwj+G18nQp2s6Z4p zy5chTnCbxR95nU/0B9Q6UdQ8eKHdpr+owg== 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:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1698587153; x=1698673553; bh=nkW4taJQaUsRU866lha58WkbM4sO1ApMx1W OQCLwoj4=; b=P2vGki3XTDzjvSr99YGyGE5GWN30BSSddhl4Yly4fXwnwPT+WD4 EfNGzkjmFEI4iqQQXSnr03SLLJi31E7HDsi2AYQMh+eZT0g6UXzoFDyDw2dJgSUw rBpDaTeIxGNOdJo8uibuO5f8xgpAHpSWcrGZBr/oiBwfcTXpAyfFvfCo6MXHXwZi 7+egwMrfjmUVbR90//2/nrtN6OVsB8Ayl9kVKcTZUNhBC9p1rI84d29YzJ74DZ36 vmETjAUlCQhrfUNVohu02hJHEIbLvaOJvTgo737KpVSKbSlQE0o5Sewgyul64Hih d/AfHlNJoPfEMYRmLw7HYvtepj1IC0mEpWg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrleekgdehgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhirgig uhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqeenuc ggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleffkeegudeghfdtuddugefhueev geffgedukeejleenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfh hrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Oct 2023 09:45:53 -0400 (EDT) From: Jiaxun Yang Date: Sun, 29 Oct 2023 02:53:04 +0000 Subject: [PATCH 3/8] MIPS: debug: Hook up DEBUG_LL with early printk MIME-Version: 1.0 Message-Id: <20231029-mips_debug_ll-v1-3-d7a491e8c278@flygoat.com> References: <20231029-mips_debug_ll-v1-0-d7a491e8c278@flygoat.com> In-Reply-To: <20231029-mips_debug_ll-v1-0-d7a491e8c278@flygoat.com> To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jiaxun Yang X-Mailer: b4 0.12.4 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org 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",