]> git.ipfire.org Git - people/arne_f/kernel.git/commit
ARM: 8108/1: mm: Introduce {pte,pmd}_isset and {pte,pmd}_isclear
authorSteven Capper <steve.capper@linaro.org>
Fri, 18 Jul 2014 15:15:27 +0000 (16:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2015 08:31:55 +0000 (10:31 +0200)
commite8043c52d169ff7e59c9486eb202f03623b29ab0
tree28254ac96ca5332708e1a55819249e96617aff05
parent910584ae1ffcac7067429a90360dd2168d7d3fcf
ARM: 8108/1: mm: Introduce {pte,pmd}_isset and {pte,pmd}_isclear

commit f2950706871c4b6e8c0f0d7c3f62d35930b8de63 upstream.

Long descriptors on ARM are 64 bits, and some pte functions such as
pte_dirty return a bitwise-and of a flag with the pte value. If the
flag to be tested resides in the upper 32 bits of the pte, then we run
into the danger of the result being dropped if downcast.

For example:
gather_stats(page, md, pte_dirty(*pte), 1);
where pte_dirty(*pte) is downcast to an int.

This patch introduces a new macro pte_isset which performs the bitwise
and, then performs a double logical invert (where needed) to ensure
predictable downcasting. The logical inverse pte_isclear is also
introduced.

Equivalent pmd functions for Transparent HugePages have also been
added.

Signed-off-by: Steve Capper <steve.capper@linaro.org>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[hpy: Backported to 3.14
 - adjust the context ]
Signed-off-by: Hou Pengyang <houpengyang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/include/asm/pgtable-3level.h
arch/arm/include/asm/pgtable.h