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: 159367 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1695294vqb; Sun, 29 Oct 2023 06:47:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPTmOZGltAyM8on9FB8Mh9OWLA+RF8ch1lSKkPIFW/MvBgBpkpCA6ltWSY/4bVguoVhhT2 X-Received: by 2002:a05:6871:a817:b0:1e9:b2e2:8754 with SMTP id wl23-20020a056871a81700b001e9b2e28754mr7077698oab.2.1698587227970; Sun, 29 Oct 2023 06:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698587227; cv=none; d=google.com; s=arc-20160816; b=QfgUhksVosJiqnPatLxyBtp8RYN9N8nsToVaMJYoEF1isgcTDhSRaXH3t3mTHvh7LG Nrh35dBLykyiUyamulF9YSsY14SIKBrgVVeQ2JTML+Nxc6cCvToemGDrSjtGnHPCKipp BxTyPRV/kTrRzBnY3IRDGOMdFg7tudvpzxO4zFdbRRcdYmVkuLRkG6v5M00m84oqjBGu 7kttlrTkwALUPk0wGqg9lY2zRE52LjMtppw46VhyhM3IeTybpyq4zvPKXfi4r8NBZipk UYPduIMILPujNDPxMSGv3F/2JUo2ijQbVQROa4m6C6ZH76RUTSaENtZh+rU3DZAxdICx iZMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :feedback-id:dkim-signature:dkim-signature; bh=nkW4taJQaUsRU866lha58WkbM4sO1ApMx1WOQCLwoj4=; fh=Dii/wXcZb/mJUCmsdlZbBl/o0XRcaQ9S/xOY9NGTLc4=; b=BXRHVwDi+VZquQFioBe7b/zHVwOMlzYDj3BfW+E3Wy+cWgsw+FN2D1OEIsWrggcDPM 6tipE8l5uYWQRFLNPBlwW7eG3THlrTZxN5j3pDXOLI8Q6WQGRvukvk1cKwFVKZ5xPORv Y64QuMMVwp0Y5Ksc68JGZk8RbJCnhCo1T8qnYnNp9jFupO5PIFDs8jtDiKi5G2bhYqUa mq4YllNoO3c197IvJkio25dFcKX3ogxbNBovgBsEwK//g1yBH+jX6ehrOZEKRc/GPWSN DQx9lkgirvcGcV0tQqJ0Dckg/+o9GSKKXc55urCjTsAPPK3INBfFkaANc5ufPYxvj5eR PTFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=W70be8GJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=P2vGki3X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x4-20020a63db44000000b005b74ce91e9fsi3548477pgi.672.2023.10.29.06.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 06:47:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=W70be8GJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=P2vGki3X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4F4BA8092ED6; Sun, 29 Oct 2023 06:46:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230256AbjJ2NqC (ORCPT + 30 others); Sun, 29 Oct 2023 09:46:02 -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 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 29 Oct 2023 06:46:13 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781097801207779170 X-GMAIL-MSGID: 1781097801207779170 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",