Skip to content

Commit 30796e1

Browse files
lsgunthtorvalds
authored andcommitted
x86/mm: introduce __set_memory_prot()
For use in the 32bit arch_add_memory() to set the pgprot type of the memory to add. Signed-off-by: Logan Gunthorpe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Dan Williams <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Eric Badger <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Will Deacon <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent c164fbb commit 30796e1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

arch/x86/include/asm/set_memory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* The caller is required to take care of these.
3535
*/
3636

37+
int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot);
3738
int _set_memory_uc(unsigned long addr, int numpages);
3839
int _set_memory_wc(unsigned long addr, int numpages);
3940
int _set_memory_wt(unsigned long addr, int numpages);

arch/x86/mm/pat/set_memory.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,19 @@ static inline int cpa_clear_pages_array(struct page **pages, int numpages,
17951795
CPA_PAGES_ARRAY, pages);
17961796
}
17971797

1798+
/*
1799+
* _set_memory_prot is an internal helper for callers that have been passed
1800+
* a pgprot_t value from upper layers and a reservation has already been taken.
1801+
* If you want to set the pgprot to a specific page protocol, use the
1802+
* set_memory_xx() functions.
1803+
*/
1804+
int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot)
1805+
{
1806+
return change_page_attr_set_clr(&addr, numpages, prot,
1807+
__pgprot(~pgprot_val(prot)), 0, 0,
1808+
NULL);
1809+
}
1810+
17981811
int _set_memory_uc(unsigned long addr, int numpages)
17991812
{
18001813
/*

0 commit comments

Comments
 (0)