[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
target/arm: cp15.dacr migration
From: |
Pavel Dovgalyuk |
Subject: |
target/arm: cp15.dacr migration |
Date: |
Mon, 7 Feb 2022 15:13:12 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 |
I recently encountered a problem with cp15.dacr register.
It has _s and _ns versions. During the migration only dacr_ns is
saved/loaded.
But both of the values are used in get_phys_addr_v5 and get_phys_addr_v6
functions. Therefore VM behavior becomes incorrect after loading the
vmstate.
I found that kvm_to_cpreg_id is responsible for disabling dacr_s
migration, because it always selects ns variant.
I used the following changes to solve the problem, but I'm not sure that
these changes do not break anything in KVM.
Can anyone give me an advice about that?
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index c6a4d50e82..d3ffef3640 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -2510,11 +2510,6 @@ static inline uint32_t kvm_to_cpreg_id(uint64_t
kvmid)
if ((kvmid & CP_REG_SIZE_MASK) == CP_REG_SIZE_U64) {
cpregid |= (1 << 15);
}
-
- /* KVM is always non-secure so add the NS flag on AArch32 register
- * entries.
- */
- cpregid |= 1 << CP_REG_NS_SHIFT;
}
return cpregid;
}
--
Pavel Dovgalyuk
- target/arm: cp15.dacr migration,
Pavel Dovgalyuk <=