Commit ce803e70 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Ingo Molnar

xen64: use arbitrary_virt_to_machine for xen_set_pmd

When building initial pagetables in 64-bit kernel the pud/pmd pointer may
be in ioremap/fixmap space, so we need to walk the pagetable to look up the
physical address.
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent ebd879e3
...@@ -178,8 +178,9 @@ void set_phys_to_machine(unsigned long pfn, unsigned long mfn) ...@@ -178,8 +178,9 @@ void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
p2m_top[topidx][idx] = mfn; p2m_top[topidx][idx] = mfn;
} }
xmaddr_t arbitrary_virt_to_machine(unsigned long address) xmaddr_t arbitrary_virt_to_machine(void *vaddr)
{ {
unsigned long address = (unsigned long)vaddr;
unsigned int level; unsigned int level;
pte_t *pte = lookup_address(address, &level); pte_t *pte = lookup_address(address, &level);
unsigned offset = address & ~PAGE_MASK; unsigned offset = address & ~PAGE_MASK;
...@@ -253,7 +254,8 @@ void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val) ...@@ -253,7 +254,8 @@ void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
xen_mc_batch(); xen_mc_batch();
u.ptr = virt_to_machine(ptr).maddr; /* ptr may be ioremapped for 64-bit pagetable setup */
u.ptr = arbitrary_virt_to_machine(ptr).maddr;
u.val = pmd_val_ma(val); u.val = pmd_val_ma(val);
extend_mmu_update(&u); extend_mmu_update(&u);
...@@ -415,7 +417,8 @@ void xen_set_pud_hyper(pud_t *ptr, pud_t val) ...@@ -415,7 +417,8 @@ void xen_set_pud_hyper(pud_t *ptr, pud_t val)
xen_mc_batch(); xen_mc_batch();
u.ptr = virt_to_machine(ptr).maddr; /* ptr may be ioremapped for 64-bit pagetable setup */
u.ptr = arbitrary_virt_to_machine(ptr).maddr;
u.val = pud_val_ma(val); u.val = pud_val_ma(val);
extend_mmu_update(&u); extend_mmu_update(&u);
......
...@@ -158,7 +158,7 @@ static inline pte_t __pte_ma(pteval_t x) ...@@ -158,7 +158,7 @@ static inline pte_t __pte_ma(pteval_t x)
#define pgd_val_ma(x) ((x).pgd) #define pgd_val_ma(x) ((x).pgd)
xmaddr_t arbitrary_virt_to_machine(unsigned long address); xmaddr_t arbitrary_virt_to_machine(void *address);
void make_lowmem_page_readonly(void *vaddr); void make_lowmem_page_readonly(void *vaddr);
void make_lowmem_page_readwrite(void *vaddr); void make_lowmem_page_readwrite(void *vaddr);
......
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