From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] arm64: KVM: Fix wrong use of the CPSR MODE mask for 32bit guests
Date: Thu, 28 Jan 2016 10:30:36 +0000 [thread overview]
Message-ID: <1453977038-13516-4-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1453977038-13516-1-git-send-email-marc.zyngier@arm.com>
From: Shannon Zhao <shannon.zhao@linaro.org>
The values of CPSR MODE mask are different between aarch32 and aarch64.
It should use the right one according to the execution state.
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm64/include/asm/kvm_emulate.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index 3066328..779a587 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -127,10 +127,14 @@ static inline unsigned long *vcpu_spsr(const struct kvm_vcpu *vcpu)
static inline bool vcpu_mode_priv(const struct kvm_vcpu *vcpu)
{
- u32 mode = *vcpu_cpsr(vcpu) & PSR_MODE_MASK;
+ u32 mode;
- if (vcpu_mode_is_32bit(vcpu))
+ if (vcpu_mode_is_32bit(vcpu)) {
+ mode = *vcpu_cpsr(vcpu) & COMPAT_PSR_MODE_MASK;
return mode > COMPAT_PSR_MODE_USR;
+ }
+
+ mode = *vcpu_cpsr(vcpu) & PSR_MODE_MASK;
return mode != PSR_MODE_EL0t;
}
--
2.1.4
next prev parent reply other threads:[~2016-01-28 10:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 10:30 [GIT PULL] KVM/ARM updates for 4.5-rc2 Marc Zyngier
2016-01-28 10:30 ` [PATCH 1/5] arm64: KVM: Fix AArch64 guest userspace exception injection Marc Zyngier
2016-01-28 10:30 ` [PATCH 2/5] arm64: KVM: Obey RES0/1 reserved bits when setting CPTR_EL2 Marc Zyngier
2016-01-28 10:30 ` Marc Zyngier [this message]
2016-01-28 10:30 ` [PATCH 4/5] arm64: KVM: Fix comments of the CP handler Marc Zyngier
2016-01-28 10:30 ` [PATCH 5/5] arm64: KVM: Fix guest dead loop when register accessor returns false Marc Zyngier
2016-02-08 15:23 ` [GIT PULL] KVM/ARM updates for 4.5-rc2 Paolo Bonzini
2016-02-08 15:31 ` Marc Zyngier
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=1453977038-13516-4-git-send-email-marc.zyngier@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).