]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm: KVM: Fix incorrect device to IPA mapping
authorMarek Majtyka <marek.majtyka@tieto.com>
Wed, 16 Sep 2015 10:04:55 +0000 (12:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Oct 2015 21:43:10 +0000 (14:43 -0700)
commit10e259a1ec2e4b39e1a9d49d51dbd152a8e5f3c3
treef3b16fedf38a4aaf91d5616d8a40ee4608a4538f
parent27f1b7fed9c305ef46f8708f1bdde9cdb5f166bd
arm: KVM: Fix incorrect device to IPA mapping

commit ca09f02f122b2ecb0f5ddfc5fd47b29ed657d4fd upstream.

A critical bug has been found in device memory stage1 translation for
VMs with more then 4GB of address space. Once vm_pgoff size is smaller
then pa (which is true for LPAE case, u32 and u64 respectively) some
more significant bits of pa may be lost as a shift operation is performed
on u32 and later cast onto u64.

Example: vm_pgoff(u32)=0x00210030, PAGE_SHIFT=12
        expected pa(u64):   0x0000002010030000
        produced pa(u64):   0x0000000010030000

The fix is to change the order of operations (casting first onto phys_addr_t
and then shifting).

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
[maz: fixed changelog and patch formatting]
Signed-off-by: Marek Majtyka <marek.majtyka@tieto.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/kvm/mmu.c