[RFC kvmtool 01/31] arm64: Disable MTE when CFI flash is emulated

Suzuki K Poulose
2023-01-27T11:40:48Z

CFI Flash file image cannot be mapped into the memory of the
guest if MTE is enabled. Thus disable MTE if flash emulation
is requested.

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arm/aarch64/kvm.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arm/aarch64/kvm.c b/arm/aarch64/kvm.c
index 54200c9e..5a53badb 100644
--- a/arm/aarch64/kvm.c
+++ b/arm/aarch64/kvm.c
@@ -145,6 +145,12 @@ void kvm__arch_enable_mte(struct kvm *kvm)
return;
}

+ if (kvm->cfg.flash_filename) {
+ kvm->cfg.arch.mte_disabled = true;
+ pr_info("MTE is incompatible with CFI flash support, disabling");
+ return;
+ }
+
if (kvm->cfg.arch.mte_disabled) {
pr_debug("MTE disabled by user");
return;
--
2.34.1