From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92728C77B73 for ; Wed, 19 Apr 2023 22:22:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233685AbjDSWWo (ORCPT ); Wed, 19 Apr 2023 18:22:44 -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-Google-Smtp-Source: AKy350ZigrT04ztZNfYo7vxPOIAk65YMZhdMrGeFS26zGyCIXgxICUZh5tguDmZpxCxB9++y2y9iww== 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 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