From: Deepak Gupta <debug@rivosinc.com> To: "Clément Léger" <cleger@rivosinc.com> Cc: Conor Dooley <conor@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Anup Patel <anup@brainfault.org>, Atish Patra <atishp@atishpatra.org>, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Ved Shanbhogue <ved@rivosinc.com> Subject: Re: [RFC PATCH 1/7] riscv: kvm: add support for FWFT SBI extension Date: Fri, 26 Apr 2024 16:44:51 -0700 [thread overview] Message-ID: <Ziw8c0X0K3mXjJWK@debug.ba.rivosinc.com> (raw) In-Reply-To: <20240418142701.1493091-2-cleger@rivosinc.com> On Thu, Apr 18, 2024 at 04:26:40PM +0200, Clément Léger wrote: >Add support for FWFT extension in KVM > >Signed-off-by: Clément Léger <cleger@rivosinc.com> >--- > arch/riscv/include/asm/kvm_host.h | 5 + > arch/riscv/include/asm/kvm_vcpu_sbi.h | 1 + > arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h | 37 ++++++ > arch/riscv/include/uapi/asm/kvm.h | 1 + > arch/riscv/kvm/Makefile | 1 + > arch/riscv/kvm/vcpu.c | 5 + > arch/riscv/kvm/vcpu_sbi.c | 4 + > arch/riscv/kvm/vcpu_sbi_fwft.c | 136 +++++++++++++++++++++ > 8 files changed, 190 insertions(+) > create mode 100644 arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h > create mode 100644 arch/riscv/kvm/vcpu_sbi_fwft.c > >diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h >index 484d04a92fa6..be60aaa07f57 100644 >--- a/arch/riscv/include/asm/kvm_host.h >+++ b/arch/riscv/include/asm/kvm_host.h >@@ -19,6 +19,7 @@ > #include <asm/kvm_vcpu_fp.h> > #include <asm/kvm_vcpu_insn.h> > #include <asm/kvm_vcpu_sbi.h> >+#include <asm/kvm_vcpu_sbi_fwft.h> > #include <asm/kvm_vcpu_timer.h> > #include <asm/kvm_vcpu_pmu.h> > >@@ -169,6 +170,7 @@ struct kvm_vcpu_csr { > struct kvm_vcpu_config { > u64 henvcfg; > u64 hstateen0; >+ u64 hedeleg; > }; > > struct kvm_vcpu_smstateen_csr { >@@ -261,6 +263,9 @@ struct kvm_vcpu_arch { > /* Performance monitoring context */ > struct kvm_pmu pmu_context; > >+ /* Firmware feature SBI extension context */ >+ struct kvm_sbi_fwft fwft_context; >+ > /* 'static' configurations which are set only once */ > struct kvm_vcpu_config cfg; > >diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h >index b96705258cf9..3a33bbacc233 100644 >--- a/arch/riscv/include/asm/kvm_vcpu_sbi.h >+++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h >@@ -86,6 +86,7 @@ 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_sta; >+extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_fwft; > 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/asm/kvm_vcpu_sbi_fwft.h b/arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h >new file mode 100644 >index 000000000000..7dc1b80c7e6c >--- /dev/null >+++ b/arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h >@@ -0,0 +1,37 @@ >+/* SPDX-License-Identifier: GPL-2.0-only */ >+/* >+ * Copyright (c) 2023 Rivos Inc >+ * >+ * Authors: >+ * Atish Patra <atishp@rivosinc.com> nit: probably need to fix Copyright year and Authors here :-) Same in all new files being introduced. >+ */ >+ >+#ifndef __KVM_VCPU_RISCV_FWFT_H >+#define __KVM_VCPU_RISCV_FWFT_H >+ >+#include <asm/sbi.h> >+ >+#define KVM_SBI_FWFT_FEATURE_COUNT 1 >+ >+static int kvm_sbi_fwft_set(struct kvm_vcpu *vcpu, >+ enum sbi_fwft_feature_t feature, >+ unsigned long value, unsigned long flags) >+{ >+ struct kvm_sbi_fwft_config *conf = kvm_sbi_fwft_get_config(vcpu, >+ feature); >+ if (!conf) >+ return SBI_ERR_DENIED; Curious, Why denied and not something like NOT_SUPPORTED NOT_AVAILABLE here? >+ >+ if ((flags & ~SBI_FWFT_SET_FLAG_LOCK) != 0) >+ return SBI_ERR_INVALID_PARAM; >+ >+ if (conf->flags & SBI_FWFT_SET_FLAG_LOCK) >+ return SBI_ERR_DENIED; >+ >+ conf->flags = flags; >+ >+ return conf->feature->set(vcpu, conf, value); >+} >+
WARNING: multiple messages have this Message-ID (diff)
From: Deepak Gupta <debug@rivosinc.com> To: "Clément Léger" <cleger@rivosinc.com> Cc: Conor Dooley <conor@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Anup Patel <anup@brainfault.org>, Atish Patra <atishp@atishpatra.org>, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Ved Shanbhogue <ved@rivosinc.com> Subject: Re: [RFC PATCH 1/7] riscv: kvm: add support for FWFT SBI extension Date: Fri, 26 Apr 2024 16:44:51 -0700 [thread overview] Message-ID: <Ziw8c0X0K3mXjJWK@debug.ba.rivosinc.com> (raw) In-Reply-To: <20240418142701.1493091-2-cleger@rivosinc.com> On Thu, Apr 18, 2024 at 04:26:40PM +0200, Clément Léger wrote: >Add support for FWFT extension in KVM > >Signed-off-by: Clément Léger <cleger@rivosinc.com> >--- > arch/riscv/include/asm/kvm_host.h | 5 + > arch/riscv/include/asm/kvm_vcpu_sbi.h | 1 + > arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h | 37 ++++++ > arch/riscv/include/uapi/asm/kvm.h | 1 + > arch/riscv/kvm/Makefile | 1 + > arch/riscv/kvm/vcpu.c | 5 + > arch/riscv/kvm/vcpu_sbi.c | 4 + > arch/riscv/kvm/vcpu_sbi_fwft.c | 136 +++++++++++++++++++++ > 8 files changed, 190 insertions(+) > create mode 100644 arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h > create mode 100644 arch/riscv/kvm/vcpu_sbi_fwft.c > >diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h >index 484d04a92fa6..be60aaa07f57 100644 >--- a/arch/riscv/include/asm/kvm_host.h >+++ b/arch/riscv/include/asm/kvm_host.h >@@ -19,6 +19,7 @@ > #include <asm/kvm_vcpu_fp.h> > #include <asm/kvm_vcpu_insn.h> > #include <asm/kvm_vcpu_sbi.h> >+#include <asm/kvm_vcpu_sbi_fwft.h> > #include <asm/kvm_vcpu_timer.h> > #include <asm/kvm_vcpu_pmu.h> > >@@ -169,6 +170,7 @@ struct kvm_vcpu_csr { > struct kvm_vcpu_config { > u64 henvcfg; > u64 hstateen0; >+ u64 hedeleg; > }; > > struct kvm_vcpu_smstateen_csr { >@@ -261,6 +263,9 @@ struct kvm_vcpu_arch { > /* Performance monitoring context */ > struct kvm_pmu pmu_context; > >+ /* Firmware feature SBI extension context */ >+ struct kvm_sbi_fwft fwft_context; >+ > /* 'static' configurations which are set only once */ > struct kvm_vcpu_config cfg; > >diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h b/arch/riscv/include/asm/kvm_vcpu_sbi.h >index b96705258cf9..3a33bbacc233 100644 >--- a/arch/riscv/include/asm/kvm_vcpu_sbi.h >+++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h >@@ -86,6 +86,7 @@ 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_sta; >+extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_fwft; > 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/asm/kvm_vcpu_sbi_fwft.h b/arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h >new file mode 100644 >index 000000000000..7dc1b80c7e6c >--- /dev/null >+++ b/arch/riscv/include/asm/kvm_vcpu_sbi_fwft.h >@@ -0,0 +1,37 @@ >+/* SPDX-License-Identifier: GPL-2.0-only */ >+/* >+ * Copyright (c) 2023 Rivos Inc >+ * >+ * Authors: >+ * Atish Patra <atishp@rivosinc.com> nit: probably need to fix Copyright year and Authors here :-) Same in all new files being introduced. >+ */ >+ >+#ifndef __KVM_VCPU_RISCV_FWFT_H >+#define __KVM_VCPU_RISCV_FWFT_H >+ >+#include <asm/sbi.h> >+ >+#define KVM_SBI_FWFT_FEATURE_COUNT 1 >+ >+static int kvm_sbi_fwft_set(struct kvm_vcpu *vcpu, >+ enum sbi_fwft_feature_t feature, >+ unsigned long value, unsigned long flags) >+{ >+ struct kvm_sbi_fwft_config *conf = kvm_sbi_fwft_get_config(vcpu, >+ feature); >+ if (!conf) >+ return SBI_ERR_DENIED; Curious, Why denied and not something like NOT_SUPPORTED NOT_AVAILABLE here? >+ >+ if ((flags & ~SBI_FWFT_SET_FLAG_LOCK) != 0) >+ return SBI_ERR_INVALID_PARAM; >+ >+ if (conf->flags & SBI_FWFT_SET_FLAG_LOCK) >+ return SBI_ERR_DENIED; >+ >+ conf->flags = flags; >+ >+ return conf->feature->set(vcpu, conf, value); >+} >+ _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-04-26 23:44 UTC|newest] Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-18 14:26 [RFC PATCH 0/7] riscv: Add support for Ssdbltrp extension Clément Léger 2024-04-18 14:26 ` Clément Léger 2024-04-18 14:26 ` [RFC PATCH 1/7] riscv: kvm: add support for FWFT SBI extension Clément Léger 2024-04-18 14:26 ` Clément Léger 2024-04-26 23:44 ` Deepak Gupta [this message] 2024-04-26 23:44 ` Deepak Gupta 2024-04-30 7:26 ` Clément Léger 2024-04-30 7:26 ` Clément Léger 2024-04-18 14:26 ` [RFC PATCH 2/7] dt-bindings: riscv: add Ssdbltrp ISA extension description Clément Léger 2024-04-18 14:26 ` Clément Léger 2024-04-23 16:30 ` Conor Dooley 2024-04-23 16:30 ` Conor Dooley 2024-04-24 7:20 ` Clément Léger 2024-04-24 7:20 ` Clément Léger 2024-04-24 7:40 ` Conor Dooley 2024-04-24 7:40 ` Conor Dooley 2024-04-24 21:38 ` Ved Shanbhogue 2024-04-24 21:38 ` Ved Shanbhogue 2024-04-18 14:26 ` [RFC PATCH 3/7] riscv: add Ssdbltrp ISA extension parsing Clément Léger 2024-04-18 14:26 ` Clément Léger 2024-04-18 14:26 ` [RFC PATCH 4/7] riscv: handle Ssdbltrp mstatus SDT bit Clément Léger 2024-04-18 14:26 ` Clément Léger 2024-04-18 14:26 ` [RFC PATCH 5/7] riscv: add double trap driver Clément Léger 2024-04-18 14:26 ` Clément Léger 2024-04-23 16:39 ` Conor Dooley 2024-04-23 16:39 ` Conor Dooley 2024-04-24 8:56 ` Clément Léger 2024-04-24 8:56 ` Clément Léger 2024-04-26 23:59 ` Deepak Gupta 2024-04-26 23:59 ` Deepak Gupta 2024-05-14 8:06 ` Clément Léger 2024-05-14 8:06 ` Clément Léger 2024-05-14 14:38 ` Deepak Gupta 2024-05-14 14:38 ` Deepak Gupta 2024-04-18 14:26 ` [RFC PATCH 6/7] riscv: kvm: add SBI FWFT support for SBI_FWFT_DOUBLE_TRAP_ENABLE Clément Léger 2024-04-18 14:26 ` Clément Léger 2024-04-27 1:17 ` Deepak Gupta 2024-04-27 1:17 ` Deepak Gupta 2024-04-27 15:36 ` Deepak Gupta 2024-04-27 15:36 ` Deepak Gupta 2024-05-14 9:43 ` Clément Léger 2024-05-14 9:43 ` Clément Léger 2024-05-14 16:05 ` Deepak Gupta 2024-05-14 16:05 ` Deepak Gupta 2024-04-18 14:26 ` [RFC PATCH 7/7] RISC-V: KVM: add support for double trap exception Clément Léger 2024-04-18 14:26 ` Clément Léger 2024-04-27 1:33 ` Deepak Gupta 2024-04-27 1:33 ` Deepak Gupta 2024-04-30 15:35 ` Clément Léger 2024-04-30 15:35 ` Clément Léger 2024-04-23 16:24 ` [RFC PATCH 0/7] riscv: Add support for Ssdbltrp extension Conor Dooley 2024-04-23 16:24 ` Conor Dooley 2024-04-24 7:23 ` Clément Léger 2024-04-24 7:23 ` Clément Léger
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=Ziw8c0X0K3mXjJWK@debug.ba.rivosinc.com \ --to=debug@rivosinc.com \ --cc=anup@brainfault.org \ --cc=aou@eecs.berkeley.edu \ --cc=atishp@atishpatra.org \ --cc=cleger@rivosinc.com \ --cc=conor@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=krzysztof.kozlowski+dt@linaro.org \ --cc=kvm-riscv@lists.infradead.org \ --cc=kvm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@dabbelt.com \ --cc=paul.walmsley@sifive.com \ --cc=robh+dt@kernel.org \ --cc=ved@rivosinc.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.