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

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to