Message ID | 20231010170503.657189-3-apatel@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp8504vqb; Tue, 10 Oct 2023 10:06:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEv9o1HrgdeUhM2XTIpzUI1x29Hjl8sNcW/CNttt976ZW6hgW+kLnPtMhRqbyPyhjXV6fJb X-Received: by 2002:a05:6a00:99c:b0:690:fd48:1aa4 with SMTP id u28-20020a056a00099c00b00690fd481aa4mr24279058pfg.0.1696957616521; Tue, 10 Oct 2023 10:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696957616; cv=none; d=google.com; s=arc-20160816; b=qCrK8OGjspZuN/Lt0rPlraMcU+oa7ovLdmN7hgPIw2pv9KtbeCbo5xfvXp1kCoNjpF OqoVFw94MwHereS5krHmjbSVVtoemF0ZL0om7Lswu/FCCWx4ZixL8qLVVa2ExFYEu17h f208tK5TDUcPxpeGvfsBgNWrH+RxfShVlng/F13ux9vljuF6OlOYSnBr2K3IHxaRPr73 OpCInR3Q9P92UPKQnrXDJoPMWSe4nrVsQnM3G+CeOuRl9Y9hgANMDPAV8xPxjEG6Ogh1 BTOe3krSfCu2J3O8ryBQsWPlrGqwMuhTokw8XDq+gKvu91J+KSl2BlqqsYwi4lbkCCtO UpYA== 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=l3lhlJZP7U6sfVX0rlDY0S8d2x8DhhVnWXy5WEJL0wg=; fh=7GYORjoWw1oF4BCDuq40hd+MOEKRwzNqXwnZ/K2vS9Q=; b=vWfto3/oO8Rr7jpZdTs0pAB6m9Mps+dqHZmq9cL+bA0/0W6SqVKwEeJOqyH3gKipuu JzOaFAmRkS3BAS4LmVpF0twCmxTHX/S47AEYzSocXRQ7j68T5ArGZYwCMooF7P1Bbdbl nK1EWzl2GgPHtnS2e44PNfo2B1sJP6xJa1nnGLgh5QZeduLPAthwQ0OrAylspIEKQpDn CSMDEQoSpWm7vL9JvioWLBVsbbo8zpmw5Ff/z1bOsoDFD333XF0zkIHKyoOqrPQqprZe Jswi8xg/R/D8tiYChhmMvi1BrVkln9TxTPFfnI2qv++Sf9iNFK84oyNVHfd/0LX7SnUV hdcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Q1nvnrQh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id f20-20020a63f114000000b00566016fc08csi12524849pgi.83.2023.10.10.10.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 10:06:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Q1nvnrQh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 AAC73808752C; Tue, 10 Oct 2023 10:05:41 -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 S233955AbjJJRFf (ORCPT <rfc822;rua109.linux@gmail.com> + 20 others); Tue, 10 Oct 2023 13:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233927AbjJJRFc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Oct 2023 13:05:32 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4593BDA for <linux-kernel@vger.kernel.org>; Tue, 10 Oct 2023 10:05:25 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c60f1a2652so418585ad.0 for <linux-kernel@vger.kernel.org>; Tue, 10 Oct 2023 10:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1696957525; x=1697562325; darn=vger.kernel.org; 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=l3lhlJZP7U6sfVX0rlDY0S8d2x8DhhVnWXy5WEJL0wg=; b=Q1nvnrQhx6Vs8g9wOc7yiACALxYiSSrf2LksIxSwvXbWbC6UNECEQcClYhPtrb2p4D zMhL03nuhtA+w/QwK0+6WWFgwJJTeDB5VQ5Z1DRG78TEEd+dPGo196k6nZVzUAE9igOU RGaJDl9jfGZVKlZ5BJMl2E8ViLpZmMrFKKantddS21R5VNXvSHxuGPHNpa6iW7ICODA+ ZM0YEFQS/+M3tWpHZ1RKnQxpmHF6ICK8mkm3vPzR8aQiFT+ZXnEz7G+q3KZxoaVRlkRi wGS16TLD+YV6fZmrGM+HGbZC1GFivZ90lyTo5977Gdwvr4ESBvxvgf9mgoSHxTujZIp4 0fTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696957525; x=1697562325; 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=l3lhlJZP7U6sfVX0rlDY0S8d2x8DhhVnWXy5WEJL0wg=; b=f0dp0Y+BR2eax41NVVE5wAFWAP6pCGFFYq2SVtLIDQsN2UtRw8v+lRce5R28hdVExz EDJrXW+5hd9xnYTTWj356PYDAX2ixOG8TU5YVp4uV8MZKkngPdtIOgfk96/9X1nTsYWq R6grhXTWdye4MMRLOucjVXuqX5Lh4Gb8t2lRGpO+xm9ANX6ADatfffDZLwrDgDU2rOAP ENIWKlo178utEv1LEsDBuEO0ZAl4LFHyX8fRv37CwaC9ZGpJNHbbOiZ2mLkDyXMtRGJw /DUHvQEA8+H0JgC1fy+VNJQyzeKbAu+1zJvuKeIdoaO97nEWx9BfnKwDohZIYtYOWAlU I+BA== X-Gm-Message-State: AOJu0Yw3hW7eC7qvYc+OjWVsub76APmwQDD3a6xMBnzmASjurk5HUTll HiJ0GeltNKVnFq0jyKZzID/ZHA== X-Received: by 2002:a17:902:d352:b0:1c6:de6:5eb4 with SMTP id l18-20020a170902d35200b001c60de65eb4mr18397397plk.13.1696957524587; Tue, 10 Oct 2023 10:05:24 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id w19-20020a1709027b9300b001b89536974bsm11979868pll.202.2023.10.10.10.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 10:05:24 -0700 (PDT) From: Anup Patel <apatel@ventanamicro.com> To: Paolo Bonzini <pbonzini@redhat.com>, Atish Patra <atishp@atishpatra.org>, Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org> Cc: Conor Dooley <conor@kernel.org>, Andrew Jones <ajones@ventanamicro.com>, 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 <apatel@ventanamicro.com> Subject: [PATCH 2/6] RISC-V: KVM: Change the SBI specification version to v2.0 Date: Tue, 10 Oct 2023 22:34:59 +0530 Message-Id: <20231010170503.657189-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010170503.657189-1-apatel@ventanamicro.com> References: <20231010170503.657189-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> 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 10:05:41 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779389029567373746 X-GMAIL-MSGID: 1779389029567373746 |
Series |
RISC-V SBI debug console extension support
|
|
Commit Message
Anup Patel
Oct. 10, 2023, 5:04 p.m. UTC
We will be implementing SBI DBCN extension for KVM RISC-V so let
us change the KVM RISC-V SBI specification version to v2.0.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote: > We will be implementing SBI DBCN extension for KVM RISC-V so let > us change the KVM RISC-V SBI specification version to v2.0. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h > index cdcf0ff07be7..8d6d4dce8a5e 100644 > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h > @@ -11,7 +11,7 @@ > > #define KVM_SBI_IMPID 3 > > -#define KVM_SBI_VERSION_MAJOR 1 > +#define KVM_SBI_VERSION_MAJOR 2 What does this number mean? Who checks it? Why do you have to keep incrementing it? thanks, greg k-h
On Tue, Oct 10, 2023 at 10:43 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote: > > We will be implementing SBI DBCN extension for KVM RISC-V so let > > us change the KVM RISC-V SBI specification version to v2.0. > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > --- > > arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > index cdcf0ff07be7..8d6d4dce8a5e 100644 > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > @@ -11,7 +11,7 @@ > > > > #define KVM_SBI_IMPID 3 > > > > -#define KVM_SBI_VERSION_MAJOR 1 > > +#define KVM_SBI_VERSION_MAJOR 2 > > What does this number mean? Who checks it? Why do you have to keep > incrementing it? This number is the SBI specification version implemented by KVM RISC-V for the Guest kernel. The original sbi_console_putchar() and sbi_console_getchar() are legacy functions (aka SBI v0.1) which were introduced a few years back along with the Linux RISC-V port. The latest SBI v2.0 specification (which is now frozen) introduces a new SBI debug console extension which replaces legacy sbi_console_putchar() and sbi_console_getchar() functions with better alternatives. (Refer, https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/commit-fe4562532a9cc57e5743b6466946c5e5c98c73ca/riscv-sbi.pdf) This series adds SBI debug console implementation in KVM RISC-V so the SBI specification version advertised by KVM RISC-V must also be upgraded to v2.0. Regarding who checks its, the SBI client drivers in the Linux kernel will check SBI specification version implemented by higher privilege mode (M-mode firmware or HS-mode hypervisor) before probing the SBI extension. For example, the HVC SBI driver (PATCH5) will ensure SBI spec version to be at least v2.0 before probing SBI debug console extension. > > thanks, > > greg k-h Regards, Anup
On Wed, Oct 11, 2023 at 11:49:14AM +0530, Anup Patel wrote: > On Tue, Oct 10, 2023 at 10:43 PM Greg Kroah-Hartman > <gregkh@linuxfoundation.org> wrote: > > > > On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote: > > > We will be implementing SBI DBCN extension for KVM RISC-V so let > > > us change the KVM RISC-V SBI specification version to v2.0. > > > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > > --- > > > arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > index cdcf0ff07be7..8d6d4dce8a5e 100644 > > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > @@ -11,7 +11,7 @@ > > > > > > #define KVM_SBI_IMPID 3 > > > > > > -#define KVM_SBI_VERSION_MAJOR 1 > > > +#define KVM_SBI_VERSION_MAJOR 2 > > > > What does this number mean? Who checks it? Why do you have to keep > > incrementing it? > > This number is the SBI specification version implemented by KVM RISC-V > for the Guest kernel. > > The original sbi_console_putchar() and sbi_console_getchar() are legacy > functions (aka SBI v0.1) which were introduced a few years back along > with the Linux RISC-V port. > > The latest SBI v2.0 specification (which is now frozen) introduces a new > SBI debug console extension which replaces legacy sbi_console_putchar() > and sbi_console_getchar() functions with better alternatives. > (Refer, https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/commit-fe4562532a9cc57e5743b6466946c5e5c98c73ca/riscv-sbi.pdf) > > This series adds SBI debug console implementation in KVM RISC-V > so the SBI specification version advertised by KVM RISC-V must also be > upgraded to v2.0. > > Regarding who checks its, the SBI client drivers in the Linux kernel > will check SBI specification version implemented by higher privilege > mode (M-mode firmware or HS-mode hypervisor) before probing > the SBI extension. For example, the HVC SBI driver (PATCH5) > will ensure SBI spec version to be at least v2.0 before probing > SBI debug console extension. Is this api backwards compatible, or did you just break existing userspace that only expects version 1.0? thanks, greg k-h
On Wed, Oct 11, 2023 at 12:57 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > On Wed, Oct 11, 2023 at 11:49:14AM +0530, Anup Patel wrote: > > On Tue, Oct 10, 2023 at 10:43 PM Greg Kroah-Hartman > > <gregkh@linuxfoundation.org> wrote: > > > > > > On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote: > > > > We will be implementing SBI DBCN extension for KVM RISC-V so let > > > > us change the KVM RISC-V SBI specification version to v2.0. > > > > > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > > > --- > > > > arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > index cdcf0ff07be7..8d6d4dce8a5e 100644 > > > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > @@ -11,7 +11,7 @@ > > > > > > > > #define KVM_SBI_IMPID 3 > > > > > > > > -#define KVM_SBI_VERSION_MAJOR 1 > > > > +#define KVM_SBI_VERSION_MAJOR 2 > > > > > > What does this number mean? Who checks it? Why do you have to keep > > > incrementing it? > > > > This number is the SBI specification version implemented by KVM RISC-V > > for the Guest kernel. > > > > The original sbi_console_putchar() and sbi_console_getchar() are legacy > > functions (aka SBI v0.1) which were introduced a few years back along > > with the Linux RISC-V port. > > > > The latest SBI v2.0 specification (which is now frozen) introduces a new > > SBI debug console extension which replaces legacy sbi_console_putchar() > > and sbi_console_getchar() functions with better alternatives. > > (Refer, https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/commit-fe4562532a9cc57e5743b6466946c5e5c98c73ca/riscv-sbi.pdf) > > > > This series adds SBI debug console implementation in KVM RISC-V > > so the SBI specification version advertised by KVM RISC-V must also be > > upgraded to v2.0. > > > > Regarding who checks its, the SBI client drivers in the Linux kernel > > will check SBI specification version implemented by higher privilege > > mode (M-mode firmware or HS-mode hypervisor) before probing > > the SBI extension. For example, the HVC SBI driver (PATCH5) > > will ensure SBI spec version to be at least v2.0 before probing > > SBI debug console extension. > > Is this api backwards compatible, or did you just break existing > userspace that only expects version 1.0? The legacy sbi_console_putchar() and sbi_console_getchar() functions have not changed so it does not break existing user-space. The new SBI DBCN functions to be implemented by KVM user space are: sbi_debug_console_write() sbi_debug_console_read() sbi_debug_console_write_byte() > > thanks, > > greg k-h Regards, Anup
On Wed, Oct 11, 2023 at 04:32:22PM +0530, Anup Patel wrote: > On Wed, Oct 11, 2023 at 12:57 PM Greg Kroah-Hartman > <gregkh@linuxfoundation.org> wrote: > > > > On Wed, Oct 11, 2023 at 11:49:14AM +0530, Anup Patel wrote: > > > On Tue, Oct 10, 2023 at 10:43 PM Greg Kroah-Hartman > > > <gregkh@linuxfoundation.org> wrote: > > > > > > > > On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote: > > > > > We will be implementing SBI DBCN extension for KVM RISC-V so let > > > > > us change the KVM RISC-V SBI specification version to v2.0. > > > > > > > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > > > > --- > > > > > arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > > index cdcf0ff07be7..8d6d4dce8a5e 100644 > > > > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > > @@ -11,7 +11,7 @@ > > > > > > > > > > #define KVM_SBI_IMPID 3 > > > > > > > > > > -#define KVM_SBI_VERSION_MAJOR 1 > > > > > +#define KVM_SBI_VERSION_MAJOR 2 > > > > > > > > What does this number mean? Who checks it? Why do you have to keep > > > > incrementing it? > > > > > > This number is the SBI specification version implemented by KVM RISC-V > > > for the Guest kernel. > > > > > > The original sbi_console_putchar() and sbi_console_getchar() are legacy > > > functions (aka SBI v0.1) which were introduced a few years back along > > > with the Linux RISC-V port. > > > > > > The latest SBI v2.0 specification (which is now frozen) introduces a new > > > SBI debug console extension which replaces legacy sbi_console_putchar() > > > and sbi_console_getchar() functions with better alternatives. > > > (Refer, https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/commit-fe4562532a9cc57e5743b6466946c5e5c98c73ca/riscv-sbi.pdf) > > > > > > This series adds SBI debug console implementation in KVM RISC-V > > > so the SBI specification version advertised by KVM RISC-V must also be > > > upgraded to v2.0. > > > > > > Regarding who checks its, the SBI client drivers in the Linux kernel > > > will check SBI specification version implemented by higher privilege > > > mode (M-mode firmware or HS-mode hypervisor) before probing > > > the SBI extension. For example, the HVC SBI driver (PATCH5) > > > will ensure SBI spec version to be at least v2.0 before probing > > > SBI debug console extension. > > > > Is this api backwards compatible, or did you just break existing > > userspace that only expects version 1.0? > > The legacy sbi_console_putchar() and sbi_console_getchar() > functions have not changed so it does not break existing > user-space. > > The new SBI DBCN functions to be implemented by KVM > user space are: > sbi_debug_console_write() > sbi_debug_console_read() > sbi_debug_console_write_byte() And where exactly is that code for us to review that this is tested? thanks, greg k-h
On Wed, Oct 11, 2023 at 8:56 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > On Wed, Oct 11, 2023 at 04:32:22PM +0530, Anup Patel wrote: > > On Wed, Oct 11, 2023 at 12:57 PM Greg Kroah-Hartman > > <gregkh@linuxfoundation.org> wrote: > > > > > > On Wed, Oct 11, 2023 at 11:49:14AM +0530, Anup Patel wrote: > > > > On Tue, Oct 10, 2023 at 10:43 PM Greg Kroah-Hartman > > > > <gregkh@linuxfoundation.org> wrote: > > > > > > > > > > On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote: > > > > > > We will be implementing SBI DBCN extension for KVM RISC-V so let > > > > > > us change the KVM RISC-V SBI specification version to v2.0. > > > > > > > > > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > > > > > --- > > > > > > arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > > > index cdcf0ff07be7..8d6d4dce8a5e 100644 > > > > > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > > > > @@ -11,7 +11,7 @@ > > > > > > > > > > > > #define KVM_SBI_IMPID 3 > > > > > > > > > > > > -#define KVM_SBI_VERSION_MAJOR 1 > > > > > > +#define KVM_SBI_VERSION_MAJOR 2 > > > > > > > > > > What does this number mean? Who checks it? Why do you have to keep > > > > > incrementing it? > > > > > > > > This number is the SBI specification version implemented by KVM RISC-V > > > > for the Guest kernel. > > > > > > > > The original sbi_console_putchar() and sbi_console_getchar() are legacy > > > > functions (aka SBI v0.1) which were introduced a few years back along > > > > with the Linux RISC-V port. > > > > > > > > The latest SBI v2.0 specification (which is now frozen) introduces a new > > > > SBI debug console extension which replaces legacy sbi_console_putchar() > > > > and sbi_console_getchar() functions with better alternatives. > > > > (Refer, https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/commit-fe4562532a9cc57e5743b6466946c5e5c98c73ca/riscv-sbi.pdf) > > > > > > > > This series adds SBI debug console implementation in KVM RISC-V > > > > so the SBI specification version advertised by KVM RISC-V must also be > > > > upgraded to v2.0. > > > > > > > > Regarding who checks its, the SBI client drivers in the Linux kernel > > > > will check SBI specification version implemented by higher privilege > > > > mode (M-mode firmware or HS-mode hypervisor) before probing > > > > the SBI extension. For example, the HVC SBI driver (PATCH5) > > > > will ensure SBI spec version to be at least v2.0 before probing > > > > SBI debug console extension. > > > > > > Is this api backwards compatible, or did you just break existing > > > userspace that only expects version 1.0? > > > > The legacy sbi_console_putchar() and sbi_console_getchar() > > functions have not changed so it does not break existing > > user-space. > > > > The new SBI DBCN functions to be implemented by KVM > > user space are: > > sbi_debug_console_write() > > sbi_debug_console_read() > > sbi_debug_console_write_byte() > > And where exactly is that code for us to review that this is tested? The KVM selftests for KVM RISC-V are under development. Eventually, we will have dedicated KVM selftests for the SBI extensions implemented by KVM RISC-V. Until then we have KVMTOOL implementation for SBI DBCN, which is available in riscv_sbi_dbcn_v1 branch at: https://github.com/avpatel/kvmtool.git > > thanks, > > greg k-h Regards, Anup
diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h index cdcf0ff07be7..8d6d4dce8a5e 100644 --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h @@ -11,7 +11,7 @@ #define KVM_SBI_IMPID 3 -#define KVM_SBI_VERSION_MAJOR 1 +#define KVM_SBI_VERSION_MAJOR 2 #define KVM_SBI_VERSION_MINOR 0 enum kvm_riscv_sbi_ext_status {