Received: by 2002:ab3:689a:0:b0:1da:d01c:d2b2 with SMTP id t26csp5467ltj; Fri, 19 Aug 2022 15:58:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Zs37JioKIOaSuKztcMtLr72DwZZPuW7lp9qSSWaO++nkhWqXOnLAyz76RJ5r2h06QG+vq X-Received: by 2002:a63:4b49:0:b0:427:e7f2:c04 with SMTP id k9-20020a634b49000000b00427e7f20c04mr7950443pgl.262.1660949886620; Fri, 19 Aug 2022 15:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660949886; cv=none; d=google.com; s=arc-20160816; b=qWbIoq9DAXPlC0p1cIqkGjEo4rdasjTqReW/wt7GSrFfTRmAmecEFRK9AfepaJT5kZ qSoh1Rib+eEi1sGTcFHlWk2YNy99XWhO0xEHHyDWmVSos8FLcOUsY6cfsuJEMpWjd3V5 Pxe3iTlaT62lt3npvkp91AL9EYqowKweeoAZv805BlpE7zME7FX9bMiDy8o0aPMnk9xP e4mizZQEhoc9clEROZcOhwv2+rDX9Mo1K2zZQOsQtRe9BWqPlOqVQLAXhPoSrIZhWm1e g2bgJVIuM7xerg4Yim8RkvwV7i/wBefGOXng7DBOBEWcPsdX7/PmBkCv42dqq7+OGuYo enHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1VuXLGTUJo4h9B65ED0Zl7RSHJx0Ni/+e/45p7OnY9Q=; b=ujqCufjINZISG5SSnUVd1lww2BJrCWS6er8VMrZuHHr4sA6xN1+H+5+mTjUE9Pw4Vx 4dfUbYLAMS5GjULM2/GcFYcBkoubJbmN5brFZvOBcbtvSqlVBWxL+6xp105uG20OfRKW EqkcQgskCoutMk5yHvMwR/ISJRTlm+Wk9pushrIEaCzJuQZ3yvbo9QXR7d/RUL1IOesP 56+I26yjorOxrVc7qJuSNApHL0I/5QnDE/OPvU5rEqV4wQ4ohEooq5NBLyc5heJ7G3uu 5U/1Ymoz3//Pb7HMmxFs5iCStkZkLakNUgdiSUe9O/fqQv4PnthhiIU7/9LhaK1mNOzf 1t+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vE2QLHiQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w190-20020a6382c7000000b004218caaa6aesi5035217pgd.345.2022.08.19.15.57.55; Fri, 19 Aug 2022 15:58:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vE2QLHiQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242643AbiHSWjA (ORCPT + 99 others); Fri, 19 Aug 2022 18:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233378AbiHSWi6 (ORCPT ); Fri, 19 Aug 2022 18:38:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E5BA5B06B for ; Fri, 19 Aug 2022 15:38:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C5448CE266F for ; Fri, 19 Aug 2022 22:38:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A32AEC433D7; Fri, 19 Aug 2022 22:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660948732; bh=8vfZJjYZxjxPbLQfL+NBtrngpHfWy/iPrGe/EGv0rns=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vE2QLHiQT4kpjISpg4qib1zdhqag6aqzkgwkAFjrEC03gSZM/HsX0wFScku3eRPem nV5m3EI8OvjlRJCZgW9nHPJA6rgXxnycpe2/Drly368tUrDggVbTqkhwxR8S4ILSI4 MShMz0GQOI2oCXNcvlEBJrj6SMZ+D5vfNgy3vuMAgfTA5YWdOsCvU6xHyTW2opGGtF yX6N7xptoJx+KJZkCFN8JOQhCdAUjkqM8aTQZMkABwREU4909Vo7RyjYnKh0BwgId7 9/jRNBZNNjn7QaUPGTV40Ww2EF5v9Ki64RYLEe2b1H/fPkyqfKQn2cszbtpVMJLPIA nemmay0WVmbtg== Received: by pali.im (Postfix) id 9C4072980; Sat, 20 Aug 2022 00:38:48 +0200 (CEST) Date: Sat, 20 Aug 2022 00:38:48 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Randy Dunlap Cc: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Nick Child , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc: Add support for early debugging via Serial 16550 console Message-ID: <20220819223848.lvxakjjzfdjvyqgu@pali> References: <20220819211254.22192-1-pali@kernel.org> <35c0ff6a-387d-3c01-66b3-f659cfe67c2a@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <35c0ff6a-387d-3c01-66b3-f659cfe67c2a@infradead.org> User-Agent: NeoMutt/20180716 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Friday 19 August 2022 15:34:14 Randy Dunlap wrote: > Hi-- > > On 8/19/22 14:12, Pali Rohár wrote: > > Currently powerpc early debugging contains lot of platform specific > > options, but does not support standard UART / serial 16550 console. > > > > Later legacy_serial.c code supports registering UART as early debug console > > from device tree but it is not early during booting, but rather later after > > machine description code finishes. > > > > So for real early debugging via UART is current code unsuitable. > > > > Add support for new early debugging option CONFIG_PPC_EARLY_DEBUG_16550 > > which enable Serial 16550 console on address defined by new option > > CONFIG_PPC_EARLY_DEBUG_16550_PHYSADDR and by stride by option > > CONFIG_PPC_EARLY_DEBUG_16550_STRIDE. > > > > With this change it is possible to debug powerpc machine descriptor code. > > For example this early debugging code can print on serial console also > > "No suitable machine description found" error which is done before > > legacy_serial.c code. > > > > Signed-off-by: Pali Rohár > > --- > > Tested on P2020 board. It allowed me do debug and implement this patch series: > > https://lore.kernel.org/linuxppc-dev/20220819191557.28116-1-pali@kernel.org/ > > --- > > arch/powerpc/Kconfig.debug | 14 ++++++++++++++ > > arch/powerpc/include/asm/udbg.h | 1 + > > arch/powerpc/kernel/udbg.c | 2 ++ > > arch/powerpc/kernel/udbg_16550.c | 33 ++++++++++++++++++++++++++++++++ > > 4 files changed, 50 insertions(+) > > > > diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug > > index 9f363c143d86..a4e7d90a45d2 100644 > > --- a/arch/powerpc/Kconfig.debug > > +++ b/arch/powerpc/Kconfig.debug > > @@ -276,6 +276,11 @@ config PPC_EARLY_DEBUG_OPAL_HVSI > > Select this to enable early debugging for the PowerNV platform > > using an "hvsi" console > > > > +config PPC_EARLY_DEBUG_16550 > > + bool "Serial 16550" > > + help > > + Select this to enable early debugging via Serial 16550 console > > + > > config PPC_EARLY_DEBUG_MEMCONS > > bool "In memory console" > > help > > @@ -355,6 +360,15 @@ config PPC_EARLY_DEBUG_CPM_ADDR > > platform probing is done, all platforms selected must > > share the same address. > > > > +config PPC_EARLY_DEBUG_16550_PHYSADDR > > + hex "Early debug Serial 16550 physical address" > > + depends on PPC_EARLY_DEBUG_16550 > > Is there any chance that you could provide a default value here > so that 'make olddefconfig' does not end up like it does > without having a default value? No. Because there is not any default value. Physical address of 16550 is hardly HW dependent. Possibly also bootloader dependent (if it can remap peripherals to different physical addresses). User _has to_ specify correct physical address if want to use early debug 16550 console. > CONFIG_PPC_EARLY_DEBUG_16550=y > # CONFIG_PPC_EARLY_DEBUG_MEMCONS is not set > CONFIG_PPC_EARLY_DEBUG_16550_PHYSADDR= > CONFIG_PPC_EARLY_DEBUG_16550_STRIDE=1 > > which then causes a kconfig prompt when starting > the build... Cannot we set somehow that PPC_EARLY_DEBUG_16550 would be disabled by default when upgrading defconfig? > > + > > +config PPC_EARLY_DEBUG_16550_STRIDE > > + int "Early debug Serial 16550 stride" > > + depends on PPC_EARLY_DEBUG_16550 > > + default 1 > > + > > config FAIL_IOMMU > > bool "Fault-injection capability for IOMMU" > > depends on FAULT_INJECTION > > Thanks. > -- > ~Randy