Commit 0814e0ba authored by Eduardo Habkost's avatar Eduardo Habkost Committed by Ingo Molnar

x86, 64-bit: split set_pte_vaddr()

We will need to set a pte on l3_user_pgt. Extract set_pte_vaddr_pud()
from set_pte_vaddr(), that will accept the l3 page table as parameter.

This change should be a no-op for existing code.
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: default avatarMark McLoughlin <markmc@redhat.com>
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 4f30cb02
...@@ -144,22 +144,13 @@ static __init void *spp_getpage(void) ...@@ -144,22 +144,13 @@ static __init void *spp_getpage(void)
} }
void void
set_pte_vaddr(unsigned long vaddr, pte_t new_pte) set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte)
{ {
pgd_t *pgd;
pud_t *pud; pud_t *pud;
pmd_t *pmd; pmd_t *pmd;
pte_t *pte; pte_t *pte;
pr_debug("set_pte_vaddr %lx to %lx\n", vaddr, native_pte_val(new_pte)); pud = pud_page + pud_index(vaddr);
pgd = pgd_offset_k(vaddr);
if (pgd_none(*pgd)) {
printk(KERN_ERR
"PGD FIXMAP MISSING, it should be setup in head.S!\n");
return;
}
pud = pud_offset(pgd, vaddr);
if (pud_none(*pud)) { if (pud_none(*pud)) {
pmd = (pmd_t *) spp_getpage(); pmd = (pmd_t *) spp_getpage();
pud_populate(&init_mm, pud, pmd); pud_populate(&init_mm, pud, pmd);
...@@ -192,6 +183,24 @@ set_pte_vaddr(unsigned long vaddr, pte_t new_pte) ...@@ -192,6 +183,24 @@ set_pte_vaddr(unsigned long vaddr, pte_t new_pte)
__flush_tlb_one(vaddr); __flush_tlb_one(vaddr);
} }
void
set_pte_vaddr(unsigned long vaddr, pte_t pteval)
{
pgd_t *pgd;
pud_t *pud_page;
pr_debug("set_pte_vaddr %lx to %lx\n", vaddr, native_pte_val(pteval));
pgd = pgd_offset_k(vaddr);
if (pgd_none(*pgd)) {
printk(KERN_ERR
"PGD FIXMAP MISSING, it should be setup in head.S!\n");
return;
}
pud_page = (pud_t*)pgd_page_vaddr(*pgd);
set_pte_vaddr_pud(pud_page, vaddr, pteval);
}
/* /*
* The head.S code sets up the kernel high mapping: * The head.S code sets up the kernel high mapping:
* *
......
...@@ -70,6 +70,9 @@ extern void paging_init(void); ...@@ -70,6 +70,9 @@ extern void paging_init(void);
struct mm_struct; struct mm_struct;
void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);
static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
pte_t *ptep) pte_t *ptep)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment