diff -r 37c90a210d71 xen/arch/ia64/linux-xen/setup.c --- a/xen/arch/ia64/linux-xen/setup.c Tue Sep 05 07:48:49 2006 +0200 +++ b/xen/arch/ia64/linux-xen/setup.c Tue Sep 05 11:32:12 2006 +0200 @@ -94,10 +94,6 @@ EXPORT_SYMBOL(io_space); EXPORT_SYMBOL(io_space); unsigned int num_io_spaces; -#ifdef XEN -extern void early_cmdline_parse(char **); -#endif - /* * "flush_icache_range()" needs to know what processor dependent stride size to use * when it makes i-cache(s) coherent with d-caches. @@ -221,10 +217,14 @@ reserve_memory (void) rsvd_region[n].end = rsvd_region[n].start + ia64_boot_param->efi_memmap_size; n++; +#ifndef XEN + /* On Xen the command line is already saved and overlaps hypervisor + memory. */ rsvd_region[n].start = (unsigned long) __va(ia64_boot_param->command_line); rsvd_region[n].end = (rsvd_region[n].start + strlen(__va(ia64_boot_param->command_line)) + 1); n++; +#endif rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START); #ifdef XEN @@ -262,6 +262,7 @@ reserve_memory (void) sort_regions(rsvd_region, num_rsvd_regions); } +#ifndef XEN /** * find_initrd - get initrd parameters from the boot parameter structure * @@ -281,6 +282,7 @@ find_initrd (void) } #endif } +#endif static void __init io_port_init (void) @@ -401,7 +403,6 @@ setup_arch (char **cmdline_p) #ifndef XEN strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE); #else - early_cmdline_parse(cmdline_p); cmdline_parse(*cmdline_p); #endif diff -r 37c90a210d71 xen/arch/ia64/xen/xensetup.c --- a/xen/arch/ia64/xen/xensetup.c Tue Sep 05 07:48:49 2006 +0200 +++ b/xen/arch/ia64/xen/xensetup.c Tue Sep 05 11:32:12 2006 +0200 @@ -25,6 +25,7 @@ #include #include #include +#include unsigned long xenheap_phys_end, total_pages; @@ -112,34 +113,27 @@ static void __init do_initcalls(void) * "com2=57600,8n1 console=com2 -- console=ttyS1 console=tty * root=/dev/sda3 ro" */ -static char null[4] = { 0 }; - -void early_cmdline_parse(char **cmdline_p) -{ +static void split_command_line (void) +{ + char *cmdline = __va(ia64_boot_param->command_line); char *guest_cmd; - static const char * const split = "--"; - - if (*cmdline_p == NULL) { - *cmdline_p = &null[0]; - saved_command_line[0] = '\0'; - dom0_command_line[0] = '\0'; + + if (cmdline == NULL) return; - } - - guest_cmd = strstr(*cmdline_p, split); + + guest_cmd = strstr(cmdline, "--"); /* If no spliter, whole line is for guest */ if (guest_cmd == NULL) { - guest_cmd = *cmdline_p; - *cmdline_p = &null[0]; + guest_cmd = cmdline; + cmdline = ""; } else { *guest_cmd = '\0'; /* Split boot parameters for xen and guest */ - guest_cmd += strlen(split); + guest_cmd += 2; while (*guest_cmd == ' ') guest_cmd++; } - strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE); + strlcpy(saved_command_line, cmdline, COMMAND_LINE_SIZE); strlcpy(dom0_command_line, guest_cmd, COMMAND_LINE_SIZE); - return; } struct ns16550_defaults ns16550_com1 = { @@ -246,6 +240,8 @@ void start_kernel(void) unsigned long nr_pages; unsigned long dom0_memory_start, dom0_memory_size; unsigned long dom0_initrd_start, dom0_initrd_size; + char *policy_start = NULL; + unsigned long policy_len = 0; unsigned long md_end, relo_start, relo_end, relo_size = 0; struct domain *idle_domain; efi_memory_desc_t *kern_md, *last_md, *md; @@ -257,9 +253,24 @@ void start_kernel(void) BUILD_BUG_ON(sizeof(struct shared_info) > XSI_SIZE); running_on_sim = is_platform_hp_ski(); - /* Kernel may be relocated by EFI loader */ + /* FIXME: Kernel may be relocated by EFI loader */ xen_pstart = ia64_tpa(KERNEL_START); + /* Bootparam mess. */ + if (ia64_boot_param->modules_nbr != 0) { + /* Started with GRUB. + command line is fully xen command line. */ + strlcpy(saved_command_line, __va(ia64_boot_param->command_line), + COMMAND_LINE_SIZE); + /* dom0 done later. */ + } + else { + /* Started with ELILO. + Split command line. */ + split_command_line (); + } + ia64_boot_param->command_line = __pa(saved_command_line); + early_setup_arch(&cmdline); /* We initialise the serial devices very early so we can get debugging. */ @@ -276,15 +287,54 @@ void start_kernel(void) init_console(); set_printk_prefix("(XEN) "); - if (running_on_sim || ia64_boot_param->domain_start == 0 || - ia64_boot_param->domain_size == 0) { - /* This is possible only with the old elilo, which does not support - a vmm. Fix now, and continue without initrd. */ - printk ("Your elilo is not Xen-aware. Bootparams fixed\n"); - ia64_boot_param->domain_start = ia64_boot_param->initrd_start; - ia64_boot_param->domain_size = ia64_boot_param->initrd_size; - ia64_boot_param->initrd_start = 0; - ia64_boot_param->initrd_size = 0; + if (ia64_boot_param->modules_nbr != 0) { + /* GRUB. dom0 is the first module. */ + struct ia64_boot_module *mod = __va(ia64_boot_param->modules_chain); + ia64_boot_param->domain_start = mod->mod_start; + ia64_boot_param->domain_size = mod->mod_end - mod->mod_start; + if (mod->cmdline) + strlcpy(dom0_command_line, __va(mod->cmdline), COMMAND_LINE_SIZE); + + while (1) { + void * start; + unsigned int len; + + if (mod->next == 0) + break; + mod = __va(mod->next); + + start = __va(mod->mod_start); + len = mod->mod_end - mod->mod_start; + + if (acm_is_policy (start, len)) { + if (policy_start != NULL) + printf ("Warning: Additionnal policy ignored\n"); + else { + policy_start = start; + policy_len = len; + } + } + else if (ia64_boot_param->initrd_start == 0) { + ia64_boot_param->initrd_start = mod->mod_start; + ia64_boot_param->initrd_size = len; + } + else + printf ("Warning: extra module ignored\n"); + } + } else if (running_on_sim + || ia64_boot_param->domain_start == 0 + || ia64_boot_param->domain_size == 0) { + if (ia64_boot_param->initrd_start == 0) + printf ("Warning: dom0 not loaded!\n"); + else { + /* This is possible only with the old elilo, which does not support + a vmm. Fix now, and continue without initrd. */ + printk ("Your elilo is not Xen-aware. Bootparams fixed\n"); + ia64_boot_param->domain_start = ia64_boot_param->initrd_start; + ia64_boot_param->domain_size = ia64_boot_param->initrd_size; + ia64_boot_param->initrd_start = 0; + ia64_boot_param->initrd_size = 0; + } } printk("Xen command line: %s\n", saved_command_line); @@ -316,8 +366,7 @@ void start_kernel(void) if (md->type == EFI_LOADER_DATA) { /* Test for ranges we're not prepared to move */ BUG_ON(md_overlaps(md, __pa(ia64_boot_param)) || - md_overlaps(md, ia64_boot_param->efi_memmap) || - md_overlaps(md, ia64_boot_param->command_line)); + md_overlaps(md, ia64_boot_param->efi_memmap)); relo_size += MD_SIZE(md); /* If range overlaps the end, push out the relocation start */ @@ -496,6 +545,11 @@ printk("num_online_cpus=%d, max_cpus=%d\ efi.hcdp = NULL; } +#if not_yet_ready + /* initialize access control security module */ + acm_init(policy_start, policy_len); +#endif + /* Create initial domain 0. */ dom0 = domain_create(0); if ( (dom0 == NULL) || (alloc_vcpu(dom0, 0, 0) == NULL) ) diff -r 37c90a210d71 xen/include/acm/acm_hooks.h --- a/xen/include/acm/acm_hooks.h Tue Sep 05 07:48:49 2006 +0200 +++ b/xen/include/acm/acm_hooks.h Tue Sep 05 11:32:12 2006 +0200 @@ -147,6 +147,8 @@ static inline int acm_init(unsigned int const multiboot_info_t *mbi, unsigned long start) { return 0; } +static inline int acm_is_policy(char *buf, unsigned long len) +{ return 0; } static inline void acm_post_domain0_create(domid_t domid) { return; } static inline int acm_sharing(ssidref_t ssidref1, ssidref_t ssidref2) diff -r 37c90a210d71 xen/include/asm-ia64/linux-xen/asm/io.h --- a/xen/include/asm-ia64/linux-xen/asm/io.h Tue Sep 05 07:48:49 2006 +0200 +++ b/xen/include/asm-ia64/linux-xen/asm/io.h Tue Sep 05 11:32:12 2006 +0200 @@ -80,7 +80,9 @@ extern unsigned int num_io_spaces; #include #include #include +#ifndef XEN #include +#endif /* * Change virtual addresses to physical addresses and vv. diff -r 37c90a210d71 xen/include/asm-ia64/linux-xen/asm/system.h --- a/xen/include/asm-ia64/linux-xen/asm/system.h Tue Sep 05 07:48:49 2006 +0200 +++ b/xen/include/asm-ia64/linux-xen/asm/system.h Tue Sep 05 11:32:12 2006 +0200 @@ -59,10 +59,22 @@ extern struct ia64_boot_param { __u64 initrd_start; __u64 initrd_size; //for loading initrd for dom0 - __u64 domain_start; /* virtual address where the boot time domain begins */ - __u64 domain_size; /* how big is the boot domain */ - + __u64 domain_start; /* VA where the boot time domain begins */ + __u64 domain_size; /* how big is the boot domain */ + /* For GRUB. */ + __u64 modules_chain; /* Chain of modules. */ + __u64 modules_nbr; /* Number of modules. */ } *ia64_boot_param; + +struct ia64_boot_module { + __u64 mod_start; + __u64 mod_end; + + /* Module command line */ + __u64 cmdline; + + __u64 next; +}; /* * Macros to force memory ordering. In these descriptions, "previous"