diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2022-02-21 21:25:19 +0100 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2022-03-01 21:05:10 +0100 |
commit | 966ffbd8615a5c1b0bf474314bbd9ea8eb6ef423 (patch) | |
tree | e262b0f3543edb9bf10b9d38fc178b80e27b5c73 /arch/s390/include/asm | |
parent | s390/mm,gmap: don't use pte_val()/pXd_val() as lvalue (diff) | |
download | linux-966ffbd8615a5c1b0bf474314bbd9ea8eb6ef423.tar.xz linux-966ffbd8615a5c1b0bf474314bbd9ea8eb6ef423.zip |
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>
Diffstat (limited to 'arch/s390/include/asm')
-rw-r--r-- | arch/s390/include/asm/page.h | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h index d98d17a36c7b..5a831a6b8fc9 100644 --- a/arch/s390/include/asm/page.h +++ b/arch/s390/include/asm/page.h @@ -90,11 +90,31 @@ typedef pte_t *pgtable_t; #define pgprot_val(x) ((x).pgprot) #define pgste_val(x) ((x).pgste) -#define pte_val(x) ((x).pte) -#define pmd_val(x) ((x).pmd) -#define pud_val(x) ((x).pud) -#define p4d_val(x) ((x).p4d) -#define pgd_val(x) ((x).pgd) + +static inline unsigned long pte_val(pte_t pte) +{ + return pte.pte; +} + +static inline unsigned long pmd_val(pmd_t pmd) +{ + return pmd.pmd; +} + +static inline unsigned long pud_val(pud_t pud) +{ + return pud.pud; +} + +static inline unsigned long p4d_val(p4d_t p4d) +{ + return p4d.p4d; +} + +static inline unsigned long pgd_val(pgd_t pgd) +{ + return pgd.pgd; +} #define __pgste(x) ((pgste_t) { (x) } ) #define __pte(x) ((pte_t) { (x) } ) |