From patchwork Fri Oct 20 07:21:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43329CDB47E for ; Fri, 20 Oct 2023 07:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aCMpAvkBJ/1oMtFttiDDRGrm52IaoaaOSwzwdhmMAyw=; b=zRPxWW9YZfRo1A Nh97Etc2qYZr137e2pOfjgMyW3+IItlXKSJisik8wDybTOhSfuidy20Z+6vtZ7q4bpp9CZfXFRSxW fIFRYaODNLe50Nz9v4WHcxcJU+7oYUK0Fga+LZhTZmTiIH4pr7cccS8Oa470yAqi4U4bGVVhK/6Lj HDA/6hhHkpLhRVMw5nv6uO7BZ73vGcTZRz4IVqBrLNPxlyLU3DzEB4YfIAk1FVLzLNvqkGTbDx3w0 YFDalanby00qfLLsggDiPgvQMtZMepO1RTde5hNDhXr9GX6M9ZCGt9XhJQ+Ajq5m7qXpFOEGh9bmP +2qSaKpQFHgRYtb8+EDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpc-001Q62-1h; Fri, 20 Oct 2023 07:22:04 +0000 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpa-001Q2i-1Z for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:03 +0000 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b2f507c03cso314239b6e.2 for ; Fri, 20 Oct 2023 00:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786514; x=1698391314; darn=lists.infradead.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=vFjlFx01Ut+IIk7lMz+iwDuvVBUbWHCR3u/gBbk/FU0=; b=EiHRqC0lSKmYaD75tCnAitMEFjYiHZaIaBjfGUcOpTDMwW2gYHW1IqDeRLfjXOpXtO a0ChwSc0T3ho4QSGobR0ZuRUGtXKq9HI4kq3We3WI8yrzWXj8rAkcVpIfGr0EVWGvpBO qWJ9wDzdrUk1Hqwf7E0DoHf1fcHNU30+NZ/jb3j4TYThSEwmopdkmwFAtGWEeiJof8In IUCGNrjFUUaSjAEiEsqVNuISjzEXnTkjCXQ1Na33r2nBFIc0CCQEE14pg5/25FPVZpWh IlHDs0OKW70+eMD0p+mAgjwzs1habxw9qPAVvNBYX9B2RWQNDKn9mY1cwsemDb7D4PPg zBIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786514; x=1698391314; 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=vFjlFx01Ut+IIk7lMz+iwDuvVBUbWHCR3u/gBbk/FU0=; b=l6Q4k7Bg8mFsfqlwI1STgikVa32mpOeCEKYU1tprj/854vFnIaUSM/Z2dOPVBgLyoD SUrY+QRNI7Wl6es1+fXTtnZ4SLhS5tiL2Hpk1x9EXupp17x6oCbvzCfnu4pW+yknqWfH z3rVtYIyYdl2wWMM/NY/8sikgC8gRTKDpatmE1UEkHHMSsZXTLtsr/AXmqXFO1tIltrM TuwHDk1E3353TAx5G8XP46QswXsc5Ub2DVFMNWZ9K48WJ8TknSW+O63ayY7Tt4Fsd0ss REL5wgp+JgFq/0IgULEIr6Fp3HKGwdVN5VQ4WAfB+0ZID8slJVH1pNxvsKzY0wGt/vYo Wryw== X-Gm-Message-State: AOJu0YzaaGNsBP/PLdwgoL1snZpgB+wwms/IMD+bBcuKqHjM7/VwUVo6 /d3O+uRPVt/Lc0hyyeJqPrnKEA== X-Google-Smtp-Source: AGHT+IHCf4SRFvcjUaBZbUoLW1qmUD5qW9WnhX5EFjNLnYxx3oBY2eRFWdyPRUuwwRReyZ05UhdEZg== X-Received: by 2002:a05:6808:15a3:b0:3ad:ffa4:dfee with SMTP id t35-20020a05680815a300b003adffa4dfeemr1187937oiw.51.1697786514419; Fri, 20 Oct 2023 00:21:54 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:21:54 -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 v3 1/9] RISC-V: Add defines for SBI debug console extension Date: Fri, 20 Oct 2023 12:51:32 +0530 Message-Id: <20231020072140.900967-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002202_525753_25470862 X-CRM114-Status: UNSURE ( 8.60 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org We add SBI debug console extension related defines/enum to the asm/sbi.h header. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- arch/riscv/include/asm/sbi.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 5b4a1bf5f439..12dfda6bb924 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -30,6 +30,7 @@ enum sbi_ext_id { SBI_EXT_HSM = 0x48534D, SBI_EXT_SRST = 0x53525354, SBI_EXT_PMU = 0x504D55, + SBI_EXT_DBCN = 0x4442434E, /* Experimentals extensions must lie within this range */ SBI_EXT_EXPERIMENTAL_START = 0x08000000, @@ -236,6 +237,12 @@ enum sbi_pmu_ctr_type { /* Flags defined for counter stop function */ #define SBI_PMU_STOP_FLAG_RESET (1 << 0) +enum sbi_ext_dbcn_fid { + SBI_EXT_DBCN_CONSOLE_WRITE = 0, + SBI_EXT_DBCN_CONSOLE_READ = 1, + SBI_EXT_DBCN_CONSOLE_WRITE_BYTE = 2, +}; + #define SBI_SPEC_VERSION_DEFAULT 0x1 #define SBI_SPEC_VERSION_MAJOR_SHIFT 24 #define SBI_SPEC_VERSION_MAJOR_MASK 0x7f From patchwork Fri Oct 20 07:21:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F376BC19F5C for ; Fri, 20 Oct 2023 07:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/7kJBw5U2PK5RRPH924StPWOAf0s5q6LFD1i9sKlsgk=; b=QJceGWE4iddVyX wL59NURKZDh1hXjNWEol31Jq+rHZLly7i1vwB5kQu3N4t+Nm008IPMWwDmZl7T5FJGTJScB+z9XhY dyhhpRK3Ra8hyezcZgccN/jyOrGjClkEv/f8eY+fE7c21gkmKTwx424pNSVlDzhPTizpls+uTnTke BcazKhpICkvyYtKmw/DTjEkhe8yYxz1g3RVVl+uJisDlEch5wtlrBPwkFsVRztPsG/cqH/FnMylXN OluIL+19Wm4T/QYBjtOdN3kEe4V1jTarWx2XlxzzizOI+0Qa3BRZpHAqosyNTw5aRCOU8loSiw8yC bcoyg7siGPPyLz80GkTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpf-001Q7g-11; Fri, 20 Oct 2023 07:22:07 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpc-001Q44-1u for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:05 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6b201a93c9cso469231b3a.0 for ; Fri, 20 Oct 2023 00:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786519; x=1698391319; darn=lists.infradead.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=eeCDV01Cfgp2ua0LgBWyAWr2dv9+xpkaYGG6VewjHJM=; b=QI8TY+F6nm6sA1qOqa9e5etqgdai/9VjKucjakjV4bMZ+e/BktspmtNZRuHrAJwEZ5 oRMlaPGxJqV2VslLk61iT7F8+DYgxJPiWxSABPXczQ4PmqJStcSnYO2c76OeBOsErDq+ UAjqstFRd1k9xmjru87nsNi7wSf45ExOLRYb8zEVflUMZaUQM4zUX0YssnIB+1le3nCU rB8cViC9vO6kTFbtBk7PnKEyOAhy5Crht7jyDu18z4FxCkP+MIFEM5GdcWh/VpH1EJ14 nlBS0vWBTWX+2NmngWhJRyYB+xGDebPRRqwBJzePYlEIptepc9cDLVfzd8Qr7/7Sq75O aruw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786519; x=1698391319; 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=eeCDV01Cfgp2ua0LgBWyAWr2dv9+xpkaYGG6VewjHJM=; b=nMUyxDotVWGrckj50bpWydSmGYjhHCQuCXWCvIZwQGWwHrlHwx0X1CSxw7YMTLTbI0 AmU97zfkIiRYsLdpjRI+U4jnFI59a3j8+WUG7N9XEgFIdwt1iBBxHZ7o2KxYF02a0tpi +ANFzDgFECFD69AwTD1bxJ9kxD6NpujigJvZzbW0e9a19BD6hSezr7hj7hc5GtUkt7Q9 PlNl+Gh5/1dhEYXKPl38cjRyydlaShV0OVppv1FDmmIs4vCNduMp6Njd5Ywg05mJ1Yic ZLwPIFlNQcU/hm8H4GYXdoaN4zr24p/zYUHXI6TIQGjTAqHTK4Qk+ImBDgMrDD5Mq/qa +mYA== X-Gm-Message-State: AOJu0Yye2alFSRs2SJMw0yIsuqZomRlj7TKXqHR6nZy/lYq/45ju2ywa rvdbI4VuRJSKE+F3Tiuk/6auLQ== X-Google-Smtp-Source: AGHT+IHW872RFsEW0M8OTGxKAzWnTo/8F6Le59a6yN6WSYq8GfyXYOW1jHmUi8NhTnVPlD9i+6DmJA== X-Received: by 2002:a05:6a00:b8e:b0:6be:4789:97ba with SMTP id g14-20020a056a000b8e00b006be478997bamr1029478pfj.3.1697786518893; Fri, 20 Oct 2023 00:21:58 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:21:58 -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 v3 2/9] RISC-V: KVM: Change the SBI specification version to v2.0 Date: Fri, 20 Oct 2023 12:51:33 +0530 Message-Id: <20231020072140.900967-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002204_649643_96AD0664 X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Andrew Jones --- 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 #define KVM_SBI_VERSION_MINOR 0 enum kvm_riscv_sbi_ext_status { From patchwork Fri Oct 20 07:21:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74599C25B40 for ; Fri, 20 Oct 2023 07:22:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fDZfZ5oWdW3cobVSlGOWDTL7Iw9n5qaVV5L0KDzd/tA=; b=EUP+wg55L2Pj3i K3KBCiVlpvc3rosHz7e30KSVfJl5tgy5wozCc1qHFrVE29C5AFQuaVOlTjZFHV21L7DMwTwO+1I14 8nZdm/dwLICi2GXuJoI3WS11zvOI0syaGLK8I5HyzkmktgaaTdy5vb2L0cYDL6UJIpVq5GBSnfYrU HMUKAr2W6WOwh00m19jNYd5UsSfCe2JwO32Xf5YJwSYSggaAGPjZv90L3vc63ko3J2Un+Pqr+kAhl 0BY6zDTEo+59UhodrwvItQG0ejfDR+K7/BJwiKUcMfxzxA39BEXF8V53/ZvjlPYBHed8llfd7Qt+k 5obVt8biSznfgd6cgq0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjph-001Q9V-2w; Fri, 20 Oct 2023 07:22:09 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpe-001Q60-2Z for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:08 +0000 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6b89ab5ddb7so513377b3a.0 for ; Fri, 20 Oct 2023 00:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786524; x=1698391324; darn=lists.infradead.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=m3zCDz3wNvDFZIfhQp3mdMMGRfliX9zzX2s9SoD5fk8=; b=DouDe7jxhPfvnZlQi7OFS0ePeoWqkQjiu0pIpIXqXl0NtEWVjnVRrRYTjpqxGRtUWC UiKp/Vbs/juHosVKv6q6ZT8v9qPhqzwnX4i5Hv4tyhq7wv8AAsPX1syRVoSptGgKrplU lX96ICxatmYFrp26Bnt9xvyah8jig6bnIoxNH+LbQSkgd4/27kAlkP1TBUS0r31JhsAG EudSfR1OHXTf4iyE3hyQmkmUzuSPvRDawdOOu4igY+r0nniDlxaACeu0H7/LrD5fMe5d 2Abe0YNj5RMs7pKuE563Yu2V6q+schyI+d8xLLWdMTJ7S5pprckpq/BRvGGk3QvNchnL +YzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786524; x=1698391324; 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=m3zCDz3wNvDFZIfhQp3mdMMGRfliX9zzX2s9SoD5fk8=; b=UKp55/sYbOE6vpiEQHPa9v/jjMHRfxhFkt+v8ascebuyyboYIRj5npkyzGBh/GJ1xz Nn5KoVOYOeScVKpWXVyKVV1etHLKurlrjBBENkOnqLg/VaogGVF1UBQJrY6/2qljfmb9 ZMhqSYRR0o7VD/5p1DIGsKOuCBnY9NIwOmdxRjNQesOF7lvCWuNGVjw9SaaxkFIgnWGL v1vmdn/eL59yVM9DTiymMfK4N1kud87/qNNPEfENE8DWkagCioJK8nOoP7BES7kZQWLg wI9Q2Sklq5zhVFjtLeqztLhIaJKB+WEFxA81bu1izRvb+ANdOMIkFugHoDGnCCik5Les 0g9g== X-Gm-Message-State: AOJu0YznIEfIb/rec2gI6xepZn1431V0lhgReTRexA/sP+sUBlr6kSQG tiTdshM9uQCvmTJW3S7Zat6GtA== X-Google-Smtp-Source: AGHT+IG244Unqcch61/RKDkaln/AZV8DtWkK/fAUAz824/pCQp9YvCbi/8qrpjv0yroTiFuFOsikCg== X-Received: by 2002:aa7:962b:0:b0:690:38b6:b2db with SMTP id r11-20020aa7962b000000b0069038b6b2dbmr951624pfg.6.1697786523600; Fri, 20 Oct 2023 00:22:03 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:22:03 -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 v3 3/9] RISC-V: KVM: Allow some SBI extensions to be disabled by default Date: Fri, 20 Oct 2023 12:51:34 +0530 Message-Id: <20231020072140.900967-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002206_834237_EF5288AE X-CRM114-Status: GOOD ( 21.61 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Currently, all SBI extensions are enabled by default which is problematic for SBI extensions (such as DBCN) which are forwarded to the KVM user-space because we might have an older KVM user-space which is not aware/ready to handle newer SBI extensions. Ideally, the SBI extensions forwarded to the KVM user-space must be disabled by default. To address above, we allow certain SBI extensions to be disabled by default so that KVM user-space must explicitly enable such SBI extensions to receive forwarded calls from Guest VCPU. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- arch/riscv/include/asm/kvm_vcpu_sbi.h | 4 ++ arch/riscv/kvm/vcpu.c | 6 +++ arch/riscv/kvm/vcpu_sbi.c | 57 +++++++++++++-------------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h index 8d6d4dce8a5e..c02bda5559d7 100644 --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h @@ -35,6 +35,9 @@ struct kvm_vcpu_sbi_return { struct kvm_vcpu_sbi_extension { unsigned long extid_start; unsigned long extid_end; + + bool default_unavail; + /** * SBI extension handler. It can be defined for a given extension or group of * extension. But it should always return linux error codes rather than SBI @@ -59,6 +62,7 @@ int kvm_riscv_vcpu_get_reg_sbi_ext(struct kvm_vcpu *vcpu, const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext( struct kvm_vcpu *vcpu, unsigned long extid); int kvm_riscv_vcpu_sbi_ecall(struct kvm_vcpu *vcpu, struct kvm_run *run); +void kvm_riscv_vcpu_sbi_init(struct kvm_vcpu *vcpu); #ifdef CONFIG_RISCV_SBI_V01 extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_v01; diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index c061a1c5fe98..e087c809073c 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -141,6 +141,12 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) if (rc) return rc; + /* + * Setup SBI extensions + * NOTE: This must be the last thing to be initialized. + */ + kvm_riscv_vcpu_sbi_init(vcpu); + /* Reset VCPU */ kvm_riscv_reset_vcpu(vcpu); diff --git a/arch/riscv/kvm/vcpu_sbi.c b/arch/riscv/kvm/vcpu_sbi.c index 9cd97091c723..bda8b0b33343 100644 --- a/arch/riscv/kvm/vcpu_sbi.c +++ b/arch/riscv/kvm/vcpu_sbi.c @@ -155,14 +155,8 @@ static int riscv_vcpu_set_sbi_ext_single(struct kvm_vcpu *vcpu, if (!sext) return -ENOENT; - /* - * We can't set the extension status to available here, since it may - * have a probe() function which needs to confirm availability first, - * but it may be too early to call that here. We can set the status to - * unavailable, though. - */ - if (!reg_val) - scontext->ext_status[sext->ext_idx] = + scontext->ext_status[sext->ext_idx] = (reg_val) ? + KVM_RISCV_SBI_EXT_AVAILABLE : KVM_RISCV_SBI_EXT_UNAVAILABLE; return 0; @@ -188,16 +182,8 @@ static int riscv_vcpu_get_sbi_ext_single(struct kvm_vcpu *vcpu, if (!sext) return -ENOENT; - /* - * If the extension status is still uninitialized, then we should probe - * to determine if it's available, but it may be too early to do that - * here. The best we can do is report that the extension has not been - * disabled, i.e. we return 1 when the extension is available and also - * when it only may be available. - */ - *reg_val = scontext->ext_status[sext->ext_idx] != - KVM_RISCV_SBI_EXT_UNAVAILABLE; - + *reg_val = scontext->ext_status[sext->ext_idx] == + KVM_RISCV_SBI_EXT_AVAILABLE; return 0; } @@ -337,18 +323,8 @@ const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext( scontext->ext_status[entry->ext_idx] == KVM_RISCV_SBI_EXT_AVAILABLE) return ext; - if (scontext->ext_status[entry->ext_idx] == - KVM_RISCV_SBI_EXT_UNAVAILABLE) - return NULL; - if (ext->probe && !ext->probe(vcpu)) { - scontext->ext_status[entry->ext_idx] = - KVM_RISCV_SBI_EXT_UNAVAILABLE; - return NULL; - } - scontext->ext_status[entry->ext_idx] = - KVM_RISCV_SBI_EXT_AVAILABLE; - return ext; + return NULL; } } @@ -419,3 +395,26 @@ int kvm_riscv_vcpu_sbi_ecall(struct kvm_vcpu *vcpu, struct kvm_run *run) return ret; } + +void kvm_riscv_vcpu_sbi_init(struct kvm_vcpu *vcpu) +{ + struct kvm_vcpu_sbi_context *scontext = &vcpu->arch.sbi_context; + const struct kvm_riscv_sbi_extension_entry *entry; + const struct kvm_vcpu_sbi_extension *ext; + int i; + + for (i = 0; i < ARRAY_SIZE(sbi_ext); i++) { + entry = &sbi_ext[i]; + ext = entry->ext_ptr; + + if (ext->probe && !ext->probe(vcpu)) { + scontext->ext_status[entry->ext_idx] = + KVM_RISCV_SBI_EXT_UNAVAILABLE; + continue; + } + + scontext->ext_status[entry->ext_idx] = ext->default_unavail ? + KVM_RISCV_SBI_EXT_UNAVAILABLE : + KVM_RISCV_SBI_EXT_AVAILABLE; + } +} From patchwork Fri Oct 20 07:21:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C214C004C0 for ; Fri, 20 Oct 2023 07:22:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X/ftt2RJESj0DBWOr2gxHDaXAMmmCs92dmrKEPzMSQo=; b=rMbVAwI8OngtmH 6jOIktqf3PpzYl9WLo66dcXlAGeBygLuaGahKcfXSDrEYy6errL1emFVQ87fC7NbG3UXHIgUmVTVr eto87hY6I7VZB0rGRAO14mt+F0bYuObVEg2zCTXH92XUGjiV1d8Uj0pT4I1Uh0YEkbC+wQ6lYj/6o HExHEB0srlnLLw76hcgQ2fWEMJGi2XIuSUJJFPk4c4RTcYWx/j2NZp0IoSZm10kElBvyMD8Sq8AQM b75owCCUbOVqmdx1tO9VwYQKhOcWMjtp3epuOWWPkl0XhuL7NvTJAyANfyU+nHHKi3Nk2zTOD+Gfu T5T56ZSx6t9sYP520Skg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpk-001QCC-2u; Fri, 20 Oct 2023 07:22:12 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpi-001Q8n-14 for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:11 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6bd96cfb99cso456078b3a.2 for ; Fri, 20 Oct 2023 00:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786528; x=1698391328; darn=lists.infradead.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=hO8QQxSKIIq22xFRYvu7Gu8eaqjv2hPcSOTMD/z9e94=; b=hRSKNmYKELDJPapfGv8UIYaSsl5Vh5ToB8Ee7fFLY5+iJ5zHcOWztKVkuXZlTojVp7 /vsrRWk4Qpr6vg5xuwfMFhMkuo20bcz5GdBaeVGA2Huk310aGT4LcpNNJJcZkdzMMMia gc8zLmb7xD6sVYpHdVASVKbObkZ2881MWBFjmFK20Irbf2/9HrLfZN/5yrZpovjD+MZ1 N+7PpDCr5z7ZlG+G9Jm/Jcp8SArAaiRNzkdONnWaEQ8U5bGgsIDpKIfsv3euOr+gmI9U GH+jEi1RJgkALI8EhULH+l2c7i5D+7z5TBeOh+8PXFDlnxAJ1J/6QLBQQV14JGIwgSaR F7tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786528; x=1698391328; 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=hO8QQxSKIIq22xFRYvu7Gu8eaqjv2hPcSOTMD/z9e94=; b=QIlzDmw8KAgvhClIDctl8gigLJUVER0l45dPe5Yl17VmuNLFlFdIPMAxF1A507vmKk LevzV2uS+454u+7LiL3qQ5ntUTTU0fwXtxBdqCaGJv5DNmmzQo3D4FPGsywB+JbmDsDp M+nGCgQhJ4wW4BkNxNSByv6mvLnrbUmjg0yUJ4N7zMZKwrDqRDRO9GRobVJdyn2QxJb/ nWtWE+kKUAidesEkYFgTaGG5bt390MLOoNXw2gRoUsQEpiREboTX+1tSNHch5DpVsUfQ qnQdCedetYUCUAOInuqeS7nHZD0Km8rk+sXaQNl4eYJEXDOEuvccoKzbwdBBuHKj/20f 1vzg== X-Gm-Message-State: AOJu0Ywbf50ufp1AKqEnedlE5jbqIKdPvNobBr4xeFY1Xjepg402gac0 mO2kU7txLKnbV81dc96k9tu8EQ== X-Google-Smtp-Source: AGHT+IEkj9caZAnNIJ+YKQHJFuBSd9R4KVCbXPxdNGw5YMPQO4SC5tQtDdGdQxSt48V7VnxE9x8JkQ== X-Received: by 2002:aa7:9622:0:b0:68e:42c9:74e0 with SMTP id r2-20020aa79622000000b0068e42c974e0mr952140pfg.3.1697786528093; Fri, 20 Oct 2023 00:22:08 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:22:07 -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 v3 4/9] RISC-V: KVM: Forward SBI DBCN extension to user-space Date: Fri, 20 Oct 2023 12:51:35 +0530 Message-Id: <20231020072140.900967-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002210_388570_A7377BCB X-CRM114-Status: GOOD ( 13.85 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Andrew Jones --- 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, KVM_RISCV_SBI_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_sbi.c b/arch/riscv/kvm/vcpu_sbi.c index bda8b0b33343..a04ff98085d9 100644 --- a/arch/riscv/kvm/vcpu_sbi.c +++ b/arch/riscv/kvm/vcpu_sbi.c @@ -66,6 +66,10 @@ static const struct kvm_riscv_sbi_extension_entry sbi_ext[] = { .ext_idx = KVM_RISCV_SBI_EXT_PMU, .ext_ptr = &vcpu_sbi_ext_pmu, }, + { + .ext_idx = KVM_RISCV_SBI_EXT_DBCN, + .ext_ptr = &vcpu_sbi_ext_dbcn, + }, { .ext_idx = KVM_RISCV_SBI_EXT_EXPERIMENTAL, .ext_ptr = &vcpu_sbi_ext_experimental, diff --git a/arch/riscv/kvm/vcpu_sbi_replace.c b/arch/riscv/kvm/vcpu_sbi_replace.c index 7c4d5d38a339..23b57c931b15 100644 --- a/arch/riscv/kvm/vcpu_sbi_replace.c +++ b/arch/riscv/kvm/vcpu_sbi_replace.c @@ -175,3 +175,35 @@ const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst = { .extid_end = SBI_EXT_SRST, .handler = kvm_sbi_ext_srst_handler, }; + +static int kvm_sbi_ext_dbcn_handler(struct kvm_vcpu *vcpu, + struct kvm_run *run, + struct kvm_vcpu_sbi_return *retdata) +{ + struct kvm_cpu_context *cp = &vcpu->arch.guest_context; + unsigned long funcid = cp->a6; + + switch (funcid) { + case SBI_EXT_DBCN_CONSOLE_WRITE: + case SBI_EXT_DBCN_CONSOLE_READ: + case SBI_EXT_DBCN_CONSOLE_WRITE_BYTE: + /* + * The SBI debug console functions are unconditionally + * forwarded to the userspace. + */ + kvm_riscv_vcpu_sbi_forward(vcpu, run); + retdata->uexit = true; + break; + default: + retdata->err_val = SBI_ERR_NOT_SUPPORTED; + } + + return 0; +} + +const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_dbcn = { + .extid_start = SBI_EXT_DBCN, + .extid_end = SBI_EXT_DBCN, + .default_unavail = true, + .handler = kvm_sbi_ext_dbcn_handler, +}; From patchwork Fri Oct 20 07:21:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67B4CCDB47E for ; Fri, 20 Oct 2023 07:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6SA+Glo82LRSM0liZHGepHgE4HuhOX8yiAFj0Dv6zg0=; b=bi744MgOB20UO6 wDpmqfJUjWBrLbzNef93i1Wniyrkor5RUJweyezwDUugGHv9N2+SVWvBwpnn/WYVrhmjjoXy5s6nK FaoYBO38fPJlZHgjiZqvzZhRm/PbgrqqcTentOt8rdfX8cavXi5EwcMslHY+N97YyM3xFmZeQ89E0 fgoR9huVI06i9XXff9dEJW/fZO8AyxA6vFys1+YeNnmDSOYV9JoqxPQW8L+LV30zu0R4mxhvBRaxE p5S6WKop8XKx2rQ8Z8wFhcblGH5l2RG80Nwnd2ekBEh3kvMGRbhE8KAE+zazZhPF/vOIXrkTzUxR9 AH16qPd9o3I+Dqo6h3ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpo-001QFG-26; Fri, 20 Oct 2023 07:22:16 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpm-001QCW-2E for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:15 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3b2b1af964dso384571b6e.1 for ; Fri, 20 Oct 2023 00:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786533; x=1698391333; darn=lists.infradead.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=7XKdexmGCdd2bnnrJTDfux86dDbyR62+1G32W+zioUE=; b=X39BuKKc2dT75Xd4KPHqPolJ2bWSNwAo7bX/ai4G7aLcC5fhZ3iDsKAInwWPtnW1mB P49ovMhhMxY1Jv8jLlecFVnJGIsLtN5ry5lfGpDZDFPObtmn3nSvOJOBoWZDZYjtTx0z Dr8yXCrWRlE53dElvYAQfms108NsdYYT7GuV2qfz44rFLSIuwYctzb/jiG03ftiRp+O5 lpbP1y9vnPTcdE0uWJvvt2wx7u4SJ6yn+NWU9Mr0wI7NhzPZmGpNtf0LZ9dA7XTqzxYb oGOMVn9LN+4IBs8LrMZ0vwbm768fTdwJx+qnoEDvSHR7idehb02dHoBwPXhWSwGQbQFz fx2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786533; x=1698391333; 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=7XKdexmGCdd2bnnrJTDfux86dDbyR62+1G32W+zioUE=; b=WXi+5TLx4Qgyk4lg3fAniaPzdw8GTeUNJK0sBANO31/3R4BvaHIskJLQgik4YnWZYs YvUGogjoh7CyTLQ1M3Td33W71Ha0hneGdl+DUw4+08Ih/NmyzdI1t8dRYWSIOFAkxaH1 Sn+SMYE7r29pCp5BSINEGAS4/NyrJTxDHRe59JQ3sU1b56X7hEROoFGtLXnFAtLrhRM3 0qpBXJcMfxs7rDJEMSd5WmRizyvh0vZxNXZcs00lCf+w34wHq/4x+2ciCrTw7isb/TWg xxSMw5iW50S6HS3+S/n0QV8hftq3cpFDvCvf4894m4rJ/wtCNgJE9r1ZbSVAvnK//pKO e23w== X-Gm-Message-State: AOJu0YyCvUFc7ycyrunhjuJjYPqcHLi/NHZ7VJRqVDVpi03x8/GXotDQ DE8ynble/d37+fLbYKEvqUJxVw== X-Google-Smtp-Source: AGHT+IGNA3teY62UcK8wOWxlnmVNiOGXjjS4KNoIU7oF6NdgPgGX2+CnnNq3uwbgRObNWcOANMq+ew== X-Received: by 2002:a05:6808:144d:b0:3b2:dcff:9e54 with SMTP id x13-20020a056808144d00b003b2dcff9e54mr1358519oiv.24.1697786532716; Fri, 20 Oct 2023 00:22:12 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:22:12 -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 v3 5/9] KVM: riscv: selftests: Add SBI DBCN extension to get-reg-list test Date: Fri, 20 Oct 2023 12:51:36 +0530 Message-Id: <20231020072140.900967-6-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002214_728935_39C22BCC X-CRM114-Status: UNSURE ( 9.12 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org We have a new SBI debug console (DBCN) extension supported by in-kernel KVM so let us add this extension to get-reg-list test. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 234006d035c9..6bedaea95395 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -394,6 +394,7 @@ static const char *sbi_ext_single_id_to_str(__u64 reg_off) KVM_SBI_EXT_ARR(KVM_RISCV_SBI_EXT_PMU), KVM_SBI_EXT_ARR(KVM_RISCV_SBI_EXT_EXPERIMENTAL), KVM_SBI_EXT_ARR(KVM_RISCV_SBI_EXT_VENDOR), + KVM_SBI_EXT_ARR(KVM_RISCV_SBI_EXT_DBCN), }; if (reg_off >= ARRAY_SIZE(kvm_sbi_ext_reg_name)) @@ -567,6 +568,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_PMU, 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_SINGLE | KVM_RISCV_SBI_EXT_DBCN, KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_MULTI_EN | 0, KVM_REG_RISCV | KVM_REG_SIZE_ULONG | KVM_REG_RISCV_SBI_EXT | KVM_REG_RISCV_SBI_MULTI_DIS | 0, }; From patchwork Fri Oct 20 07:21:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A5E8C001DF for ; Fri, 20 Oct 2023 07:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4wdMeY9cFvHnJWxQMRCA0B5r5eieNCS4YpHUxu11EMM=; b=aSS2WXtVKGnw1L Cu3IV30xssK2XkIAoFznymVIoLfPIUaDiH5Xhg7y+UM84LWM9VXF3ywJLI9GjFTq0hdF6OKuNEkKs vJe3IitEFOClirikbPMjtQR6wZtbTqQCRWg+qxzsj8jMDivfuH1F5jsO6uu4GDm9lSluvwKZ927fi DNdcfaup25VpIRZGll0e2lQWfE5V0kU0QWaX+qbSUSEkNzsz/Ua73xjroazlKqNq0bbnwCpveLMn4 uQoMraYElHV5FjUWzNoVrspQVGh+LvAyyqYxLbncj4boKn/d8qvE/6nkYd+6HW3RsJHzDmPgq+8ev 6o3V56wBbU4wlz0ADtjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpv-001QKU-0V; Fri, 20 Oct 2023 07:22:23 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjps-001QGG-1e for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:21 +0000 Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-35748b32d73so1841575ab.0 for ; Fri, 20 Oct 2023 00:22:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786537; x=1698391337; darn=lists.infradead.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=MwlyMPcz0zqeFoKpmeSvnyAhcAgahoPS/k2EPhyd9Ww=; b=LNEP+bTpC093DJS8sonX6gQ7hZBexK9o7735+S+gxR0VgCO2dhfFwHKJ7B/mWw47DN rkVURvaS0MwaEzahIHvZML5CEokT9pq4Bo7RZeG/12f5x6t7/bi80h7o8rlgrA5xu6BH 4mvu7mid3YSaUbk+iQvikQtJ01HVsKVz7Tcywd2X0Ge+IUglji9wh8WpKqzAXEPrm3jh wnE37fgII6KrXK0XQzfyrGzeJxaqMS+dPNG+F0Izqg1EG06lQFlsMxkw7j+eMgrdBLn1 YosolcbfmhkzY/MG4Lgsvod3aAZtbfLRoSG8/MS/uby5nut3yiFvjSkjJcCAnrbHUd2H UpSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786537; x=1698391337; 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=MwlyMPcz0zqeFoKpmeSvnyAhcAgahoPS/k2EPhyd9Ww=; b=VXZ4BSatdyICfYzlmtnJVerUGyX6pbtTX+EgxdOylMkx57qorep3rL3JL3NBOBa0b3 5zoFB/27QT3ERc+X6tnhFo6U4F9RVv1WVOArBc6yOcvj1u5SmEaMZnaoCwozbpSQUnAy jDn2r2Id6bAI8xq/JnuXvPMiI6CUe9tsmYINy7kHRrCIwLq3L+naryH+SgWLaKSjDL99 xDumCmqK/EulLRPq1rtnvtUA3OZ/1SWiJ+eZHesBWZaflYltZuC0ID21awPBFAFPkBPf nl3WBjhTbe30/Q3bF2nPiuQVfm8wQLDnhJoYcZnjZqCz5izSCzVAKOgu+um7ajDmXjO1 qShg== X-Gm-Message-State: AOJu0YyhO9MYM00KE9lk6j+AmhT5JYsvoyV31aFLsPWKeaB6cxT4i21p nCPzDQ9MUNYggsfVUl7P+haLTA== X-Google-Smtp-Source: AGHT+IGxC63+68DtxcLP2NLHVLlq5o7kgQhRaiJb+wOy0CTSQu3yay0cbuJzx5Z+DRUCCNZLZovnkw== X-Received: by 2002:a05:6e02:1748:b0:34c:e16d:6793 with SMTP id y8-20020a056e02174800b0034ce16d6793mr1508711ill.14.1697786537209; Fri, 20 Oct 2023 00:22:17 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:22:16 -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 v3 6/9] RISC-V: Add stubs for sbi_console_putchar/getchar() Date: Fri, 20 Oct 2023 12:51:37 +0530 Message-Id: <20231020072140.900967-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002220_547036_51C9483B X-CRM114-Status: UNSURE ( 9.07 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The functions sbi_console_putchar() and sbi_console_getchar() are not defined when CONFIG_RISCV_SBI_V01 is disabled so let us add stub of these functions to avoid "#ifdef" on user side. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- arch/riscv/include/asm/sbi.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 12dfda6bb924..cbcefa344417 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -271,8 +271,13 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, unsigned long arg3, unsigned long arg4, unsigned long arg5); +#ifdef CONFIG_RISCV_SBI_V01 void sbi_console_putchar(int ch); int sbi_console_getchar(void); +#else +static inline void sbi_console_putchar(int ch) { } +static inline int sbi_console_getchar(void) { return -1; } +#endif long sbi_get_mvendorid(void); long sbi_get_marchid(void); long sbi_get_mimpid(void); From patchwork Fri Oct 20 07:21:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0C68C07480 for ; Fri, 20 Oct 2023 07:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lL65OarzLHumfu8rkfQ9gXf3sBuDCIaRrMSv290/jEY=; b=pvnYT5EaDd3XK9 HDrnm+W61emYHCJXmFp8sK+iW2mRwg3oba5NuSdA6nnz/Ck0J5RY/YBwC60x2/fyRwBi21R4pQih/ QtqmQSAsMADbR9B9IP3JtqJzo2/g99GP0oLv4gbl/4TcJE/CYnLNGDCiNIDw842QRakMolFowhsGu VNE1hn/Uf+RlCiFQJEUJn7dsrQTlY/bVSPWsKQJ32+JPvMvAd9eKRu34VHRxqkZrTLG4em+zxQF57 UK0cr3xFaU/FmoGLnR5OYDksWy6TxBXh0DjHn+Rl1F1BRvtmyvBfUVmHaAka0+pdbU1K3V/mFQ9pE IMcvUhgGU9NfVqRQEqIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpy-001QNN-0d; Fri, 20 Oct 2023 07:22:26 +0000 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjpu-001QJZ-1S for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:23 +0000 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b2ec9a79bdso379791b6e.3 for ; Fri, 20 Oct 2023 00:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786542; x=1698391342; darn=lists.infradead.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=y40VDpa5tFn1F2iuJCGX0eAdf56bF4H2v7CDU5J7JlM=; b=FjkEtfmY2HhGrYZFzokvdmJS1WKFJcOMt0fz6tSuYyQrHNO2CTwYvRVadw49KM6qvW MvLTqeZII9+vJjhJvcFCGUNBs21Fr9aPqBy5sSO8s9jMSDAQxMm3u3Sa69hrVscPZ/+g kYJyRtByzor92GWwK4dOuh5QNLheyV7ZRy+JuN+twIRNNSajaEwkUCjAnwCAyUAnlWcF fSC5yCy8nn/BRgNk55Hmpel3cfVqe+Q1gySLPKZI0rw+F8VVyLbCFeC4qWz5ieCG99/g +Xkj1+og1eXB/vtidt1b6OwWx0w3rWOS6BstuAE+U1a8j5gp4WNDKuJmcykFF/CcMlLe GfKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786542; x=1698391342; 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=y40VDpa5tFn1F2iuJCGX0eAdf56bF4H2v7CDU5J7JlM=; b=Ej29BMgMB5rEUQRtfwKtCybgXQ6kIIRwsAW+vwvFgUelw6ggVCH4L/eJ2m/MhMpf2T j2/Hcj8+IhCiPUdaYKVJq7VUJoQtI5ZplARgyfG9nY3KSPlZkZPg+YnAdI7FjhbEy4Fw 9vbJ7lCMqIT6cJGuWAHJ3FO46Q9FjRMYNKlzY/P0GXRyLpe5Uge9JgFWJKlG44vPj5oL b7aoZgXE+IXyJ6zj9sAMfrOXd65usJPWh8LOJp/xUTJKH2iUNxMJUtMQC85P57142Bo5 eRf7VL+BeShrH+c6OH2mYSSAXyE+UEy47LqXpO6eynN0ifQgJ3mRGMvdV+6FrCVPhCPN oEug== X-Gm-Message-State: AOJu0YwP+7g9p7sv53Avy0ig2+7Kzq7yqAFuGwleRiRSKkHyAOlflYVD a6zBvc80cqmxC2Q/KBKdZJSn/g== X-Google-Smtp-Source: AGHT+IEUQYK4G0+aPnRjUR077ELz4RoscN7PlFXPrhd3l1/3Dp5w/UYmiQBCTNoQsdXF4g9TKR4q0g== X-Received: by 2002:a05:6808:55:b0:3af:d7dc:a47e with SMTP id v21-20020a056808005500b003afd7dca47emr1067018oic.42.1697786541699; Fri, 20 Oct 2023 00:22:21 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:22:21 -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 v3 7/9] tty/serial: Add RISC-V SBI debug console based earlycon Date: Fri, 20 Oct 2023 12:51:38 +0530 Message-Id: <20231020072140.900967-8-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002222_487022_5DB86765 X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org We extend the existing RISC-V SBI earlycon support to use the new RISC-V SBI debug console extension. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/earlycon-riscv-sbi.c | 32 +++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index bdc568a4ab66..cec46091a716 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -87,7 +87,7 @@ config SERIAL_EARLYCON_SEMIHOST config SERIAL_EARLYCON_RISCV_SBI bool "Early console using RISC-V SBI" - depends on RISCV_SBI_V01 + depends on RISCV_SBI select SERIAL_CORE select SERIAL_CORE_CONSOLE select SERIAL_EARLYCON diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/earlycon-riscv-sbi.c index 27afb0b74ea7..c21cdef254e7 100644 --- a/drivers/tty/serial/earlycon-riscv-sbi.c +++ b/drivers/tty/serial/earlycon-riscv-sbi.c @@ -15,17 +15,41 @@ static void sbi_putc(struct uart_port *port, unsigned char c) sbi_console_putchar(c); } -static void sbi_console_write(struct console *con, - const char *s, unsigned n) +static void sbi_0_1_console_write(struct console *con, + const char *s, unsigned int n) { struct earlycon_device *dev = con->data; uart_console_write(&dev->port, s, n, sbi_putc); } +static void sbi_dbcn_console_write(struct console *con, + const char *s, unsigned int n) +{ + phys_addr_t pa = __pa(s); + + if (IS_ENABLED(CONFIG_32BIT)) + sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE, + n, lower_32_bits(pa), upper_32_bits(pa), 0, 0, 0); + else + sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE, + n, pa, 0, 0, 0, 0); +} + static int __init early_sbi_setup(struct earlycon_device *device, const char *opt) { - device->con->write = sbi_console_write; - return 0; + int ret = 0; + + if ((sbi_spec_version >= sbi_mk_version(2, 0)) && + (sbi_probe_extension(SBI_EXT_DBCN) > 0)) { + device->con->write = sbi_dbcn_console_write; + } else { + if (IS_ENABLED(CONFIG_RISCV_SBI_V01)) + device->con->write = sbi_0_1_console_write; + else + ret = -ENODEV; + } + + return ret; } EARLYCON_DECLARE(sbi, early_sbi_setup); From patchwork Fri Oct 20 07:21:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52D0EC001DF for ; Fri, 20 Oct 2023 07:22:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RxUoBfu5xXaN5YTWAU/Ln4fIMUMOq/5avzS2zn69mew=; b=uz67SQxV3OyiBc TfvwuGFYsBFL5Okiiz8vLO4pXJIKMw/i7jy2eWWh8CGlIDqoZ9Q0Ox66oyqgKAYtBrb5eD8rh0yqH BvFUKtRKheUWD2yw9sAf2E31wUzdVvRRKfj6v8w5sn++mGRYoOe4YeYLG2AKRltkhZSfwk3labJyY VvtI6jx0HljbJqKgmoLAKCLulboc6VntMIaMNCEia8+WQu7bYVX1BXPyCWRM0221fmLXwpWbfDiIB S+NJNggzwUGrdWKuT+JS/BMzxktaew+KQkvIddZ81dT1EYWje5y0KlmrLTSz4kEdPNxI86P+6c8l3 mTAYVK0SKoaUTqYH2Lzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjq8-001QVm-2V; Fri, 20 Oct 2023 07:22:36 +0000 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjq4-001QNq-2J for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:35 +0000 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1ea82246069so346629fac.3 for ; Fri, 20 Oct 2023 00:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786546; x=1698391346; darn=lists.infradead.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=jRerAerNbb8Gix3xbbzThpKCfwsEd5HQVNj+VzWX/14=; b=M7pttKomrGE2ugAYXP4SxzJEf9SB5Sm95fLX23Xb4DGsuIPOLwUBQzeXfrgMnJizky lP4hM95SbYk1cNxzHDitUoVM/PMfb9bzltTQzH69/7zV23HVav5rbfUNhYruSTlv9xMr Pb35FZaI/95SC2TPCriDGOjrpnBw2mcM8OaeOewogrm5lrLkT7LCVWZx8SRsOZzvC050 fi6S5p9d42cSsIt/Oi+AQ7j2WdWkqzpA26b+567doi+FujYDt57caK0O74ENWaO4nNmi 41Oao8nMQzppd8xowpwnHkNsu9a0Yysnr/PjMgB3UUT15IuRQUEf9BbPN2pX5FPBque3 oWNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786546; x=1698391346; 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=jRerAerNbb8Gix3xbbzThpKCfwsEd5HQVNj+VzWX/14=; b=NfQ8o+xRN8wJppcXwOIgYjSj61Fhv4UDb8UImgrQ8wihus7hra55nH/ZKggkIZqUFu enVgMvn9wQLgr+zZrYWtJ6XCHs+A7l1PbixJ897dUGvAD8y20uxoTEX/PGYewZRaUWVI kHf1p3q3dHxwySkv0KGtUwy/HUpbk+H7mtlQIhNJWDTTdT8XZp8tZWQvA89FcXCk4OGz kER1cK7HzoHrPuyOczl6gtgY5WaU3VKfPEUjSA15mI1Po7ccU+36wUXp2TyD9QeYjMSm 7J8lv6lKP7ATn6yNKRjlNXGtkGG3Q+lp5Ttm33sqJZD+VNXHVHJ6M3ApiXHFVVgfIkJX v5Ug== X-Gm-Message-State: AOJu0YzfW//59n6P3weY9hQkoAIkEoMJ+CHulhcnxC0ybHMGzIEx+tjq v97M/ixBJa5kVlYiA2As7hlYpw== X-Google-Smtp-Source: AGHT+IGbj7Rt6bShDAUFanmC108dgduwjhSl0KgUP8g8u39xhZmpikUXzy5ZBRKEXuN+qk48Le7mXg== X-Received: by 2002:a05:6871:5225:b0:1ea:2ed0:2978 with SMTP id ht37-20020a056871522500b001ea2ed02978mr1202977oac.22.1697786546202; Fri, 20 Oct 2023 00:22:26 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:22:25 -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, Atish Patra , Anup Patel Subject: [PATCH v3 8/9] tty: Add SBI debug console support to HVC SBI driver Date: Fri, 20 Oct 2023 12:51:39 +0530 Message-Id: <20231020072140.900967-9-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002232_766521_64910E72 X-CRM114-Status: GOOD ( 16.01 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Atish Patra RISC-V SBI specification supports advanced debug console support via SBI DBCN extension. Extend the HVC SBI driver to support it. Signed-off-by: Atish Patra Signed-off-by: Anup Patel --- drivers/tty/hvc/Kconfig | 2 +- drivers/tty/hvc/hvc_riscv_sbi.c | 82 ++++++++++++++++++++++++++++++--- 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig index 4f9264d005c0..6e05c5c7bca1 100644 --- a/drivers/tty/hvc/Kconfig +++ b/drivers/tty/hvc/Kconfig @@ -108,7 +108,7 @@ config HVC_DCC_SERIALIZE_SMP config HVC_RISCV_SBI bool "RISC-V SBI console support" - depends on RISCV_SBI_V01 + depends on RISCV_SBI select HVC_DRIVER help This enables support for console output via RISC-V SBI calls, which diff --git a/drivers/tty/hvc/hvc_riscv_sbi.c b/drivers/tty/hvc/hvc_riscv_sbi.c index 31f53fa77e4a..56da1a4b5aca 100644 --- a/drivers/tty/hvc/hvc_riscv_sbi.c +++ b/drivers/tty/hvc/hvc_riscv_sbi.c @@ -39,21 +39,89 @@ static int hvc_sbi_tty_get(uint32_t vtermno, char *buf, int count) return i; } -static const struct hv_ops hvc_sbi_ops = { +static const struct hv_ops hvc_sbi_v01_ops = { .get_chars = hvc_sbi_tty_get, .put_chars = hvc_sbi_tty_put, }; -static int __init hvc_sbi_init(void) +static int hvc_sbi_dbcn_tty_put(uint32_t vtermno, const char *buf, int count) { - return PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_ops, 16)); + phys_addr_t pa; + struct sbiret ret; + + if (is_vmalloc_addr(buf)) { + pa = page_to_phys(vmalloc_to_page(buf)) + offset_in_page(buf); + if (PAGE_SIZE < (offset_in_page(buf) + count)) + count = PAGE_SIZE - offset_in_page(buf); + } else { + pa = __pa(buf); + } + + if (IS_ENABLED(CONFIG_32BIT)) + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE, + count, lower_32_bits(pa), upper_32_bits(pa), + 0, 0, 0); + else + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE, + count, pa, 0, 0, 0, 0); + if (ret.error) + return 0; + + return count; } -device_initcall(hvc_sbi_init); -static int __init hvc_sbi_console_init(void) +static int hvc_sbi_dbcn_tty_get(uint32_t vtermno, char *buf, int count) { - hvc_instantiate(0, 0, &hvc_sbi_ops); + phys_addr_t pa; + struct sbiret ret; + + if (is_vmalloc_addr(buf)) { + pa = page_to_phys(vmalloc_to_page(buf)) + offset_in_page(buf); + if (PAGE_SIZE < (offset_in_page(buf) + count)) + count = PAGE_SIZE - offset_in_page(buf); + } else { + pa = __pa(buf); + } + + if (IS_ENABLED(CONFIG_32BIT)) + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_READ, + count, lower_32_bits(pa), upper_32_bits(pa), + 0, 0, 0); + else + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_READ, + count, pa, 0, 0, 0, 0); + if (ret.error) + return 0; + + return ret.value; +} + +static const struct hv_ops hvc_sbi_dbcn_ops = { + .put_chars = hvc_sbi_dbcn_tty_put, + .get_chars = hvc_sbi_dbcn_tty_get, +}; + +static int __init hvc_sbi_init(void) +{ + int err; + + if ((sbi_spec_version >= sbi_mk_version(2, 0)) && + (sbi_probe_extension(SBI_EXT_DBCN) > 0)) { + err = PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_dbcn_ops, 16)); + if (err) + return err; + hvc_instantiate(0, 0, &hvc_sbi_dbcn_ops); + } else { + if (IS_ENABLED(CONFIG_RISCV_SBI_V01)) { + err = PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_v01_ops, 16)); + if (err) + return err; + hvc_instantiate(0, 0, &hvc_sbi_v01_ops); + } else { + return -ENODEV; + } + } return 0; } -console_initcall(hvc_sbi_console_init); +device_initcall(hvc_sbi_init); From patchwork Fri Oct 20 07:21:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13430179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00069CDB474 for ; Fri, 20 Oct 2023 07:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vMH3H4pq3FSap6jitsOyQAeYjM1afIs3rq9fHenPlxc=; b=kIHFN39WdhVhGU HbPjPwgQ56Qqe89aqthYW08K+8bB4/GhqZBGT4g8SeH5x2YoVarCpzRsaEn3b/tOaQNoryKfvFc+D Aaim7ODCnjUHay9Zn2fkw85DopwNbsu1B0Soap4skqFkPfvZ4Y/jxttCn0t8whfAVjjYWINU9Kpba J/TV30eHbn+WT6C051EIAkNZenWDUCZMkc7Joheh8a+KzyYNOsen6555aRFpR7pWzaKpia5bFyoXF S85R5uGivtcdR+5r4pYFFAw0PE1lcTwv25gOSzUhe38IOK6iSllr5B/pQO+/Ksh9i41ZGHMusnLFq Llk0utCrUg0VrY9ibhjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtjq7-001QUY-0J; Fri, 20 Oct 2023 07:22:35 +0000 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtjq4-001QS4-2C for linux-riscv@lists.infradead.org; Fri, 20 Oct 2023 07:22:34 +0000 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1e9d3cc6e7aso383257fac.2 for ; Fri, 20 Oct 2023 00:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697786551; x=1698391351; darn=lists.infradead.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=DQOTSMVYEAXB96lPNmfxUETXmF1nmywj/hDtdToDI6M=; b=P4AFTiKEilBOl7p/1oQFUhwnxHLbRbb2e367XlEvwtDnGnYTl8wLDJNfHkibfxJDhu 9GxTY4LH0xyOovmYBYLQnHB6wZImVQWZ4QmhN7X0LP+yUHnojzAWMhS0x7cy2kUfJE2o vfnWB5y/HxsffuqSGzhNSSIu1IV5wCXPlV3E2zyp2fnGndl1R4/qhkfKj9qtfnEBD35/ KE0c2Kbk49GMLRt3IMBMRgPah/G4kDUMLOtj9IO9JYvKeFkfaXF+PYzDCwzr+yxPUslh dMMj6genVOhIel/KC4s+nadAPLzJlpx797iq2UxK4sZKYP7KdJhZH7EM28vlbj/0IRoR GxWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697786551; x=1698391351; 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=DQOTSMVYEAXB96lPNmfxUETXmF1nmywj/hDtdToDI6M=; b=lRKRX1efLV7QN1IS3fSwRFzvEyku1V50ikg8JsOfYqmrQC8mwz01TEy5RQ48qRD8p/ C/ysG9eN179uB+IjQdbQVh5sHpZeFDE2GooBIZEE7JuiQCEuZBhcfYgbw36kBaN/d0uv 6oqxamuOh1ELNOqZm5dJN+UrxxXbyCIZ4tARjur+i5hyKrVhv980gLXul35BowWbu7Ks vdG3IKD9dF47z2vWtoB6LUGnQ2KgaAF8z9VPnU6Sr3ZY60V3pvQVi0mNSBF7HJ+3nAmz merxuQ67EZA8/mjGYN5m53FR5fbsOBuiJHf4AgiPWy+NdtwXlFquBEYfdRYflXOHpwMD CIOw== X-Gm-Message-State: AOJu0YxT+RZNxeA/fPkJ7avDuIx5RosC4hDfHMo+5q5hn07CXy+KaygS rbg6RPoyqp18s9HaPsqE+baXbQ== X-Google-Smtp-Source: AGHT+IHVpVTtGUUCbE9QtkhDvgB6PWIuexjVRbTOQpUxtFm1xcTHF7ruZ9rqINTCV8Ep/hVGmPBCuA== X-Received: by 2002:a05:6871:3316:b0:1e9:9215:3987 with SMTP id nf22-20020a056871331600b001e992153987mr1427367oac.16.1697786550612; Fri, 20 Oct 2023 00:22:30 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.83.81]) by smtp.gmail.com with ESMTPSA id v12-20020a63f20c000000b005b32d6b4f2fsm828204pgh.81.2023.10.20.00.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 00:22:30 -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 v3 9/9] RISC-V: Enable SBI based earlycon support Date: Fri, 20 Oct 2023 12:51:40 +0530 Message-Id: <20231020072140.900967-10-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020072140.900967-1-apatel@ventanamicro.com> References: <20231020072140.900967-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_002232_719276_3BDAAF84 X-CRM114-Status: UNSURE ( 7.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Let us enable SBI based earlycon support in defconfigs for both RV32 and RV64 so that "earlycon=sbi" can be used again. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- arch/riscv/configs/defconfig | 1 + arch/riscv/configs/rv32_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig index ab86ec3b9eab..f82700da0056 100644 --- a/arch/riscv/configs/defconfig +++ b/arch/riscv/configs/defconfig @@ -132,6 +132,7 @@ CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_DW=y CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SERIAL_SH_SCI=y +CONFIG_SERIAL_EARLYCON_RISCV_SBI=y CONFIG_VIRTIO_CONSOLE=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_VIRTIO=y diff --git a/arch/riscv/configs/rv32_defconfig b/arch/riscv/configs/rv32_defconfig index 89b601e253a6..5721af39afd1 100644 --- a/arch/riscv/configs/rv32_defconfig +++ b/arch/riscv/configs/rv32_defconfig @@ -66,6 +66,7 @@ CONFIG_INPUT_MOUSEDEV=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_EARLYCON_RISCV_SBI=y CONFIG_VIRTIO_CONSOLE=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_VIRTIO=y