[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86: drop high compat r/o M2P table address range
commit 5af040ef8b572ffccb7e3530e617d4259a9ff724 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Apr 30 10:38:07 2020 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Apr 30 10:38:07 2020 +0200 x86: drop high compat r/o M2P table address range Now that we don't properly hook things up into the page tables anymore we also don't need to set aside an address range. Drop it, using compat_idle_pg_table_l2[] simply (explicitly) from slot 0. While doing the re-arrangement, which is accompanied by the dropping or replacing of some local variables, restrict the scopes of some further ones at the same time. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Wei Liu <wl@xxxxxxx> --- xen/arch/x86/mm.c | 3 +-- xen/arch/x86/x86_64/mm.c | 42 +++++++++++++++++------------------------- xen/include/asm-x86/config.h | 5 +---- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index ab9cd00225..355c50ff91 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -1423,8 +1423,7 @@ static bool pae_xen_mappings_check(const struct domain *d, void init_xen_pae_l2_slots(l2_pgentry_t *l2t, const struct domain *d) { memcpy(&l2t[COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(d)], - &compat_idle_pg_table_l2[ - l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)], + compat_idle_pg_table_l2, COMPAT_L2_PAGETABLE_XEN_SLOTS(d) * sizeof(*l2t)); } diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 39c01cf907..102079a801 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -216,9 +216,7 @@ static int share_hotadd_m2p_table(struct mem_hotadd_info *info) static void destroy_compat_m2p_mapping(struct mem_hotadd_info *info) { - unsigned long i, va, rwva, pt_pfn; - unsigned long smap = info->spfn, emap = info->spfn; - l2_pgentry_t *l2_ro_mpt = compat_idle_pg_table_l2; + unsigned long i, smap = info->spfn, emap = info->spfn; if ( smap > ((RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) >> 2) ) return; @@ -228,18 +226,19 @@ static void destroy_compat_m2p_mapping(struct mem_hotadd_info *info) for ( i = smap; i < emap; ) { - va = HIRO_COMPAT_MPT_VIRT_START + - i * sizeof(*compat_machine_to_phys_mapping); - rwva = RDWR_COMPAT_MPT_VIRT_START + - i * sizeof(*compat_machine_to_phys_mapping); - if ( l2e_get_flags(l2_ro_mpt[l2_table_offset(va)]) & _PAGE_PRESENT ) + unsigned int off = i * sizeof(*compat_machine_to_phys_mapping); + l2_pgentry_t *pl2e = compat_idle_pg_table_l2 + l2_table_offset(off); + + if ( l2e_get_flags(*pl2e) & _PAGE_PRESENT ) { - pt_pfn = l2e_get_pfn(l2_ro_mpt[l2_table_offset(va)]); + unsigned long pt_pfn = l2e_get_pfn(*pl2e); + if ( hotadd_mem_valid(pt_pfn, info) ) { - destroy_xen_mappings(rwva, rwva + - (1UL << L2_PAGETABLE_SHIFT)); - l2e_write(&l2_ro_mpt[l2_table_offset(va)], l2e_empty()); + unsigned long rwva = RDWR_COMPAT_MPT_VIRT_START + off; + + destroy_xen_mappings(rwva, rwva + (1UL << L2_PAGETABLE_SHIFT)); + l2e_write(pl2e, l2e_empty()); } } @@ -316,10 +315,9 @@ static void destroy_m2p_mapping(struct mem_hotadd_info *info) */ static int setup_compat_m2p_table(struct mem_hotadd_info *info) { - unsigned long i, va, smap, emap, rwva, epfn = info->epfn; + unsigned long i, smap, emap, epfn = info->epfn; mfn_t mfn; unsigned int n; - l2_pgentry_t *l2_ro_mpt = NULL; int err = 0; smap = info->spfn & (~((1UL << (L2_PAGETABLE_SHIFT - 2)) -1)); @@ -337,8 +335,6 @@ static int setup_compat_m2p_table(struct mem_hotadd_info *info) emap = ( (epfn + ((1UL << (L2_PAGETABLE_SHIFT - 2)) - 1 )) & ~((1UL << (L2_PAGETABLE_SHIFT - 2)) - 1) ); - l2_ro_mpt = compat_idle_pg_table_l2; - #define MFN(x) (((x) << L2_PAGETABLE_SHIFT) / sizeof(unsigned int)) #define CNT ((sizeof(*frame_table) & -sizeof(*frame_table)) / \ sizeof(*compat_machine_to_phys_mapping)) @@ -347,13 +343,11 @@ static int setup_compat_m2p_table(struct mem_hotadd_info *info) for ( i = smap; i < emap; i += (1UL << (L2_PAGETABLE_SHIFT - 2)) ) { - va = HIRO_COMPAT_MPT_VIRT_START + - i * sizeof(*compat_machine_to_phys_mapping); - - rwva = RDWR_COMPAT_MPT_VIRT_START + - i * sizeof(*compat_machine_to_phys_mapping); + unsigned int off = i * sizeof(*compat_machine_to_phys_mapping); + l2_pgentry_t *pl2e = compat_idle_pg_table_l2 + l2_table_offset(off); + unsigned long rwva = RDWR_COMPAT_MPT_VIRT_START + off; - if (l2e_get_flags(l2_ro_mpt[l2_table_offset(va)]) & _PAGE_PRESENT) + if ( l2e_get_flags(*pl2e) & _PAGE_PRESENT ) continue; for ( n = 0; n < CNT; ++n) @@ -370,8 +364,7 @@ static int setup_compat_m2p_table(struct mem_hotadd_info *info) /* Fill with INVALID_M2P_ENTRY. */ memset((void *)rwva, 0xFF, 1UL << L2_PAGETABLE_SHIFT); /* NB. Cannot be GLOBAL as the ptes get copied into per-VM space. */ - l2e_write(&l2_ro_mpt[l2_table_offset(va)], - l2e_from_mfn(mfn, _PAGE_PSE|_PAGE_PRESENT)); + l2e_write(pl2e, l2e_from_mfn(mfn, _PAGE_PSE|_PAGE_PRESENT)); } #undef CNT #undef MFN @@ -620,7 +613,6 @@ void __init paging_init(void) goto nomem; compat_idle_pg_table_l2 = l2_ro_mpt; clear_page(l2_ro_mpt); - l2_ro_mpt += l2_table_offset(HIRO_COMPAT_MPT_VIRT_START); /* Allocate and map the compatibility mode machine-to-phys table. */ mpt_size = (mpt_size >> 1) + (1UL << (L2_PAGETABLE_SHIFT - 1)); if ( mpt_size > RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START ) diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h index 2d6393e64e..266d281718 100644 --- a/xen/include/asm-x86/config.h +++ b/xen/include/asm-x86/config.h @@ -215,11 +215,8 @@ extern unsigned char boot_edid_info[128]; /* Slot 261: compatibility machine-to-phys conversion table (1GB). */ #define RDWR_COMPAT_MPT_VIRT_START VMAP_VIRT_END #define RDWR_COMPAT_MPT_VIRT_END (RDWR_COMPAT_MPT_VIRT_START + GB(1)) -/* Slot 261: high read-only compat machine-to-phys conversion table (1GB). */ -#define HIRO_COMPAT_MPT_VIRT_START RDWR_COMPAT_MPT_VIRT_END -#define HIRO_COMPAT_MPT_VIRT_END (HIRO_COMPAT_MPT_VIRT_START + GB(1)) /* Slot 261: xen text, static data, bss, per-cpu stubs and executable fixmap (1GB). */ -#define XEN_VIRT_START (HIRO_COMPAT_MPT_VIRT_END) +#define XEN_VIRT_START RDWR_COMPAT_MPT_VIRT_END #define XEN_VIRT_END (XEN_VIRT_START + GB(1)) #ifndef CONFIG_BIGMEM -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |