ia64/xen-unstable

changeset 5168:a9d48e7fb8c5

bitkeeper revision 1.1509.1.5 (4295ee88HY2abQVcdhSuV8au7cjYDA)

First fast hyperprivop support (hyper_rfi)

Signed-off by: Dan Magenheimer <dan.magenheimer@hp.com>
author djm@kirby.fc.hp.com
date Thu May 26 15:43:04 2005 +0000 (2005-05-26)
parents ebdeb9b86189
children 34b95079edb9
files .rootkeys xen/arch/ia64/Makefile xen/arch/ia64/asm-offsets.c xen/arch/ia64/hyperprivop.S xen/arch/ia64/ivt.S xen/arch/ia64/privop.c xen/include/asm-ia64/xensystem.h xen/include/public/arch-ia64.h
line diff
     1.1 --- a/.rootkeys	Wed May 25 20:19:09 2005 +0000
     1.2 +++ b/.rootkeys	Thu May 26 15:43:04 2005 +0000
     1.3 @@ -1063,6 +1063,7 @@ 421098b2PHgzf_Gg4R65YRNi_QzMKQ xen/arch/
     1.4  421098b2O7jsNfzQXA1v3rbAc1QhpA xen/arch/ia64/dom_fw.c
     1.5  421098b2ZlaBcyiuuPr3WpzaSDwg6Q xen/arch/ia64/domain.c
     1.6  4239e98a_HX-FCIcXtVqY0BbrDqVug xen/arch/ia64/hypercall.c
     1.7 +4295e18f42gf1T-8W97A3KSlBaY1tA xen/arch/ia64/hyperprivop.S
     1.8  421098b3LYAS8xJkQiGP7tiTlyBt0Q xen/arch/ia64/idle0_task.c
     1.9  421098b3ys5GAr4z6_H1jD33oem82g xen/arch/ia64/irq.c
    1.10  4272a8e4lavI6DrTvqaIhXeR5RuKBw xen/arch/ia64/ivt.S
     2.1 --- a/xen/arch/ia64/Makefile	Wed May 25 20:19:09 2005 +0000
     2.2 +++ b/xen/arch/ia64/Makefile	Thu May 26 15:43:04 2005 +0000
     2.3 @@ -9,7 +9,7 @@ OBJS = xensetup.o setup.o time.o irq.o i
     2.4  	xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \
     2.5  	extable.o linuxextable.o xenirq.o xentime.o \
     2.6  	regionreg.o entry.o unaligned.o privop.o vcpu.o \
     2.7 -	irq_ia64.o irq_lsapic.o vhpt.o xenasm.o dom_fw.o
     2.8 +	irq_ia64.o irq_lsapic.o vhpt.o xenasm.o hyperprivop.o dom_fw.o
     2.9  
    2.10  ifeq ($(CONFIG_VTI),y)
    2.11  OBJS += vmx_init.o vmx_virt.o vmx_vcpu.o vmx_process.o vmx_vsa.o vmx_ivt.o \
     3.1 --- a/xen/arch/ia64/asm-offsets.c	Wed May 25 20:19:09 2005 +0000
     3.2 +++ b/xen/arch/ia64/asm-offsets.c	Thu May 26 15:43:04 2005 +0000
     3.3 @@ -44,6 +44,13 @@ void foo(void)
     3.4  	DEFINE(XSI_PSR_IC_OFS, offsetof(vcpu_info_t, arch.interrupt_collection_enabled));
     3.5  	DEFINE(XSI_PSR_IC, (SHAREDINFO_ADDR+offsetof(vcpu_info_t, arch.interrupt_collection_enabled)));
     3.6  	DEFINE(XSI_PSR_I_OFS, offsetof(vcpu_info_t, arch.interrupt_delivery_enabled));
     3.7 +	DEFINE(XSI_IIP_OFS, offsetof(vcpu_info_t, arch.iip));
     3.8 +	DEFINE(XSI_IPSR_OFS, offsetof(vcpu_info_t, arch.ipsr));
     3.9 +	DEFINE(XSI_IFS_OFS, offsetof(vcpu_info_t, arch.ifs));
    3.10 +	DEFINE(XSI_BANKNUM_OFS, offsetof(vcpu_info_t, arch.banknum));
    3.11 +	DEFINE(XSI_METAPHYS_OFS, offsetof(vcpu_info_t, arch.metaphysical_mode));
    3.12 +	DEFINE(XSI_INCOMPL_REG_OFS, offsetof(vcpu_info_t, arch.incomplete_regframe));
    3.13 +	DEFINE(XSI_PEND_OFS, offsetof(vcpu_info_t, arch.pending_interruption));
    3.14  	//DEFINE(IA64_TASK_BLOCKED_OFFSET,offsetof (struct task_struct, blocked));
    3.15  	//DEFINE(IA64_TASK_CLEAR_CHILD_TID_OFFSET,offsetof (struct task_struct, clear_child_tid));
    3.16  	//DEFINE(IA64_TASK_GROUP_LEADER_OFFSET, offsetof (struct task_struct, group_leader));
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/xen/arch/ia64/hyperprivop.S	Thu May 26 15:43:04 2005 +0000
     4.3 @@ -0,0 +1,103 @@
     4.4 +/*
     4.5 + * arch/ia64/kernel/hyperprivop.S
     4.6 + *
     4.7 + * Copyright (C) 2005 Hewlett-Packard Co
     4.8 + *	Dan Magenheimer <dan.magenheimer@hp.com>
     4.9 + */
    4.10 +
    4.11 +#include <linux/config.h>
    4.12 +
    4.13 +#include <asm/asmmacro.h>
    4.14 +#include <asm/kregs.h>
    4.15 +#include <asm/offsets.h>
    4.16 +#include <asm/processor.h>
    4.17 +#include <asm/system.h>
    4.18 +#include <public/arch-ia64.h>
    4.19 +
    4.20 +// Note: not hand-scheduled for now
    4.21 +//  Registers at entry
    4.22 +//	r16 == cr.isr
    4.23 +//	r17 == cr.iim
    4.24 +//	r18 == XSI_PSR_IC_OFS
    4.25 +//	r19 == vpsr.ic (low 32 bits) | vpsr.i (high 32 bits)
    4.26 +//	r31 == pr
    4.27 +GLOBAL_ENTRY(fast_hyperprivop)
    4.28 +	//cover;;
    4.29 +	// if domain interrupts pending, give up for now and do it the slow way
    4.30 +	adds r20=XSI_PEND_OFS-XSI_PSR_IC_OFS,r18 ;;
    4.31 +	ld8 r20=[r20] ;;
    4.32 +	cmp.ne p7,p0=r0,r20
    4.33 +(p7)	br.sptk.many dispatch_break_fault ;;
    4.34 +
    4.35 +	// HYPERPRIVOP_RFI?
    4.36 +	cmp.eq p7,p6=XEN_HYPER_RFI,r17
    4.37 +(p7)	br.sptk.many hyper_rfi;;
    4.38 +	// if not rfi, give up for now and do it the slow way
    4.39 +	br.sptk.many dispatch_break_fault ;;
    4.40 +
    4.41 +// ensure that, if giving up, registers at entry to fast_hyperprivop unchanged
    4.42 +ENTRY(hyper_rfi)
    4.43 +	adds r20=XSI_IPSR_OFS-XSI_PSR_IC_OFS,r18 ;;
    4.44 +	ld8 r21=[r20];;		// r21 = vcr.ipsr
    4.45 +	extr.u r22=r21,IA64_PSR_BE_BIT,1 ;;
    4.46 +	// if turning on psr.be, give up for now and do it the slow way
    4.47 +	cmp.ne p7,p0=r22,r0
    4.48 +(p7)	br.sptk.many dispatch_break_fault ;;
    4.49 +	// if (!(vpsr.dt && vpsr.rt && vpsr.it)), do it the slow way
    4.50 +	movl r20=(IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_IT);;
    4.51 +	and r22=r20,r21
    4.52 +	;;
    4.53 +	cmp.ne p7,p0=r22,r20
    4.54 +(p7)	br.sptk.many dispatch_break_fault ;;
    4.55 +	// if was in metaphys mode, do it the slow way (FIXME later?)
    4.56 +	adds r20=XSI_METAPHYS_OFS-XSI_PSR_IC_OFS,r18 ;;
    4.57 +	ld4 r20=[r20];;
    4.58 +	cmp.ne p7,p0=r20,r0
    4.59 +(p7)	br.sptk.many dispatch_break_fault ;;
    4.60 +	// if domain hasn't already done virtual bank switch
    4.61 +	//  do it the slow way (FIXME later?)
    4.62 +	adds r20=XSI_BANKNUM_OFS-XSI_PSR_IC_OFS,r18 ;;
    4.63 +	ld4 r20=[r20];;
    4.64 +	cmp.eq p7,p0=r20,r0
    4.65 +(p7)	br.sptk.many dispatch_break_fault ;;
    4.66 +	// validate vcr.iip, if in Xen range, do it the slow way
    4.67 +	adds r20=XSI_IIP_OFS-XSI_PSR_IC_OFS,r18 ;;
    4.68 +	ld8 r22=[r20];;
    4.69 +	movl r23=XEN_VIRT_SPACE_LOW
    4.70 +	movl r24=XEN_VIRT_SPACE_HIGH ;;
    4.71 +	cmp.ltu p0,p7=r22,r23 ;;	// if !(iip<low) &&
    4.72 +(p7)	cmp.geu p0,p7=r22,r24 ;;	//    !(iip>=high)
    4.73 +(p7)	br.sptk.many dispatch_break_fault ;;
    4.74 +
    4.75 +	// OK now, let's do an rfi.
    4.76 +	// r18=&vpsr.i|vpsr.ic, r21==vpsr, r20==&vcr.iip, r22=vcr.iip
    4.77 +	mov cr.iip=r22;;
    4.78 +	adds r20=XSI_INCOMPL_REG_OFS-XSI_PSR_IC_OFS,r18 ;;
    4.79 +	st4 [r20]=r0 ;;
    4.80 +	adds r20=XSI_IFS_OFS-XSI_PSR_IC_OFS,r18 ;;
    4.81 +	ld8 r20=[r20];;
    4.82 +	dep r20=0,r20,38,25;; // ensure ifs has no reserved bits set
    4.83 +	mov cr.ifs=r20 ;;
    4.84 +// TODO: increment a counter so we can count how many rfi's go the fast way
    4.85 +//    but where?  counter must be pinned
    4.86 +	// ipsr.cpl == (vcr.ipsr.cpl == 0) 2 : 3;
    4.87 +	dep r21=-1,r21,IA64_PSR_CPL1_BIT,1 ;;
    4.88 +	// vpsr.i = vcr.ipsr.i; vpsr.ic = vcr.ipsr.ic
    4.89 +	mov r19=r0 ;;
    4.90 +	extr.u r22=r21,IA64_PSR_I_BIT,1 ;;
    4.91 +	cmp.ne p7,p6=r22,r0 ;;
    4.92 +(p7)	dep r19=-1,r19,32,1
    4.93 +	extr.u r22=r21,IA64_PSR_IC_BIT,1 ;;
    4.94 +	cmp.ne p7,p6=r22,r0 ;;
    4.95 +(p7)	dep r19=-1,r19,0,1 ;;
    4.96 +	st8 [r18]=r19 ;;
    4.97 +	// force on psr.ic, i, dt, rt, it, bn
    4.98 +	movl r20=(IA64_PSR_I|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_IT|IA64_PSR_BN)
    4.99 +	;;
   4.100 +	or r21=r21,r20
   4.101 +	;;
   4.102 +	mov cr.ipsr=r21
   4.103 +	mov pr=r31,-1
   4.104 +	;;
   4.105 +	rfi
   4.106 +	;;
     5.1 --- a/xen/arch/ia64/ivt.S	Wed May 25 20:19:09 2005 +0000
     5.2 +++ b/xen/arch/ia64/ivt.S	Thu May 26 15:43:04 2005 +0000
     5.3 @@ -792,6 +792,7 @@ ENTRY(break_fault)
     5.4  	// Later, they will be fast hand-coded assembly with psr.ic off
     5.5  	// which means no calls, no use of r1-r15 and no memory accesses
     5.6  	// except to pinned addresses!
     5.7 +#define FAST_HYPERPRIVOPS
     5.8  #ifdef FAST_HYPERPRIVOPS
     5.9  	br.sptk.many fast_hyperprivop
    5.10  #else
    5.11 @@ -917,9 +918,10 @@ END(interrupt)
    5.12  	// fault ever gets "unreserved", simply moved the following code to a more
    5.13  	// suitable spot...
    5.14  
    5.15 -ENTRY(dispatch_break_fault)
    5.16 +GLOBAL_ENTRY(dispatch_break_fault)
    5.17  	SAVE_MIN_WITH_COVER
    5.18  	;;
    5.19 +dispatch_break_fault_post_save:
    5.20  	alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!)
    5.21  	mov out0=cr.ifa
    5.22  	adds out1=16,sp
    5.23 @@ -1796,6 +1798,15 @@ ENTRY(dispatch_reflection)
    5.24  	mov rp=r14
    5.25  	br.sptk.many ia64_prepare_handle_reflection
    5.26  END(dispatch_reflection)
    5.27 +
    5.28 +#define SAVE_MIN_COVER_DONE	DO_SAVE_MIN(,mov r30=cr.ifs,)
    5.29 +
    5.30 +// same as dispatch_break_fault except cover has already been done
    5.31 +GLOBAL_ENTRY(dispatch_slow_hyperprivop)
    5.32 +	SAVE_MIN_COVER_DONE
    5.33 +	;;
    5.34 +	br.sptk.many dispatch_break_fault_post_save
    5.35 +END(dispatch_slow_hyperprivop)
    5.36  #endif
    5.37  
    5.38  #ifdef CONFIG_IA32_SUPPORT
     6.1 --- a/xen/arch/ia64/privop.c	Wed May 25 20:19:09 2005 +0000
     6.2 +++ b/xen/arch/ia64/privop.c	Thu May 26 15:43:04 2005 +0000
     6.3 @@ -981,7 +981,7 @@ int dump_hyperprivop_counts(char *buf)
     6.4  {
     6.5  	int i;
     6.6  	char *s = buf;
     6.7 -	s += sprintf(s,"Hyperprivops:\n");
     6.8 +	s += sprintf(s,"Slow hyperprivops:\n");
     6.9  	for (i = 1; i <= HYPERPRIVOP_MAX; i++)
    6.10  		if (hyperpriv_cnt[i])
    6.11  			s += sprintf(s,"%10d %s\n",
     7.1 --- a/xen/include/asm-ia64/xensystem.h	Wed May 25 20:19:09 2005 +0000
     7.2 +++ b/xen/include/asm-ia64/xensystem.h	Thu May 26 15:43:04 2005 +0000
     7.3 @@ -14,10 +14,10 @@
     7.4  #include <linux/kernel.h>
     7.5  
     7.6  /* Define HV space hierarchy */
     7.7 -#ifdef CONFIG_VTI
     7.8  #define XEN_VIRT_SPACE_LOW	 0xe800000000000000
     7.9  #define XEN_VIRT_SPACE_HIGH	 0xf800000000000000	
    7.10  /* This is address to mapping rr7 switch stub, in region 5 */
    7.11 +#ifdef CONFIG_VTI
    7.12  #define XEN_RR7_SWITCH_STUB	 0xb700000000000000
    7.13  #endif // CONFIG_VTI
    7.14  
     8.1 --- a/xen/include/public/arch-ia64.h	Wed May 25 20:19:09 2005 +0000
     8.2 +++ b/xen/include/public/arch-ia64.h	Thu May 26 15:43:04 2005 +0000
     8.3 @@ -81,4 +81,11 @@ typedef struct vcpu_guest_context {
     8.4  
     8.5  #endif /* !__ASSEMBLY__ */
     8.6  
     8.7 +#define	XEN_HYPER_RFI			1
     8.8 +#define	XEN_HYPER_RSM_PSR_DT		2
     8.9 +#define	XEN_HYPER_SSM_PSR_DT		3
    8.10 +#define	XEN_HYPER_COVER			4
    8.11 +#define	XEN_HYPER_ITC_D			5
    8.12 +#define	XEN_HYPER_ITC_I			6
    8.13 +
    8.14  #endif /* __HYPERVISOR_IF_IA64_H__ */