diff options
author | Christoffer Dall <christoffer.dall@linaro.org> | 2013-08-06 03:08:41 +0200 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2013-08-06 20:32:30 +0200 |
commit | 240e99cbd00aa541b572480e3ea7ecb0d480bc79 (patch) | |
tree | 758ef9aff571daca39b9744fc873e22511cf4ff8 /arch/arm/kvm/coproc_a15.c | |
parent | KVM: s390: fix pfmf non-quiescing control handling (diff) | |
download | linux-240e99cbd00aa541b572480e3ea7ecb0d480bc79.tar.xz linux-240e99cbd00aa541b572480e3ea7ecb0d480bc79.zip |
ARM: KVM: Fix 64-bit coprocessor handling
The PAR was exported as CRn == 7 and CRm == 0, but in fact the primary
coprocessor register number was determined by CRm for 64-bit coprocessor
registers as the user space API was modeled after the coprocessor
access instructions (see the ARM ARM rev. C - B3-1445).
However, just changing the CRn to CRm breaks the sorting check when
booting the kernel, because the internal kernel logic always treats CRn
as the primary register number, and it makes the table sorting
impossible to understand for humans.
Alternatively we could change the logic to always have CRn == CRm, but
that becomes unclear in the number of ways we do look up of a coprocessor
register. We could also have a separate 64-bit table but that feels
somewhat over-engineered. Instead, keep CRn the primary representation
of the primary coproc. register number in-kernel and always export the
primary number as CRm as per the existing user space ABI.
Note: The TTBR registers just magically worked because they happened to
follow the CRn(0) regs and were considered CRn(0) in the in-kernel
representation.
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'arch/arm/kvm/coproc_a15.c')
-rw-r--r-- | arch/arm/kvm/coproc_a15.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/arm/kvm/coproc_a15.c b/arch/arm/kvm/coproc_a15.c index 685063a6d0cf..cf93472b9dd6 100644 --- a/arch/arm/kvm/coproc_a15.c +++ b/arch/arm/kvm/coproc_a15.c @@ -114,7 +114,11 @@ static bool access_l2ectlr(struct kvm_vcpu *vcpu, /* * A15-specific CP15 registers. - * Important: Must be sorted ascending by CRn, CRM, Op1, Op2 + * CRn denotes the primary register number, but is copied to the CRm in the + * user space API for 64-bit register access in line with the terminology used + * in the ARM ARM. + * Important: Must be sorted ascending by CRn, CRM, Op1, Op2 and with 64-bit + * registers preceding 32-bit ones. */ static const struct coproc_reg a15_regs[] = { /* MPIDR: we use VMPIDR for guest access. */ |