Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp599100rdg; Tue, 10 Oct 2023 22:51:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsVs/79bgFbolXBSJPelArle18Tx5XcK53ic4iCwdE+dAu/fQlo75OLL5KpGaIFQgmGKkw X-Received: by 2002:a05:6a21:a599:b0:153:39d9:56f8 with SMTP id gd25-20020a056a21a59900b0015339d956f8mr24914755pzc.15.1697003515548; Tue, 10 Oct 2023 22:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697003515; cv=none; d=google.com; s=arc-20160816; b=TFHFhIqKStZFlCN6lWkhLn4DHiFNe4ukN9WD3eVo8dEb+CRYI+jEVjtOhRUR6xMyOm 7jZaQGC0Gy1N3vv3VZ+q3G4HFp0gblBQfH/ZT2B3D061djut8+egbUg3ctuIocbGmc2q 5X4tjJkRLsYWtWyG63/DPhM7DBWfDJgh5oH65PPKE05bkCs3c8spYFxngqVb+6dTtWhi uuCdH07yrxt4rHk35u0ugGvSf/tkQTt/ohAHlusjoV/sQFD/kYuZg5JrHSaLYBS6dQ+s pemzf4mW8OPd1ckUJRqbR8FYOX0bdwsi8kodt/eQn/BuAurRQ7vfAqEuquVz7hCTCLEn KZiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZgOOUrxhrQpKc0UcO6mj9tBnrpY40gn5l4EwRcu1NOI=; fh=wbI5+tAFtdF+DoZwDhN/wB4q6hsamHOrlV28PK5Jbbw=; b=umCAzxvSmj9OVzZ4jpMadlCjKIzeEgDwnwrf9YUBbD5FSPFjUBAnkmJmWr2RD3hsj/ 4WZ1fUS5G3pLg1x1HfUo9dvSRLmpLXS7EfXTmbogaFbp6uBcO0UJ7ZmPRI0prsjAolTL h1K0uLPMbBJYJo4TPLepjuMRV2MLZfW2cKltMiKLIVIBVpxHjEN9857JEdNCwGQ44o7h HC2gP7wo2Ty4EQ4vxjeU3K70z7ZYgs7jsMrOuA8M6jzE4zjC0oJycTHa0Gby18l8A14O vgsvYnkpV18NFLMZ+IEtKuKn2QLWQheY9Axbrsxwe5VquT+XuhWXMxQZJUCSAXBDg/Gj jwqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=BBi47a0d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id g15-20020a056a001a0f00b0068fca125aaasi11683775pfv.232.2023.10.10.22.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 22:51:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=BBi47a0d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D2E81801B72B; Tue, 10 Oct 2023 22:51:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343792AbjJKFvc (ORCPT + 99 others); Wed, 11 Oct 2023 01:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbjJKFva (ORCPT ); Wed, 11 Oct 2023 01:51:30 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53DAB6 for ; Tue, 10 Oct 2023 22:51:28 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5892832f8daso501893a12.0 for ; Tue, 10 Oct 2023 22:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697003488; x=1697608288; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZgOOUrxhrQpKc0UcO6mj9tBnrpY40gn5l4EwRcu1NOI=; b=BBi47a0d566uAZLf74tOZs1i4XMtlk8eUoxA0YLHzNJyaMusR9TcGhPGokZjl5ln0U IzVnafrv1kV+fiwNyN2a1FSBE2YjZoajroOV/AR7Cyi7kB9q6tT9coTOdOY6J0Lw3uDT T8QZ2zmqeHXENIC9goCzxe0mPR72xr20vE2VqXn2R5t9Xl7EEXutZ7zJKkM4LMEoS9AJ Hm+09KxzGAxoq5a4gDnw5G3o3zcrKaZNaBnzNQSqnl6WAJyt9anQ4rkXmnXgKTUYWfC4 tv6llJs5kqPNvZA2m5iaj+LKIA6CiUvDriFzNPV4D9iHLB359OmfAFQNcrSCOf6qm7MO mMHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697003488; x=1697608288; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZgOOUrxhrQpKc0UcO6mj9tBnrpY40gn5l4EwRcu1NOI=; b=b5e0IfTZdiP84jWK2GV2RFJ96uDyZcQVs4fluj/0UMvGJlcu7/y5SFTtCaLVFgBqgG 009HXP9YQ6ipNTTG8FG57pu7r76M2j8rnkyW00r4V1clbpuyI+5uu1R0BqSpSiQ8bqmy 5+fJxfOuLhVGUjkeX30btoYpXf/4bielQu/ZOnOqQ/+dbPobuyFSIvEiMujCXTu8s34N arUbItEVGhqODuidSS91D9h3yVczRtgJUcyFeJNuI7LLIviET/cipf9oHH6kugQgOTUD AccDT7a9Zy1aAk0YnzIzmv6OuKaEqah6yhrWgJ3Vmddw6yZ+weqfjFn/CqAdq87/+yZA axVg== X-Gm-Message-State: AOJu0YxjbYwAe/dFZgtQbUhHjHnALXi2CTgRFZo1eO5BMFqinDEpEKGb /RbAQzF7ICAorAWiHB4jvfaw767/V5womYW9np0EKg== X-Received: by 2002:a17:90a:af86:b0:277:4be4:7a84 with SMTP id w6-20020a17090aaf8600b002774be47a84mr25295223pjq.19.1697003487902; Tue, 10 Oct 2023 22:51:27 -0700 (PDT) MIME-Version: 1.0 References: <20231010170503.657189-1-apatel@ventanamicro.com> <20231010170503.657189-6-apatel@ventanamicro.com> <2023101045-hazard-popcorn-7d19@gregkh> In-Reply-To: <2023101045-hazard-popcorn-7d19@gregkh> From: Anup Patel Date: Wed, 11 Oct 2023 11:21:17 +0530 Message-ID: Subject: Re: [PATCH 5/6] tty: Add SBI debug console support to HVC SBI driver To: Greg Kroah-Hartman 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 22:51:52 -0700 (PDT) X-Spam-Level: ** On Tue, Oct 10, 2023 at 10:42=E2=80=AFPM Greg Kroah-Hartman wrote: > > 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? Okay, I will remove all #ifdef from .c file > > > +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 =3D page_to_phys(vmalloc_to_page(buf)) + offset_in_pag= e(buf); > > + else > > + pa =3D __pa(buf); > > + > > + ret =3D 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. Sure, I will update like you suggested. > > thanks, > > gre gk-h Thanks, Anup