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-ia64-devel

Re: [Xen-ia64-devel] Could you tell me howto run xen on ski?

To: Matsumoto <n_matumoto@xxxxxxxxxxxxxxxx>
Subject: Re: [Xen-ia64-devel] Could you tell me howto run xen on ski?
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Mon, 5 Dec 2005 17:34:39 +0900
Cc: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 05 Dec 2005 08:34:18 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20051202185124.4DDE.N_MATUMOTO@xxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20051202185124.4DDE.N_MATUMOTO@xxxxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
Hi.

On Fri, Dec 02, 2005 at 06:52:47PM +0900, Matsumoto wrote:

> I am interested in running ski for Xen development.

I have also tried to boot xen on ski.
With following patch, I can load xen, dom0 image and initrd image.
But dom0 panics during its boot procedure for now.

Its usage is as follows.
ski bootloader vmm=<path to xen elf image> image=<path to vmlinux elf image> 
initrd=<path to initrd image> <parameter...>
ski bootloader <vmlinux elf image> <parameter...>

Singed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

--
diff -ruNp -X linux-2.6.14.2/Documentation/dontdiff 
linux-2.6.14.2/arch/ia64/hp/sim/boot.orig/bootloader.c 
linux-2.6.14.2/arch/ia64/hp/sim/boot/bootloader.c
--- linux-2.6.14.2/arch/ia64/hp/sim/boot.orig/bootloader.c      2005-11-11 
14:33:12.000000000 +0900
+++ linux-2.6.14.2/arch/ia64/hp/sim/boot/bootloader.c   2005-12-05 
16:45:51.000000000 +0900
@@ -24,6 +24,8 @@ struct task_struct;   /* forward declarati
 #include <asm/system.h>
 
 #include "ssc.h"
+#include "xen_boot_param.h"
+#define running_on_xen 0
 
 struct disk_req {
        unsigned long addr;
@@ -36,7 +38,7 @@ struct disk_stat {
 };
 
 extern void jmp_to_kernel (unsigned long bp, unsigned long e_entry);
-extern struct ia64_boot_param *sys_fw_init (const char *args, int arglen);
+extern struct xen_ia64_boot_param *sys_fw_init (const char *args, int arglen, 
__u64 initrd_start, __u64 initrd_size, __u64 domain_start, __u64 domain_size);
 extern void debug_break (void);
 
 static void
@@ -51,6 +53,77 @@ cons_write (const char *buf)
        }
 }
 
+static void
+skip_space(char** args, long* arglen) 
+{
+       while (**args == ' ' && **args != '\0' && *arglen > 0) {
+               (*args)++;
+               (*arglen)--;
+       }
+}
+
+static void
+find_space(char** args, long* arglen)
+{
+       while (**args != ' ' && **args != '\0' && *arglen > 0) {
+               (*args)++;
+               (*arglen)--;
+       }
+}
+
+void
+set_nul(char** args, long* arglen)
+{
+       if (**args == ' ') {
+               **args = '\0';
+               (*args)++;
+               (*arglen)--;
+       }
+}
+
+__u64
+roundup(__u64 n) 
+{
+#define ALIGN_SIZE     (4 * 1024 * 1024)
+       return (n + (ALIGN_SIZE - 1)) & ~(ALIGN_SIZE - 1) ;
+}
+
+__u64
+load_file(char* path, __u64 mem)
+{
+#define READ_SIZE      (4 * 1024 * 1024)
+       struct disk_req req;
+       unsigned long off;
+       
+       struct disk_stat stat;
+
+       int fd = ssc((long)path, 1, 0, 0, SSC_OPEN);
+       if (fd < 0) {
+               cons_write(path);
+               cons_write(": file not found, reboot now\n");
+               for(;;);
+       }
+
+       off = 0;
+       do {
+               req.len = READ_SIZE;
+               req.addr = mem;
+               ssc(fd, 1, (long) &req, off, SSC_READ);
+
+               stat.fd = fd;
+               ssc((long) &stat, 0, 0, 0, SSC_WAIT_COMPLETION);
+
+               off += READ_SIZE;
+               mem += READ_SIZE;
+       } while (stat.count == READ_SIZE);
+       
+       off -= READ_SIZE;
+       off += stat.count;
+       ssc(fd, 0, 0, 0, SSC_CLOSE);
+
+       return off;
+}
+
 #define MAX_ARGS 32
 
 void
@@ -65,9 +138,26 @@ start_bootloader (void)
        struct elfhdr *elf;
        struct elf_phdr *elf_phdr;      /* program header */
        unsigned long e_entry, e_phoff, e_phnum;
-       register struct ia64_boot_param *bp;
+       register struct xen_ia64_boot_param *bp;
        char *kpath, *args;
        long arglen = 0;
+       __u64 max_loaded = 0;
+
+       char *domain_path = NULL;
+       __u64 domain_start = 0;
+       __u64 domain_size = 0;
+
+       char *initrd_path = NULL;
+       __u64 initrd_start = 0;
+       __u64 initrd_size = 0;
+
+       // kpath:               vmlinux or xen
+       // domain_path:         NULL    or dom0 kernel image
+       // domain_start:                0       or image addrss
+       // domain_size          0       or image size
+       // initrd_path:         NULL    or initrd path
+       // initrd_start:        0       or initrd addrsss
+       // initrd_size:         0       or initrd size
 
        ssc(0, 0, 0, 0, SSC_CONSOLE_INIT);
 
@@ -85,11 +175,45 @@ start_bootloader (void)
        kpath = "vmlinux";
        args = buffer;
        if (arglen > 0) {
-               kpath = buffer;
-               while (*args != ' ' && *args != '\0')
-                       ++args, --arglen;
-               if (*args == ' ')
-                       *args++ = '\0', --arglen;
+               skip_space(&args, &arglen);
+#define VMM_STR                "vmm="
+#define VMM_STR_LEN    4
+#define IMAGE_STR      "image="
+#define IMAGE_STR_LEN  6
+#define INITRD_STR     "initrd="
+#define INITRD_STR_LEN 7
+               if (arglen > VMM_STR_LEN &&
+                   strncmp(args, VMM_STR, VMM_STR_LEN) == 0) {
+                       args += VMM_STR_LEN;
+                       arglen -= VMM_STR_LEN;
+                       kpath = args;
+                       find_space(&args, &arglen);
+                       set_nul(&args, &arglen);
+
+                       skip_space(&args, &arglen);
+                       if (arglen > IMAGE_STR_LEN &&
+                           strncmp(args, IMAGE_STR, IMAGE_STR_LEN) == 0) {
+                               args += IMAGE_STR_LEN;
+                               arglen -= IMAGE_STR_LEN;
+                               domain_path = args;
+                               find_space(&args, &arglen);
+                               set_nul(&args, &arglen);
+                       }
+
+                       skip_space(&args, &arglen);
+                       if (arglen > INITRD_STR_LEN &&
+                           strncmp(args, INITRD_STR, INITRD_STR_LEN) == 0) {
+                               args += INITRD_STR_LEN;
+                               arglen -= INITRD_STR_LEN;
+                               initrd_path = args;
+                               find_space(&args, &arglen);
+                               set_nul(&args, &arglen);
+                       }
+               } else {
+                       kpath = buffer;
+                       find_space(&args, &arglen);
+                       set_nul(&args, &arglen);
+               }
        }
 
        if (arglen <= 0) {
@@ -156,17 +280,47 @@ start_bootloader (void)
                ssc((long) &stat, 0, 0, 0, SSC_WAIT_COMPLETION);
                memset((char *)__pa(elf_phdr->p_paddr) + elf_phdr->p_filesz, 0,
                       elf_phdr->p_memsz - elf_phdr->p_filesz);
+               if (max_loaded < __pa(elf_phdr->p_paddr) + elf_phdr->p_filesz) {
+                       max_loaded = __pa(elf_phdr->p_paddr) + 
elf_phdr->p_filesz;
+               }
        }
        ssc(fd, 0, 0, 0, SSC_CLOSE);
 
+       if (domain_path != NULL) {
+               cons_write("loading ");
+               cons_write(domain_path);
+               cons_write("...\n");
+#define MAX_DOMAIN_IMAGE_SIZE  (64 * 1024 * 1024) //XXX work around
+               max_loaded = roundup(max_loaded + MAX_DOMAIN_IMAGE_SIZE);
+               domain_start = max_loaded;
+               domain_size = load_file(domain_path, domain_start);
+               max_loaded += domain_size;
+       }
+       
+       if (initrd_path != NULL) {
+               cons_write("loading ");
+               cons_write(initrd_path);
+               cons_write("...\n");
+
+               max_loaded = roundup(max_loaded + MAX_DOMAIN_IMAGE_SIZE);
+               
+               initrd_start = max_loaded;
+               initrd_size = load_file(initrd_path, initrd_start);
+               max_loaded += initrd_size;
+       }
+
        cons_write("starting kernel...\n");
 
        /* fake an I/O base address: */
        ia64_setreg(_IA64_REG_AR_KR0, 0xffffc000000UL);
 
-       bp = sys_fw_init(args, arglen);
+       bp = sys_fw_init(args, arglen,
+                        initrd_start, initrd_size, domain_start, domain_size);
 
        ssc(0, (long) kpath, 0, 0, SSC_LOAD_SYMBOLS);
+       if (domain_path != NULL) {
+               ssc(0, (long) domain_path, 0, 0, SSC_LOAD_SYMBOLS);
+       }
 
        debug_break();
        jmp_to_kernel((unsigned long) bp, e_entry);
diff -ruNp -X linux-2.6.14.2/Documentation/dontdiff 
linux-2.6.14.2/arch/ia64/hp/sim/boot.orig/fw-emu.c 
linux-2.6.14.2/arch/ia64/hp/sim/boot/fw-emu.c
--- linux-2.6.14.2/arch/ia64/hp/sim/boot.orig/fw-emu.c  2005-12-05 
14:14:59.000000000 +0900
+++ linux-2.6.14.2/arch/ia64/hp/sim/boot/fw-emu.c       2005-12-05 
14:47:26.000000000 +0900
@@ -16,6 +16,7 @@
 #include <asm/sal.h>
 
 #include "ssc.h"
+#include "xen_boot_param.h"
 
 #define MB     (1024*1024UL)
 
@@ -27,7 +28,7 @@
 # define NUM_MEM_DESCS 16
 #endif
 
-static char fw_mem[(  sizeof(struct ia64_boot_param)
+static char fw_mem[(  sizeof(struct xen_ia64_boot_param)
                    + sizeof(efi_system_table_t)
                    + sizeof(efi_runtime_services_t)
                    + 1*sizeof(efi_config_table_t)
@@ -237,8 +238,10 @@ sal_emulator (long index, unsigned long 
        return ((struct sal_ret_values) {status, r9, r10, r11});
 }
 
-struct ia64_boot_param *
-sys_fw_init (const char *args, int arglen)
+struct xen_ia64_boot_param *
+sys_fw_init (const char *args, int arglen,
+            __u64 initrd_start, __u64 initrd_size,
+            __u64 domain_start, __u64 domain_size)
 {
        efi_system_table_t *efi_systab;
        efi_runtime_services_t *efi_runtime;
@@ -247,7 +250,7 @@ sys_fw_init (const char *args, int argle
        efi_memory_desc_t *efi_memmap, *md;
        unsigned long *pal_desc, *sal_desc;
        struct ia64_sal_desc_entry_point *sal_ed;
-       struct ia64_boot_param *bp;
+       struct xen_ia64_boot_param *bp;
        unsigned char checksum = 0;
        char *cp, *cmd_line;
        int i = 0;
@@ -350,7 +353,7 @@ sys_fw_init (const char *args, int argle
        /* simulate free memory at physical address zero */
        MAKE_MD(EFI_BOOT_SERVICES_DATA,         EFI_MEMORY_WB,    0*MB,    
1*MB);
        MAKE_MD(EFI_PAL_CODE,                   EFI_MEMORY_WB,    1*MB,    
2*MB);
-       MAKE_MD(EFI_CONVENTIONAL_MEMORY,        EFI_MEMORY_WB,    2*MB,  
130*MB);
+       MAKE_MD(EFI_CONVENTIONAL_MEMORY,        EFI_MEMORY_WB,    2*MB,  
4096*MB);
        MAKE_MD(EFI_CONVENTIONAL_MEMORY,        EFI_MEMORY_WB, 4096*MB, 
4128*MB);
 #else
        MAKE_MD( 4,                0x9, 0x0000000000000000, 0x0000000000001000);
@@ -382,6 +385,10 @@ sys_fw_init (const char *args, int argle
        bp->console_info.orig_x = 0;
        bp->console_info.orig_y = 24;
        bp->fpswa = 0;
+       bp->initrd_start = initrd_start;
+       bp->initrd_size = initrd_size;
+       bp->domain_start = domain_start;
+       bp->domain_size = domain_size;
 
        return bp;
 }
diff -ruNp -X linux-2.6.14.2/Documentation/dontdiff 
linux-2.6.14.2/arch/ia64/hp/sim/boot.orig/xen_boot_param.h 
linux-2.6.14.2/arch/ia64/hp/sim/boot/xen_boot_param.h
--- linux-2.6.14.2/arch/ia64/hp/sim/boot.orig/xen_boot_param.h  1970-01-01 
09:00:00.000000000 +0900
+++ linux-2.6.14.2/arch/ia64/hp/sim/boot/xen_boot_param.h       2005-12-05 
14:45:59.000000000 +0900
@@ -0,0 +1,26 @@
+#ifndef XEN_BOOT_PARAM_H
+#define XEN_BOOT_PARAM_H
+
+// this is ia64_boot_param from xen/include/asm-ia64/linux-xen/asm/system.h
+extern struct xen_ia64_boot_param {
+       __u64 command_line;             /* physical address of command line 
arguments */
+       __u64 efi_systab;               /* physical address of EFI system table 
*/
+       __u64 efi_memmap;               /* physical address of EFI memory map */
+       __u64 efi_memmap_size;          /* size of EFI memory map */
+       __u64 efi_memdesc_size;         /* size of an EFI memory map descriptor 
*/
+       __u32 efi_memdesc_version;      /* memory descriptor version */
+       struct {
+               __u16 num_cols; /* number of columns on console output device */
+               __u16 num_rows; /* number of rows on console output device */
+               __u16 orig_x;   /* cursor's x position */
+               __u16 orig_y;   /* cursor's y position */
+       } console_info;
+       __u64 fpswa;            /* physical address of the fpswa interface */
+       __u64 initrd_start;
+       __u64 initrd_size;
+       __u64 domain_start;     /* virtual address where the boot time v
+mcode begins */
+       __u64 domain_size;      /* how big is the boot module */
+} *xen_ia64_boot_param;
+
+#endif // XEN_BOOT_PARAM_H


-- 
yamahata

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

<Prev in Thread] Current Thread [Next in Thread>