Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp633137rdg; Wed, 11 Oct 2023 00:26:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsJYHTOc1EALXL8QLXx3StLTMUKc8IEulIhUjEmAJXEoNlgMRRqZD/o8KhxeCPiH2d+LkV X-Received: by 2002:a05:6a00:a92:b0:68e:399e:70db with SMTP id b18-20020a056a000a9200b0068e399e70dbmr20537268pfl.6.1697009195218; Wed, 11 Oct 2023 00:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697009195; cv=none; d=google.com; s=arc-20160816; b=ZqEiOBWDqc5jnyOVdjVXKdVJDB+yYxKUL5zoJs5jYEvj30G2vOD+mXMWc42TY/tRKV 8hWd84XjhQKCBFjlNMw8nvmblmpYqHarJISl7h5YR+j8rUcayk9+iPiolq6prGRXqe8U XQNhsHd7bnWpXvcO+0Ju1WuVjjcqFp8xm/7ZoRNSCLltldqyLepn2mU4xWQZv+wfZikC BPyquAUrrYHVUGHEsjqzErPpqc910fwQ9ufnjuLQ6t3wzkkfo0fg6AQpM4g2a7eCdSFr dBBQ5R5zWEEzrtDOS9MMsvx3apQaCtzSBVnMZHYRPlivtjSGbCjchThQcEmPa7KylfFz kKOg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=lxNU2ppCF29HpJhZsddTMNyj9QDYP2AarLgf0ArCBoU=; fh=NKFL920pUMQopkg1dKfCPq22lKBlLOlyPGUlM3IaF/I=; b=UOIch4wt5Xyeb6FXIDRt7ooKwfVeRgLK96W2XYL+GUse6b8BJ/3mkPa3fYrEwPO20F 3tJWoSg4VBnAFlt5Ba3ubfNTH4FktljBefEG6NuTkGzYAR8MqWnib9BWX+QSf/UEn12J B31YtE4MWCHcsCvg8TvcUtrymE/Yj3b/hSV4wI4+nTPV9hol2sEdgtB/CCHLqzG5htLb 0m75kdnXyqgH8FEsYXm1sB2VWMauZi/9oJV1RExUAQLUnlNGwaUybMPySx4v5Gutzuy5 JCQqZNvoqA4U0P1714bHxtKno48KFeXpK7c0QbtDceyWuJVRzDLpZ8GxTMVPAvLs84h9 Bm8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vvUjAcwi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id k4-20020a056a00168400b00690fc88e4acsi12284992pfc.228.2023.10.11.00.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 00:26:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vvUjAcwi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E7881806E4F6; Wed, 11 Oct 2023 00:26:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344701AbjJKH0F (ORCPT + 99 others); Wed, 11 Oct 2023 03:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344424AbjJKH0E (ORCPT ); Wed, 11 Oct 2023 03:26:04 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A45C8F; Wed, 11 Oct 2023 00:25:59 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72CD2C433C7; Wed, 11 Oct 2023 07:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697009159; bh=I+hjt1PIAmeTlSR8yMwMC5kINnpTg7kd2uxBgq828hE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vvUjAcwiuU1Y7Tj7a0D35EZe0SxqN+mW7fhJhdPKPZHsA7bkpi+kq6XyZgKWRJkuv wFoBLopdpeV8uJrtE3LTjN5hQ4GGXvHKw8zhDirGSmsdZTrIVkOmuPDRDKHXj1+LnL 4btIOyNUCM+4qGWuJA+oAlJPtLbETjMO8IeYC9sw= Date: Wed, 11 Oct 2023 09:25:56 +0200 From: Greg Kroah-Hartman To: Anup Patel 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 Subject: Re: [PATCH 3/6] RISC-V: KVM: Forward SBI DBCN extension to user-space Message-ID: <2023101105-oink-aerospace-989e@gregkh> References: <20231010170503.657189-1-apatel@ventanamicro.com> <20231010170503.657189-4-apatel@ventanamicro.com> <2023101048-attach-drift-d77b@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 00:26:32 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 11, 2023 at 12:02:30PM +0530, Anup Patel wrote: > On Tue, Oct 10, 2023 at 10:45 PM Greg Kroah-Hartman > wrote: > > > > On Tue, Oct 10, 2023 at 10:35:00PM +0530, Anup Patel wrote: > > > The SBI DBCN extension needs to be emulated in user-space > > > > Why? > > The SBI debug console is similar to a console port available to > KVM Guest so the KVM user space tool (i.e. QEMU-KVM or > KVMTOOL) can redirect the input/output of SBI debug console > wherever it wants (e.g. telnet, file, stdio, etc). > > We forward SBI DBCN calls to KVM user space so that the > in-kernel KVM does not need to be aware of the guest > console devices. Hint, my "Why" was attempting to get you to write a better changelog description, which would include the above information. Please read the kernel documentation for hints on how to do this so that we know what why changes are being made. > > > so let > > > us forward console_puts() call to user-space. > > > > What could go wrong! > > > > Why does userspace have to get involved in a console message? Why is > > this needed at all? The kernel can not handle userspace consoles as > > obviously they have to be re-entrant and irq safe. > > As mentioned above, these are KVM guest console messages which > the VMM (i.e. KVM user-space) can choose to manage on its own. If it chooses not to, what happens? > This is more about providing flexibility to KVM user-space which > allows it to manage guest console devices. Why not use the normal virtio console device interface instead of making a riscv-custom one? Where is the userspace side of this interface at? Where are the patches to handle this new api you added? > > > > > > > > > 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 | 31 +++++++++++++++++++++++++++ > > > 4 files changed, 37 insertions(+) > > > > > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > index 8d6d4dce8a5e..a85f95eb6e85 100644 > > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h > > > @@ -69,6 +69,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, > > > KVM_RISCV_SBI_EXT_MAX, > > > > You just broke a user/kernel ABI here, why? > > The KVM_RISCV_SBI_EXT_MAX only represents the number > of entries in "enum KVM_RISCV_SBI_EXT_ID" so we are not > breaking "enum KVM_RISCV_SBI_EXT_ID" rather appending > new ID to existing enum. So you are sure that userspace never actually tests or sends that _MAX value anywhere? If not, why is it even needed? thanks, greg k-h