# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1205839374 0
# Node ID f619448beab508c3f495a7a1dcd04b9382870c5b
# Parent 87a56ff291d3fb6d07ad746cbc427b2284e35b10
xen/i386: re-add and use pre_setup_arch_hook()
It was only during the 2.6.25 merge that I realized that there was a
difference to native code that was not only unnecessary, but even
preventing the Xen version from being better readable and closer to
native both in terms of source code and behavior:
pre_setup_arch_hook() can do everything that (or equivalent to what)
x86-64 does in head64-xen.c. Apart from that it simplifies forward
porting, since certain pieces set up here are required to be available
much earlier in newer Linux.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
arch/i386/kernel/setup-xen.c | 7 +------
arch/i386/mach-xen/setup.c | 42 ++++++++++++++++++++++++++----------------
arch/i386/mm/init-xen.c | 3 ---
3 files changed, 27 insertions(+), 25 deletions(-)
diff -r 87a56ff291d3 -r f619448beab5 arch/i386/kernel/setup-xen.c
--- a/arch/i386/kernel/setup-xen.c Tue Mar 18 11:21:44 2008 +0000
+++ b/arch/i386/kernel/setup-xen.c Tue Mar 18 11:22:54 2008 +0000
@@ -1402,10 +1402,6 @@ void __init setup_bootmem_allocator(void
crashk_res.end - crashk_res.start + 1);
#endif
#endif
-
- if (!xen_feature(XENFEAT_auto_translated_physmap))
- phys_to_machine_mapping =
- (unsigned long *)xen_start_info->mfn_list;
}
/*
@@ -1627,6 +1623,7 @@ void __init setup_arch(char **cmdline_p)
VMASST_TYPE_writable_pagetables));
memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
+ pre_setup_arch_hook();
early_cpu_init();
#ifdef CONFIG_SMP
prefill_possible_map();
@@ -1680,8 +1677,6 @@ void __init setup_arch(char **cmdline_p)
rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0);
#endif
- setup_xen_features();
-
ARCH_SETUP
if (efi_enabled)
efi_init();
diff -r 87a56ff291d3 -r f619448beab5 arch/i386/mach-xen/setup.c
--- a/arch/i386/mach-xen/setup.c Tue Mar 18 11:21:44 2008 +0000
+++ b/arch/i386/mach-xen/setup.c Tue Mar 18 11:22:54 2008 +0000
@@ -87,17 +87,39 @@ extern void failsafe_callback(void);
extern void failsafe_callback(void);
extern void nmi(void);
-unsigned long *machine_to_phys_mapping;
+unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START;
EXPORT_SYMBOL(machine_to_phys_mapping);
unsigned int machine_to_phys_order;
EXPORT_SYMBOL(machine_to_phys_order);
+void __init pre_setup_arch_hook(void)
+{
+ struct xen_machphys_mapping mapping;
+ unsigned long machine_to_phys_nr_ents;
+ struct xen_platform_parameters pp;
+
+ init_mm.pgd = swapper_pg_dir = (pgd_t *)xen_start_info->pt_base;
+
+ setup_xen_features();
+
+ if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0)
+ set_fixaddr_top(pp.virt_start);
+
+ if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
+ machine_to_phys_mapping = (unsigned long *)mapping.v_start;
+ machine_to_phys_nr_ents = mapping.max_mfn + 1;
+ } else
+ machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
+ machine_to_phys_order = fls(machine_to_phys_nr_ents - 1);
+
+ if (!xen_feature(XENFEAT_auto_translated_physmap))
+ phys_to_machine_mapping =
+ (unsigned long *)xen_start_info->mfn_list;
+}
+
void __init machine_specific_arch_setup(void)
{
int ret;
- struct xen_machphys_mapping mapping;
- unsigned long machine_to_phys_nr_ents;
- struct xen_platform_parameters pp;
static struct callback_register __initdata event = {
.type = CALLBACKTYPE_event,
.address = { __KERNEL_CS, (unsigned long)hypervisor_callback },
@@ -132,16 +154,4 @@ void __init machine_specific_arch_setup(
HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
}
#endif
-
- if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0)
- set_fixaddr_top(pp.virt_start);
-
- machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
- machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
- if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
- machine_to_phys_mapping = (unsigned long *)mapping.v_start;
- machine_to_phys_nr_ents = mapping.max_mfn + 1;
- }
- while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
- machine_to_phys_order++;
}
diff -r 87a56ff291d3 -r f619448beab5 arch/i386/mm/init-xen.c
--- a/arch/i386/mm/init-xen.c Tue Mar 18 11:21:44 2008 +0000
+++ b/arch/i386/mm/init-xen.c Tue Mar 18 11:22:54 2008 +0000
@@ -388,9 +388,6 @@ static void __init pagetable_init (void)
unsigned long vaddr;
pgd_t *pgd_base = (pgd_t *)xen_start_info->pt_base;
- swapper_pg_dir = pgd_base;
- init_mm.pgd = pgd_base;
-
/* Enable PSE if available */
if (cpu_has_pse) {
set_in_cr4(X86_CR4_PSE);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|