Skip to contentSkip to conversation

RISC-V: KVM: Fix comments in kvm_riscv_vcpu_isa_disable_allowed

PATCH Superseded Chao Du 2 participants 3 messages Feb 20, 2025 – Feb 21, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chao Du

author
#0 lore raw

PATCH 1/1 RISC-V: KVM: Fix comments in kvm_riscv_vcpu_isa_disable_allowed

The comments for EXT_SVADE are opposite with the codes. Fix it to avoid confusion.

---
 arch/riscv/kvm/vcpu_onereg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kvm/vcpu_onereg.c +1 -1
index f6d27b59c641..6df41794e346 100644
@@ -203,7 +203,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext)
 	case KVM_RISCV_ISA_EXT_SVADE:
 		/*
 		 * The henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero.
-		 * Svade is not allowed to disable when the platform use Svade.
+		 * Svade is allowed to disable when the platform use Svade.
 		 */
 		return arch_has_hw_pte_young();
 	default:
Signature · 1 line
2.34.1
#1 lore raw
Quoted 13 lines · Chao Du

The comments for EXT_SVADE are opposite with the codes. Fix it to avoid confusion.

---
 arch/riscv/kvm/vcpu_onereg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kvm/vcpu_onereg.c +0 -0
index f6d27b59c641..6df41794e346 100644

arch/riscv/kvm/vcpu_onereg.c static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) · line 207

Quoted 6 lines
arch/riscv/kvm/vcpu_onereg.c +1 -1
@@ -203,7 +203,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext)
 	case KVM_RISCV_ISA_EXT_SVADE:
 		/*
 		 * The henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero.
-		 * Svade is not allowed to disable when the platform use Svade.
+		 * Svade is allowed to disable when the platform use Svade.
 		 */

It was correct (but confusing) before this change. When arch_has_hw_pte_young() returns true, that means we can use SVADU (which is !SVADE). If we don't have SVADU, then we must be using SVADE, and therefore can't disable it.

How about

/*
* The henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero.
* Svade can't be disabled unless we support Svadu. */

Thanks,
drew

Quoted 10 lines
arch/riscv/kvm/vcpu_onereg.c +0 -0
 		return arch_has_hw_pte_young();
 	default:
Signature · 7 lines
2.34.1


-- 
kvm-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kvm-riscv
author
#2 lore raw
Quoted 9 lines · Andrew Jones
Quoted 8 lines · Chao Du

The comments for EXT_SVADE are opposite with the codes. Fix it to avoid confusion.

---
 arch/riscv/kvm/vcpu_onereg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines

arch/riscv/kvm/vcpu_onereg.c static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) · line 207

Quoted 11 lines
arch/riscv/kvm/vcpu_onereg.c +1 -1
index f6d27b59c641..6df41794e346 100644
@@ -203,7 +203,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext)
 	case KVM_RISCV_ISA_EXT_SVADE:
 		/*
 		 * The henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero.
-		 * Svade is not allowed to disable when the platform use Svade.
+		 * Svade is allowed to disable when the platform use Svade.
 		 */

It was correct (but confusing) before this change. When arch_has_hw_pte_young() returns true, that means we can use SVADU (which is !SVADE). If we don't have SVADU, then we must be using SVADE, and therefore can't disable it.

Thanks for the clarification.
I had some misunderstandings about the relation between SVADU and SVADE.

Quoted 6 lines

How about

/*
* The henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero.
* Svade can't be disabled unless we support Svadu. */

Yeah, that's better.

Thanks,
Chao

Quoted 14 lines

Thanks,
drew

Quoted 10 lines
arch/riscv/kvm/vcpu_onereg.c +0 -0
 		return arch_has_hw_pte_young();
 	default:
Signature · 7 lines
2.34.1


-- 
kvm-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kvm-riscv
Signature · 3 lines
kvm-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kvm-riscv