Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp917321rwr; Wed, 19 Apr 2023 15:25:47 -0700 (PDT) X-Google-Smtp-Source: AKy350b7tTsN72Ohq6EzAPpXThlo7pjvHU61qC4rb8LYKoIFogBJBq9w48sCP4pq+WlaOuQPZM93 X-Received: by 2002:a05:6a21:3014:b0:ef:5f:3c15 with SMTP id yd20-20020a056a21301400b000ef005f3c15mr16152pzb.47.1681943147317; Wed, 19 Apr 2023 15:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681943147; cv=none; d=google.com; s=arc-20160816; b=SLBPw0ZyPYN5PoP6ymY+US9XBB1UKxnV75XgAD6wgpuLGA2ZCduC9XVyNTyM0BmV+y cGEPbKvGxNzNP6M+YTxbd1v+XiWZ69KIr+XlESx+jlCI/K7KaKKeSbULMU4/IXt9uYyM FDeiCXpcQ1Cmc4ppSmecRMdyBUCe/s1gwCqBXTFYh0fuX41+TNc1Tlr/kiaLH/WHb0kH 9KD4FjDyWaeHOCJQ875+dAcU6z5QgqUtr0zOIdoPCFsuwv6ExLfhL4O3YYwIIm2kZCTC pg2d1b5Suq/7FjCsd+aIlpQ40k2l2rXNXhzXUNtLdSj9j/q/bTRKnsEUbqXHPLES2uDN 6xRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=P8D5qQaAsWRyihppL8lxgNE7a17gNAwjOwZEXYQRMgE=; b=fsdHkyHWL+ClWjFLjGmpNEotX8yRYqwb80kKUiu0wJjUkaaITwuFWzPPjYAUZLZ2eh MbXmJtatKAD3tefbwMMR0Gqx00rpjM/NCoy5qHm8dZZJCG6gU9/jqFE1+52kwRPk7giR BqE7xfLxflpjq0ilJfPhQ4f1ojB3Z3NezMU9xg51tCBiX6sCuQs3xhCDFpntgBCBzS60 VW/kCIFpfzs7IDz37V7PVaDxz6dF33wC969NSRA8ovX1cIRnri7FYE4f7lm4vvtKW0Eo HKN9l3XdoLINgku1bp64+Jf5fBQllsYYMmUjZxYVMXwZJ+G9SHc7U3lpaWH508LA1V8q V/tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=KY3qeDku; 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 6-20020a630f46000000b005135d3abc6asi17730642pgp.90.2023.04.19.15.25.33; Wed, 19 Apr 2023 15:25:47 -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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=KY3qeDku; 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 S233682AbjDSWWn (ORCPT + 99 others); Wed, 19 Apr 2023 18:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233283AbjDSWWD (ORCPT ); Wed, 19 Apr 2023 18:22:03 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F09D89ECE for ; Wed, 19 Apr 2023 15:20:31 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1a5197f00e9so4663835ad.1 for ; Wed, 19 Apr 2023 15:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1681942756; x=1684534756; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P8D5qQaAsWRyihppL8lxgNE7a17gNAwjOwZEXYQRMgE=; b=KY3qeDkuqx7ojUE9edJo91m4yJkLaFWv5WBr0z1XBW37m3Ugju5gvpwIFDQff0jKms +hgKcILxSjrfAbaSn/gsJas5jFwQYwJwvq++pUZKG2L4GsKhyqTPcUu6xp5ypSE2166a M9MbN1bFoVVAdPgWpFhugIMpkrykve+HvKmx+0rzvYuv5b7fjLguHE92nxuCMfaazyT0 EjqjUkf7F7QIDOnYykXPXccd7CL3t2WBS+Rd2ML5ADa2yHIE2iBIctAwVUyHJ5XwQDtq 3t1dyXic09IH7MeVfo82H9l2jXFUHVEBVSeBHFYy8QxMmo1hXkdwnKJUN8t2qaLHF1ux +z5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681942756; x=1684534756; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P8D5qQaAsWRyihppL8lxgNE7a17gNAwjOwZEXYQRMgE=; b=SyMR+Ta5LKGWhgY6UhjWW3oVwuyguxlYikXGyvDIqHcAyWIFpG2MmgRtpI6SKvWqA/ 1CvM/hvQtRYTIgDq+bSROaQCG4U42eWM0vtOIX0BGXjFt2tEDUd2eCP9A50fZaEqN+zy QsSw9nH++4paKTyhQfJ23bkOWG6hLgF3VsGsDtRsDrYjyEayk2E58qQa7+/NCwlutPS7 3mG1Og2yQMQpHdzDtWNq9lPZeG4h9Yz54NOAcImtei4YNfsVU0msM15rs228rZMsjWfU dmJXnB4AVoUt1MSbZaYYltF/nQThmuVxiET76qQEhiQAYJ1Ja91eAnWbEYBTLrsAZZWz Dodg== X-Gm-Message-State: AAQBX9fNRCuccd+0OAljabtBVZRqOmeg+sxtrYf2eQDUnllr6N+i087t aZWi10Sn0HKYe9+VPEJ/Sq/c0vDBpgcUHnlO1PI= X-Received: by 2002:a17:903:2288:b0:1a5:2db2:2bb with SMTP id b8-20020a170903228800b001a52db202bbmr8899588plh.15.1681942756356; Wed, 19 Apr 2023 15:19:16 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id jn11-20020a170903050b00b00196807b5189sm11619190plb.292.2023.04.19.15.19.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 15:19:16 -0700 (PDT) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Alexandre Ghiti , Andrew Jones , Andrew Morton , Anup Patel , Atish Patra , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Suzuki K Poulose , Will Deacon , Marc Zyngier , Sean Christopherson , linux-coco@lists.linux.dev, Dylan Reid , abrestic@rivosinc.com, Samuel Ortiz , Christoph Hellwig , Conor Dooley , Greg Kroah-Hartman , Guo Ren , Heiko Stuebner , Jiri Slaby , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, Mayuresh Chitale , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Rajnesh Kanwal , Uladzislau Rezki Subject: [RFC 48/48] drivers/hvc: sbi: Disable HVC console for TVMs Date: Wed, 19 Apr 2023 15:17:16 -0700 Message-Id: <20230419221716.3603068-49-atishp@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419221716.3603068-1-atishp@rivosinc.com> References: <20230419221716.3603068-1-atishp@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 If two same type of console is used in command line, kernel picks up the first registered one instead of the preferred one. The fix was proposed and NACK'ed due to a possible regression for other users. https://lore.kernel.org/all/Y+tziG0Uo5ey+Ocy@alley/ HVC sbi console makes it impossible to use virtio console which is preferred anyways. We could have disabled HVC console for TVMs but same kernel image must work on both host and the the guest. There are genuine reasons for requiring the hvc sbi cosnole for the host. Do not initialize the hvc console for the TVMs so that virtio console can be used. Signed-off-by: Atish Patra --- drivers/tty/hvc/hvc_riscv_sbi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/tty/hvc/hvc_riscv_sbi.c b/drivers/tty/hvc/hvc_riscv_sbi.c index 83cfe00..dee96c5 100644 --- a/drivers/tty/hvc/hvc_riscv_sbi.c +++ b/drivers/tty/hvc/hvc_riscv_sbi.c @@ -11,6 +11,7 @@ #include #include +#include #include #include "hvc_console.h" @@ -103,6 +104,10 @@ static int __init hvc_sbi_init(void) { int err; + /* Prefer virtio console as hvc console for guests */ + if (is_cove_guest()) + return 0; + if ((sbi_spec_version >= sbi_mk_version(1, 0)) && (sbi_probe_extension(SBI_EXT_DBCN) > 0)) { err = PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_dbcn_ops, 16)); -- 2.25.1