* [PATCH v3 0/2] Fix hgatp mode settings within kvm_riscv_gstage_vmid_detect
@ 2025-08-20 12:59 fangyu.yu
2025-08-20 12:59 ` [PATCH v3 1/2] RISC-V: KVM: Write hgatp register with valid mode bits fangyu.yu
2025-08-20 12:59 ` [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read fangyu.yu
0 siblings, 2 replies; 8+ messages in thread
From: fangyu.yu @ 2025-08-20 12:59 UTC (permalink / raw)
To: anup, atish.patra, paul.walmsley, palmer, aou, alex
Cc: guoren, kvm, kvm-riscv, linux-riscv, linux-kernel, Fangyu Yu
From: Fangyu Yu <fangyu.yu@linux.alibaba.com>
According to the RISC-V Privileged Architecture Spec, when MODE=Bare
is selected,software must write zero to the remaining fields of hgatp.
So,use a valid mode when detecting vmids of the HW supported,meanwhile
remove unnecessary HGATP csr_read.
---
Changes in v3:
- Add "Fixes" tag.
- Involve("RISC-V KVM: Remove unnecessary HGATP csr_read"), which
depends on patch 1.
Changes in v2:
- Fixed build error since kvm_riscv_gstage_mode() has been modified.
---
Fangyu Yu (1):
RISC-V: KVM: Write hgatp register with valid mode bits
Guo Ren (Alibaba DAMO Academy) (1):
RISC-V KVM: Remove unnecessary HGATP csr_read
arch/riscv/kvm/vmid.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
--
2.49.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/2] RISC-V: KVM: Write hgatp register with valid mode bits
2025-08-20 12:59 [PATCH v3 0/2] Fix hgatp mode settings within kvm_riscv_gstage_vmid_detect fangyu.yu
@ 2025-08-20 12:59 ` fangyu.yu
2025-08-20 12:59 ` [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read fangyu.yu
1 sibling, 0 replies; 8+ messages in thread
From: fangyu.yu @ 2025-08-20 12:59 UTC (permalink / raw)
To: anup, atish.patra, paul.walmsley, palmer, aou, alex
Cc: guoren, kvm, kvm-riscv, linux-riscv, linux-kernel, Fangyu Yu,
Nutty Liu, Troy Mitchell
From: Fangyu Yu <fangyu.yu@linux.alibaba.com>
According to the RISC-V Privileged Architecture Spec, when MODE=Bare
is selected,software must write zero to the remaining fields of hgatp.
We have detected the valid mode supported by the HW before, So using a
valid mode to detect how many vmid bits are supported.
Fixes: fd7bb4a251df ("RISC-V: KVM: Implement VMID allocator")
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
---
arch/riscv/kvm/vmid.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
index 3b426c800480..5f33625f4070 100644
--- a/arch/riscv/kvm/vmid.c
+++ b/arch/riscv/kvm/vmid.c
@@ -14,6 +14,7 @@
#include <linux/smp.h>
#include <linux/kvm_host.h>
#include <asm/csr.h>
+#include <asm/kvm_mmu.h>
#include <asm/kvm_tlb.h>
#include <asm/kvm_vmid.h>
@@ -28,7 +29,7 @@ void __init kvm_riscv_gstage_vmid_detect(void)
/* Figure-out number of VMID bits in HW */
old = csr_read(CSR_HGATP);
- csr_write(CSR_HGATP, old | HGATP_VMID);
+ csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
vmid_bits = csr_read(CSR_HGATP);
vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
vmid_bits = fls_long(vmid_bits);
--
2.49.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read
2025-08-20 12:59 [PATCH v3 0/2] Fix hgatp mode settings within kvm_riscv_gstage_vmid_detect fangyu.yu
2025-08-20 12:59 ` [PATCH v3 1/2] RISC-V: KVM: Write hgatp register with valid mode bits fangyu.yu
@ 2025-08-20 12:59 ` fangyu.yu
2025-08-20 14:40 ` Troy Mitchell
2025-08-21 2:49 ` Nutty.Liu
1 sibling, 2 replies; 8+ messages in thread
From: fangyu.yu @ 2025-08-20 12:59 UTC (permalink / raw)
To: anup, atish.patra, paul.walmsley, palmer, aou, alex
Cc: guoren, kvm, kvm-riscv, linux-riscv, linux-kernel, Fangyu Yu
From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
The HGATP has been set to zero in gstage_mode_detect(), so there
is no need to save the old context. Unify the code convention
with gstage_mode_detect().
Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
---
arch/riscv/kvm/vmid.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
index 5f33625f4070..abb1c2bf2542 100644
--- a/arch/riscv/kvm/vmid.c
+++ b/arch/riscv/kvm/vmid.c
@@ -25,15 +25,12 @@ static DEFINE_SPINLOCK(vmid_lock);
void __init kvm_riscv_gstage_vmid_detect(void)
{
- unsigned long old;
-
/* Figure-out number of VMID bits in HW */
- old = csr_read(CSR_HGATP);
csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
vmid_bits = csr_read(CSR_HGATP);
vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
vmid_bits = fls_long(vmid_bits);
- csr_write(CSR_HGATP, old);
+ csr_write(CSR_HGATP, 0);
/* We polluted local TLB so flush all guest TLB */
kvm_riscv_local_hfence_gvma_all();
--
2.49.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read
2025-08-20 12:59 ` [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read fangyu.yu
@ 2025-08-20 14:40 ` Troy Mitchell
2025-08-21 1:13 ` Guo Ren
2025-08-21 1:25 ` Guo Ren
2025-08-21 2:49 ` Nutty.Liu
1 sibling, 2 replies; 8+ messages in thread
From: Troy Mitchell @ 2025-08-20 14:40 UTC (permalink / raw)
To: fangyu.yu, anup, atish.patra, paul.walmsley, palmer, aou, alex
Cc: guoren, kvm, kvm-riscv, linux-riscv, linux-kernel, Troy Mitchell
On Wed, Aug 20, 2025 at 08:59:52PM +0800, fangyu.yu@linux.alibaba.com wrote:
> From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
>
> The HGATP has been set to zero in gstage_mode_detect(), so there
> is no need to save the old context. Unify the code convention
> with gstage_mode_detect().
>
> Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
> Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
> ---
> arch/riscv/kvm/vmid.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
> index 5f33625f4070..abb1c2bf2542 100644
> --- a/arch/riscv/kvm/vmid.c
> +++ b/arch/riscv/kvm/vmid.c
> @@ -25,15 +25,12 @@ static DEFINE_SPINLOCK(vmid_lock);
>
> void __init kvm_riscv_gstage_vmid_detect(void)
> {
> - unsigned long old;
> -
> /* Figure-out number of VMID bits in HW */
> - old = csr_read(CSR_HGATP);
> csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
> vmid_bits = csr_read(CSR_HGATP);
> vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
> vmid_bits = fls_long(vmid_bits);
> - csr_write(CSR_HGATP, old);
> + csr_write(CSR_HGATP, 0);
Is setting HGATP to 0 in gstage_mode_detect meaningless now?
If so, it might be better to drop it and just keep the one here.
- Troy
>
> /* We polluted local TLB so flush all guest TLB */
> kvm_riscv_local_hfence_gvma_all();
> --
> 2.49.0
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read
2025-08-20 14:40 ` Troy Mitchell
@ 2025-08-21 1:13 ` Guo Ren
2025-08-21 1:25 ` Guo Ren
1 sibling, 0 replies; 8+ messages in thread
From: Guo Ren @ 2025-08-21 1:13 UTC (permalink / raw)
To: Troy Mitchell
Cc: fangyu.yu, anup, atish.patra, paul.walmsley, palmer, aou, alex,
kvm, kvm-riscv, linux-riscv, linux-kernel
On Wed, Aug 20, 2025 at 10:40 PM Troy Mitchell <troy.mitchell@linux.dev> wrote:
>
> On Wed, Aug 20, 2025 at 08:59:52PM +0800, fangyu.yu@linux.alibaba.com wrote:
> > From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
> >
> > The HGATP has been set to zero in gstage_mode_detect(), so there
> > is no need to save the old context. Unify the code convention
> > with gstage_mode_detect().
> >
> > Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
> > Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
> > ---
> > arch/riscv/kvm/vmid.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
> > index 5f33625f4070..abb1c2bf2542 100644
> > --- a/arch/riscv/kvm/vmid.c
> > +++ b/arch/riscv/kvm/vmid.c
> > @@ -25,15 +25,12 @@ static DEFINE_SPINLOCK(vmid_lock);
> >
> > void __init kvm_riscv_gstage_vmid_detect(void)
> > {
> > - unsigned long old;
> > -
> > /* Figure-out number of VMID bits in HW */
> > - old = csr_read(CSR_HGATP);
> > csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
> > vmid_bits = csr_read(CSR_HGATP);
> > vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
> > vmid_bits = fls_long(vmid_bits);
> > - csr_write(CSR_HGATP, old);
> > + csr_write(CSR_HGATP, 0);
> Is setting HGATP to 0 in gstage_mode_detect meaningless now?
It's not meaningless, it means keep hgatp off. CSR_HGATP is set to 0
by gstage_mode_detect(), but that's another independent function whose
coincidence is set to 0. And in that function, we use
"csr_write(CSR_HGATP, 0)", but here we change to confusing save_old &
restore_old coding convention?
So, keep kvm_riscv_gstage_vmid_detect() coding convention clear. We
should follow the same approach as gstage_mode_detect(), that is,
"csr_write(CSR_HGATP, 0)".
- The first patch is focused on fixing meaning, so keep the minimum
modifications, no coding convention cleanup.
- The second one is about coding convention, which is no need to Cc:
stable@kernel.org
Hope the above explanation makes sense.
> If so, it might be better to drop it and just keep the one here.
>
> - Troy
>
> >
> > /* We polluted local TLB so flush all guest TLB */
> > kvm_riscv_local_hfence_gvma_all();
> > --
> > 2.49.0
> >
> >
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv
--
Best Regards
Guo Ren
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read
2025-08-20 14:40 ` Troy Mitchell
2025-08-21 1:13 ` Guo Ren
@ 2025-08-21 1:25 ` Guo Ren
2025-08-21 2:29 ` Guo Ren
1 sibling, 1 reply; 8+ messages in thread
From: Guo Ren @ 2025-08-21 1:25 UTC (permalink / raw)
To: Troy Mitchell
Cc: fangyu.yu, anup, atish.patra, paul.walmsley, palmer, aou, alex,
kvm, kvm-riscv, linux-riscv, linux-kernel
On Wed, Aug 20, 2025 at 10:40 PM Troy Mitchell <troy.mitchell@linux.dev> wrote:
>
> On Wed, Aug 20, 2025 at 08:59:52PM +0800, fangyu.yu@linux.alibaba.com wrote:
> > From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
> >
> > The HGATP has been set to zero in gstage_mode_detect(), so there
> > is no need to save the old context. Unify the code convention
> > with gstage_mode_detect().
> >
> > Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
> > Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
> > ---
> > arch/riscv/kvm/vmid.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
> > index 5f33625f4070..abb1c2bf2542 100644
> > --- a/arch/riscv/kvm/vmid.c
> > +++ b/arch/riscv/kvm/vmid.c
> > @@ -25,15 +25,12 @@ static DEFINE_SPINLOCK(vmid_lock);
> >
> > void __init kvm_riscv_gstage_vmid_detect(void)
> > {
> > - unsigned long old;
> > -
> > /* Figure-out number of VMID bits in HW */
> > - old = csr_read(CSR_HGATP);
> > csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
> > vmid_bits = csr_read(CSR_HGATP);
> > vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
> > vmid_bits = fls_long(vmid_bits);
> > - csr_write(CSR_HGATP, old);
> > + csr_write(CSR_HGATP, 0);
> Is setting HGATP to 0 in gstage_mode_detect meaningless now?
> If so, it might be better to drop it and just keep the one here.
Sorry, I misunderstood here.
1. kvm_riscv_gstage_vmid_detect() & gstage_mode_detect() are indepent
function, so keep csr_write(CSR_HGATP, 0) is considerable.
2. But your idea is good, because csr_write(CSR_HGATP, 0) would cause
TLB flush in some micro-arch, which reduces the IPC. So, removing
unnecessary CSR_write (CSR_HGATP, 0) is also considerable.
I would update V4 to merge kvm_riscv_gstage_vmid_detect() &
gstage_mode_detect() into a single function, inspired by your idea.
>
> - Troy
>
> >
> > /* We polluted local TLB so flush all guest TLB */
> > kvm_riscv_local_hfence_gvma_all();
> > --
> > 2.49.0
> >
> >
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv
--
Best Regards
Guo Ren
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read
2025-08-21 1:25 ` Guo Ren
@ 2025-08-21 2:29 ` Guo Ren
0 siblings, 0 replies; 8+ messages in thread
From: Guo Ren @ 2025-08-21 2:29 UTC (permalink / raw)
To: Troy Mitchell
Cc: fangyu.yu, anup, atish.patra, paul.walmsley, palmer, aou, alex,
kvm, kvm-riscv, linux-riscv, linux-kernel
On Thu, Aug 21, 2025 at 9:25 AM Guo Ren <guoren@kernel.org> wrote:
>
> On Wed, Aug 20, 2025 at 10:40 PM Troy Mitchell <troy.mitchell@linux.dev> wrote:
> >
> > On Wed, Aug 20, 2025 at 08:59:52PM +0800, fangyu.yu@linux.alibaba.com wrote:
> > > From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
> > >
> > > The HGATP has been set to zero in gstage_mode_detect(), so there
> > > is no need to save the old context. Unify the code convention
> > > with gstage_mode_detect().
> > >
> > > Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
> > > Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
> > > ---
> > > arch/riscv/kvm/vmid.c | 5 +----
> > > 1 file changed, 1 insertion(+), 4 deletions(-)
> > >
> > > diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
> > > index 5f33625f4070..abb1c2bf2542 100644
> > > --- a/arch/riscv/kvm/vmid.c
> > > +++ b/arch/riscv/kvm/vmid.c
> > > @@ -25,15 +25,12 @@ static DEFINE_SPINLOCK(vmid_lock);
> > >
> > > void __init kvm_riscv_gstage_vmid_detect(void)
> > > {
> > > - unsigned long old;
> > > -
> > > /* Figure-out number of VMID bits in HW */
> > > - old = csr_read(CSR_HGATP);
> > > csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
> > > vmid_bits = csr_read(CSR_HGATP);
> > > vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
> > > vmid_bits = fls_long(vmid_bits);
> > > - csr_write(CSR_HGATP, old);
> > > + csr_write(CSR_HGATP, 0);
> > Is setting HGATP to 0 in gstage_mode_detect meaningless now?
> > If so, it might be better to drop it and just keep the one here.
> Sorry, I misunderstood here.
>
> 1. kvm_riscv_gstage_vmid_detect() & gstage_mode_detect() are indepent
> function, so keep csr_write(CSR_HGATP, 0) is considerable.
>
> 2. But your idea is good, because csr_write(CSR_HGATP, 0) would cause
> TLB flush in some micro-arch, which reduces the IPC. So, removing
> unnecessary CSR_write (CSR_HGATP, 0) is also considerable.
>
> I would update V4 to merge kvm_riscv_gstage_vmid_detect() &
> gstage_mode_detect() into a single function, inspired by your idea.
I found we can't remove "csr_write(CSR_HGATP, 0)" in
gstage_mode_detect(), because this patch needs to reset the HGATP when
mode check failure:
https://lore.kernel.org/linux-riscv/20250819004643.1884149-1-guoren@kernel.org/
I would update to v4, which collects these related patches together
for review convenience.
>
> >
> > - Troy
> >
> > >
> > > /* We polluted local TLB so flush all guest TLB */
> > > kvm_riscv_local_hfence_gvma_all();
> > > --
> > > 2.49.0
> > >
> > >
> > > _______________________________________________
> > > linux-riscv mailing list
> > > linux-riscv@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-riscv
>
>
>
> --
> Best Regards
> Guo Ren
--
Best Regards
Guo Ren
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read
2025-08-20 12:59 ` [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read fangyu.yu
2025-08-20 14:40 ` Troy Mitchell
@ 2025-08-21 2:49 ` Nutty.Liu
1 sibling, 0 replies; 8+ messages in thread
From: Nutty.Liu @ 2025-08-21 2:49 UTC (permalink / raw)
To: fangyu.yu, anup, atish.patra, paul.walmsley, palmer, aou, alex
Cc: guoren, kvm, kvm-riscv, linux-riscv, linux-kernel
On 8/20/2025 8:59 PM, fangyu.yu@linux.alibaba.com wrote:
> From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
>
> The HGATP has been set to zero in gstage_mode_detect(), so there
> is no need to save the old context. Unify the code convention
> with gstage_mode_detect().
>
> Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
> Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
> ---
> arch/riscv/kvm/vmid.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
> index 5f33625f4070..abb1c2bf2542 100644
> --- a/arch/riscv/kvm/vmid.c
> +++ b/arch/riscv/kvm/vmid.c
> @@ -25,15 +25,12 @@ static DEFINE_SPINLOCK(vmid_lock);
>
> void __init kvm_riscv_gstage_vmid_detect(void)
> {
> - unsigned long old;
> -
> /* Figure-out number of VMID bits in HW */
> - old = csr_read(CSR_HGATP);
> csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
> vmid_bits = csr_read(CSR_HGATP);
> vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
> vmid_bits = fls_long(vmid_bits);
> - csr_write(CSR_HGATP, old);
> + csr_write(CSR_HGATP, 0);
Seems there is no need to set 'CSR_HGATP' as 0.
Otherwise,
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Thanks,
Nutty
>
> /* We polluted local TLB so flush all guest TLB */
> kvm_riscv_local_hfence_gvma_all();
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-08-21 3:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 12:59 [PATCH v3 0/2] Fix hgatp mode settings within kvm_riscv_gstage_vmid_detect fangyu.yu
2025-08-20 12:59 ` [PATCH v3 1/2] RISC-V: KVM: Write hgatp register with valid mode bits fangyu.yu
2025-08-20 12:59 ` [PATCH v3 2/2] RISC-V KVM: Remove unnecessary HGATP csr_read fangyu.yu
2025-08-20 14:40 ` Troy Mitchell
2025-08-21 1:13 ` Guo Ren
2025-08-21 1:25 ` Guo Ren
2025-08-21 2:29 ` Guo Ren
2025-08-21 2:49 ` Nutty.Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox