Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/mm: convert pte_val()/pXd_val() into functions

Disallow constructs like this:

pte_val(*pte) = __pa(addr) | prot;

which would directly write into a page table. Users are supposed to
use the set_pte()/set_pXd() primitives, which guarantee block
concurrent (aka atomic) writes.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Heiko Carstens and committed by
Vasily Gorbik
966ffbd8 e1fc74ff

+25 -5
+25 -5
arch/s390/include/asm/page.h
··· 90 90 91 91 #define pgprot_val(x) ((x).pgprot) 92 92 #define pgste_val(x) ((x).pgste) 93 - #define pte_val(x) ((x).pte) 94 - #define pmd_val(x) ((x).pmd) 95 - #define pud_val(x) ((x).pud) 96 - #define p4d_val(x) ((x).p4d) 97 - #define pgd_val(x) ((x).pgd) 93 + 94 + static inline unsigned long pte_val(pte_t pte) 95 + { 96 + return pte.pte; 97 + } 98 + 99 + static inline unsigned long pmd_val(pmd_t pmd) 100 + { 101 + return pmd.pmd; 102 + } 103 + 104 + static inline unsigned long pud_val(pud_t pud) 105 + { 106 + return pud.pud; 107 + } 108 + 109 + static inline unsigned long p4d_val(p4d_t p4d) 110 + { 111 + return p4d.p4d; 112 + } 113 + 114 + static inline unsigned long pgd_val(pgd_t pgd) 115 + { 116 + return pgd.pgd; 117 + } 98 118 99 119 #define __pgste(x) ((pgste_t) { (x) } ) 100 120 #define __pte(x) ((pte_t) { (x) } )