From: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>
To: QEMU Developers <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>
Subject: target/arm: cp15.dacr migration
Date: Mon, 7 Feb 2022 15:13:12 +0300 [thread overview]
Message-ID: <662aca02-da99-524f-d9df-cd61427ca520@ispras.ru> (raw)
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
next reply other threads:[~2022-02-07 12:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 12:13 Pavel Dovgalyuk [this message]
2022-02-07 13:44 ` target/arm: cp15.dacr migration Peter Maydell
2022-02-08 4:56 ` Pavel Dovgalyuk
2022-02-08 10:19 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=662aca02-da99-524f-d9df-cd61427ca520@ispras.ru \
--to=pavel.dovgalyuk@ispras.ru \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).