From patchwork Thu Oct 12 05:15:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 15257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp994771vqb; Wed, 11 Oct 2023 22:17:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXfpOQBKXXJi8dQpdiqloIRZF+P04QKC+LY9DQvbxIgp0a44D3OcWW0wQEo4YpaPtZemTH X-Received: by 2002:a54:4385:0:b0:3a1:d457:83b5 with SMTP id u5-20020a544385000000b003a1d45783b5mr23071895oiv.3.1697087832753; Wed, 11 Oct 2023 22:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697087832; cv=none; d=google.com; s=arc-20160816; b=CK/ghlORGbf7wKpW6SqC2ZvkmwmsTzGkbfyVEYPwpH92nocbakwTCDkYXWlzmS8nM7 BOhRM/mnlv14ErOourpLgJGQ9ziJhmh3XPIgfYZZ+v38G3Y952ffdVXdH6u6Gys1x95+ rmDKFaNpGaS0SxD2h3kCB/MqDdMwZJWA4Ic5RkHyTXd4n5JjUtkfakbk5QDiatlxoEOI r0LHYH358/xLqwnL3YzKOXhK/wQsH7eTGzDnQm+GxporKQc2v/wdj24qiLOEp/hvmnDR Y4lu9BNLL2S+RtNb+B/Qdj6ZLmU60DnciSQAsdAfRDxoDavgzWhICucr/4REFI9hMAKB 3vaA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xYp5d01yjoieOqk/RkEsuV4xU8mIT2wOo0WVBK9XVOw=; fh=7GYORjoWw1oF4BCDuq40hd+MOEKRwzNqXwnZ/K2vS9Q=; b=PX7i/3fpwLUPSqAQMVzEI1jgXJNX7DT3sOlTEzCQVPLxOy4zX+5uh3dnSwkcsMMvc6 PkkUfpHGtIwOm3Uu2llQDdsxv13dFbYtuTT9I4ZTSnP6g+puTiWHKX5ot9EvzfWe94lH ohdDzlVlRYUt3I1aKUL/Du8uQg/OdqVQ15uymYxtwr8eQBG0G6nOwzmNkL8vDSTJtI68 MZC3RUey65ByjnzAX8Zhz7THFp2v9GL/NNygZ94ZFxIalRi35bPbTVQfIGwVqWHvRVkO Hm7UhDEl8DMan/yGkfQid6e7otTWFHPUMeu6qmhcxg+GkF6GIkk9IuXHazEBkPtyE873 26QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=b2U2xlBd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q26-20020a631f5a000000b0058556272a80si1374757pgm.371.2023.10.11.22.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 22:17:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=b2U2xlBd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 56D938092D9C; Wed, 11 Oct 2023 22:15:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376867AbjJLFPX (ORCPT + 18 others); Thu, 12 Oct 2023 01:15:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233879AbjJLFPV (ORCPT ); Thu, 12 Oct 2023 01:15:21 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23E1BA for ; Wed, 11 Oct 2023 22:15:19 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c60cec8041so4285865ad.3 for ; Wed, 11 Oct 2023 22:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697087719; x=1697692519; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xYp5d01yjoieOqk/RkEsuV4xU8mIT2wOo0WVBK9XVOw=; b=b2U2xlBdhLNmojbTWlKg6h/wiuEFBOwdQizMaSZpjhVJMTWnFOsEHP+Fb50ss4lvMb dRuHPLY1NY0g4VJYWnnjM6liqlo45EFsj5gtUyx/xTLsZW6ZJOkc6HpabmooBEU+hBlI oLSOw8FDL7DLp+3XhrWG3RNA6Bb2C21p8SU5G1o4WrHj5ODjEmOx0xAcdcwELl15hB7e Alxs6NtonfrE2TOx4iTPAymqXN2ptM/eiAx9kzLoBz9vV25srw+dvXoAc6bSHcAujstE xU4jp/ST3sU7ADIYxpNVDmbA16/R7uhjMFrdE4hnWINArbOhIOAgcIjgpOYX9amvO/hj Q3hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697087719; x=1697692519; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xYp5d01yjoieOqk/RkEsuV4xU8mIT2wOo0WVBK9XVOw=; b=lmALij7ETf5evGLIu47ppyyO1qDHNo1pVU5wq6PX6AgfXmOVzG86mg8eOd9gV/ouf2 SKeIqxN2vqskfpsZaGLq9DL14048s63fzEMzPdh2thO+slwie7gB+EpwJyBdjWvayR9t RCO5WLnBdkVTA4x7uTa6sbWUHf5yVrTcYFTXLgierMLWIZZhOh1YwRGyxsn8FOjvawO6 UVvnv7G820oV+6iMoKd6bzQa2dXaK2MMsvF0Nz8qL0n4JUp+P6zC1jfoawxSIv5UukGZ 4O2/2veqe1bI/n/dYrVv66pvvhh+Ys11yRy8TcLYiuwviLF/w3zyrGLn9nrHwNJC33XR 14mA== X-Gm-Message-State: AOJu0Yze32Ap+TUPJYXl9FKnE4MbhXzIRlQWC5IypZkY3MUvucGADXWu mIK8d65eOZedZY780F+wpFJQZg== X-Received: by 2002:a17:902:e888:b0:1c7:37e2:13fe with SMTP id w8-20020a170902e88800b001c737e213femr22891127plg.2.1697087719126; Wed, 11 Oct 2023 22:15:19 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([106.51.83.242]) by smtp.gmail.com with ESMTPSA id s18-20020a17090330d200b001b9d95945afsm851309plc.155.2023.10.11.22.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 22:15:18 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Greg Kroah-Hartman , Jiri Slaby Cc: 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, Anup Patel Subject: [PATCH v2 0/8] RISC-V SBI debug console extension support Date: Thu, 12 Oct 2023 10:45:01 +0530 Message-Id: <20231012051509.738750-1-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 22:15:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779525571327713955 X-GMAIL-MSGID: 1779525571327713955 The SBI v2.0 specification is now frozen. The SBI v2.0 specification defines SBI debug console (DBCN) extension which replaces the legacy SBI v0.1 functions sbi_console_putchar() and sbi_console_getchar(). (Refer v2.0-rc5 at https://github.com/riscv-non-isa/riscv-sbi-doc/releases) This series adds support for SBI debug console (DBCN) extension in KVM RISC-V and Linux RISC-V. To try these patches with KVM RISC-V, use KVMTOOL from riscv_sbi_dbcn_v1 branch at: https://github.com/avpatel/kvmtool.git These patches can also be found in the riscv_sbi_dbcn_v2 branch at: https://github.com/avpatel/linux.git Changes since v1: - Remove use of #ifdef from PATCH4 and PATCH5 of the v1 series - Improved commit description of PATCH3 in v1 series - Introduced new PATCH3 in this series to allow some SBI extensions (such as SBI DBCN) do to disabled by default so that older KVM user space work fine and newer KVM user space have to explicitly opt-in for emulating SBI DBCN. - Introduced new PATCH5 in this series which adds inline version of sbi_console_getchar() and sbi_console_putchar() for the case where CONFIG_RISCV_SBI_V01 is disabled. Anup Patel (7): RISC-V: Add defines for SBI debug console extension RISC-V: KVM: Change the SBI specification version to v2.0 RISC-V: KVM: Allow some SBI extensions to be disabled by default RISC-V: KVM: Forward SBI DBCN extension to user-space RISC-V: Add inline version of sbi_console_putchar/getchar() functions tty/serial: Add RISC-V SBI debug console based earlycon RISC-V: Enable SBI based earlycon support Atish Patra (1): tty: Add SBI debug console support to HVC SBI driver arch/riscv/configs/defconfig | 1 + arch/riscv/configs/rv32_defconfig | 1 + arch/riscv/include/asm/kvm_vcpu_sbi.h | 7 ++- arch/riscv/include/asm/sbi.h | 12 ++++ arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu.c | 6 ++ arch/riscv/kvm/vcpu_sbi.c | 49 +++++++++------- arch/riscv/kvm/vcpu_sbi_replace.c | 32 +++++++++++ drivers/tty/hvc/Kconfig | 2 +- drivers/tty/hvc/hvc_riscv_sbi.c | 76 ++++++++++++++++++++++--- drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/earlycon-riscv-sbi.c | 32 +++++++++-- 12 files changed, 188 insertions(+), 33 deletions(-)