Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp288743rdg; Tue, 10 Oct 2023 10:13:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdygWk1GahACvDrF0MpqyMyrrG/dFbP6Gva/K3GvBGYptxJeWNbm75c3hP2oWSwNcDe/Wz X-Received: by 2002:a05:6a00:2d1e:b0:690:463a:fa9d with SMTP id fa30-20020a056a002d1e00b00690463afa9dmr19935694pfb.22.1696957982716; Tue, 10 Oct 2023 10:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696957982; cv=none; d=google.com; s=arc-20160816; b=dJtB2/e3M8x23bgbVdpsqo+1TbKHUzjvEsTYGVsGOehhVWEuGZ4HdNm0kPM67JjoLo yB/oAhUIcVxX7zcJJd70T9wz9SP4xtxkwVbYNZhnHY37gWTZ+7WcJYZCpdRhD+licNhc BQxQStqMgyM0cKDvtJteH6yLYPOOQTkqlDr97r2qGyZF6u8EM22/gjxY49hj2QtWeZTn H5U40ft724ztjLvu4RiIdz5CuFzdZ2nlnyD0Cf+ac1QOKcnv3H7cLGRcEEKlo0NfpkJL dd12xf1c02SysMYiPgK5hFiyfZScOXMnOWhDROKSUEcNuN02IOChIOq/MBtw2Xnw6as+ jeSw== 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=HOszK9lC5muVIzC+LmZ09IidPrh/x7ApklLqTcRRCjs=; fh=90bD+2NM68pp+EKVCN45xT00TQqc0qSqSQqkq/mOpp0=; b=QKFMaWMTjhLhtXYM1kBKmgHyXR0L5h/HWVzxuxELTV2Ss7YHxvzFlVDgcgEmTrwfII PAP4FKBOISdV1tN0+X1Hj0PXluEJTF4GWg+Wkx3XEp7c46CXHyEcaM9TBdO7QwrYHgsG BaOjtxZaPmlP0ODiOPBsSGNRZD1EzaxAd/b0Wo0BK0cVJt0og1lV2lVCq7qUM5fz2Stw dqhiJYN3+7bDSUM4GE9WMJOKBciV3L89ahNGd7E04rlxFrjlHFJSmhLNkN/JxgSCUmjc RPoCXeTH7X6HA5yTELyUSngbT0fEd0XGw3UJxgyyqfn0IZvS1tBLdKYu1y92ckTMEqIo nwuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="h8/uqYlf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id k4-20020a056a00134400b0069026fd5a48si10215126pfu.34.2023.10.10.10.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 10:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="h8/uqYlf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 538BC806114E; Tue, 10 Oct 2023 10:13:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233505AbjJJRMs (ORCPT + 99 others); Tue, 10 Oct 2023 13:12:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232908AbjJJRMr (ORCPT ); Tue, 10 Oct 2023 13:12:47 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8638C97; Tue, 10 Oct 2023 10:12:45 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E682C433C7; Tue, 10 Oct 2023 17:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696957965; bh=+k83Wr/EUECBDmTY4zF/z/iAjbCmN1Z0PcCaY918fko=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h8/uqYlf08jWlRslIBjTFO+O3KgIK4hpU8keuMdttxUwK2/9BA0rrNe2DhBa7HpYl I/alfdg11rxUhylY0/9H2xtDI6H1yC7wPztb9/1hUE9ZzcSiPSz0b0kYJerOuVfCok WHXS5S9wReYUkDvdHstV1VmsH6cDy1VV/U/4BhNk= Date: Tue, 10 Oct 2023 19:12:42 +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, Atish Patra Subject: Re: [PATCH 5/6] tty: Add SBI debug console support to HVC SBI driver Message-ID: <2023101045-hazard-popcorn-7d19@gregkh> References: <20231010170503.657189-1-apatel@ventanamicro.com> <20231010170503.657189-6-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231010170503.657189-6-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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 10 Oct 2023 10:13:00 -0700 (PDT) X-Spam-Level: ** On Tue, Oct 10, 2023 at 10:35:02PM +0530, Anup Patel wrote: > --- a/drivers/tty/hvc/hvc_riscv_sbi.c > +++ b/drivers/tty/hvc/hvc_riscv_sbi.c > @@ -15,6 +15,7 @@ > > #include "hvc_console.h" > > +#ifdef CONFIG_RISCV_SBI_V01 Please no #ifdef in a .c file, that's not a good style for Linux code at all. And what if you want to build the driver for both options here? What will happen? > +static int hvc_sbi_dbcn_tty_put(uint32_t vtermno, const char *buf, int count) > { > - return PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_ops, 16)); > + phys_addr_t pa; > + struct sbiret ret; > + > + if (is_vmalloc_addr(buf)) > + pa = page_to_phys(vmalloc_to_page(buf)) + offset_in_page(buf); > + else > + pa = __pa(buf); > + > + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE, > +#ifdef CONFIG_32BIT > + count, pa, (u64)pa >> 32, > +#else > + count, pa, 0, > +#endif This is not how to do an api, sorry, again, please no #ifdef if you want to support this code for the next 20+ years. thanks, gre gk-h