Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp218407rdb; Thu, 19 Oct 2023 02:17:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUuwUJRHGHNsXZ7S0cZUGMsPo3Eh+5v+rVzDHwqGHlpFX+Bib7VQN3pTbQ8M8H1OvzQ3EE X-Received: by 2002:a05:6870:f808:b0:1ea:2d58:46e3 with SMTP id fr8-20020a056870f80800b001ea2d5846e3mr2243022oab.33.1697707074442; Thu, 19 Oct 2023 02:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697707074; cv=none; d=google.com; s=arc-20160816; b=Tm5Uo5WDKrh34SEdisnlwVDNLSpn7VFV5Rf1CApqn+3vaaMoSZtg5IU2vo544PHDaV /NX7ELluy7gI4xp85j5/GkEToWd3i8/XptOkGJjCNjwEcQvIJaN4xDyGc8KhX8KNwPHG 1x1MzCCqjmrcTboKq9hXpVstMBcyqT67m1WHnEw1nPeKhuKJmXDj7V3dQsp9+aUdYiND /9NDRnMGjkSncrz7ObjiUqP1KRWAOA9BxqJDIhk5xEa9P1Kf2S60C+Qvxhb7gmPw1CU6 UOVU9hJbijTR2dSCdHey6oGzaKdzasS423pekMrMwNZy7wvZP88EVi8TOOMAzfIFjnyS +NyA== 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=bcsnYpAdLM0em0FjxCCFcChvrh3CN3lWApFF37wa+JE=; fh=HphsaL+YRSr8xSEjXKGEGNHhmBU1p3niIw2svRX7Lek=; b=zi/uVuuN4w0CYxQ3dHxy6DThVNancHErpUwPAwbPnXVBJifFzHofOi1U7xRO3e9wFo kKlKuoTKdsOARED/36h3sBCEGlBhLq+cGVsgc2e1vf5YTeFntHK0vfF5Xm9kcTeGhjCB DOGVxht46krdgl2vl7L8BnHHs+ea6us2CFaDtubgEUyyeOAa3irVEPrpyK4w+v9qPWUq GQld7cBaqaTKs9kkEG9HL+IPTDXoW/Q5NNz+wIHOH4xhMXcpgqo7E4dvN+kK+BOnmTxE EsWx9Zxcydx2YdM28x8zIqfwPTOUbULoiARioAjp6zGpabpa1IKIvUg5zIHQG93hTzP/ bKXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="BPG/BIKe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k3-20020a6568c3000000b0057d08dac754si3951420pgt.671.2023.10.19.02.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 02:17:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="BPG/BIKe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id A100C80EE77F; Thu, 19 Oct 2023 02:17:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232935AbjJSJRd (ORCPT + 99 others); Thu, 19 Oct 2023 05:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233035AbjJSJRc (ORCPT ); Thu, 19 Oct 2023 05:17:32 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4564CFE for ; Thu, 19 Oct 2023 02:17:30 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-307d58b3efbso5966957f8f.0 for ; Thu, 19 Oct 2023 02:17:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697707048; x=1698311848; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=bcsnYpAdLM0em0FjxCCFcChvrh3CN3lWApFF37wa+JE=; b=BPG/BIKe8y/kUb1c1997E4CB0SJBH8lvMMeUOwxjLgg3PdHnKFLeEa1b9P15H+Ygn6 GZTakKl79VFLDWgSLF4ZhkcgDXn1hxlqU7thbIqvtYNANxLHnbLVWU3C1u5sR9+jfetr fsq3kEAydfAH8CcAocGVpMUHKTDZxhwxNVFBL/vzNjawjNXTkwy+rQR258xT23FY8gxD 0w5sBPWW9Juj+umlRSFYMzPLHbWCWrRDHpDVhAgm3JyIesa90vcakvBHDCuvTjyYp2p+ W/Ns/NOL4kmFtbmI2B2jhUaVKipdb5g5/6E9dCmVD8SDfa9LvpjRwcnaBRRk5E13ITV+ vKJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697707048; x=1698311848; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bcsnYpAdLM0em0FjxCCFcChvrh3CN3lWApFF37wa+JE=; b=Xb/kfY74qxU6buLXUd4P7wXPPEU8OahREJ5SHB3xW81SoHjUuy6nkUIVBGawB19gyX 4/Wz5X2WWzKWNAfjNnczegi9aQP3wYrvD/HaZNEygN8su++K9h5WlKWnDfi1/94X0CLr P0PfTtiwY5uGG6WqoI99uwCrtM3EpLgi5y2lKqPIQcJaLGQ1TRhdY8Nizqg6rtvbOt06 JkL9NsYjPT7OmQIq8dVjk2hZ//snJdXMCIZyyOI7/FLMW/oiL0/mw2ggAs6A7R7SLnYK JEpYOORwPlxI3ypJViIlbI1hOgw8uEYMbF335T7uXUaK85BXJ+UEM9WNIU2TVyfwShJn PzoQ== X-Gm-Message-State: AOJu0YyZQDKoLvaMNPNyXUaeMSYnqxPqs6MdrzLcVKBUidWYG0FUzTSG BIIU2aD4lO/D04NDBQyeGf7GGA== X-Received: by 2002:adf:f74d:0:b0:32d:8da0:48d0 with SMTP id z13-20020adff74d000000b0032d8da048d0mr923979wrp.68.1697707048600; Thu, 19 Oct 2023 02:17:28 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id x8-20020adfec08000000b0032dbf6bf7a2sm3994451wrn.97.2023.10.19.02.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 02:17:27 -0700 (PDT) Date: Thu, 19 Oct 2023 11:17:26 +0200 From: Andrew Jones To: Anup Patel Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Greg Kroah-Hartman , Jiri Slaby , Conor Dooley , 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 Subject: Re: [PATCH v2 4/8] RISC-V: KVM: Forward SBI DBCN extension to user-space Message-ID: <20231019-7471d3927d94ab7158d61c6b@orel> References: <20231012051509.738750-1-apatel@ventanamicro.com> <20231012051509.738750-5-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231012051509.738750-5-apatel@ventanamicro.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 19 Oct 2023 02:17:51 -0700 (PDT) On Thu, Oct 12, 2023 at 10:45:05AM +0530, Anup Patel wrote: > The frozen SBI v2.0 specification defines the SBI debug console > (DBCN) extension which replaces the legacy SBI v0.1 console > functions namely sbi_console_getchar() and sbi_console_putchar(). > > The SBI DBCN extension needs to be emulated in the KVM user-space > (i.e. QEMU-KVM or KVMTOOL) so we forward SBI DBCN calls from KVM > guest to the KVM user-space which can then redirect the console > input/output to wherever it wants (e.g. telnet, file, stdio, etc). > > The SBI debug console is simply a early console available to KVM > guest for early prints and it does not intend to replace the proper > console devices such as 8250, VirtIO console, etc. > > Signed-off-by: Anup Patel > --- > arch/riscv/include/asm/kvm_vcpu_sbi.h | 1 + > arch/riscv/include/uapi/asm/kvm.h | 1 + > arch/riscv/kvm/vcpu_sbi.c | 4 ++++ > arch/riscv/kvm/vcpu_sbi_replace.c | 32 +++++++++++++++++++++++++++ > 4 files changed, 38 insertions(+) > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h > index c02bda5559d7..6a453f7f8b56 100644 > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h > @@ -73,6 +73,7 @@ extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_ipi; > extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence; > extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst; > extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm; > +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_dbcn; > extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental; > extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor; > > diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h > index 917d8cc2489e..60d3b21dead7 100644 > --- a/arch/riscv/include/uapi/asm/kvm.h > +++ b/arch/riscv/include/uapi/asm/kvm.h > @@ -156,6 +156,7 @@ enum KVM_RISCV_SBI_EXT_ID { > KVM_RISCV_SBI_EXT_PMU, > KVM_RISCV_SBI_EXT_EXPERIMENTAL, > KVM_RISCV_SBI_EXT_VENDOR, > + KVM_RISCV_SBI_EXT_DBCN, We should add this new register to the get-reg-list kselftest, i.e. diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 234006d035c9..4a0f8a8cfbf8 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -565,6 +565,7 @@ static __u64 base_regs[] = { KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_SRST, KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_HSM, KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_PMU, + KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_DBCN, KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_EXPERIMENTAL, KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_SINGLE | KVM_RISCV_SBI_EXT_VENDOR, KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_MULTI_EN | 0, Thanks, drew