Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp291729rdg; Tue, 10 Oct 2023 10:17:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdWVpRaAWpoq6Reek5j5B7CcmC5yS+xAoYpNOIp5L+Xtg84tGAPmyxX2yge2EoeLk8pkHS X-Received: by 2002:a05:6a00:b8f:b0:693:4202:b535 with SMTP id g15-20020a056a000b8f00b006934202b535mr20983440pfj.27.1696958242786; Tue, 10 Oct 2023 10:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696958242; cv=none; d=google.com; s=arc-20160816; b=F4sUV80Y24HjSJjJ3auU6xvogvCDrjPMWY4tXAaBdXIRn+dn7fSkeKe/M/7u2hDqL+ hsMQcgxzItTn3YPKbpK0VzkgEZkcYZ7+F2w44X+xXL64YPQGimgHoRRQBCzOKzD1WudF 0RiiKnCFZRdE19hQgMi7C6lqNZ5QB9i/6FolM7avkyNvK7qHapZO8jvSNb7X4X5DjXFv MoXdi6VLtkZdNDeLHzN6Sy740WZ3GNuGEO35ON43VX7/Az9ZXB64yCVCDVegVzt6ziGE 1r7dzMaCGt/gp2sVM4UlFCyqlKvvE949oAoegHJPvFs31fwyhu8OgvFkYaWHhLSZf9qM MHwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wjzlkYDZ+oHcw83Vk7ciwUiuLGXqDb6XQn2FXAD1+lw=; fh=NKFL920pUMQopkg1dKfCPq22lKBlLOlyPGUlM3IaF/I=; b=CmkLhaFBESUQGfT8CbPnTFgdY2T93BsAjm22zARWQzikyRcWXfmziDBrkeq3BNZABR 3UwLAQg3dfRli2PovSr5wjdGglnwQZpGyCCjNHYdegfjIYt38KcEfAhRhRhEdjWoS0Md e7ftGdZFsHzAPL+psx9FremndSifDMpcu9AqtzL/OgTcGMqYz6uyNH5E4cHoZlKychOZ 5Be4Ji4L89UddQ0TXCdIWuNm3p6DthVLv+e7hlbzDgoG+RjeQn7Yswdt/Z5Pbaxk2iKx rFO37Nm8TElg954xEaxC4fL/F6wTQYLUkP86DXIFqW5wY/8pKalXlDKiUEA9drCJMEaf ld7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KjfeGlF0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id d16-20020a056a0024d000b0068e3f55075esi10453258pfv.134.2023.10.10.10.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 10:17:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KjfeGlF0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 747FC80B0285; Tue, 10 Oct 2023 10:16:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233961AbjJJRQO (ORCPT + 99 others); Tue, 10 Oct 2023 13:16:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233690AbjJJRQL (ORCPT ); Tue, 10 Oct 2023 13:16:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D3668E; Tue, 10 Oct 2023 10:16:10 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D43AC433C8; Tue, 10 Oct 2023 17:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696958169; bh=a+x8Te5gzV4XxTKWewe7fEV8PtaF6rYm/cvaiuepDlQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KjfeGlF0UJ6DXx3oZyLRJVdL1oufvFQST3r9+ykMZsN12WhBXEReutobcTRYLrezP Z3JkUecNUZ5yAmukh+tnKP+MyQLL6iIrGVRsaOs1qSbPyefIvjdVU49uGoZgm7aaXD 3o5aVSIERl4W5I36SXctSE0u3h4jVtHA+rxzX1g0= Date: Tue, 10 Oct 2023 19:16:07 +0200 From: Greg Kroah-Hartman To: Anup Patel Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Jiri Slaby , Conor Dooley , Andrew Jones , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-serial@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/6] tty/serial: Add RISC-V SBI debug console based earlycon Message-ID: <2023101053-scholar-resolute-a9a0@gregkh> References: <20231010170503.657189-1-apatel@ventanamicro.com> <20231010170503.657189-5-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231010170503.657189-5-apatel@ventanamicro.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 10:16:28 -0700 (PDT) X-Spam-Level: ** On Tue, Oct 10, 2023 at 10:35:01PM +0530, Anup Patel wrote: > We extend the existing RISC-V SBI earlycon support to use the new > RISC-V SBI debug console extension. > > Signed-off-by: Anup Patel > --- > drivers/tty/serial/Kconfig | 2 +- > drivers/tty/serial/earlycon-riscv-sbi.c | 35 ++++++++++++++++++++++--- > 2 files changed, 32 insertions(+), 5 deletions(-) > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index bdc568a4ab66..cec46091a716 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -87,7 +87,7 @@ config SERIAL_EARLYCON_SEMIHOST > > config SERIAL_EARLYCON_RISCV_SBI > bool "Early console using RISC-V SBI" > - depends on RISCV_SBI_V01 > + depends on RISCV_SBI > select SERIAL_CORE > select SERIAL_CORE_CONSOLE > select SERIAL_EARLYCON > diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/earlycon-riscv-sbi.c > index 27afb0b74ea7..b1da34e8d8cd 100644 > --- a/drivers/tty/serial/earlycon-riscv-sbi.c > +++ b/drivers/tty/serial/earlycon-riscv-sbi.c > @@ -10,22 +10,49 @@ > #include > #include > > +#ifdef CONFIG_RISCV_SBI_V01 > static void sbi_putc(struct uart_port *port, unsigned char c) > { > sbi_console_putchar(c); > } > > -static void sbi_console_write(struct console *con, > - const char *s, unsigned n) > +static void sbi_0_1_console_write(struct console *con, > + const char *s, unsigned int n) > { > struct earlycon_device *dev = con->data; > uart_console_write(&dev->port, s, n, sbi_putc); > } > +#endif > + > +static void sbi_dbcn_console_write(struct console *con, > + const char *s, unsigned int n) > +{ > + phys_addr_t pa = __pa(s); > + > + sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE, > +#ifdef CONFIG_32BIT > + n, pa, (u64)pa >> 32, > +#else > + n, pa, 0, > +#endif Again, no #ifdef in .c files please. thanks, greg k-h