[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-ia64-devel] RFC: adding a dom0_firmware_setup hypercall



Hi,

this a just for review and comments.  The purpose is not to use 
DOM0_SETVPUCONTEXT to initialiaze a domain.
This is the first step for save&restore.

[This patch also contains warning cleanup, it will be separated of course].

Tristan.
diff -r 303e1b6bf727 linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c Sun May 21 
07:49:46 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c Tue May 23 
14:44:22 2006 +0200
@@ -25,7 +25,6 @@ int xen_init(void)
                return -1;
 
        xen_start_info = __va(s->arch.start_info_pfn << PAGE_SHIFT);
-       xen_start_info->flags = s->arch.flags;
        printk("Running on Xen! start_info_pfn=0x%lx nr_pages=%ld flags=0x%x\n",
                s->arch.start_info_pfn, xen_start_info->nr_pages,
                xen_start_info->flags);
diff -r 303e1b6bf727 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Sun May 21 07:49:46 2006 -0600
+++ b/tools/libxc/xc_linux_build.c      Tue May 23 14:44:22 2006 +0200
@@ -2,6 +2,7 @@
  * xc_linux_build.c
  */
 
+#include <stddef.h>
 #include "xg_private.h"
 #include "xc_private.h"
 #include <xenctrl.h>
@@ -471,6 +472,9 @@ static int setup_guest(int xc_handle,
     unsigned long v_end;
     unsigned long start_page, pgnr;
     start_info_t *start_info;
+    unsigned long start_info_mpa;
+    struct ia64_boot_param *bp;
+    DECLARE_DOM0_OP;
     int rc;
 
     rc = probeimageformat(image, image_size, &load_funcs);
@@ -536,10 +540,11 @@ static int setup_guest(int xc_handle,
 
     *store_mfn = page_array[1];
     *console_mfn = page_array[2];
+    start_info_mpa = (nr_pages - 3) << PAGE_SHIFT;
     printf("start_info: 0x%lx at 0x%lx, "
            "store_mfn: 0x%lx at 0x%lx, "
            "console_mfn: 0x%lx at 0x%lx\n",
-           page_array[0], nr_pages,
+           page_array[0], nr_pages - 3,
            *store_mfn,    nr_pages - 2,
            *console_mfn,  nr_pages - 1);
 
@@ -554,21 +559,31 @@ static int setup_guest(int xc_handle,
     start_info->console_mfn   = nr_pages - 1;
     start_info->console_evtchn = console_evtchn;
     start_info->nr_pages       = nr_pages; // FIXME?: nr_pages - 2 ????
+
+    /* Build firmware.  */
+    op.u.firmware_setup.domain = (domid_t)dom;
+    op.u.firmware_setup.bp = start_info_mpa + sizeof (start_info_t);
+    op.u.firmware_setup.hypercall_imm = 0x1000;
+    op.u.firmware_setup.sys_pgnr = 3;
+    op.u.firmware_setup.start_info_pfn = nr_pages - 3; /* metaphysical */
+
+    op.cmd = DOM0_FIRMWARE_SETUP;
+    if ( xc_dom0_op(xc_handle, &op) )
+        goto error_out;
+    bp = (struct ia64_boot_param *)(start_info + 1);
+    bp->command_line = start_info_mpa + offsetof(start_info_t, cmd_line);
+    if ( cmdline != NULL )
+    {
+        strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
+        start_info->cmd_line[MAX_GUEST_CMDLINE - 1] = 0;
+        printf ("cmd_line=%s\n", cmdline);
+    }
     if ( initrd->len != 0 )
     {
-        ctxt->initrd.start    = vinitrd_start;
-        ctxt->initrd.size     = initrd->len;
-    }
-    else
-    {
-        ctxt->initrd.start    = 0;
-        ctxt->initrd.size     = 0;
-    }
-    if ( cmdline != NULL )
-    {
-        strncpy((char *)ctxt->cmdline, cmdline, IA64_COMMAND_LINE_SIZE);
-        ctxt->cmdline[IA64_COMMAND_LINE_SIZE-1] = '\0';
-    }
+        bp->initrd_start    = vinitrd_start;
+        bp->initrd_size     = initrd->len;
+    }
+    ctxt->regs.r28 = start_info_mpa + sizeof (start_info_t);
     munmap(start_info, PAGE_SIZE);
 
     free(page_array);
@@ -1106,8 +1121,6 @@ static int xc_linux_build_internal(int x
 #ifdef __ia64__
     /* based on new_thread in xen/arch/ia64/domain.c */
     ctxt->flags = 0;
-    ctxt->shared.flags = flags;
-    ctxt->shared.start_info_pfn = nr_pages - 3; /* metaphysical */
     ctxt->regs.cr_ipsr = 0; /* all necessary bits filled by hypervisor */
     ctxt->regs.cr_iip = vkern_entry;
     ctxt->regs.cr_ifs = 1UL << 63;
@@ -1115,7 +1128,6 @@ static int xc_linux_build_internal(int x
     /* currently done by hypervisor, should move here */
     /* ctxt->regs.r28 = dom_fw_setup(); */
     ctxt->privregs = 0;
-    ctxt->sys_pgnr = 3;
     i = 0; /* silence unused variable warning */
 #else /* x86 */
     /*
diff -r 303e1b6bf727 xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk    Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/Rules.mk    Tue May 23 14:44:22 2006 +0200
@@ -40,7 +40,7 @@ CFLAGS        += -DCONFIG_XEN_IA64_DOM0_VP
 CFLAGS += -DCONFIG_XEN_IA64_DOM0_VP
 endif
 ifeq ($(no_warns),y)
-CFLAGS += -Wa,--fatal-warnings
+CFLAGS += -Wa,--fatal-warnings -Werror -Wno-uninitialized
 endif
 
 LDFLAGS := -g
diff -r 303e1b6bf727 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/linux-xen/iosapic.c Tue May 23 14:44:22 2006 +0200
@@ -1112,12 +1112,14 @@ map_iosapic_to_node(unsigned int gsi_bas
 }
 #endif
 
+#ifndef XEN
 static int __init iosapic_enable_kmalloc (void)
 {
        iosapic_kmalloc_ok = 1;
        return 0;
 }
 core_initcall (iosapic_enable_kmalloc);
+#endif
 
 #ifdef XEN
 /* nop for now */
diff -r 303e1b6bf727 xen/arch/ia64/linux-xen/irq_ia64.c
--- a/xen/arch/ia64/linux-xen/irq_ia64.c        Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/linux-xen/irq_ia64.c        Tue May 23 14:44:22 2006 +0200
@@ -225,7 +225,7 @@ extern irqreturn_t handle_IPI (int irq, 
 extern irqreturn_t handle_IPI (int irq, void *dev_id, struct pt_regs *regs);
 
 static struct irqaction ipi_irqaction = {
-       .handler =      handle_IPI,
+       .handler =      (void (*)(int,void*,struct cpu_user_regs*))handle_IPI,
 #ifndef XEN
        .flags =        SA_INTERRUPT,
 #endif
diff -r 303e1b6bf727 xen/arch/ia64/linux-xen/sal.c
--- a/xen/arch/ia64/linux-xen/sal.c     Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/linux-xen/sal.c     Tue May 23 14:44:22 2006 +0200
@@ -229,7 +229,7 @@ ia64_sal_init (struct ia64_sal_systab *s
                return;
        }
 
-       if (strncmp(systab->signature, "SST_", 4) != 0)
+       if (strncmp((char*)systab->signature, "SST_", 4) != 0)
                printk(KERN_ERR "bad signature in system table!");
 
        check_versions(systab);
diff -r 303e1b6bf727 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/linux-xen/smpboot.c Tue May 23 14:44:22 2006 +0200
@@ -197,7 +197,7 @@ sync_master (void *arg)
  * negative that it is behind.
  */
 static inline long
-get_delta (long *rt, long *master)
+get_delta (unsigned long *rt, unsigned long *master)
 {
        unsigned long best_t0 = 0, best_t1 = ~0UL, best_tm = 0;
        unsigned long tcenter, t0, t1, tm;
diff -r 303e1b6bf727 xen/arch/ia64/linux-xen/time.c
--- a/xen/arch/ia64/linux-xen/time.c    Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/linux-xen/time.c    Tue May 23 14:44:22 2006 +0200
@@ -158,7 +158,7 @@ ia64_init_itm (void)
 {
        unsigned long platform_base_freq, itc_freq;
        struct pal_freq_ratio itc_ratio, proc_ratio;
-       long status, platform_base_drift, itc_drift;
+       unsigned long status, platform_base_drift, itc_drift;
 
        /*
         * According to SAL v2.6, we need to use a SAL call to determine the 
platform base
@@ -197,7 +197,7 @@ ia64_init_itm (void)
        itc_freq = (platform_base_freq*itc_ratio.num)/itc_ratio.den;
 
        local_cpu_data->itm_delta = (itc_freq + HZ/2) / HZ;
-       printk(KERN_DEBUG "CPU %d: base freq=%lu.%03luMHz, ITC ratio=%lu/%lu, "
+       printk(KERN_DEBUG "CPU %d: base freq=%lu.%03luMHz, ITC ratio=%u/%u, "
               "ITC freq=%lu.%03luMHz", smp_processor_id(),
               platform_base_freq / 1000000, (platform_base_freq / 1000) % 1000,
               itc_ratio.num, itc_ratio.den, itc_freq / 1000000, (itc_freq / 
1000) % 1000);
diff -r 303e1b6bf727 xen/arch/ia64/vmx/pal_emul.c
--- a/xen/arch/ia64/vmx/pal_emul.c      Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/vmx/pal_emul.c      Tue May 23 14:44:22 2006 +0200
@@ -196,6 +196,10 @@ pal_debug_info(VCPU *vcpu){
 
 static struct ia64_pal_retval
 pal_fixed_addr(VCPU *vcpu){
+       struct ia64_pal_retval result;
+
+       result.status= -1; //unimplemented
+       return result;
 }
 
 static struct ia64_pal_retval
diff -r 303e1b6bf727 xen/arch/ia64/vmx/vmx_hypercall.c
--- a/xen/arch/ia64/vmx/vmx_hypercall.c Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/vmx/vmx_hypercall.c Tue May 23 14:44:22 2006 +0200
@@ -36,7 +36,6 @@
 #include <xen/domain.h>
 
 extern long do_sched_op_compat(int cmd, unsigned long arg);
-extern unsigned long domain_mpa_to_imva(struct domain *,unsigned long mpaddr);
 
 void hyper_not_support(void)
 {
diff -r 303e1b6bf727 xen/arch/ia64/vmx/vmx_process.c
--- a/xen/arch/ia64/vmx/vmx_process.c   Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/vmx/vmx_process.c   Tue May 23 14:44:22 2006 +0200
@@ -338,7 +338,7 @@ vmx_hpw_miss(u64 vadr , u64 vec, REGS* r
     }
     if(vec == 1) type = ISIDE_TLB;
     else if(vec == 2) type = DSIDE_TLB;
-    else panic_domain(regs,"wrong vec:%0xlx\n",vec);
+    else panic_domain(regs,"wrong vec:0x%lx\n",vec);
 
 //    prepare_if_physical_mode(v);
 
diff -r 303e1b6bf727 xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c      Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/xen/dom0_ops.c      Tue May 23 14:44:22 2006 +0200
@@ -19,6 +19,10 @@
 #include <xen/guest_access.h>
 #include <public/sched_ctl.h>
 #include <asm/vmx.h>
+#include <asm/dom_fw.h>
+
+void build_physmap_table(struct domain *d);
+
 extern unsigned long total_pages;
 long arch_do_dom0_op(dom0_op_t *op, XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op)
 {
@@ -225,6 +229,25 @@ long arch_do_dom0_op(dom0_op_t *op, XEN_
     }
     break;
 
+    case DOM0_FIRMWARE_SETUP:
+    {
+        dom0_firmware_setup_t *fs = &op->u.firmware_setup;
+        struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
+
+        if ( d == NULL) {
+            ret = -EINVAL;
+            break;
+        }
+        if (!d->arch.physmap_built)
+            build_physmap_table(d);
+        d->arch.breakimm = fs->hypercall_imm;
+        d->arch.sys_pgnr = fs->sys_pgnr;
+        d->shared_info->arch.start_info_pfn = fs->start_info_pfn;
+        dom_fw_setup (d, fs->bp);
+        printf ("dom_firmware_setup: bp=%lx\n", fs->bp);
+    }
+    break;
+
     default:
         printf("arch_do_dom0_op: unrecognized dom0 op: %d!!!\n",op->cmd);
         ret = -ENOSYS;
diff -r 303e1b6bf727 xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c        Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/xen/dom_fw.c        Tue May 23 14:44:22 2006 +0200
@@ -21,16 +21,15 @@
 #include <asm/dom_fw.h>
 #include <public/sched.h>
 
-static struct ia64_boot_param *dom_fw_init(struct domain *, const char 
*,int,char *,int);
-extern unsigned long domain_mpa_to_imva(struct domain *,unsigned long mpaddr);
+static void dom_fw_init(struct domain *, struct ia64_boot_param *,char *,int);
 extern struct domain *dom0;
 extern unsigned long dom0_start;
 
 extern unsigned long running_on_sim;
 
 
-unsigned long dom_fw_base_mpa = -1;
-unsigned long imva_fw_base = -1;
+static unsigned long dom_fw_base_mpa = -1;
+static unsigned long imva_fw_base = -1;
 
 // return domain (meta)physical address for a given imva
 // this function is a call-back from dom_fw_init
@@ -92,22 +91,20 @@ static void dom_fw_pal_hypercall_patch(s
        build_pal_hypercall_bundles(imva, d->arch.breakimm, 
FW_HYPERCALL_PAL_CALL);
 }
 
-
-// FIXME: This is really a hack: Forcing the boot parameter block
-// at domain mpaddr 0 page, then grabbing only the low bits of the
-// Xen imva, which is the offset into the page
-unsigned long dom_fw_setup(struct domain *d, const char *args, int arglen)
+void dom_fw_setup(struct domain *d, unsigned long bp_mpa)
 {
        struct ia64_boot_param *bp;
 
        dom_fw_base_mpa = 0;
 #ifndef CONFIG_XEN_IA64_DOM0_VP
        if (d == dom0) dom_fw_base_mpa += dom0_start;
+       if (d == dom0) bp_mpa += dom0_start;
 #endif
        ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, dom_fw_base_mpa);
-       imva_fw_base = domain_mpa_to_imva(d, dom_fw_base_mpa);
-       bp = dom_fw_init(d, args, arglen, (char *) imva_fw_base, PAGE_SIZE);
-       return dom_pa((unsigned long) bp);
+       imva_fw_base = (unsigned long) domain_mpa_to_imva(d, dom_fw_base_mpa);
+       ASSIGN_NEW_DOMAIN_PAGE_IF_DOM0(d, bp_mpa);
+       bp = domain_mpa_to_imva(d, bp_mpa);
+       dom_fw_init(d, bp, (char *) imva_fw_base, PAGE_SIZE);
 }
 
 
@@ -762,8 +759,8 @@ efi_mdt_cmp(const void *a, const void *b
        return 0;
 }
 
-static struct ia64_boot_param *
-dom_fw_init (struct domain *d, const char *args, int arglen, char *fw_mem, int 
fw_mem_size)
+static void
+dom_fw_init (struct domain *d, struct ia64_boot_param *bp, char *fw_mem, int 
fw_mem_size)
 {
        efi_system_table_t *efi_systab;
        efi_runtime_services_t *efi_runtime;
@@ -772,10 +769,9 @@ dom_fw_init (struct domain *d, const cha
        struct ia64_sal_desc_entry_point *sal_ed;
        struct ia64_sal_desc_ap_wakeup *sal_wakeup;
        efi_memory_desc_t *efi_memmap, *md;
-       struct ia64_boot_param *bp;
        unsigned long *pfn;
        unsigned char checksum = 0;
-       char *cp, *cmd_line, *fw_vendor;
+       char *cp, *fw_vendor;
        int i = 0;
        unsigned long maxmem = (d->max_pages - d->arch.sys_pgnr) * PAGE_SIZE;
 #ifdef CONFIG_XEN_IA64_DOM0_VP
@@ -813,27 +809,16 @@ dom_fw_init (struct domain *d, const cha
        sal_ed      = (void *) cp; cp += sizeof(*sal_ed);
        sal_wakeup  = (void *) cp; cp += sizeof(*sal_wakeup);
        efi_memmap  = (void *) cp; cp += NUM_MEM_DESCS*sizeof(*efi_memmap);
-       bp          = (void *) cp; cp += sizeof(*bp);
        pfn         = (void *) cp; cp += NFUNCPTRS * 2 * sizeof(pfn);
-       cmd_line    = (void *) cp;
 
        /* Initialise for EFI_SET_VIRTUAL_ADDRESS_MAP emulation */
        d->arch.efi_runtime = efi_runtime;
-
-       if (args) {
-               if (arglen >= 1024)
-                       arglen = 1023;
-               memcpy(cmd_line, args, arglen);
-       } else {
-               arglen = 0;
-       }
-       cmd_line[arglen] = '\0';
 
        memset(efi_systab, 0, sizeof(efi_systab));
        efi_systab->hdr.signature = EFI_SYSTEM_TABLE_SIGNATURE;
        efi_systab->hdr.revision  = EFI_SYSTEM_TABLE_REVISION;
        efi_systab->hdr.headersize = sizeof(efi_systab->hdr);
-       cp = fw_vendor = &cmd_line[arglen] + (2-(arglen&1)); // round to 16-bit 
boundary
+       fw_vendor =  cp;
 #define FW_VENDOR 
"X\0e\0n\0/\0i\0a\0\066\0\064\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
        cp += sizeof(FW_VENDOR) + (8-((unsigned long)cp & 7)); // round to 
64-bit boundary
 
@@ -1032,12 +1017,13 @@ dom_fw_init (struct domain *d, const cha
        bp->efi_memmap_size = i * sizeof(efi_memory_desc_t);
        bp->efi_memdesc_size = sizeof(efi_memory_desc_t);
        bp->efi_memdesc_version = EFI_MEMDESC_VERSION;
-       bp->command_line = dom_pa((unsigned long) cmd_line);
+       bp->command_line = 0; // dom_pa((unsigned long) cmd_line);
        bp->console_info.num_cols = 80;
        bp->console_info.num_rows = 25;
        bp->console_info.orig_x = 0;
        bp->console_info.orig_y = 24;
        bp->fpswa = 0;
+#if 0
        if (d == dom0) {
                // XXX CONFIG_XEN_IA64_DOM0_VP
                // initrd_start address is hard coded in start_kernel()
@@ -1051,5 +1037,5 @@ dom_fw_init (struct domain *d, const cha
        }
        printf(" initrd start 0x%lx", bp->initrd_start);
        printf(" initrd size 0x%lx\n", bp->initrd_size);
-       return bp;
-}
+#endif
+}
diff -r 303e1b6bf727 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/xen/domain.c        Tue May 23 14:44:22 2006 +0200
@@ -61,6 +61,8 @@ unsigned long dom0_size = 512*1024*1024;
 unsigned long dom0_size = 512*1024*1024;
 unsigned long dom0_align = 64*1024*1024;
 
+extern char dom0_command_line[];
+
 /* dom0_max_vcpus: maximum number of VCPUs to create for dom0.  */
 static unsigned int dom0_max_vcpus = 1;
 integer_param("dom0_max_vcpus", dom0_max_vcpus); 
@@ -260,7 +262,9 @@ void arch_getdomaininfo_ctxt(struct vcpu
 void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
 {
        c->regs = *vcpu_regs (v);
+#if 0
        c->shared = v->domain->shared_info->arch;
+#endif
 }
 
 int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c)
@@ -284,6 +288,7 @@ int arch_set_info_guest(struct vcpu *v, 
            build_physmap_table(d);
 
        *regs = c->regs;
+#if 0
        if (v == d->vcpu[0]) {
            /* Only for first vcpu.  */
            d->arch.sys_pgnr = c->sys_pgnr;
@@ -296,6 +301,7 @@ int arch_set_info_guest(struct vcpu *v, 
               during mmap/unmap operation.  However be conservative.  */
            domain_cache_flush (d, 1);
        }
+#endif
        new_thread(v, regs->cr_iip, 0, 0);
 
        if ( c->privregs && copy_from_user(v->arch.privregs,
@@ -499,12 +505,13 @@ void new_thread(struct vcpu *v,
                 unsigned long start_stack,
                 unsigned long start_info)
 {
+#if 0
        struct domain *d = v->domain;
+#endif
        struct pt_regs *regs;
-       extern char dom0_command_line[];
 
 #ifdef CONFIG_DOMAIN0_CONTIGUOUS
-       if (d == dom0 && v->vcpu_id == 0) start_pc += dom0_start;
+       if (v->domain == dom0 && v->vcpu_id == 0) start_pc += dom0_start;
 #endif
 
        regs = vcpu_regs (v);
@@ -524,14 +531,17 @@ void new_thread(struct vcpu *v,
 
        if (VMX_DOMAIN(v)) {
                vmx_init_all_rr(v);
+#if 0
                if (d == dom0)
                    regs->r28 = dom_fw_setup(d,dom0_command_line,
                                             COMMAND_LINE_SIZE);
+#endif
                /* Virtual processor context setup */
                VCPU(v, vpsr) = IA64_PSR_BN;
                VCPU(v, dcr) = 0;
        } else {
                init_all_rr(v);
+#if 0
                if (v->vcpu_id == 0) {
                        /* Build the firmware.  */
                        if (d == dom0) 
@@ -553,9 +563,8 @@ void new_thread(struct vcpu *v,
 
                                regs->r28 = dom_fw_setup (d, cmdline, len);
                        }
-                       d->shared_info->arch.flags = (d == dom0) ?
-                               (SIF_INITDOMAIN|SIF_PRIVILEGED) : 0;
                }
+#endif
                regs->ar_rsc |= (2 << 2); /* force PL2/3 */
                VCPU(v, banknum) = 1;
                VCPU(v, metaphysical_mode) = 1;
@@ -1421,7 +1430,7 @@ void domain_cache_flush (struct domain *
 
 // FIXME: ONLY USE FOR DOMAIN PAGE_SIZE == PAGE_SIZE
 #if 1
-unsigned long domain_mpa_to_imva(struct domain *d, unsigned long mpaddr)
+void * domain_mpa_to_imva(struct domain *d, unsigned long mpaddr)
 {
        unsigned long pte = lookup_domain_mpa(d,mpaddr);
        unsigned long imva;
@@ -1429,10 +1438,10 @@ unsigned long domain_mpa_to_imva(struct 
        pte &= _PAGE_PPN_MASK;
        imva = (unsigned long) __va(pte);
        imva |= mpaddr & ~PAGE_MASK;
-       return(imva);
+       return (void*)imva;
 }
 #else
-unsigned long domain_mpa_to_imva(struct domain *d, unsigned long mpaddr)
+void *domain_mpa_to_imva(struct domain *d, unsigned long mpaddr)
 {
     unsigned long imva = __gpa_to_mpa(d, mpaddr);
 
@@ -1615,6 +1624,8 @@ int construct_dom0(struct domain *d,
        unsigned long pkern_end;
        unsigned long pinitrd_start = 0;
        unsigned long pstart_info;
+       unsigned long bp_mpa;
+       struct ia64_boot_param *bp;
        struct page_info *start_info_page;
 
 #ifdef VALIDATE_VT
@@ -1774,6 +1785,8 @@ int construct_dom0(struct domain *d,
        memset(si, 0, PAGE_SIZE);
        sprintf(si->magic, "xen-%i.%i-ia64", XEN_VERSION, XEN_SUBVERSION);
        si->nr_pages     = max_pages;
+       si->flags = SIF_INITDOMAIN|SIF_PRIVILEGED;
+       d->shared_info->arch.flags = si->flags;
 
        /* Give up the VGA console if DOM0 is configured to grab it. */
        if (cmdline != NULL)
@@ -1788,7 +1801,26 @@ int construct_dom0(struct domain *d,
 
        set_bit(_VCPUF_initialised, &v->vcpu_flags);
 
+       /* Build firmware.  */
+       bp_mpa = pstart_info + sizeof (struct start_info);
+       dom_fw_setup (d, bp_mpa);
+
+       /* Fill boot param.  */
+       strncpy ((char *)si->cmd_line,
+                dom0_command_line, sizeof (si->cmd_line));
+       si->cmd_line[sizeof(si->cmd_line)-1] = 0;
+
+       bp = (struct ia64_boot_param *)(si + 1);
+       bp->command_line = pstart_info + offsetof (start_info_t, cmd_line);
+
+       bp->initrd_start = (dom0_start+dom0_size) -
+         (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
+       bp->initrd_size = ia64_boot_param->initrd_size;
+
        new_thread(v, pkern_entry, 0, 0);
+
+       vcpu_regs(v)->r28 = bp_mpa;
+
        physdev_init_dom0(d);
 
        // dom0 doesn't need build_physmap_table()
diff -r 303e1b6bf727 xen/arch/ia64/xen/efi_emul.c
--- a/xen/arch/ia64/xen/efi_emul.c      Sun May 21 07:49:46 2006 -0600
+++ b/xen/arch/ia64/xen/efi_emul.c      Tue May 23 14:44:22 2006 +0200
@@ -24,7 +24,6 @@
 #include <public/sched.h>
 
 extern unsigned long translate_domain_mpaddr(unsigned long);
-extern unsigned long domain_mpa_to_imva(struct domain *,unsigned long mpaddr);
 
 // given a current domain (virtual or metaphysical) address, return the 
virtual address
 static unsigned long
diff -r 303e1b6bf727 xen/include/asm-ia64/dom_fw.h
--- a/xen/include/asm-ia64/dom_fw.h     Sun May 21 07:49:46 2006 -0600
+++ b/xen/include/asm-ia64/dom_fw.h     Tue May 23 14:44:22 2006 +0200
@@ -142,7 +142,7 @@ extern struct ia64_pal_retval xen_pal_em
 extern struct ia64_pal_retval xen_pal_emulator(UINT64, u64, u64, u64);
 extern struct sal_ret_values sal_emulator (long index, unsigned long in1, 
unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, 
unsigned long in6, unsigned long in7);
 extern struct ia64_pal_retval pal_emulator_static (unsigned long);
-extern unsigned long dom_fw_setup (struct domain *, const char *, int);
+extern void dom_fw_setup (struct domain *, unsigned long bp_mpa);
 extern efi_status_t efi_emulator (struct pt_regs *regs, unsigned long *fault);
 
 extern void build_pal_hypercall_bundles(unsigned long *imva, unsigned long 
brkimm, unsigned long hypnum);
diff -r 303e1b6bf727 xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h     Sun May 21 07:49:46 2006 -0600
+++ b/xen/include/asm-ia64/domain.h     Tue May 23 14:44:22 2006 +0200
@@ -115,6 +115,9 @@ void __assign_domain_page(struct domain 
 void __assign_domain_page(struct domain *d, unsigned long mpaddr, unsigned 
long physaddr);
 void assign_domain_page(struct domain *d, unsigned long mpaddr, unsigned long 
physaddr);
 void assign_domain_io_page(struct domain *d, unsigned long mpaddr, unsigned 
long flags);
+
+extern void *domain_mpa_to_imva(struct domain *,unsigned long mpaddr);
+
 #ifdef CONFIG_XEN_IA64_DOM0_VP
 unsigned long assign_domain_mmio_page(struct domain *d, unsigned long mpaddr, 
unsigned long size);
 unsigned long assign_domain_mach_page(struct domain *d, unsigned long mpaddr, 
unsigned long size);
diff -r 303e1b6bf727 xen/include/asm-ia64/linux-xen/asm/system.h
--- a/xen/include/asm-ia64/linux-xen/asm/system.h       Sun May 21 07:49:46 
2006 -0600
+++ b/xen/include/asm-ia64/linux-xen/asm/system.h       Tue May 23 14:44:22 
2006 +0200
@@ -42,6 +42,7 @@ struct pci_vector_struct {
        __u32 irq;      /* IRQ assigned */
 };
 
+#ifndef XEN
 extern struct ia64_boot_param {
        __u64 command_line;             /* physical address of command line 
arguments */
        __u64 efi_systab;               /* physical address of EFI system table 
*/
@@ -63,6 +64,9 @@ extern struct ia64_boot_param {
        __u64 domain_size;      /* how big is the boot domain */
 
 } *ia64_boot_param;
+#else
+extern struct ia64_boot_param *ia64_boot_param;
+#endif
 
 /*
  * Macros to force memory ordering.  In these descriptions, "previous"
diff -r 303e1b6bf727 xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Sun May 21 07:49:46 2006 -0600
+++ b/xen/include/public/arch-ia64.h    Tue May 23 14:44:22 2006 +0200
@@ -298,17 +298,21 @@ typedef mapped_regs_t vpd_t;
 typedef mapped_regs_t vpd_t;
 
 typedef struct {
+#if 1
     unsigned int flags;
+#endif
     unsigned long start_info_pfn;
 
     /* Interrupt vector for event channel.  */
     int evtchn_vector;
 } arch_shared_info_t;
 
+#if 0
 typedef struct {
     unsigned long start;
     unsigned long size;
 } arch_initrd_info_t;
+#endif
 
 #define IA64_COMMAND_LINE_SIZE 512
 typedef struct vcpu_guest_context {
@@ -318,16 +322,40 @@ typedef struct vcpu_guest_context {
     unsigned long flags;       /* VGCF_* flags */
     unsigned long pt_base;     /* PMT table base */
     unsigned long share_io_pg; /* Shared page for I/O emulation */
+#if 0
     unsigned long sys_pgnr;    /* System pages out of domain memory */
+#endif
     unsigned long vm_assist;   /* VMASST_TYPE_* bitmap, now none on IPF */
 
     cpu_user_regs_t regs;
     mapped_regs_t *privregs;
+#if 0
     arch_shared_info_t shared;
     arch_initrd_info_t initrd;
     char cmdline[IA64_COMMAND_LINE_SIZE];
+#endif
 } vcpu_guest_context_t;
 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
+
+struct ia64_boot_param {
+       unsigned long command_line;             /* physical address of command 
line.  */
+       unsigned long efi_systab;               /* physical address of EFI 
system table */
+       unsigned long efi_memmap;               /* physical address of EFI 
memory map */
+       unsigned long efi_memmap_size;  /* size of EFI memory map */
+       unsigned long efi_memdesc_size; /* size of an EFI memory map descriptor 
*/
+       unsigned int  efi_memdesc_version;      /* memory descriptor version */
+       struct {
+               unsigned short num_cols;        /* number of columns on console 
*/
+               unsigned short num_rows;        /* number of rows on console */
+               unsigned short orig_x;  /* cursor's x position */
+               unsigned short orig_y;  /* cursor's y position */
+       } console_info;
+       unsigned long fpswa;            /* physical address of the fpswa 
interface */
+       unsigned long initrd_start;
+       unsigned long initrd_size;
+    unsigned long domain_start;     /* virtual address where dom0 begins */
+    unsigned long domain_size;      /* how big is the boot domain */
+};
 
 // dom0 vp op
 #define __HYPERVISOR_ia64_dom0vp_op     __HYPERVISOR_arch_0
diff -r 303e1b6bf727 xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h     Sun May 21 07:49:46 2006 -0600
+++ b/xen/include/public/dom0_ops.h     Tue May 23 14:44:22 2006 +0200
@@ -473,6 +473,16 @@ typedef struct dom0_hypercall_init {
     unsigned long mfn;        /* machine frame to be initialised */
 } dom0_hypercall_init_t;
 DEFINE_XEN_GUEST_HANDLE(dom0_hypercall_init_t);
+
+#define DOM0_FIRMWARE_SETUP   49
+typedef struct dom0_firmware_setup {
+    domid_t  domain;          /* domain to be affected */
+    unsigned long bp;         /* mpaddr of boot param area */
+    unsigned long start_info_pfn; /* pfn of start_info  */
+    unsigned long sys_pgnr;   /* number of system page */
+    unsigned int hypercall_imm;        /* IIM for hypercall */
+} dom0_firmware_setup_t;
+DEFINE_XEN_GUEST_HANDLE(dom0_firmware_setup_t);
 
 typedef struct dom0_op {
     uint32_t cmd;
@@ -515,6 +525,7 @@ typedef struct dom0_op {
         struct dom0_irq_permission    irq_permission;
         struct dom0_iomem_permission  iomem_permission;
         struct dom0_hypercall_init    hypercall_init;
+        struct dom0_firmware_setup    firmware_setup;
         uint8_t                       pad[128];
     } u;
 } dom0_op_t;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.