* [PATCH] RISC-V: KVM: Fix incorrect KVM_MAX_VCPUS value
@ 2021-11-17 6:02 Anup Patel
2021-11-18 7:53 ` Atish Patra
0 siblings, 1 reply; 3+ messages in thread
From: Anup Patel @ 2021-11-17 6:02 UTC (permalink / raw)
To: Atish Patra
Cc: Palmer Dabbelt, Paul Walmsley, Paolo Bonzini, Anup Patel,
kvm-riscv, kvm, linux-riscv, linux-kernel, Anup Patel
The KVM_MAX_VCPUS value is supposed to be aligned with number of
VMID bits in the hgatp CSR but the current KVM_MAX_VCPUS value
is aligned with number of ASID bits in the satp CSR.
Fixes: 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support")
Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
arch/riscv/include/asm/kvm_host.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h
index 25ba21f98504..2639b9ee48f9 100644
--- a/arch/riscv/include/asm/kvm_host.h
+++ b/arch/riscv/include/asm/kvm_host.h
@@ -12,14 +12,12 @@
#include <linux/types.h>
#include <linux/kvm.h>
#include <linux/kvm_types.h>
+#include <asm/csr.h>
#include <asm/kvm_vcpu_fp.h>
#include <asm/kvm_vcpu_timer.h>
-#ifdef CONFIG_64BIT
-#define KVM_MAX_VCPUS (1U << 16)
-#else
-#define KVM_MAX_VCPUS (1U << 9)
-#endif
+#define KVM_MAX_VCPUS \
+ ((HGATP_VMID_MASK >> HGATP_VMID_SHIFT) + 1)
#define KVM_HALT_POLL_NS_DEFAULT 500000
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: KVM: Fix incorrect KVM_MAX_VCPUS value
2021-11-17 6:02 [PATCH] RISC-V: KVM: Fix incorrect KVM_MAX_VCPUS value Anup Patel
@ 2021-11-18 7:53 ` Atish Patra
2021-11-19 12:20 ` Anup Patel
0 siblings, 1 reply; 3+ messages in thread
From: Atish Patra @ 2021-11-18 7:53 UTC (permalink / raw)
To: Anup Patel
Cc: Palmer Dabbelt, Paul Walmsley, Paolo Bonzini, Anup Patel,
kvm-riscv, kvm, linux-riscv, linux-kernel@vger.kernel.org List
On Tue, Nov 16, 2021 at 10:03 PM Anup Patel <anup.patel@wdc.com> wrote:
>
> The KVM_MAX_VCPUS value is supposed to be aligned with number of
> VMID bits in the hgatp CSR but the current KVM_MAX_VCPUS value
> is aligned with number of ASID bits in the satp CSR.
>
> Fixes: 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support")
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> ---
> arch/riscv/include/asm/kvm_host.h | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h
> index 25ba21f98504..2639b9ee48f9 100644
> --- a/arch/riscv/include/asm/kvm_host.h
> +++ b/arch/riscv/include/asm/kvm_host.h
> @@ -12,14 +12,12 @@
> #include <linux/types.h>
> #include <linux/kvm.h>
> #include <linux/kvm_types.h>
> +#include <asm/csr.h>
> #include <asm/kvm_vcpu_fp.h>
> #include <asm/kvm_vcpu_timer.h>
>
> -#ifdef CONFIG_64BIT
> -#define KVM_MAX_VCPUS (1U << 16)
> -#else
> -#define KVM_MAX_VCPUS (1U << 9)
> -#endif
> +#define KVM_MAX_VCPUS \
> + ((HGATP_VMID_MASK >> HGATP_VMID_SHIFT) + 1)
>
> #define KVM_HALT_POLL_NS_DEFAULT 500000
>
> --
> 2.25.1
>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
--
Regards,
Atish
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: KVM: Fix incorrect KVM_MAX_VCPUS value
2021-11-18 7:53 ` Atish Patra
@ 2021-11-19 12:20 ` Anup Patel
0 siblings, 0 replies; 3+ messages in thread
From: Anup Patel @ 2021-11-19 12:20 UTC (permalink / raw)
To: Atish Patra
Cc: Anup Patel, Palmer Dabbelt, Paul Walmsley, Paolo Bonzini,
kvm-riscv, KVM General, linux-riscv,
linux-kernel@vger.kernel.org List
On Thu, Nov 18, 2021 at 1:23 PM Atish Patra <atishp@atishpatra.org> wrote:
>
> On Tue, Nov 16, 2021 at 10:03 PM Anup Patel <anup.patel@wdc.com> wrote:
> >
> > The KVM_MAX_VCPUS value is supposed to be aligned with number of
> > VMID bits in the hgatp CSR but the current KVM_MAX_VCPUS value
> > is aligned with number of ASID bits in the satp CSR.
> >
> > Fixes: 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support")
> > Signed-off-by: Anup Patel <anup.patel@wdc.com>
> > ---
> > arch/riscv/include/asm/kvm_host.h | 8 +++-----
> > 1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h
> > index 25ba21f98504..2639b9ee48f9 100644
> > --- a/arch/riscv/include/asm/kvm_host.h
> > +++ b/arch/riscv/include/asm/kvm_host.h
> > @@ -12,14 +12,12 @@
> > #include <linux/types.h>
> > #include <linux/kvm.h>
> > #include <linux/kvm_types.h>
> > +#include <asm/csr.h>
> > #include <asm/kvm_vcpu_fp.h>
> > #include <asm/kvm_vcpu_timer.h>
> >
> > -#ifdef CONFIG_64BIT
> > -#define KVM_MAX_VCPUS (1U << 16)
> > -#else
> > -#define KVM_MAX_VCPUS (1U << 9)
> > -#endif
> > +#define KVM_MAX_VCPUS \
> > + ((HGATP_VMID_MASK >> HGATP_VMID_SHIFT) + 1)
> >
> > #define KVM_HALT_POLL_NS_DEFAULT 500000
> >
> > --
> > 2.25.1
> >
>
>
> Reviewed-by: Atish Patra <atishp@rivosinc.com>
I have queued this patch for fixes.
Thanks,
Anup
>
> --
> Regards,
> Atish
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-19 12:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 6:02 [PATCH] RISC-V: KVM: Fix incorrect KVM_MAX_VCPUS value Anup Patel
2021-11-18 7:53 ` Atish Patra
2021-11-19 12:20 ` Anup Patel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).