Skip to contentSkip to conversation

KVM: arm64: Change back kvm fault condition to translation

PATCH Applied Wujie Duan 4 participants 6 messages Mar 18, 2024 – Mar 26, 2024

Subsystems (2)
lore
Share & tools
lore

Wujie Duan

author
#0 lore raw

PATCH 1/1 KVM: arm64: Change back kvm fault condition to translation

KVM: arm64: Condition should be esr_fsc_is_translation_fault

In commit '11e5ea5242e3 ("KVM: arm64: Use helpers to
classify exception types reported via ESR")'
the KVM code was optimized, but the code logic was incorrectly modified. Therefore, it is being corrected.

---
 arch/arm64/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/mmu.c +1 -1
index 18680771cdb0..dc04bc767865 100644
@@ -1637,7 +1637,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
 	fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);
 	is_iabt = kvm_vcpu_trap_is_iabt(vcpu);
 
-	if (esr_fsc_is_permission_fault(esr)) {
+	if (esr_fsc_is_translation_fault(esr)) {
 		/* Beyond sanitised PARange (which is the IPA limit) */
 		if (fault_ipa >= BIT_ULL(get_kvm_ipa_limit())) {
 			kvm_inject_size_fault(vcpu);
Signature · 1 line
2.40.1
maintainer Acked-by Ard Biesheuvel Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Wujie Duan

KVM: arm64: Condition should be esr_fsc_is_translation_fault

In commit '11e5ea5242e3 ("KVM: arm64: Use helpers to
classify exception types reported via ESR")'
the KVM code was optimized, but the code logic was incorrectly modified. Therefore, it is being corrected.

---
 arch/arm64/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/mmu.c +0 -0
index 18680771cdb0..dc04bc767865 100644

arch/arm64/kvm/mmu.c int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) · line 1643

Quoted 8 lines
arch/arm64/kvm/mmu.c +1 -1
@@ -1637,7 +1637,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
 	fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);
 	is_iabt = kvm_vcpu_trap_is_iabt(vcpu);
 
-	if (esr_fsc_is_permission_fault(esr)) {
+	if (esr_fsc_is_translation_fault(esr)) {
 		/* Beyond sanitised PARange (which is the IPA limit) */
 		if (fault_ipa >= BIT_ULL(get_kvm_ipa_limit())) {
 			kvm_inject_size_fault(vcpu);

I think 7 tries are enough ;-). Here's what I was expecting:

- a subject indicating the nature of the issue as a one-liner
- a commit message describing the exact situation
- a Fixes: tag indicating the commit being fixed
- a Cc: stable tag to indicate this needs backporting
- Ard's Ack, as he's been kind enough to look into it

See below for the full patch and my own RB tag. In the future, please try to follow these guidelines.

Oliver, can you please pick this ASAP?

Thanks,

	M.

From 10febd177a551e1f9bfb708a0b3865ca642f9a85 Mon Sep 17 00:00:00 2001
From: Wujie Duan <[email protected]>
Date: Mon, 18 Mar 2024 17:47:35 +0800
Subject: [PATCH] KVM: arm64: Fix out-of-IPA space translation fault handling

Commit 11e5ea5242e3 ("KVM: arm64: Use helpers to classify exception types reported via ESR") tried to abstract the translation fault check when handling an out-of IPA space condition, but incorrectly replaced it with a permission fault check.

Restore the previous translation fault check.

Fixes 11e5ea5242e3 ("KVM: arm64: Use helpers to classify exception types reported via ESR")
---
 arch/arm64/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/mmu.c +1 -1
index 2902f3ffca3c..df90ebc039dc 100644
@@ -1637,7 +1637,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
 	fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);
 	is_iabt = kvm_vcpu_trap_is_iabt(vcpu);
 
-	if (esr_fsc_is_permission_fault(esr)) {
+	if (esr_fsc_is_translation_fault(esr)) {
 		/* Beyond sanitised PARange (which is the IPA limit) */
 		if (fault_ipa >= BIT_ULL(get_kvm_ipa_limit())) {
 			kvm_inject_size_fault(vcpu);
Signature · 5 lines
2.39.2


-- 
Without deviation from the norm, progress is not possible.
reviewer Reviewed-by
#2 lore raw
Quoted 7 lines · Marc Zyngier

Subject: [PATCH] KVM: arm64: Fix out-of-IPA space translation fault handling

Commit 11e5ea5242e3 ("KVM: arm64: Use helpers to classify exception types reported via ESR") tried to abstract the translation fault check when handling an out-of IPA space condition, but incorrectly replaced it with a permission fault check.

Quoted 7 lines

Restore the previous translation fault check.

Fixes 11e5ea5242e3 ("KVM: arm64: Use helpers to classify exception types reported via ESR")
#3 lore raw
In reply to Marc Zyngier

Hey,

Quoted 1 line · Marc Zyngier

I think 7 tries are enough ;-). Here's what I was expecting:

Hopefully I'm looking at the right thread!

Quoted 10 lines

- a subject indicating the nature of the issue as a one-liner
- a commit message describing the exact situation
- a Fixes: tag indicating the commit being fixed
- a Cc: stable tag to indicate this needs backporting
- Ard's Ack, as he's been kind enough to look into it

See below for the full patch and my own RB tag. In the future, please try to follow these guidelines.

Oliver, can you please pick this ASAP?

Yup, I'll queue it up but I only plan on sending the first set of fixes after -rc1 as I'll be AFK for a few days this week. I'll get a respin of the vPMU + nVHE stuff out too.

Signature · 2 lines
Thanks,
Oliver
maintainer
#4 lore raw
Quoted 8 lines · Oliver Upton

Hey,

Quoted 1 line · Marc Zyngier

I think 7 tries are enough ;-). Here's what I was expecting:

Hopefully I'm looking at the right thread!

You are!

Quoted 7 lines
Quoted 7 lines

- a subject indicating the nature of the issue as a one-liner
- a commit message describing the exact situation
- a Fixes: tag indicating the commit being fixed
- a Cc: stable tag to indicate this needs backporting
- Ard's Ack, as he's been kind enough to look into it

Quoted 8 lines
Quoted 4 lines

See below for the full patch and my own RB tag. In the future, please try to follow these guidelines.

Oliver, can you please pick this ASAP?

Yup, I'll queue it up but I only plan on sending the first set of fixes after -rc1 as I'll be AFK for a few days this week. I'll get a respin of the vPMU + nVHE stuff out too.

Sounds good. This is only a corner case anyway, which is why it didn't show up in my testing, and -rc1 is the right spot for it.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Applied
#5 lore raw

Re: (subset) [PATCH] KVM: arm64: Change back kvm fault condition to translation

In reply to Wujie Duan
Quoted 8 lines · Wujie Duan

KVM: arm64: Condition should be esr_fsc_is_translation_fault

In commit '11e5ea5242e3 ("KVM: arm64: Use helpers to
classify exception types reported via ESR")'
the KVM code was optimized, but the code logic was incorrectly modified. Therefore, it is being corrected.

[...]

Applied to kvmarm/fixes, thanks!

[1/1] KVM: arm64: Change back kvm fault condition to translation

	f5fe0adeed6019df495497a64cb57d563ead2296
Signature · 2 lines
Best,
Oliver