Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp32729rwb; Fri, 19 Aug 2022 16:14:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR7PAetsF25XRASontKO02EYawzRqIj4Gqrhybmm3B+sE5+h0MoIk10QWwU8jkJPfYHq9ACT X-Received: by 2002:a05:6402:493:b0:445:b5f0:7a0f with SMTP id k19-20020a056402049300b00445b5f07a0fmr7682828edv.120.1660950858138; Fri, 19 Aug 2022 16:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660950858; cv=none; d=google.com; s=arc-20160816; b=KGgqhpd7ayiWCLRcRERhu6XfhZwdheoe9VaQbW/MINfZJ/wk9FM8+VZgeerUOmkXee ds96X1LzY9Cgo+ywrXh5d6nVev/w9fWHd+h06EWko8/k/C33odwnYHjO9Cj0oqmR2XU8 xlpIjoXgSEPkheVHg/gKpDBaD0iLQNEkySJpEvAvBLqvko56Adqf8PvURpHd0lrjciTh OyrGrBoG1w9+SR7avo51+xCgOfLe90hAXh7iB6oZHIXaFBqLLnAswzWWxhn8KT64oBsw VxGSIlKMQI4EeIIBgQl6iZB7w8BqhlcMZ1GfrgS96vjZKQL8dnjqNSD6pHeQrDFpKfjX KEWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=goG5LB8namyKTJGHlQDVYOEn/LSWKITP9frCvQXf38Y=; b=sO/DiVtI/gJsvtde+4gNsYfWLYYVgv+KVnzbTZ6fca+7Rta1YhzeBfgHxfGyYcJ/Rb kd2PvDPla8Yx7KCbAvROlkmk5/QPDOpYJm0+WD/ckBsJjacadAcC1czJZn9658HptXxr h6ul06gJ+c/cI6Vqxau8u1bK7XOMiHzonp7SenEISXR8GNDBCwJ3WSmihB3XKuBeE3Nz orRNETuz7bVfX0fguMGiD3LKLz9mJonM2edYwSGuGaAOIgSFcCGzTFXnDkh7fUFAM/zQ aki3pwzICC/GGwayIWzMuB8W66YC+hQhybc2lvK1XLZrWyDpcYuP/g8g9HCTsI4g5Kik xM4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=G9ItjeqE; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020a1709067fce00b00738a50268d3si3440236ejs.417.2022.08.19.16.13.37; Fri, 19 Aug 2022 16:14:18 -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=@infradead.org header.s=bombadil.20210309 header.b=G9ItjeqE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241767AbiHSWnf (ORCPT + 99 others); Fri, 19 Aug 2022 18:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbiHSWna (ORCPT ); Fri, 19 Aug 2022 18:43:30 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B556532041 for ; Fri, 19 Aug 2022 15:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=goG5LB8namyKTJGHlQDVYOEn/LSWKITP9frCvQXf38Y=; b=G9ItjeqEmkfO7Sedn9n9RCO48B bBIiwJ1kx8hIXNKondte8LHOV/iDX6lfxwRmD24PyeNnDAdIh7VVUXwA0dECCDfxn6lpflz/wjC4o tJbCWaFX+jxoAP12qkpgpkHANjS9A5bnfaNnlxgz2SAiaFwAcGuIeSHvEtkDW7/Rl9bqemZP1KjA3 dvyImPZXGwyiB29OMWx+OctY+IdyMgk7HFSFyH5jC/jh6e245S9HGsQx+CB5pkk/AQ7+nprQ8yrs7 WODHyFNOPzZJ6TU39F+SUBaWGD3s/vnZLZ8EywFnqzfGb2BdZhBy3TVZUmwQq93LvhwFAyK1fG7ah KaHLSYqA==; Received: from [2601:1c0:6280:3f0::a6b3] by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oPAhz-00D0H0-AT; Fri, 19 Aug 2022 22:43:19 +0000 Message-ID: Date: Fri, 19 Aug 2022 15:43:18 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] powerpc: Add support for early debugging via Serial 16550 console Content-Language: en-US To: =?UTF-8?Q?Pali_Roh=c3=a1r?= Cc: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Nick Child , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20220819211254.22192-1-pali@kernel.org> <35c0ff6a-387d-3c01-66b3-f659cfe67c2a@infradead.org> <20220819223848.lvxakjjzfdjvyqgu@pali> From: Randy Dunlap In-Reply-To: <20220819223848.lvxakjjzfdjvyqgu@pali> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,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 8/19/22 15:38, Pali Rohár wrote: > 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. OK, we'll see if it ever causes a real problem then... >> 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? Don't know about that. Thanks. -- ~Randy