@@ -4913,20 +4913,6 @@ int mmcfg_intercept_write(
return X86EMUL_OKAY;
}
-void *alloc_xen_pagetable(void)
-{
- mfn_t mfn = alloc_xen_pagetable_new();
-
- return mfn_eq(mfn, INVALID_MFN) ? NULL : mfn_to_virt(mfn_x(mfn));
-}
-
-void free_xen_pagetable(void *v)
-{
- mfn_t mfn = v ? virt_to_mfn(v) : INVALID_MFN;
-
- free_xen_pagetable_new(mfn);
-}
-
/*
* For these PTE APIs, the caller must follow the alloc-map-unmap-free
* lifecycle, which means explicitly mapping the PTE pages before accessing
@@ -1114,7 +1114,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
continue;
*pl4e = l4e_from_intpte(l4e_get_intpte(*pl4e) +
xen_phys_start);
- pl3e = l4e_to_l3e(*pl4e);
+ pl3e = __va(l4e_get_paddr(*pl4e));
for ( j = 0; j < L3_PAGETABLE_ENTRIES; j++, pl3e++ )
{
/* Not present, 1GB mapping, or already relocated? */
@@ -1124,7 +1124,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
continue;
*pl3e = l3e_from_intpte(l3e_get_intpte(*pl3e) +
xen_phys_start);
- pl2e = l3e_to_l2e(*pl3e);
+ pl2e = __va(l3e_get_paddr(*pl3e));
for ( k = 0; k < L2_PAGETABLE_ENTRIES; k++, pl2e++ )
{
/* Not present, PSE, or already relocated? */
@@ -815,7 +815,7 @@ static int setup_cpu_root_pgt(unsigned int cpu)
if ( !opt_xpti_hwdom && !opt_xpti_domu )
return 0;
- rpt = alloc_xen_pagetable();
+ rpt = alloc_xenheap_page();
if ( !rpt )
return -ENOMEM;
@@ -919,7 +919,7 @@ static void cleanup_cpu_root_pgt(unsigned int cpu)
free_xen_pagetable_new(l3mfn);
}
- free_xen_pagetable(rpt);
+ free_xenheap_page(rpt);
/* Also zap the stub mapping for this CPU. */
if ( stub_linear )
@@ -583,8 +583,6 @@ int vcpu_destroy_pagetables(struct vcpu *);
void *do_page_walk(struct vcpu *v, unsigned long addr);
/* Allocator functions for Xen pagetables. */
-void *alloc_xen_pagetable(void);
-void free_xen_pagetable(void *v);
mfn_t alloc_xen_pagetable_new(void);
void free_xen_pagetable_new(mfn_t mfn);
@@ -188,11 +188,6 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)
#define l4e_has_changed(x,y,flags) \
( !!(((x).l4 ^ (y).l4) & ((PADDR_MASK&PAGE_MASK)|put_pte_flags(flags))) )
-/* Pagetable walking. */
-#define l2e_to_l1e(x) ((l1_pgentry_t *)__va(l2e_get_paddr(x)))
-#define l3e_to_l2e(x) ((l2_pgentry_t *)__va(l3e_get_paddr(x)))
-#define l4e_to_l3e(x) ((l3_pgentry_t *)__va(l4e_get_paddr(x)))
-
#define map_l1t_from_l2e(x) (l1_pgentry_t *)map_domain_page(l2e_get_mfn(x))
#define map_l2t_from_l3e(x) (l2_pgentry_t *)map_domain_page(l3e_get_mfn(x))
#define map_l3t_from_l4e(x) (l3_pgentry_t *)map_domain_page(l4e_get_mfn(x))