linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/kvm: correct the error report in kvm_handle_guest_abort
@ 2021-01-15  9:30 Jianyong Wu
  2021-01-15 11:20 ` Marc Zyngier
  0 siblings, 1 reply; 14+ messages in thread
From: Jianyong Wu @ 2021-01-15  9:30 UTC (permalink / raw)
  To: maz, james.morse, will
  Cc: justin.he, Steve.Capper, jianyong.wu, nd, suzuki.poulose, kvmarm,
	linux-arm-kernel

Currently, error report when cache maintenance at read-only memory range,
like rom, is not clear enough and even not correct. As the specific error
is definitely known by kvm, it is obliged to give it out.

Fox example, in a qemu/kvm VM, if the guest do dc at the pflash range from
0 to 128M, error is reported by kvm as "Data abort outside memslots with
no valid syndrome info" which is not quite correct.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 arch/arm64/kvm/mmu.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index 7d2257cc5438..de66b7e38a5b 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -1022,9 +1022,15 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
 		 * So let's assume that the guest is just being
 		 * cautious, and skip the instruction.
 		 */
-		if (kvm_is_error_hva(hva) && kvm_vcpu_dabt_is_cm(vcpu)) {
-			kvm_incr_pc(vcpu);
-			ret = 1;
+		if (kvm_vcpu_dabt_is_cm(vcpu)) {
+			if (kvm_is_error_hva(hva)) {
+				kvm_incr_pc(vcpu);
+				ret = 1;
+				goto out_unlock;
+			}
+
+			kvm_err("Do cache maintenance in the read-only memory range\n");
+			ret = -EFAULT;
 			goto out_unlock;
 		}
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-01-28  9:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-15  9:30 [PATCH] arm64/kvm: correct the error report in kvm_handle_guest_abort Jianyong Wu
2021-01-15 11:20 ` Marc Zyngier
2021-01-16  8:46   ` Jianyong Wu
2021-01-18 13:01     ` Jianyong Wu
2021-01-18 13:04     ` Jianyong Wu
2021-01-18 13:26       ` Marc Zyngier
2021-01-18 13:38         ` Jianyong Wu
2021-01-18 13:44           ` Marc Zyngier
2021-01-18 14:24             ` Jianyong Wu
2021-01-26  8:10   ` Jianyong Wu
2021-01-26  9:18     ` Marc Zyngier
2021-01-28  3:01       ` Jianyong Wu
2021-01-28  9:07         ` Marc Zyngier
2021-01-28  9:55           ` Jianyong Wu

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).