Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp905159rdg; Wed, 11 Oct 2023 08:38:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMcOZhdapTj9XfsFx+m4eiyTjLA6IA/DQxwCUx5aReNDafQXHvk/9EggxZweKzA5NXRx1A X-Received: by 2002:a05:6870:c194:b0:1d4:d016:229f with SMTP id h20-20020a056870c19400b001d4d016229fmr22822491oad.10.1697038724159; Wed, 11 Oct 2023 08:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697038724; cv=none; d=google.com; s=arc-20160816; b=1J62gYOkGj30lX8AlrmN2X52aWL8hCQiP9FKkG0aMCoQYwIN6eCh78dZYq/4Rf+iv8 rRNFZDjnGbEYXesvpWoLltxdinjTbo57RyA5G7u90qFu3lhKzlZe7bS9nHf9NT9l++w8 Kck25IG/FEPzXFRuXYu+m5TcL6Nr8AhkopkptRyI4kLy37dtWLHyZqWBRRjXdyZj+YIo Z4u7SQyV18Sk5ZaU+ZSbcHuLXZZ9/BqHlYFW0/iKYsNjLDn+Y+JfnTk4fLcYm4Epeckg kUxmQKQ9FsA6SOzPykEX/kLp5rZTjiUeY+N1J7Jv3GsTmtUpQ0td0Z/FY3moibpyHsFv IeGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1bZpkRgovz51AKO2Ok87+Y9u7MeLQt0Mw3B5ANlnfec=; fh=JyL8+fJr4BsolHUmcm+dYi0xCmNZZ71zno4Ij1nE8wE=; b=SurQ8F0iC3AaBzSe+6fFkZ6s9A/IoSODpXEX1qDW8Bmf+7M3gMWA5xeM4ZcqLhAS6f oR9J22g/RQ7DNoV50qr0O6Jjhbcw7nenq62rqH8vdzGh5jYA1v6La/k2++C87J8ZxCC6 0IoiYVW6z5TIfCTAfZW9Mw1Y1wDywOWEuV6zJmb4ErJMzzs00LLKVNX53z1YElTaP22b RIPjDxkwfkHTYG6GtCLZ0tyAAfJvApaWMg1LQqyHMqFo8Cv/M6YG0erZQi/yD/nx/NE5 LiH+USs+oDRlqprXHHrc+gwOdX45nXsifhU3y/agkv2LR5Atv0IeYMtetdxs9yONQ/c+ EnLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=msVb2fwf; 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 16-20020a630b10000000b0058afac51c12si10190pgl.545.2023.10.11.08.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 08:38:44 -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=msVb2fwf; 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 A084C80EE6C3; Wed, 11 Oct 2023 08:38:40 -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 S235052AbjJKPiZ (ORCPT + 99 others); Wed, 11 Oct 2023 11:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232739AbjJKPiX (ORCPT ); Wed, 11 Oct 2023 11:38:23 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4BBAA7 for ; Wed, 11 Oct 2023 08:38:21 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5859a7d6556so5170882a12.0 for ; Wed, 11 Oct 2023 08:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697038701; x=1697643501; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1bZpkRgovz51AKO2Ok87+Y9u7MeLQt0Mw3B5ANlnfec=; b=msVb2fwfQ0RSkKlGNIjoO0jg/GdEFZEW3wB/D9iCFdHefI+rOovi7bK23pRnKEFl34 j9dQcZUvwhKjm7SijzDg9SK2xWuulSyDufCg912mTL4d8SDcDH60Q6eJYGiZ+wQXGyiw o5/sJgRhEjY16tpPh8+EAA3UqahUfJiWAZz4tBAaoQRe/TYkSGbNwB1auAYePf2S25Ux 2XYB9T51z32d2HIFdHAaiWRjbEQSGDdLFCt9aBwBVhcC5pqqKD8VacGPrDEQBvSedBTU vN3o/73ahdhhys9XduvBE16auxNNdSTlnyLJ7g3JWzsCM40lxaZAuEKJIkK56cFxH5FO mNlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697038701; x=1697643501; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1bZpkRgovz51AKO2Ok87+Y9u7MeLQt0Mw3B5ANlnfec=; b=WDhbaS9Wqg8bsroXU3QWTQWxi3A84pIqwYGbnftJXi/OpJzGCupzchsvpkTaE0Vnn9 vnw1R5JxjYBCW3yPS7gBHgXuEuwmGEl6yGFdipgCK4ckHZrGe4IawwoD7zTFAVbawnvc ETA8pMHjEYcD5aS+O6FiVQxrAOfVDCN3KIPE8YYJtR9EfEUfK67z+P/xOpTHgAc9oF5t suDTuJe4Kfi9vUc2invnrssNek1cVGaiLwsCMYJDg4BwCyS8CJ+VKBkuxk9IColszpj6 urm8ZPSRsqtMnZD2VZo+0Vm+WzDUld+uwYRXFJD/1KlvsqmFMAblO45LfYV8nJ/WaDBS 5cMg== X-Gm-Message-State: AOJu0YyogWXlQCtXr+6fCuaTK+RY8D3f9meKsBVZgM/BsBwenm3s4OZr O+8fkzDApgHIad6qhUqLZ5FF/e4UNZZJsoTK7ntHzg== X-Received: by 2002:a17:90a:5383:b0:27c:ea4c:d8c5 with SMTP id y3-20020a17090a538300b0027cea4cd8c5mr5192162pjh.19.1697038701054; Wed, 11 Oct 2023 08:38:21 -0700 (PDT) MIME-Version: 1.0 References: <20231010170503.657189-1-apatel@ventanamicro.com> <20231010170503.657189-3-apatel@ventanamicro.com> <2023101013-overfeed-online-7f69@gregkh> <2023101107-endorse-large-ef50@gregkh> <2023101148-anatomy-mantis-a0f5@gregkh> In-Reply-To: <2023101148-anatomy-mantis-a0f5@gregkh> From: Anup Patel Date: Wed, 11 Oct 2023 21:08:10 +0530 Message-ID: Subject: Re: [PATCH 2/6] RISC-V: KVM: Change the SBI specification version to v2.0 To: Greg Kroah-Hartman Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Jiri Slaby , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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]); Wed, 11 Oct 2023 08:38:40 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 11, 2023 at 8:56=E2=80=AFPM Greg Kroah-Hartman wrote: > > On Wed, Oct 11, 2023 at 04:32:22PM +0530, Anup Patel wrote: > > On Wed, Oct 11, 2023 at 12:57=E2=80=AFPM Greg Kroah-Hartman > > wrote: > > > > > > On Wed, Oct 11, 2023 at 11:49:14AM +0530, Anup Patel wrote: > > > > On Tue, Oct 10, 2023 at 10:43=E2=80=AFPM Greg Kroah-Hartman > > > > 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 le= t > > > > > > us change the KVM RISC-V SBI specification version to v2.0. > > > > > > > > > > > > Signed-off-by: Anup Patel > > > > > > --- > > > > > > 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 k= eep > > > > > incrementing it? > > > > > > > > This number is the SBI specification version implemented by KVM RIS= C-V > > > > for the Guest kernel. > > > > > > > > The original sbi_console_putchar() and sbi_console_getchar() are le= gacy > > > > functions (aka SBI v0.1) which were introduced a few years back alo= ng > > > > 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_putch= ar() > > > > and sbi_console_getchar() functions with better alternatives. > > > > (Refer, https://github.com/riscv-non-isa/riscv-sbi-doc/releases/dow= nload/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 kerne= l > > > > will check SBI specification version implemented by higher privileg= e > > > > 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