From cd5108c08767e79f91d94ba7386204713ecc19be Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Wed, 20 Apr 2005 18:12:03 +0000 Subject: [PATCH 01/36] bitkeeper revision 1.1277.1.9 (42669b73P7IEHFimy7hJD0wKH7v80w) vcpu.c, process.c: correct handling for cr.iha --- xen/arch/ia64/process.c | 4 ++++ xen/arch/ia64/vcpu.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/xen/arch/ia64/process.c b/xen/arch/ia64/process.c index 3ddbc05192..221812123d 100644 --- a/xen/arch/ia64/process.c +++ b/xen/arch/ia64/process.c @@ -171,6 +171,10 @@ panic_domain(regs,"psr.ic off, delivering fault=%lx,iip=%p,ifa=%p,isr=%p,PSCB.ii else if (vector == IA64_INST_TLB_VECTOR) vector = IA64_ALT_INST_TLB_VECTOR; // } + if (vector == IA64_ALT_DATA_TLB_VECTOR || + vector == IA64_ALT_INST_TLB_VECTOR) { + vcpu_thash(ed,ifa,&PSCB(ed,iha)); + } PSCB(ed,unat) = regs->ar_unat; // not sure if this is really needed? PSCB(ed,precover_ifs) = regs->cr_ifs; vcpu_bsw0(ed); diff --git a/xen/arch/ia64/vcpu.c b/xen/arch/ia64/vcpu.c index bb8fc4ac07..8ce8149dd9 100644 --- a/xen/arch/ia64/vcpu.c +++ b/xen/arch/ia64/vcpu.c @@ -394,7 +394,10 @@ IA64FAULT vcpu_get_iim(VCPU *vcpu, UINT64 *pval) IA64FAULT vcpu_get_iha(VCPU *vcpu, UINT64 *pval) { - return vcpu_thash(vcpu,PSCB(vcpu,ifa),pval); + //return vcpu_thash(vcpu,PSCB(vcpu,ifa),pval); + UINT64 val = PSCB(vcpu,iha); + *pval = val; + return (IA64_NO_FAULT); } IA64FAULT vcpu_set_dcr(VCPU *vcpu, UINT64 val) @@ -1138,11 +1141,13 @@ IA64FAULT vcpu_thash(VCPU *vcpu, UINT64 vadr, UINT64 *pval) UINT64 VHPT_addr = VHPT_addr1 | ((VHPT_addr2a | VHPT_addr2b) << 15) | VHPT_addr3; +#if 0 if (VHPT_addr1 == 0xe000000000000000L) { printf("vcpu_thash: thash unsupported with rr7 @%lx\n", PSCB(vcpu,iip)); return (IA64_ILLOP_FAULT); } +#endif //verbose("vcpu_thash: vadr=%p, VHPT_addr=%p\n",vadr,VHPT_addr); *pval = VHPT_addr; return (IA64_NO_FAULT); From 72850576ff2893d5dddc6c37be5ec21df18a2f9b Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Thu, 21 Apr 2005 00:04:59 +0000 Subject: [PATCH 02/36] bitkeeper revision 1.1327.1.5 (4266ee2bW65qcNXtpGjcvtUxXqKVUQ) vcpu.c: more cases for setting pending --- xen/arch/ia64/vcpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/ia64/vcpu.c b/xen/arch/ia64/vcpu.c index 8ce8149dd9..d1769a20c3 100644 --- a/xen/arch/ia64/vcpu.c +++ b/xen/arch/ia64/vcpu.c @@ -750,7 +750,8 @@ IA64FAULT vcpu_set_tpr(VCPU *vcpu, UINT64 val) { if (val & 0xff00) return IA64_RSVDREG_FAULT; PSCB(vcpu,tpr) = val; - //PSCB(vcpu,pending_interruption) = 1; + if (vcpu_check_pending_interrupts(vcpu) != SPURIOUS_VECTOR) + PSCB(vcpu,pending_interruption) = 1; return (IA64_NO_FAULT); } @@ -776,6 +777,8 @@ IA64FAULT vcpu_set_eoi(VCPU *vcpu, UINT64 val) // with interrupts disabled printf("Trying to EOI interrupt with interrupts enabled\r\n"); } + if (vcpu_check_pending_interrupts(vcpu) != SPURIOUS_VECTOR) + PSCB(vcpu,pending_interruption) = 1; //printf("YYYYY vcpu_set_eoi: Successful\n"); return (IA64_NO_FAULT); } From 1fb37b2fb44b9794443f12937eb941297ccf437a Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Tue, 26 Apr 2005 21:08:52 +0000 Subject: [PATCH 03/36] bitkeeper revision 1.1327.1.6 (426eade4Z6TUJnbOAc8St0Xt6XDYMw) Various tweaks for paravirtualization and debugging --- xen/arch/ia64/hypercall.c | 9 ++++++++- xen/arch/ia64/vhpt.c | 13 +++++++++++++ xen/arch/ia64/xenasm.S | 1 - xen/include/asm-ia64/config.h | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/xen/arch/ia64/hypercall.c b/xen/arch/ia64/hypercall.c index f568ee87b7..3eeff6fe2b 100644 --- a/xen/arch/ia64/hypercall.c +++ b/xen/arch/ia64/hypercall.c @@ -32,6 +32,14 @@ ia64_hypercall (struct pt_regs *regs) case FW_HYPERCALL_PAL_CALL: //printf("*** PAL hypercall: index=%d\n",regs->r28); //FIXME: This should call a C routine +#if 1 + // This is very conservative, but avoids a possible + // (and deadly) freeze in paravirtualized domains due + // to a yet-to-be-found bug where pending_interruption + // is zero when it shouldn't be. Since PAL is called + // in the idle loop, this should resolve it + ed->vcpu_info->arch.pending_interruption = 1; +#endif x = pal_emulator_static(regs->r28); regs->r8 = x.status; regs->r9 = x.v0; regs->r10 = x.v1; regs->r11 = x.v2; @@ -61,7 +69,6 @@ ia64_hypercall (struct pt_regs *regs) #endif break; case FW_HYPERCALL_EFI_GET_TIME: - fooefi(); tv = vcpu_get_gr(ed,32); tc = vcpu_get_gr(ed,33); //printf("efi_get_time(%p,%p) called...",tv,tc); diff --git a/xen/arch/ia64/vhpt.c b/xen/arch/ia64/vhpt.c index 976adce15c..b535f9fc56 100644 --- a/xen/arch/ia64/vhpt.c +++ b/xen/arch/ia64/vhpt.c @@ -21,7 +21,20 @@ void vhpt_flush(void) { struct vhpt_lf_entry *v = (void *)VHPT_ADDR; int i, cnt = 0; +#if 0 +static int firsttime = 2; +if (firsttime) firsttime--; +else { +printf("vhpt_flush: *********************************************\n"); +printf("vhpt_flush: *********************************************\n"); +printf("vhpt_flush: *********************************************\n"); +printf("vhpt_flush: flushing vhpt (seems to crash at rid wrap?)...\n"); +printf("vhpt_flush: *********************************************\n"); +printf("vhpt_flush: *********************************************\n"); +printf("vhpt_flush: *********************************************\n"); +} +#endif for (i = 0; i < VHPT_NUM_ENTRIES; i++, v++) { v->itir = 0; v->CChain = 0; diff --git a/xen/arch/ia64/xenasm.S b/xen/arch/ia64/xenasm.S index 0aee4a1fdd..f04dfea8fa 100644 --- a/xen/arch/ia64/xenasm.S +++ b/xen/arch/ia64/xenasm.S @@ -190,7 +190,6 @@ GLOBAL_ENTRY(ia64_new_rr7) movl r22=SHAREDINFO_ADDR ;; - movl r25=PAGE_SHARED movl r25=__pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RW) ;; mov r21=loc5 // saved sharedinfo physical address diff --git a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h index 2fb1c7c7ca..2b3d017cf9 100644 --- a/xen/include/asm-ia64/config.h +++ b/xen/include/asm-ia64/config.h @@ -251,6 +251,8 @@ extern unsigned int watchdog_on; #undef CONFIG_X86 +#define CONFIG_MCKINLEY + //#define CONFIG_SMP 1 //#define CONFIG_NR_CPUS 2 //leave SMP for a later time From 25875d4a7fb2e9c59f502c4f7515fb7b10469528 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Tue, 26 Apr 2005 22:24:29 +0000 Subject: [PATCH 04/36] bitkeeper revision 1.1327.1.7 (426ebf9dElmn-4PJcDb_JoGYAMuVlA) Oops, forgot a patch file --- xen/arch/ia64/patch/linux-2.6.11/time.c | 30 +++++++++++-------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/xen/arch/ia64/patch/linux-2.6.11/time.c b/xen/arch/ia64/patch/linux-2.6.11/time.c index 6f744899ba..e109c76fe6 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/time.c +++ b/xen/arch/ia64/patch/linux-2.6.11/time.c @@ -1,10 +1,5 @@ - time.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 files changed, 158 insertions(+) - -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/time.c 2005-04-07 17:02:39.634985144 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/time.c 2005-04-07 17:23:52.777723222 -0500 +--- ../../linux-2.6.11/arch/ia64/kernel/time.c 2005-03-02 00:37:50.000000000 -0700 ++++ arch/ia64/time.c 2005-04-26 15:43:01.000000000 -0600 @@ -10,16 +10,22 @@ */ #include @@ -48,7 +43,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c EXPORT_SYMBOL(jiffies_64); -@@ -45,33 +60,154 @@ EXPORT_SYMBOL(last_cli_ip); +@@ -45,33 +60,155 @@ #endif @@ -158,6 +153,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c + // We have to ensure that domain0 is launched before we + // call vcpu_timer_expired on it + //domain0_ready = 1; // moved to xensetup.c ++ current->vcpu_info->arch.pending_interruption = 1; + } + if (domain0_ready && vcpu_timer_expired(dom0->exec_domain[0])) { + vcpu_pend_timer(dom0->exec_domain[0]); @@ -203,7 +199,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c new_itm += local_cpu_data->itm_delta; -@@ -82,10 +218,16 @@ timer_interrupt (int irq, void *dev_id, +@@ -82,10 +219,16 @@ * another CPU. We need to avoid to SMP race by acquiring the * xtime_lock. */ @@ -220,7 +216,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c } else local_cpu_data->itm_next = new_itm; -@@ -105,7 +247,12 @@ timer_interrupt (int irq, void *dev_id, +@@ -105,7 +248,12 @@ */ while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2)) new_itm += local_cpu_data->itm_delta; @@ -233,7 +229,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c /* double check, in case we got hit by a (slow) PMI: */ } while (time_after_eq(ia64_get_itc(), new_itm)); return IRQ_HANDLED; -@@ -120,6 +267,7 @@ ia64_cpu_local_tick (void) +@@ -120,6 +268,7 @@ int cpu = smp_processor_id(); unsigned long shift = 0, delta; @@ -241,7 +237,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c /* arrange for the cycle counter to generate a timer interrupt: */ ia64_set_itv(IA64_TIMER_VECTOR); -@@ -133,6 +281,7 @@ ia64_cpu_local_tick (void) +@@ -133,6 +282,7 @@ shift = (2*(cpu - hi) + 1) * delta/hi/2; } local_cpu_data->itm_next = ia64_get_itc() + delta + shift; @@ -249,7 +245,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c ia64_set_itm(local_cpu_data->itm_next); } -@@ -160,6 +309,7 @@ ia64_init_itm (void) +@@ -160,6 +310,7 @@ * frequency and then a PAL call to determine the frequency ratio between the ITC * and the base frequency. */ @@ -257,7 +253,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM, &platform_base_freq, &platform_base_drift); if (status != 0) { -@@ -212,6 +362,7 @@ ia64_init_itm (void) +@@ -212,6 +363,7 @@ + itc_freq/2)/itc_freq; if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) { @@ -265,7 +261,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c itc_interpolator.frequency = local_cpu_data->itc_freq; itc_interpolator.drift = itc_drift; #ifdef CONFIG_SMP -@@ -228,6 +379,7 @@ ia64_init_itm (void) +@@ -228,6 +380,7 @@ if (!nojitter) itc_interpolator.jitter = 1; #endif register_time_interpolator(&itc_interpolator); @@ -273,7 +269,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c } /* Setup the CPU local timer tick */ -@@ -236,7 +388,9 @@ ia64_init_itm (void) +@@ -236,7 +389,9 @@ static struct irqaction timer_irqaction = { .handler = timer_interrupt, @@ -283,7 +279,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c .name = "timer" }; -@@ -244,12 +398,16 @@ void __init +@@ -244,12 +399,16 @@ time_init (void) { register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction); From f2811866bc51a6d591370d6c788f74ee0d250461 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Thu, 28 Apr 2005 17:02:19 +0000 Subject: [PATCH 05/36] bitkeeper revision 1.1327.1.8 (4271171bkgG2OW7a1JXLin4JRIi6_Q) Code cleanup --- xen/arch/ia64/patch/linux-2.6.11/head.S | 51 ++++--------------------- xen/arch/ia64/tools/mkbuildtree | 14 ++++--- xen/arch/ia64/xenmisc.c | 29 +++++++++++--- xen/arch/ia64/xensetup.c | 34 ++++++----------- xen/include/asm-ia64/config.h | 9 +++-- 5 files changed, 56 insertions(+), 81 deletions(-) diff --git a/xen/arch/ia64/patch/linux-2.6.11/head.S b/xen/arch/ia64/patch/linux-2.6.11/head.S index cb98c3ee89..7cb47a60b8 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/head.S +++ b/xen/arch/ia64/patch/linux-2.6.11/head.S @@ -1,20 +1,6 @@ - head.S | 34 ++++++++++++++++++++++++++++++++++ - 1 files changed, 34 insertions(+) - -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/head.S -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/head.S 2005-04-07 10:56:19.225128582 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/head.S 2005-04-07 11:00:21.718513399 -0500 -@@ -1,3 +1,8 @@ -+#ifdef XEN -+#define console_print printf -+#define kernel_thread_helper 0 -+#define sys_exit 0 -+#endif - /* - * Here is where the ball gets rolling as far as the kernel is concerned. - * When control is transferred to _start, the bootload has already -@@ -187,7 +192,11 @@ start_ap: +--- ../../linux-2.6.11/arch/ia64/kernel/head.S 2005-03-02 00:38:13.000000000 -0700 ++++ arch/ia64/head.S 2005-04-28 10:51:19.000000000 -0600 +@@ -187,7 +187,11 @@ dep r18=0,r3,0,12 ;; or r18=r17,r18 @@ -26,7 +12,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/head.S ;; mov r17=rr[r2] shr.u r16=r3,IA64_GRANULE_SHIFT -@@ -227,7 +236,11 @@ start_ap: +@@ -227,7 +231,11 @@ ;; mov ar.rsc=0x3 // place RSE in eager mode @@ -38,29 +24,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/head.S (isBP) movl r2=ia64_boot_param ;; (isBP) st8 [r2]=r28 // save the address of the boot param area passed by the bootloader -@@ -245,7 +258,21 @@ start_ap: - br.call.sptk.many rp=sys_fw_init - .ret1: - #endif -+#ifdef XEN -+ alloc r2=ar.pfs,8,0,2,0 -+ ;; -+#define fake_mbi_magic 0 -+#define MULTIBOOT_INFO_SIZE 1024 -+ .rodata -+fake_mbi: -+ .skip MULTIBOOT_INFO_SIZE -+ .previous -+ movl out0=fake_mbi -+ ;; -+ br.call.sptk.many rp=cmain -+#else - br.call.sptk.many rp=start_kernel -+#endif - .ret2: addl r3=@ltoff(halt_msg),gp - ;; - alloc r2=ar.pfs,8,0,2,0 -@@ -254,7 +281,9 @@ start_ap: +@@ -254,7 +262,9 @@ br.call.sptk.many b0=console_print self: hint @pause @@ -70,13 +34,12 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/head.S END(_start) GLOBAL_ENTRY(ia64_save_debug_regs) -@@ -850,7 +879,12 @@ END(ia64_delay_loop) +@@ -850,7 +860,11 @@ * intermediate precision so that we can produce a full 64-bit result. */ GLOBAL_ENTRY(sched_clock) +#ifdef XEN -+ break 0;; // FIX IA64_CPUINFO_NSEC_PER_CYC_OFFSET -+ //movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET ++ movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET +#else addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 +#endif diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 55dd82066d..6ff9b80a95 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -97,7 +97,8 @@ cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S #cp_patch mm/slab.c arch/ia64/slab.c slab.c # following renamed to avoid conflict -cp_patch kernel/extable.c arch/ia64/linuxextable.c linuxextable.c +#cp_patch kernel/extable.c arch/ia64/linuxextable.c linuxextable.c +softlink kernel/extable.c arch/ia64/linuxextable.c cp_patch arch/ia64/mm/contig.c arch/ia64/mm_contig.c mm_contig.c cp_patch arch/ia64/mm/tlb.c arch/ia64/tlb.c tlb.c @@ -168,7 +169,8 @@ softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h vml cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h -cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h +#cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h +softlink include/asm-ia64/current.h include/asm-ia64/current.h #cp_patch include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h gcc_intrin.h softlink include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h cp_patch include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h hardirq.h @@ -180,7 +182,8 @@ cp_patch include/asm-ia64/irq.h include/asm-ia64/irq.h irq.h cp_patch include/asm-ia64/kregs.h include/asm-ia64/kregs.h kregs.h cp_patch include/asm-ia64/page.h include/asm-ia64/page.h page.h cp_patch include/asm-ia64/processor.h include/asm-ia64/processor.h processor.h -cp_patch include/asm-ia64/sal.h include/asm-ia64/sal.h sal.h +#cp_patch include/asm-ia64/sal.h include/asm-ia64/sal.h sal.h +softlink include/asm-ia64/sal.h include/asm-ia64/sal.h cp_patch include/asm-ia64/system.h include/asm-ia64/system.h system.h cp_patch include/asm-ia64/types.h include/asm-ia64/types.h types.h @@ -268,9 +271,10 @@ cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h linuxhardirq.h cp_patch include/linux/interrupt.h include/asm-ia64/linux/interrupt.h interrupt.h cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h -cp_patch include/linux/wait.h include/asm-ia64/linux/wait.h wait.h +#cp_patch include/linux/wait.h include/asm-ia64/linux/wait.h wait.h +softlink include/linux/wait.h include/asm-ia64/linux/wait.h -cp_patch include/linux/slab.h include/asm-ia64/slab.h slab.h +#cp_patch include/linux/slab.h include/asm-ia64/slab.h slab.h # following renamed to avoid conflict cp_patch include/linux/time.h include/xen/linuxtime.h linuxtime.h diff --git a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c index 382def35c1..16668ed49d 100644 --- a/xen/arch/ia64/xenmisc.c +++ b/xen/arch/ia64/xenmisc.c @@ -237,18 +237,35 @@ void physdev_destroy_state(struct domain *d) dummy(); } -// accomodate linux extable.c -//const struct exception_table_entry * -void *search_module_extables(unsigned long addr) +/////////////////////////////// +// called from arch/ia64/head.S +/////////////////////////////// + +void console_print(char *msg) { - return NULL; + printk("console_print called, how did start_kernel return???\n"); } -void *module_text_address(unsigned long addr) +void kernel_thread_helper(void) { - return NULL; + printk("kernel_thread_helper not implemented\n"); + dummy(); } +void sys_exit(void) +{ + printk("sys_exit not implemented\n"); + dummy(); +} + + + +// accomodate linux extable.c +//const struct exception_table_entry * +void *search_module_extables(unsigned long addr) { return NULL; } +void *__module_text_address(unsigned long addr) { return NULL; } +void *module_text_address(unsigned long addr) { return NULL; } + void cs10foo(void) {} void cs01foo(void) {} diff --git a/xen/arch/ia64/xensetup.c b/xen/arch/ia64/xensetup.c index 466e4ec629..a15b754d68 100644 --- a/xen/arch/ia64/xensetup.c +++ b/xen/arch/ia64/xensetup.c @@ -1,13 +1,9 @@ /****************************************************************************** - * kernel.c - * - * This file should contain architecture-independent bootstrap and low-level - * help routines. It's a bit x86/PC specific right now! - * - * Copyright (c) 2002-2003 K A Fraser + * xensetup.c + * Copyright (c) 2004-2005 Hewlett-Packard Co + * Dan Magenheimer */ -//#include #include #include #include @@ -20,11 +16,6 @@ //#include //#include #include -//#include -//#include -//#include -//#include -//#include #include #include @@ -84,7 +75,7 @@ char opt_physdev_dom0_hide[200] = ""; char opt_leveltrigger[30] = "", opt_edgetrigger[30] = ""; /* * opt_xenheap_megabytes: Size of Xen heap in megabytes, including: - * xen image + * xen image * bootmap bits * xen heap * Note: To allow xenheap size configurable, the prerequisite is @@ -147,10 +138,9 @@ static void __init do_initcalls(void) (*call)(); } -void cmain(multiboot_info_t *mbi) +void start_kernel(void) { unsigned char *cmdline; - module_t *mod = (module_t *)__va(mbi->mods_addr); void *heap_start; int i; unsigned long max_mem, nr_pages, firsthole_start; @@ -162,7 +152,8 @@ void cmain(multiboot_info_t *mbi) xen_pstart = ia64_tpa(KERNEL_START); /* Must do this early -- e.g., spinlocks rely on get_current(). */ - set_current(&idle0_exec_domain); + //set_current(&idle0_exec_domain); + ia64_r13 = (void *)&idle0_exec_domain; idle0_exec_domain.domain = &idle0_domain; early_setup_arch(&cmdline); @@ -170,7 +161,7 @@ void cmain(multiboot_info_t *mbi) /* We initialise the serial devices very early so we can get debugging. */ serial_init_stage1(); - init_console(); + init_console(); set_printk_prefix("(XEN) "); /* xenheap should be in same TR-covered range with xen image */ @@ -201,7 +192,7 @@ void cmain(multiboot_info_t *mbi) ia64_boot_param->initrd_size); ia64_boot_param->initrd_start = initial_images_start; printk("Done\n"); - + /* first find highest page frame number */ max_page = 0; efi_memmap_walk(find_max_pfn, &max_page); @@ -217,7 +208,7 @@ void cmain(multiboot_info_t *mbi) efi_memmap_walk(filter_rsvd_memory, init_boot_pages); efi_memmap_walk(xen_count_pages, &nr_pages); - printk("System RAM: %luMB (%lukB)\n", + printk("System RAM: %luMB (%lukB)\n", nr_pages >> (20 - PAGE_SHIFT), nr_pages << (PAGE_SHIFT - 10)); @@ -267,7 +258,7 @@ printk("About to call init_idle_task()\n"); { int i; for (i = 0; i < CLONE_DOMAIN0; i++) { - clones[i] = do_createdomain(i+1, 0); + clones[i] = do_createdomain(i+1, 0); if ( clones[i] == NULL ) panic("Error creating domain0 clone %d\n",i); } @@ -278,9 +269,6 @@ printk("About to call init_idle_task()\n"); set_bit(DF_PRIVILEGED, &dom0->d_flags); -//printk("About to call shadow_mode_init()\n"); -// shadow_mode_init(); - /* * We're going to setup domain0 using the module(s) that we stashed safely * above our heap. The second module, if present, is an initrd ramdisk. diff --git a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h index 2b3d017cf9..1c34f40999 100644 --- a/xen/include/asm-ia64/config.h +++ b/xen/include/asm-ia64/config.h @@ -116,6 +116,9 @@ struct page; // avoid redefining task_t in asm/thread_info.h #define task_t struct domain +// avoid redefining task_struct in asm/current.h +#define task_struct exec_domain + // linux/include/asm-ia64/machvec.h (linux/arch/ia64/lib/io.c) #define platform_inb __ia64_inb #define platform_inw __ia64_inw @@ -177,8 +180,6 @@ struct pci_bus_region { unsigned long end; }; -// from linux/include/linux/module.h - // warning: unless search_extable is declared, the return value gets // truncated to 32-bits, causing a very strange error in privop handling struct exception_table_entry; @@ -232,7 +233,9 @@ void sort_main_extable(void); #define ARCH_HAS_EXEC_DOMAIN_MM_PTR -// see arch/x86/nmi.c !?!? +// from include/linux/preempt.h (needs including from interrupt.h or smp.h) +#define preempt_enable() do { } while (0) +#define preempt_disable() do { } while (0) // these declarations got moved at some point, find a better place for them extern int opt_noht; From f1033d84568cae409ec38c899ebff05625c2471b Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Thu, 28 Apr 2005 20:40:15 +0000 Subject: [PATCH 06/36] bitkeeper revision 1.1327.1.9 (42714a2f9RKgJOZHHOz9jvIICLyXxQ) More code cleanup --- xen/arch/ia64/Makefile | 2 +- xen/arch/ia64/patch/linux-2.6.11/cpumask.h | 20 ++++++-------------- xen/arch/ia64/patch/linux-2.6.11/time.c | 4 ++-- xen/arch/ia64/tools/mkbuildtree | 16 +++++++++++----- xen/arch/ia64/xenmisc.c | 6 ++++++ xen/include/asm-ia64/config.h | 17 ++++++++++++----- 6 files changed, 38 insertions(+), 27 deletions(-) diff --git a/xen/arch/ia64/Makefile b/xen/arch/ia64/Makefile index b8f1fdf161..6bc52ee152 100644 --- a/xen/arch/ia64/Makefile +++ b/xen/arch/ia64/Makefile @@ -9,7 +9,7 @@ OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \ sal.o cmdline.o mm_init.o tlb.o smpboot.o \ extable.o linuxextable.o \ regionreg.o entry.o unaligned.o privop.o vcpu.o \ - irq_ia64.o irq_lsapic.o hpsim_irq.o vhpt.o xenasm.o dom_fw.o + irq_ia64.o irq_lsapic.o vhpt.o xenasm.o dom_fw.o # perfmon.o # unwind.o needed for kernel unwinding (rare) diff --git a/xen/arch/ia64/patch/linux-2.6.11/cpumask.h b/xen/arch/ia64/patch/linux-2.6.11/cpumask.h index 6022ea2cdf..c5866b5350 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/cpumask.h +++ b/xen/arch/ia64/patch/linux-2.6.11/cpumask.h @@ -1,20 +1,12 @@ - cpumask.h | 2 +- - 1 files changed, 1 insertion(+), 1 deletion(-) - -Index: linux-2.6.11-xendiffs/include/linux/cpumask.h -=================================================================== ---- linux-2.6.11-xendiffs.orig/include/linux/cpumask.h 2005-03-02 01:38:00.000000000 -0600 -+++ linux-2.6.11-xendiffs/include/linux/cpumask.h 2005-03-24 15:06:18.408145243 -0600 -@@ -341,11 +341,11 @@ static inline int __cpumask_parse(const - * main(){ set1(3); set2(5); } +--- ../../linux-2.6.11/include/linux/cpumask.h 2005-03-02 00:38:00.000000000 -0700 ++++ include/asm-ia64/linux/cpumask.h 2005-04-28 13:21:20.000000000 -0600 +@@ -342,7 +342,9 @@ */ -+#if NR_CPUS > 1 extern cpumask_t cpu_possible_map; ++#ifndef XEN extern cpumask_t cpu_online_map; ++#endif extern cpumask_t cpu_present_map; --#if NR_CPUS > 1 - #define num_online_cpus() cpus_weight(cpu_online_map) - #define num_possible_cpus() cpus_weight(cpu_possible_map) - #define num_present_cpus() cpus_weight(cpu_present_map) + #if NR_CPUS > 1 diff --git a/xen/arch/ia64/patch/linux-2.6.11/time.c b/xen/arch/ia64/patch/linux-2.6.11/time.c index e109c76fe6..8df14e4311 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/time.c +++ b/xen/arch/ia64/patch/linux-2.6.11/time.c @@ -1,5 +1,5 @@ --- ../../linux-2.6.11/arch/ia64/kernel/time.c 2005-03-02 00:37:50.000000000 -0700 -+++ arch/ia64/time.c 2005-04-26 15:43:01.000000000 -0600 ++++ arch/ia64/time.c 2005-04-28 14:29:58.000000000 -0600 @@ -10,16 +10,22 @@ */ #include @@ -49,7 +49,7 @@ +#ifdef XEN +volatile unsigned long last_nsec_offset; -+extern rwlock_t xtime_lock; ++extern seqlock_t xtime_lock; +unsigned long cpu_khz; /* Detected as we calibrate the TSC */ +static s_time_t stime_irq; /* System time at last 'time update' */ + diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 6ff9b80a95..624142966f 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -103,7 +103,7 @@ softlink kernel/extable.c arch/ia64/linuxextable.c cp_patch arch/ia64/mm/contig.c arch/ia64/mm_contig.c mm_contig.c cp_patch arch/ia64/mm/tlb.c arch/ia64/tlb.c tlb.c -cp_patch arch/ia64/hp/sim/hpsim_irq.c arch/ia64/hpsim_irq.c hpsim_irq.c +#cp_patch arch/ia64/hp/sim/hpsim_irq.c arch/ia64/hpsim_irq.c hpsim_irq.c softlink arch/ia64/kernel/efi_stub.S arch/ia64/efi_stub.S softlink arch/ia64/kernel/entry.h arch/ia64/entry.h @@ -178,7 +178,8 @@ cp_patch include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h hardirq.h softlink include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h #cp_patch include/asm-ia64/ide.h include/asm-ia64/ide.h ide.h cp_patch include/asm-ia64/io.h include/asm-ia64/io.h io.h -cp_patch include/asm-ia64/irq.h include/asm-ia64/irq.h irq.h +#cp_patch include/asm-ia64/irq.h include/asm-ia64/irq.h irq.h +softlink include/asm-ia64/irq.h include/asm-ia64/irq.h cp_patch include/asm-ia64/kregs.h include/asm-ia64/kregs.h kregs.h cp_patch include/asm-ia64/page.h include/asm-ia64/page.h page.h cp_patch include/asm-ia64/processor.h include/asm-ia64/processor.h processor.h @@ -266,10 +267,12 @@ cp_patch include/linux/cpumask.h include/asm-ia64/linux/cpumask.h cpumask.h softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h #cp_patch include/linux/efi.h include/asm-ia64/linux/efi.h efi.h softlink include/linux/efi.h include/asm-ia64/linux/efi.h -cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h linuxhardirq.h +#cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h linuxhardirq.h +softlink include/linux/hardirq.h include/asm-ia64/linux/linuxhardirq.h #cp_patch include/linux/init_task.h include/asm-ia64/linux/init_task.h init_task.h cp_patch include/linux/interrupt.h include/asm-ia64/linux/interrupt.h interrupt.h -cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h +#cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h +softlink include/linux/mmzone.h include/asm-ia64/linux/mmzone.h #cp_patch include/linux/wait.h include/asm-ia64/linux/wait.h wait.h softlink include/linux/wait.h include/asm-ia64/linux/wait.h @@ -277,7 +280,8 @@ softlink include/linux/wait.h include/asm-ia64/linux/wait.h #cp_patch include/linux/slab.h include/asm-ia64/slab.h slab.h # following renamed to avoid conflict -cp_patch include/linux/time.h include/xen/linuxtime.h linuxtime.h +#cp_patch include/linux/time.h include/xen/linuxtime.h linuxtime.h +softlink include/linux/time.h include/asm-ia64/linux/linuxtime.h softlink include/linux/bcd.h include/asm-ia64/linux/bcd.h softlink include/linux/bitmap.h include/asm-ia64/linux/bitmap.h @@ -301,6 +305,7 @@ softlink include/linux/threads.h include/asm-ia64/linux/threads.h softlink include/linux/timex.h include/asm-ia64/linux/timex.h softlink include/linux/topology.h include/asm-ia64/linux/topology.h softlink include/linux/tty.h include/asm-ia64/linux/tty.h +softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h null include/asm-ia64/linux/file.h null include/asm-ia64/linux/module.h @@ -309,6 +314,7 @@ null include/asm-ia64/linux/device.h null include/asm-ia64/linux/proc_fs.h null include/asm-ia64/linux/rtc.h null include/asm-ia64/linux/profile.h +null include/asm-ia64/linux/seqlock.h softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h diff --git a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c index 16668ed49d..eb8e810491 100644 --- a/xen/arch/ia64/xenmisc.c +++ b/xen/arch/ia64/xenmisc.c @@ -259,6 +259,12 @@ void sys_exit(void) } +//////////////////////////////////// +// called from irq_ia64.c:init_IRQ() +// (because CONFIG_IA64_HP_SIM is specified) +//////////////////////////////////// +void hpsim_irq_init(void) { } + // accomodate linux extable.c //const struct exception_table_entry * diff --git a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h index 1c34f40999..c590f31423 100644 --- a/xen/include/asm-ia64/config.h +++ b/xen/include/asm-ia64/config.h @@ -136,6 +136,7 @@ struct page; #define __cacheline_aligned #define ____cacheline_aligned #define ____cacheline_aligned_in_smp +#define ____cacheline_maxaligned_in_smp #include "asm/types.h" // for u64 struct device { @@ -222,21 +223,27 @@ void sort_main_extable(void); // FIXME following needs work #define atomic_compareandswap(old, new, v) old -// x86 typedef still used in sched.h, may go away later -//typedef unsigned long l1_pgentry_t; - // see include/asm-ia64/mm.h, handle remaining pfn_info uses until gone #define pfn_info page // see common/keyhandler.c #define nop() asm volatile ("nop 0") -#define ARCH_HAS_EXEC_DOMAIN_MM_PTR - // from include/linux/preempt.h (needs including from interrupt.h or smp.h) #define preempt_enable() do { } while (0) #define preempt_disable() do { } while (0) +// needed for include/xen/linuxtime.h +typedef s64 time_t; +typedef s64 suseconds_t; + +// used in common code +#define softirq_pending(cpu) (cpu_data(cpu)->softirq_pending) + +// dup'ed from signal.h to avoid changes to includes +#define SA_SHIRQ 0x04000000 +#define SA_INTERRUPT 0x20000000 + // these declarations got moved at some point, find a better place for them extern int opt_noht; extern int ht_per_core; From e79456c5ee16c9672e4e9debf6ac6e1fc232757d Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Thu, 28 Apr 2005 20:54:13 +0000 Subject: [PATCH 07/36] bitkeeper revision 1.1327.1.10 (42714d75SI_oJV84oFz8Mm3tGBld4w) Fix code cleanup oops --- xen/arch/ia64/tools/mkbuildtree | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 624142966f..e181c1cd19 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -268,7 +268,7 @@ softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h #cp_patch include/linux/efi.h include/asm-ia64/linux/efi.h efi.h softlink include/linux/efi.h include/asm-ia64/linux/efi.h #cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h linuxhardirq.h -softlink include/linux/hardirq.h include/asm-ia64/linux/linuxhardirq.h +softlink include/linux/hardirq.h include/asm-ia64/linux/hardirq.h #cp_patch include/linux/init_task.h include/asm-ia64/linux/init_task.h init_task.h cp_patch include/linux/interrupt.h include/asm-ia64/linux/interrupt.h interrupt.h #cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h From daf8653e27160ff71bc44bc453a46adfb53737c4 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Thu, 28 Apr 2005 22:24:03 +0000 Subject: [PATCH 08/36] bitkeeper revision 1.1327.1.11 (42716283nLvDhTYM3QOqDMa-wZuJHQ) More code cleanup --- .rootkeys | 12 +- xen/arch/ia64/Makefile | 2 +- xen/arch/ia64/patch/linux-2.6.11/current.h | 22 -- xen/arch/ia64/patch/linux-2.6.11/hardirq.h | 15 -- xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c | 41 ---- xen/arch/ia64/patch/linux-2.6.11/irq.h | 23 -- .../ia64/patch/linux-2.6.11/kernel-time.c | 44 ---- .../ia64/patch/linux-2.6.11/linuxextable.c | 16 -- xen/arch/ia64/patch/linux-2.6.11/linuxtime.h | 36 --- xen/arch/ia64/patch/linux-2.6.11/mm_contig.c | 231 +++--------------- xen/arch/ia64/patch/linux-2.6.11/mmzone.h | 19 -- xen/arch/ia64/patch/linux-2.6.11/sal.h | 39 --- xen/arch/ia64/patch/linux-2.6.11/slab.h | 19 -- xen/arch/ia64/patch/linux-2.6.11/unaligned.c | 86 +------ xen/arch/ia64/patch/linux-2.6.11/wait.h | 35 --- xen/arch/ia64/tools/mkbuildtree | 6 +- xen/arch/ia64/xenmem.c | 67 +++++ xen/arch/ia64/xenmisc.c | 34 +++ 18 files changed, 149 insertions(+), 598 deletions(-) delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/current.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/hardirq.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/irq.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/kernel-time.c delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/linuxextable.c delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/linuxtime.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/mmzone.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/sal.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/slab.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/wait.h create mode 100644 xen/arch/ia64/xenmem.c diff --git a/.rootkeys b/.rootkeys index c463985a86..a4177c1adc 100644 --- a/.rootkeys +++ b/.rootkeys @@ -1082,43 +1082,32 @@ 421098b3O0MYMUsmYVFy84VV_1gFwQ xen/arch/ia64/mm_init.c 425ae516skiHBZU-Kfwxv2YWXfNRWQ xen/arch/ia64/patch/linux-2.6.11/bootmem.h 425ae516maKAsHBJVSzs19cdRgt3Nw xen/arch/ia64/patch/linux-2.6.11/cpumask.h -425ae516rHybgKj6KsvBOE0c_Hruxg xen/arch/ia64/patch/linux-2.6.11/current.h 425ae516cGqvMzGtihTEsQXAXsuOhQ xen/arch/ia64/patch/linux-2.6.11/efi.c 425ae516Y1A4q4_Kfre3qnDj7lbHJg xen/arch/ia64/patch/linux-2.6.11/entry.S -425ae516RoFheL-Ua-EOtFqmLxoc9g xen/arch/ia64/patch/linux-2.6.11/hardirq.h 425ae516PDO1ESDHXHVeDNvlqUfmdQ xen/arch/ia64/patch/linux-2.6.11/head.S -425ae5163aiWdc1IZNsON6ruE2-n9g xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c 425ae516JR7HWvt1zxJ-wLvEWmJGgg xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h 425ae516AHRNmaVuZjJY-9YjmKRDqg xen/arch/ia64/patch/linux-2.6.11/interrupt.h 425ae516U2wFUzrUJQUpy3z38jZHsQ xen/arch/ia64/patch/linux-2.6.11/io.h -425ae516nXL2iTzpziIaSLi3N257qQ xen/arch/ia64/patch/linux-2.6.11/irq.h 425ae516GGRmXijPBLC5ii6yWOn0rg xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c 425ae516qQA5dHuIybqfN3nEzM_Zvg xen/arch/ia64/patch/linux-2.6.11/ivt.S -425ae516_UhrTa3Y8wDG7fTgX6pNYA xen/arch/ia64/patch/linux-2.6.11/kernel-time.c 425ae516atiECmpn_6nZDw4kkmbJ6g xen/arch/ia64/patch/linux-2.6.11/kregs.h 425ae516lwlYwHG1Jv93kC3tfU5caw xen/arch/ia64/patch/linux-2.6.11/lds.S -425ae516UGTH2xC56DEIlHSrPH4oxg xen/arch/ia64/patch/linux-2.6.11/linuxextable.c 425ae516txAP-owjzpTJ7ThfzWR8nw xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h -425ae516kNsO5yYnBHvAISdvCkQ2-g xen/arch/ia64/patch/linux-2.6.11/linuxtime.h 425ae516Je2zI-Iw30_uGhvUYdlCZQ xen/arch/ia64/patch/linux-2.6.11/mca_asm.h 425ae5160-9wHxh0tOnIjavEjt6W0A xen/arch/ia64/patch/linux-2.6.11/minstate.h 425ae516N7SaORdbodDr90tmtCzYXw xen/arch/ia64/patch/linux-2.6.11/mm_contig.c -425ae516YcBgoZ3xCTEmhCrgX8CjCA xen/arch/ia64/patch/linux-2.6.11/mmzone.h 425ae516WDLrfEA4zr40d00z0VIWPg xen/arch/ia64/patch/linux-2.6.11/page.h 425ae516pVQ75NhdItT593SiWI0lbQ xen/arch/ia64/patch/linux-2.6.11/pal.S 425ae516QfmjiF_a-mabAXqV8Imzkg xen/arch/ia64/patch/linux-2.6.11/pgalloc.h 425ae516EWaNOBEnc1xnphTbRmNZsw xen/arch/ia64/patch/linux-2.6.11/processor.h -425ae5165sks4NwRldZOV_p63fspYw xen/arch/ia64/patch/linux-2.6.11/sal.h 425ae516LecDyXlwh3NLBtHZKXmMcA xen/arch/ia64/patch/linux-2.6.11/series 425ae516RFiPn2CGkpJ21LM-1lJcQg xen/arch/ia64/patch/linux-2.6.11/setup.c -425ae516-xgihgqPEv-Aq8-9cNoCXg xen/arch/ia64/patch/linux-2.6.11/slab.h 425ae516FX_10YaKGMU8Ysf7kkdm_A xen/arch/ia64/patch/linux-2.6.11/swiotlb.c 425ae516p4ICTkjqNYEfYFxqULj4dw xen/arch/ia64/patch/linux-2.6.11/system.h 425ae516juUB257qrwUdsL9AsswrqQ xen/arch/ia64/patch/linux-2.6.11/time.c 425ae5167zQn7zYcgKtDUDX2v-e8mw xen/arch/ia64/patch/linux-2.6.11/tlb.c 425ae5162bIl2Dgd19x-FceB4L9oGw xen/arch/ia64/patch/linux-2.6.11/types.h 425ae516cFUNY2jHD46bujcF5NJheA xen/arch/ia64/patch/linux-2.6.11/unaligned.c -425ae516viTtlyQjWHf6kBmq8KcwiQ xen/arch/ia64/patch/linux-2.6.11/wait.h 421098b39QFMC-1t1r38CA7NxAYBPA xen/arch/ia64/patch/linux-2.6.7/bootmem.h 421098b3SIA1vZX9fFUjo1T3o_jMCQ xen/arch/ia64/patch/linux-2.6.7/current.h 421098b3ZBl80iPuSeDU_Id5AgZl0w xen/arch/ia64/patch/linux-2.6.7/efi.c @@ -1179,6 +1168,7 @@ 41a26ebc--sjlYZQxmIxyCx3jw70qA xen/arch/ia64/vcpu.c 421098b6M2WhsJ_ZMzFamAQcdc5gzw xen/arch/ia64/vhpt.c 41a26ebc4jSBGQOuyNIPDST58mNbBw xen/arch/ia64/xenasm.S +427162263zDUiPmTj-lP4eGyXs5eIg xen/arch/ia64/xenmem.c 421098b6mWyFPtkhPz9h1LCmKpoCLg xen/arch/ia64/xenmisc.c 421098b6lY2JzrV1oFDbrt7XQhtElg xen/arch/ia64/xensetup.c 3ddb79bcZbRBzT3elFWSX7u6NtMagQ xen/arch/x86/Makefile diff --git a/xen/arch/ia64/Makefile b/xen/arch/ia64/Makefile index 6bc52ee152..cde36319dc 100644 --- a/xen/arch/ia64/Makefile +++ b/xen/arch/ia64/Makefile @@ -6,7 +6,7 @@ OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \ xenmisc.o pdb-stub.o acpi.o hypercall.o \ machvec.o dom0_ops.o domain.o \ idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \ - sal.o cmdline.o mm_init.o tlb.o smpboot.o \ + xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \ extable.o linuxextable.o \ regionreg.o entry.o unaligned.o privop.o vcpu.o \ irq_ia64.o irq_lsapic.o vhpt.o xenasm.o dom_fw.o diff --git a/xen/arch/ia64/patch/linux-2.6.11/current.h b/xen/arch/ia64/patch/linux-2.6.11/current.h deleted file mode 100644 index 195270ac0d..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/current.h +++ /dev/null @@ -1,22 +0,0 @@ - current.h | 8 ++++++++ - 1 files changed, 8 insertions(+) - -Index: linux-2.6.11/include/asm-ia64/current.h -=================================================================== ---- linux-2.6.11.orig/include/asm-ia64/current.h 2005-03-02 01:38:19.000000000 -0600 -+++ linux-2.6.11/include/asm-ia64/current.h 2005-03-19 12:39:41.410955288 -0600 -@@ -12,6 +12,14 @@ - * In kernel mode, thread pointer (r13) is used to point to the current task - * structure. - */ -+#ifdef XEN -+struct domain; -+#define get_current() ((struct exec_domain *) ia64_getreg(_IA64_REG_TP)) -+#define current get_current() -+//#define set_current(d) ia64_setreg(_IA64_REG_TP,(void *)d); -+#define set_current(d) (ia64_r13 = (void *)d) -+#else - #define current ((struct task_struct *) ia64_getreg(_IA64_REG_TP)) -+#endif - - #endif /* _ASM_IA64_CURRENT_H */ diff --git a/xen/arch/ia64/patch/linux-2.6.11/hardirq.h b/xen/arch/ia64/patch/linux-2.6.11/hardirq.h deleted file mode 100644 index 52077f2da8..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/hardirq.h +++ /dev/null @@ -1,15 +0,0 @@ - hardirq.h | 1 + - 1 files changed, 1 insertion(+) - -Index: linux-2.6.11-xendiffs/include/asm-ia64/hardirq.h -=================================================================== ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/hardirq.h 2005-03-24 15:59:37.210502749 -0600 -+++ linux-2.6.11-xendiffs/include/asm-ia64/hardirq.h 2005-03-24 16:00:19.439540961 -0600 -@@ -20,6 +20,7 @@ - #define __ARCH_IRQ_STAT 1 - - #define local_softirq_pending() (local_cpu_data->softirq_pending) -+#define softirq_pending(cpu) (cpu_data(cpu)->softirq_pending) - - #define HARDIRQ_BITS 14 - diff --git a/xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c b/xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c deleted file mode 100644 index a212275865..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c +++ /dev/null @@ -1,41 +0,0 @@ - hpsim_irq.c | 15 +++++++++++++++ - 1 files changed, 15 insertions(+) - -Index: linux-2.6.11/arch/ia64/hp/sim/hpsim_irq.c -=================================================================== ---- linux-2.6.11.orig/arch/ia64/hp/sim/hpsim_irq.c 2005-03-02 01:38:33.000000000 -0600 -+++ linux-2.6.11/arch/ia64/hp/sim/hpsim_irq.c 2005-03-19 13:33:57.312014806 -0600 -@@ -9,7 +9,17 @@ - #include - #include - #include -+#ifdef XEN -+#include -+#endif - -+#if 1 -+void __init -+hpsim_irq_init (void) -+{ -+ printf("*** hpsim_irq_init called: NOT NEEDED?!?!?\n"); -+} -+#else - static unsigned int - hpsim_irq_startup (unsigned int irq) - { -@@ -19,6 +29,10 @@ hpsim_irq_startup (unsigned int irq) - static void - hpsim_irq_noop (unsigned int irq) - { -+#if 1 -+printf("hpsim_irq_noop: irq=%d\n",irq); -+while(irq); -+#endif - } - - static void -@@ -49,3 +63,4 @@ hpsim_irq_init (void) - idesc->handler = &irq_type_hp_sim; - } - } -+#endif diff --git a/xen/arch/ia64/patch/linux-2.6.11/irq.h b/xen/arch/ia64/patch/linux-2.6.11/irq.h deleted file mode 100644 index d4937de5db..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/irq.h +++ /dev/null @@ -1,23 +0,0 @@ - irq.h | 9 +++++++++ - 1 files changed, 9 insertions(+) - -Index: linux-2.6.11/include/asm-ia64/irq.h -=================================================================== ---- linux-2.6.11.orig/include/asm-ia64/irq.h 2005-03-02 01:38:33.000000000 -0600 -+++ linux-2.6.11/include/asm-ia64/irq.h 2005-03-19 13:42:27.957677364 -0600 -@@ -30,6 +30,15 @@ extern void disable_irq_nosync (unsigned - extern void enable_irq (unsigned int); - extern void set_irq_affinity_info (unsigned int irq, int dest, int redir); - -+#ifdef XEN -+// dup'ed from signal.h to avoid changes to includes -+#define SA_NOPROFILE 0x02000000 -+#define SA_SHIRQ 0x04000000 -+#define SA_RESTART 0x10000000 -+#define SA_INTERRUPT 0x20000000 -+#define SA_SAMPLE_RANDOM SA_RESTART -+#endif -+ - #ifdef CONFIG_SMP - extern void move_irq(int irq); - #else diff --git a/xen/arch/ia64/patch/linux-2.6.11/kernel-time.c b/xen/arch/ia64/patch/linux-2.6.11/kernel-time.c deleted file mode 100644 index 29ff92ee9b..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/kernel-time.c +++ /dev/null @@ -1,44 +0,0 @@ - time.c | 7 ++++++- - 1 files changed, 6 insertions(+), 1 deletion(-) - -Index: linux-2.6.11/kernel/time.c -=================================================================== ---- linux-2.6.11.orig/kernel/time.c 2005-03-02 01:37:50.000000000 -0600 -+++ linux-2.6.11/kernel/time.c 2005-03-19 14:56:40.767870674 -0600 -@@ -495,6 +495,7 @@ void getnstimeofday (struct timespec *tv - tv->tv_nsec = nsec; - } - -+#ifndef XEN - int do_settimeofday (struct timespec *tv) - { - time_t wtm_sec, sec = tv->tv_sec; -@@ -503,7 +504,9 @@ int do_settimeofday (struct timespec *tv - if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) - return -EINVAL; - -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN - write_seqlock_irq(&xtime_lock); -+#endif - { - /* - * This is revolting. We need to set "xtime" correctly. However, the value -@@ -525,7 +528,9 @@ int do_settimeofday (struct timespec *tv - time_esterror = NTP_PHASE_LIMIT; - time_interpolator_reset(); - } -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN - write_sequnlock_irq(&xtime_lock); -+#endif - clock_was_set(); - return 0; - } -@@ -552,7 +557,7 @@ void do_gettimeofday (struct timeval *tv - } - - EXPORT_SYMBOL(do_gettimeofday); -- -+#endif - - #else - /* diff --git a/xen/arch/ia64/patch/linux-2.6.11/linuxextable.c b/xen/arch/ia64/patch/linux-2.6.11/linuxextable.c deleted file mode 100644 index fe796a1476..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/linuxextable.c +++ /dev/null @@ -1,16 +0,0 @@ - extable.c | 2 ++ - 1 files changed, 2 insertions(+) - -Index: linux-2.6.11-xendiffs/kernel/extable.c -=================================================================== ---- linux-2.6.11-xendiffs.orig/kernel/extable.c 2005-03-02 01:37:54.000000000 -0600 -+++ linux-2.6.11-xendiffs/kernel/extable.c 2005-04-08 14:30:46.283360881 -0500 -@@ -20,6 +20,8 @@ - #include - #include - -+#define __module_text_address(addr) (NULL) -+ - extern struct exception_table_entry __start___ex_table[]; - extern struct exception_table_entry __stop___ex_table[]; - diff --git a/xen/arch/ia64/patch/linux-2.6.11/linuxtime.h b/xen/arch/ia64/patch/linux-2.6.11/linuxtime.h deleted file mode 100644 index 4d5b1ed9fc..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/linuxtime.h +++ /dev/null @@ -1,36 +0,0 @@ - time.h | 9 +++++++++ - 1 files changed, 9 insertions(+) - -Index: linux-2.6.11/include/linux/time.h -=================================================================== ---- linux-2.6.11.orig/include/linux/time.h 2005-03-02 01:38:12.000000000 -0600 -+++ linux-2.6.11/include/linux/time.h 2005-03-19 13:46:27.987225234 -0600 -@@ -1,11 +1,18 @@ - #ifndef _LINUX_TIME_H - #define _LINUX_TIME_H - -+#ifdef XEN -+typedef s64 time_t; -+typedef s64 suseconds_t; -+#endif -+ - #include - -+#ifndef XEN - #ifdef __KERNEL__ - #include - #endif -+#endif - - #ifndef _STRUCT_TIMESPEC - #define _STRUCT_TIMESPEC -@@ -80,7 +87,9 @@ mktime (unsigned int year, unsigned int - - extern struct timespec xtime; - extern struct timespec wall_to_monotonic; -+#ifndef XEN - extern seqlock_t xtime_lock; -+#endif - - static inline unsigned long get_seconds(void) - { diff --git a/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c b/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c index 3819120008..df5eb199a6 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c +++ b/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c @@ -1,220 +1,47 @@ - contig.c | 172 +++++++++++++++++---------------------------------------------- - 1 files changed, 48 insertions(+), 124 deletions(-) - -Index: linux-2.6.11-xendiffs/arch/ia64/mm/contig.c -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/mm/contig.c 2005-04-07 11:02:50.227598140 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/mm/contig.c 2005-04-07 11:05:21.724931959 -0500 -@@ -15,11 +15,21 @@ - * memory. +--- ../../linux-2.6.11/arch/ia64/mm/contig.c 2005-03-02 00:37:55.000000000 -0700 ++++ arch/ia64/mm_contig.c 2005-04-28 16:13:52.000000000 -0600 +@@ -35,6 +35,7 @@ + * + * Just walks the pages in the system and describes where they're allocated. */ - #include -+#ifdef XEN -+#include -+#endif - #include - #include - #include - #include - -+#ifdef XEN -+#undef reserve_bootmem -+extern struct page *zero_page_memmap_ptr; -+struct page *mem_map; -+#define MAX_DMA_ADDRESS ~0UL // FIXME??? -+#endif -+ - #include - #include - #include -@@ -38,30 +48,7 @@ static unsigned long num_dma_physpages; ++#ifndef XEN void show_mem (void) { -- int i, total = 0, reserved = 0; -- int shared = 0, cached = 0; -- -- printk("Mem-info:\n"); -- show_free_areas(); -- -- printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); -- i = max_mapnr; -- while (i-- > 0) { -- if (!pfn_valid(i)) -- continue; -- total++; -- if (PageReserved(mem_map+i)) -- reserved++; -- else if (PageSwapCache(mem_map+i)) -- cached++; -- else if (page_count(mem_map + i)) -- shared += page_count(mem_map + i) - 1; -- } -- printk("%d pages of RAM\n", total); -- printk("%d reserved pages\n", reserved); -- printk("%d pages shared\n", shared); -- printk("%d pages swap cached\n", cached); -- printk("%ld pages in page table cache\n", pgtable_cache_size); -+ printk("Dummy show_mem\n"); +@@ -63,6 +64,7 @@ + printk("%d pages swap cached\n", cached); + printk("%ld pages in page table cache\n", pgtable_cache_size); } ++#endif /* physical address where the bootmem map is located */ -@@ -81,6 +68,9 @@ find_max_pfn (unsigned long start, unsig + unsigned long bootmap_start; +@@ -140,6 +142,7 @@ + * Walk the EFI memory map and find usable memory for the system, taking + * into account reserved areas. + */ ++#ifndef XEN + void + find_memory (void) { - unsigned long *max_pfnp = arg, pfn; +@@ -168,6 +171,7 @@ -+#ifdef XEN -+//printf("find_max_pfn: start=%lx, end=%lx, *arg=%lx\n",start,end,*(unsigned long *)arg); -+#endif - pfn = (PAGE_ALIGN(end - 1) - PAGE_OFFSET) >> PAGE_SHIFT; - if (pfn > *max_pfnp) - *max_pfnp = pfn; -@@ -134,41 +124,6 @@ find_bootmap_location (unsigned long sta - return 0; + find_initrd(); } ++#endif --/** -- * find_memory - setup memory map -- * -- * Walk the EFI memory map and find usable memory for the system, taking -- * into account reserved areas. -- */ --void --find_memory (void) --{ -- unsigned long bootmap_size; -- -- reserve_memory(); -- -- /* first find highest page frame number */ -- max_pfn = 0; -- efi_memmap_walk(find_max_pfn, &max_pfn); -- -- /* how many bytes to cover all the pages */ -- bootmap_size = bootmem_bootmap_pages(max_pfn) << PAGE_SHIFT; -- -- /* look for a location to hold the bootmap */ -- bootmap_start = ~0UL; -- efi_memmap_walk(find_bootmap_location, &bootmap_size); -- if (bootmap_start == ~0UL) -- panic("Cannot find %ld bytes for bootmap\n", bootmap_size); -- -- bootmap_size = init_bootmem(bootmap_start >> PAGE_SHIFT, max_pfn); -- -- /* Free all available memory, then mark bootmem-map as being in use. */ -- efi_memmap_walk(filter_rsvd_memory, free_bootmem); -- reserve_bootmem(bootmap_start, bootmap_size); -- -- find_initrd(); --} -- #ifdef CONFIG_SMP /** - * per_cpu_init - setup per-cpu variables -@@ -228,72 +183,41 @@ count_dma_pages (u64 start, u64 end, voi +@@ -225,6 +229,7 @@ + * Set up the page tables. + */ + ++#ifndef XEN void paging_init (void) { -- unsigned long max_dma; -- unsigned long zones_size[MAX_NR_ZONES]; --#ifdef CONFIG_VIRTUAL_MEM_MAP -- unsigned long zholes_size[MAX_NR_ZONES]; -- unsigned long max_gap; --#endif -- -- /* initialize mem_map[] */ -- -- memset(zones_size, 0, sizeof(zones_size)); -- -- num_physpages = 0; -- efi_memmap_walk(count_pages, &num_physpages); -- -- max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; -- --#ifdef CONFIG_VIRTUAL_MEM_MAP -- memset(zholes_size, 0, sizeof(zholes_size)); -+ struct pfn_info *pg; -+ /* Allocate and map the machine-to-phys table */ -+ if ((pg = alloc_domheap_pages(NULL, 10)) == NULL) -+ panic("Not enough memory to bootstrap Xen.\n"); -+ memset(page_to_virt(pg), 0x55, 16UL << 20); - -- num_dma_physpages = 0; -- efi_memmap_walk(count_dma_pages, &num_dma_physpages); -+ /* Other mapping setup */ - -- if (max_low_pfn < max_dma) { -- zones_size[ZONE_DMA] = max_low_pfn; -- zholes_size[ZONE_DMA] = max_low_pfn - num_dma_physpages; -- } else { -- zones_size[ZONE_DMA] = max_dma; -- zholes_size[ZONE_DMA] = max_dma - num_dma_physpages; -- if (num_physpages > num_dma_physpages) { -- zones_size[ZONE_NORMAL] = max_low_pfn - max_dma; -- zholes_size[ZONE_NORMAL] = -- ((max_low_pfn - max_dma) - -- (num_physpages - num_dma_physpages)); -- } -- } -- -- max_gap = 0; -- efi_memmap_walk(find_largest_hole, (u64 *)&max_gap); -- if (max_gap < LARGE_GAP) { -- vmem_map = (struct page *) 0; -- free_area_init_node(0, &contig_page_data, zones_size, 0, -- zholes_size); -- } else { -- unsigned long map_size; -- -- /* allocate virtual_mem_map */ -- -- map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page)); -- vmalloc_end -= map_size; -- vmem_map = (struct page *) vmalloc_end; -- efi_memmap_walk(create_mem_map_page_table, NULL); -- -- mem_map = contig_page_data.node_mem_map = vmem_map; -- free_area_init_node(0, &contig_page_data, zones_size, -- 0, zholes_size); -- -- printk("Virtual mem_map starts at 0x%p\n", mem_map); -- } --#else /* !CONFIG_VIRTUAL_MEM_MAP */ -- if (max_low_pfn < max_dma) -- zones_size[ZONE_DMA] = max_low_pfn; -- else { -- zones_size[ZONE_DMA] = max_dma; -- zones_size[ZONE_NORMAL] = max_low_pfn - max_dma; -- } -- free_area_init(zones_size); --#endif /* !CONFIG_VIRTUAL_MEM_MAP */ +@@ -297,3 +302,4 @@ + #endif /* !CONFIG_VIRTUAL_MEM_MAP */ zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page)); } -+ -+struct pfn_info *frame_table; -+unsigned long frame_table_size; -+unsigned long max_page; -+ -+/* FIXME: postpone support to machines with big holes between physical memorys. -+ * Current hack allows only efi memdesc upto 4G place. (See efi.c) -+ */ -+#ifndef CONFIG_VIRTUAL_MEM_MAP -+#define FT_ALIGN_SIZE (16UL << 20) -+void __init init_frametable(void) -+{ -+ unsigned long i, p; -+ frame_table_size = max_page * sizeof(struct pfn_info); -+ frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK; -+ -+ /* Request continuous trunk from boot allocator, since HV -+ * address is identity mapped */ -+ p = alloc_boot_pages(frame_table_size, FT_ALIGN_SIZE); -+ if (p == 0) -+ panic("Not enough memory for frame table.\n"); -+ -+ frame_table = __va(p); -+ memset(frame_table, 0, frame_table_size); -+ printk("size of frame_table: %lukB\n", -+ frame_table_size >> 10); -+} -+#endif ++#endif /* !CONFIG_XEN */ diff --git a/xen/arch/ia64/patch/linux-2.6.11/mmzone.h b/xen/arch/ia64/patch/linux-2.6.11/mmzone.h deleted file mode 100644 index d1c61b4a4e..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/mmzone.h +++ /dev/null @@ -1,19 +0,0 @@ - mmzone.h | 4 ++++ - 1 files changed, 4 insertions(+) - -Index: linux-2.6.11/include/linux/mmzone.h -=================================================================== ---- linux-2.6.11.orig/include/linux/mmzone.h 2005-03-02 01:38:10.000000000 -0600 -+++ linux-2.6.11/include/linux/mmzone.h 2005-03-19 13:49:30.427573139 -0600 -@@ -209,7 +209,11 @@ struct zone { - * rarely used fields: - */ - char *name; -+#ifdef XEN -+}; -+#else - } ____cacheline_maxaligned_in_smp; -+#endif - - - /* diff --git a/xen/arch/ia64/patch/linux-2.6.11/sal.h b/xen/arch/ia64/patch/linux-2.6.11/sal.h deleted file mode 100644 index e600d3c7af..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/sal.h +++ /dev/null @@ -1,39 +0,0 @@ - sal.h | 17 +++++++++++++++++ - 1 files changed, 17 insertions(+) - -Index: linux-2.6.11-xendiffs/include/asm-ia64/sal.h -=================================================================== ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/sal.h 2005-04-08 12:00:53.510988510 -0500 -+++ linux-2.6.11-xendiffs/include/asm-ia64/sal.h 2005-04-08 12:02:17.778587216 -0500 -@@ -36,6 +36,7 @@ - #ifndef __ASSEMBLY__ - - #include -+#include - #include - #include - -@@ -650,7 +651,23 @@ ia64_sal_freq_base (unsigned long which, - { - struct ia64_sal_retval isrv; - -+//#ifdef XEN -+#if 0 -+ unsigned long *x = (unsigned long *)ia64_sal; -+ unsigned long *inst = (unsigned long *)*x; -+ unsigned long __ia64_sc_flags; -+ struct ia64_fpreg __ia64_sc_fr[6]; -+printf("ia64_sal_freq_base: about to save_scratch_fpregs\n"); -+ ia64_save_scratch_fpregs(__ia64_sc_fr); -+ spin_lock_irqsave(&sal_lock, __ia64_sc_flags); -+printf("ia64_sal_freq_base: about to call, ia64_sal=%p, ia64_sal[0]=%p, ia64_sal[1]=%p\n",x,x[0],x[1]); -+printf("first inst=%p,%p\n",inst[0],inst[1]); -+ isrv = (*ia64_sal)(SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0); -+ spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags); -+ ia64_load_scratch_fpregs(__ia64_sc_fr); -+#else - SAL_CALL(isrv, SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0); -+#endif - *ticks_per_second = isrv.v0; - *drift_info = isrv.v1; - return isrv.status; diff --git a/xen/arch/ia64/patch/linux-2.6.11/slab.h b/xen/arch/ia64/patch/linux-2.6.11/slab.h deleted file mode 100644 index e1dda60e15..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/slab.h +++ /dev/null @@ -1,19 +0,0 @@ - slab.h | 4 ++++ - 1 files changed, 4 insertions(+) - -Index: linux-2.6.11/include/linux/slab.h -=================================================================== ---- linux-2.6.11.orig/include/linux/slab.h 2005-03-02 01:38:33.000000000 -0600 -+++ linux-2.6.11/include/linux/slab.h 2005-03-19 14:35:19.301871922 -0600 -@@ -91,7 +91,11 @@ static inline void *kmalloc(size_t size, - goto found; \ - else \ - i++; -+#ifdef XEN -+#include -+#else - #include "kmalloc_sizes.h" -+#endif - #undef CACHE - { - extern void __you_cannot_kmalloc_that_much(void); diff --git a/xen/arch/ia64/patch/linux-2.6.11/unaligned.c b/xen/arch/ia64/patch/linux-2.6.11/unaligned.c index 6bf27842bf..bcc165e95e 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/unaligned.c +++ b/xen/arch/ia64/patch/linux-2.6.11/unaligned.c @@ -1,39 +1,6 @@ - unaligned.c | 27 +++++++++++++++++++++++++++ - 1 files changed, 27 insertions(+) - -Index: linux-2.6.11/arch/ia64/kernel/unaligned.c -=================================================================== ---- linux-2.6.11.orig/arch/ia64/kernel/unaligned.c 2005-03-02 01:38:25.000000000 -0600 -+++ linux-2.6.11/arch/ia64/kernel/unaligned.c 2005-03-19 14:58:51.269335202 -0600 -@@ -15,8 +15,10 @@ - */ - #include - #include -+#ifndef XEN - #include - #include -+#endif - - #include - #include -@@ -24,7 +26,16 @@ - #include - #include - -+#ifdef XEN -+#define ia64_peek(x...) printk("ia64_peek: called, not implemented\n") -+#define ia64_poke(x...) printk("ia64_poke: called, not implemented\n") -+#define ia64_sync_fph(x...) printk("ia64_sync_fph: called, not implemented\n") -+#define ia64_flush_fph(x...) printk("ia64_flush_fph: called, not implemented\n") -+#define die_if_kernel(x...) printk("die_if_kernel: called, not implemented\n") -+#define jiffies 0 -+#else - extern void die_if_kernel(char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn)); -+#endif - - #undef DEBUG_UNALIGNED_TRAP - -@@ -437,7 +448,11 @@ get_rse_reg (struct pt_regs *regs, unsig +--- ../../linux-2.6.11/arch/ia64/kernel/unaligned.c 2005-03-02 00:38:25.000000000 -0700 ++++ arch/ia64/unaligned.c 2005-04-28 15:40:13.000000000 -0600 +@@ -437,7 +437,11 @@ } @@ -45,7 +12,7 @@ Index: linux-2.6.11/arch/ia64/kernel/unaligned.c setreg (unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs) { struct switch_stack *sw = (struct switch_stack *) regs - 1; -@@ -611,7 +626,11 @@ getfpreg (unsigned long regnum, struct i +@@ -611,7 +615,11 @@ } @@ -57,46 +24,19 @@ Index: linux-2.6.11/arch/ia64/kernel/unaligned.c getreg (unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs) { struct switch_stack *sw = (struct switch_stack *) regs - 1; -@@ -1298,7 +1317,9 @@ ia64_handle_unaligned (unsigned long ifa - mm_segment_t old_fs = get_fs(); - unsigned long bundle[2]; - unsigned long opcode; -+#ifndef XEN - struct siginfo si; -+#endif - const struct exception_table_entry *eh = NULL; - union { - unsigned long l; -@@ -1317,6 +1338,9 @@ ia64_handle_unaligned (unsigned long ifa - * user-level unaligned accesses. Otherwise, a clever program could trick this - * handler into reading an arbitrary kernel addresses... - */ +@@ -1294,6 +1302,9 @@ + void + ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs) + { +#ifdef XEN +printk("ia64_handle_unaligned: called, not working yet\n"); +#else - if (!user_mode(regs)) - eh = search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri); - if (user_mode(regs) || eh) { -@@ -1353,6 +1377,7 @@ ia64_handle_unaligned (unsigned long ifa - - if (__copy_from_user(bundle, (void __user *) regs->cr_iip, 16)) - goto failure; -+#endif - - /* - * extract the instruction from the bundle given the slot number -@@ -1493,6 +1518,7 @@ ia64_handle_unaligned (unsigned long ifa - /* NOT_REACHED */ - } - force_sigbus: -+#ifndef XEN - si.si_signo = SIGBUS; - si.si_errno = 0; - si.si_code = BUS_ADRALN; -@@ -1501,5 +1527,6 @@ ia64_handle_unaligned (unsigned long ifa - si.si_isr = 0; + struct ia64_psr *ipsr = ia64_psr(regs); + mm_segment_t old_fs = get_fs(); + unsigned long bundle[2]; +@@ -1502,4 +1513,5 @@ si.si_imm = 0; force_sig_info(SIGBUS, &si, current); -+#endif goto done; ++#endif } diff --git a/xen/arch/ia64/patch/linux-2.6.11/wait.h b/xen/arch/ia64/patch/linux-2.6.11/wait.h deleted file mode 100644 index e38b0d07a5..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/wait.h +++ /dev/null @@ -1,35 +0,0 @@ - wait.h | 6 ++++++ - 1 files changed, 6 insertions(+) - -Index: linux-2.6.11/include/linux/wait.h -=================================================================== ---- linux-2.6.11.orig/include/linux/wait.h 2005-03-02 01:38:10.000000000 -0600 -+++ linux-2.6.11/include/linux/wait.h 2005-03-19 15:00:23.691156973 -0600 -@@ -136,7 +136,11 @@ static inline void __remove_wait_queue(w - list_del(&old->task_list); - } - -+#ifdef XEN -+void FASTCALL(__wake_up(struct task_struct *p)); -+#else - void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key)); -+#endif - extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode)); - extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr)); - void FASTCALL(__wake_up_bit(wait_queue_head_t *, void *, int)); -@@ -147,6 +151,7 @@ int FASTCALL(out_of_line_wait_on_bit(voi - int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned)); - wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int)); - -+#ifndef XEN - #define wake_up(x) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL) - #define wake_up_nr(x, nr) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL) - #define wake_up_all(x) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL) -@@ -155,6 +160,7 @@ wait_queue_head_t *FASTCALL(bit_waitqueu - #define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) - #define wake_up_locked(x) __wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE) - #define wake_up_interruptible_sync(x) __wake_up_sync((x),TASK_INTERRUPTIBLE, 1) -+#endif - - #define __wait_event(wq, condition) \ - do { \ diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index e181c1cd19..6655fe7b06 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -90,7 +90,8 @@ cp_patch arch/ia64/kernel/ivt.S arch/ia64/ivt.S ivt.S cp_patch arch/ia64/kernel/setup.c arch/ia64/setup.c setup.c cp_patch arch/ia64/kernel/time.c arch/ia64/time.c time.c cp_patch arch/ia64/kernel/unaligned.c arch/ia64/unaligned.c unaligned.c -cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S +#cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S +softlink arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S #cp_patch mm/bootmem.c arch/ia64/mm_bootmem.c mm_bootmem.c #cp_patch mm/page_alloc.c arch/ia64/page_alloc.c page_alloc.c @@ -304,7 +305,6 @@ softlink include/linux/thread_info.h include/asm-ia64/linux/thread_info.h softlink include/linux/threads.h include/asm-ia64/linux/threads.h softlink include/linux/timex.h include/asm-ia64/linux/timex.h softlink include/linux/topology.h include/asm-ia64/linux/topology.h -softlink include/linux/tty.h include/asm-ia64/linux/tty.h softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h null include/asm-ia64/linux/file.h @@ -315,6 +315,8 @@ null include/asm-ia64/linux/proc_fs.h null include/asm-ia64/linux/rtc.h null include/asm-ia64/linux/profile.h null include/asm-ia64/linux/seqlock.h +null include/asm-ia64/linux/smp_lock.h +null include/asm-ia64/linux/tty.h softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h diff --git a/xen/arch/ia64/xenmem.c b/xen/arch/ia64/xenmem.c new file mode 100644 index 0000000000..c3f255fd51 --- /dev/null +++ b/xen/arch/ia64/xenmem.c @@ -0,0 +1,67 @@ +/* + * Xen memory allocator routines + * + * Copyright (C) 2005 Hewlett-Packard Co + * Dan Magenheimer + * Copyright (C) 2005 Intel Corp. + * + * Routines used by ia64 machines with contiguous (or virtually contiguous) + * memory. + */ + +#include +#include + +extern struct page *zero_page_memmap_ptr; +struct pfn_info *frame_table; +unsigned long frame_table_size; +unsigned long max_page; + +struct page *mem_map; +#define MAX_DMA_ADDRESS ~0UL // FIXME??? + +#ifdef CONFIG_VIRTUAL_MEM_MAP +static unsigned long num_dma_physpages; +#endif + +/* + * Set up the page tables. + */ + +void +paging_init (void) +{ + struct pfn_info *pg; + /* Allocate and map the machine-to-phys table */ + if ((pg = alloc_domheap_pages(NULL, 10)) == NULL) + panic("Not enough memory to bootstrap Xen.\n"); + memset(page_to_virt(pg), 0x55, 16UL << 20); + + /* Other mapping setup */ + + zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page)); +} + +/* FIXME: postpone support to machines with big holes between physical memorys. + * Current hack allows only efi memdesc upto 4G place. (See efi.c) + */ +#ifndef CONFIG_VIRTUAL_MEM_MAP +#define FT_ALIGN_SIZE (16UL << 20) +void __init init_frametable(void) +{ + unsigned long i, p; + frame_table_size = max_page * sizeof(struct pfn_info); + frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK; + + /* Request continuous trunk from boot allocator, since HV + * address is identity mapped */ + p = alloc_boot_pages(frame_table_size, FT_ALIGN_SIZE); + if (p == 0) + panic("Not enough memory for frame table.\n"); + + frame_table = __va(p); + memset(frame_table, 0, frame_table_size); + printk("size of frame_table: %lukB\n", + frame_table_size >> 10); +} +#endif diff --git a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c index eb8e810491..aac3bf8dd8 100644 --- a/xen/arch/ia64/xenmisc.c +++ b/xen/arch/ia64/xenmisc.c @@ -258,6 +258,40 @@ void sys_exit(void) dummy(); } +//////////////////////////////////// +// called from unaligned.c +//////////////////////////////////// + +void die_if_kernel(char *str, struct pt_regs *regs, long err) /* __attribute__ ((noreturn)) */ +{ + printk("die_if_kernel: called, not implemented\n"); +} + +long +ia64_peek (struct task_struct *child, struct switch_stack *child_stack, + unsigned long user_rbs_end, unsigned long addr, long *val) +{ + printk("ia64_peek: called, not implemented\n"); +} + +long +ia64_poke (struct task_struct *child, struct switch_stack *child_stack, + unsigned long user_rbs_end, unsigned long addr, long val) +{ + printk("ia64_poke: called, not implemented\n"); +} + +void +ia64_sync_fph (struct task_struct *task) +{ + printk("ia64_sync_fph: called, not implemented\n"); +} + +void +ia64_flush_fph (struct task_struct *task) +{ + printk("ia64_flush_fph: called, not implemented\n"); +} //////////////////////////////////// // called from irq_ia64.c:init_IRQ() From 8f5b147a50085f77f65f59e1c9150925f0492dee Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Thu, 28 Apr 2005 22:36:45 +0000 Subject: [PATCH 09/36] bitkeeper revision 1.1327.1.12 (4271657dvd6v7i5Y8X39HQ9Fu_LjoQ) Fix more cleanup oops --- .rootkeys | 2 +- xen/arch/ia64/patch/linux-2.6.11/hardirq.h | 14 +++++++++ .../ia64/patch/linux-2.6.11/linuxhardirq.h | 29 ------------------- xen/arch/ia64/tools/mkbuildtree | 9 +++--- 4 files changed, 19 insertions(+), 35 deletions(-) create mode 100644 xen/arch/ia64/patch/linux-2.6.11/hardirq.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h diff --git a/.rootkeys b/.rootkeys index a4177c1adc..09b55726d2 100644 --- a/.rootkeys +++ b/.rootkeys @@ -1084,6 +1084,7 @@ 425ae516maKAsHBJVSzs19cdRgt3Nw xen/arch/ia64/patch/linux-2.6.11/cpumask.h 425ae516cGqvMzGtihTEsQXAXsuOhQ xen/arch/ia64/patch/linux-2.6.11/efi.c 425ae516Y1A4q4_Kfre3qnDj7lbHJg xen/arch/ia64/patch/linux-2.6.11/entry.S +425ae516txAP-owjzpTJ7ThfzWR8nw xen/arch/ia64/patch/linux-2.6.11/hardirq.h 425ae516PDO1ESDHXHVeDNvlqUfmdQ xen/arch/ia64/patch/linux-2.6.11/head.S 425ae516JR7HWvt1zxJ-wLvEWmJGgg xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h 425ae516AHRNmaVuZjJY-9YjmKRDqg xen/arch/ia64/patch/linux-2.6.11/interrupt.h @@ -1092,7 +1093,6 @@ 425ae516qQA5dHuIybqfN3nEzM_Zvg xen/arch/ia64/patch/linux-2.6.11/ivt.S 425ae516atiECmpn_6nZDw4kkmbJ6g xen/arch/ia64/patch/linux-2.6.11/kregs.h 425ae516lwlYwHG1Jv93kC3tfU5caw xen/arch/ia64/patch/linux-2.6.11/lds.S -425ae516txAP-owjzpTJ7ThfzWR8nw xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h 425ae516Je2zI-Iw30_uGhvUYdlCZQ xen/arch/ia64/patch/linux-2.6.11/mca_asm.h 425ae5160-9wHxh0tOnIjavEjt6W0A xen/arch/ia64/patch/linux-2.6.11/minstate.h 425ae516N7SaORdbodDr90tmtCzYXw xen/arch/ia64/patch/linux-2.6.11/mm_contig.c diff --git a/xen/arch/ia64/patch/linux-2.6.11/hardirq.h b/xen/arch/ia64/patch/linux-2.6.11/hardirq.h new file mode 100644 index 0000000000..76b2115d66 --- /dev/null +++ b/xen/arch/ia64/patch/linux-2.6.11/hardirq.h @@ -0,0 +1,14 @@ +--- ../../linux-2.6.11/include/linux/hardirq.h 2005-03-02 00:38:00.000000000 -0700 ++++ include/asm-ia64/linux/hardirq.h 2005-04-28 16:34:39.000000000 -0600 +@@ -60,7 +60,11 @@ + */ + #define in_irq() (hardirq_count()) + #define in_softirq() (softirq_count()) ++#ifndef XEN + #define in_interrupt() (irq_count()) ++#else ++#define in_interrupt() 0 // FIXME LATER ++#endif + + #if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL) + # define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) diff --git a/xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h b/xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h deleted file mode 100644 index 7332588e64..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h +++ /dev/null @@ -1,29 +0,0 @@ - hardirq.h | 6 ++++++ - 1 files changed, 6 insertions(+) - -Index: linux-2.6.11-xendiffs/include/linux/hardirq.h -=================================================================== ---- linux-2.6.11-xendiffs.orig/include/linux/hardirq.h 2005-03-02 01:38:00.000000000 -0600 -+++ linux-2.6.11-xendiffs/include/linux/hardirq.h 2005-03-25 08:49:57.301998663 -0600 -@@ -2,7 +2,9 @@ - #define LINUX_HARDIRQ_H - - #include -+#ifndef XEN - #include -+#endif - #include - #include - -@@ -60,7 +62,11 @@ - */ - #define in_irq() (hardirq_count()) - #define in_softirq() (softirq_count()) -+#ifndef XEN - #define in_interrupt() (irq_count()) -+#else -+#define in_interrupt() 0 // FIXME LATER -+#endif - - #if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL) - # define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 6655fe7b06..104d0852fc 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -90,8 +90,7 @@ cp_patch arch/ia64/kernel/ivt.S arch/ia64/ivt.S ivt.S cp_patch arch/ia64/kernel/setup.c arch/ia64/setup.c setup.c cp_patch arch/ia64/kernel/time.c arch/ia64/time.c time.c cp_patch arch/ia64/kernel/unaligned.c arch/ia64/unaligned.c unaligned.c -#cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S -softlink arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S +cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S #cp_patch mm/bootmem.c arch/ia64/mm_bootmem.c mm_bootmem.c #cp_patch mm/page_alloc.c arch/ia64/page_alloc.c page_alloc.c @@ -174,7 +173,8 @@ cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h softlink include/asm-ia64/current.h include/asm-ia64/current.h #cp_patch include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h gcc_intrin.h softlink include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h -cp_patch include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h hardirq.h +#cp_patch include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h hardirq.h +softlink include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h #cp_patch include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h hw_irq.h softlink include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h #cp_patch include/asm-ia64/ide.h include/asm-ia64/ide.h ide.h @@ -268,8 +268,7 @@ cp_patch include/linux/cpumask.h include/asm-ia64/linux/cpumask.h cpumask.h softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h #cp_patch include/linux/efi.h include/asm-ia64/linux/efi.h efi.h softlink include/linux/efi.h include/asm-ia64/linux/efi.h -#cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h linuxhardirq.h -softlink include/linux/hardirq.h include/asm-ia64/linux/hardirq.h +cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h hardirq.h #cp_patch include/linux/init_task.h include/asm-ia64/linux/init_task.h init_task.h cp_patch include/linux/interrupt.h include/asm-ia64/linux/interrupt.h interrupt.h #cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h From e7bb9ebe8d53e9277ff4f7625c646c7fcdbab70a Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Thu, 28 Apr 2005 22:40:58 +0000 Subject: [PATCH 10/36] bitkeeper revision 1.1327.1.13 (4271667aYkuvJ7WO8DXbP7e0Bldz8g) Another more code cleanup oops --- xen/arch/ia64/tools/mkbuildtree | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 104d0852fc..66b7b4fa0e 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -90,7 +90,8 @@ cp_patch arch/ia64/kernel/ivt.S arch/ia64/ivt.S ivt.S cp_patch arch/ia64/kernel/setup.c arch/ia64/setup.c setup.c cp_patch arch/ia64/kernel/time.c arch/ia64/time.c time.c cp_patch arch/ia64/kernel/unaligned.c arch/ia64/unaligned.c unaligned.c -cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S +#cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S +softlink arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S #cp_patch mm/bootmem.c arch/ia64/mm_bootmem.c mm_bootmem.c #cp_patch mm/page_alloc.c arch/ia64/page_alloc.c page_alloc.c From c1843cc66aaa96739142e2d371cab3adfc03d115 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Fri, 29 Apr 2005 22:09:13 +0000 Subject: [PATCH 11/36] bitkeeper revision 1.1327.1.14 (4272b089iYvr5Anp8Hwey0z6acqlvg) More code cleanup --- .rootkeys | 6 +- xen/arch/ia64/Makefile | 2 +- xen/arch/ia64/ivt.S | 1870 ++++++++++++++++++ xen/arch/ia64/patch/linux-2.6.11/bootmem.h | 17 - xen/arch/ia64/patch/linux-2.6.11/efi.c | 31 +- xen/arch/ia64/patch/linux-2.6.11/entry.S | 191 +- xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h | 31 - xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c | 109 +- xen/arch/ia64/patch/linux-2.6.11/ivt.S | 533 ----- xen/arch/ia64/patch/linux-2.6.11/lds.S | 22 - xen/arch/ia64/tools/mkbuildtree | 7 +- xen/arch/ia64/xenirq.c | 77 + 12 files changed, 2074 insertions(+), 822 deletions(-) create mode 100644 xen/arch/ia64/ivt.S delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/bootmem.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/ivt.S delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/lds.S create mode 100644 xen/arch/ia64/xenirq.c diff --git a/.rootkeys b/.rootkeys index 09b55726d2..7895777148 100644 --- a/.rootkeys +++ b/.rootkeys @@ -1078,21 +1078,18 @@ 4239e98a_HX-FCIcXtVqY0BbrDqVug xen/arch/ia64/hypercall.c 421098b3LYAS8xJkQiGP7tiTlyBt0Q xen/arch/ia64/idle0_task.c 421098b3ys5GAr4z6_H1jD33oem82g xen/arch/ia64/irq.c +4272a8e4lavI6DrTvqaIhXeR5RuKBw xen/arch/ia64/ivt.S 421098b3Heh72KuoVlND3CH6c0B0aA xen/arch/ia64/lib/Makefile 421098b3O0MYMUsmYVFy84VV_1gFwQ xen/arch/ia64/mm_init.c -425ae516skiHBZU-Kfwxv2YWXfNRWQ xen/arch/ia64/patch/linux-2.6.11/bootmem.h 425ae516maKAsHBJVSzs19cdRgt3Nw xen/arch/ia64/patch/linux-2.6.11/cpumask.h 425ae516cGqvMzGtihTEsQXAXsuOhQ xen/arch/ia64/patch/linux-2.6.11/efi.c 425ae516Y1A4q4_Kfre3qnDj7lbHJg xen/arch/ia64/patch/linux-2.6.11/entry.S 425ae516txAP-owjzpTJ7ThfzWR8nw xen/arch/ia64/patch/linux-2.6.11/hardirq.h 425ae516PDO1ESDHXHVeDNvlqUfmdQ xen/arch/ia64/patch/linux-2.6.11/head.S -425ae516JR7HWvt1zxJ-wLvEWmJGgg xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h 425ae516AHRNmaVuZjJY-9YjmKRDqg xen/arch/ia64/patch/linux-2.6.11/interrupt.h 425ae516U2wFUzrUJQUpy3z38jZHsQ xen/arch/ia64/patch/linux-2.6.11/io.h 425ae516GGRmXijPBLC5ii6yWOn0rg xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c -425ae516qQA5dHuIybqfN3nEzM_Zvg xen/arch/ia64/patch/linux-2.6.11/ivt.S 425ae516atiECmpn_6nZDw4kkmbJ6g xen/arch/ia64/patch/linux-2.6.11/kregs.h -425ae516lwlYwHG1Jv93kC3tfU5caw xen/arch/ia64/patch/linux-2.6.11/lds.S 425ae516Je2zI-Iw30_uGhvUYdlCZQ xen/arch/ia64/patch/linux-2.6.11/mca_asm.h 425ae5160-9wHxh0tOnIjavEjt6W0A xen/arch/ia64/patch/linux-2.6.11/minstate.h 425ae516N7SaORdbodDr90tmtCzYXw xen/arch/ia64/patch/linux-2.6.11/mm_contig.c @@ -1168,6 +1165,7 @@ 41a26ebc--sjlYZQxmIxyCx3jw70qA xen/arch/ia64/vcpu.c 421098b6M2WhsJ_ZMzFamAQcdc5gzw xen/arch/ia64/vhpt.c 41a26ebc4jSBGQOuyNIPDST58mNbBw xen/arch/ia64/xenasm.S +4272adaeit9raZ9KnjO_wR4Ii9LJNQ xen/arch/ia64/xenirq.c 427162263zDUiPmTj-lP4eGyXs5eIg xen/arch/ia64/xenmem.c 421098b6mWyFPtkhPz9h1LCmKpoCLg xen/arch/ia64/xenmisc.c 421098b6lY2JzrV1oFDbrt7XQhtElg xen/arch/ia64/xensetup.c diff --git a/xen/arch/ia64/Makefile b/xen/arch/ia64/Makefile index cde36319dc..85d817079a 100644 --- a/xen/arch/ia64/Makefile +++ b/xen/arch/ia64/Makefile @@ -7,7 +7,7 @@ OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \ machvec.o dom0_ops.o domain.o \ idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \ xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \ - extable.o linuxextable.o \ + extable.o linuxextable.o xenirq.o \ regionreg.o entry.o unaligned.o privop.o vcpu.o \ irq_ia64.o irq_lsapic.o vhpt.o xenasm.o dom_fw.o # perfmon.o diff --git a/xen/arch/ia64/ivt.S b/xen/arch/ia64/ivt.S new file mode 100644 index 0000000000..f68e78a834 --- /dev/null +++ b/xen/arch/ia64/ivt.S @@ -0,0 +1,1870 @@ + +#ifdef XEN +//#define CONFIG_DISABLE_VHPT // FIXME: change when VHPT is enabled?? +// these are all hacked out for now as the entire IVT +// will eventually be replaced... just want to use it +// for startup code to handle TLB misses +//#define ia64_leave_kernel 0 +//#define ia64_ret_from_syscall 0 +//#define ia64_handle_irq 0 +//#define ia64_fault 0 +#define ia64_illegal_op_fault 0 +#define ia64_prepare_handle_unaligned 0 +#define ia64_bad_break 0 +#define ia64_trace_syscall 0 +#define sys_call_table 0 +#define sys_ni_syscall 0 +#include +#endif +/* + * arch/ia64/kernel/ivt.S + * + * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co + * Stephane Eranian + * David Mosberger + * Copyright (C) 2000, 2002-2003 Intel Co + * Asit Mallick + * Suresh Siddha + * Kenneth Chen + * Fenghua Yu + * + * 00/08/23 Asit Mallick TLB handling for SMP + * 00/12/20 David Mosberger-Tang DTLB/ITLB handler now uses virtual PT. + */ +/* + * This file defines the interruption vector table used by the CPU. + * It does not include one entry per possible cause of interruption. + * + * The first 20 entries of the table contain 64 bundles each while the + * remaining 48 entries contain only 16 bundles each. + * + * The 64 bundles are used to allow inlining the whole handler for critical + * interruptions like TLB misses. + * + * For each entry, the comment is as follows: + * + * // 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51) + * entry offset ----/ / / / / + * entry number ---------/ / / / + * size of the entry -------------/ / / + * vector name -------------------------------------/ / + * interruptions triggering this vector ----------------------/ + * + * The table is 32KB in size and must be aligned on 32KB boundary. + * (The CPU ignores the 15 lower bits of the address) + * + * Table is based upon EAS2.6 (Oct 1999) + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if 1 +# define PSR_DEFAULT_BITS psr.ac +#else +# define PSR_DEFAULT_BITS 0 +#endif + +#if 0 + /* + * This lets you track the last eight faults that occurred on the CPU. Make sure ar.k2 isn't + * needed for something else before enabling this... + */ +# define DBG_FAULT(i) mov r16=ar.k2;; shl r16=r16,8;; add r16=(i),r16;;mov ar.k2=r16 +#else +# define DBG_FAULT(i) +#endif + +#define MINSTATE_VIRT /* needed by minstate.h */ +#include "minstate.h" + +#define FAULT(n) \ + mov r31=pr; \ + mov r19=n;; /* prepare to save predicates */ \ + br.sptk.many dispatch_to_fault_handler + +#ifdef XEN +#define REFLECT(n) \ + mov r31=pr; \ + mov r19=n;; /* prepare to save predicates */ \ + br.sptk.many dispatch_reflection +#endif + + .section .text.ivt,"ax" + + .align 32768 // align on 32KB boundary + .global ia64_ivt +ia64_ivt: +///////////////////////////////////////////////////////////////////////////////////////// +// 0x0000 Entry 0 (size 64 bundles) VHPT Translation (8,20,47) +ENTRY(vhpt_miss) + DBG_FAULT(0) + /* + * The VHPT vector is invoked when the TLB entry for the virtual page table + * is missing. This happens only as a result of a previous + * (the "original") TLB miss, which may either be caused by an instruction + * fetch or a data access (or non-access). + * + * What we do here is normal TLB miss handing for the _original_ miss, followed + * by inserting the TLB entry for the virtual page table page that the VHPT + * walker was attempting to access. The latter gets inserted as long + * as both L1 and L2 have valid mappings for the faulting address. + * The TLB entry for the original miss gets inserted only if + * the L3 entry indicates that the page is present. + * + * do_page_fault gets invoked in the following cases: + * - the faulting virtual address uses unimplemented address bits + * - the faulting virtual address has no L1, L2, or L3 mapping + */ + mov r16=cr.ifa // get address that caused the TLB miss +#ifdef CONFIG_HUGETLB_PAGE + movl r18=PAGE_SHIFT + mov r25=cr.itir +#endif + ;; + rsm psr.dt // use physical addressing for data + mov r31=pr // save the predicate registers + mov r19=IA64_KR(PT_BASE) // get page table base address + shl r21=r16,3 // shift bit 60 into sign bit + shr.u r17=r16,61 // get the region number into r17 + ;; + shr r22=r21,3 +#ifdef CONFIG_HUGETLB_PAGE + extr.u r26=r25,2,6 + ;; + cmp.ne p8,p0=r18,r26 + sub r27=r26,r18 + ;; +(p8) dep r25=r18,r25,2,6 +(p8) shr r22=r22,r27 +#endif + ;; + cmp.eq p6,p7=5,r17 // is IFA pointing into to region 5? + shr.u r18=r22,PGDIR_SHIFT // get bits 33-63 of the faulting address + ;; +(p7) dep r17=r17,r19,(PAGE_SHIFT-3),3 // put region number bits in place + + srlz.d + LOAD_PHYSICAL(p6, r19, swapper_pg_dir) // region 5 is rooted at swapper_pg_dir + + .pred.rel "mutex", p6, p7 +(p6) shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT +(p7) shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT-3 + ;; +(p6) dep r17=r18,r19,3,(PAGE_SHIFT-3) // r17=PTA + IFA(33,42)*8 +(p7) dep r17=r18,r17,3,(PAGE_SHIFT-6) // r17=PTA + (((IFA(61,63) << 7) | IFA(33,39))*8) + cmp.eq p7,p6=0,r21 // unused address bits all zeroes? + shr.u r18=r22,PMD_SHIFT // shift L2 index into position + ;; + ld8 r17=[r17] // fetch the L1 entry (may be 0) + ;; +(p7) cmp.eq p6,p7=r17,r0 // was L1 entry NULL? + dep r17=r18,r17,3,(PAGE_SHIFT-3) // compute address of L2 page table entry + ;; +(p7) ld8 r20=[r17] // fetch the L2 entry (may be 0) + shr.u r19=r22,PAGE_SHIFT // shift L3 index into position + ;; +(p7) cmp.eq.or.andcm p6,p7=r20,r0 // was L2 entry NULL? + dep r21=r19,r20,3,(PAGE_SHIFT-3) // compute address of L3 page table entry + ;; +(p7) ld8 r18=[r21] // read the L3 PTE + mov r19=cr.isr // cr.isr bit 0 tells us if this is an insn miss + ;; +(p7) tbit.z p6,p7=r18,_PAGE_P_BIT // page present bit cleared? + mov r22=cr.iha // get the VHPT address that caused the TLB miss + ;; // avoid RAW on p7 +(p7) tbit.nz.unc p10,p11=r19,32 // is it an instruction TLB miss? + dep r23=0,r20,0,PAGE_SHIFT // clear low bits to get page address + ;; +(p10) itc.i r18 // insert the instruction TLB entry +(p11) itc.d r18 // insert the data TLB entry +(p6) br.cond.spnt.many page_fault // handle bad address/page not present (page fault) + mov cr.ifa=r22 + +#ifdef CONFIG_HUGETLB_PAGE +(p8) mov cr.itir=r25 // change to default page-size for VHPT +#endif + + /* + * Now compute and insert the TLB entry for the virtual page table. We never + * execute in a page table page so there is no need to set the exception deferral + * bit. + */ + adds r24=__DIRTY_BITS_NO_ED|_PAGE_PL_0|_PAGE_AR_RW,r23 + ;; +(p7) itc.d r24 + ;; +#ifdef CONFIG_SMP + /* + * Tell the assemblers dependency-violation checker that the above "itc" instructions + * cannot possibly affect the following loads: + */ + dv_serialize_data + + /* + * Re-check L2 and L3 pagetable. If they changed, we may have received a ptc.g + * between reading the pagetable and the "itc". If so, flush the entry we + * inserted and retry. + */ + ld8 r25=[r21] // read L3 PTE again + ld8 r26=[r17] // read L2 entry again + ;; + cmp.ne p6,p7=r26,r20 // did L2 entry change + mov r27=PAGE_SHIFT<<2 + ;; +(p6) ptc.l r22,r27 // purge PTE page translation +(p7) cmp.ne.or.andcm p6,p7=r25,r18 // did L3 PTE change + ;; +(p6) ptc.l r16,r27 // purge translation +#endif + + mov pr=r31,-1 // restore predicate registers + rfi +END(vhpt_miss) + + .org ia64_ivt+0x400 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x0400 Entry 1 (size 64 bundles) ITLB (21) +ENTRY(itlb_miss) + DBG_FAULT(1) +#ifdef XEN + VHPT_CCHAIN_LOOKUP(itlb_miss,i) +#ifdef VHPT_GLOBAL + br.cond.sptk page_fault + ;; +#endif +#endif + /* + * The ITLB handler accesses the L3 PTE via the virtually mapped linear + * page table. If a nested TLB miss occurs, we switch into physical + * mode, walk the page table, and then re-execute the L3 PTE read + * and go on normally after that. + */ + mov r16=cr.ifa // get virtual address + mov r29=b0 // save b0 + mov r31=pr // save predicates +.itlb_fault: + mov r17=cr.iha // get virtual address of L3 PTE + movl r30=1f // load nested fault continuation point + ;; +1: ld8 r18=[r17] // read L3 PTE + ;; + mov b0=r29 + tbit.z p6,p0=r18,_PAGE_P_BIT // page present bit cleared? +(p6) br.cond.spnt page_fault + ;; + itc.i r18 + ;; +#ifdef CONFIG_SMP + /* + * Tell the assemblers dependency-violation checker that the above "itc" instructions + * cannot possibly affect the following loads: + */ + dv_serialize_data + + ld8 r19=[r17] // read L3 PTE again and see if same + mov r20=PAGE_SHIFT<<2 // setup page size for purge + ;; + cmp.ne p7,p0=r18,r19 + ;; +(p7) ptc.l r16,r20 +#endif + mov pr=r31,-1 + rfi +END(itlb_miss) + + .org ia64_ivt+0x0800 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x0800 Entry 2 (size 64 bundles) DTLB (9,48) +ENTRY(dtlb_miss) + DBG_FAULT(2) +#ifdef XEN + VHPT_CCHAIN_LOOKUP(dtlb_miss,d) +#ifdef VHPT_GLOBAL + br.cond.sptk page_fault + ;; +#endif +#endif + /* + * The DTLB handler accesses the L3 PTE via the virtually mapped linear + * page table. If a nested TLB miss occurs, we switch into physical + * mode, walk the page table, and then re-execute the L3 PTE read + * and go on normally after that. + */ + mov r16=cr.ifa // get virtual address + mov r29=b0 // save b0 + mov r31=pr // save predicates +dtlb_fault: + mov r17=cr.iha // get virtual address of L3 PTE + movl r30=1f // load nested fault continuation point + ;; +1: ld8 r18=[r17] // read L3 PTE + ;; + mov b0=r29 + tbit.z p6,p0=r18,_PAGE_P_BIT // page present bit cleared? +(p6) br.cond.spnt page_fault + ;; + itc.d r18 + ;; +#ifdef CONFIG_SMP + /* + * Tell the assemblers dependency-violation checker that the above "itc" instructions + * cannot possibly affect the following loads: + */ + dv_serialize_data + + ld8 r19=[r17] // read L3 PTE again and see if same + mov r20=PAGE_SHIFT<<2 // setup page size for purge + ;; + cmp.ne p7,p0=r18,r19 + ;; +(p7) ptc.l r16,r20 +#endif + mov pr=r31,-1 + rfi +END(dtlb_miss) + + .org ia64_ivt+0x0c00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19) +ENTRY(alt_itlb_miss) + DBG_FAULT(3) +#ifdef XEN +//#ifdef VHPT_GLOBAL +// VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i) +// br.cond.sptk page_fault +// ;; +//#endif +#endif + mov r16=cr.ifa // get address that caused the TLB miss + movl r17=PAGE_KERNEL + mov r21=cr.ipsr + movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff) + mov r31=pr + ;; +#ifdef CONFIG_DISABLE_VHPT + shr.u r22=r16,61 // get the region number into r21 + ;; + cmp.gt p8,p0=6,r22 // user mode + ;; +(p8) thash r17=r16 + ;; +(p8) mov cr.iha=r17 +(p8) mov r29=b0 // save b0 +(p8) br.cond.dptk .itlb_fault +#endif + extr.u r23=r21,IA64_PSR_CPL0_BIT,2 // extract psr.cpl + and r19=r19,r16 // clear ed, reserved bits, and PTE control bits + shr.u r18=r16,57 // move address bit 61 to bit 4 + ;; + andcm r18=0x10,r18 // bit 4=~address-bit(61) + cmp.ne p8,p0=r0,r23 // psr.cpl != 0? + or r19=r17,r19 // insert PTE control bits into r19 + ;; + or r19=r19,r18 // set bit 4 (uncached) if the access was to region 6 +(p8) br.cond.spnt page_fault + ;; + itc.i r19 // insert the TLB entry + mov pr=r31,-1 + rfi +END(alt_itlb_miss) + + .org ia64_ivt+0x1000 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46) +ENTRY(alt_dtlb_miss) + DBG_FAULT(4) +#ifdef XEN +//#ifdef VHPT_GLOBAL +// VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d) +// br.cond.sptk page_fault +// ;; +//#endif +#endif + mov r16=cr.ifa // get address that caused the TLB miss + movl r17=PAGE_KERNEL + mov r20=cr.isr + movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff) + mov r21=cr.ipsr + mov r31=pr + ;; +#ifdef CONFIG_DISABLE_VHPT + shr.u r22=r16,61 // get the region number into r21 + ;; + cmp.gt p8,p0=6,r22 // access to region 0-5 + ;; +(p8) thash r17=r16 + ;; +(p8) mov cr.iha=r17 +(p8) mov r29=b0 // save b0 +(p8) br.cond.dptk dtlb_fault +#endif + extr.u r23=r21,IA64_PSR_CPL0_BIT,2 // extract psr.cpl + and r22=IA64_ISR_CODE_MASK,r20 // get the isr.code field + tbit.nz p6,p7=r20,IA64_ISR_SP_BIT // is speculation bit on? + shr.u r18=r16,57 // move address bit 61 to bit 4 + and r19=r19,r16 // clear ed, reserved bits, and PTE control bits + tbit.nz p9,p0=r20,IA64_ISR_NA_BIT // is non-access bit on? + ;; + andcm r18=0x10,r18 // bit 4=~address-bit(61) + cmp.ne p8,p0=r0,r23 +(p9) cmp.eq.or.andcm p6,p7=IA64_ISR_CODE_LFETCH,r22 // check isr.code field +(p8) br.cond.spnt page_fault +#ifdef XEN + ;; + // FIXME: inadequate test, this is where we test for Xen address + // note that 0xf000 (cached) and 0xd000 (uncached) addresses + // should be OK. (Though no I/O is done in Xen, EFI needs uncached + // addresses and some domain EFI calls are passed through) + tbit.nz p0,p8=r16,60 +(p8) br.cond.spnt page_fault +//(p8) br.cond.spnt 0 + ;; +#endif + + dep r21=-1,r21,IA64_PSR_ED_BIT,1 + or r19=r19,r17 // insert PTE control bits into r19 + ;; + or r19=r19,r18 // set bit 4 (uncached) if the access was to region 6 +(p6) mov cr.ipsr=r21 + ;; +(p7) itc.d r19 // insert the TLB entry + mov pr=r31,-1 + rfi +END(alt_dtlb_miss) + + .org ia64_ivt+0x1400 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x1400 Entry 5 (size 64 bundles) Data nested TLB (6,45) +ENTRY(nested_dtlb_miss) + /* + * In the absence of kernel bugs, we get here when the virtually mapped linear + * page table is accessed non-speculatively (e.g., in the Dirty-bit, Instruction + * Access-bit, or Data Access-bit faults). If the DTLB entry for the virtual page + * table is missing, a nested TLB miss fault is triggered and control is + * transferred to this point. When this happens, we lookup the pte for the + * faulting address by walking the page table in physical mode and return to the + * continuation point passed in register r30 (or call page_fault if the address is + * not mapped). + * + * Input: r16: faulting address + * r29: saved b0 + * r30: continuation address + * r31: saved pr + * + * Output: r17: physical address of L3 PTE of faulting address + * r29: saved b0 + * r30: continuation address + * r31: saved pr + * + * Clobbered: b0, r18, r19, r21, psr.dt (cleared) + */ + rsm psr.dt // switch to using physical data addressing + mov r19=IA64_KR(PT_BASE) // get the page table base address + shl r21=r16,3 // shift bit 60 into sign bit + ;; + shr.u r17=r16,61 // get the region number into r17 + ;; + cmp.eq p6,p7=5,r17 // is faulting address in region 5? + shr.u r18=r16,PGDIR_SHIFT // get bits 33-63 of faulting address + ;; +(p7) dep r17=r17,r19,(PAGE_SHIFT-3),3 // put region number bits in place + + srlz.d + LOAD_PHYSICAL(p6, r19, swapper_pg_dir) // region 5 is rooted at swapper_pg_dir + + .pred.rel "mutex", p6, p7 +(p6) shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT +(p7) shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT-3 + ;; +(p6) dep r17=r18,r19,3,(PAGE_SHIFT-3) // r17=PTA + IFA(33,42)*8 +(p7) dep r17=r18,r17,3,(PAGE_SHIFT-6) // r17=PTA + (((IFA(61,63) << 7) | IFA(33,39))*8) + cmp.eq p7,p6=0,r21 // unused address bits all zeroes? + shr.u r18=r16,PMD_SHIFT // shift L2 index into position + ;; + ld8 r17=[r17] // fetch the L1 entry (may be 0) + ;; +(p7) cmp.eq p6,p7=r17,r0 // was L1 entry NULL? + dep r17=r18,r17,3,(PAGE_SHIFT-3) // compute address of L2 page table entry + ;; +(p7) ld8 r17=[r17] // fetch the L2 entry (may be 0) + shr.u r19=r16,PAGE_SHIFT // shift L3 index into position + ;; +(p7) cmp.eq.or.andcm p6,p7=r17,r0 // was L2 entry NULL? + dep r17=r19,r17,3,(PAGE_SHIFT-3) // compute address of L3 page table entry +(p6) br.cond.spnt page_fault + mov b0=r30 + br.sptk.many b0 // return to continuation point +END(nested_dtlb_miss) + + .org ia64_ivt+0x1800 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24) +ENTRY(ikey_miss) +#ifdef XEN + REFLECT(6) +#endif + DBG_FAULT(6) + FAULT(6) +END(ikey_miss) + + //----------------------------------------------------------------------------------- + // call do_page_fault (predicates are in r31, psr.dt may be off, r16 is faulting address) +ENTRY(page_fault) + ssm psr.dt + ;; + srlz.i + ;; + SAVE_MIN_WITH_COVER +#ifdef XEN + alloc r15=ar.pfs,0,0,4,0 + mov out0=cr.ifa + mov out1=cr.isr + mov out3=cr.itir +#else + alloc r15=ar.pfs,0,0,3,0 + mov out0=cr.ifa + mov out1=cr.isr +#endif + adds r3=8,r2 // set up second base pointer + ;; + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collectin is on + ;; +(p15) ssm psr.i // restore psr.i + movl r14=ia64_leave_kernel + ;; + SAVE_REST + mov rp=r14 + ;; + adds out2=16,r12 // out2 = pointer to pt_regs + br.call.sptk.many b6=ia64_do_page_fault // ignore return address +END(page_fault) + + .org ia64_ivt+0x1c00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51) +ENTRY(dkey_miss) +#ifdef XEN + REFLECT(7) +#endif + DBG_FAULT(7) + FAULT(7) +END(dkey_miss) + + .org ia64_ivt+0x2000 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54) +ENTRY(dirty_bit) +#ifdef XEN + REFLECT(8) +#endif + DBG_FAULT(8) + /* + * What we do here is to simply turn on the dirty bit in the PTE. We need to + * update both the page-table and the TLB entry. To efficiently access the PTE, + * we address it through the virtual page table. Most likely, the TLB entry for + * the relevant virtual page table page is still present in the TLB so we can + * normally do this without additional TLB misses. In case the necessary virtual + * page table TLB entry isn't present, we take a nested TLB miss hit where we look + * up the physical address of the L3 PTE and then continue at label 1 below. + */ + mov r16=cr.ifa // get the address that caused the fault + movl r30=1f // load continuation point in case of nested fault + ;; + thash r17=r16 // compute virtual address of L3 PTE + mov r29=b0 // save b0 in case of nested fault + mov r31=pr // save pr +#ifdef CONFIG_SMP + mov r28=ar.ccv // save ar.ccv + ;; +1: ld8 r18=[r17] + ;; // avoid RAW on r18 + mov ar.ccv=r18 // set compare value for cmpxchg + or r25=_PAGE_D|_PAGE_A,r18 // set the dirty and accessed bits + ;; + cmpxchg8.acq r26=[r17],r25,ar.ccv + mov r24=PAGE_SHIFT<<2 + ;; + cmp.eq p6,p7=r26,r18 + ;; +(p6) itc.d r25 // install updated PTE + ;; + /* + * Tell the assemblers dependency-violation checker that the above "itc" instructions + * cannot possibly affect the following loads: + */ + dv_serialize_data + + ld8 r18=[r17] // read PTE again + ;; + cmp.eq p6,p7=r18,r25 // is it same as the newly installed + ;; +(p7) ptc.l r16,r24 + mov b0=r29 // restore b0 + mov ar.ccv=r28 +#else + ;; +1: ld8 r18=[r17] + ;; // avoid RAW on r18 + or r18=_PAGE_D|_PAGE_A,r18 // set the dirty and accessed bits + mov b0=r29 // restore b0 + ;; + st8 [r17]=r18 // store back updated PTE + itc.d r18 // install updated PTE +#endif + mov pr=r31,-1 // restore pr + rfi +END(dirty_bit) + + .org ia64_ivt+0x2400 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27) +ENTRY(iaccess_bit) +#ifdef XEN + REFLECT(9) +#endif + DBG_FAULT(9) + // Like Entry 8, except for instruction access + mov r16=cr.ifa // get the address that caused the fault + movl r30=1f // load continuation point in case of nested fault + mov r31=pr // save predicates +#ifdef CONFIG_ITANIUM + /* + * Erratum 10 (IFA may contain incorrect address) has "NoFix" status. + */ + mov r17=cr.ipsr + ;; + mov r18=cr.iip + tbit.z p6,p0=r17,IA64_PSR_IS_BIT // IA64 instruction set? + ;; +(p6) mov r16=r18 // if so, use cr.iip instead of cr.ifa +#endif /* CONFIG_ITANIUM */ + ;; + thash r17=r16 // compute virtual address of L3 PTE + mov r29=b0 // save b0 in case of nested fault) +#ifdef CONFIG_SMP + mov r28=ar.ccv // save ar.ccv + ;; +1: ld8 r18=[r17] + ;; + mov ar.ccv=r18 // set compare value for cmpxchg + or r25=_PAGE_A,r18 // set the accessed bit + ;; + cmpxchg8.acq r26=[r17],r25,ar.ccv + mov r24=PAGE_SHIFT<<2 + ;; + cmp.eq p6,p7=r26,r18 + ;; +(p6) itc.i r25 // install updated PTE + ;; + /* + * Tell the assemblers dependency-violation checker that the above "itc" instructions + * cannot possibly affect the following loads: + */ + dv_serialize_data + + ld8 r18=[r17] // read PTE again + ;; + cmp.eq p6,p7=r18,r25 // is it same as the newly installed + ;; +(p7) ptc.l r16,r24 + mov b0=r29 // restore b0 + mov ar.ccv=r28 +#else /* !CONFIG_SMP */ + ;; +1: ld8 r18=[r17] + ;; + or r18=_PAGE_A,r18 // set the accessed bit + mov b0=r29 // restore b0 + ;; + st8 [r17]=r18 // store back updated PTE + itc.i r18 // install updated PTE +#endif /* !CONFIG_SMP */ + mov pr=r31,-1 + rfi +END(iaccess_bit) + + .org ia64_ivt+0x2800 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55) +ENTRY(daccess_bit) +#ifdef XEN + REFLECT(10) +#endif + DBG_FAULT(10) + // Like Entry 8, except for data access + mov r16=cr.ifa // get the address that caused the fault + movl r30=1f // load continuation point in case of nested fault + ;; + thash r17=r16 // compute virtual address of L3 PTE + mov r31=pr + mov r29=b0 // save b0 in case of nested fault) +#ifdef CONFIG_SMP + mov r28=ar.ccv // save ar.ccv + ;; +1: ld8 r18=[r17] + ;; // avoid RAW on r18 + mov ar.ccv=r18 // set compare value for cmpxchg + or r25=_PAGE_A,r18 // set the dirty bit + ;; + cmpxchg8.acq r26=[r17],r25,ar.ccv + mov r24=PAGE_SHIFT<<2 + ;; + cmp.eq p6,p7=r26,r18 + ;; +(p6) itc.d r25 // install updated PTE + /* + * Tell the assemblers dependency-violation checker that the above "itc" instructions + * cannot possibly affect the following loads: + */ + dv_serialize_data + ;; + ld8 r18=[r17] // read PTE again + ;; + cmp.eq p6,p7=r18,r25 // is it same as the newly installed + ;; +(p7) ptc.l r16,r24 + mov ar.ccv=r28 +#else + ;; +1: ld8 r18=[r17] + ;; // avoid RAW on r18 + or r18=_PAGE_A,r18 // set the accessed bit + ;; + st8 [r17]=r18 // store back updated PTE + itc.d r18 // install updated PTE +#endif + mov b0=r29 // restore b0 + mov pr=r31,-1 + rfi +END(daccess_bit) + + .org ia64_ivt+0x2c00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x2c00 Entry 11 (size 64 bundles) Break instruction (33) +ENTRY(break_fault) + /* + * The streamlined system call entry/exit paths only save/restore the initial part + * of pt_regs. This implies that the callers of system-calls must adhere to the + * normal procedure calling conventions. + * + * Registers to be saved & restored: + * CR registers: cr.ipsr, cr.iip, cr.ifs + * AR registers: ar.unat, ar.pfs, ar.rsc, ar.rnat, ar.bspstore, ar.fpsr + * others: pr, b0, b6, loadrs, r1, r11, r12, r13, r15 + * Registers to be restored only: + * r8-r11: output value from the system call. + * + * During system call exit, scratch registers (including r15) are modified/cleared + * to prevent leaking bits from kernel to user level. + */ + DBG_FAULT(11) +#ifdef XEN + mov r16=cr.isr + mov r17=cr.iim + mov r31=pr + ;; + cmp.eq p7,p0=r0,r17 // is this a psuedo-cover? + // FIXME: may also need to check slot==2? +(p7) br.sptk.many dispatch_privop_fault + br.sptk.many dispatch_break_fault +#endif + mov r16=IA64_KR(CURRENT) // r16 = current task; 12 cycle read lat. + mov r17=cr.iim + mov r18=__IA64_BREAK_SYSCALL + mov r21=ar.fpsr + mov r29=cr.ipsr + mov r19=b6 + mov r25=ar.unat + mov r27=ar.rsc + mov r26=ar.pfs + mov r28=cr.iip +#ifndef XEN + mov r31=pr // prepare to save predicates +#endif + mov r20=r1 + ;; + adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 + cmp.eq p0,p7=r18,r17 // is this a system call? (p7 <- false, if so) +(p7) br.cond.spnt non_syscall + ;; + ld1 r17=[r16] // load current->thread.on_ustack flag + st1 [r16]=r0 // clear current->thread.on_ustack flag + add r1=-IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 // set r1 for MINSTATE_START_SAVE_MIN_VIRT + ;; + invala + + /* adjust return address so we skip over the break instruction: */ + + extr.u r8=r29,41,2 // extract ei field from cr.ipsr + ;; + cmp.eq p6,p7=2,r8 // isr.ei==2? + mov r2=r1 // setup r2 for ia64_syscall_setup + ;; +(p6) mov r8=0 // clear ei to 0 +(p6) adds r28=16,r28 // switch cr.iip to next bundle cr.ipsr.ei wrapped +(p7) adds r8=1,r8 // increment ei to next slot + ;; + cmp.eq pKStk,pUStk=r0,r17 // are we in kernel mode already? + dep r29=r8,r29,41,2 // insert new ei into cr.ipsr + ;; + + // switch from user to kernel RBS: + MINSTATE_START_SAVE_MIN_VIRT + br.call.sptk.many b7=ia64_syscall_setup + ;; + MINSTATE_END_SAVE_MIN_VIRT // switch to bank 1 + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + mov r3=NR_syscalls - 1 + ;; +(p15) ssm psr.i // restore psr.i + // p10==true means out registers are more than 8 or r15's Nat is true +(p10) br.cond.spnt.many ia64_ret_from_syscall + ;; + movl r16=sys_call_table + + adds r15=-1024,r15 // r15 contains the syscall number---subtract 1024 + movl r2=ia64_ret_from_syscall + ;; + shladd r20=r15,3,r16 // r20 = sys_call_table + 8*(syscall-1024) + cmp.leu p6,p7=r15,r3 // (syscall > 0 && syscall < 1024 + NR_syscalls) ? + mov rp=r2 // set the real return addr + ;; +(p6) ld8 r20=[r20] // load address of syscall entry point +(p7) movl r20=sys_ni_syscall + + add r2=TI_FLAGS+IA64_TASK_SIZE,r13 + ;; + ld4 r2=[r2] // r2 = current_thread_info()->flags + ;; + and r2=_TIF_SYSCALL_TRACEAUDIT,r2 // mask trace or audit + ;; + cmp.eq p8,p0=r2,r0 + mov b6=r20 + ;; +(p8) br.call.sptk.many b6=b6 // ignore this return addr + br.cond.sptk ia64_trace_syscall + // NOT REACHED +END(break_fault) + + .org ia64_ivt+0x3000 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x3000 Entry 12 (size 64 bundles) External Interrupt (4) +ENTRY(interrupt) + DBG_FAULT(12) + mov r31=pr // prepare to save predicates + ;; + SAVE_MIN_WITH_COVER // uses r31; defines r2 and r3 + ssm psr.ic | PSR_DEFAULT_BITS + ;; + adds r3=8,r2 // set up second base pointer for SAVE_REST + srlz.i // ensure everybody knows psr.ic is back on + ;; + SAVE_REST + ;; + alloc r14=ar.pfs,0,0,2,0 // must be first in an insn group + mov out0=cr.ivr // pass cr.ivr as first arg + add out1=16,sp // pass pointer to pt_regs as second arg + ;; + srlz.d // make sure we see the effect of cr.ivr + movl r14=ia64_leave_kernel + ;; + mov rp=r14 + br.call.sptk.many b6=ia64_handle_irq +END(interrupt) + + .org ia64_ivt+0x3400 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x3400 Entry 13 (size 64 bundles) Reserved + DBG_FAULT(13) + FAULT(13) + +#ifdef XEN + // There is no particular reason for this code to be here, other than that + // there happens to be space here that would go unused otherwise. If this + // fault ever gets "unreserved", simply moved the following code to a more + // suitable spot... + +ENTRY(dispatch_break_fault) + SAVE_MIN_WITH_COVER + ;; + alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!) + mov out0=cr.ifa + adds out1=16,sp + mov out2=cr.isr // FIXME: pity to make this slow access twice + mov out3=cr.iim // FIXME: pity to make this slow access twice + + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + ;; +(p15) ssm psr.i // restore psr.i + adds r3=8,r2 // set up second base pointer + ;; + SAVE_REST + movl r14=ia64_leave_kernel + ;; + mov rp=r14 + br.sptk.many ia64_prepare_handle_break +END(dispatch_break_fault) +#endif + + .org ia64_ivt+0x3800 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x3800 Entry 14 (size 64 bundles) Reserved + DBG_FAULT(14) + FAULT(14) + + /* + * There is no particular reason for this code to be here, other than that + * there happens to be space here that would go unused otherwise. If this + * fault ever gets "unreserved", simply moved the following code to a more + * suitable spot... + * + * ia64_syscall_setup() is a separate subroutine so that it can + * allocate stacked registers so it can safely demine any + * potential NaT values from the input registers. + * + * On entry: + * - executing on bank 0 or bank 1 register set (doesn't matter) + * - r1: stack pointer + * - r2: current task pointer + * - r3: preserved + * - r11: original contents (saved ar.pfs to be saved) + * - r12: original contents (sp to be saved) + * - r13: original contents (tp to be saved) + * - r15: original contents (syscall # to be saved) + * - r18: saved bsp (after switching to kernel stack) + * - r19: saved b6 + * - r20: saved r1 (gp) + * - r21: saved ar.fpsr + * - r22: kernel's register backing store base (krbs_base) + * - r23: saved ar.bspstore + * - r24: saved ar.rnat + * - r25: saved ar.unat + * - r26: saved ar.pfs + * - r27: saved ar.rsc + * - r28: saved cr.iip + * - r29: saved cr.ipsr + * - r31: saved pr + * - b0: original contents (to be saved) + * On exit: + * - executing on bank 1 registers + * - psr.ic enabled, interrupts restored + * - p10: TRUE if syscall is invoked with more than 8 out + * registers or r15's Nat is true + * - r1: kernel's gp + * - r3: preserved (same as on entry) + * - r8: -EINVAL if p10 is true + * - r12: points to kernel stack + * - r13: points to current task + * - p15: TRUE if interrupts need to be re-enabled + * - ar.fpsr: set to kernel settings + */ +GLOBAL_ENTRY(ia64_syscall_setup) +#ifndef XEN +#if PT(B6) != 0 +# error This code assumes that b6 is the first field in pt_regs. +#endif +#endif + st8 [r1]=r19 // save b6 + add r16=PT(CR_IPSR),r1 // initialize first base pointer + add r17=PT(R11),r1 // initialize second base pointer + ;; + alloc r19=ar.pfs,8,0,0,0 // ensure in0-in7 are writable + st8 [r16]=r29,PT(AR_PFS)-PT(CR_IPSR) // save cr.ipsr + tnat.nz p8,p0=in0 + + st8.spill [r17]=r11,PT(CR_IIP)-PT(R11) // save r11 + tnat.nz p9,p0=in1 +(pKStk) mov r18=r0 // make sure r18 isn't NaT + ;; + + st8 [r16]=r26,PT(CR_IFS)-PT(AR_PFS) // save ar.pfs + st8 [r17]=r28,PT(AR_UNAT)-PT(CR_IIP) // save cr.iip + mov r28=b0 // save b0 (2 cyc) + ;; + + st8 [r17]=r25,PT(AR_RSC)-PT(AR_UNAT) // save ar.unat + dep r19=0,r19,38,26 // clear all bits but 0..37 [I0] +(p8) mov in0=-1 + ;; + + st8 [r16]=r19,PT(AR_RNAT)-PT(CR_IFS) // store ar.pfs.pfm in cr.ifs + extr.u r11=r19,7,7 // I0 // get sol of ar.pfs + and r8=0x7f,r19 // A // get sof of ar.pfs + + st8 [r17]=r27,PT(AR_BSPSTORE)-PT(AR_RSC)// save ar.rsc + tbit.nz p15,p0=r29,IA64_PSR_I_BIT // I0 +(p9) mov in1=-1 + ;; + +(pUStk) sub r18=r18,r22 // r18=RSE.ndirty*8 + tnat.nz p10,p0=in2 + add r11=8,r11 + ;; +(pKStk) adds r16=PT(PR)-PT(AR_RNAT),r16 // skip over ar_rnat field +(pKStk) adds r17=PT(B0)-PT(AR_BSPSTORE),r17 // skip over ar_bspstore field + tnat.nz p11,p0=in3 + ;; +(p10) mov in2=-1 + tnat.nz p12,p0=in4 // [I0] +(p11) mov in3=-1 + ;; +(pUStk) st8 [r16]=r24,PT(PR)-PT(AR_RNAT) // save ar.rnat +(pUStk) st8 [r17]=r23,PT(B0)-PT(AR_BSPSTORE) // save ar.bspstore + shl r18=r18,16 // compute ar.rsc to be used for "loadrs" + ;; + st8 [r16]=r31,PT(LOADRS)-PT(PR) // save predicates + st8 [r17]=r28,PT(R1)-PT(B0) // save b0 + tnat.nz p13,p0=in5 // [I0] + ;; + st8 [r16]=r18,PT(R12)-PT(LOADRS) // save ar.rsc value for "loadrs" + st8.spill [r17]=r20,PT(R13)-PT(R1) // save original r1 +(p12) mov in4=-1 + ;; + +.mem.offset 0,0; st8.spill [r16]=r12,PT(AR_FPSR)-PT(R12) // save r12 +.mem.offset 8,0; st8.spill [r17]=r13,PT(R15)-PT(R13) // save r13 +(p13) mov in5=-1 + ;; + st8 [r16]=r21,PT(R8)-PT(AR_FPSR) // save ar.fpsr + tnat.nz p14,p0=in6 + cmp.lt p10,p9=r11,r8 // frame size can't be more than local+8 + ;; + stf8 [r16]=f1 // ensure pt_regs.r8 != 0 (see handle_syscall_error) +(p9) tnat.nz p10,p0=r15 + adds r12=-16,r1 // switch to kernel memory stack (with 16 bytes of scratch) + + st8.spill [r17]=r15 // save r15 + tnat.nz p8,p0=in7 + nop.i 0 + + mov r13=r2 // establish `current' + movl r1=__gp // establish kernel global pointer + ;; +(p14) mov in6=-1 +(p8) mov in7=-1 + nop.i 0 + + cmp.eq pSys,pNonSys=r0,r0 // set pSys=1, pNonSys=0 + movl r17=FPSR_DEFAULT + ;; + mov.m ar.fpsr=r17 // set ar.fpsr to kernel default value +(p10) mov r8=-EINVAL + br.ret.sptk.many b7 +END(ia64_syscall_setup) + + .org ia64_ivt+0x3c00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x3c00 Entry 15 (size 64 bundles) Reserved + DBG_FAULT(15) + FAULT(15) + + /* + * Squatting in this space ... + * + * This special case dispatcher for illegal operation faults allows preserved + * registers to be modified through a callback function (asm only) that is handed + * back from the fault handler in r8. Up to three arguments can be passed to the + * callback function by returning an aggregate with the callback as its first + * element, followed by the arguments. + */ +ENTRY(dispatch_illegal_op_fault) + SAVE_MIN_WITH_COVER + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + ;; +(p15) ssm psr.i // restore psr.i + adds r3=8,r2 // set up second base pointer for SAVE_REST + ;; + alloc r14=ar.pfs,0,0,1,0 // must be first in insn group + mov out0=ar.ec + ;; + SAVE_REST + ;; + br.call.sptk.many rp=ia64_illegal_op_fault +.ret0: ;; + alloc r14=ar.pfs,0,0,3,0 // must be first in insn group + mov out0=r9 + mov out1=r10 + mov out2=r11 + movl r15=ia64_leave_kernel + ;; + mov rp=r15 + mov b6=r8 + ;; + cmp.ne p6,p0=0,r8 +(p6) br.call.dpnt.many b6=b6 // call returns to ia64_leave_kernel + br.sptk.many ia64_leave_kernel +END(dispatch_illegal_op_fault) + + .org ia64_ivt+0x4000 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x4000 Entry 16 (size 64 bundles) Reserved + DBG_FAULT(16) + FAULT(16) + +#ifdef XEN + // There is no particular reason for this code to be here, other than that + // there happens to be space here that would go unused otherwise. If this + // fault ever gets "unreserved", simply moved the following code to a more + // suitable spot... + +ENTRY(dispatch_privop_fault) + SAVE_MIN_WITH_COVER + ;; + alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!) + mov out0=cr.ifa + adds out1=16,sp + mov out2=cr.isr // FIXME: pity to make this slow access twice + mov out3=cr.itir + + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + ;; +(p15) ssm psr.i // restore psr.i + adds r3=8,r2 // set up second base pointer + ;; + SAVE_REST + movl r14=ia64_leave_kernel + ;; + mov rp=r14 + br.sptk.many ia64_prepare_handle_privop +END(dispatch_privop_fault) +#endif + + + .org ia64_ivt+0x4400 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x4400 Entry 17 (size 64 bundles) Reserved + DBG_FAULT(17) + FAULT(17) + +ENTRY(non_syscall) + SAVE_MIN_WITH_COVER + + // There is no particular reason for this code to be here, other than that + // there happens to be space here that would go unused otherwise. If this + // fault ever gets "unreserved", simply moved the following code to a more + // suitable spot... + + alloc r14=ar.pfs,0,0,2,0 + mov out0=cr.iim + add out1=16,sp + adds r3=8,r2 // set up second base pointer for SAVE_REST + + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + ;; +(p15) ssm psr.i // restore psr.i + movl r15=ia64_leave_kernel + ;; + SAVE_REST + mov rp=r15 + ;; + br.call.sptk.many b6=ia64_bad_break // avoid WAW on CFM and ignore return addr +END(non_syscall) + + .org ia64_ivt+0x4800 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x4800 Entry 18 (size 64 bundles) Reserved + DBG_FAULT(18) + FAULT(18) + + /* + * There is no particular reason for this code to be here, other than that + * there happens to be space here that would go unused otherwise. If this + * fault ever gets "unreserved", simply moved the following code to a more + * suitable spot... + */ + +ENTRY(dispatch_unaligned_handler) + SAVE_MIN_WITH_COVER + ;; + alloc r14=ar.pfs,0,0,2,0 // now it's safe (must be first in insn group!) + mov out0=cr.ifa + adds out1=16,sp + + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + ;; +(p15) ssm psr.i // restore psr.i + adds r3=8,r2 // set up second base pointer + ;; + SAVE_REST + movl r14=ia64_leave_kernel + ;; + mov rp=r14 + br.sptk.many ia64_prepare_handle_unaligned +END(dispatch_unaligned_handler) + + .org ia64_ivt+0x4c00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x4c00 Entry 19 (size 64 bundles) Reserved + DBG_FAULT(19) + FAULT(19) + + /* + * There is no particular reason for this code to be here, other than that + * there happens to be space here that would go unused otherwise. If this + * fault ever gets "unreserved", simply moved the following code to a more + * suitable spot... + */ + +ENTRY(dispatch_to_fault_handler) + /* + * Input: + * psr.ic: off + * r19: fault vector number (e.g., 24 for General Exception) + * r31: contains saved predicates (pr) + */ + SAVE_MIN_WITH_COVER_R19 + alloc r14=ar.pfs,0,0,5,0 + mov out0=r15 + mov out1=cr.isr + mov out2=cr.ifa + mov out3=cr.iim + mov out4=cr.itir + ;; + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + ;; +(p15) ssm psr.i // restore psr.i + adds r3=8,r2 // set up second base pointer for SAVE_REST + ;; + SAVE_REST + movl r14=ia64_leave_kernel + ;; + mov rp=r14 + br.call.sptk.many b6=ia64_fault +END(dispatch_to_fault_handler) + +// +// --- End of long entries, Beginning of short entries +// + + .org ia64_ivt+0x5000 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5000 Entry 20 (size 16 bundles) Page Not Present (10,22,49) +ENTRY(page_not_present) +#ifdef XEN + REFLECT(20) +#endif + DBG_FAULT(20) + mov r16=cr.ifa + rsm psr.dt + /* + * The Linux page fault handler doesn't expect non-present pages to be in + * the TLB. Flush the existing entry now, so we meet that expectation. + */ + mov r17=PAGE_SHIFT<<2 + ;; + ptc.l r16,r17 + ;; + mov r31=pr + srlz.d + br.sptk.many page_fault +END(page_not_present) + + .org ia64_ivt+0x5100 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5100 Entry 21 (size 16 bundles) Key Permission (13,25,52) +ENTRY(key_permission) +#ifdef XEN + REFLECT(21) +#endif + DBG_FAULT(21) + mov r16=cr.ifa + rsm psr.dt + mov r31=pr + ;; + srlz.d + br.sptk.many page_fault +END(key_permission) + + .org ia64_ivt+0x5200 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26) +ENTRY(iaccess_rights) +#ifdef XEN + REFLECT(22) +#endif + DBG_FAULT(22) + mov r16=cr.ifa + rsm psr.dt + mov r31=pr + ;; + srlz.d + br.sptk.many page_fault +END(iaccess_rights) + + .org ia64_ivt+0x5300 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53) +ENTRY(daccess_rights) +#ifdef XEN + REFLECT(23) +#endif + DBG_FAULT(23) + mov r16=cr.ifa + rsm psr.dt + mov r31=pr + ;; + srlz.d + br.sptk.many page_fault +END(daccess_rights) + + .org ia64_ivt+0x5400 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5400 Entry 24 (size 16 bundles) General Exception (5,32,34,36,38,39) +ENTRY(general_exception) + DBG_FAULT(24) + mov r16=cr.isr + mov r31=pr + ;; +#ifdef XEN + cmp4.ge p6,p0=0x20,r16 +(p6) br.sptk.many dispatch_privop_fault +#else + cmp4.eq p6,p0=0,r16 +(p6) br.sptk.many dispatch_illegal_op_fault +#endif + ;; + mov r19=24 // fault number + br.sptk.many dispatch_to_fault_handler +END(general_exception) + + .org ia64_ivt+0x5500 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35) +ENTRY(disabled_fp_reg) +#ifdef XEN + REFLECT(25) +#endif + DBG_FAULT(25) + rsm psr.dfh // ensure we can access fph + ;; + srlz.d + mov r31=pr + mov r19=25 + br.sptk.many dispatch_to_fault_handler +END(disabled_fp_reg) + + .org ia64_ivt+0x5600 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50) +ENTRY(nat_consumption) +#ifdef XEN + REFLECT(26) +#endif + DBG_FAULT(26) + FAULT(26) +END(nat_consumption) + + .org ia64_ivt+0x5700 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5700 Entry 27 (size 16 bundles) Speculation (40) +ENTRY(speculation_vector) +#ifdef XEN + // this probably need not reflect... + REFLECT(27) +#endif + DBG_FAULT(27) + /* + * A [f]chk.[as] instruction needs to take the branch to the recovery code but + * this part of the architecture is not implemented in hardware on some CPUs, such + * as Itanium. Thus, in general we need to emulate the behavior. IIM contains + * the relative target (not yet sign extended). So after sign extending it we + * simply add it to IIP. We also need to reset the EI field of the IPSR to zero, + * i.e., the slot to restart into. + * + * cr.imm contains zero_ext(imm21) + */ + mov r18=cr.iim + ;; + mov r17=cr.iip + shl r18=r18,43 // put sign bit in position (43=64-21) + ;; + + mov r16=cr.ipsr + shr r18=r18,39 // sign extend (39=43-4) + ;; + + add r17=r17,r18 // now add the offset + ;; + mov cr.iip=r17 + dep r16=0,r16,41,2 // clear EI + ;; + + mov cr.ipsr=r16 + ;; + + rfi // and go back +END(speculation_vector) + + .org ia64_ivt+0x5800 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5800 Entry 28 (size 16 bundles) Reserved + DBG_FAULT(28) + FAULT(28) + + .org ia64_ivt+0x5900 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56) +ENTRY(debug_vector) +#ifdef XEN + REFLECT(29) +#endif + DBG_FAULT(29) + FAULT(29) +END(debug_vector) + + .org ia64_ivt+0x5a00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57) +ENTRY(unaligned_access) +#ifdef XEN + REFLECT(30) +#endif + DBG_FAULT(30) + mov r16=cr.ipsr + mov r31=pr // prepare to save predicates + ;; + br.sptk.many dispatch_unaligned_handler +END(unaligned_access) + + .org ia64_ivt+0x5b00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57) +ENTRY(unsupported_data_reference) +#ifdef XEN + REFLECT(31) +#endif + DBG_FAULT(31) + FAULT(31) +END(unsupported_data_reference) + + .org ia64_ivt+0x5c00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5c00 Entry 32 (size 16 bundles) Floating-Point Fault (64) +ENTRY(floating_point_fault) +#ifdef XEN + REFLECT(32) +#endif + DBG_FAULT(32) + FAULT(32) +END(floating_point_fault) + + .org ia64_ivt+0x5d00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66) +ENTRY(floating_point_trap) +#ifdef XEN + REFLECT(33) +#endif + DBG_FAULT(33) + FAULT(33) +END(floating_point_trap) + + .org ia64_ivt+0x5e00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66) +ENTRY(lower_privilege_trap) +#ifdef XEN + REFLECT(34) +#endif + DBG_FAULT(34) + FAULT(34) +END(lower_privilege_trap) + + .org ia64_ivt+0x5f00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68) +ENTRY(taken_branch_trap) +#ifdef XEN + REFLECT(35) +#endif + DBG_FAULT(35) + FAULT(35) +END(taken_branch_trap) + + .org ia64_ivt+0x6000 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69) +ENTRY(single_step_trap) +#ifdef XEN + REFLECT(36) +#endif + DBG_FAULT(36) + FAULT(36) +END(single_step_trap) + + .org ia64_ivt+0x6100 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6100 Entry 37 (size 16 bundles) Reserved + DBG_FAULT(37) + FAULT(37) + + .org ia64_ivt+0x6200 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6200 Entry 38 (size 16 bundles) Reserved + DBG_FAULT(38) + FAULT(38) + + .org ia64_ivt+0x6300 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6300 Entry 39 (size 16 bundles) Reserved + DBG_FAULT(39) + FAULT(39) + + .org ia64_ivt+0x6400 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6400 Entry 40 (size 16 bundles) Reserved + DBG_FAULT(40) + FAULT(40) + + .org ia64_ivt+0x6500 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6500 Entry 41 (size 16 bundles) Reserved + DBG_FAULT(41) + FAULT(41) + + .org ia64_ivt+0x6600 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6600 Entry 42 (size 16 bundles) Reserved + DBG_FAULT(42) + FAULT(42) + + .org ia64_ivt+0x6700 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6700 Entry 43 (size 16 bundles) Reserved + DBG_FAULT(43) + FAULT(43) + + .org ia64_ivt+0x6800 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6800 Entry 44 (size 16 bundles) Reserved + DBG_FAULT(44) + FAULT(44) + + .org ia64_ivt+0x6900 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6900 Entry 45 (size 16 bundles) IA-32 Exeception (17,18,29,41,42,43,44,58,60,61,62,72,73,75,76,77) +ENTRY(ia32_exception) +#ifdef XEN + REFLECT(45) +#endif + DBG_FAULT(45) + FAULT(45) +END(ia32_exception) + + .org ia64_ivt+0x6a00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept (30,31,59,70,71) +ENTRY(ia32_intercept) +#ifdef XEN + REFLECT(46) +#endif + DBG_FAULT(46) +#ifdef CONFIG_IA32_SUPPORT + mov r31=pr + mov r16=cr.isr + ;; + extr.u r17=r16,16,8 // get ISR.code + mov r18=ar.eflag + mov r19=cr.iim // old eflag value + ;; + cmp.ne p6,p0=2,r17 +(p6) br.cond.spnt 1f // not a system flag fault + xor r16=r18,r19 + ;; + extr.u r17=r16,18,1 // get the eflags.ac bit + ;; + cmp.eq p6,p0=0,r17 +(p6) br.cond.spnt 1f // eflags.ac bit didn't change + ;; + mov pr=r31,-1 // restore predicate registers + rfi + +1: +#endif // CONFIG_IA32_SUPPORT + FAULT(46) +END(ia32_intercept) + + .org ia64_ivt+0x6b00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt (74) +ENTRY(ia32_interrupt) +#ifdef XEN + REFLECT(47) +#endif + DBG_FAULT(47) +#ifdef CONFIG_IA32_SUPPORT + mov r31=pr + br.sptk.many dispatch_to_ia32_handler +#else + FAULT(47) +#endif +END(ia32_interrupt) + + .org ia64_ivt+0x6c00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6c00 Entry 48 (size 16 bundles) Reserved + DBG_FAULT(48) + FAULT(48) + + .org ia64_ivt+0x6d00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6d00 Entry 49 (size 16 bundles) Reserved + DBG_FAULT(49) + FAULT(49) + + .org ia64_ivt+0x6e00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6e00 Entry 50 (size 16 bundles) Reserved + DBG_FAULT(50) + FAULT(50) + + .org ia64_ivt+0x6f00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x6f00 Entry 51 (size 16 bundles) Reserved + DBG_FAULT(51) + FAULT(51) + + .org ia64_ivt+0x7000 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7000 Entry 52 (size 16 bundles) Reserved + DBG_FAULT(52) + FAULT(52) + + .org ia64_ivt+0x7100 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7100 Entry 53 (size 16 bundles) Reserved + DBG_FAULT(53) + FAULT(53) + + .org ia64_ivt+0x7200 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7200 Entry 54 (size 16 bundles) Reserved + DBG_FAULT(54) + FAULT(54) + + .org ia64_ivt+0x7300 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7300 Entry 55 (size 16 bundles) Reserved + DBG_FAULT(55) + FAULT(55) + + .org ia64_ivt+0x7400 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7400 Entry 56 (size 16 bundles) Reserved + DBG_FAULT(56) + FAULT(56) + + .org ia64_ivt+0x7500 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7500 Entry 57 (size 16 bundles) Reserved + DBG_FAULT(57) + FAULT(57) + + .org ia64_ivt+0x7600 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7600 Entry 58 (size 16 bundles) Reserved + DBG_FAULT(58) + FAULT(58) + + .org ia64_ivt+0x7700 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7700 Entry 59 (size 16 bundles) Reserved + DBG_FAULT(59) + FAULT(59) + + .org ia64_ivt+0x7800 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7800 Entry 60 (size 16 bundles) Reserved + DBG_FAULT(60) + FAULT(60) + + .org ia64_ivt+0x7900 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7900 Entry 61 (size 16 bundles) Reserved + DBG_FAULT(61) + FAULT(61) + + .org ia64_ivt+0x7a00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7a00 Entry 62 (size 16 bundles) Reserved + DBG_FAULT(62) + FAULT(62) + + .org ia64_ivt+0x7b00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7b00 Entry 63 (size 16 bundles) Reserved + DBG_FAULT(63) + FAULT(63) + + .org ia64_ivt+0x7c00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7c00 Entry 64 (size 16 bundles) Reserved + DBG_FAULT(64) + FAULT(64) + + .org ia64_ivt+0x7d00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7d00 Entry 65 (size 16 bundles) Reserved + DBG_FAULT(65) + FAULT(65) + + .org ia64_ivt+0x7e00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7e00 Entry 66 (size 16 bundles) Reserved + DBG_FAULT(66) + FAULT(66) + + .org ia64_ivt+0x7f00 +///////////////////////////////////////////////////////////////////////////////////////// +// 0x7f00 Entry 67 (size 16 bundles) Reserved + DBG_FAULT(67) + FAULT(67) + +#ifdef XEN + .org ia64_ivt+0x8000 +ENTRY(dispatch_reflection) + /* + * Input: + * psr.ic: off + * r19: intr type (offset into ivt, see ia64_int.h) + * r31: contains saved predicates (pr) + */ + SAVE_MIN_WITH_COVER_R19 + alloc r14=ar.pfs,0,0,5,0 + mov out4=r15 + mov out0=cr.ifa + adds out1=16,sp + mov out2=cr.isr + mov out3=cr.iim +// mov out3=cr.itir + + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + ;; +(p15) ssm psr.i // restore psr.i + adds r3=8,r2 // set up second base pointer + ;; + SAVE_REST + movl r14=ia64_leave_kernel + ;; + mov rp=r14 + br.sptk.many ia64_prepare_handle_reflection +END(dispatch_reflection) +#endif + +#ifdef CONFIG_IA32_SUPPORT + + /* + * There is no particular reason for this code to be here, other than that + * there happens to be space here that would go unused otherwise. If this + * fault ever gets "unreserved", simply moved the following code to a more + * suitable spot... + */ + + // IA32 interrupt entry point + +ENTRY(dispatch_to_ia32_handler) + SAVE_MIN + ;; + mov r14=cr.isr + ssm psr.ic | PSR_DEFAULT_BITS + ;; + srlz.i // guarantee that interruption collection is on + ;; +(p15) ssm psr.i + adds r3=8,r2 // Base pointer for SAVE_REST + ;; + SAVE_REST + ;; + mov r15=0x80 + shr r14=r14,16 // Get interrupt number + ;; + cmp.ne p6,p0=r14,r15 +(p6) br.call.dpnt.many b6=non_ia32_syscall + + adds r14=IA64_PT_REGS_R8_OFFSET + 16,sp // 16 byte hole per SW conventions + adds r15=IA64_PT_REGS_R1_OFFSET + 16,sp + ;; + cmp.eq pSys,pNonSys=r0,r0 // set pSys=1, pNonSys=0 + ld8 r8=[r14] // get r8 + ;; + st8 [r15]=r8 // save original EAX in r1 (IA32 procs don't use the GP) + ;; + alloc r15=ar.pfs,0,0,6,0 // must first in an insn group + ;; + ld4 r8=[r14],8 // r8 == eax (syscall number) + mov r15=IA32_NR_syscalls + ;; + cmp.ltu.unc p6,p7=r8,r15 + ld4 out1=[r14],8 // r9 == ecx + ;; + ld4 out2=[r14],8 // r10 == edx + ;; + ld4 out0=[r14] // r11 == ebx + adds r14=(IA64_PT_REGS_R13_OFFSET) + 16,sp + ;; + ld4 out5=[r14],PT(R14)-PT(R13) // r13 == ebp + ;; + ld4 out3=[r14],PT(R15)-PT(R14) // r14 == esi + adds r2=TI_FLAGS+IA64_TASK_SIZE,r13 + ;; + ld4 out4=[r14] // r15 == edi + movl r16=ia32_syscall_table + ;; +(p6) shladd r16=r8,3,r16 // force ni_syscall if not valid syscall number + ld4 r2=[r2] // r2 = current_thread_info()->flags + ;; + ld8 r16=[r16] + and r2=_TIF_SYSCALL_TRACEAUDIT,r2 // mask trace or audit + ;; + mov b6=r16 + movl r15=ia32_ret_from_syscall + cmp.eq p8,p0=r2,r0 + ;; + mov rp=r15 +(p8) br.call.sptk.many b6=b6 + br.cond.sptk ia32_trace_syscall + +non_ia32_syscall: + alloc r15=ar.pfs,0,0,2,0 + mov out0=r14 // interrupt # + add out1=16,sp // pointer to pt_regs + ;; // avoid WAW on CFM + br.call.sptk.many rp=ia32_bad_interrupt +.ret1: movl r15=ia64_leave_kernel + ;; + mov rp=r15 + br.ret.sptk.many rp +END(dispatch_to_ia32_handler) + +#endif /* CONFIG_IA32_SUPPORT */ diff --git a/xen/arch/ia64/patch/linux-2.6.11/bootmem.h b/xen/arch/ia64/patch/linux-2.6.11/bootmem.h deleted file mode 100644 index 9a63aa92af..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/bootmem.h +++ /dev/null @@ -1,17 +0,0 @@ - bootmem.h | 2 ++ - 1 files changed, 2 insertions(+) - -Index: linux-2.6.11/include/linux/bootmem.h -=================================================================== ---- linux-2.6.11.orig/include/linux/bootmem.h 2005-03-02 01:38:25.000000000 -0600 -+++ linux-2.6.11/include/linux/bootmem.h 2005-03-19 12:39:36.915887729 -0600 -@@ -41,7 +41,9 @@ extern unsigned long __init init_bootmem - extern void __init free_bootmem (unsigned long addr, unsigned long size); - extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); - #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE -+#ifndef XEN - extern void __init reserve_bootmem (unsigned long addr, unsigned long size); -+#endif - #define alloc_bootmem(x) \ - __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) - #define alloc_bootmem_low(x) \ diff --git a/xen/arch/ia64/patch/linux-2.6.11/efi.c b/xen/arch/ia64/patch/linux-2.6.11/efi.c index 8fb00fa453..11e65f091d 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/efi.c +++ b/xen/arch/ia64/patch/linux-2.6.11/efi.c @@ -1,29 +1,6 @@ - efi.c | 32 ++++++++++++++++++++++++++++++++ - 1 files changed, 32 insertions(+) - -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/efi.c 2005-04-07 12:22:08.230781400 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c 2005-04-07 12:25:11.875195997 -0500 -@@ -25,6 +25,9 @@ - #include - #include - #include -+#ifdef XEN -+#include -+#endif - - #include - #include -@@ -218,6 +221,7 @@ efi_gettimeofday (struct timespec *ts) - if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS) - return; - -+ dummy(); - ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second); - ts->tv_nsec = tm.nanosecond; - } -@@ -320,6 +324,10 @@ efi_memmap_walk (efi_freemem_callback_t +--- ../../linux-2.6.11/arch/ia64/kernel/efi.c 2005-03-02 00:37:47.000000000 -0700 ++++ arch/ia64/efi.c 2005-04-29 14:09:24.000000000 -0600 +@@ -320,6 +320,10 @@ if (!(md->attribute & EFI_MEMORY_WB)) continue; @@ -34,7 +11,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c /* * granule_addr is the base of md's first granule. * [granule_addr - first_non_wb_addr) is guaranteed to -@@ -719,6 +727,30 @@ efi_get_iobase (void) +@@ -719,6 +723,30 @@ return 0; } diff --git a/xen/arch/ia64/patch/linux-2.6.11/entry.S b/xen/arch/ia64/patch/linux-2.6.11/entry.S index 4d88e3d277..19217002a5 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/entry.S +++ b/xen/arch/ia64/patch/linux-2.6.11/entry.S @@ -1,86 +1,34 @@ - entry.S | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 files changed, 85 insertions(+), 1 deletion(-) - -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/entry.S 2005-04-08 13:32:07.636308237 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S 2005-04-08 13:37:04.612542509 -0500 -@@ -35,7 +35,9 @@ - - #include - #include -+#ifndef XEN - #include -+#endif - #include - #include - #include -@@ -46,6 +48,25 @@ +--- ../../linux-2.6.11/arch/ia64/kernel/entry.S 2005-03-02 00:37:50.000000000 -0700 ++++ arch/ia64/entry.S 2005-04-29 14:54:13.000000000 -0600 +@@ -46,6 +46,7 @@ #include "minstate.h" -+#ifdef XEN -+#define sys_execve 0 -+#define do_fork 0 -+#define syscall_trace_enter 0 -+#define syscall_trace_leave 0 -+#define schedule 0 -+#define do_notify_resume_user 0 -+#define ia64_rt_sigsuspend 0 -+#define ia64_rt_sigreturn 0 -+#define ia64_handle_unaligned 0 -+#define errno 0 -+#define sys_ni_syscall 0 -+#define unw_init_frame_info 0 -+#define sys_call_table 0 -+#define do_sigdelayed 0 -+#endif -+ -+ /* -+ ++#ifndef XEN /* * execve() is special because in case of success, we need to * setup a null register window frame. -@@ -187,11 +208,14 @@ GLOBAL_ENTRY(ia64_switch_to) - DO_SAVE_SWITCH_STACK - .body +@@ -174,6 +175,7 @@ + mov rp=loc0 + br.ret.sptk.many rp + END(sys_clone) ++#endif /* !XEN */ -+#ifdef XEN -+//#undef IA64_TASK_THREAD_KSP_OFFSET -+//#define IA64_TASK_THREAD_KSP_OFFSET 0x38 - adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13 + /* + * prev_task <- ia64_switch_to(struct task_struct *next) +@@ -191,7 +193,11 @@ movl r25=init_task mov r27=IA64_KR(CURRENT_STACK) adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0 -- dep r20=0,in0,61,3 // physical address of "next" ++#ifdef XEN + dep r20=0,in0,60,4 // physical address of "next" ++#else + dep r20=0,in0,61,3 // physical address of "next" ++#endif ;; st8 [r22]=sp // save kernel stack pointer of old task shr.u r26=r20,IA64_GRANULE_SHIFT -@@ -203,6 +227,22 @@ GLOBAL_ENTRY(ia64_switch_to) - (p6) cmp.eq p7,p6=r26,r27 - (p6) br.cond.dpnt .map - ;; -+#else -+ adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13 -+ mov r27=IA64_KR(CURRENT_STACK) -+ dep r20=0,in0,61,3 // physical address of "current" -+ ;; -+ st8 [r22]=sp // save kernel stack pointer of old task -+ shr.u r26=r20,IA64_GRANULE_SHIFT -+ adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0 -+ ;; -+ /* -+ * If we've already mapped this task's page, we can skip doing it again. -+ */ -+ cmp.eq p7,p6=r26,r27 -+(p6) br.cond.dpnt .map -+ ;; -+#endif - .done: - (p6) ssm psr.ic // if we had to map, reenable the psr.ic bit FIRST!!! - ;; -@@ -220,6 +260,16 @@ GLOBAL_ENTRY(ia64_switch_to) +@@ -220,6 +226,16 @@ br.ret.sptk.many rp // boogie on out in new context .map: @@ -97,7 +45,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S rsm psr.ic // interrupts (psr.i) are already disabled here movl r25=PAGE_KERNEL ;; -@@ -376,7 +426,11 @@ END(save_switch_stack) +@@ -376,7 +392,11 @@ * - b7 holds address to return to * - must not touch r8-r11 */ @@ -109,7 +57,23 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S .prologue .altrp b7 -@@ -604,6 +658,11 @@ GLOBAL_ENTRY(ia64_ret_from_clone) +@@ -470,6 +490,7 @@ + br.cond.sptk.many b7 + END(load_switch_stack) + ++#ifndef XEN + GLOBAL_ENTRY(__ia64_syscall) + .regstk 6,0,0,0 + mov r15=in5 // put syscall number in place +@@ -588,6 +609,7 @@ + } + .ret4: br.cond.sptk ia64_leave_kernel + END(ia64_strace_leave_kernel) ++#endif + + GLOBAL_ENTRY(ia64_ret_from_clone) + PT_REGS_UNWIND_INFO(0) +@@ -604,6 +626,11 @@ */ br.call.sptk.many rp=ia64_invoke_schedule_tail } @@ -121,7 +85,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S .ret8: adds r2=TI_FLAGS+IA64_TASK_SIZE,r13 ;; -@@ -614,6 +673,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone) +@@ -614,6 +641,7 @@ ;; cmp.ne p6,p0=r2,r0 (p6) br.cond.spnt .strace_check_retval @@ -129,14 +93,11 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S ;; // added stop bits to prevent r8 dependency END(ia64_ret_from_clone) // fall through -@@ -700,9 +760,14 @@ ENTRY(ia64_leave_syscall) +@@ -700,19 +728,25 @@ .work_processed_syscall: adds r2=PT(LOADRS)+16,r12 adds r3=PT(AR_BSPSTORE)+16,r12 -+#ifdef XEN -+ mov r31=r0 -+ ;; -+#else ++#ifndef XEN adds r18=TI_FLAGS+IA64_TASK_SIZE,r13 ;; (p6) ld4 r31=[r18] // load current_thread_info()->flags @@ -144,7 +105,21 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs" mov b7=r0 // clear b7 ;; -@@ -757,7 +822,11 @@ ENTRY(ia64_leave_syscall) + ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE) // load ar.bspstore (may be garbage) + ld8 r18=[r2],PT(R9)-PT(B6) // load b6 ++#ifndef XEN + (p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE? ++#endif + ;; + mov r16=ar.bsp // M2 get existing backing store pointer ++#ifndef XEN + (p6) cmp4.ne.unc p6,p0=r15, r0 // any special work pending? + (p6) br.cond.spnt .work_pending_syscall ++#endif + ;; + // start restoring the state saved on the kernel stack (struct pt_regs): + ld8 r9=[r2],PT(CR_IPSR)-PT(R9) +@@ -757,7 +791,11 @@ ;; ld8.fill r12=[r2] // restore r12 (sp) ld8.fill r15=[r3] // restore r15 @@ -156,7 +131,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S ;; (pUStk) ld4 r3=[r3] // r3 = cpu_data->phys_stacked_size_p8 (pUStk) st1 [r14]=r17 -@@ -814,9 +883,18 @@ GLOBAL_ENTRY(ia64_leave_kernel) +@@ -814,9 +852,18 @@ (pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk #endif .work_processed_kernel: @@ -175,7 +150,17 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S adds r21=PT(PR)+16,r12 ;; -@@ -934,7 +1012,11 @@ GLOBAL_ENTRY(ia64_leave_kernel) +@@ -838,7 +885,9 @@ + ;; + ld8 r29=[r2],16 // load b7 + ld8 r30=[r3],16 // load ar.csd ++#ifndef XEN + (p6) br.cond.spnt .work_pending ++#endif + ;; + ld8 r31=[r2],16 // load ar.ssd + ld8.fill r8=[r3],16 +@@ -934,7 +983,11 @@ shr.u r18=r19,16 // get byte size of existing "dirty" partition ;; mov r16=ar.bsp // get existing backing store pointer @@ -187,15 +172,47 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S ;; ld4 r17=[r17] // r17 = cpu_data->phys_stacked_size_p8 (pKStk) br.cond.dpnt skip_rbs_switch -@@ -1323,6 +1405,7 @@ GLOBAL_ENTRY(unw_init_running) - br.ret.sptk.many rp - END(unw_init_running) +@@ -1069,6 +1122,7 @@ + mov pr=r31,-1 // I0 + rfi // B +#ifndef XEN - .rodata - .align 8 - .globl sys_call_table -@@ -1585,3 +1668,4 @@ sys_call_table: + /* + * On entry: + * r20 = ¤t->thread_info->pre_count (if CONFIG_PREEMPT) +@@ -1130,6 +1184,7 @@ + ld8 r8=[r2] + ld8 r10=[r3] + br.cond.sptk.many .work_processed_syscall // re-check ++#endif + + END(ia64_leave_kernel) + +@@ -1166,6 +1221,7 @@ + br.ret.sptk.many rp + END(ia64_invoke_schedule_tail) + ++#ifndef XEN + /* + * Setup stack and call do_notify_resume_user(). Note that pSys and pNonSys need to + * be set up by the caller. We declare 8 input registers so the system call +@@ -1264,6 +1320,7 @@ + mov ar.unat=r9 + br.many b7 + END(sys_rt_sigreturn) ++#endif + + GLOBAL_ENTRY(ia64_prepare_handle_unaligned) + .prologue +@@ -1278,6 +1335,7 @@ + br.cond.sptk.many rp // goes to ia64_leave_kernel + END(ia64_prepare_handle_unaligned) + ++#ifndef XEN + // + // unw_init_running(void (*callback)(info, arg), void *arg) + // +@@ -1585,3 +1643,4 @@ data8 sys_ni_syscall .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls diff --git a/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h b/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h deleted file mode 100644 index 421644b0f7..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h +++ /dev/null @@ -1,31 +0,0 @@ - hpsim_ssc.h | 19 +++++++++++++++++++ - 1 files changed, 19 insertions(+) - -Index: linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h -=================================================================== ---- linux-2.6.11.orig/arch/ia64/hp/sim/hpsim_ssc.h 2005-03-02 01:38:17.000000000 -0600 -+++ linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h 2005-03-19 13:34:01.705520375 -0600 -@@ -33,4 +33,23 @@ - */ - extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr); - -+#ifdef XEN -+/* Note: These are declared in linux/arch/ia64/hp/sim/simscsi.c but belong -+ * in linux/include/asm-ia64/hpsim_ssc.h, hence their addition here */ -+#define SSC_OPEN 50 -+#define SSC_CLOSE 51 -+#define SSC_READ 52 -+#define SSC_WRITE 53 -+#define SSC_GET_COMPLETION 54 -+#define SSC_WAIT_COMPLETION 55 -+ -+#define SSC_WRITE_ACCESS 2 -+#define SSC_READ_ACCESS 1 -+ -+struct ssc_disk_req { -+ unsigned long addr; -+ unsigned long len; -+}; -+#endif -+ - #endif /* _IA64_PLATFORM_HPSIM_SSC_H */ diff --git a/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c b/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c index f0983646c2..ba2c3bc1e4 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c +++ b/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c @@ -1,111 +1,22 @@ - irq_ia64.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 files changed, 67 insertions(+) - -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/irq_ia64.c -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/irq_ia64.c 2005-04-08 13:30:16.777174938 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/irq_ia64.c 2005-04-08 14:15:47.398616472 -0500 -@@ -17,18 +17,26 @@ - #include - #include - -+#ifndef XEN - #include -+#endif - #include - #include - #include - #include -+#ifndef XEN - #include -+#endif - #include -+#ifndef XEN - #include - #include /* for rand_initialize_irq() */ - #include -+#endif - #include -+#ifndef XEN - #include -+#endif - #include - #include - -@@ -104,6 +112,24 @@ void - ia64_handle_irq (ia64_vector vector, struct pt_regs *regs) - { +--- ../../linux-2.6.11/arch/ia64/kernel/irq_ia64.c 2005-03-02 00:38:07.000000000 -0700 ++++ arch/ia64/irq_ia64.c 2005-04-29 16:05:30.000000000 -0600 +@@ -106,6 +106,9 @@ unsigned long saved_tpr; -+#if 0 -+//FIXME: For debug only, can be removed -+ static char firstirq = 1; -+ static char firsttime[256]; -+ static char firstpend[256]; -+ if (firstirq) { -+ int i; -+ for (i=0;i<256;i++) firsttime[i] = 1; -+ for (i=0;i<256;i++) firstpend[i] = 1; -+ firstirq = 0; -+ } -+ if (firsttime[vector]) { -+ printf("**** (entry) First received int on vector=%d,itc=%lx\n", -+ (unsigned long) vector, ia64_get_itc()); -+ firsttime[vector] = 0; -+ } -+#endif -+ #if IRQ_DEBUG ++#ifdef XEN ++ xen_debug_irq(vector, regs); ++#endif { -@@ -148,6 +174,27 @@ ia64_handle_irq (ia64_vector vector, str + unsigned long bsp, sp; + +@@ -148,6 +151,9 @@ ia64_setreg(_IA64_REG_CR_TPR, vector); ia64_srlz_d(); +#ifdef XEN -+ if (vector != 0xef) { -+ extern void vcpu_pend_interrupt(void *, int); -+#if 0 -+ if (firsttime[vector]) { -+ printf("**** (iterate) First received int on vector=%d,itc=%lx\n", -+ (unsigned long) vector, ia64_get_itc()); -+ firsttime[vector] = 0; -+ } -+ if (firstpend[vector]) { -+ printf("**** First pended int on vector=%d,itc=%lx\n", -+ (unsigned long) vector,ia64_get_itc()); -+ firstpend[vector] = 0; -+ } -+#endif -+ //FIXME: TEMPORARY HACK!!!! -+ vcpu_pend_interrupt(dom0->exec_domain[0],vector); -+ domain_wake(dom0->exec_domain[0]); -+ } -+ else ++ if (!xen_do_IRQ(vector)) +#endif __do_IRQ(local_vector_to_irq(vector), regs); /* -@@ -276,3 +323,23 @@ ia64_send_ipi (int cpu, int vector, int - - writeq(ipi_data, ipi_addr); - } -+ -+/* From linux/kernel/softirq.c */ -+#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED -+# define invoke_softirq() __do_softirq() -+#else -+# define invoke_softirq() do_softirq() -+#endif -+ -+/* -+ * Exit an interrupt context. Process softirqs if needed and possible: -+ */ -+void irq_exit(void) -+{ -+ account_system_vtime(current); -+ sub_preempt_count(IRQ_EXIT_OFFSET); -+ if (!in_interrupt() && local_softirq_pending()) -+ invoke_softirq(); -+ preempt_enable_no_resched(); -+} -+/* end from linux/kernel/softirq.c */ diff --git a/xen/arch/ia64/patch/linux-2.6.11/ivt.S b/xen/arch/ia64/patch/linux-2.6.11/ivt.S deleted file mode 100644 index e8ee4e152e..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/ivt.S +++ /dev/null @@ -1,533 +0,0 @@ - ivt.S | 254 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 files changed, 254 insertions(+) - -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/ivt.S -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/ivt.S 2005-04-07 10:29:00.565766924 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/ivt.S 2005-04-07 10:29:50.923594750 -0500 -@@ -1,3 +1,21 @@ -+ -+#ifdef XEN -+//#define CONFIG_DISABLE_VHPT // FIXME: change when VHPT is enabled?? -+// these are all hacked out for now as the entire IVT -+// will eventually be replaced... just want to use it -+// for startup code to handle TLB misses -+//#define ia64_leave_kernel 0 -+//#define ia64_ret_from_syscall 0 -+//#define ia64_handle_irq 0 -+//#define ia64_fault 0 -+#define ia64_illegal_op_fault 0 -+#define ia64_prepare_handle_unaligned 0 -+#define ia64_bad_break 0 -+#define ia64_trace_syscall 0 -+#define sys_call_table 0 -+#define sys_ni_syscall 0 -+#include -+#endif - /* - * arch/ia64/kernel/ivt.S - * -@@ -77,6 +95,13 @@ - mov r19=n;; /* prepare to save predicates */ \ - br.sptk.many dispatch_to_fault_handler - -+#ifdef XEN -+#define REFLECT(n) \ -+ mov r31=pr; \ -+ mov r19=n;; /* prepare to save predicates */ \ -+ br.sptk.many dispatch_reflection -+#endif -+ - .section .text.ivt,"ax" - - .align 32768 // align on 32KB boundary -@@ -214,6 +239,13 @@ END(vhpt_miss) - // 0x0400 Entry 1 (size 64 bundles) ITLB (21) - ENTRY(itlb_miss) - DBG_FAULT(1) -+#ifdef XEN -+ VHPT_CCHAIN_LOOKUP(itlb_miss,i) -+#ifdef VHPT_GLOBAL -+ br.cond.sptk page_fault -+ ;; -+#endif -+#endif - /* - * The ITLB handler accesses the L3 PTE via the virtually mapped linear - * page table. If a nested TLB miss occurs, we switch into physical -@@ -258,6 +290,13 @@ END(itlb_miss) - // 0x0800 Entry 2 (size 64 bundles) DTLB (9,48) - ENTRY(dtlb_miss) - DBG_FAULT(2) -+#ifdef XEN -+ VHPT_CCHAIN_LOOKUP(dtlb_miss,d) -+#ifdef VHPT_GLOBAL -+ br.cond.sptk page_fault -+ ;; -+#endif -+#endif - /* - * The DTLB handler accesses the L3 PTE via the virtually mapped linear - * page table. If a nested TLB miss occurs, we switch into physical -@@ -302,6 +341,13 @@ END(dtlb_miss) - // 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19) - ENTRY(alt_itlb_miss) - DBG_FAULT(3) -+#ifdef XEN -+//#ifdef VHPT_GLOBAL -+// VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i) -+// br.cond.sptk page_fault -+// ;; -+//#endif -+#endif - mov r16=cr.ifa // get address that caused the TLB miss - movl r17=PAGE_KERNEL - mov r21=cr.ipsr -@@ -340,6 +386,13 @@ END(alt_itlb_miss) - // 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46) - ENTRY(alt_dtlb_miss) - DBG_FAULT(4) -+#ifdef XEN -+//#ifdef VHPT_GLOBAL -+// VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d) -+// br.cond.sptk page_fault -+// ;; -+//#endif -+#endif - mov r16=cr.ifa // get address that caused the TLB miss - movl r17=PAGE_KERNEL - mov r20=cr.isr -@@ -369,6 +422,17 @@ ENTRY(alt_dtlb_miss) - cmp.ne p8,p0=r0,r23 - (p9) cmp.eq.or.andcm p6,p7=IA64_ISR_CODE_LFETCH,r22 // check isr.code field - (p8) br.cond.spnt page_fault -+#ifdef XEN -+ ;; -+ // FIXME: inadequate test, this is where we test for Xen address -+ // note that 0xf000 (cached) and 0xd000 (uncached) addresses -+ // should be OK. (Though no I/O is done in Xen, EFI needs uncached -+ // addresses and some domain EFI calls are passed through) -+ tbit.nz p0,p8=r16,60 -+(p8) br.cond.spnt page_fault -+//(p8) br.cond.spnt 0 -+ ;; -+#endif - - dep r21=-1,r21,IA64_PSR_ED_BIT,1 - or r19=r19,r17 // insert PTE control bits into r19 -@@ -449,6 +513,9 @@ END(nested_dtlb_miss) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24) - ENTRY(ikey_miss) -+#ifdef XEN -+ REFLECT(6) -+#endif - DBG_FAULT(6) - FAULT(6) - END(ikey_miss) -@@ -461,9 +528,16 @@ ENTRY(page_fault) - srlz.i - ;; - SAVE_MIN_WITH_COVER -+#ifdef XEN -+ alloc r15=ar.pfs,0,0,4,0 -+ mov out0=cr.ifa -+ mov out1=cr.isr -+ mov out3=cr.itir -+#else - alloc r15=ar.pfs,0,0,3,0 - mov out0=cr.ifa - mov out1=cr.isr -+#endif - adds r3=8,r2 // set up second base pointer - ;; - ssm psr.ic | PSR_DEFAULT_BITS -@@ -484,6 +558,9 @@ END(page_fault) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51) - ENTRY(dkey_miss) -+#ifdef XEN -+ REFLECT(7) -+#endif - DBG_FAULT(7) - FAULT(7) - END(dkey_miss) -@@ -492,6 +569,9 @@ END(dkey_miss) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54) - ENTRY(dirty_bit) -+#ifdef XEN -+ REFLECT(8) -+#endif - DBG_FAULT(8) - /* - * What we do here is to simply turn on the dirty bit in the PTE. We need to -@@ -554,6 +634,9 @@ END(dirty_bit) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27) - ENTRY(iaccess_bit) -+#ifdef XEN -+ REFLECT(9) -+#endif - DBG_FAULT(9) - // Like Entry 8, except for instruction access - mov r16=cr.ifa // get the address that caused the fault -@@ -619,6 +702,9 @@ END(iaccess_bit) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55) - ENTRY(daccess_bit) -+#ifdef XEN -+ REFLECT(10) -+#endif - DBG_FAULT(10) - // Like Entry 8, except for data access - mov r16=cr.ifa // get the address that caused the fault -@@ -687,6 +773,16 @@ ENTRY(break_fault) - * to prevent leaking bits from kernel to user level. - */ - DBG_FAULT(11) -+#ifdef XEN -+ mov r16=cr.isr -+ mov r17=cr.iim -+ mov r31=pr -+ ;; -+ cmp.eq p7,p0=r0,r17 // is this a psuedo-cover? -+ // FIXME: may also need to check slot==2? -+(p7) br.sptk.many dispatch_privop_fault -+ br.sptk.many dispatch_break_fault -+#endif - mov r16=IA64_KR(CURRENT) // r16 = current task; 12 cycle read lat. - mov r17=cr.iim - mov r18=__IA64_BREAK_SYSCALL -@@ -697,7 +793,9 @@ ENTRY(break_fault) - mov r27=ar.rsc - mov r26=ar.pfs - mov r28=cr.iip -+#ifndef XEN - mov r31=pr // prepare to save predicates -+#endif - mov r20=r1 - ;; - adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 -@@ -797,6 +895,36 @@ END(interrupt) - DBG_FAULT(13) - FAULT(13) - -+#ifdef XEN -+ // There is no particular reason for this code to be here, other than that -+ // there happens to be space here that would go unused otherwise. If this -+ // fault ever gets "unreserved", simply moved the following code to a more -+ // suitable spot... -+ -+ENTRY(dispatch_break_fault) -+ SAVE_MIN_WITH_COVER -+ ;; -+ alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!) -+ mov out0=cr.ifa -+ adds out1=16,sp -+ mov out2=cr.isr // FIXME: pity to make this slow access twice -+ mov out3=cr.iim // FIXME: pity to make this slow access twice -+ -+ ssm psr.ic | PSR_DEFAULT_BITS -+ ;; -+ srlz.i // guarantee that interruption collection is on -+ ;; -+(p15) ssm psr.i // restore psr.i -+ adds r3=8,r2 // set up second base pointer -+ ;; -+ SAVE_REST -+ movl r14=ia64_leave_kernel -+ ;; -+ mov rp=r14 -+ br.sptk.many ia64_prepare_handle_break -+END(dispatch_break_fault) -+#endif -+ - .org ia64_ivt+0x3800 - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x3800 Entry 14 (size 64 bundles) Reserved -@@ -850,9 +978,11 @@ END(interrupt) - * - ar.fpsr: set to kernel settings - */ - GLOBAL_ENTRY(ia64_syscall_setup) -+#ifndef XEN - #if PT(B6) != 0 - # error This code assumes that b6 is the first field in pt_regs. - #endif -+#endif - st8 [r1]=r19 // save b6 - add r16=PT(CR_IPSR),r1 // initialize first base pointer - add r17=PT(R11),r1 // initialize second base pointer -@@ -992,6 +1122,37 @@ END(dispatch_illegal_op_fault) - DBG_FAULT(16) - FAULT(16) - -+#ifdef XEN -+ // There is no particular reason for this code to be here, other than that -+ // there happens to be space here that would go unused otherwise. If this -+ // fault ever gets "unreserved", simply moved the following code to a more -+ // suitable spot... -+ -+ENTRY(dispatch_privop_fault) -+ SAVE_MIN_WITH_COVER -+ ;; -+ alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!) -+ mov out0=cr.ifa -+ adds out1=16,sp -+ mov out2=cr.isr // FIXME: pity to make this slow access twice -+ mov out3=cr.itir -+ -+ ssm psr.ic | PSR_DEFAULT_BITS -+ ;; -+ srlz.i // guarantee that interruption collection is on -+ ;; -+(p15) ssm psr.i // restore psr.i -+ adds r3=8,r2 // set up second base pointer -+ ;; -+ SAVE_REST -+ movl r14=ia64_leave_kernel -+ ;; -+ mov rp=r14 -+ br.sptk.many ia64_prepare_handle_privop -+END(dispatch_privop_fault) -+#endif -+ -+ - .org ia64_ivt+0x4400 - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x4400 Entry 17 (size 64 bundles) Reserved -@@ -1108,6 +1269,9 @@ END(dispatch_to_fault_handler) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5000 Entry 20 (size 16 bundles) Page Not Present (10,22,49) - ENTRY(page_not_present) -+#ifdef XEN -+ REFLECT(20) -+#endif - DBG_FAULT(20) - mov r16=cr.ifa - rsm psr.dt -@@ -1128,6 +1292,9 @@ END(page_not_present) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5100 Entry 21 (size 16 bundles) Key Permission (13,25,52) - ENTRY(key_permission) -+#ifdef XEN -+ REFLECT(21) -+#endif - DBG_FAULT(21) - mov r16=cr.ifa - rsm psr.dt -@@ -1141,6 +1308,9 @@ END(key_permission) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26) - ENTRY(iaccess_rights) -+#ifdef XEN -+ REFLECT(22) -+#endif - DBG_FAULT(22) - mov r16=cr.ifa - rsm psr.dt -@@ -1154,6 +1324,9 @@ END(iaccess_rights) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53) - ENTRY(daccess_rights) -+#ifdef XEN -+ REFLECT(23) -+#endif - DBG_FAULT(23) - mov r16=cr.ifa - rsm psr.dt -@@ -1171,8 +1344,13 @@ ENTRY(general_exception) - mov r16=cr.isr - mov r31=pr - ;; -+#ifdef XEN -+ cmp4.ge p6,p0=0x20,r16 -+(p6) br.sptk.many dispatch_privop_fault -+#else - cmp4.eq p6,p0=0,r16 - (p6) br.sptk.many dispatch_illegal_op_fault -+#endif - ;; - mov r19=24 // fault number - br.sptk.many dispatch_to_fault_handler -@@ -1182,6 +1360,9 @@ END(general_exception) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35) - ENTRY(disabled_fp_reg) -+#ifdef XEN -+ REFLECT(25) -+#endif - DBG_FAULT(25) - rsm psr.dfh // ensure we can access fph - ;; -@@ -1195,6 +1376,9 @@ END(disabled_fp_reg) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50) - ENTRY(nat_consumption) -+#ifdef XEN -+ REFLECT(26) -+#endif - DBG_FAULT(26) - FAULT(26) - END(nat_consumption) -@@ -1203,6 +1387,10 @@ END(nat_consumption) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5700 Entry 27 (size 16 bundles) Speculation (40) - ENTRY(speculation_vector) -+#ifdef XEN -+ // this probably need not reflect... -+ REFLECT(27) -+#endif - DBG_FAULT(27) - /* - * A [f]chk.[as] instruction needs to take the branch to the recovery code but -@@ -1246,6 +1434,9 @@ END(speculation_vector) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56) - ENTRY(debug_vector) -+#ifdef XEN -+ REFLECT(29) -+#endif - DBG_FAULT(29) - FAULT(29) - END(debug_vector) -@@ -1254,6 +1445,9 @@ END(debug_vector) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57) - ENTRY(unaligned_access) -+#ifdef XEN -+ REFLECT(30) -+#endif - DBG_FAULT(30) - mov r16=cr.ipsr - mov r31=pr // prepare to save predicates -@@ -1265,6 +1459,9 @@ END(unaligned_access) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57) - ENTRY(unsupported_data_reference) -+#ifdef XEN -+ REFLECT(31) -+#endif - DBG_FAULT(31) - FAULT(31) - END(unsupported_data_reference) -@@ -1273,6 +1470,9 @@ END(unsupported_data_reference) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5c00 Entry 32 (size 16 bundles) Floating-Point Fault (64) - ENTRY(floating_point_fault) -+#ifdef XEN -+ REFLECT(32) -+#endif - DBG_FAULT(32) - FAULT(32) - END(floating_point_fault) -@@ -1281,6 +1481,9 @@ END(floating_point_fault) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66) - ENTRY(floating_point_trap) -+#ifdef XEN -+ REFLECT(33) -+#endif - DBG_FAULT(33) - FAULT(33) - END(floating_point_trap) -@@ -1289,6 +1492,9 @@ END(floating_point_trap) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66) - ENTRY(lower_privilege_trap) -+#ifdef XEN -+ REFLECT(34) -+#endif - DBG_FAULT(34) - FAULT(34) - END(lower_privilege_trap) -@@ -1297,6 +1503,9 @@ END(lower_privilege_trap) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68) - ENTRY(taken_branch_trap) -+#ifdef XEN -+ REFLECT(35) -+#endif - DBG_FAULT(35) - FAULT(35) - END(taken_branch_trap) -@@ -1305,6 +1514,9 @@ END(taken_branch_trap) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69) - ENTRY(single_step_trap) -+#ifdef XEN -+ REFLECT(36) -+#endif - DBG_FAULT(36) - FAULT(36) - END(single_step_trap) -@@ -1361,6 +1573,9 @@ END(single_step_trap) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x6900 Entry 45 (size 16 bundles) IA-32 Exeception (17,18,29,41,42,43,44,58,60,61,62,72,73,75,76,77) - ENTRY(ia32_exception) -+#ifdef XEN -+ REFLECT(45) -+#endif - DBG_FAULT(45) - FAULT(45) - END(ia32_exception) -@@ -1369,6 +1584,9 @@ END(ia32_exception) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept (30,31,59,70,71) - ENTRY(ia32_intercept) -+#ifdef XEN -+ REFLECT(46) -+#endif - DBG_FAULT(46) - #ifdef CONFIG_IA32_SUPPORT - mov r31=pr -@@ -1399,6 +1617,9 @@ END(ia32_intercept) - ///////////////////////////////////////////////////////////////////////////////////////// - // 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt (74) - ENTRY(ia32_interrupt) -+#ifdef XEN -+ REFLECT(47) -+#endif - DBG_FAULT(47) - #ifdef CONFIG_IA32_SUPPORT - mov r31=pr -@@ -1528,6 +1749,39 @@ END(ia32_interrupt) - DBG_FAULT(67) - FAULT(67) - -+#ifdef XEN -+ .org ia64_ivt+0x8000 -+ENTRY(dispatch_reflection) -+ /* -+ * Input: -+ * psr.ic: off -+ * r19: intr type (offset into ivt, see ia64_int.h) -+ * r31: contains saved predicates (pr) -+ */ -+ SAVE_MIN_WITH_COVER_R19 -+ alloc r14=ar.pfs,0,0,5,0 -+ mov out4=r15 -+ mov out0=cr.ifa -+ adds out1=16,sp -+ mov out2=cr.isr -+ mov out3=cr.iim -+// mov out3=cr.itir -+ -+ ssm psr.ic | PSR_DEFAULT_BITS -+ ;; -+ srlz.i // guarantee that interruption collection is on -+ ;; -+(p15) ssm psr.i // restore psr.i -+ adds r3=8,r2 // set up second base pointer -+ ;; -+ SAVE_REST -+ movl r14=ia64_leave_kernel -+ ;; -+ mov rp=r14 -+ br.sptk.many ia64_prepare_handle_reflection -+END(dispatch_reflection) -+#endif -+ - #ifdef CONFIG_IA32_SUPPORT - - /* diff --git a/xen/arch/ia64/patch/linux-2.6.11/lds.S b/xen/arch/ia64/patch/linux-2.6.11/lds.S deleted file mode 100644 index a2860c40d3..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/lds.S +++ /dev/null @@ -1,22 +0,0 @@ - vmlinux.lds.S | 2 ++ - 1 files changed, 2 insertions(+) - -Index: linux-2.6.11/arch/ia64/kernel/vmlinux.lds.S -=================================================================== ---- linux-2.6.11.orig/arch/ia64/kernel/vmlinux.lds.S 2005-03-02 01:38:25.000000000 -0600 -+++ linux-2.6.11/arch/ia64/kernel/vmlinux.lds.S 2005-03-19 13:44:28.746368232 -0600 -@@ -11,12 +11,14 @@ - OUTPUT_FORMAT("elf64-ia64-little") - OUTPUT_ARCH(ia64) - ENTRY(phys_start) -+#ifndef XEN - jiffies = jiffies_64; - PHDRS { - code PT_LOAD; - percpu PT_LOAD; - data PT_LOAD; - } -+#endif - SECTIONS - { - /* Sections to be discarded */ diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 66b7b4fa0e..998ce2b832 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -85,7 +85,7 @@ cp_patch arch/ia64/kernel/entry.S arch/ia64/entry.S entry.S cp_patch arch/ia64/kernel/head.S arch/ia64/head.S head.S #cp_patch arch/ia64/kernel/init_task.c arch/ia64/init_task.c init_task.c cp_patch arch/ia64/kernel/irq_ia64.c arch/ia64/irq_ia64.c irq_ia64.c -cp_patch arch/ia64/kernel/ivt.S arch/ia64/ivt.S ivt.S +#cp_patch arch/ia64/kernel/ivt.S arch/ia64/ivt.S ivt.S #cp_patch arch/ia64/kernel/minstate.h arch/ia64/minstate.h minstate.h cp_patch arch/ia64/kernel/setup.c arch/ia64/setup.c setup.c cp_patch arch/ia64/kernel/time.c arch/ia64/time.c time.c @@ -317,6 +317,11 @@ null include/asm-ia64/linux/profile.h null include/asm-ia64/linux/seqlock.h null include/asm-ia64/linux/smp_lock.h null include/asm-ia64/linux/tty.h +null include/asm-ia64/linux/jiffies.h +null include/asm-ia64/linux/kernel_stat.h +null include/asm-ia64/linux/ptrace.h +null include/asm-ia64/linux/random.h +null include/asm-ia64/linux/signal.h softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h diff --git a/xen/arch/ia64/xenirq.c b/xen/arch/ia64/xenirq.c new file mode 100644 index 0000000000..8809122751 --- /dev/null +++ b/xen/arch/ia64/xenirq.c @@ -0,0 +1,77 @@ +/* + * Xen irq routines + * + * Copyright (C) 2005 Hewlett-Packard Co. + * Dan Magenheimer (dan.magenheimer@hp.com) + * + */ + +#include +#include + + +void +xen_debug_irq(ia64_vector vector, struct pt_regs *regs) +{ +//FIXME: For debug only, can be removed + static char firstirq = 1; + static char firsttime[256]; + static char firstpend[256]; + if (firstirq) { + int i; + for (i=0;i<256;i++) firsttime[i] = 1; + for (i=0;i<256;i++) firstpend[i] = 1; + firstirq = 0; + } + if (firsttime[vector]) { + printf("**** (entry) First received int on vector=%d,itc=%lx\n", + (unsigned long) vector, ia64_get_itc()); + firsttime[vector] = 0; + } +} + + +int +xen_do_IRQ(ia64_vector vector) +{ + if (vector != 0xef) { + extern void vcpu_pend_interrupt(void *, int); +#if 0 + if (firsttime[vector]) { + printf("**** (iterate) First received int on vector=%d,itc=%lx\n", + (unsigned long) vector, ia64_get_itc()); + firsttime[vector] = 0; + } + if (firstpend[vector]) { + printf("**** First pended int on vector=%d,itc=%lx\n", + (unsigned long) vector,ia64_get_itc()); + firstpend[vector] = 0; + } +#endif + //FIXME: TEMPORARY HACK!!!! + vcpu_pend_interrupt(dom0->exec_domain[0],vector); + domain_wake(dom0->exec_domain[0]); + return(1); + } + return(0); +} + +/* From linux/kernel/softirq.c */ +#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED +# define invoke_softirq() __do_softirq() +#else +# define invoke_softirq() do_softirq() +#endif + +/* + * Exit an interrupt context. Process softirqs if needed and possible: + */ +void irq_exit(void) +{ + //account_system_vtime(current); + //sub_preempt_count(IRQ_EXIT_OFFSET); + if (!in_interrupt() && local_softirq_pending()) + invoke_softirq(); + //preempt_enable_no_resched(); +} +/* end from linux/kernel/softirq.c */ From bba00769209ce4a7727b217b3ffdedd9de947edb Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Fri, 29 Apr 2005 22:14:00 +0000 Subject: [PATCH 12/36] bitkeeper revision 1.1327.1.15 (4272b1a8fCzXHatP1Qs_LnEeeJWW8A) Oops on more code cleanup --- xen/arch/ia64/tools/mkbuildtree | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 998ce2b832..d725659e2d 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -168,7 +168,7 @@ softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h vml # xen/include/asm-ia64 files -cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h +#cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h #cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h softlink include/asm-ia64/current.h include/asm-ia64/current.h @@ -263,7 +263,8 @@ softlink include/asm-ia64/ustack.h include/asm-ia64/ustack.h # xen/include/asm-ia64/linux/*.h (== linux/include/linux/*.h) -cp_patch include/linux/bootmem.h include/asm-ia64/linux/bootmem.h bootmem.h +#cp_patch include/linux/bootmem.h include/asm-ia64/linux/bootmem.h bootmem.h +softlink include/linux/bootmem.h include/asm-ia64/linux/bootmem.h cp_patch include/linux/cpumask.h include/asm-ia64/linux/cpumask.h cpumask.h #cp_patch include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h dma-mapping.h softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h From f61bfaa19194c168fc087b2269837bad6fb44c50 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Fri, 29 Apr 2005 22:25:31 +0000 Subject: [PATCH 13/36] bitkeeper revision 1.1327.1.16 (4272b45boHfzFkRg8miCOTENDrStwg) Oops2 for more code cleanup --- xen/arch/ia64/tools/mkbuildtree | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index d725659e2d..7a69af85a4 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -169,6 +169,7 @@ softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h vml # xen/include/asm-ia64 files #cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h +softlink arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h #cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h softlink include/asm-ia64/current.h include/asm-ia64/current.h @@ -264,7 +265,6 @@ softlink include/asm-ia64/ustack.h include/asm-ia64/ustack.h # xen/include/asm-ia64/linux/*.h (== linux/include/linux/*.h) #cp_patch include/linux/bootmem.h include/asm-ia64/linux/bootmem.h bootmem.h -softlink include/linux/bootmem.h include/asm-ia64/linux/bootmem.h cp_patch include/linux/cpumask.h include/asm-ia64/linux/cpumask.h cpumask.h #cp_patch include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h dma-mapping.h softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h @@ -323,6 +323,7 @@ null include/asm-ia64/linux/kernel_stat.h null include/asm-ia64/linux/ptrace.h null include/asm-ia64/linux/random.h null include/asm-ia64/linux/signal.h +null include/asm-ia64/linux/bootmem.h softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h From d26ce5ce849735eaa8fe1b6e4dd5d66bd7821c9e Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Fri, 29 Apr 2005 22:30:23 +0000 Subject: [PATCH 14/36] bitkeeper revision 1.1327.1.17 (4272b57fwJKUhFtJ5BrqVZ7CEFKwrA) Oops3 for more code cleanup --- .rootkeys | 1 + xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h | 31 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h diff --git a/.rootkeys b/.rootkeys index 7895777148..f24cbca0ed 100644 --- a/.rootkeys +++ b/.rootkeys @@ -1086,6 +1086,7 @@ 425ae516Y1A4q4_Kfre3qnDj7lbHJg xen/arch/ia64/patch/linux-2.6.11/entry.S 425ae516txAP-owjzpTJ7ThfzWR8nw xen/arch/ia64/patch/linux-2.6.11/hardirq.h 425ae516PDO1ESDHXHVeDNvlqUfmdQ xen/arch/ia64/patch/linux-2.6.11/head.S +425ae516JR7HWvt1zxJ-wLvEWmJGgg xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h 425ae516AHRNmaVuZjJY-9YjmKRDqg xen/arch/ia64/patch/linux-2.6.11/interrupt.h 425ae516U2wFUzrUJQUpy3z38jZHsQ xen/arch/ia64/patch/linux-2.6.11/io.h 425ae516GGRmXijPBLC5ii6yWOn0rg xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c diff --git a/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h b/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h new file mode 100644 index 0000000000..421644b0f7 --- /dev/null +++ b/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h @@ -0,0 +1,31 @@ + hpsim_ssc.h | 19 +++++++++++++++++++ + 1 files changed, 19 insertions(+) + +Index: linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h +=================================================================== +--- linux-2.6.11.orig/arch/ia64/hp/sim/hpsim_ssc.h 2005-03-02 01:38:17.000000000 -0600 ++++ linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h 2005-03-19 13:34:01.705520375 -0600 +@@ -33,4 +33,23 @@ + */ + extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr); + ++#ifdef XEN ++/* Note: These are declared in linux/arch/ia64/hp/sim/simscsi.c but belong ++ * in linux/include/asm-ia64/hpsim_ssc.h, hence their addition here */ ++#define SSC_OPEN 50 ++#define SSC_CLOSE 51 ++#define SSC_READ 52 ++#define SSC_WRITE 53 ++#define SSC_GET_COMPLETION 54 ++#define SSC_WAIT_COMPLETION 55 ++ ++#define SSC_WRITE_ACCESS 2 ++#define SSC_READ_ACCESS 1 ++ ++struct ssc_disk_req { ++ unsigned long addr; ++ unsigned long len; ++}; ++#endif ++ + #endif /* _IA64_PLATFORM_HPSIM_SSC_H */ From f142704017d8d39e12225f89906fe3a6cd5c328e Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Fri, 29 Apr 2005 22:31:36 +0000 Subject: [PATCH 15/36] bitkeeper revision 1.1327.1.18 (4272b5c8SnvwX0tHThgOSkWlbYUjvQ) Oops4 for more code cleanup --- xen/arch/ia64/tools/mkbuildtree | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 7a69af85a4..e4bb793899 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -168,8 +168,7 @@ softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h vml # xen/include/asm-ia64 files -#cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h -softlink arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h +cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h #cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h softlink include/asm-ia64/current.h include/asm-ia64/current.h From 6e88ee268dded9c251b085f24e19b4932e457811 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sat, 30 Apr 2005 08:35:33 +0000 Subject: [PATCH 16/36] bitkeeper revision 1.1389.1.14 (427343557mBKHXIKNWB3vC3vSFMQ7g) Fix xc_ptrace for paravirtualized guests. Signed-off-by: Kip Macy --- tools/libxc/xc_ptrace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/libxc/xc_ptrace.c b/tools/libxc/xc_ptrace.c index 4c79d497a7..df05b59d4e 100644 --- a/tools/libxc/xc_ptrace.c +++ b/tools/libxc/xc_ptrace.c @@ -181,7 +181,8 @@ map_domain_va(unsigned long domid, int cpu, void * guest_va, int perm) } if ((pde = cr3_virt[cpu][vtopdi(va)]) == 0) /* logical address */ goto error_out; - pde = page_array[pde >> PAGE_SHIFT] << PAGE_SHIFT; + if (ctxt[cpu].flags & VGCF_VMX_GUEST) + pde = page_array[pde >> PAGE_SHIFT] << PAGE_SHIFT; if (pde != pde_phys[cpu]) { pde_phys[cpu] = pde; @@ -194,7 +195,8 @@ map_domain_va(unsigned long domid, int cpu, void * guest_va, int perm) } if ((page = pde_virt[cpu][vtopti(va)]) == 0) /* logical address */ goto error_out; - page = page_array[page >> PAGE_SHIFT] << PAGE_SHIFT; + if (ctxt[cpu].flags & VGCF_VMX_GUEST) + page = page_array[page >> PAGE_SHIFT] << PAGE_SHIFT; if (page != page_phys[cpu] || perm != prev_perm[cpu]) { page_phys[cpu] = page; From 927084f0d4255ded569bdc51fda5b1279fad9767 Mon Sep 17 00:00:00 2001 From: "arun.sharma@intel.com[kaf24]" Date: Sat, 30 Apr 2005 08:35:58 +0000 Subject: [PATCH 17/36] bitkeeper revision 1.1389.1.15 (4273436eypuqO7C1_MKQjhBV2kylZw) [PATCH] vmx-mach-to-phys.patch VMX domains need to setup their machine to physical maps. Signed-off-by: Arun Sharma --- tools/libxc/xc_vmx_build.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/libxc/xc_vmx_build.c b/tools/libxc/xc_vmx_build.c index 42b546fec6..a89b783fee 100644 --- a/tools/libxc/xc_vmx_build.c +++ b/tools/libxc/xc_vmx_build.c @@ -313,6 +313,16 @@ static int setup_guest(int xc_handle, munmap(vl1tab, PAGE_SIZE); munmap(vl2tab, PAGE_SIZE); + /* Write the machine->phys table entries. */ + for ( count = 0; count < nr_pages; count++ ) + { + if ( add_mmu_update(xc_handle, mmu, + (page_array[count] << PAGE_SHIFT) | + MMU_MACHPHYS_UPDATE, count) ) + goto error_out; + } + + if ((boot_paramsp = xc_map_foreign_range( xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, page_array[(vboot_params_start-dsi.v_start)>>PAGE_SHIFT])) == 0) From b61e6cb4e9f9d9c936ed60b1242c0b746a79d1cc Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk[kaf24]" Date: Sat, 30 Apr 2005 08:45:02 +0000 Subject: [PATCH 18/36] bitkeeper revision 1.1389.1.16 (4273458eyxEjHSppjkQyDsXHHxOY9Q) coredump.patch Extend libxc and gdb server to coredump a domain. Signed-off-by: Kip Macy --- .rootkeys | 3 + .../gdb/gdbserver/Makefile.in | 2 +- .../gdb/gdbserver/linux-xen-low.c | 40 +- .../gdb/gdbserver/server.c | 639 ++++++++++++++++++ tools/libxc/Makefile | 2 + tools/libxc/xc.h | 39 ++ tools/libxc/xc_core.c | 99 +++ tools/libxc/xc_ptrace.c | 9 +- tools/libxc/xc_ptrace_core.c | 287 ++++++++ tools/python/xen/lowlevel/xc/xc.c | 35 + 10 files changed, 1134 insertions(+), 21 deletions(-) create mode 100644 tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c create mode 100644 tools/libxc/xc_core.c create mode 100644 tools/libxc/xc_ptrace_core.c diff --git a/.rootkeys b/.rootkeys index cd12228470..e1444d613a 100644 --- a/.rootkeys +++ b/.rootkeys @@ -550,6 +550,7 @@ 423d3a7b2vJq86I8FbYm6up5BsCwfA tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in 423d3a7bQPownmVb63qOoyq89ebBVA tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv 423d3a7bHtqhyOgiRWhjWt-S-6wbYg tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c +4273458dYPghQKVnj_xu5-fC38CcOg tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c 423d3a7b2ENk2IskDZYZ98pe5NsvIA tools/gdb/gdb-6.2.1-xen-sparse/mkbuildtree 423d3a7buANO_q-kgxIRffUu7lMnUw tools/gdb/gdbbuild 41e2ff6dNPgvIrdIF6dC1azdex1U3A tools/ioemu/Makefile @@ -720,6 +721,7 @@ 3fbba6dc1uU7U3IFeF6A-XEOYF2MkQ tools/libxc/rpm.spec 3fbba6dcrNxtygEcgJYAJJ1gCQqfsA tools/libxc/xc.h 3fbba6dbEVkVMX0JuDFzap9jeaucGA tools/libxc/xc_bvtsched.c +4273458dyF2_sKA6CFkNJQYb8eY2dA tools/libxc/xc_core.c 3fbba6dbasJQV-MVElDC0DGSHMiL5w tools/libxc/xc_domain.c 40278d99BLsfUv3qxv0I8C1sClZ0ow tools/libxc/xc_elf.h 403e0977Bjsm_e82pwvl9VvaJxh8Gg tools/libxc/xc_evtchn.c @@ -735,6 +737,7 @@ 3fbba6dctWRWlFJkYb6hdix2X4WMuw tools/libxc/xc_private.c 3fbba6dcbVrG2hPzEzwdeV_UC8kydQ tools/libxc/xc_private.h 42337174PxyzzPk62raDiYCIsfStDg tools/libxc/xc_ptrace.c +4273458duzL--nsTfT6e_q6Kfij48g tools/libxc/xc_ptrace_core.c 41dde8b0pLfAKMs_L9Uri2hnzHiCRQ tools/libxc/xc_vmx_build.c 40e1b09dMYB4ItGCqcMIzirdMd9I-w tools/libxutil/Makefile 40e033325Sjqs-_4TuzeUEprP_gYFg tools/libxutil/allocate.c diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in b/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in index b6605f6698..93f177387c 100644 --- a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in +++ b/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in @@ -83,7 +83,7 @@ READLINE_DEP = $$(READLINE_DIR) # -I. for config files. # -I${srcdir} for our headers. # -I$(srcdir)/../regformats for regdef.h. -INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR) +INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR) -I../../../../libxc/ -I../../../../libxutil/ # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS # from the config/ directory. diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c b/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c index c5cff23928..0e35f30294 100644 --- a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c +++ b/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c @@ -35,12 +35,11 @@ #include #include #include - +#include #define TRACE_ENTER /* printf("enter %s\n", __FUNCTION__) */ -#define ptrace xc_ptrace -long xc_ptrace(enum __ptrace_request request, ...); +long (*myptrace)(enum __ptrace_request, pid_t, long, long); +int (*myxcwait)(int domain, int *status, int options) ; -int waitdomain(int domain, int *status, int options); #define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */ #define DOMFLAGS_CRASHED (1<<1) /* Crashed domain; frozen for postmortem. */ @@ -61,6 +60,8 @@ static void linux_resume (struct thread_resume *resume_info); int debug_threads; int using_threads; +extern int isfile; + struct pending_signals { int signal; @@ -150,7 +151,7 @@ linux_attach (int domain) { struct process_info *new_process; current_domain = domain; - if (ptrace (PTRACE_ATTACH, domain, 0, 0) != 0) { + if (myptrace (PTRACE_ATTACH, domain, 0, 0) != 0) { fprintf (stderr, "Cannot attach to domain %d: %s (%d)\n", domain, strerror (errno), errno); fflush (stderr); @@ -173,7 +174,7 @@ linux_kill_one_process (struct inferior_list_entry *entry) { struct thread_info *thread = (struct thread_info *) entry; struct process_info *process = get_thread_process (thread); - ptrace (PTRACE_KILL, pid_of (process), 0, 0); + myptrace (PTRACE_KILL, pid_of (process), 0, 0); } @@ -190,7 +191,7 @@ linux_detach_one_process (struct inferior_list_entry *entry) struct thread_info *thread = (struct thread_info *) entry; struct process_info *process = get_thread_process (thread); - ptrace (PTRACE_DETACH, pid_of (process), 0, 0); + myptrace (PTRACE_DETACH, pid_of (process), 0, 0); } @@ -216,8 +217,7 @@ static unsigned char linux_wait (char *status) { int w; - TRACE_ENTER; - if (waitdomain(current_domain, &w, 0)) + if (myxcwait(current_domain, &w, 0)) return -1; if (w & (DOMFLAGS_CRASHED|DOMFLAGS_DYING)) { @@ -242,7 +242,7 @@ linux_resume (struct thread_resume *resume_info) expect_signal = resume_info->sig; for_each_inferior(&all_threads, regcache_invalidate_one); - ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, current_domain, 0, 0); + myptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, current_domain, 0, 0); } @@ -266,7 +266,7 @@ regsets_fetch_inferior_registers () } buf = malloc (regset->size); - res = ptrace (regset->get_request, inferior_pid, 0, buf); + res = myptrace (regset->get_request, inferior_pid, 0, (PTRACE_XFER_TYPE)buf); if (res < 0) { if (errno == EIO) @@ -318,7 +318,7 @@ regsets_store_inferior_registers () buf = malloc (regset->size); regset->fill_function (buf); - res = ptrace (regset->set_request, inferior_pid, 0, buf); + res = myptrace (regset->set_request, inferior_pid, 0, (PTRACE_XFER_TYPE)buf); if (res < 0) { if (errno == EIO) @@ -395,7 +395,7 @@ linux_read_memory (CORE_ADDR memaddr, char *myaddr, int len) for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) { errno = 0; - buffer[i] = ptrace (PTRACE_PEEKTEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0); + buffer[i] = myptrace (PTRACE_PEEKTEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0); if (errno) return errno; } @@ -428,13 +428,13 @@ linux_write_memory (CORE_ADDR memaddr, const char *myaddr, int len) /* Fill start and end extra bytes of buffer with existing memory data. */ - buffer[0] = ptrace (PTRACE_PEEKTEXT, inferior_pid, + buffer[0] = myptrace (PTRACE_PEEKTEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0); if (count > 1) { buffer[count - 1] - = ptrace (PTRACE_PEEKTEXT, inferior_pid, + = myptrace (PTRACE_PEEKTEXT, inferior_pid, (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE)), 0); @@ -448,7 +448,7 @@ linux_write_memory (CORE_ADDR memaddr, const char *myaddr, int len) for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) { errno = 0; - ptrace (PTRACE_POKETEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr, buffer[i]); + myptrace (PTRACE_POKETEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr, buffer[i]); if (errno) return errno; } @@ -545,4 +545,12 @@ initialize_low (void) the_low_target.breakpoint_len); init_registers (); linux_init_signals (); + if (isfile) { + myptrace = xc_ptrace_core; + myxcwait = xc_waitdomain_core; + } else { + myptrace = xc_ptrace; + myxcwait = xc_waitdomain; + } + } diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c b/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c new file mode 100644 index 0000000000..54f508a186 --- /dev/null +++ b/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c @@ -0,0 +1,639 @@ +/* Main code for remote server for GDB. + Copyright 1989, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004 + Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "server.h" + +#include +#include +#include +#include +#include +#include + +int cont_thread; +int general_thread; +int step_thread; +int thread_from_wait; +int old_thread_from_wait; +int extended_protocol; +int server_waiting; +int isfile = 0; + +jmp_buf toplevel; + +/* The PID of the originally created or attached inferior. Used to + send signals to the process when GDB sends us an asynchronous interrupt + (user hitting Control-C in the client), and to wait for the child to exit + when no longer debugging it. */ + +int signal_pid; + +static unsigned char +start_inferior (char *argv[], char *statusptr) +{ + signal (SIGTTOU, SIG_DFL); + signal (SIGTTIN, SIG_DFL); + + signal_pid = create_inferior (argv[0], argv); + + fprintf (stderr, "Process %s created; pid = %d\n", argv[0], + signal_pid); + + signal (SIGTTOU, SIG_IGN); + signal (SIGTTIN, SIG_IGN); + tcsetpgrp (fileno (stderr), signal_pid); + + /* Wait till we are at 1st instruction in program, return signal number. */ + return mywait (statusptr, 0); +} + +static int +attach_inferior (int pid, char *statusptr, unsigned char *sigptr) +{ + /* myattach should return -1 if attaching is unsupported, + 0 if it succeeded, and call error() otherwise. */ + + if (myattach (pid) != 0) + return -1; + + fprintf (stderr, "Attached; pid = %d\n", pid); + + /* FIXME - It may be that we should get the SIGNAL_PID from the + attach function, so that it can be the main thread instead of + whichever we were told to attach to. */ + signal_pid = pid; + + *sigptr = mywait (statusptr, 0); + + return 0; +} + +extern int remote_debug; + +/* Handle all of the extended 'q' packets. */ +void +handle_query (char *own_buf) +{ + static struct inferior_list_entry *thread_ptr; + + if (strcmp ("qSymbol::", own_buf) == 0) + { + if (the_target->look_up_symbols != NULL) + (*the_target->look_up_symbols) (); + + strcpy (own_buf, "OK"); + return; + } + + if (strcmp ("qfThreadInfo", own_buf) == 0) + { + thread_ptr = all_threads.head; + sprintf (own_buf, "m%x", thread_ptr->id); + thread_ptr = thread_ptr->next; + return; + } + + if (strcmp ("qsThreadInfo", own_buf) == 0) + { + if (thread_ptr != NULL) + { + sprintf (own_buf, "m%x", thread_ptr->id); + thread_ptr = thread_ptr->next; + return; + } + else + { + sprintf (own_buf, "l"); + return; + } + } + + if (the_target->read_auxv != NULL + && strncmp ("qPart:auxv:read::", own_buf, 17) == 0) + { + char data[(PBUFSIZ - 1) / 2]; + CORE_ADDR ofs; + unsigned int len; + int n; + decode_m_packet (&own_buf[17], &ofs, &len); /* "OFS,LEN" */ + if (len > sizeof data) + len = sizeof data; + n = (*the_target->read_auxv) (ofs, data, len); + if (n == 0) + write_ok (own_buf); + else if (n < 0) + write_enn (own_buf); + else + convert_int_to_ascii (data, own_buf, n); + return; + } + + /* Otherwise we didn't know what packet it was. Say we didn't + understand it. */ + own_buf[0] = 0; +} + +/* Parse vCont packets. */ +void +handle_v_cont (char *own_buf, char *status, unsigned char *signal) +{ + char *p, *q; + int n = 0, i = 0; + struct thread_resume *resume_info, default_action; + + /* Count the number of semicolons in the packet. There should be one + for every action. */ + p = &own_buf[5]; + while (p) + { + n++; + p++; + p = strchr (p, ';'); + } + /* Allocate room for one extra action, for the default remain-stopped + behavior; if no default action is in the list, we'll need the extra + slot. */ + resume_info = malloc ((n + 1) * sizeof (resume_info[0])); + + default_action.thread = -1; + default_action.leave_stopped = 1; + default_action.step = 0; + default_action.sig = 0; + + p = &own_buf[5]; + i = 0; + while (*p) + { + p++; + + resume_info[i].leave_stopped = 0; + + if (p[0] == 's' || p[0] == 'S') + resume_info[i].step = 1; + else if (p[0] == 'c' || p[0] == 'C') + resume_info[i].step = 0; + else + goto err; + + if (p[0] == 'S' || p[0] == 'C') + { + int sig; + sig = strtol (p + 1, &q, 16); + if (p == q) + goto err; + p = q; + + if (!target_signal_to_host_p (sig)) + goto err; + resume_info[i].sig = target_signal_to_host (sig); + } + else + { + resume_info[i].sig = 0; + p = p + 1; + } + + if (p[0] == 0) + { + resume_info[i].thread = -1; + default_action = resume_info[i]; + + /* Note: we don't increment i here, we'll overwrite this entry + the next time through. */ + } + else if (p[0] == ':') + { + resume_info[i].thread = strtol (p + 1, &q, 16); + if (p == q) + goto err; + p = q; + if (p[0] != ';' && p[0] != 0) + goto err; + + i++; + } + } + + resume_info[i] = default_action; + + /* Still used in occasional places in the backend. */ + if (n == 1 && resume_info[0].thread != -1) + cont_thread = resume_info[0].thread; + else + cont_thread = -1; + set_desired_inferior (0); + + (*the_target->resume) (resume_info); + + free (resume_info); + + *signal = mywait (status, 1); + prepare_resume_reply (own_buf, *status, *signal); + return; + +err: + /* No other way to report an error... */ + strcpy (own_buf, ""); + free (resume_info); + return; +} + +/* Handle all of the extended 'v' packets. */ +void +handle_v_requests (char *own_buf, char *status, unsigned char *signal) +{ + if (strncmp (own_buf, "vCont;", 6) == 0) + { + handle_v_cont (own_buf, status, signal); + return; + } + + if (strncmp (own_buf, "vCont?", 6) == 0) + { + strcpy (own_buf, "vCont;c;C;s;S"); + return; + } + + /* Otherwise we didn't know what packet it was. Say we didn't + understand it. */ + own_buf[0] = 0; + return; +} + +void +myresume (int step, int sig) +{ + struct thread_resume resume_info[2]; + int n = 0; + + if (step || sig || cont_thread > 0) + { + resume_info[0].thread + = ((struct inferior_list_entry *) current_inferior)->id; + resume_info[0].step = step; + resume_info[0].sig = sig; + resume_info[0].leave_stopped = 0; + n++; + } + resume_info[n].thread = -1; + resume_info[n].step = 0; + resume_info[n].sig = 0; + resume_info[n].leave_stopped = (cont_thread > 0); + + (*the_target->resume) (resume_info); +} + +static int attached; + +static void +gdbserver_usage (void) +{ + error ("Usage:\tgdbserver COMM PROG [ARGS ...]\n" + "\tgdbserver COMM --attach PID\n" + "\tgdbserver COMM --file COREFILE\n" + "\n" + "COMM may either be a tty device (for serial debugging), or \n" + "HOST:PORT to listen for a TCP connection.\n"); +} + +int +main (int argc, char *argv[]) +{ + char ch, status, *own_buf, mem_buf[2000]; + int i = 0; + unsigned char signal; + unsigned int len; + CORE_ADDR mem_addr; + int bad_attach; + int pid; + char *arg_end; + + if (setjmp (toplevel)) + { + fprintf (stderr, "Exiting\n"); + exit (1); + } + + bad_attach = 0; + pid = 0; + attached = 0; + if (argc >= 3 && strcmp (argv[2], "--attach") == 0) + { + if (argc == 4 + && argv[3] != '\0' + && (pid = strtoul (argv[3], &arg_end, 10)) != 0 + && *arg_end == '\0') + { + ; + } + else + bad_attach = 1; + } + else if (argc >= 3 && strcmp (argv[2], "--file") == 0) + { + if (argc == 4 + && argv[3] != '\0') + { + if ((pid = open(argv[3], O_RDONLY)) <= 0) + bad_attach = 1; + else + isfile = 1; + } + else + bad_attach = 1; + } + + if (argc < 3 || bad_attach) + gdbserver_usage(); + + initialize_low (); + + own_buf = malloc (PBUFSIZ); + + if (pid == 0) + { + /* Wait till we are at first instruction in program. */ + signal = start_inferior (&argv[2], &status); + + /* We are now stopped at the first instruction of the target process */ + } + else + { + switch (attach_inferior (pid, &status, &signal)) + { + case -1: + error ("Attaching not supported on this target"); + break; + default: + attached = 1; + break; + } + } + + while (1) + { + remote_open (argv[1]); + + restart: + setjmp (toplevel); + while (getpkt (own_buf) > 0) + { + unsigned char sig; + i = 0; + ch = own_buf[i++]; + switch (ch) + { + case 'q': + handle_query (own_buf); + break; + case 'd': + remote_debug = !remote_debug; + break; + case 'D': + fprintf (stderr, "Detaching from inferior\n"); + detach_inferior (); + write_ok (own_buf); + putpkt (own_buf); + remote_close (); + + /* If we are attached, then we can exit. Otherwise, we need to + hang around doing nothing, until the child is gone. */ + if (!attached) + { + int status, ret; + + do { + ret = waitpid (signal_pid, &status, 0); + if (WIFEXITED (status) || WIFSIGNALED (status)) + break; + } while (ret != -1 || errno != ECHILD); + } + + exit (0); + + case '!': + if (attached == 0) + { + extended_protocol = 1; + prepare_resume_reply (own_buf, status, signal); + } + else + { + /* We can not use the extended protocol if we are + attached, because we can not restart the running + program. So return unrecognized. */ + own_buf[0] = '\0'; + } + break; + case '?': + prepare_resume_reply (own_buf, status, signal); + break; + case 'H': + switch (own_buf[1]) + { + case 'g': + general_thread = strtol (&own_buf[2], NULL, 16); + write_ok (own_buf); + set_desired_inferior (1); + break; + case 'c': + cont_thread = strtol (&own_buf[2], NULL, 16); + write_ok (own_buf); + break; + case 's': + step_thread = strtol (&own_buf[2], NULL, 16); + write_ok (own_buf); + break; + default: + /* Silently ignore it so that gdb can extend the protocol + without compatibility headaches. */ + own_buf[0] = '\0'; + break; + } + break; + case 'g': + set_desired_inferior (1); + registers_to_string (own_buf); + break; + case 'G': + set_desired_inferior (1); + registers_from_string (&own_buf[1]); + write_ok (own_buf); + break; + case 'm': + decode_m_packet (&own_buf[1], &mem_addr, &len); + if (read_inferior_memory (mem_addr, mem_buf, len) == 0) + convert_int_to_ascii (mem_buf, own_buf, len); + else + write_enn (own_buf); + break; + case 'M': + decode_M_packet (&own_buf[1], &mem_addr, &len, mem_buf); + if (write_inferior_memory (mem_addr, mem_buf, len) == 0) + write_ok (own_buf); + else + write_enn (own_buf); + break; + case 'C': + convert_ascii_to_int (own_buf + 1, &sig, 1); + if (target_signal_to_host_p (sig)) + signal = target_signal_to_host (sig); + else + signal = 0; + set_desired_inferior (0); + myresume (0, signal); + signal = mywait (&status, 1); + prepare_resume_reply (own_buf, status, signal); + break; + case 'S': + convert_ascii_to_int (own_buf + 1, &sig, 1); + if (target_signal_to_host_p (sig)) + signal = target_signal_to_host (sig); + else + signal = 0; + set_desired_inferior (0); + myresume (1, signal); + signal = mywait (&status, 1); + prepare_resume_reply (own_buf, status, signal); + break; + case 'c': + set_desired_inferior (0); + myresume (0, 0); + signal = mywait (&status, 1); + prepare_resume_reply (own_buf, status, signal); + break; + case 's': + set_desired_inferior (0); + myresume (1, 0); + signal = mywait (&status, 1); + prepare_resume_reply (own_buf, status, signal); + break; + case 'k': + fprintf (stderr, "Killing inferior\n"); + kill_inferior (); + /* When using the extended protocol, we start up a new + debugging session. The traditional protocol will + exit instead. */ + if (extended_protocol) + { + write_ok (own_buf); + fprintf (stderr, "GDBserver restarting\n"); + + /* Wait till we are at 1st instruction in prog. */ + signal = start_inferior (&argv[2], &status); + goto restart; + break; + } + else + { + exit (0); + break; + } + case 'T': + if (mythread_alive (strtol (&own_buf[1], NULL, 16))) + write_ok (own_buf); + else + write_enn (own_buf); + break; + case 'R': + /* Restarting the inferior is only supported in the + extended protocol. */ + if (extended_protocol) + { + kill_inferior (); + write_ok (own_buf); + fprintf (stderr, "GDBserver restarting\n"); + + /* Wait till we are at 1st instruction in prog. */ + signal = start_inferior (&argv[2], &status); + goto restart; + break; + } + else + { + /* It is a request we don't understand. Respond with an + empty packet so that gdb knows that we don't support this + request. */ + own_buf[0] = '\0'; + break; + } + case 'v': + /* Extended (long) request. */ + handle_v_requests (own_buf, &status, &signal); + break; + default: + /* It is a request we don't understand. Respond with an + empty packet so that gdb knows that we don't support this + request. */ + own_buf[0] = '\0'; + break; + } + + putpkt (own_buf); + + if (status == 'W') + fprintf (stderr, + "\nChild exited with status %d\n", signal); + if (status == 'X') + fprintf (stderr, "\nChild terminated with signal = 0x%x\n", + signal); + if (status == 'W' || status == 'X') + { + if (extended_protocol) + { + fprintf (stderr, "Killing inferior\n"); + kill_inferior (); + write_ok (own_buf); + fprintf (stderr, "GDBserver restarting\n"); + + /* Wait till we are at 1st instruction in prog. */ + signal = start_inferior (&argv[2], &status); + goto restart; + break; + } + else + { + fprintf (stderr, "GDBserver exiting\n"); + exit (0); + } + } + } + + /* We come here when getpkt fails. + + For the extended remote protocol we exit (and this is the only + way we gracefully exit!). + + For the traditional remote protocol close the connection, + and re-open it at the top of the loop. */ + if (extended_protocol) + { + remote_close (); + exit (0); + } + else + { + fprintf (stderr, "Remote side has terminated connection. " + "GDBserver will reopen the connection.\n"); + remote_close (); + } + } +} diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index eea5218754..e458444bb0 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -17,6 +17,7 @@ INCLUDES += -I $(XEN_LIBXUTIL) SRCS := SRCS += xc_bvtsched.c +SRCS += xc_core.c SRCS += xc_domain.c SRCS += xc_evtchn.c SRCS += xc_gnttab.c @@ -29,6 +30,7 @@ SRCS += xc_misc.c SRCS += xc_physdev.c SRCS += xc_private.c SRCS += xc_ptrace.c +SRCS += xc_ptrace_core.c SRCS += xc_vmx_build.c CFLAGS += -Wall diff --git a/tools/libxc/xc.h b/tools/libxc/xc.h index 9eac0a7a18..80a3914208 100644 --- a/tools/libxc/xc.h +++ b/tools/libxc/xc.h @@ -20,6 +20,7 @@ typedef int16_t s16; typedef int32_t s32; typedef int64_t s64; +#include #include #include #include @@ -71,6 +72,38 @@ int xc_interface_open(void); */ int xc_interface_close(int xc_handle); +/* + * DOMAIN DEBUGGING FUNCTIONS + */ + +typedef struct xc_core_header { + unsigned int xch_magic; + unsigned int xch_nr_vcpus; + unsigned int xch_nr_pages; + unsigned int xch_ctxt_offset; + unsigned int xch_index_offset; + unsigned int xch_pages_offset; +} xc_core_header_t; + + +long xc_ptrace(enum __ptrace_request request, + pid_t pid, + long addr, + long data); + +long xc_ptrace_core(enum __ptrace_request request, + pid_t pid, + long addr, + long data); + +int xc_waitdomain(int domain, + int *status, + int options); + +int xc_waitdomain_core(int domain, + int *status, + int options); + /* * DOMAIN MANAGEMENT FUNCTIONS */ @@ -94,6 +127,12 @@ int xc_domain_create(int xc_handle, float cpu_weight, u32 *pdomid); + +int xc_domain_dumpcore(int xc_handle, + u32 domid, + const char *corename); + + /** * This function pauses a domain. A paused domain still exists in memory * however it does not receive any timeslices from the hypervisor. diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c new file mode 100644 index 0000000000..84ef16bf37 --- /dev/null +++ b/tools/libxc/xc_core.c @@ -0,0 +1,99 @@ +#include "xc_private.h" +#define ELFSIZE 32 +#include "xc_elf.h" +#include +#include + +/* number of pages to write at a time */ +#define DUMP_INCREMENT 4 * 1024 +#define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) +static int +copy_from_domain_page(int xc_handle, + u32 domid, + unsigned long *page_array, + unsigned long src_pfn, + void *dst_page) +{ + void *vaddr = xc_map_foreign_range( + xc_handle, domid, PAGE_SIZE, PROT_READ, page_array[src_pfn]); + if ( vaddr == NULL ) + return -1; + memcpy(dst_page, vaddr, PAGE_SIZE); + munmap(vaddr, PAGE_SIZE); + return 0; +} + +int +xc_domain_dumpcore(int xc_handle, + u32 domid, + const char *corename) +{ + vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt; + unsigned long nr_pages; + unsigned long *page_array; + xc_domaininfo_t st_info, *info = &st_info; + int i, dump_fd; + char *dump_mem, *dump_mem_start = NULL; + struct xc_core_header header; + + if ((dump_fd = open(corename, O_CREAT|O_RDWR, S_IWUSR|S_IRUSR)) < 0) { + PERROR("Could not open corefile %s: %s", corename, strerror(errno)); + goto error_out; + } + + if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == 0) { + PERROR("Could not allocate dump_mem"); + goto error_out; + } + + if (xc_domain_getfullinfo(xc_handle, domid, 0/* XXX hardcode */, info, ctxt)) { + PERROR("Could not get full info for domain"); + goto error_out; + } + + nr_pages = info->tot_pages; + header.xch_magic = 0xF00FEBED; + header.xch_nr_vcpus = 1; /* no interface to query at the moment */ + header.xch_nr_pages = nr_pages; + header.xch_ctxt_offset = sizeof(struct xc_core_header); + header.xch_index_offset = sizeof(struct xc_core_header) + + sizeof(vcpu_guest_context_t); + header.xch_pages_offset = round_pgup(sizeof(struct xc_core_header) + + sizeof(vcpu_guest_context_t) + nr_pages * sizeof(unsigned long)); + + write(dump_fd, &header, sizeof(struct xc_core_header)); + write(dump_fd, ctxt, sizeof(st_ctxt)); + + if ((page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL) { + printf("Could not allocate memory\n"); + goto error_out; + } + if (xc_get_pfn_list(xc_handle, domid, page_array, nr_pages) != nr_pages) { + printf("Could not get the page frame list\n"); + goto error_out; + } + write(dump_fd, page_array, nr_pages * sizeof(unsigned long)); + lseek(dump_fd, header.xch_pages_offset, SEEK_SET); + for (dump_mem = dump_mem_start, i = 0; i < nr_pages; i++) { + copy_from_domain_page(xc_handle, domid, page_array, i, dump_mem); + dump_mem += PAGE_SIZE; + if (((i + 1) % DUMP_INCREMENT == 0) || (i + 1) == nr_pages) { + if (write(dump_fd, dump_mem_start, dump_mem - dump_mem_start) < + dump_mem - dump_mem_start) { + PERROR("Partial write, file system full?"); + goto error_out; + } + dump_mem = dump_mem_start; + } + } + + close(dump_fd); + free(dump_mem_start); + return 0; + error_out: + if (dump_fd) + close(dump_fd); + if (dump_mem_start) + free(dump_mem_start); + return -1; +} diff --git a/tools/libxc/xc_ptrace.c b/tools/libxc/xc_ptrace.c index df05b59d4e..287680573f 100644 --- a/tools/libxc/xc_ptrace.c +++ b/tools/libxc/xc_ptrace.c @@ -17,8 +17,7 @@ * ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data); */ -long xc_ptrace(enum __ptrace_request request, - pid_t pid, void *addr, void *data); + int waitdomain(int domain, int *status, int options); char * ptrace_names[] = { @@ -218,7 +217,7 @@ map_domain_va(unsigned long domid, int cpu, void * guest_va, int perm) } int -waitdomain(int domain, int *status, int options) +xc_waitdomain(int domain, int *status, int options) { dom0_op_t op; int retval; @@ -260,7 +259,7 @@ waitdomain(int domain, int *status, int options) } long -xc_ptrace(enum __ptrace_request request, pid_t domid, void *addr, void *data) +xc_ptrace(enum __ptrace_request request, pid_t domid, long eaddr, long edata) { dom0_op_t op; int status = 0; @@ -268,6 +267,8 @@ xc_ptrace(enum __ptrace_request request, pid_t domid, void *addr, void *data) long retval = 0; unsigned long *guest_va; int cpu = VCPU; + void *addr = (char *)eaddr; + void *data = (char *)edata; op.interface_version = DOM0_INTERFACE_VERSION; diff --git a/tools/libxc/xc_ptrace_core.c b/tools/libxc/xc_ptrace_core.c new file mode 100644 index 0000000000..87b88edf3d --- /dev/null +++ b/tools/libxc/xc_ptrace_core.c @@ -0,0 +1,287 @@ +#include +#include +#include "xc_private.h" +#include +#include + + +#define BSD_PAGE_MASK (PAGE_SIZE-1) +#define PG_FRAME (~((unsigned long)BSD_PAGE_MASK) +#define PDRSHIFT 22 +#define PSL_T 0x00000100 /* trace enable bit */ + +#define VCPU 0 /* XXX */ + +/* + * long + * ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data); + */ + + +struct gdb_regs { + long ebx; /* 0 */ + long ecx; /* 4 */ + long edx; /* 8 */ + long esi; /* 12 */ + long edi; /* 16 */ + long ebp; /* 20 */ + long eax; /* 24 */ + int xds; /* 28 */ + int xes; /* 32 */ + int xfs; /* 36 */ + int xgs; /* 40 */ + long orig_eax; /* 44 */ + long eip; /* 48 */ + int xcs; /* 52 */ + long eflags; /* 56 */ + long esp; /* 60 */ + int xss; /* 64 */ +}; + +#define printval(x) printf("%s = %lx\n", #x, (long)x); +#define SET_PT_REGS(pt, xc) \ +{ \ + pt.ebx = xc.ebx; \ + pt.ecx = xc.ecx; \ + pt.edx = xc.edx; \ + pt.esi = xc.esi; \ + pt.edi = xc.edi; \ + pt.ebp = xc.ebp; \ + pt.eax = xc.eax; \ + pt.eip = xc.eip; \ + pt.xcs = xc.cs; \ + pt.eflags = xc.eflags; \ + pt.esp = xc.esp; \ + pt.xss = xc.ss; \ + pt.xes = xc.es; \ + pt.xds = xc.ds; \ + pt.xfs = xc.fs; \ + pt.xgs = xc.gs; \ +} + +#define SET_XC_REGS(pt, xc) \ +{ \ + xc.ebx = pt->ebx; \ + xc.ecx = pt->ecx; \ + xc.edx = pt->edx; \ + xc.esi = pt->esi; \ + xc.edi = pt->edi; \ + xc.ebp = pt->ebp; \ + xc.eax = pt->eax; \ + xc.eip = pt->eip; \ + xc.cs = pt->xcs; \ + xc.eflags = pt->eflags; \ + xc.esp = pt->esp; \ + xc.ss = pt->xss; \ + xc.es = pt->xes; \ + xc.ds = pt->xds; \ + xc.fs = pt->xfs; \ + xc.gs = pt->xgs; \ +} + + +#define vtopdi(va) ((va) >> PDRSHIFT) +#define vtopti(va) (((va) >> PAGE_SHIFT) & 0x3ff) + +/* XXX application state */ + + +static long nr_pages = 0; +static unsigned long *p2m_array = NULL; +static unsigned long *m2p_array = NULL; +static unsigned long pages_offset; +static unsigned long cr3[MAX_VIRT_CPUS]; +static vcpu_guest_context_t ctxt[MAX_VIRT_CPUS]; + +/* --------------------- */ + +static unsigned long +map_mtop_offset(unsigned long ma) +{ + return pages_offset + (m2p_array[ma >> PAGE_SHIFT] << PAGE_SHIFT); +} + + +static void * +map_domain_va(unsigned long domfd, int cpu, void * guest_va) +{ + unsigned long pde, page; + unsigned long va = (unsigned long)guest_va; + + static unsigned long cr3_phys[MAX_VIRT_CPUS]; + static unsigned long *cr3_virt[MAX_VIRT_CPUS]; + static unsigned long pde_phys[MAX_VIRT_CPUS]; + static unsigned long *pde_virt[MAX_VIRT_CPUS]; + static unsigned long page_phys[MAX_VIRT_CPUS]; + static unsigned long *page_virt[MAX_VIRT_CPUS]; + + if (cr3[cpu] != cr3_phys[cpu]) + { + cr3_phys[cpu] = cr3[cpu]; + if (cr3_virt[cpu]) + munmap(cr3_virt[cpu], PAGE_SIZE); + if ((cr3_virt[cpu] = mmap(NULL, PAGE_SIZE, PROT_READ, + MAP_PRIVATE, domfd, map_mtop_offset(cr3_phys[cpu]))) == + (unsigned long*)0xffffffff) + { + perror("mmap failed"); + goto error_out; + } + } + if ((pde = cr3_virt[cpu][vtopdi(va)]) == 0) /* logical address */ + goto error_out; + if (ctxt[cpu].flags & VGCF_VMX_GUEST) + pde = p2m_array[pde >> PAGE_SHIFT] << PAGE_SHIFT; + if (pde != pde_phys[cpu]) + { + pde_phys[cpu] = pde; + if (pde_virt[cpu]) + munmap(pde_virt[cpu], PAGE_SIZE); + if ((pde_virt[cpu] = mmap(NULL, PAGE_SIZE, PROT_READ, + MAP_PRIVATE, domfd, map_mtop_offset(pde_phys[cpu]))) == NULL) + goto error_out; + } + if ((page = pde_virt[cpu][vtopti(va)]) == 0) /* logical address */ + goto error_out; + if (ctxt[cpu].flags & VGCF_VMX_GUEST) + page = p2m_array[page >> PAGE_SHIFT] << PAGE_SHIFT; + if (page != page_phys[cpu]) + { + page_phys[cpu] = page; + if (page_virt[cpu]) + munmap(page_virt[cpu], PAGE_SIZE); + if ((page_virt[cpu] = mmap(NULL, PAGE_SIZE, PROT_READ, + MAP_PRIVATE, domfd, map_mtop_offset(page_phys[cpu]))) == NULL) { + printf("cr3 %lx pde %lx page %lx pti %lx\n", cr3[cpu], pde, page, vtopti(va)); + page_phys[cpu] = 0; + goto error_out; + } + } + return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK)); + + error_out: + return 0; +} + +int +xc_waitdomain_core(int domfd, int *status, int options) +{ + int retval = -1; + int nr_vcpus; + int i; + xc_core_header_t header; + + if (nr_pages == 0) { + + if (read(domfd, &header, sizeof(header)) != sizeof(header)) + return -1; + + nr_pages = header.xch_nr_pages; + nr_vcpus = header.xch_nr_vcpus; + pages_offset = header.xch_pages_offset; + + if (read(domfd, ctxt, sizeof(vcpu_guest_context_t)*nr_vcpus) != + sizeof(vcpu_guest_context_t)*nr_vcpus) + return -1; + + for (i = 0; i < nr_vcpus; i++) { + cr3[i] = ctxt[i].pt_base; + } + if ((p2m_array = malloc(nr_pages * sizeof(unsigned long))) == NULL) { + printf("Could not allocate p2m_array\n"); + goto error_out; + } + if (read(domfd, p2m_array, sizeof(unsigned long)*nr_pages) != + sizeof(unsigned long)*nr_pages) + return -1; + + if ((m2p_array = malloc((1<<20) * sizeof(unsigned long))) == NULL) { + printf("Could not allocate m2p array\n"); + goto error_out; + } + bzero(m2p_array, sizeof(unsigned long)* 1 << 20); + + for (i = 0; i < nr_pages; i++) { + m2p_array[p2m_array[i]] = i; + } + + } + retval = 0; + error_out: + return retval; + +} + +long +xc_ptrace_core(enum __ptrace_request request, int domfd, long eaddr, long edata) +{ + int status = 0; + struct gdb_regs pt; + long retval = 0; + unsigned long *guest_va; + int cpu = VCPU; + void *addr = (char *)eaddr; + void *data = (char *)edata; + +#if 0 + printf("%20s %d, %p, %p \n", ptrace_names[request], domid, addr, data); +#endif + switch (request) { + case PTRACE_PEEKTEXT: + case PTRACE_PEEKDATA: + if ((guest_va = (unsigned long *)map_domain_va(domfd, cpu, addr)) == NULL) { + status = EFAULT; + goto error_out; + } + + retval = *guest_va; + break; + case PTRACE_POKETEXT: + case PTRACE_POKEDATA: + if ((guest_va = (unsigned long *)map_domain_va(domfd, cpu, addr)) == NULL) { + status = EFAULT; + goto error_out; + } + *guest_va = (unsigned long)data; + break; + case PTRACE_GETREGS: + case PTRACE_GETFPREGS: + case PTRACE_GETFPXREGS: + if (request == PTRACE_GETREGS) { + SET_PT_REGS(pt, ctxt[cpu].user_regs); + memcpy(data, &pt, sizeof(elf_gregset_t)); + } else if (request == PTRACE_GETFPREGS) + memcpy(data, &ctxt[cpu].fpu_ctxt, sizeof(ctxt[cpu].fpu_ctxt)); + else /*if (request == PTRACE_GETFPXREGS)*/ + memcpy(data, &ctxt[cpu].fpu_ctxt, sizeof(ctxt[cpu].fpu_ctxt)); + break; + case PTRACE_ATTACH: + retval = 0; + break; + case PTRACE_SETREGS: + case PTRACE_SINGLESTEP: + case PTRACE_CONT: + case PTRACE_DETACH: + case PTRACE_SETFPREGS: + case PTRACE_SETFPXREGS: + case PTRACE_PEEKUSER: + case PTRACE_POKEUSER: + case PTRACE_SYSCALL: + case PTRACE_KILL: +#ifdef DEBUG + printf("unsupported xc_ptrace request %s\n", ptrace_names[request]); +#endif + status = ENOSYS; + break; + case PTRACE_TRACEME: + printf("PTRACE_TRACEME is an invalid request under Xen\n"); + status = EINVAL; + } + + if (status) { + errno = status; + retval = -1; + } + error_out: + return retval; +} diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index a474c4a888..5b76a20f43 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -36,6 +36,33 @@ typedef struct { * Definitions for the 'xc' object type. */ +static PyObject *pyxc_domain_dumpcore(PyObject *self, + PyObject *args, + PyObject *kwds) +{ + XcObject *xc = (XcObject *)self; + + u32 dom; + char *corefile; + + static char *kwd_list[] = { "dom", "corefile", NULL }; + + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list, &dom, &corefile) ) + goto exit; + + if ( (corefile == NULL) || (corefile[0] == '\0') ) + goto exit; + + if ( xc_domain_dumpcore(xc->xc_handle, dom, corefile) != 0 ) + return PyErr_SetFromErrno(xc_error); + + Py_INCREF(zero); + return zero; + + exit: + return NULL; +} + static PyObject *pyxc_domain_create(PyObject *self, PyObject *args, PyObject *kwds) @@ -854,6 +881,14 @@ static PyMethodDef pyxc_methods[] = { " mem_kb [int, 0]: Memory allocation, in kilobytes.\n" "Returns: [int] new domain identifier; -1 on error.\n" }, + { "domain_dumpcore", + (PyCFunction)pyxc_domain_dumpcore, + METH_VARARGS | METH_KEYWORDS, "\n" + "dump core of a domain.\n" + " dom [int]: Identifier of domain to be paused.\n\n" + " corefile [string]: Name of corefile to be created.\n\n" + "Returns: [int] 0 on success; -1 on error.\n" }, + { "domain_pause", (PyCFunction)pyxc_domain_pause, METH_VARARGS | METH_KEYWORDS, "\n" From 1c8d278230398b5db3e3f2e970e639698bd463e3 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk[kaf24]" Date: Sat, 30 Apr 2005 08:50:08 +0000 Subject: [PATCH 19/36] bitkeeper revision 1.1389.1.17 (427346c0aRp-AQNVyrLuVwZpeN01Sg) crash.patch FreeBSD calls domain_crash() on error so that its core is dumped. Signed-off-by: Kip Macy --- .rootkeys | 1 + .../i386-xen/include/hypervisor.h | 18 + freebsd-5.3-xen-sparse/kern/kern_shutdown.c | 635 ++++++++++++++++++ 3 files changed, 654 insertions(+) create mode 100644 freebsd-5.3-xen-sparse/kern/kern_shutdown.c diff --git a/.rootkeys b/.rootkeys index e1444d613a..ed9314cf7f 100644 --- a/.rootkeys +++ b/.rootkeys @@ -121,6 +121,7 @@ 423e7e8dVX2QkuzWwB2rtZDxD5Y_-w freebsd-5.3-xen-sparse/i386-xen/xen/misc/npx.c 423e7e8d_PdWXjQeRg75twh7TleJhQ freebsd-5.3-xen-sparse/i386-xen/xen/netfront/xn_netfront.c 423e7e8dlsc1oCW_ul57w0AHY5jZjQ freebsd-5.3-xen-sparse/kern/kern_fork.c +427346bfHJQldVgD-acDy_2toKMhTA freebsd-5.3-xen-sparse/kern/kern_shutdown.c 423e7e8dVDL1WLfbmQWuXMbetYk4jA freebsd-5.3-xen-sparse/mkbuildtree 423e7e8dBrOrAbydK6h49bY0VvDgPw freebsd-5.3-xen-sparse/xenfbsd_kernel_build 4187ca95_eQN62ugV1zliQcfzXrHnw install.sh diff --git a/freebsd-5.3-xen-sparse/i386-xen/include/hypervisor.h b/freebsd-5.3-xen-sparse/i386-xen/include/hypervisor.h index b23221bdbd..94c449ded9 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/include/hypervisor.h +++ b/freebsd-5.3-xen-sparse/i386-xen/include/hypervisor.h @@ -22,6 +22,7 @@ extern start_info_t *xen_start_info; * be MACHINE addresses. */ +static inline void HYPERVISOR_crash(void) __dead2; void MULTICALL_flush_page_update_queue(void); @@ -201,6 +202,23 @@ HYPERVISOR_suspend(unsigned long srec) return ret; } + +static inline void +HYPERVISOR_crash(void) +{ + int ret; + unsigned long ign1; + __asm__ __volatile__ ( + TRAP_INSTR + : "=a" (ret), "=b" (ign1) + : "0" (__HYPERVISOR_sched_op), + "1" (SCHEDOP_shutdown | (SHUTDOWN_crash << SCHEDOP_reasonshift)) + : "memory" ); + + for (;;) ; /* eliminate noreturn error */ + +} + static inline long HYPERVISOR_set_timer_op(uint64_t timeout) { diff --git a/freebsd-5.3-xen-sparse/kern/kern_shutdown.c b/freebsd-5.3-xen-sparse/kern/kern_shutdown.c new file mode 100644 index 0000000000..0143bd7446 --- /dev/null +++ b/freebsd-5.3-xen-sparse/kern/kern_shutdown.c @@ -0,0 +1,635 @@ +/*- + * Copyright (c) 1986, 1988, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 + */ + +#include +__FBSDID("$FreeBSD: src/sys/kern/kern_shutdown.c,v 1.163.2.2 2004/09/10 00:04:17 scottl Exp $"); + +#include "opt_kdb.h" +#include "opt_hw_wdog.h" +#include "opt_mac.h" +#include "opt_panic.h" +#include "opt_show_busybufs.h" +#include "opt_sched.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* smp_active */ +#include +#include +#include + +#include +#include +#include + +#include + +#ifndef PANIC_REBOOT_WAIT_TIME +#define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */ +#endif + +/* + * Note that stdarg.h and the ANSI style va_start macro is used for both + * ANSI and traditional C compilers. + */ +#include + +#ifdef KDB +#ifdef KDB_UNATTENDED +int debugger_on_panic = 0; +#else +int debugger_on_panic = 1; +#endif +SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW, + &debugger_on_panic, 0, "Run debugger on kernel panic"); + +#ifdef KDB_TRACE +int trace_on_panic = 1; +#else +int trace_on_panic = 0; +#endif +SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, CTLFLAG_RW, + &trace_on_panic, 0, "Print stack trace on kernel panic"); +#endif /* KDB */ + +int sync_on_panic = 0; +SYSCTL_INT(_kern, OID_AUTO, sync_on_panic, CTLFLAG_RW, + &sync_on_panic, 0, "Do a sync before rebooting from a panic"); + +SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment"); + +#ifdef HW_WDOG +/* + * If there is a hardware watchdog, point this at the function needed to + * hold it off. + * It's needed when the kernel needs to do some lengthy operations. + * e.g. in wd.c when dumping core.. It's most annoying to have + * your precious core-dump only half written because the wdog kicked in. + */ +watchdog_tickle_fn wdog_tickler = NULL; +#endif /* HW_WDOG */ + +/* + * Variable panicstr contains argument to first call to panic; used as flag + * to indicate that the kernel has already called panic. + */ +const char *panicstr; + +int dumping; /* system is dumping */ +static struct dumperinfo dumper; /* our selected dumper */ + +/* Context information for dump-debuggers. */ +static struct pcb dumppcb; /* Registers. */ +static lwpid_t dumptid; /* Thread ID. */ + +static void boot(int) __dead2; +static void poweroff_wait(void *, int); +static void shutdown_halt(void *junk, int howto); +static void shutdown_panic(void *junk, int howto); +static void shutdown_reset(void *junk, int howto); + +/* register various local shutdown events */ +static void +shutdown_conf(void *unused) +{ + + EVENTHANDLER_REGISTER(shutdown_final, poweroff_wait, NULL, + SHUTDOWN_PRI_FIRST); + EVENTHANDLER_REGISTER(shutdown_final, shutdown_halt, NULL, + SHUTDOWN_PRI_LAST + 100); + EVENTHANDLER_REGISTER(shutdown_final, shutdown_panic, NULL, + SHUTDOWN_PRI_LAST + 100); + EVENTHANDLER_REGISTER(shutdown_final, shutdown_reset, NULL, + SHUTDOWN_PRI_LAST + 200); +} + +SYSINIT(shutdown_conf, SI_SUB_INTRINSIC, SI_ORDER_ANY, shutdown_conf, NULL) + +/* + * The system call that results in a reboot + * + * MPSAFE + */ +/* ARGSUSED */ +int +reboot(struct thread *td, struct reboot_args *uap) +{ + int error; + + error = 0; +#ifdef MAC + error = mac_check_system_reboot(td->td_ucred, uap->opt); +#endif + if (error == 0) + error = suser(td); + if (error == 0) { + mtx_lock(&Giant); + boot(uap->opt); + mtx_unlock(&Giant); + } + return (error); +} + +/* + * Called by events that want to shut down.. e.g on a PC + */ +static int shutdown_howto = 0; + +void +shutdown_nice(int howto) +{ + + shutdown_howto = howto; + + /* Send a signal to init(8) and have it shutdown the world */ + if (initproc != NULL) { + PROC_LOCK(initproc); + psignal(initproc, SIGINT); + PROC_UNLOCK(initproc); + } else { + /* No init(8) running, so simply reboot */ + boot(RB_NOSYNC); + } + return; +} +static int waittime = -1; + +static void +print_uptime(void) +{ + int f; + struct timespec ts; + + getnanouptime(&ts); + printf("Uptime: "); + f = 0; + if (ts.tv_sec >= 86400) { + printf("%ldd", (long)ts.tv_sec / 86400); + ts.tv_sec %= 86400; + f = 1; + } + if (f || ts.tv_sec >= 3600) { + printf("%ldh", (long)ts.tv_sec / 3600); + ts.tv_sec %= 3600; + f = 1; + } + if (f || ts.tv_sec >= 60) { + printf("%ldm", (long)ts.tv_sec / 60); + ts.tv_sec %= 60; + f = 1; + } + printf("%lds\n", (long)ts.tv_sec); +} + +static void +doadump(void) +{ + + /* + * Sometimes people have to call this from the kernel debugger. + * (if 'panic' can not dump) + * Give them a clue as to why they can't dump. + */ + if (dumper.dumper == NULL) { + printf("Cannot dump. No dump device defined.\n"); + return; + } + + savectx(&dumppcb); + dumptid = curthread->td_tid; + dumping++; + dumpsys(&dumper); +} + +/* + * Go through the rigmarole of shutting down.. + * this used to be in machdep.c but I'll be dammned if I could see + * anything machine dependant in it. + */ +static void +boot(int howto) +{ + static int first_buf_printf = 1; + + /* collect extra flags that shutdown_nice might have set */ + howto |= shutdown_howto; + + /* We are out of the debugger now. */ + kdb_active = 0; + +#ifdef SMP + if (smp_active) + printf("boot() called on cpu#%d\n", PCPU_GET(cpuid)); +#endif + /* + * Do any callouts that should be done BEFORE syncing the filesystems. + */ + EVENTHANDLER_INVOKE(shutdown_pre_sync, howto); + + /* + * Now sync filesystems + */ + if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { + register struct buf *bp; + int iter, nbusy, pbusy; +#ifndef PREEMPTION + int subiter; +#endif + + waittime = 0; + + sync(&thread0, NULL); + + /* + * With soft updates, some buffers that are + * written will be remarked as dirty until other + * buffers are written. + */ + for (iter = pbusy = 0; iter < 20; iter++) { + nbusy = 0; + for (bp = &buf[nbuf]; --bp >= buf; ) { + if ((bp->b_flags & B_INVAL) == 0 && + BUF_REFCNT(bp) > 0) { + nbusy++; + } else if ((bp->b_flags & (B_DELWRI | B_INVAL)) + == B_DELWRI) { + /* bawrite(bp);*/ + nbusy++; + } + } + if (nbusy == 0) { + if (first_buf_printf) + printf("No buffers busy after final sync"); + break; + } + if (first_buf_printf) { + printf("Syncing disks, buffers remaining... "); + first_buf_printf = 0; + } + printf("%d ", nbusy); + if (nbusy < pbusy) + iter = 0; + pbusy = nbusy; + sync(&thread0, NULL); + +#ifdef PREEMPTION + /* + * Drop Giant and spin for a while to allow + * interrupt threads to run. + */ + DROP_GIANT(); + DELAY(50000 * iter); + PICKUP_GIANT(); +#else + /* + * Drop Giant and context switch several times to + * allow interrupt threads to run. + */ + DROP_GIANT(); + for (subiter = 0; subiter < 50 * iter; subiter++) { + mtx_lock_spin(&sched_lock); + mi_switch(SW_VOL, NULL); + mtx_unlock_spin(&sched_lock); + DELAY(1000); + } + PICKUP_GIANT(); +#endif + } + printf("\n"); + /* + * Count only busy local buffers to prevent forcing + * a fsck if we're just a client of a wedged NFS server + */ + nbusy = 0; + for (bp = &buf[nbuf]; --bp >= buf; ) { + if (((bp->b_flags&B_INVAL) == 0 && BUF_REFCNT(bp)) || + ((bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI)) { + if (bp->b_dev == NULL) { + TAILQ_REMOVE(&mountlist, + bp->b_vp->v_mount, mnt_list); + continue; + } + nbusy++; +#if defined(SHOW_BUSYBUFS) || defined(DIAGNOSTIC) + printf( + "%d: dev:%s, flags:%0x, blkno:%ld, lblkno:%ld\n", + nbusy, devtoname(bp->b_dev), + bp->b_flags, (long)bp->b_blkno, + (long)bp->b_lblkno); +#endif + } + } + if (nbusy) { + /* + * Failed to sync all blocks. Indicate this and don't + * unmount filesystems (thus forcing an fsck on reboot). + */ + printf("Giving up on %d buffers\n", nbusy); + DELAY(5000000); /* 5 seconds */ + } else { + if (!first_buf_printf) + printf("Final sync complete\n"); + /* + * Unmount filesystems + */ + if (panicstr == 0) + vfs_unmountall(); + } + DELAY(100000); /* wait for console output to finish */ + } + + print_uptime(); + + /* + * Ok, now do things that assume all filesystem activity has + * been completed. + */ + EVENTHANDLER_INVOKE(shutdown_post_sync, howto); + splhigh(); + if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) + doadump(); + + /* Now that we're going to really halt the system... */ + EVENTHANDLER_INVOKE(shutdown_final, howto); + + for(;;) ; /* safety against shutdown_reset not working */ + /* NOTREACHED */ +} + +/* + * If the shutdown was a clean halt, behave accordingly. + */ +static void +shutdown_halt(void *junk, int howto) +{ + + if (howto & RB_HALT) { + printf("\n"); + printf("The operating system has halted.\n"); + printf("Please press any key to reboot.\n\n"); + switch (cngetc()) { + case -1: /* No console, just die */ + cpu_halt(); + /* NOTREACHED */ + default: + howto &= ~RB_HALT; + break; + } + } +} + +/* + * Check to see if the system paniced, pause and then reboot + * according to the specified delay. + */ +static void +shutdown_panic(void *junk, int howto) +{ + int loop; + + if (howto & RB_DUMP) { + if (PANIC_REBOOT_WAIT_TIME != 0) { + if (PANIC_REBOOT_WAIT_TIME != -1) { + printf("Automatic reboot in %d seconds - " + "press a key on the console to abort\n", + PANIC_REBOOT_WAIT_TIME); + for (loop = PANIC_REBOOT_WAIT_TIME * 10; + loop > 0; --loop) { + DELAY(1000 * 100); /* 1/10th second */ + /* Did user type a key? */ + if (cncheckc() != -1) + break; + } + if (!loop) + return; + } + } else { /* zero time specified - reboot NOW */ + return; + } + printf("--> Press a key on the console to reboot,\n"); + printf("--> or switch off the system now.\n"); + cngetc(); + } +} + +/* + * Everything done, now reset + */ +static void +shutdown_reset(void *junk, int howto) +{ + + printf("Rebooting...\n"); + DELAY(1000000); /* wait 1 sec for printf's to complete and be read */ + /* cpu_boot(howto); */ /* doesn't do anything at the moment */ + cpu_reset(); + /* NOTREACHED */ /* assuming reset worked */ +} + +#ifdef SMP +static u_int panic_cpu = NOCPU; +#endif + +/* + * Panic is called on unresolvable fatal errors. It prints "panic: mesg", + * and then reboots. If we are called twice, then we avoid trying to sync + * the disks as this often leads to recursive panics. + * + * MPSAFE + */ +void +panic(const char *fmt, ...) +{ + struct thread *td = curthread; + int bootopt, newpanic; + va_list ap; + static char buf[256]; + +#ifdef SMP + /* + * We don't want multiple CPU's to panic at the same time, so we + * use panic_cpu as a simple spinlock. We have to keep checking + * panic_cpu if we are spinning in case the panic on the first + * CPU is canceled. + */ + if (panic_cpu != PCPU_GET(cpuid)) + while (atomic_cmpset_int(&panic_cpu, NOCPU, + PCPU_GET(cpuid)) == 0) + while (panic_cpu != NOCPU) + ; /* nothing */ +#endif + + bootopt = RB_AUTOBOOT | RB_DUMP; + newpanic = 0; + if (panicstr) + bootopt |= RB_NOSYNC; + else { + panicstr = fmt; + newpanic = 1; + } + + va_start(ap, fmt); + if (newpanic) { + (void)vsnprintf(buf, sizeof(buf), fmt, ap); + panicstr = buf; + printf("panic: %s\n", buf); + } else { + printf("panic: "); + vprintf(fmt, ap); + printf("\n"); + } + va_end(ap); +#ifdef SMP + printf("cpuid = %d\n", PCPU_GET(cpuid)); +#endif + +#ifdef KDB + if (newpanic && trace_on_panic) + kdb_backtrace(); + if (debugger_on_panic) + kdb_enter("panic"); +#ifdef RESTARTABLE_PANICS + /* See if the user aborted the panic, in which case we continue. */ + if (panicstr == NULL) { +#ifdef SMP + atomic_store_rel_int(&panic_cpu, NOCPU); +#endif + return; + } +#endif +#endif + mtx_lock_spin(&sched_lock); + td->td_flags |= TDF_INPANIC; + mtx_unlock_spin(&sched_lock); + if (!sync_on_panic) + bootopt |= RB_NOSYNC; +#ifdef XEN + HYPERVISOR_crash(); +#else + boot(bootopt); +#endif +} + +/* + * Support for poweroff delay. + */ +#ifndef POWEROFF_DELAY +# define POWEROFF_DELAY 5000 +#endif +static int poweroff_delay = POWEROFF_DELAY; + +SYSCTL_INT(_kern_shutdown, OID_AUTO, poweroff_delay, CTLFLAG_RW, + &poweroff_delay, 0, ""); + +static void +poweroff_wait(void *junk, int howto) +{ + + if (!(howto & RB_POWEROFF) || poweroff_delay <= 0) + return; + DELAY(poweroff_delay * 1000); +} + +/* + * Some system processes (e.g. syncer) need to be stopped at appropriate + * points in their main loops prior to a system shutdown, so that they + * won't interfere with the shutdown process (e.g. by holding a disk buf + * to cause sync to fail). For each of these system processes, register + * shutdown_kproc() as a handler for one of shutdown events. + */ +static int kproc_shutdown_wait = 60; +SYSCTL_INT(_kern_shutdown, OID_AUTO, kproc_shutdown_wait, CTLFLAG_RW, + &kproc_shutdown_wait, 0, ""); + +void +kproc_shutdown(void *arg, int howto) +{ + struct proc *p; + char procname[MAXCOMLEN + 1]; + int error; + + if (panicstr) + return; + + p = (struct proc *)arg; + strlcpy(procname, p->p_comm, sizeof(procname)); + printf("Waiting (max %d seconds) for system process `%s' to stop...", + kproc_shutdown_wait, procname); + error = kthread_suspend(p, kproc_shutdown_wait * hz); + + if (error == EWOULDBLOCK) + printf("timed out\n"); + else + printf("done\n"); +} + +/* Registration of dumpers */ +int +set_dumper(struct dumperinfo *di) +{ + + if (di == NULL) { + bzero(&dumper, sizeof dumper); + return (0); + } + if (dumper.dumper != NULL) + return (EBUSY); + dumper = *di; + return (0); +} + +#if defined(__powerpc__) +void +dumpsys(struct dumperinfo *di __unused) +{ + + printf("Kernel dumps not implemented on this architecture\n"); +} +#endif From f497950f3f6e52282b5ba70c3d95dace15785417 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk[kaf24]" Date: Sat, 30 Apr 2005 15:19:31 +0000 Subject: [PATCH 20/36] bitkeeper revision 1.1389.1.18 (4273a203Crs6SOBhDcJcXdza1-0gNw) dump-enable.patch Dump guest core if enable-dump is set. Signed-off-by: Kip Macy --- tools/python/xen/xend/XendDomain.py | 2 ++ tools/python/xen/xend/XendRoot.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index 7f5218bff1..93d66725f0 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -255,6 +255,8 @@ class XendDomain: eserver.inject('xend.domain.exit', [name, id, reason]) self.domain_restart_schedule(id, reason) else: + if xroot.get_enable_dump() == 'true': + xc.domain_dumpcore(dom = int(id), corefile = "/var/xen/dump/%s.%s.core"%(name,id)) eserver.inject('xend.domain.exit', [name, id, 'crash']) destroyed += 1 self.final_domain_destroy(id) diff --git a/tools/python/xen/xend/XendRoot.py b/tools/python/xen/xend/XendRoot.py index c8236a4ecd..815cb88dfb 100644 --- a/tools/python/xen/xend/XendRoot.py +++ b/tools/python/xen/xend/XendRoot.py @@ -255,6 +255,9 @@ class XendRoot: def get_network_script(self): return self.get_config_value('network-script', 'network') + def get_enable_dump(self): + return self.get_config_value('enable-dump', 'false') + def get_vif_bridge(self): return self.get_config_value('vif-bridge', 'xen-br0') From e66cbf425214927543279005be10e187126cdd56 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk[kaf24]" Date: Sat, 30 Apr 2005 15:20:55 +0000 Subject: [PATCH 21/36] bitkeeper revision 1.1389.1.19 (4273a257_YthmItOayXCOoUAFw7rYA) wrpt-disable.patch Disable writable pagetables in FreeBSD for the time being. Signed-off-by: Kip Macy --- freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h b/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h index b25b0b8fe6..4d5e73f9b0 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h +++ b/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h @@ -59,7 +59,9 @@ void pmap_ref(pt_entry_t *pte, unsigned long ma); #define PMAP_DEC_REF_PAGE(a) #endif +#if 0 #define WRITABLE_PAGETABLES +#endif #define ALWAYS_SYNC 0 #ifdef PT_DEBUG @@ -118,18 +120,18 @@ void pd_set(struct pmap *pmap, vm_paddr_t *ptr, vm_paddr_t val, int type); #define PT_SET_VA(_ptp,_npte,sync) do { \ PMAP_REF((_ptp), xpmap_ptom(_npte)); \ - xen_queue_pt_update((pt_entry_t *)vtomach(_ptp), \ + xen_queue_pt_update(vtomach(_ptp), \ xpmap_ptom(_npte)); \ if (sync || ALWAYS_SYNC) xen_flush_queue(); \ } while (/*CONSTCOND*/0) #define PT_SET_VA_MA(_ptp,_npte,sync) do { \ PMAP_REF((_ptp), (_npte)); \ - xen_queue_pt_update((pt_entry_t *)vtomach(_ptp), _npte);\ + xen_queue_pt_update(vtomach(_ptp), _npte); \ if (sync || ALWAYS_SYNC) xen_flush_queue(); \ } while (/*CONSTCOND*/0) #define PT_CLEAR_VA(_ptp, sync) do { \ PMAP_REF((pt_entry_t *)(_ptp), 0); \ - xen_queue_pt_update((pt_entry_t *)vtomach(_ptp), 0); \ + xen_queue_pt_update(vtomach(_ptp), 0); \ if (sync || ALWAYS_SYNC) \ xen_flush_queue(); \ } while (/*CONSTCOND*/0) From 28772e89c597d3573737823a37fa40b7f013e6cb Mon Sep 17 00:00:00 2001 From: "kmacy@netapp.com[kaf24]" Date: Mon, 2 May 2005 08:33:19 +0000 Subject: [PATCH 22/36] bitkeeper revision 1.1389.1.20 (4275e5cf8rSBidyFfn32zpPSsOA_xw) [PATCH] [PATCH] make XenFreeBSD trapframe the same as native # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/05/01 16:04:24-07:00 kmacy@curly.lab.netapp.com # Make trapframe the same size as on native i386 # Signed-off-by: Kip Macy # # freebsd-5.3-xen-sparse/i386-xen/include/pcpu.h # 2005/05/01 16:04:20-07:00 kmacy@curly.lab.netapp.com +3 -2 # add per-cpu fields for evtchn and page faults # # freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c # 2005/05/01 16:04:20-07:00 kmacy@curly.lab.netapp.com +1 -9 # remove STACK_DEBUGGING cruft # fetch cr2 from pcpu area # # freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c # 2005/05/01 16:04:20-07:00 kmacy@curly.lab.netapp.com +1 -2 # remove unused trap_nesting # add cr2 field # # freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s # 2005/05/01 16:04:20-07:00 kmacy@curly.lab.netapp.com +41 -31 # Save CR2 after trap frame then move to pcpu area # # BitKeeper/deleted/.del-ucontext.h~6f534fc91cb2d96b # 2005/05/01 15:56:03-07:00 kmacy@curly.lab.netapp.com +0 -1 # Delete: freebsd-5.3-xen-sparse/i386-xen/include/ucontext.h # # BitKeeper/deleted/.del-frame.h~fbfe41b49597c684 # 2005/05/01 15:55:59-07:00 kmacy@curly.lab.netapp.com +3 -3 # Delete: freebsd-5.3-xen-sparse/i386-xen/include/frame.h # --- .rootkeys | 2 - BitKeeper/etc/logging_ok | 1 + .../i386-xen/i386-xen/exception.s | 72 +++++----- .../i386-xen/i386-xen/genassym.c | 3 +- .../i386-xen/i386-xen/trap.c | 10 +- .../i386-xen/include/frame.h | 129 ------------------ .../i386-xen/include/pcpu.h | 5 +- .../i386-xen/include/ucontext.h | 105 -------------- 8 files changed, 47 insertions(+), 280 deletions(-) delete mode 100644 freebsd-5.3-xen-sparse/i386-xen/include/frame.h delete mode 100644 freebsd-5.3-xen-sparse/i386-xen/include/ucontext.h diff --git a/.rootkeys b/.rootkeys index ed9314cf7f..60c742cd39 100644 --- a/.rootkeys +++ b/.rootkeys @@ -95,7 +95,6 @@ 423e7e8aVYTynjpZsJxUsFSlIDhpJw freebsd-5.3-xen-sparse/i386-xen/include/cpufunc.h 423e7e8avrrUxDugrwq_GJp499DkJw freebsd-5.3-xen-sparse/i386-xen/include/ctrl_if.h 423e7e8apY1r9Td-S0eZITNZZbfNTQ freebsd-5.3-xen-sparse/i386-xen/include/evtchn.h -423e7e8aL9DsObEegCwtILrF6SWcAQ freebsd-5.3-xen-sparse/i386-xen/include/frame.h 4266317eOVvN00XdcqRfDRFIrbqgvg freebsd-5.3-xen-sparse/i386-xen/include/gnttab.h 423e7e8btv8Gojq50ggnP5A1Dkc4kA freebsd-5.3-xen-sparse/i386-xen/include/hypervisor-ifs.h 423e7e8buhTLVFLZ33-5s8-UdADSZg freebsd-5.3-xen-sparse/i386-xen/include/hypervisor.h @@ -108,7 +107,6 @@ 423e7e8bVOoPguCLyNj7pil-PT7Vcw freebsd-5.3-xen-sparse/i386-xen/include/segments.h 423e7e8c9AuwksRrt0ptRKHnNVWuNQ freebsd-5.3-xen-sparse/i386-xen/include/synch_bitops.h 423e7e8csdWimnMBI2HxEDJ30L42kQ freebsd-5.3-xen-sparse/i386-xen/include/trap.h -423e7e8cgVgn9W8sZWwfh_4938fSJQ freebsd-5.3-xen-sparse/i386-xen/include/ucontext.h 423e7e8cdsEhPyad2ppDoSiBR4eB9g freebsd-5.3-xen-sparse/i386-xen/include/vmparam.h 423e7e8ccGI7kzIlRcEVziGZzm46wg freebsd-5.3-xen-sparse/i386-xen/include/xen-os.h 423e7e8cVSqLIOp5vH4ADvAL_MF6Qg freebsd-5.3-xen-sparse/i386-xen/include/xen_intr.h diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index d0fc567e14..6ddee7bec8 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -55,6 +55,7 @@ kaf24@scramble.cl.cam.ac.uk kaf24@striker.cl.cam.ac.uk kaf24@viper.(none) katzj@redhat.com +kmacy@netapp.com kmacy@shemp.lab.netapp.com kraxel@bytesex.org laudney@eclipse.(none) diff --git a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s index 4adb61a350..670d2809fa 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s @@ -91,47 +91,52 @@ MCOUNT_LABEL(user) MCOUNT_LABEL(btrap) IDTVEC(div) - pushl $0; pushl $0; TRAP(T_DIVIDE) + pushl $0; TRAP(T_DIVIDE) IDTVEC(dbg) - pushl $0; pushl $0; TRAP(T_TRCTRAP) + pushl $0; TRAP(T_TRCTRAP) IDTVEC(nmi) - pushl $0; pushl $0; TRAP(T_NMI) + pushl $0; TRAP(T_NMI) IDTVEC(bpt) - pushl $0; pushl $0; TRAP(T_BPTFLT) + pushl $0; TRAP(T_BPTFLT) IDTVEC(ofl) - pushl $0; pushl $0; TRAP(T_OFLOW) + pushl $0; TRAP(T_OFLOW) IDTVEC(bnd) - pushl $0; pushl $0; TRAP(T_BOUND) + pushl $0; TRAP(T_BOUND) IDTVEC(ill) - pushl $0; pushl $0; TRAP(T_PRIVINFLT) + pushl $0; TRAP(T_PRIVINFLT) IDTVEC(dna) - pushl $0; pushl $0; TRAP(T_DNA) + pushl $0; TRAP(T_DNA) IDTVEC(fpusegm) - pushl $0; pushl $0; TRAP(T_FPOPFLT) + pushl $0; TRAP(T_FPOPFLT) IDTVEC(tss) - pushl $0; TRAP(T_TSSFLT) + TRAP(T_TSSFLT) IDTVEC(missing) - pushl $0; TRAP(T_SEGNPFLT) + TRAP(T_SEGNPFLT) IDTVEC(stk) - pushl $0; TRAP(T_STKFLT) + TRAP(T_STKFLT) IDTVEC(prot) - pushl $0; TRAP(T_PROTFLT) + TRAP(T_PROTFLT) IDTVEC(page) + pushl %eax + movl 4(%esp),%eax + movl %eax,-44(%esp) # move cr2 after trap frame + popl %eax + addl $4,%esp TRAP(T_PAGEFLT) IDTVEC(mchk) - pushl $0; pushl $0; TRAP(T_MCHK) + pushl $0; TRAP(T_MCHK) IDTVEC(rsvd) - pushl $0; pushl $0; TRAP(T_RESERVED) + pushl $0; TRAP(T_RESERVED) IDTVEC(fpu) - pushl $0; pushl $0; TRAP(T_ARITHTRAP) + pushl $0; TRAP(T_ARITHTRAP) IDTVEC(align) - pushl $0; TRAP(T_ALIGNFLT) + TRAP(T_ALIGNFLT) IDTVEC(xmm) - pushl $0; pushl $0; TRAP(T_XMMFLT) + pushl $0; TRAP(T_XMMFLT) IDTVEC(hypervisor_callback) - pushl $T_HYPCALLBACK; pushl %eax; TRAP(T_HYPCALLBACK) + pushl %eax; TRAP(T_HYPCALLBACK) hypervisor_callback_pending: movl $T_HYPCALLBACK,TF_TRAPNO(%esp) @@ -161,6 +166,12 @@ alltraps_with_regs_pushed: movl $KPSEL,%eax movl %eax,%fs FAKE_MCOUNT(TF_EIP(%esp)) +save_cr2: + movl TF_TRAPNO(%esp),%eax + cmpl $T_PAGEFLT,%eax + jne calltrap + movl -4(%esp),%eax + movl %eax,PCPU(CR2) calltrap: movl TF_EIP(%esp),%eax cmpl $scrit,%eax @@ -217,8 +228,7 @@ IDTVEC(lcall_syscall) SUPERALIGN_TEXT IDTVEC(int0x80_syscall) pushl $2 /* sizeof "int 0x80" */ - pushl $0xCAFE - pushl $0xDEAD + pushl $0xBEEF pushal pushl %ds pushl %es @@ -324,7 +334,7 @@ doreti_popl_es: doreti_popl_ds: popl %ds POPA - addl $12,%esp + addl $8,%esp .globl doreti_iret doreti_iret: iret @@ -341,7 +351,7 @@ ecrit: ALIGN_TEXT .globl doreti_iret_fault doreti_iret_fault: - subl $12,%esp + subl $8,%esp pushal pushl %ds .globl doreti_popl_ds_fault @@ -376,7 +386,7 @@ critical_region_fixup: movl %esp,%esi add %eax,%esi # %esi points at end of src region movl %esp,%edi - add $0x44,%edi # %edi points at end of dst region + add $0x40,%edi # %edi points at end of dst region movl %eax,%ecx shr $2,%ecx # convert bytes to words je 16f # skip loop if nothing to copy @@ -403,8 +413,8 @@ critical_fixup_table: .byte 0x20 #pop %edx .byte 0x24 #pop %ecx .byte 0x28 #pop %eax -.byte 0x2c,0x2c,0x2c #add $0xc,%esp -.byte 0x38 #iret +.byte 0x2c,0x2c,0x2c #add $0x8,%esp +.byte 0x34 #iret /* # Hypervisor uses this for application faults while it executes.*/ @@ -412,17 +422,17 @@ ENTRY(failsafe_callback) pushal call xen_failsafe_handler /*# call install_safe_pf_handler */ - movl 32(%esp),%ebx + movl 28(%esp),%ebx 1: movl %ebx,%ds - movl 36(%esp),%ebx + movl 32(%esp),%ebx 2: movl %ebx,%es - movl 40(%esp),%ebx + movl 36(%esp),%ebx 3: movl %ebx,%fs - movl 44(%esp),%ebx + movl 40(%esp),%ebx 4: movl %ebx,%gs /*# call install_normal_pf_handler */ popal - addl $16,%esp + addl $12,%esp iret diff --git a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c index 1e9df732c7..8b320fb200 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c @@ -200,8 +200,7 @@ ASSYM(PC_TSS_GDT, offsetof(struct pcpu, pc_tss_gdt)); ASSYM(PC_CURRENTLDT, offsetof(struct pcpu, pc_currentldt)); ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); -ASSYM(PC_TRAP_NESTING, offsetof(struct pcpu, pc_trap_nesting)); - +ASSYM(PC_CR2, offsetof(struct pcpu, pc_cr2)); ASSYM(PC_CR3, offsetof(struct pcpu, pc_pdir)); #ifdef DEV_APIC diff --git a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c index a74986ed18..662f94c456 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c @@ -181,11 +181,6 @@ trap(struct trapframe frame) u_int sticks = 0; int i = 0, ucode = 0, type, code; vm_offset_t eva; -#ifdef STACK_DEBUGGING - int nesting, current_sp; - static int prev_csp = 0, prev_ssp = 0; - nesting = PCPU_GET(trap_nesting); -#endif #ifdef POWERFAIL_NMI static int lastalert = 0; @@ -227,7 +222,7 @@ trap(struct trapframe frame) * kernel can print out a useful trap message and even get * to the debugger. */ - eva = frame.tf_cr2; + eva = PCPU_GET(cr2); if (td->td_critnest != 0) trap_fatal(&frame, eva); @@ -613,9 +608,6 @@ user: mtx_assert(&Giant, MA_NOTOWNED); userout: out: -#ifdef STACK_DEBUGGING - PCPU_SET(trap_nesting, nesting); -#endif return; } diff --git a/freebsd-5.3-xen-sparse/i386-xen/include/frame.h b/freebsd-5.3-xen-sparse/i386-xen/include/frame.h deleted file mode 100644 index a6572d85a9..0000000000 --- a/freebsd-5.3-xen-sparse/i386-xen/include/frame.h +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)frame.h 5.2 (Berkeley) 1/18/91 - * $FreeBSD: src/sys/i386/include/frame.h,v 1.23 2003/07/22 08:11:15 peter Exp $ - */ - -#ifndef _MACHINE_FRAME_H_ -#define _MACHINE_FRAME_H_ 1 - -/* - * System stack frames. - */ - -/* - * Exception/Trap Stack Frame - */ - -struct trapframe { - int tf_fs; - int tf_es; - int tf_ds; - int tf_edi; - int tf_esi; - int tf_ebp; - int tf_isp; - int tf_ebx; - int tf_edx; - int tf_ecx; - int tf_eax; - int tf_trapno; - int tf_cr2; - /* below portion defined in 386 hardware */ - int tf_err; - int tf_eip; - int tf_cs; - int tf_eflags; - /* below only when crossing rings (e.g. user to kernel) */ - int tf_esp; - int tf_ss; -}; - -/* Interrupt stack frame */ - -struct intrframe { - int if_fs; - int if_es; - int if_ds; - int if_edi; - int if_esi; - int if_ebp; - int :32; - int if_ebx; - int if_edx; - int if_ecx; - int if_eax; - int :32; /* for compat with trap frame - trapno */ - int if_vec; /* cr2 in trap frame */ - int :32; /* for compat with trap frame - err */ - /* below portion defined in 386 hardware */ - int if_eip; - int if_cs; - int if_eflags; - /* below only when crossing rings (e.g. user to kernel) */ - int if_esp; - int if_ss; -}; - -/* frame of clock (same as interrupt frame) */ - -struct clockframe { - int cf_fs; - int cf_es; - int cf_ds; - int cf_edi; - int cf_esi; - int cf_ebp; - int :32; - int cf_ebx; - int cf_edx; - int cf_ecx; - int cf_eax; - int :32; /* for compat with trap frame - trapno */ - int cf_vec; /* cr2 in trap frame */ - int :32; /* for compat with trap frame - err */ - /* below portion defined in 386 hardware */ - int cf_eip; - int cf_cs; - int cf_eflags; - /* below only when crossing rings (e.g. user to kernel) */ - int cf_esp; - int cf_ss; -}; - -#define INTR_TO_TRAPFRAME(frame) ((struct trapframe *)&(frame)->if_fs) - -#endif /* _MACHINE_FRAME_H_ */ diff --git a/freebsd-5.3-xen-sparse/i386-xen/include/pcpu.h b/freebsd-5.3-xen-sparse/i386-xen/include/pcpu.h index 80a675cd4a..e373697cca 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/include/pcpu.h +++ b/freebsd-5.3-xen-sparse/i386-xen/include/pcpu.h @@ -50,8 +50,9 @@ int pc_currentldt; \ u_int pc_acpi_id; \ u_int pc_apic_id; \ - u_int pc_faultaddr; \ - u_int pc_trap_nesting; \ + int *pc_ipi_to_evtchn; \ + int *pc_virq_to_irq; \ + u_int pc_cr2; \ u_int pc_pdir #if defined(lint) diff --git a/freebsd-5.3-xen-sparse/i386-xen/include/ucontext.h b/freebsd-5.3-xen-sparse/i386-xen/include/ucontext.h deleted file mode 100644 index eda584b62e..0000000000 --- a/freebsd-5.3-xen-sparse/i386-xen/include/ucontext.h +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * Copyright (c) 1999 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/sys/i386/include/ucontext.h,v 1.10 2002/12/02 19:58:55 deischen Exp $ - */ - -#ifndef _MACHINE_UCONTEXT_H_ -#define _MACHINE_UCONTEXT_H_ - -typedef struct __mcontext { - /* - * The first 20 fields must match the definition of - * sigcontext. So that we can support sigcontext - * and ucontext_t at the same time. - */ - int mc_onstack; /* XXX - sigcontext compat. */ - int mc_gs; /* machine state (struct trapframe) */ - int mc_fs; - int mc_es; - int mc_ds; - int mc_edi; - int mc_esi; - int mc_ebp; - int mc_isp; - int mc_ebx; - int mc_edx; - int mc_ecx; - int mc_eax; - int mc_trapno; - int mc_cr2; - int mc_err; - int mc_eip; - int mc_cs; - int mc_eflags; - int mc_esp; - int mc_ss; - - int mc_len; /* sizeof(mcontext_t) */ -#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */ -#define _MC_FPFMT_387 0x10001 -#define _MC_FPFMT_XMM 0x10002 - int mc_fpformat; -#define _MC_FPOWNED_NONE 0x20000 /* FP state not used */ -#define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */ -#define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */ - int mc_ownedfp; - /* - * See for the internals of mc_fpstate[]. - */ - int mc_fpstate[128] __aligned(16); - int mc_spare2[8]; -} mcontext_t; - -#if defined(_KERNEL) && defined(COMPAT_FREEBSD4) -struct mcontext4 { - int mc_onstack; /* XXX - sigcontext compat. */ - int mc_gs; /* machine state (struct trapframe) */ - int mc_fs; - int mc_es; - int mc_ds; - int mc_edi; - int mc_esi; - int mc_ebp; - int mc_isp; - int mc_ebx; - int mc_edx; - int mc_ecx; - int mc_eax; - int mc_trapno; - int mc_err; - int mc_eip; - int mc_cs; - int mc_eflags; - int mc_esp; /* machine state */ - int mc_ss; - int mc_fpregs[28]; /* env87 + fpacc87 + u_long */ - int __spare__[17]; -}; -#endif - -#endif /* !_MACHINE_UCONTEXT_H_ */ From 7f4d96e056d8c7b0422ee3cae6ad189a3b33be2a Mon Sep 17 00:00:00 2001 From: "kmacy@netapp.com[kaf24]" Date: Mon, 2 May 2005 08:33:31 +0000 Subject: [PATCH 23/36] bitkeeper revision 1.1389.1.21 (4275e5dbz3R_E1mjaxcOhfE7cYQy0w) [PATCH] [PATCH] update evtchn for SMP # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/05/01 17:01:17-07:00 kmacy@curly.lab.netapp.com # add SMP support to evtchn # Signed-off-by: Kip Macy # # freebsd-5.3-xen-sparse/i386-xen/include/xen_intr.h # 2005/05/01 17:01:15-07:00 kmacy@curly.lab.netapp.com +3 -0 # add SMP interfaces # # freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c # 2005/05/01 17:01:15-07:00 kmacy@curly.lab.netapp.com +85 -9 # add SMP support # --- .../i386-xen/i386-xen/evtchn.c | 94 +++++++++++++++++-- .../i386-xen/include/xen_intr.h | 3 + 2 files changed, 88 insertions(+), 9 deletions(-) diff --git a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c index 76289bb0ef..d6bda9ecc5 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c @@ -31,8 +31,9 @@ static struct mtx irq_mapping_update_lock; static int evtchn_to_irq[NR_EVENT_CHANNELS]; static int irq_to_evtchn[NR_IRQS]; -/* IRQ <-> VIRQ mapping. */ -static int virq_to_irq[NR_VIRQS]; +static int virq_to_irq[MAX_VIRT_CPUS][NR_VIRQS]; +static int ipi_to_evtchn[MAX_VIRT_CPUS][NR_VIRQS]; + /* Reference counts for bindings to IRQs. */ static int irq_bindcount[NR_IRQS]; @@ -120,7 +121,7 @@ bind_virq_to_irq(int virq) mtx_lock(&irq_mapping_update_lock); - if ( (irq = virq_to_irq[virq]) == -1 ) + if ( (irq = PCPU_GET(virq_to_irq)[virq]) == -1 ) { op.cmd = EVTCHNOP_bind_virq; op.u.bind_virq.virq = virq; @@ -132,7 +133,7 @@ bind_virq_to_irq(int virq) evtchn_to_irq[evtchn] = irq; irq_to_evtchn[irq] = evtchn; - virq_to_irq[virq] = irq; + PCPU_GET(virq_to_irq)[virq] = irq; } irq_bindcount[irq]++; @@ -146,7 +147,7 @@ void unbind_virq_from_irq(int virq) { evtchn_op_t op; - int irq = virq_to_irq[virq]; + int irq = PCPU_GET(virq_to_irq)[virq]; int evtchn = irq_to_evtchn[irq]; mtx_lock(&irq_mapping_update_lock); @@ -161,7 +162,64 @@ unbind_virq_from_irq(int virq) evtchn_to_irq[evtchn] = -1; irq_to_evtchn[irq] = -1; - virq_to_irq[virq] = -1; + PCPU_GET(virq_to_irq)[virq] = -1; + } + + mtx_unlock(&irq_mapping_update_lock); +} + + +int +bind_ipi_on_cpu_to_irq(int cpu, int ipi) +{ + evtchn_op_t op; + int evtchn, irq; + + mtx_lock(&irq_mapping_update_lock); + + if ( (evtchn = PCPU_GET(ipi_to_evtchn)[ipi]) == 0 ) + { + op.cmd = EVTCHNOP_bind_ipi; + op.u.bind_ipi.ipi_edom = cpu; + if ( HYPERVISOR_event_channel_op(&op) != 0 ) + panic("Failed to bind virtual IPI %d on cpu %d\n", ipi, cpu); + evtchn = op.u.bind_ipi.port; + + irq = find_unbound_irq(); + evtchn_to_irq[evtchn] = irq; + irq_to_evtchn[irq] = evtchn; + + PCPU_GET(ipi_to_evtchn)[ipi] = evtchn; + } else + irq = evtchn_to_irq[evtchn]; + + irq_bindcount[irq]++; + + mtx_unlock(&irq_mapping_update_lock); + + return irq; +} + +void +unbind_ipi_on_cpu_from_irq(int cpu, int ipi) +{ + evtchn_op_t op; + int evtchn = PCPU_GET(ipi_to_evtchn)[ipi]; + int irq = irq_to_evtchn[evtchn]; + + mtx_lock(&irq_mapping_update_lock); + + if ( --irq_bindcount[irq] == 0 ) + { + op.cmd = EVTCHNOP_close; + op.u.close.dom = DOMID_SELF; + op.u.close.port = evtchn; + if ( HYPERVISOR_event_channel_op(&op) != 0 ) + panic("Failed to unbind virtual IPI %d on cpu %d\n", ipi, cpu); + + evtchn_to_irq[evtchn] = -1; + irq_to_evtchn[irq] = -1; + PCPU_GET(ipi_to_evtchn)[ipi] = 0; } mtx_unlock(&irq_mapping_update_lock); @@ -464,7 +522,7 @@ void irq_suspend(void) /* Unbind VIRQs from event channels. */ for ( virq = 0; virq < NR_VIRQS; virq++ ) { - if ( (irq = virq_to_irq[virq]) == -1 ) + if ( (irq = PCPU_GET(virq_to_irq)[virq]) == -1 ) continue; evtchn = irq_to_evtchn[irq]; @@ -493,7 +551,7 @@ void irq_resume(void) for ( virq = 0; virq < NR_VIRQS; virq++ ) { - if ( (irq = virq_to_irq[virq]) == -1 ) + if ( (irq = PCPU_GET(virq_to_irq)[virq]) == -1 ) continue; /* Get a new binding from Xen. */ @@ -512,6 +570,20 @@ void irq_resume(void) } } +void +ap_evtchn_init(int cpu) +{ + int i; + + /* XXX -- expedience hack */ + PCPU_SET(virq_to_irq, (int *)&virq_to_irq[cpu]); + PCPU_SET(ipi_to_evtchn, (int *)&ipi_to_evtchn[cpu]); + + /* No VIRQ -> IRQ mappings. */ + for ( i = 0; i < NR_VIRQS; i++ ) + PCPU_GET(virq_to_irq)[i] = -1; +} + static void evtchn_init(void *dummy __unused) { @@ -527,9 +599,13 @@ evtchn_init(void *dummy __unused) */ mtx_init(&irq_mapping_update_lock, "xp", NULL, MTX_DEF); + /* XXX -- expedience hack */ + PCPU_SET(virq_to_irq, (int *)&virq_to_irq[0]); + PCPU_SET(ipi_to_evtchn, (int *)&ipi_to_evtchn[0]); + /* No VIRQ -> IRQ mappings. */ for ( i = 0; i < NR_VIRQS; i++ ) - virq_to_irq[i] = -1; + PCPU_GET(virq_to_irq)[i] = -1; /* No event-channel -> IRQ mappings. */ for ( i = 0; i < NR_EVENT_CHANNELS; i++ ) diff --git a/freebsd-5.3-xen-sparse/i386-xen/include/xen_intr.h b/freebsd-5.3-xen-sparse/i386-xen/include/xen_intr.h index e35eafa5d2..f4e32823df 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/include/xen_intr.h +++ b/freebsd-5.3-xen-sparse/i386-xen/include/xen_intr.h @@ -31,6 +31,9 @@ extern int bind_virq_to_irq(int virq); extern void unbind_virq_from_irq(int virq); extern int bind_evtchn_to_irq(int evtchn); extern void unbind_evtchn_from_irq(int evtchn); +extern int bind_ipi_on_cpu_to_irq(int cpu, int ipi); +extern void unbind_ipi_on_cpu_from_irq(int cpu, int ipi); +extern void ap_evtchn_init(int cpu); static __inline__ int irq_cannonicalize(int irq) { From 55e32f4e7d259c55199626d2cc609381aa5daedf Mon Sep 17 00:00:00 2001 From: "kmacy@netapp.com[kaf24]" Date: Mon, 2 May 2005 08:33:37 +0000 Subject: [PATCH 24/36] bitkeeper revision 1.1389.1.22 (4275e5e1eelF9eh7n92D3W-1Ju8Fzg) [PATCH] [PATCH] make XenFreeBSD VBD ring full handling sensible # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/05/01 23:48:15-07:00 kmacy@curly.lab.netapp.com # make ring full handling sensible # Signed-off-by: Kip Macy # # freebsd-5.3-xen-sparse/i386-xen/xen/blkfront/xb_blkfront.c # 2005/05/01 23:48:12-07:00 kmacy@curly.lab.netapp.com +48 -5 # make ring full handling sensible # --- .../i386-xen/xen/blkfront/xb_blkfront.c | 53 +++++++++++++++++-- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/freebsd-5.3-xen-sparse/i386-xen/xen/blkfront/xb_blkfront.c b/freebsd-5.3-xen-sparse/i386-xen/xen/blkfront/xb_blkfront.c index 5aeb212153..cd7f9d60a2 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/xen/blkfront/xb_blkfront.c +++ b/freebsd-5.3-xen-sparse/i386-xen/xen/blkfront/xb_blkfront.c @@ -68,6 +68,7 @@ struct xb_softc { void *xb_resp_handler; int xb_unit; int xb_flags; + struct xb_softc *xb_next_blocked; #define XB_OPEN (1<<0) /* drive is open (can't shut down) */ }; @@ -118,6 +119,9 @@ static grant_ref_t gref_head, gref_terminal; (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLKIF_RING_SIZE) #endif +static struct xb_softc *xb_kick_pending_head = NULL; +static struct xb_softc *xb_kick_pending_tail = NULL; +static struct mtx blkif_io_block_lock; static unsigned long rec_ring_free; blkif_request_t rec_ring[BLK_RING_SIZE]; @@ -246,6 +250,7 @@ xb_response_intr(void *xsc) /* sometimes we seem to lose i/o. stay in the interrupt handler while * there is stuff to process: continually recheck the response producer. */ + process_rcvd: for ( i = blk_ring.rsp_cons; i != (rp = blk_ring.sring->rsp_prod); i++ ) { unsigned long id; bret = RING_GET_RESPONSE(&blk_ring, i); @@ -298,9 +303,28 @@ xb_response_intr(void *xsc) blk_ring.rsp_cons = i; - if (sc && xb_kick_pending) { - xb_kick_pending = FALSE; - xb_startio(sc); + if (xb_kick_pending) { + unsigned long flags; + mtx_lock_irqsave(&blkif_io_block_lock, flags); + xb_kick_pending = FALSE; + /* Run as long as there are blocked devs or queue fills again */ + while ((NULL != xb_kick_pending_head) && (FALSE == xb_kick_pending)) { + struct xb_softc *xb_cur = xb_kick_pending_head; + xb_kick_pending_head = xb_cur->xb_next_blocked; + if(NULL == xb_kick_pending_head) { + xb_kick_pending_tail = NULL; + } + xb_cur->xb_next_blocked = NULL; + mtx_unlock_irqrestore(&blkif_io_block_lock, flags); + xb_startio(xb_cur); + mtx_lock_irqsave(&blkif_io_block_lock, flags); + } + mtx_unlock_irqrestore(&blkif_io_block_lock, flags); + + if(blk_ring.rsp_cons != blk_ring.sring->rsp_prod) { + /* Consume those, too */ + goto process_rcvd; + } } mtx_unlock_irqrestore(&blkif_io_lock, flags); @@ -448,8 +472,22 @@ xb_startio(struct xb_softc *sc) } - if (RING_FULL(&blk_ring)) + if (RING_FULL(&blk_ring)) { + unsigned long flags; + mtx_lock_irqsave(&blkif_io_block_lock, flags); xb_kick_pending = TRUE; + /* If we are not already on blocked list, add us */ + if((NULL == sc->xb_next_blocked) && (xb_kick_pending_tail != sc)) { + + if(NULL == xb_kick_pending_head) { + xb_kick_pending_head = xb_kick_pending_tail = sc; + } else { + xb_kick_pending_tail->xb_next_blocked = sc; + xb_kick_pending_tail = sc; + } + } + mtx_unlock_irqrestore(&blkif_io_block_lock, flags); + } if (queued != 0) flush_requests(); @@ -501,6 +539,7 @@ xb_create(int unit) sc = (struct xb_softc *)malloc(sizeof(*sc), M_DEVBUF, M_WAITOK); sc->xb_unit = unit; + sc->xb_next_blocked = NULL; memset(&sc->xb_disk, 0, sizeof(sc->xb_disk)); sc->xb_disk.d_unit = unit; @@ -947,7 +986,10 @@ xb_init(void *unused) return; printk("Blkif frontend is using grant tables.\n"); #endif - + + xb_kick_pending = FALSE; + xb_kick_pending_head = NULL; + xb_kick_pending_tail = NULL; rec_ring_free = 0; for (i = 0; i < BLK_RING_SIZE; i++) { @@ -1002,4 +1044,5 @@ blkif_completion(blkif_request_t *req) #endif } MTX_SYSINIT(ioreq, &blkif_io_lock, "BIO LOCK", MTX_SPIN | MTX_NOWITNESS); /* XXX how does one enroll a lock? */ + MTX_SYSINIT(ioreq_block, &blkif_io_block_lock, "BIO BLOCK LOCK", MTX_SPIN | MTX_NOWITNESS); SYSINIT(xbdev, SI_SUB_PSEUDO, SI_ORDER_ANY, xb_init, NULL) From 47d73f74d890101e11825b1101c37af1414d672c Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 2 May 2005 08:38:46 +0000 Subject: [PATCH 25/36] bitkeeper revision 1.1389.1.23 (4275e716ZM2AFvimq_UhqQK8jiiq5g) Fix xc_ptrace interface to get rid of pid_t. Signed-off-by: Keir Fraser --- tools/libxc/xc.h | 4 ++-- tools/libxc/xc_ptrace.c | 2 +- tools/libxc/xc_ptrace_core.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/libxc/xc.h b/tools/libxc/xc.h index 80a3914208..d9c4414e30 100644 --- a/tools/libxc/xc.h +++ b/tools/libxc/xc.h @@ -87,12 +87,12 @@ typedef struct xc_core_header { long xc_ptrace(enum __ptrace_request request, - pid_t pid, + u32 domid, long addr, long data); long xc_ptrace_core(enum __ptrace_request request, - pid_t pid, + u32 domid, long addr, long data); diff --git a/tools/libxc/xc_ptrace.c b/tools/libxc/xc_ptrace.c index 287680573f..63efdd7cb9 100644 --- a/tools/libxc/xc_ptrace.c +++ b/tools/libxc/xc_ptrace.c @@ -259,7 +259,7 @@ xc_waitdomain(int domain, int *status, int options) } long -xc_ptrace(enum __ptrace_request request, pid_t domid, long eaddr, long edata) +xc_ptrace(enum __ptrace_request request, u32 domid, long eaddr, long edata) { dom0_op_t op; int status = 0; diff --git a/tools/libxc/xc_ptrace_core.c b/tools/libxc/xc_ptrace_core.c index 87b88edf3d..a936bd8b42 100644 --- a/tools/libxc/xc_ptrace_core.c +++ b/tools/libxc/xc_ptrace_core.c @@ -213,7 +213,7 @@ xc_waitdomain_core(int domfd, int *status, int options) } long -xc_ptrace_core(enum __ptrace_request request, int domfd, long eaddr, long edata) +xc_ptrace_core(enum __ptrace_request request, u32 domfd, long eaddr, long edata) { int status = 0; struct gdb_regs pt; From d431485326cac9746f8ff6ebcbcc9df425d7875b Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 2 May 2005 10:17:29 +0000 Subject: [PATCH 26/36] bitkeeper revision 1.1389.1.24 (4275fe39zl4LNqHkDr0esLqsvTaLoA) Fix ioemu makefile to not use 'uname -i'. Signed-off-by: Keir Fraser --- tools/ioemu/iodev/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/ioemu/iodev/Makefile b/tools/ioemu/iodev/Makefile index 05c09791f1..e56e3862cf 100644 --- a/tools/ioemu/iodev/Makefile +++ b/tools/ioemu/iodev/Makefile @@ -4,8 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk TOPDIR= .. CXXFLAGS=-I. -I../include -I.. -ARCH=$(shell uname -i) -ifeq ($(ARCH), i386) +ifeq ($(XEN_TARGET_ARCH), x86_32) CXXFLAGS+=-D_FILE_OFFSET_BITS=64 endif From c043f762e14b35a8a128427f941f78af78c1327a Mon Sep 17 00:00:00 2001 From: "kmacy@netapp.com[kaf24]" Date: Mon, 2 May 2005 13:50:40 +0000 Subject: [PATCH 27/36] bitkeeper revision 1.1389.1.25 (42763030SYN-c5A47iaiRMSIUFsKbA) [PATCH] [PATCH] fix booting with SMP enabled Let me know if pine has messed up the patch the way gmail does. # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/04/30 16:07:55-07:00 kmacy@curly.lab.netapp.com # Make FreeBSD work with SMP enabled again # Kip Macy # # BitKeeper/etc/logging_ok # 2005/04/30 16:07:54-07:00 kmacy@curly.lab.netapp.com +1 -0 # Logging to logging@openlogging.org accepted # # freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c # 2005/04/30 16:07:39-07:00 kmacy@curly.lab.netapp.com +22 -12 # Do shadow directory initialization before SMP page table setup # # freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c # 2005/04/30 16:07:39-07:00 kmacy@curly.lab.netapp.com +2 -1 # Don't try to probe apics # --- .../i386-xen/i386-xen/local_apic.c | 3 +- .../i386-xen/i386-xen/machdep.c | 34 ++++++++++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c index 8fb7f9f12e..7b8fa1b2e5 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c @@ -545,7 +545,6 @@ apic_register_enumerator(struct apic_enumerator *enumerator) static void apic_init(void *dummy __unused) { - struct apic_enumerator *enumerator; uint64_t apic_base; int retval, best; @@ -560,6 +559,7 @@ apic_init(void *dummy __unused) /* First, probe all the enumerators to find the best match. */ best_enum = NULL; best = 0; +#ifndef XEN SLIST_FOREACH(enumerator, &enumerators, apic_next) { retval = enumerator->apic_probe(); if (retval > 0) @@ -569,6 +569,7 @@ apic_init(void *dummy __unused) best = retval; } } +#endif if (best_enum == NULL) { if (bootverbose) printf("APIC: Could not find any APICs.\n"); diff --git a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c index b61d9ceeb4..ba1adb1de9 100644 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c @@ -1386,6 +1386,7 @@ initvalues(start_info_t *startinfo) { int i; vm_paddr_t pdir_shadow_ma, KPTphys; + vm_offset_t *pdir_shadow; #ifdef WRITABLE_PAGETABLES printk("using writable pagetables\n"); HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); @@ -1424,6 +1425,27 @@ initvalues(start_info_t *startinfo) /* allocate page for ldt */ ldt = (union descriptor *)(KERNBASE + (tmpindex << PAGE_SHIFT)); tmpindex++; + + /* initialize page directory shadow page */ + pdir_shadow = (vm_offset_t *)(KERNBASE + (tmpindex << PAGE_SHIFT)); + i686_pagezero(pdir_shadow); + pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT); + PT_SET_MA(pdir_shadow, pdir_shadow_ma | PG_V | PG_A); + tmpindex++; + + /* setup shadow mapping first so vtomach will work */ + xen_pt_pin((vm_paddr_t)pdir_shadow_ma); + xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), + pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M); + xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), + ((vm_paddr_t)IdlePTD) | PG_V | PG_A); + xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), + KPTphys | PG_V | PG_A); + + xen_flush_queue(); + /* allocate remainder of NKPT pages */ + + #ifdef SMP /* allocate cpu0 private page */ cpu0prvpage = (KERNBASE + (tmpindex << PAGE_SHIFT)); @@ -1458,18 +1480,6 @@ initvalues(start_info_t *startinfo) xen_queue_pt_update(KPTphys + i*sizeof(vm_paddr_t), 0); xen_flush_queue(); - pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT); - tmpindex++; - - /* setup shadow mapping first so vtomach will work */ - xen_pt_pin((vm_paddr_t)pdir_shadow_ma); - xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), - pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M); - xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), - ((vm_paddr_t)IdlePTD) | PG_V | PG_A); - xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), - KPTphys | PG_V | PG_A); - /* allocate remainder of NKPT pages */ for (i = 0; i < NKPT-1; i++, tmpindex++) { xen_queue_pt_update((vm_paddr_t)(IdlePTD + KPTDI + i + 1), From 12b6d1516680421ecd512cb4651aedbaa2db7968 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 2 May 2005 16:01:00 +0000 Subject: [PATCH 28/36] bitkeeper revision 1.1389.1.26 (42764ebcQUGB5SU0NuOL0gHMTOa--A) Fix int3 handling in cdb. They're harmless. Signed-off-by: Keir Fraser --- xen/include/asm-x86/debugger.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index 877aa3b5e8..5b7af3badc 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -42,7 +42,14 @@ extern int __trap_to_cdb(struct cpu_user_regs *r); #define debugger_trap_entry(_v, _r) (0) -#define debugger_trap_fatal(_v, _r) __trap_to_cdb(_r) + +static inline int debugger_trap_fatal( + unsigned int vector, struct cpu_user_regs *regs) +{ + (void)__trap_to_cdb(regs); + return (vector == TRAP_int3); /* int3 is harmless */ +} + /* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); From 7659373e1b956a7bd445ec2784561e8d9de7699e Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 2 May 2005 16:07:35 +0000 Subject: [PATCH 29/36] bitkeeper revision 1.1389.1.27 (42765047QI9d01CBiVyH-bBFAhM6lQ) Add '-g' compile option on debug builds. Signed-off-by: Keir Fraser --- xen/Rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index cf30a12ef7..955ace1f9d 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -42,7 +42,7 @@ ifeq ($(verbose),y) CFLAGS += -DVERBOSE endif else -CFLAGS += -DVERBOSE +CFLAGS += -g -DVERBOSE endif ifeq ($(domu_debug),y) From d116f2b58d2cbdafc61471fe1dc53ebc79db162e Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Mon, 2 May 2005 17:34:28 +0000 Subject: [PATCH 30/36] bitkeeper revision 1.1327.1.19 (427664a4ddicjiXeRHKCKKrSnBvjug) Last round of cleanup (for now) --- .rootkeys | 1 - xen/arch/ia64/Makefile | 2 +- xen/arch/ia64/patch/linux-2.6.11/page.h | 58 ++--- xen/arch/ia64/patch/linux-2.6.11/pgalloc.h | 68 +++--- xen/arch/ia64/patch/linux-2.6.11/setup.c | 212 ++++------------ xen/arch/ia64/patch/linux-2.6.11/swiotlb.c | 77 ------ xen/arch/ia64/patch/linux-2.6.11/system.h | 24 +- xen/arch/ia64/patch/linux-2.6.11/time.c | 272 ++------------------- xen/arch/ia64/patch/linux-2.6.11/tlb.c | 27 +- xen/arch/ia64/tools/mkbuildtree | 16 +- xen/arch/ia64/xenmisc.c | 8 +- xen/arch/ia64/xensetup.c | 9 +- xen/include/asm-ia64/config.h | 24 +- 13 files changed, 169 insertions(+), 629 deletions(-) delete mode 100644 xen/arch/ia64/patch/linux-2.6.11/swiotlb.c diff --git a/.rootkeys b/.rootkeys index f24cbca0ed..c6b829b733 100644 --- a/.rootkeys +++ b/.rootkeys @@ -1100,7 +1100,6 @@ 425ae516EWaNOBEnc1xnphTbRmNZsw xen/arch/ia64/patch/linux-2.6.11/processor.h 425ae516LecDyXlwh3NLBtHZKXmMcA xen/arch/ia64/patch/linux-2.6.11/series 425ae516RFiPn2CGkpJ21LM-1lJcQg xen/arch/ia64/patch/linux-2.6.11/setup.c -425ae516FX_10YaKGMU8Ysf7kkdm_A xen/arch/ia64/patch/linux-2.6.11/swiotlb.c 425ae516p4ICTkjqNYEfYFxqULj4dw xen/arch/ia64/patch/linux-2.6.11/system.h 425ae516juUB257qrwUdsL9AsswrqQ xen/arch/ia64/patch/linux-2.6.11/time.c 425ae5167zQn7zYcgKtDUDX2v-e8mw xen/arch/ia64/patch/linux-2.6.11/tlb.c diff --git a/xen/arch/ia64/Makefile b/xen/arch/ia64/Makefile index 85d817079a..36d7b845b3 100644 --- a/xen/arch/ia64/Makefile +++ b/xen/arch/ia64/Makefile @@ -7,7 +7,7 @@ OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \ machvec.o dom0_ops.o domain.o \ idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \ xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \ - extable.o linuxextable.o xenirq.o \ + extable.o linuxextable.o xenirq.o xentime.o \ regionreg.o entry.o unaligned.o privop.o vcpu.o \ irq_ia64.o irq_lsapic.o vhpt.o xenasm.o dom_fw.o # perfmon.o diff --git a/xen/arch/ia64/patch/linux-2.6.11/page.h b/xen/arch/ia64/patch/linux-2.6.11/page.h index 67016a5366..cd6b281224 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/page.h +++ b/xen/arch/ia64/patch/linux-2.6.11/page.h @@ -1,52 +1,34 @@ - page.h | 42 +++++++++++++++++++++++++++++++++++++++--- - 1 files changed, 39 insertions(+), 3 deletions(-) - -Index: linux-2.6.11-xendiffs/include/asm-ia64/page.h -=================================================================== ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/page.h 2005-04-06 22:58:07.597539393 -0500 -+++ linux-2.6.11-xendiffs/include/asm-ia64/page.h 2005-04-06 23:06:15.908576975 -0500 -@@ -12,6 +12,9 @@ - #include - #include - -+#ifndef __ASSEMBLY__ -+#include -+#endif - /* - * PAGE_SHIFT determines the actual kernel page size. - */ -@@ -95,9 +98,11 @@ extern int ia64_pfn_valid (unsigned long +--- ../../linux-2.6.11/include/asm-ia64/page.h 2005-03-02 00:37:48.000000000 -0700 ++++ include/asm-ia64/page.h 2005-05-02 11:25:33.000000000 -0600 +@@ -95,9 +95,15 @@ #endif #ifndef CONFIG_DISCONTIGMEM +#ifdef XEN -+#define pfn_valid(pfn) (0) ++# define pfn_valid(pfn) (0) ++# define page_to_pfn(_page) ((unsigned long)((_page) - frame_table)) ++# define pfn_to_page(_pfn) (frame_table + (_pfn)) +#else # define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn)) --# define page_to_pfn(page) ((unsigned long) (page - mem_map)) --# define pfn_to_page(pfn) (mem_map + (pfn)) + # define page_to_pfn(page) ((unsigned long) (page - mem_map)) + # define pfn_to_page(pfn) (mem_map + (pfn)) +#endif #else extern struct page *vmem_map; extern unsigned long max_low_pfn; -@@ -106,9 +111,15 @@ extern unsigned long max_low_pfn; - # define pfn_to_page(pfn) (vmem_map + (pfn)) - #endif - --#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) -+#define page_to_pfn(_page) ((unsigned long)((_page) - frame_table)) -+#define page_to_virt(_page) phys_to_virt(page_to_phys(_page)) -+ -+#define page_to_phys(_page) (page_to_pfn(_page) << PAGE_SHIFT) +@@ -109,6 +115,11 @@ + #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -+#define pfn_to_page(_pfn) (frame_table + (_pfn)) ++#ifdef XEN ++#define page_to_virt(_page) phys_to_virt(page_to_phys(_page)) +#define phys_to_page(kaddr) pfn_to_page(((kaddr) >> PAGE_SHIFT)) ++#endif + typedef union ia64_va { struct { unsigned long off : 61; /* intra-region offset */ -@@ -124,8 +135,25 @@ typedef union ia64_va { +@@ -124,8 +135,23 @@ * expressed in this way to ensure they result in a single "dep" * instruction. */ @@ -63,8 +45,6 @@ Index: linux-2.6.11-xendiffs/include/asm-ia64/page.h +// xen/drivers/console.c uses __va in a declaration (should be fixed!) +#define __pa(x) ({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;}) +#define __va(x) ({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;}) -+//# define __pa(x) ((unsigned long)(((unsigned long)x) - PAGE_OFFSET)) -+//# define __va(x) ((void *)((char *)(x) + PAGE_OFFSET)) +#else #define __pa(x) ({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;}) #define __va(x) ({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;}) @@ -72,7 +52,7 @@ Index: linux-2.6.11-xendiffs/include/asm-ia64/page.h #define REGION_NUMBER(x) ({ia64_va _v; _v.l = (long) (x); _v.f.reg;}) #define REGION_OFFSET(x) ({ia64_va _v; _v.l = (long) (x); _v.f.off;}) -@@ -197,11 +225,19 @@ get_order (unsigned long size) +@@ -197,7 +223,11 @@ # define __pgprot(x) (x) #endif /* !STRICT_MM_TYPECHECKS */ @@ -84,11 +64,3 @@ Index: linux-2.6.11-xendiffs/include/asm-ia64/page.h #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | \ - (((current->personality & READ_IMPLIES_EXEC) != 0) \ - ? VM_EXEC : 0)) - -+#ifdef XEN -+#define __flush_tlb() do {} while(0); -+#endif -+ - #endif /* _ASM_IA64_PAGE_H */ diff --git a/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h index 17df69771f..be8e0bdd42 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h +++ b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h @@ -1,78 +1,72 @@ - pgalloc.h | 17 +++++++++++------ - 1 files changed, 11 insertions(+), 6 deletions(-) - -Index: linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h -=================================================================== ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/pgalloc.h 2005-04-08 11:57:30.909774800 -0500 -+++ linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h 2005-04-08 11:58:08.102711219 -0500 -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - #include - - #include -@@ -34,6 +35,10 @@ - #define pmd_quicklist (local_cpu_data->pmd_quick) - #define pgtable_cache_size (local_cpu_data->pgtable_cache_sz) - -+/* FIXME: Later 3 level page table should be over, to create -+ * new interface upon xen memory allocator. To simplify first -+ * effort moving to xen allocator, use xenheap pages temporarily. -+ */ - static inline pgd_t* - pgd_alloc_one_fast (struct mm_struct *mm) - { -@@ -61,7 +66,7 @@ pgd_alloc (struct mm_struct *mm) +--- ../../linux-2.6.11/include/asm-ia64/pgalloc.h 2005-03-02 00:37:31.000000000 -0700 ++++ include/asm-ia64/pgalloc.h 2005-04-29 17:09:20.000000000 -0600 +@@ -61,7 +61,11 @@ pgd_t *pgd = pgd_alloc_one_fast(mm); if (unlikely(pgd == NULL)) { -- pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); ++#ifdef XEN + pgd = (pgd_t *)alloc_xenheap_page(); ++#else + pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); ++#endif } return pgd; } -@@ -104,7 +109,7 @@ pmd_alloc_one_fast (struct mm_struct *mm +@@ -104,7 +108,11 @@ static inline pmd_t* pmd_alloc_one (struct mm_struct *mm, unsigned long addr) { -- pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); ++#ifdef XEN + pmd_t *pmd = (pmd_t *)alloc_xenheap_page(); ++#else + pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); ++#endif return pmd; } -@@ -136,7 +141,7 @@ pmd_populate_kernel (struct mm_struct *m +@@ -136,7 +144,11 @@ static inline struct page * pte_alloc_one (struct mm_struct *mm, unsigned long addr) { -- struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); ++#ifdef XEN + struct page *pte = alloc_xenheap_page(); ++#else + struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); ++#endif return pte; } -@@ -144,7 +149,7 @@ pte_alloc_one (struct mm_struct *mm, uns +@@ -144,7 +156,11 @@ static inline pte_t * pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr) { -- pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); ++#ifdef XEN + pte_t *pte = (pte_t *)alloc_xenheap_page(); ++#else + pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); ++#endif return pte; } -@@ -152,13 +157,13 @@ pte_alloc_one_kernel (struct mm_struct * +@@ -152,13 +168,21 @@ static inline void pte_free (struct page *pte) { -- __free_page(pte); ++#ifdef XEN + free_xenheap_page(pte); ++#else + __free_page(pte); ++#endif } static inline void pte_free_kernel (pte_t *pte) { -- free_page((unsigned long) pte); ++#ifdef XEN + free_xenheap_page((unsigned long) pte); ++#else + free_page((unsigned long) pte); ++#endif } #define __pte_free_tlb(tlb, pte) tlb_remove_page((tlb), (pte)) diff --git a/xen/arch/ia64/patch/linux-2.6.11/setup.c b/xen/arch/ia64/patch/linux-2.6.11/setup.c index 2b95625f90..5d7afce326 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/setup.c +++ b/xen/arch/ia64/patch/linux-2.6.11/setup.c @@ -1,191 +1,96 @@ - setup.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++------------- - 1 files changed, 58 insertions(+), 14 deletions(-) - -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/setup.c 2005-04-07 17:44:13.294980153 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c 2005-04-07 17:46:37.157717072 -0500 -@@ -21,6 +21,9 @@ - #include - - #include -+#ifdef XEN -+#include -+#endif - #include - #include - #include -@@ -30,13 +33,17 @@ - #include - #include - #include -+#ifndef XEN - #include - #include - #include -+#endif - #include - #include - -+#ifndef XEN - #include -+#endif - #include - #include - #include -@@ -51,6 +58,12 @@ - #include - #include - #include -+#ifdef XEN -+#include -+#include -+extern unsigned long loops_per_jiffy; // from linux/init/main.c -+char saved_command_line[COMMAND_LINE_SIZE]; // from linux/init/main.c -+#endif - - #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE) - # error "struct cpuinfo_ia64 too big!" -@@ -66,7 +79,9 @@ DEFINE_PER_CPU(unsigned long, local_per_ - DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8); - unsigned long ia64_cycles_per_usec; - struct ia64_boot_param *ia64_boot_param; -+#ifndef XEN - struct screen_info screen_info; -+#endif - - unsigned long ia64_max_cacheline_size; - unsigned long ia64_iobase; /* virtual address for I/O accesses */ -@@ -95,7 +110,6 @@ EXPORT_SYMBOL(ia64_max_iommu_merge_mask) - struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1]; - int num_rsvd_regions; - -- - /* - * Filter incoming memory segments based on the primitive map created from the boot - * parameters. Segments contained in the map are removed from the memory ranges. A -@@ -125,9 +139,12 @@ filter_rsvd_memory (unsigned long start, - for (i = 0; i < num_rsvd_regions; ++i) { - range_start = max(start, prev_start); +--- ../../linux-2.6.11/arch/ia64/kernel/setup.c 2005-03-02 00:37:49.000000000 -0700 ++++ arch/ia64/setup.c 2005-05-02 10:04:03.000000000 -0600 +@@ -127,7 +127,16 @@ range_end = min(end, rsvd_region[i].start); -- -- if (range_start < range_end) -- call_pernode_memory(__pa(range_start), range_end - range_start, func); + + if (range_start < range_end) ++#ifdef XEN ++ { + /* init_boot_pages requires "ps, pe" */ -+ if (range_start < range_end) { + printk("Init boot pages: 0x%lx -> 0x%lx.\n", + __pa(range_start), __pa(range_end)); + (*func)(__pa(range_start), __pa(range_end), 0); + } ++#else + call_pernode_memory(__pa(range_start), range_end - range_start, func); ++#endif /* nothing more available in this segment */ if (range_end == end) return 0; -@@ -184,17 +201,17 @@ reserve_memory (void) - + strlen(__va(ia64_boot_param->command_line)) + 1); +@@ -185,7 +194,12 @@ n++; -+ /* Reserve xen image/bitmap/xen-heap */ rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START); -- rsvd_region[n].end = (unsigned long) ia64_imva(_end); ++#ifdef XEN ++ /* Reserve xen image/bitmap/xen-heap */ + rsvd_region[n].end = rsvd_region[n].start + xenheap_size; ++#else + rsvd_region[n].end = (unsigned long) ia64_imva(_end); ++#endif n++; --#ifdef CONFIG_BLK_DEV_INITRD -+ /* This is actually dom0 image */ - if (ia64_boot_param->initrd_start) { - rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start); - rsvd_region[n].end = rsvd_region[n].start + ia64_boot_param->initrd_size; - n++; - } --#endif - - /* end of memory marker */ - rsvd_region[n].start = ~0UL; -@@ -204,6 +221,16 @@ reserve_memory (void) - num_rsvd_regions = n; - - sort_regions(rsvd_region, num_rsvd_regions); -+ -+ { -+ int i; -+ printk("Reserved regions: \n"); -+ for (i = 0; i < num_rsvd_regions; i++) -+ printk(" [%d] -> [0x%lx, 0x%lx]\n", -+ i, -+ rsvd_region[i].start, -+ rsvd_region[i].end); -+ } + #ifdef CONFIG_BLK_DEV_INITRD +@@ -299,7 +313,11 @@ } - /** -@@ -298,18 +325,17 @@ mark_bsp_online (void) - #endif - } - -+#ifdef XEN void __init --setup_arch (char **cmdline_p) ++#ifdef XEN +early_setup_arch (char **cmdline_p) ++#else + setup_arch (char **cmdline_p) ++#endif { unw_init(); -- ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist); -- +@@ -308,8 +326,14 @@ *cmdline_p = __va(ia64_boot_param->command_line); strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE); -+ cmdline_parse(*cmdline_p); ++#ifdef XEN ++ cmdline_parse(*cmdline_p); ++#undef CONFIG_ACPI_BOOT ++#endif efi_init(); -- io_port_init(); ++#ifndef XEN + io_port_init(); ++#endif #ifdef CONFIG_IA64_GENERIC { -@@ -339,6 +365,10 @@ setup_arch (char **cmdline_p) - if (early_console_setup(*cmdline_p) == 0) - mark_bsp_online(); - -+#ifdef XEN -+#undef CONFIG_ACPI_BOOT -+#endif -+ - #ifdef CONFIG_ACPI_BOOT - /* Initialize the ACPI boot-time table parser */ - acpi_table_init(); -@@ -350,9 +380,13 @@ setup_arch (char **cmdline_p) - smp_build_cpu_map(); /* happens, e.g., with the Ski simulator */ +@@ -351,8 +375,17 @@ # endif #endif /* CONFIG_APCI_BOOT */ + ++#ifndef XEN + find_memory(); ++#else + io_port_init(); +} -+#endif -- find_memory(); -- +void __init -+setup_arch (void) ++late_setup_arch (char **cmdline_p) +{ ++#undef CONFIG_ACPI_BOOT ++#endif /* process SAL system table: */ ia64_sal_init(efi.sal_systab); -@@ -388,7 +422,6 @@ setup_arch (char **cmdline_p) - if (!strstr(saved_command_line, "nomca")) - ia64_mca_init(); - -- platform_setup(cmdline_p); - paging_init(); +@@ -492,12 +525,14 @@ + { } -@@ -448,6 +481,9 @@ show_cpuinfo (struct seq_file *m, void * - sprintf(cp, " 0x%lx", mask); - } - -+#ifdef XEN -+#define seq_printf(a,b...) printf(b) ++#ifndef XEN + struct seq_operations cpuinfo_op = { + .start = c_start, + .next = c_next, + .stop = c_stop, + .show = show_cpuinfo + }; +#endif - seq_printf(m, - "processor : %d\n" - "vendor : %s\n" -@@ -659,11 +695,17 @@ cpu_init (void) + + void + identify_cpu (struct cpuinfo_ia64 *c) +@@ -659,7 +694,11 @@ | IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC)); atomic_inc(&init_mm.mm_count); current->active_mm = &init_mm; @@ -197,18 +102,3 @@ Index: linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c BUG(); ia64_mmu_init(ia64_imva(cpu_data)); -+#ifndef XEN - ia64_mca_cpu_init(ia64_imva(cpu_data)); -+#endif - - #ifdef CONFIG_IA32_SUPPORT - ia32_cpu_init(); -@@ -711,6 +753,8 @@ cpu_init (void) - void - check_bugs (void) - { -+#ifndef XEN - ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles, - (unsigned long) __end___mckinley_e9_bundles); -+#endif - } diff --git a/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c deleted file mode 100644 index 77fff5e2ec..0000000000 --- a/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c +++ /dev/null @@ -1,77 +0,0 @@ - swiotlb.c | 21 +++++++++++++-------- - 1 files changed, 13 insertions(+), 8 deletions(-) - -Index: linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/lib/swiotlb.c 2005-04-08 12:13:54.040202667 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c 2005-04-08 12:19:09.170367318 -0500 -@@ -124,8 +124,11 @@ swiotlb_init_with_default_size (size_t d - /* - * Get IO TLB memory from the low pages - */ -- io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs * -- (1 << IO_TLB_SHIFT)); -+ /* FIXME: Do we really need swiotlb in HV? If all memory trunks -+ * presented to guest as <4G, are actually <4G in machine range, -+ * no DMA intevention from HV... -+ */ -+ io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT))); - if (!io_tlb_start) - panic("Cannot allocate SWIOTLB buffer"); - io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT); -@@ -135,16 +138,16 @@ swiotlb_init_with_default_size (size_t d - * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE - * between io_tlb_start and io_tlb_end. - */ -- io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int)); -+ io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(int))); - for (i = 0; i < io_tlb_nslabs; i++) - io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); - io_tlb_index = 0; -- io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *)); -+ io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(char *))); - - /* - * Get the overflow emergency buffer - */ -- io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow); -+ io_tlb_overflow_buffer = alloc_xenheap_pages(get_order(io_tlb_overflow)); - printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n", - virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end)); - } -@@ -328,13 +331,13 @@ swiotlb_alloc_coherent(struct device *hw - */ - flags |= GFP_DMA; - -- ret = (void *)__get_free_pages(flags, order); -+ ret = (void *)alloc_xenheap_pages(get_order(size)); - if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) { - /* - * The allocated memory isn't reachable by the device. - * Fall back on swiotlb_map_single(). - */ -- free_pages((unsigned long) ret, order); -+ free_xenheap_pages((unsigned long) ret, order); - ret = NULL; - } - if (!ret) { -@@ -372,7 +375,7 @@ swiotlb_free_coherent(struct device *hwd - { - if (!(vaddr >= (void *)io_tlb_start - && vaddr < (void *)io_tlb_end)) -- free_pages((unsigned long) vaddr, get_order(size)); -+ free_xenheap_pages((unsigned long) vaddr, get_order(size)); - else - /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ - swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE); -@@ -388,8 +391,10 @@ swiotlb_full(struct device *dev, size_t - * When the mapping is small enough return a static buffer to limit - * the damage, or panic when the transfer is too big. - */ -+#ifndef XEN - printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %lu bytes at " - "device %s\n", size, dev ? dev->bus_id : "?"); -+#endif - - if (size > io_tlb_overflow && do_panic) { - if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL) diff --git a/xen/arch/ia64/patch/linux-2.6.11/system.h b/xen/arch/ia64/patch/linux-2.6.11/system.h index 032c47f80d..e31d332c2b 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/system.h +++ b/xen/arch/ia64/patch/linux-2.6.11/system.h @@ -1,16 +1,10 @@ - system.h | 15 +++++++++++++++ - 1 files changed, 15 insertions(+) - -Index: linux-2.6.11-xendiffs/include/asm-ia64/system.h -=================================================================== ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/system.h 2005-04-07 10:39:11.066701457 -0500 -+++ linux-2.6.11-xendiffs/include/asm-ia64/system.h 2005-04-07 10:40:19.540544127 -0500 -@@ -24,8 +24,16 @@ +--- ../../linux-2.6.11/include/asm-ia64/system.h 2005-03-02 00:38:07.000000000 -0700 ++++ include/asm-ia64/system.h 2005-05-02 10:18:30.000000000 -0600 +@@ -24,8 +24,15 @@ * 0xa000000000000000+2*PERCPU_PAGE_SIZE * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page) */ +#ifdef XEN -+//#define KERNEL_START 0xf000000100000000 +#define KERNEL_START 0xf000000004000000 +#define PERCPU_ADDR 0xf100000000000000-PERCPU_PAGE_SIZE +#define SHAREDINFO_ADDR 0xf100000000000000 @@ -22,7 +16,7 @@ Index: linux-2.6.11-xendiffs/include/asm-ia64/system.h #ifndef __ASSEMBLY__ -@@ -218,9 +226,13 @@ extern void ia64_load_extra (struct task +@@ -218,9 +225,13 @@ # define PERFMON_IS_SYSWIDE() (0) #endif @@ -36,13 +30,3 @@ Index: linux-2.6.11-xendiffs/include/asm-ia64/system.h #define __switch_to(prev,next,last) do { \ if (IA64_HAS_EXTRA_STATE(prev)) \ -@@ -249,6 +261,9 @@ extern void ia64_load_extra (struct task - #else - # define switch_to(prev,next,last) __switch_to(prev, next, last) - #endif -+//#ifdef XEN -+//#undef switch_to -+//#endif - - /* - * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch, diff --git a/xen/arch/ia64/patch/linux-2.6.11/time.c b/xen/arch/ia64/patch/linux-2.6.11/time.c index 8df14e4311..9e480b969e 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/time.c +++ b/xen/arch/ia64/patch/linux-2.6.11/time.c @@ -1,259 +1,32 @@ --- ../../linux-2.6.11/arch/ia64/kernel/time.c 2005-03-02 00:37:50.000000000 -0700 -+++ arch/ia64/time.c 2005-04-28 14:29:58.000000000 -0600 -@@ -10,16 +10,22 @@ - */ - #include - -+#ifndef XEN - #include -+#endif - #include - #include - #include -+#ifndef XEN - #include -+#endif - #include - #include - #include - #include -+#ifndef XEN - #include -+#endif - #include - - #include -@@ -29,10 +35,19 @@ ++++ arch/ia64/time.c 2005-05-02 11:19:29.000000000 -0600 +@@ -29,6 +29,9 @@ #include #include #include +#ifdef XEN -+#include ++#include // not included by xen/sched.h +#endif extern unsigned long wall_jiffies; -+#ifndef XEN - u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES; -+#else -+#define INITIAL_JIFFIES 0 -+u64 jiffies_64 = INITIAL_JIFFIES; -+#define CPU_PROFILING 0 -+#endif - - EXPORT_SYMBOL(jiffies_64); - -@@ -45,33 +60,155 @@ +@@ -45,6 +48,7 @@ #endif -+#ifdef XEN -+volatile unsigned long last_nsec_offset; -+extern seqlock_t xtime_lock; -+unsigned long cpu_khz; /* Detected as we calibrate the TSC */ -+static s_time_t stime_irq; /* System time at last 'time update' */ -+ -+static inline u64 get_time_delta(void) -+{ -+ return ia64_get_itc(); -+} -+ -+s_time_t get_s_time(void) -+{ -+ s_time_t now; -+ unsigned long flags; -+ -+ read_lock_irqsave(&xtime_lock, flags); -+ -+ now = stime_irq + get_time_delta(); -+ -+ /* Ensure that the returned system time is monotonically increasing. */ -+ { -+ static s_time_t prev_now = 0; -+ if ( unlikely(now < prev_now) ) -+ now = prev_now; -+ prev_now = now; -+ } -+ -+ read_unlock_irqrestore(&xtime_lock, flags); -+ -+ return now; -+} -+ -+void update_dom_time(struct exec_domain *ed) -+{ -+// FIXME: implement this? -+// printf("update_dom_time: called, not implemented, skipping\n"); -+ return; -+} -+ -+/* Set clock to after 00:00:00 UTC, 1 January, 1970. */ -+void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base) -+{ -+// FIXME: Should this be do_settimeofday (from linux)??? -+ printf("do_settime: called, not implemented, stopping\n"); -+ dummy(); -+} -+#endif -+ -+#if 0 /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ -+#endif /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ -+ +#ifndef XEN static struct time_interpolator itc_interpolator = { .shift = 16, .mask = 0xffffffffffffffffLL, - .source = TIME_SOURCE_CPU - }; -+#endif -+ -+#ifdef XEN -+unsigned long domain0_ready = 0; // FIXME (see below) -+#define typecheck(a,b) 1 -+/* FROM linux/include/linux/jiffies.h */ -+/* -+ * These inlines deal with timer wrapping correctly. You are -+ * strongly encouraged to use them -+ * 1. Because people otherwise forget -+ * 2. Because if the timer wrap changes in future you won't have to -+ * alter your driver code. -+ * -+ * time_after(a,b) returns true if the time a is after time b. -+ * -+ * Do this with "<0" and ">=0" to only test the sign of the result. A -+ * good compiler would generate better code (and a really good compiler -+ * wouldn't care). Gcc is currently neither. -+ */ -+#define time_after(a,b) \ -+ (typecheck(unsigned long, a) && \ -+ typecheck(unsigned long, b) && \ -+ ((long)(b) - (long)(a) < 0)) -+#define time_before(a,b) time_after(b,a) -+ -+#define time_after_eq(a,b) \ -+ (typecheck(unsigned long, a) && \ -+ typecheck(unsigned long, b) && \ -+ ((long)(a) - (long)(b) >= 0)) -+#define time_before_eq(a,b) time_after_eq(b,a) -+#endif - - static irqreturn_t - timer_interrupt (int irq, void *dev_id, struct pt_regs *regs) - { - unsigned long new_itm; - -+#ifndef XEN - if (unlikely(cpu_is_offline(smp_processor_id()))) { - return IRQ_HANDLED; - } -+#endif -+#ifdef XEN -+ if (current->domain == dom0) { -+ // FIXME: there's gotta be a better way of doing this... -+ // We have to ensure that domain0 is launched before we -+ // call vcpu_timer_expired on it -+ //domain0_ready = 1; // moved to xensetup.c -+ current->vcpu_info->arch.pending_interruption = 1; -+ } -+ if (domain0_ready && vcpu_timer_expired(dom0->exec_domain[0])) { -+ vcpu_pend_timer(dom0->exec_domain[0]); -+ //vcpu_set_next_timer(dom0->exec_domain[0]); -+ domain_wake(dom0->exec_domain[0]); -+ } -+ if (!is_idle_task(current->domain) && current->domain != dom0) { -+ if (vcpu_timer_expired(current)) { -+ vcpu_pend_timer(current); -+ // ensure another timer interrupt happens even if domain doesn't -+ vcpu_set_next_timer(current); -+ domain_wake(current); -+ } -+ } -+ raise_actimer_softirq(); -+#endif - -+#ifndef XEN - platform_timer_interrupt(irq, dev_id, regs); -+#endif - - new_itm = local_cpu_data->itm_next; - - if (!time_after(ia64_get_itc(), new_itm)) -+#ifdef XEN -+ return; -+#else - printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)\n", - ia64_get_itc(), new_itm); -+#endif - -+#ifdef XEN -+// printf("GOT TO HERE!!!!!!!!!!!\n"); -+ //while(1); -+#else - profile_tick(CPU_PROFILING, regs); -+#endif - - while (1) { -+#ifndef XEN - update_process_times(user_mode(regs)); -+#endif - - new_itm += local_cpu_data->itm_delta; - -@@ -82,10 +219,16 @@ - * another CPU. We need to avoid to SMP race by acquiring the - * xtime_lock. - */ -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN - write_seqlock(&xtime_lock); -+#endif -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN - do_timer(regs); -+#endif - local_cpu_data->itm_next = new_itm; -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN - write_sequnlock(&xtime_lock); -+#endif - } else - local_cpu_data->itm_next = new_itm; - -@@ -105,7 +248,12 @@ - */ - while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2)) - new_itm += local_cpu_data->itm_delta; -+//#ifdef XEN -+// vcpu_set_next_timer(current); -+//#else -+//printf("***** timer_interrupt: Setting itm to %lx\n",new_itm); - ia64_set_itm(new_itm); -+//#endif - /* double check, in case we got hit by a (slow) PMI: */ +@@ -110,6 +114,7 @@ } while (time_after_eq(ia64_get_itc(), new_itm)); return IRQ_HANDLED; -@@ -120,6 +268,7 @@ - int cpu = smp_processor_id(); - unsigned long shift = 0, delta; - -+printf("ia64_cpu_local_tick: about to call ia64_set_itv\n"); - /* arrange for the cycle counter to generate a timer interrupt: */ - ia64_set_itv(IA64_TIMER_VECTOR); - -@@ -133,6 +282,7 @@ - shift = (2*(cpu - hi) + 1) * delta/hi/2; - } - local_cpu_data->itm_next = ia64_get_itc() + delta + shift; -+printf("***** ia64_cpu_local_tick: Setting itm to %lx\n",local_cpu_data->itm_next); - ia64_set_itm(local_cpu_data->itm_next); } ++#endif -@@ -160,6 +310,7 @@ - * frequency and then a PAL call to determine the frequency ratio between the ITC - * and the base frequency. - */ -+ - status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM, - &platform_base_freq, &platform_base_drift); - if (status != 0) { -@@ -212,6 +363,7 @@ + /* + * Encapsulate access to the itm structure for SMP. +@@ -212,6 +217,7 @@ + itc_freq/2)/itc_freq; if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) { @@ -261,7 +34,7 @@ itc_interpolator.frequency = local_cpu_data->itc_freq; itc_interpolator.drift = itc_drift; #ifdef CONFIG_SMP -@@ -228,6 +380,7 @@ +@@ -228,12 +234,14 @@ if (!nojitter) itc_interpolator.jitter = 1; #endif register_time_interpolator(&itc_interpolator); @@ -269,30 +42,15 @@ } /* Setup the CPU local timer tick */ -@@ -236,7 +389,9 @@ + ia64_cpu_local_tick(); + } ++#ifndef XEN static struct irqaction timer_irqaction = { .handler = timer_interrupt, -+#ifndef XEN .flags = SA_INTERRUPT, -+#endif - .name = "timer" - }; - -@@ -244,12 +399,16 @@ - time_init (void) - { - register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction); -+#ifndef XEN - efi_gettimeofday(&xtime); -+#endif - ia64_init_itm(); - -+#ifndef XEN - /* - * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the - * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC). +@@ -253,3 +261,4 @@ */ set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); -+#endif } ++#endif diff --git a/xen/arch/ia64/patch/linux-2.6.11/tlb.c b/xen/arch/ia64/patch/linux-2.6.11/tlb.c index 4bd3b6cf74..1a13908c62 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/tlb.c +++ b/xen/arch/ia64/patch/linux-2.6.11/tlb.c @@ -1,21 +1,6 @@ - tlb.c | 10 ++++++++++ - 1 files changed, 10 insertions(+) - -Index: linux-2.6.11/arch/ia64/mm/tlb.c -=================================================================== ---- linux-2.6.11.orig/arch/ia64/mm/tlb.c 2005-03-02 01:38:38.000000000 -0600 -+++ linux-2.6.11/arch/ia64/mm/tlb.c 2005-03-19 14:58:43.978400822 -0600 -@@ -21,7 +21,9 @@ - #include - #include - #include -+#ifndef XEN - #include -+#endif - - static struct { - unsigned long mask; /* mask of supported purge page-sizes */ -@@ -43,6 +45,9 @@ DEFINE_PER_CPU(u8, ia64_need_tlb_flush); +--- ../../linux-2.6.11/arch/ia64/mm/tlb.c 2005-03-02 00:38:38.000000000 -0700 ++++ arch/ia64/tlb.c 2005-05-02 10:23:09.000000000 -0600 +@@ -43,6 +43,9 @@ void wrap_mmu_context (struct mm_struct *mm) { @@ -25,7 +10,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c unsigned long tsk_context, max_ctx = ia64_ctx.max_ctx; struct task_struct *tsk; int i; -@@ -83,6 +88,7 @@ wrap_mmu_context (struct mm_struct *mm) +@@ -83,6 +86,7 @@ put_cpu(); } local_flush_tlb_all(); @@ -33,7 +18,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c } void -@@ -132,6 +138,9 @@ EXPORT_SYMBOL(local_flush_tlb_all); +@@ -132,6 +136,9 @@ void flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end) { @@ -43,7 +28,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c struct mm_struct *mm = vma->vm_mm; unsigned long size = end - start; unsigned long nbits; -@@ -163,6 +172,7 @@ flush_tlb_range (struct vm_area_struct * +@@ -163,6 +170,7 @@ # endif ia64_srlz_i(); /* srlz.i implies srlz.d */ diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index e4bb793899..0a60d12faf 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -142,7 +142,7 @@ softlink arch/ia64/lib/strlen_user.S arch/ia64/lib/strlen_user.S softlink arch/ia64/lib/strncpy_from_user.S arch/ia64/lib/strncpy_from_user.S softlink arch/ia64/lib/strnlen_user.S arch/ia64/lib/strnlen_user.S #softlink arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c -cp_patch arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c swiotlb.c +#cp_patch arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c swiotlb.c softlink arch/ia64/lib/xor.S arch/ia64/lib/xor.S softlink lib/cmdline.c arch/ia64/cmdline.c @@ -196,6 +196,8 @@ null include/asm-ia64/desc.h null include/asm-ia64/io_apic.h null include/asm-ia64/pdb.h null include/asm-ia64/module.h +null include/asm-ia64/ia32.h +null include/asm-ia64/tlbflush.h softlink include/asm-ia64/acpi.h include/asm-ia64/acpi.h softlink include/asm-ia64/asmmacro.h include/asm-ia64/asmmacro.h @@ -214,7 +216,7 @@ softlink include/asm-ia64/dma-mapping.h include/asm-ia64/dma-mapping.h softlink include/asm-ia64/errno.h include/asm-ia64/errno.h softlink include/asm-ia64/fpu.h include/asm-ia64/fpu.h softlink include/asm-ia64/hdreg.h include/asm-ia64/hdreg.h -softlink include/asm-ia64/ia32.h include/asm-ia64/ia32.h +#softlink include/asm-ia64/ia32.h include/asm-ia64/ia32.h softlink include/asm-ia64/ia64regs.h include/asm-ia64/ia64regs.h softlink include/asm-ia64/intrinsics.h include/asm-ia64/intrinsics.h softlink include/asm-ia64/ioctl.h include/asm-ia64/ioctl.h @@ -298,14 +300,15 @@ softlink include/linux/percpu.h include/asm-ia64/linux/percpu.h softlink include/linux/preempt.h include/asm-ia64/linux/preempt.h softlink include/linux/rbtree.h include/asm-ia64/linux/rbtree.h softlink include/linux/rwsem.h include/asm-ia64/linux/rwsem.h -softlink include/linux/seq_file.h include/asm-ia64/linux/seq_file.h -softlink include/linux/serial_core.h include/asm-ia64/linux/serial_core.h +#softlink include/linux/seq_file.h include/asm-ia64/linux/seq_file.h +#softlink include/linux/serial_core.h include/asm-ia64/linux/serial_core.h softlink include/linux/stddef.h include/asm-ia64/linux/stddef.h softlink include/linux/thread_info.h include/asm-ia64/linux/thread_info.h softlink include/linux/threads.h include/asm-ia64/linux/threads.h softlink include/linux/timex.h include/asm-ia64/linux/timex.h softlink include/linux/topology.h include/asm-ia64/linux/topology.h softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h +softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h null include/asm-ia64/linux/file.h null include/asm-ia64/linux/module.h @@ -317,12 +320,15 @@ null include/asm-ia64/linux/profile.h null include/asm-ia64/linux/seqlock.h null include/asm-ia64/linux/smp_lock.h null include/asm-ia64/linux/tty.h -null include/asm-ia64/linux/jiffies.h null include/asm-ia64/linux/kernel_stat.h null include/asm-ia64/linux/ptrace.h null include/asm-ia64/linux/random.h null include/asm-ia64/linux/signal.h null include/asm-ia64/linux/bootmem.h +null include/asm-ia64/linux/serial.h +null include/asm-ia64/linux/serial_core.h +null include/asm-ia64/linux/seq_file.h +null include/asm-ia64/linux/cpu.h softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h diff --git a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c index aac3bf8dd8..290b3296ab 100644 --- a/xen/arch/ia64/xenmisc.c +++ b/xen/arch/ia64/xenmisc.c @@ -27,7 +27,13 @@ unsigned int watchdog_on = 0; // from arch/x86/nmi.c ?!? void unw_init(void) { printf("unw_init() skipped (NEED FOR KERNEL UNWIND)\n"); } void ia64_mca_init(void) { printf("ia64_mca_init() skipped (Machine check abort handling)\n"); } -void hpsim_setup(char **x) { printf("hpsim_setup() skipped (MAY NEED FOR CONSOLE INPUT!!!)\n"); } +void ia64_mca_cpu_init(void *x) { } +void ia64_patch_mckinley_e9(unsigned long a, unsigned long b) { } +void ia64_patch_vtop(unsigned long a, unsigned long b) { } +void hpsim_setup(char **x) { } + +// called from mem_init... don't think s/w I/O tlb is needed in Xen +void swiotlb_init(void) { } long is_platform_hp_ski(void) diff --git a/xen/arch/ia64/xensetup.c b/xen/arch/ia64/xensetup.c index a15b754d68..2c24a872ea 100644 --- a/xen/arch/ia64/xensetup.c +++ b/xen/arch/ia64/xensetup.c @@ -18,9 +18,12 @@ #include #include #include +#include unsigned long xenheap_phys_end; +char saved_command_line[COMMAND_LINE_SIZE]; + struct exec_domain *idle_task[NR_CPUS] = { &idle0_exec_domain }; #ifdef CLONE_DOMAIN0 @@ -226,15 +229,15 @@ void start_kernel(void) (xenheap_phys_end-__pa(heap_start)) >> 20, (xenheap_phys_end-__pa(heap_start)) >> 10); - setup_arch(); + late_setup_arch(&cmdline); setup_per_cpu_areas(); mem_init(); printk("About to call scheduler_init()\n"); scheduler_init(); local_irq_disable(); -printk("About to call time_init()\n"); - time_init(); +printk("About to call xen_time_init()\n"); + xen_time_init(); printk("About to call ac_timer_init()\n"); ac_timer_init(); // init_xen_time(); ??? diff --git a/xen/include/asm-ia64/config.h b/xen/include/asm-ia64/config.h index c590f31423..74dbb3a4e5 100644 --- a/xen/include/asm-ia64/config.h +++ b/xen/include/asm-ia64/config.h @@ -14,8 +14,6 @@ // needed by include/asm-ia64/page.h #define CONFIG_IA64_PAGE_SIZE_16KB // 4KB doesn't work?!? #define CONFIG_IA64_GRANULE_16MB -// needed in arch/ia64/setup.c to reserve memory for domain0 -#define CONFIG_BLK_DEV_INITRD #ifndef __ASSEMBLY__ @@ -134,6 +132,7 @@ struct page; #undef ____cacheline_aligned #undef ____cacheline_aligned_in_smp #define __cacheline_aligned +#define __cacheline_aligned_in_smp #define ____cacheline_aligned #define ____cacheline_aligned_in_smp #define ____cacheline_maxaligned_in_smp @@ -237,6 +236,20 @@ void sort_main_extable(void); typedef s64 time_t; typedef s64 suseconds_t; +// needed for include/linux/jiffies.h +typedef long clock_t; + +// from include/linux/kernel.h, needed by jiffies.h +#define typecheck(type,x) \ +({ type __dummy; \ + typeof(x) __dummy2; \ + (void)(&__dummy == &__dummy2); \ + 1; \ +}) + +// from include/linux/timex.h, needed by arch/ia64/time.c +#define TIME_SOURCE_CPU 0 + // used in common code #define softirq_pending(cpu) (cpu_data(cpu)->softirq_pending) @@ -244,6 +257,13 @@ typedef s64 suseconds_t; #define SA_SHIRQ 0x04000000 #define SA_INTERRUPT 0x20000000 +// needed for setup.c +extern unsigned long loops_per_jiffy; +extern char saved_command_line[]; +struct screen_info { }; +#define seq_printf(a,b...) printf(b) +#define CONFIG_BLK_DEV_INITRD // needed to reserve memory for domain0 + // these declarations got moved at some point, find a better place for them extern int opt_noht; extern int ht_per_core; From 3309b6011e350c9fa86903a5894fff12517d9c7d Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Mon, 2 May 2005 17:36:28 +0000 Subject: [PATCH 31/36] bitkeeper revision 1.1327.1.20 (4276651cSwFEIaVv-X0LcrzNw_Dxfw) Last round of cleanup: Forgot a new file --- .rootkeys | 1 + xen/arch/ia64/xentime.c | 204 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 205 insertions(+) create mode 100644 xen/arch/ia64/xentime.c diff --git a/.rootkeys b/.rootkeys index c6b829b733..c18887a54a 100644 --- a/.rootkeys +++ b/.rootkeys @@ -1169,6 +1169,7 @@ 427162263zDUiPmTj-lP4eGyXs5eIg xen/arch/ia64/xenmem.c 421098b6mWyFPtkhPz9h1LCmKpoCLg xen/arch/ia64/xenmisc.c 421098b6lY2JzrV1oFDbrt7XQhtElg xen/arch/ia64/xensetup.c +427664f5eygrc3nEhI3RKf0Y37PzyA xen/arch/ia64/xentime.c 3ddb79bcZbRBzT3elFWSX7u6NtMagQ xen/arch/x86/Makefile 3ddb79bcBQF85CfLS4i1WGZ4oLLaCA xen/arch/x86/Rules.mk 3e5636e5FAYZ5_vQnmgwFJfSdmO5Mw xen/arch/x86/acpi.c diff --git a/xen/arch/ia64/xentime.c b/xen/arch/ia64/xentime.c new file mode 100644 index 0000000000..20d13eb7ef --- /dev/null +++ b/xen/arch/ia64/xentime.c @@ -0,0 +1,204 @@ +/* + * xen/arch/ia64/time.c + * + * Copyright (C) 2005 Hewlett-Packard Co + * Dan Magenheimer + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#ifdef XEN +#include // not included by xen/sched.h +#endif + +#define TIME_KEEPER_ID 0 +extern unsigned long wall_jiffies; + +static s_time_t stime_irq; /* System time at last 'time update' */ + +unsigned long domain0_ready = 0; + +static inline u64 get_time_delta(void) +{ + return ia64_get_itc(); +} + +s_time_t get_s_time(void) +{ + s_time_t now; + unsigned long flags; + + read_lock_irqsave(&xtime_lock, flags); + + now = stime_irq + get_time_delta(); + + /* Ensure that the returned system time is monotonically increasing. */ + { + static s_time_t prev_now = 0; + if ( unlikely(now < prev_now) ) + now = prev_now; + prev_now = now; + } + + read_unlock_irqrestore(&xtime_lock, flags); + + return now; +} + +void update_dom_time(struct exec_domain *ed) +{ +// FIXME: implement this? +// printf("update_dom_time: called, not implemented, skipping\n"); + return; +} + +/* Set clock to after 00:00:00 UTC, 1 January, 1970. */ +void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base) +{ +// FIXME: Should this be do_settimeofday (from linux)??? + printf("do_settime: called, not implemented, stopping\n"); + dummy(); +} + +irqreturn_t +xen_timer_interrupt (int irq, void *dev_id, struct pt_regs *regs) +{ + unsigned long new_itm; + +#ifndef XEN + if (unlikely(cpu_is_offline(smp_processor_id()))) { + return IRQ_HANDLED; + } +#endif +#ifdef XEN + if (current->domain == dom0) { + // FIXME: there's gotta be a better way of doing this... + // We have to ensure that domain0 is launched before we + // call vcpu_timer_expired on it + //domain0_ready = 1; // moved to xensetup.c + current->vcpu_info->arch.pending_interruption = 1; + } + if (domain0_ready && vcpu_timer_expired(dom0->exec_domain[0])) { + vcpu_pend_timer(dom0->exec_domain[0]); + //vcpu_set_next_timer(dom0->exec_domain[0]); + domain_wake(dom0->exec_domain[0]); + } + if (!is_idle_task(current->domain) && current->domain != dom0) { + if (vcpu_timer_expired(current)) { + vcpu_pend_timer(current); + // ensure another timer interrupt happens even if domain doesn't + vcpu_set_next_timer(current); + domain_wake(current); + } + } + raise_actimer_softirq(); +#endif + +#ifndef XEN + platform_timer_interrupt(irq, dev_id, regs); +#endif + + new_itm = local_cpu_data->itm_next; + + if (!time_after(ia64_get_itc(), new_itm)) +#ifdef XEN + return; +#else + printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)\n", + ia64_get_itc(), new_itm); +#endif + +#ifdef XEN +// printf("GOT TO HERE!!!!!!!!!!!\n"); + //while(1); +#else + profile_tick(CPU_PROFILING, regs); +#endif + + while (1) { +#ifndef XEN + update_process_times(user_mode(regs)); +#endif + + new_itm += local_cpu_data->itm_delta; + + if (smp_processor_id() == TIME_KEEPER_ID) { + /* + * Here we are in the timer irq handler. We have irqs locally + * disabled, but we don't know if the timer_bh is running on + * another CPU. We need to avoid to SMP race by acquiring the + * xtime_lock. + */ +#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN + write_seqlock(&xtime_lock); +#endif +#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN + do_timer(regs); +#endif + local_cpu_data->itm_next = new_itm; +#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN + write_sequnlock(&xtime_lock); +#endif + } else + local_cpu_data->itm_next = new_itm; + + if (time_after(new_itm, ia64_get_itc())) + break; + } + + do { + /* + * If we're too close to the next clock tick for + * comfort, we increase the safety margin by + * intentionally dropping the next tick(s). We do NOT + * update itm.next because that would force us to call + * do_timer() which in turn would let our clock run + * too fast (with the potentially devastating effect + * of losing monotony of time). + */ + while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2)) + new_itm += local_cpu_data->itm_delta; +//#ifdef XEN +// vcpu_set_next_timer(current); +//#else +//printf("***** timer_interrupt: Setting itm to %lx\n",new_itm); + ia64_set_itm(new_itm); +//#endif + /* double check, in case we got hit by a (slow) PMI: */ + } while (time_after_eq(ia64_get_itc(), new_itm)); + return IRQ_HANDLED; +} + +static struct irqaction xen_timer_irqaction = { + .handler = xen_timer_interrupt, +#ifndef XEN + .flags = SA_INTERRUPT, +#endif + .name = "timer" +}; + +void __init +xen_time_init (void) +{ + register_percpu_irq(IA64_TIMER_VECTOR, &xen_timer_irqaction); + ia64_init_itm(); +} From 47de05036a663a5c2313c07b79ccc198c3d456e4 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Mon, 2 May 2005 17:39:04 +0000 Subject: [PATCH 32/36] bitkeeper revision 1.1327.1.21 (427665b8B4k_2-bwpMByBLCK9j9snA) Last round of cleanup: Forgot to remove a file too! --- xen/arch/ia64/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/ia64/lib/Makefile b/xen/arch/ia64/lib/Makefile index a181d5166d..b5125f632b 100644 --- a/xen/arch/ia64/lib/Makefile +++ b/xen/arch/ia64/lib/Makefile @@ -9,7 +9,7 @@ OBJS := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \ bitop.o checksum.o clear_page.o csum_partial_copy.o copy_page.o \ clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \ flush.o ip_fast_csum.o do_csum.o copy_user.o \ - memset.o strlen.o memcpy.o swiotlb.o + memset.o strlen.o memcpy.o default: $(OBJS) $(LD) -r -o ia64lib.o $(OBJS) From 7c24bb1755c3d60f9120d8b7efafcca117c43873 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Mon, 2 May 2005 19:09:26 +0000 Subject: [PATCH 33/36] bitkeeper revision 1.1327.1.22 (42767ae6pMJH90d_vWODEW1wraCMTg) Oops, reenable swiotlb (more last round :-) --- .rootkeys | 1 + xen/arch/ia64/lib/Makefile | 2 +- xen/arch/ia64/patch/linux-2.6.11/swiotlb.c | 77 ++++++++++++++++++++++ xen/arch/ia64/tools/mkbuildtree | 24 +++---- xen/arch/ia64/xenmisc.c | 2 +- 5 files changed, 92 insertions(+), 14 deletions(-) create mode 100644 xen/arch/ia64/patch/linux-2.6.11/swiotlb.c diff --git a/.rootkeys b/.rootkeys index c18887a54a..f89bc459b4 100644 --- a/.rootkeys +++ b/.rootkeys @@ -1100,6 +1100,7 @@ 425ae516EWaNOBEnc1xnphTbRmNZsw xen/arch/ia64/patch/linux-2.6.11/processor.h 425ae516LecDyXlwh3NLBtHZKXmMcA xen/arch/ia64/patch/linux-2.6.11/series 425ae516RFiPn2CGkpJ21LM-1lJcQg xen/arch/ia64/patch/linux-2.6.11/setup.c +425ae516FX_10YaKGMU8Ysf7kkdm_A xen/arch/ia64/patch/linux-2.6.11/swiotlb.c 425ae516p4ICTkjqNYEfYFxqULj4dw xen/arch/ia64/patch/linux-2.6.11/system.h 425ae516juUB257qrwUdsL9AsswrqQ xen/arch/ia64/patch/linux-2.6.11/time.c 425ae5167zQn7zYcgKtDUDX2v-e8mw xen/arch/ia64/patch/linux-2.6.11/tlb.c diff --git a/xen/arch/ia64/lib/Makefile b/xen/arch/ia64/lib/Makefile index b5125f632b..a181d5166d 100644 --- a/xen/arch/ia64/lib/Makefile +++ b/xen/arch/ia64/lib/Makefile @@ -9,7 +9,7 @@ OBJS := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \ bitop.o checksum.o clear_page.o csum_partial_copy.o copy_page.o \ clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \ flush.o ip_fast_csum.o do_csum.o copy_user.o \ - memset.o strlen.o memcpy.o + memset.o strlen.o memcpy.o swiotlb.o default: $(OBJS) $(LD) -r -o ia64lib.o $(OBJS) diff --git a/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c new file mode 100644 index 0000000000..77fff5e2ec --- /dev/null +++ b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c @@ -0,0 +1,77 @@ + swiotlb.c | 21 +++++++++++++-------- + 1 files changed, 13 insertions(+), 8 deletions(-) + +Index: linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c +=================================================================== +--- linux-2.6.11-xendiffs.orig/arch/ia64/lib/swiotlb.c 2005-04-08 12:13:54.040202667 -0500 ++++ linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c 2005-04-08 12:19:09.170367318 -0500 +@@ -124,8 +124,11 @@ swiotlb_init_with_default_size (size_t d + /* + * Get IO TLB memory from the low pages + */ +- io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs * +- (1 << IO_TLB_SHIFT)); ++ /* FIXME: Do we really need swiotlb in HV? If all memory trunks ++ * presented to guest as <4G, are actually <4G in machine range, ++ * no DMA intevention from HV... ++ */ ++ io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT))); + if (!io_tlb_start) + panic("Cannot allocate SWIOTLB buffer"); + io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT); +@@ -135,16 +138,16 @@ swiotlb_init_with_default_size (size_t d + * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE + * between io_tlb_start and io_tlb_end. + */ +- io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int)); ++ io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(int))); + for (i = 0; i < io_tlb_nslabs; i++) + io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); + io_tlb_index = 0; +- io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *)); ++ io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(char *))); + + /* + * Get the overflow emergency buffer + */ +- io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow); ++ io_tlb_overflow_buffer = alloc_xenheap_pages(get_order(io_tlb_overflow)); + printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n", + virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end)); + } +@@ -328,13 +331,13 @@ swiotlb_alloc_coherent(struct device *hw + */ + flags |= GFP_DMA; + +- ret = (void *)__get_free_pages(flags, order); ++ ret = (void *)alloc_xenheap_pages(get_order(size)); + if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) { + /* + * The allocated memory isn't reachable by the device. + * Fall back on swiotlb_map_single(). + */ +- free_pages((unsigned long) ret, order); ++ free_xenheap_pages((unsigned long) ret, order); + ret = NULL; + } + if (!ret) { +@@ -372,7 +375,7 @@ swiotlb_free_coherent(struct device *hwd + { + if (!(vaddr >= (void *)io_tlb_start + && vaddr < (void *)io_tlb_end)) +- free_pages((unsigned long) vaddr, get_order(size)); ++ free_xenheap_pages((unsigned long) vaddr, get_order(size)); + else + /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ + swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE); +@@ -388,8 +391,10 @@ swiotlb_full(struct device *dev, size_t + * When the mapping is small enough return a static buffer to limit + * the damage, or panic when the transfer is too big. + */ ++#ifndef XEN + printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %lu bytes at " + "device %s\n", size, dev ? dev->bus_id : "?"); ++#endif + + if (size > io_tlb_overflow && do_panic) { + if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL) diff --git a/xen/arch/ia64/tools/mkbuildtree b/xen/arch/ia64/tools/mkbuildtree index 0a60d12faf..5ffbd3efc8 100644 --- a/xen/arch/ia64/tools/mkbuildtree +++ b/xen/arch/ia64/tools/mkbuildtree @@ -142,7 +142,7 @@ softlink arch/ia64/lib/strlen_user.S arch/ia64/lib/strlen_user.S softlink arch/ia64/lib/strncpy_from_user.S arch/ia64/lib/strncpy_from_user.S softlink arch/ia64/lib/strnlen_user.S arch/ia64/lib/strnlen_user.S #softlink arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c -#cp_patch arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c swiotlb.c +cp_patch arch/ia64/lib/swiotlb.c arch/ia64/lib/swiotlb.c swiotlb.c softlink arch/ia64/lib/xor.S arch/ia64/lib/xor.S softlink lib/cmdline.c arch/ia64/cmdline.c @@ -151,19 +151,19 @@ softlink arch/ia64/hp/sim/hpsim.S arch/ia64/hpsim.S # xen/include/asm-generic files -softlink include/asm-generic/bug.h include/asm-generic/bug.h bug.h -softlink include/asm-generic/div64.h include/asm-generic/div64.h div64.h +softlink include/asm-generic/bug.h include/asm-generic/bug.h +softlink include/asm-generic/div64.h include/asm-generic/div64.h softlink include/asm-generic/errno.h include/asm-generic/errno.h softlink include/asm-generic/errno-base.h include/asm-generic/errno-base.h -softlink include/asm-generic/ide_iops.h include/asm-generic/ide_iops.h ide_iops.h -softlink include/asm-generic/iomap.h include/asm-generic/iomap.h iomap.h -softlink include/asm-generic/pci-dma-compat.h include/asm-generic/pci-dma-compat.h pci-dma-compat.h -softlink include/asm-generic/pci.h include/asm-generic/pci.h pci.h -softlink include/asm-generic/pgtable.h include/asm-generic/pgtable.h pgtable.h -softlink include/asm-generic/pgtable-nopud.h include/asm-generic/pgtable-nopud.h pgtable-nopud.h -softlink include/asm-generic/sections.h include/asm-generic/sections.h sections.h -softlink include/asm-generic/topology.h include/asm-generic/topology.h topology.h -softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h vmlinux.lds.h +softlink include/asm-generic/ide_iops.h include/asm-generic/ide_iops.h +softlink include/asm-generic/iomap.h include/asm-generic/iomap.h +softlink include/asm-generic/pci-dma-compat.h include/asm-generic/pci-dma-compat.h +softlink include/asm-generic/pci.h include/asm-generic/pci.h +softlink include/asm-generic/pgtable.h include/asm-generic/pgtable.h +softlink include/asm-generic/pgtable-nopud.h include/asm-generic/pgtable-nopud.h +softlink include/asm-generic/sections.h include/asm-generic/sections.h +softlink include/asm-generic/topology.h include/asm-generic/topology.h +softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h # xen/include/asm-ia64 files diff --git a/xen/arch/ia64/xenmisc.c b/xen/arch/ia64/xenmisc.c index 290b3296ab..335e7d16c3 100644 --- a/xen/arch/ia64/xenmisc.c +++ b/xen/arch/ia64/xenmisc.c @@ -33,7 +33,7 @@ void ia64_patch_vtop(unsigned long a, unsigned long b) { } void hpsim_setup(char **x) { } // called from mem_init... don't think s/w I/O tlb is needed in Xen -void swiotlb_init(void) { } +//void swiotlb_init(void) { } ...looks like it IS needed long is_platform_hp_ski(void) From 5158ad1b1b1ab68a79f2bcbe46fedd8aa403e798 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Mon, 2 May 2005 19:35:43 +0000 Subject: [PATCH 34/36] bitkeeper revision 1.1327.1.23 (4276810fCGJukAImkhaVlxkOSDW-Dg) Sorry... still one more (Last round of cleanup) --- xen/arch/ia64/patch/linux-2.6.11/swiotlb.c | 82 +++++----------------- 1 file changed, 17 insertions(+), 65 deletions(-) diff --git a/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c index 77fff5e2ec..fc239138a7 100644 --- a/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c +++ b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c @@ -1,70 +1,22 @@ - swiotlb.c | 21 +++++++++++++-------- - 1 files changed, 13 insertions(+), 8 deletions(-) - -Index: linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c -=================================================================== ---- linux-2.6.11-xendiffs.orig/arch/ia64/lib/swiotlb.c 2005-04-08 12:13:54.040202667 -0500 -+++ linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c 2005-04-08 12:19:09.170367318 -0500 -@@ -124,8 +124,11 @@ swiotlb_init_with_default_size (size_t d - /* - * Get IO TLB memory from the low pages - */ -- io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs * -- (1 << IO_TLB_SHIFT)); -+ /* FIXME: Do we really need swiotlb in HV? If all memory trunks -+ * presented to guest as <4G, are actually <4G in machine range, -+ * no DMA intevention from HV... -+ */ -+ io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT))); - if (!io_tlb_start) - panic("Cannot allocate SWIOTLB buffer"); - io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT); -@@ -135,16 +138,16 @@ swiotlb_init_with_default_size (size_t d - * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE - * between io_tlb_start and io_tlb_end. - */ -- io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int)); -+ io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(int))); - for (i = 0; i < io_tlb_nslabs; i++) - io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); - io_tlb_index = 0; -- io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *)); -+ io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(char *))); +--- ../../linux-2.6.11/arch/ia64/lib/swiotlb.c 2005-03-02 00:38:17.000000000 -0700 ++++ arch/ia64/lib/swiotlb.c 2005-05-02 13:04:15.000000000 -0600 +@@ -49,6 +49,15 @@ + */ + #define IO_TLB_SHIFT 11 - /* - * Get the overflow emergency buffer - */ -- io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow); -+ io_tlb_overflow_buffer = alloc_xenheap_pages(get_order(io_tlb_overflow)); - printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n", - virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end)); - } -@@ -328,13 +331,13 @@ swiotlb_alloc_coherent(struct device *hw - */ - flags |= GFP_DMA; ++#ifdef XEN ++#define __order_to_size(_order) (1 << (_order+PAGE_SHIFT)) ++#define alloc_bootmem_low_pages(_x) alloc_xenheap_pages(get_order(_x)) ++#define alloc_bootmem_low(_x) alloc_xenheap_pages(get_order(_x)) ++#define alloc_bootmem(_x) alloc_xenheap_pages(get_order(_x)) ++#define __get_free_pages(_x,_y) alloc_xenheap_pages(__order_to_size(_y)) ++#define free_pages(_x,_y) free_xenheap_pages(_x,_y) ++#endif ++ + int swiotlb_force; -- ret = (void *)__get_free_pages(flags, order); -+ ret = (void *)alloc_xenheap_pages(get_order(size)); - if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) { - /* - * The allocated memory isn't reachable by the device. - * Fall back on swiotlb_map_single(). - */ -- free_pages((unsigned long) ret, order); -+ free_xenheap_pages((unsigned long) ret, order); - ret = NULL; - } - if (!ret) { -@@ -372,7 +375,7 @@ swiotlb_free_coherent(struct device *hwd - { - if (!(vaddr >= (void *)io_tlb_start - && vaddr < (void *)io_tlb_end)) -- free_pages((unsigned long) vaddr, get_order(size)); -+ free_xenheap_pages((unsigned long) vaddr, get_order(size)); - else - /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ - swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE); -@@ -388,8 +391,10 @@ swiotlb_full(struct device *dev, size_t + /* +@@ -388,8 +397,10 @@ * When the mapping is small enough return a static buffer to limit * the damage, or panic when the transfer is too big. */ From 7fca77a6485930bff5c6053d62c048f0da4347d7 Mon Sep 17 00:00:00 2001 From: "djm@sportsman.spdomain" Date: Tue, 3 May 2005 00:07:25 +0000 Subject: [PATCH 35/36] bitkeeper revision 1.1389.1.29 (4276c0bdcHMh8JYpMOuOkZTWJxnCHQ) arch-ia64.h: fix typo from common name change --- xen/include/public/arch-ia64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/public/arch-ia64.h b/xen/include/public/arch-ia64.h index ee5e4217c9..ad24299a0d 100644 --- a/xen/include/public/arch-ia64.h +++ b/xen/include/public/arch-ia64.h @@ -22,7 +22,7 @@ typedef unsigned long cpureg_t; /* Full-sized register. */ typedef struct { -} PACKED struct cpu_user_regs; +} PACKED cpu_user_regs; /* * NB. This may become a 64-bit count with no shift. If this happens then the From ead2ce892ed6ab53444a8575df4b95ddd764770f Mon Sep 17 00:00:00 2001 From: "arun.sharma@intel.com[kaf24]" Date: Tue, 3 May 2005 07:46:23 +0000 Subject: [PATCH 36/36] bitkeeper revision 1.1389.1.30 (42772c4ftqTKMw2_A0pJAa1-LYe2xw) [PATCH] config_xen0_tun.patch QEMU needs CONFIG_TUN to enable networking. Signed-off-by: Edwin Zhai Signed-off-by: Arun Sharma --- linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 | 2 +- linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 index 093e463fc5..0ae5a68d8c 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 +++ b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 @@ -598,7 +598,7 @@ CONFIG_NETDEVICES=y # CONFIG_DUMMY is not set # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set +CONFIG_TUN=y # # ARCnet devices diff --git a/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 index 061920a44f..9adb57f463 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 +++ b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 @@ -515,7 +515,7 @@ CONFIG_NETDEVICES=y # CONFIG_DUMMY is not set # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set -# CONFIG_TUN is not set +CONFIG_TUN=y # # ARCnet devices