Skip to content

Commit 0515e02

Browse files
xzpeterakpm00
authored andcommitted
mm: always define pxx_pgprot()
There're: - 8 archs (arc, arm64, include, mips, powerpc, s390, sh, x86) that support pte_pgprot(). - 2 archs (x86, sparc) that support pmd_pgprot(). - 1 arch (x86) that support pud_pgprot(). Always define them to be used in generic code, and then we don't need to fiddle with "#ifdef"s when doing so. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Alex Williamson <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Gavin Shan <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Niklas Schnelle <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Sean Christopherson <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Will Deacon <[email protected]> Cc: Zi Yan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent bc02afb commit 0515e02

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ static inline void __sync_cache_and_tags(pte_t pte, unsigned int nr_pages)
384384
/*
385385
* Select all bits except the pfn
386386
*/
387+
#define pte_pgprot pte_pgprot
387388
static inline pgprot_t pte_pgprot(pte_t pte)
388389
{
389390
unsigned long pfn = pte_pfn(pte);

arch/powerpc/include/asm/pgtable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static inline unsigned long pte_pfn(pte_t pte)
6565
/*
6666
* Select all bits except the pfn
6767
*/
68+
#define pte_pgprot pte_pgprot
6869
static inline pgprot_t pte_pgprot(pte_t pte)
6970
{
7071
unsigned long pte_flags;

arch/s390/include/asm/pgtable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,7 @@ static inline int pte_unused(pte_t pte)
955955
* young/old accounting is not supported, i.e _PAGE_PROTECT and _PAGE_INVALID
956956
* must not be set.
957957
*/
958+
#define pte_pgprot pte_pgprot
958959
static inline pgprot_t pte_pgprot(pte_t pte)
959960
{
960961
unsigned long pte_flags = pte_val(pte) & _PAGE_CHG_MASK;

arch/sparc/include/asm/pgtable_64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ static inline pmd_t pmd_mkwrite_novma(pmd_t pmd)
783783
return __pmd(pte_val(pte));
784784
}
785785

786+
#define pmd_pgprot pmd_pgprot
786787
static inline pgprot_t pmd_pgprot(pmd_t entry)
787788
{
788789
unsigned long val = pmd_val(entry);

include/linux/pgtable.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,18 @@ typedef unsigned int pgtbl_mod_mask;
19561956
#define MAX_PTRS_PER_P4D PTRS_PER_P4D
19571957
#endif
19581958

1959+
#ifndef pte_pgprot
1960+
#define pte_pgprot(x) ((pgprot_t) {0})
1961+
#endif
1962+
1963+
#ifndef pmd_pgprot
1964+
#define pmd_pgprot(x) ((pgprot_t) {0})
1965+
#endif
1966+
1967+
#ifndef pud_pgprot
1968+
#define pud_pgprot(x) ((pgprot_t) {0})
1969+
#endif
1970+
19591971
/* description of effects of mapping type and prot in current implementation.
19601972
* this is due to the limited x86 page protection hardware. The expected
19611973
* behavior is in parens:

0 commit comments

Comments
 (0)