WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] linux: eliminate E820 tables

To: Jan Beulich <jbeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] linux: eliminate E820 tables
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Thu, 11 May 2006 13:23:10 -0500
Cc: Xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 11 May 2006 11:23:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <44635590.76E4.0078.0@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <44635590.76E4.0078.0@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mail/News 1.5 (X11/20060309)
Why do we need CONFIG_XEN guards in xen specific files?

Should setup-xen.c and e820-xen.c be built when CONFIG_XEN isn't set?

Regards,

Anthony Liguori

Jan Beulich wrote:
.. to make clear that no relevant state is actually maintained in there and 
that, as a consequence, adjustments to
native Linux code in this area aren't applicable to the Xen kernels.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
------------------------------------------------------------------------

Index: head-2006-05-03/arch/i386/kernel/setup-xen.c
===================================================================
--- head-2006-05-03.orig/arch/i386/kernel/setup-xen.c   2006-05-08 
16:04:28.000000000 +0200
+++ head-2006-05-03/arch/i386/kernel/setup-xen.c        2006-05-08 
16:09:21.000000000 +0200
@@ -157,7 +157,9 @@ struct ist_info ist_info;
        defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
 EXPORT_SYMBOL(ist_info);
 #endif
+#ifndef CONFIG_XEN
 struct e820map e820;
+#endif
extern void early_cpu_init(void);
 extern void generic_apic_probe(char *);
@@ -399,6 +401,7 @@ EXPORT_SYMBOL(phys_to_machine_mapping);
 start_info_t *xen_start_info;
 EXPORT_SYMBOL(xen_start_info);
+#ifndef CONFIG_XEN
 static void __init limit_regions(unsigned long long size)
 {
        unsigned long long current_addr = 0;
@@ -492,7 +495,6 @@ static void __init print_memory_map(char
        }
 }
-#if 0
 /*
  * Sanitize the BIOS e820 map.
  *
@@ -747,7 +749,9 @@ static void __init parse_cmdline_early (
 {
        char c = ' ', *to = command_line, *from = saved_command_line;
        int len = 0, max_cmdline;
+#ifndef CONFIG_XEN
        int userdef = 0;
+#endif
if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
                max_cmdline = COMMAND_LINE_SIZE;
@@ -795,6 +799,7 @@ static void __init parse_cmdline_early (
                        }
                }
+#ifndef CONFIG_XEN
                else if (!memcmp(from, "memmap=", 7)) {
                        if (to != command_line)
                                to--;
@@ -836,6 +841,7 @@ static void __init parse_cmdline_early (
                                }
                        }
                }
+#endif
else if (!memcmp(from, "noexec=", 7))
                        noexec_setup(from + 7);
@@ -978,10 +984,12 @@ static void __init parse_cmdline_early (
        }
        *to = '\0';
        *cmdline_p = command_line;
+#ifndef CONFIG_XEN
        if (userdef) {
                printk(KERN_INFO "user-defined physical RAM map:\n");
                print_memory_map("user");
        }
+#endif
 }
#if 0 /* !XEN */
@@ -1111,6 +1119,7 @@ unsigned long __init find_max_low_pfn(vo
        return max_low_pfn;
 }
+#ifndef CONFIG_XEN
 /*
  * Free all available memory for boot time allocation.  Used
  * as a callback function by efi_memory_walk()
@@ -1129,11 +1138,14 @@ free_available_memory(unsigned long star
return 0;
 }
+#endif
+
 /*
  * Register fully available low RAM pages with the bootmem allocator.
  */
 static void __init register_bootmem_low_pages(unsigned long max_low_pfn)
 {
+#ifndef CONFIG_XEN
        int i;
if (efi_enabled) {
@@ -1171,6 +1183,13 @@ static void __init register_bootmem_low_
                size = last_pfn - curr_pfn;
                free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
        }
+#else
+       unsigned long size = xen_start_info->nr_pages;
+
+       if (size > max_low_pfn)
+               size = max_low_pfn;
+       free_bootmem(0, PFN_PHYS(size));
+#endif
 }
#ifndef CONFIG_XEN
@@ -1699,12 +1718,14 @@ void __init setup_arch(char **cmdline_p)
        setup_xen_features();
ARCH_SETUP
+#ifndef CONFIG_XEN
        if (efi_enabled)
                efi_init();
        else {
                printk(KERN_INFO "BIOS-provided physical RAM map:\n");
                print_memory_map(machine_specific_memory_setup());
        }
+#endif
copy_edd(); Index: head-2006-05-03/arch/x86_64/kernel/e820-xen.c
===================================================================
--- head-2006-05-03.orig/arch/x86_64/kernel/e820-xen.c  2006-05-03 
09:39:54.000000000 +0200
+++ head-2006-05-03/arch/x86_64/kernel/e820-xen.c       2006-05-08 
16:04:28.000000000 +0200
@@ -36,6 +36,7 @@ EXPORT_SYMBOL(end_pfn);
unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT; unsigned long end_pfn_map; +#ifndef CONFIG_XEN /* * Add a memory region to the kernel e820 map. */ @@ -54,8 +55,6 @@ void __init add_memory_region(unsigned l
        e820.nr_map++;
 }
-#ifndef CONFIG_XEN
-
/* * end_pfn only includes RAM, while end_pfn_map includes all e820 entries.
  * The direct mapping extends to end_pfn_map, so that we can directly access
@@ -278,6 +279,7 @@ int __init e820_all_mapped(unsigned long
 }
 #endif /* CONFIG_XEN */
+#ifndef CONFIG_XEN
 void __init e820_print_map(char *who)
 {
        int i;
@@ -304,7 +304,6 @@ void __init e820_print_map(char *who)
        }
 }
-#ifndef CONFIG_XEN
 /*
  * Sanitize the BIOS e820 map.
  *
@@ -562,7 +561,8 @@ void __init setup_memory_region(void)
#else /* CONFIG_XEN */ -extern unsigned long xen_override_max_pfn;
+/* Allows setting of maximum possible memory size  */
+static unsigned long xen_override_max_pfn;
 extern union xen_start_info_union xen_start_info_union;
unsigned long __init e820_end_of_ram(void)
@@ -662,6 +662,7 @@ void __init parse_memopt(char *p, char *
        xen_override_max_pfn = (unsigned long) end_user_pfn;
} +#ifndef CONFIG_XEN
 void __init parse_memmapopt(char *p, char **from)
 {
        unsigned long long start_at, mem_size;
@@ -682,6 +683,7 @@ void __init parse_memmapopt(char *p, cha
        }
        p = *from;
 }
+#endif
/*
  * Search for the biggest gap in the low 32 bits of the e820
Index: head-2006-05-03/arch/x86_64/kernel/setup-xen.c
===================================================================
--- head-2006-05-03.orig/arch/x86_64/kernel/setup-xen.c 2006-05-08 
16:04:28.000000000 +0200
+++ head-2006-05-03/arch/x86_64/kernel/setup-xen.c      2006-05-08 
16:11:01.000000000 +0200
@@ -88,9 +88,6 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info);
 extern char hypercall_page[PAGE_SIZE];
 EXPORT_SYMBOL(hypercall_page);
-/* Allows setting of maximum possible memory size */
-unsigned long xen_override_max_pfn;
-
 static int xen_panic_event(struct notifier_block *, unsigned long, void *);
 static struct notifier_block xen_panic_block = {
        xen_panic_event, NULL, 0 /* try to go last */
@@ -142,7 +139,9 @@ struct sys_desc_table_struct {
 };
struct edid_info edid_info;
+#ifndef CONFIG_XEN
 struct e820map e820;
+#endif
extern int root_mountflags; @@ -321,7 +320,9 @@ static __init void parse_cmdline_early (
 {
        char c = ' ', *to = command_line, *from = COMMAND_LINE;
        int len = 0;
+#ifndef CONFIG_XEN
        int userdef = 0;
+#endif
for (;;) { if (c != ' ') @@ -401,6 +402,7 @@ static __init void parse_cmdline_early (
                if (!memcmp(from, "mem=", 4))
parse_memopt(from+4, &from); +#ifndef CONFIG_XEN
                if (!memcmp(from, "memmap=", 7)) {
                        /* exactmap option is for used defined memory */
                        if (!memcmp(from+7, "exactmap", 8)) {
@@ -422,6 +424,7 @@ static __init void parse_cmdline_early (
                                userdef = 1;
                        }
                }
+#endif
#ifdef CONFIG_NUMA
                if (!memcmp(from, "numa=", 5))
@@ -481,10 +484,12 @@ static __init void parse_cmdline_early (
                        break;
                *(to++) = c;
        }
+#ifndef CONFIG_XEN
        if (userdef) {
                printk(KERN_INFO "user-defined physical RAM map:\n");
                e820_print_map("user");
        }
+#endif
        *to = '\0';
        *cmdline_p = command_line;
 }
Index: head-2006-05-03/include/asm-i386/mach-xen/setup_arch_post.h
===================================================================
--- head-2006-05-03.orig/include/asm-i386/mach-xen/setup_arch_post.h    
2006-04-24 11:43:43.000000000 +0200
+++ head-2006-05-03/include/asm-i386/mach-xen/setup_arch_post.h 2006-05-08 
16:04:28.000000000 +0200
@@ -1,6 +1,4 @@
 /**
- * machine_specific_memory_setup - Hook for machine specific memory setup.
- *
  * Description:
  *     This is included late in kernel/setup.c so that it can make
  *     use of all of the static functions.
@@ -8,16 +8,6 @@
#include <xen/interface/callback.h> -static char * __init machine_specific_memory_setup(void)
-{
-       unsigned long max_pfn = xen_start_info->nr_pages;
-
-       e820.nr_map = 0;
-       add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
-
-       return "Xen";
-}
-
 extern void hypervisor_callback(void);
 extern void failsafe_callback(void);
 extern void nmi(void);
Index: head-2006-05-03/include/asm-i386/mach-xen/setup_arch_pre.h
===================================================================
--- head-2006-05-03.orig/include/asm-i386/mach-xen/setup_arch_pre.h     
2006-04-24 11:43:43.000000000 +0200
+++ head-2006-05-03/include/asm-i386/mach-xen/setup_arch_pre.h  2006-05-08 
16:04:28.000000000 +0200
@@ -3,3 +3,9 @@
 #define ARCH_SETUP machine_specific_arch_setup();
static void __init machine_specific_arch_setup(void);
+
+static inline char * machine_specific_memory_setup(void)
+{
+       return "Xen";
+}
+
------------------------------------------------------------------------

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel