# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1181643320 -3600
# Node ID e5b50dd9fcf5aad4567ffe74a80c93ad55e383e2
# Parent 7c5fc63cd0aab441945238e5f7f19e087c59968b
linux/x86-64: miscellaneous initialization code cleanup
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
arch/x86_64/kernel/head-xen.S | 4 --
arch/x86_64/kernel/setup64-xen.c | 4 +-
arch/x86_64/kernel/vsyscall-xen.c | 12 -------
arch/x86_64/mm/init-xen.c | 49 +++++++-----------------------
drivers/xen/core/smpboot.c | 2 -
include/asm-x86_64/mach-xen/asm/pgalloc.h | 4 +-
include/asm-x86_64/mach-xen/asm/pgtable.h | 3 -
7 files changed, 18 insertions(+), 60 deletions(-)
diff -r 7c5fc63cd0aa -r e5b50dd9fcf5 arch/x86_64/kernel/head-xen.S
--- a/arch/x86_64/kernel/head-xen.S Tue Jun 12 11:12:35 2007 +0100
+++ b/arch/x86_64/kernel/head-xen.S Tue Jun 12 11:15:20 2007 +0100
@@ -50,15 +50,13 @@ NEXT_PAGE(init_level4_pgt)
NEXT_PAGE(init_level4_pgt)
/* This gets initialized in x86_64_start_kernel */
.fill 512,8,0
-
/*
* We update two pgd entries to make kernel and user pgd consistent
* at pgd_populate(). It can be used for kernel modules. So we place
* this page here for those cases to avoid memory corruption.
- * We also use this page to establish the initiali mapping for
+ * We also use this page to establish the initial mapping for the
* vsyscall area.
*/
-NEXT_PAGE(init_level4_user_pgt)
.fill 512,8,0
NEXT_PAGE(level3_kernel_pgt)
diff -r 7c5fc63cd0aa -r e5b50dd9fcf5 arch/x86_64/kernel/setup64-xen.c
--- a/arch/x86_64/kernel/setup64-xen.c Tue Jun 12 11:12:35 2007 +0100
+++ b/arch/x86_64/kernel/setup64-xen.c Tue Jun 12 11:15:20 2007 +0100
@@ -128,8 +128,8 @@ void __init setup_per_cpu_areas(void)
#ifdef CONFIG_XEN
static void switch_pt(void)
{
- xen_pt_switch(__pa(init_level4_pgt));
- xen_new_user_pt(__pa(init_level4_user_pgt));
+ xen_pt_switch(__pa_symbol(init_level4_pgt));
+ xen_new_user_pt(__pa_symbol(__user_pgd(init_level4_pgt)));
}
void __cpuinit cpu_gdt_init(struct desc_ptr *gdt_descr)
diff -r 7c5fc63cd0aa -r e5b50dd9fcf5 arch/x86_64/kernel/vsyscall-xen.c
--- a/arch/x86_64/kernel/vsyscall-xen.c Tue Jun 12 11:12:35 2007 +0100
+++ b/arch/x86_64/kernel/vsyscall-xen.c Tue Jun 12 11:15:20 2007 +0100
@@ -208,17 +208,6 @@ static void __init map_vsyscall(void)
__set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_page0, PAGE_KERNEL_VSYSCALL);
}
-#ifdef CONFIG_XEN
-static void __init map_vsyscall_user(void)
-{
- extern void __set_fixmap_user(enum fixed_addresses, unsigned long,
pgprot_t);
- extern char __vsyscall_0;
- unsigned long physaddr_page0 = __pa_symbol(&__vsyscall_0);
-
- __set_fixmap_user(VSYSCALL_FIRST_PAGE, physaddr_page0,
PAGE_KERNEL_VSYSCALL);
-}
-#endif
-
static int __init vsyscall_init(void)
{
BUG_ON(((unsigned long) &vgettimeofday !=
@@ -227,7 +216,6 @@ static int __init vsyscall_init(void)
BUG_ON((VSYSCALL_ADDR(0) != __fix_to_virt(VSYSCALL_FIRST_PAGE)));
map_vsyscall();
#ifdef CONFIG_XEN
- map_vsyscall_user();
sysctl_vsyscall = 0; /* disable vgettimeofay() */
#endif
#ifdef CONFIG_SYSCTL
diff -r 7c5fc63cd0aa -r e5b50dd9fcf5 arch/x86_64/mm/init-xen.c
--- a/arch/x86_64/mm/init-xen.c Tue Jun 12 11:12:35 2007 +0100
+++ b/arch/x86_64/mm/init-xen.c Tue Jun 12 11:15:20 2007 +0100
@@ -227,14 +227,8 @@ static __init void *spp_getpage(void)
return ptr;
}
-#define pgd_offset_u(address) (pgd_t *)(init_level4_user_pgt +
pgd_index(address))
-
-static inline pud_t *pud_offset_u(unsigned long address)
-{
- pud_t *pud = level3_user_pgt;
-
- return pud + pud_index(address);
-}
+#define pgd_offset_u(address) (__user_pgd(init_level4_pgt) +
pgd_index(address))
+#define pud_offset_u(address) (level3_user_pgt + pud_index(address))
static __init void set_pte_phys(unsigned long vaddr,
unsigned long phys, pgprot_t prot, int user_mode)
@@ -337,9 +331,6 @@ static __init void set_pte_phys_ma(unsig
__flush_tlb_one(vaddr);
}
-#define SET_FIXMAP_KERNEL 0
-#define SET_FIXMAP_USER 1
-
/* NOTE: this is meant to be run only at boot */
void __init
__set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
@@ -352,28 +343,13 @@ __set_fixmap (enum fixed_addresses idx,
}
switch (idx) {
case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE:
- set_pte_phys(address, phys, prot, SET_FIXMAP_KERNEL);
+ set_pte_phys(address, phys, prot, 0);
+ set_pte_phys(address, phys, prot, 1);
break;
default:
set_pte_phys_ma(address, phys, prot);
break;
}
-}
-
-/*
- * This only supports vsyscall area.
- */
-void __init
-__set_fixmap_user (enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
-{
- unsigned long address = __fix_to_virt(idx);
-
- if (idx >= __end_of_fixed_addresses) {
- printk("Invalid __set_fixmap\n");
- return;
- }
-
- set_pte_phys(address, phys, prot, SET_FIXMAP_USER);
}
unsigned long __initdata table_start, table_end;
@@ -579,13 +555,15 @@ void __init xen_init_pt(void)
init_level4_pgt[pgd_index(__START_KERNEL_map)] =
__pgd(__pa_symbol(level3_kernel_pgt) | _PAGE_TABLE);
level3_kernel_pgt[pud_index(__START_KERNEL_map)] =
- __pud(__pa_symbol(level2_kernel_pgt) |
- _KERNPG_TABLE);
- memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
+ __pud(__pa_symbol(level2_kernel_pgt) | _PAGE_TABLE);
+ memcpy(level2_kernel_pgt, page, PAGE_SIZE);
+
+ __user_pgd(init_level4_pgt)[pgd_index(VSYSCALL_START)] =
+ __pgd(__pa_symbol(level3_user_pgt) | _PAGE_TABLE);
early_make_page_readonly(init_level4_pgt,
XENFEAT_writable_page_tables);
- early_make_page_readonly(init_level4_user_pgt,
+ early_make_page_readonly(__user_pgd(init_level4_pgt),
XENFEAT_writable_page_tables);
early_make_page_readonly(level3_kernel_pgt,
XENFEAT_writable_page_tables);
@@ -596,11 +574,8 @@ void __init xen_init_pt(void)
if (!xen_feature(XENFEAT_writable_page_tables)) {
xen_pgd_pin(__pa_symbol(init_level4_pgt));
- xen_pgd_pin(__pa_symbol(init_level4_user_pgt));
- }
-
- set_pgd((pgd_t *)(init_level4_user_pgt + 511),
- mk_kernel_pgd(__pa_symbol(level3_user_pgt)));
+ xen_pgd_pin(__pa_symbol(__user_pgd(init_level4_pgt)));
+ }
}
static void __init extend_init_mapping(unsigned long tables_space)
diff -r 7c5fc63cd0aa -r e5b50dd9fcf5 drivers/xen/core/smpboot.c
--- a/drivers/xen/core/smpboot.c Tue Jun 12 11:12:35 2007 +0100
+++ b/drivers/xen/core/smpboot.c Tue Jun 12 11:15:20 2007 +0100
@@ -72,8 +72,6 @@ EXPORT_SYMBOL(cpu_core_map);
#if defined(__i386__)
u8 x86_cpu_to_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = 0xff };
EXPORT_SYMBOL(x86_cpu_to_apicid);
-#elif !defined(CONFIG_X86_IO_APIC)
-unsigned int maxcpus = NR_CPUS;
#endif
void __init prefill_possible_map(void)
diff -r 7c5fc63cd0aa -r e5b50dd9fcf5 include/asm-x86_64/mach-xen/asm/pgalloc.h
--- a/include/asm-x86_64/mach-xen/asm/pgalloc.h Tue Jun 12 11:12:35 2007 +0100
+++ b/include/asm-x86_64/mach-xen/asm/pgalloc.h Tue Jun 12 11:15:20 2007 +0100
@@ -146,8 +146,8 @@ static inline pgd_t *pgd_alloc(struct mm
/*
* Set level3_user_pgt for vsyscall area
*/
- set_pgd(__user_pgd(pgd) + pgd_index(VSYSCALL_START),
- __pgd(__pa_symbol(level3_user_pgt) | _PAGE_TABLE));
+ __user_pgd(pgd)[pgd_index(VSYSCALL_START)] =
+ __pgd(__pa_symbol(level3_user_pgt) | _PAGE_TABLE);
return pgd;
}
diff -r 7c5fc63cd0aa -r e5b50dd9fcf5 include/asm-x86_64/mach-xen/asm/pgtable.h
--- a/include/asm-x86_64/mach-xen/asm/pgtable.h Tue Jun 12 11:12:35 2007 +0100
+++ b/include/asm-x86_64/mach-xen/asm/pgtable.h Tue Jun 12 11:15:20 2007 +0100
@@ -15,7 +15,6 @@
#include <asm/hypervisor.h>
extern pud_t level3_user_pgt[512];
-extern pud_t init_level4_user_pgt[];
extern void xen_init_pt(void);
@@ -395,7 +394,7 @@ static inline int pmd_large(pmd_t pte) {
#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK))
#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
-#define pgd_offset_k(address) (pgd_t *)(init_level4_pgt + pgd_index(address))
+#define pgd_offset_k(address) (init_level4_pgt + pgd_index(address))
#define pgd_present(pgd) (__pgd_val(pgd) & _PAGE_PRESENT)
#define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|