mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 15:18:15 +00:00
x86: implement gbpages support in change_page_attr()
Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
b536022227
commit
f07333fd14
1 changed files with 15 additions and 2 deletions
|
@ -281,7 +281,12 @@ static int try_preserve_large_page(pte_t *kpte, unsigned long address,
|
||||||
psize = PMD_PAGE_SIZE;
|
psize = PMD_PAGE_SIZE;
|
||||||
pmask = PMD_PAGE_MASK;
|
pmask = PMD_PAGE_MASK;
|
||||||
break;
|
break;
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
case PG_LEVEL_1G:
|
case PG_LEVEL_1G:
|
||||||
|
psize = PMD_PAGE_SIZE;
|
||||||
|
pmask = PMD_PAGE_MASK;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
@ -343,7 +348,7 @@ static int split_large_page(pte_t *kpte, unsigned long address)
|
||||||
{
|
{
|
||||||
pgprot_t ref_prot;
|
pgprot_t ref_prot;
|
||||||
gfp_t gfp_flags = GFP_KERNEL;
|
gfp_t gfp_flags = GFP_KERNEL;
|
||||||
unsigned long flags, addr, pfn;
|
unsigned long flags, addr, pfn, pfninc = 1;
|
||||||
pte_t *pbase, *tmp;
|
pte_t *pbase, *tmp;
|
||||||
struct page *base;
|
struct page *base;
|
||||||
unsigned int i, level;
|
unsigned int i, level;
|
||||||
|
@ -372,11 +377,19 @@ static int split_large_page(pte_t *kpte, unsigned long address)
|
||||||
#endif
|
#endif
|
||||||
ref_prot = pte_pgprot(pte_clrhuge(*kpte));
|
ref_prot = pte_pgprot(pte_clrhuge(*kpte));
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
|
if (level == PG_LEVEL_1G) {
|
||||||
|
pfninc = PMD_PAGE_SIZE >> PAGE_SHIFT;
|
||||||
|
pgprot_val(ref_prot) |= _PAGE_PSE;
|
||||||
|
addr &= PUD_PAGE_MASK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the target pfn from the original entry:
|
* Get the target pfn from the original entry:
|
||||||
*/
|
*/
|
||||||
pfn = pte_pfn(*kpte);
|
pfn = pte_pfn(*kpte);
|
||||||
for (i = 0; i < PTRS_PER_PTE; i++, pfn++)
|
for (i = 0; i < PTRS_PER_PTE; i++, pfn += pfninc)
|
||||||
set_pte(&pbase[i], pfn_pte(pfn, ref_prot));
|
set_pte(&pbase[i], pfn_pte(pfn, ref_prot));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue