2008-01-07 04:11:57 +03:00
/ *
* File : mca_ a s m . S
* Purpose : assembly p o r t i o n o f t h e I A 6 4 M C A h a n d l i n g
*
* Mods b y c f l e c k t o i n t e g r a t e i n t o k e r n e l b u i l d
*
* 2 0 0 0 - 0 3 - 1 5 David M o s b e r g e r - T a n g < d a v i d m @hpl.hp.com>
* Added v a r i o u s s t o p b i t s t o g e t a c l e a n c o m p i l e
*
* 2 0 0 0 - 0 3 - 2 9 Chuck F l e c k e n s t e i n < c f l e c k @co.intel.com>
* Added c o d e t o s a v e I N I T h a n d o f f s t a t e i n p t _ r e g s f o r m a t ,
* switch t o t e m p k s t a c k , s w i t c h m o d e s , j u m p t o C I N I T h a n d l e r
*
* 2 0 0 2 - 0 1 - 0 4 J. H a l l < j e n n a . s . h a l l @intel.com>
* Before e n t e r i n g v i r t u a l m o d e c o d e :
* 1 . Check f o r T L B C P U e r r o r
* 2 . Restore c u r r e n t t h r e a d p o i n t e r t o k r6
* 3 . Move s t a c k p t r 1 6 b y t e s t o c o n f o r m t o C c a l l i n g c o n v e n t i o n
*
* 2 0 0 4 - 1 1 - 1 2 Russ A n d e r s o n < r j a @sgi.com>
* Added p e r c p u M C A / I N I T s t a c k s a v e a r e a s .
*
* 2 0 0 5 - 1 2 - 0 8 Keith O w e n s < k a o s @sgi.com>
* Use p e r c p u M C A / I N I T s t a c k s f o r a l l d a t a .
* /
2005-04-17 02:20:36 +04:00
# include < l i n u x / t h r e a d s . h >
# include < a s m / a s m m a c r o . h >
# include < a s m / p g t a b l e . h >
# include < a s m / p r o c e s s o r . h >
# include < a s m / m c a _ a s m . h >
# include < a s m / m c a . h >
2005-09-11 11:22:53 +04:00
# include " e n t r y . h "
2005-04-17 02:20:36 +04:00
# define G E T _ I A 6 4 _ M C A _ D A T A ( r e g ) \
GET_ T H I S _ P A D D R ( r e g , i a64 _ m c a _ d a t a ) \
;; \
ld8 r e g = [ r e g ]
2005-04-23 01:44:40 +04:00
.global ia64_do_tlb_purge
2005-09-11 11:22:53 +04:00
.global ia64_os_mca_dispatch
[IA64] kexec: Make INIT safe while transition to
kdump/kexec kernel
Summary:
Asserting INIT on the beginning of kdump/kexec kernel will result
in unexpected behavior because INIT handler for previous kernel is
invoked on new kernel.
Description:
In panic situation, we can receive INIT while kernel transition,
i.e. from beginning of panic to bootstrap of kdump kernel.
Since we initialize registers on leave from current kernel, no
longer monarch/slave handlers of current kernel in virtual mode are
called safely. (In fact system goes hang as far as I confirmed)
How to Reproduce:
Start kdump
# echo c > /proc/sysrq-trigger
Then assert INIT while kdump kernel is booting, before new INIT
handler for kdump kernel is registered.
Expected(Desirable) result:
kdump kernel boots without any problem, crashdump retrieved
Actual result:
INIT handler for previous kernel is invoked on kdump kernel
=> panic, hang etc. (unexpected)
Proposed fix:
We can unregister these init handlers from SAL before jumping into
new kernel, however then the INIT will fallback to default behavior,
result in warmboot by SAL (according to the SAL specification) and
we cannot retrieve the crashdump.
Therefore this patch introduces a NOP init handler and register it
to SAL before leave from current kernel, to start kdump safely by
preventing INITs from entering virtual mode and resulting in warmboot.
On the other hand, in case of kexec that not for kdump, it also
has same problem with INIT while kernel transition.
This patch handles this case differently, because for kexec
unregistering handlers will be preferred than registering NOP
handler, since the situation "no handlers registered" is usual
state for kernel's entry.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Haren Myneni <hbabu@us.ibm.com>
Cc: kexec@lists.infradead.org
Acked-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
2009-08-07 01:51:56 +04:00
.global ia64_os_init_on_kdump
2005-09-11 11:22:53 +04:00
.global ia64_os_init_dispatch_monarch
.global ia64_os_init_dispatch_slave
2005-04-17 02:20:36 +04:00
.text
.align 16
2005-09-11 11:22:53 +04:00
/ / StartMain/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
2005-04-23 01:44:40 +04:00
/ *
* Just t h e T L B p u r g e p a r t i s m o v e d t o a s e p a r a t e f u n c t i o n
* so w e c a n r e - u s e t h e c o d e f o r c p u h o t p l u g c o d e a s w e l l
* Caller s h o u l d n o w s e t u p b1 , s o w e c a n b r a n c h o n c e t h e
* tlb f l u s h i s c o m p l e t e .
* /
2005-04-17 02:20:36 +04:00
2005-04-23 01:44:40 +04:00
ia64_do_tlb_purge :
2005-04-17 02:20:36 +04:00
# define O ( m e m b e r ) I A 6 4 _ C P U I N F O _ ## m e m b e r # # _ O F F S E T
2009-10-29 16:34:14 +03:00
GET_ T H I S _ P A D D R ( r2 , i a64 _ c p u _ i n f o ) / / l o a d p h y s a d d r o f c p u _ i n f o i n t o r2
2005-04-17 02:20:36 +04:00
;;
addl r17 =O ( P T C E _ S T R I D E ) ,r2
addl r2 =O ( P T C E _ B A S E ) ,r2
;;
ld8 r18 = [ r2 ] ,( O ( P T C E _ C O U N T ) - O ( P T C E _ B A S E ) ) ;; // r18=ptce_base
ld4 r19 = [ r2 ] ,4 / / r19 =ptce_count [ 0 ]
ld4 r21 = [ r17 ] ,4 / / r21 =ptce_stride [ 0 ]
;;
ld4 r20 = [ r2 ] / / r20 =ptce_count [ 1 ]
ld4 r22 = [ r17 ] / / r22 =ptce_stride [ 1 ]
mov r24 =0
;;
adds r20 = - 1 ,r20
;;
# undef O
2 :
cmp. l t u p6 ,p7 =r24 ,r19
( p7 ) b r . c o n d . d p n t . f e w 4 f
mov a r . l c =r20
3 :
ptc. e r18
;;
add r18 =r22 ,r18
br. c l o o p . s p t k . f e w 3 b
;;
add r18 =r21 ,r18
add r24 =1 ,r24
;;
br. s p t k . f e w 2 b
4 :
srlz. i / / s r l z . i i m p l i e s s r l z . d
;;
/ / Now p u r g e a d d r e s s e s f o r m e r l y m a p p e d b y T R r e g i s t e r s
/ / 1 . Purge I T R & D T R f o r k e r n e l .
movl r16 =KERNEL_START
mov r18 =KERNEL_TR_PAGE_SHIFT < < 2
;;
ptr. i r16 , r18
ptr. d r16 , r18
;;
srlz. i
;;
srlz. d
;;
/ / 3 . Purge I T R f o r P A L c o d e .
GET_ T H I S _ P A D D R ( r2 , i a64 _ m c a _ p a l _ b a s e )
;;
ld8 r16 = [ r2 ]
mov r18 =IA64_GRANULE_SHIFT < < 2
;;
ptr. i r16 ,r18
;;
srlz. i
;;
/ / 4 . Purge D T R f o r s t a c k .
mov r16 =IA64_KR ( C U R R E N T _ S T A C K )
;;
shl r16 =r16 ,I A 6 4 _ G R A N U L E _ S H I F T
movl r19 =PAGE_OFFSET
;;
add r16 =r19 ,r16
mov r18 =IA64_GRANULE_SHIFT < < 2
;;
ptr. d r16 ,r18
;;
srlz. i
;;
2005-04-23 01:44:40 +04:00
/ / Now b r a n c h a w a y t o c a l l e r .
br. s p t k . m a n y b1
;;
2005-09-11 11:22:53 +04:00
/ / EndMain/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / StartMain/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
2005-04-23 01:44:40 +04:00
2005-09-11 11:22:53 +04:00
ia64_os_mca_dispatch :
mov r3 =IA64_MCA_CPU_MCA_STACK_OFFSET / / u s e t h e M C A s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
mov r19 =1 / / A l l M C A e v e n t s a r e t r e a t e d a s m o n a r c h ( f o r n o w )
br. s p t k i a64 _ s t a t e _ s a v e / / s a v e t h e s t a t e t h a t i s n o t i n m i n s t a t e
1 :
2005-04-23 01:44:40 +04:00
2005-09-11 11:22:53 +04:00
GET_ I A 6 4 _ M C A _ D A T A ( r2 )
/ / Using M C A s t a c k , s t r u c t i a64 _ s a l _ o s _ s t a t e , v a r i a b l e p r o c _ s t a t e _ p a r a m
;;
2006-04-07 12:08:11 +04:00
add r3 =IA64_MCA_CPU_MCA_STACK_OFFSET + M C A _ S O S _ O F F S E T + S O S ( P R O C _ S T A T E _ P A R A M ) , r2
2005-04-23 01:44:40 +04:00
;;
2005-09-11 11:22:53 +04:00
ld8 r18 = [ r3 ] / / G e t p r o c e s s o r s t a t e p a r a m e t e r o n e x i s t i n g P A L E _ C H E C K .
2005-04-23 01:44:40 +04:00
;;
tbit. n z p6 ,p7 =r18 ,6 0
( p7 ) b r . s p n t d o n e _ t l b _ p u r g e _ a n d _ r e l o a d
/ / The f o l l o w i n g c o d e p u r g e s T C a n d T R e n t r i e s . T h e n r e l o a d a l l T C e n t r i e s .
/ / Purge p e r c p u d a t a T C e n t r i e s .
begin_tlb_purge_and_reload :
movl r18 =ia64_reload_tr ;;
LOAD_ P H Y S I C A L ( p0 ,r18 ,i a64 _ r e l o a d _ t r ) ;;
mov b1 =r18 ;;
br. s p t k . m a n y i a64 _ d o _ t l b _ p u r g e ;;
ia64_reload_tr :
2005-04-17 02:20:36 +04:00
/ / Finally r e l o a d t h e T R r e g i s t e r s .
/ / 1 . Reload D T R / I T R r e g i s t e r s f o r k e r n e l .
mov r18 =KERNEL_TR_PAGE_SHIFT < < 2
movl r17 =KERNEL_START
;;
mov c r . i t i r =r18
mov c r . i f a =r17
mov r16 =IA64_TR_KERNEL
mov r19 =ip
movl r18 =PAGE_KERNEL
;;
dep r17 =0 ,r19 ,0 , K E R N E L _ T R _ P A G E _ S H I F T
;;
or r18 =r17 ,r18
;;
itr. i i t r [ r16 ] =r18
;;
itr. d d t r [ r16 ] =r18
;;
srlz. i
srlz. d
;;
/ / 3 . Reload I T R f o r P A L c o d e .
GET_ T H I S _ P A D D R ( r2 , i a64 _ m c a _ p a l _ p t e )
;;
ld8 r18 = [ r2 ] / / l o a d P A L P T E
;;
GET_ T H I S _ P A D D R ( r2 , i a64 _ m c a _ p a l _ b a s e )
;;
ld8 r16 = [ r2 ] / / l o a d P A L v a d d r
mov r19 =IA64_GRANULE_SHIFT < < 2
;;
mov c r . i t i r =r19
mov c r . i f a =r16
mov r20 =IA64_TR_PALCODE
;;
itr. i i t r [ r20 ] =r18
;;
srlz. i
;;
/ / 4 . Reload D T R f o r s t a c k .
mov r16 =IA64_KR ( C U R R E N T _ S T A C K )
;;
shl r16 =r16 ,I A 6 4 _ G R A N U L E _ S H I F T
movl r19 =PAGE_OFFSET
;;
add r18 =r19 ,r16
movl r20 =PAGE_KERNEL
;;
add r16 =r20 ,r16
mov r19 =IA64_GRANULE_SHIFT < < 2
;;
mov c r . i t i r =r19
mov c r . i f a =r18
mov r20 =IA64_TR_CURRENT_STACK
;;
itr. d d t r [ r20 ] =r16
2008-04-03 22:02:58 +04:00
GET_ T H I S _ P A D D R ( r2 , i a64 _ m c a _ t r _ r e l o a d )
mov r18 = 1
2005-04-17 02:20:36 +04:00
;;
srlz. d
2008-04-03 22:02:58 +04:00
;;
st8 [ r2 ] =r18
;;
2005-04-17 02:20:36 +04:00
done_tlb_purge_and_reload :
2005-09-11 11:22:53 +04:00
/ / switch t o p e r c p u M C A s t a c k
mov r3 =IA64_MCA_CPU_MCA_STACK_OFFSET / / u s e t h e M C A s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ n e w _ s t a c k
1 :
/ / everything s a v e d , n o w w e c a n s e t t h e k e r n e l r e g i s t e r s
mov r3 =IA64_MCA_CPU_MCA_STACK_OFFSET / / u s e t h e M C A s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ s e t _ k e r n e l _ r e g i s t e r s
1 :
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
/ / This m u s t b e d o n e i n p h y s i c a l m o d e
2005-04-17 02:20:36 +04:00
GET_ I A 6 4 _ M C A _ D A T A ( r2 )
;;
2005-09-11 11:22:53 +04:00
mov r7 =r2
2005-04-17 02:20:36 +04:00
/ / Enter v i r t u a l m o d e f r o m p h y s i c a l m o d e
VIRTUAL_ M O D E _ E N T E R ( r2 , r3 , i a64 _ o s _ m c a _ v i r t u a l _ b e g i n , r4 )
2005-09-11 11:22:53 +04:00
/ / This c o d e r e t u r n s t o S A L v i a S O S r2 , i n g e n e r a l S A L h a s n o u n w i n d
/ / data. T o g e t a c l e a n t e r m i n a t i o n w h e n b a c k t r a c i n g t h e C M C A / I N I T
/ / handler, s e t a d u m m y r e t u r n a d d r e s s o f 0 i n t h i s r o u t i n e . T h a t
/ / requires t h a t i a64 _ o s _ m c a _ v i r t u a l _ b e g i n b e a g l o b a l f u n c t i o n .
ENTRY( i a64 _ o s _ m c a _ v i r t u a l _ b e g i n )
.prologue
.save rp,r0
.body
mov a r . r s c =3 / / s e t e a g e r m o d e f o r C h a n d l e r
mov r2 =r7 / / s e e G E T _ I A 6 4 _ M C A _ D A T A a b o v e
;;
2005-04-17 02:20:36 +04:00
/ / Call v i r t u a l m o d e h a n d l e r
2005-09-11 11:22:53 +04:00
alloc r14 =ar . p f s ,0 ,0 ,3 ,0
;;
DATA_ P A _ T O _ V A ( r2 ,r7 )
;;
add o u t 0 =IA64_MCA_CPU_MCA_STACK_OFFSET + M C A _ P T _ R E G S _ O F F S E T , r2
add o u t 1 =IA64_MCA_CPU_MCA_STACK_OFFSET + M C A _ S W I T C H _ S T A C K _ O F F S E T , r2
add o u t 2 =IA64_MCA_CPU_MCA_STACK_OFFSET + M C A _ S O S _ O F F S E T , r2
br. c a l l . s p t k . m a n y b0 =ia64_mca_handler
2005-04-17 02:20:36 +04:00
/ / Revert b a c k t o p h y s i c a l m o d e b e f o r e g o i n g b a c k t o S A L
PHYSICAL_ M O D E _ E N T E R ( r2 , r3 , i a64 _ o s _ m c a _ v i r t u a l _ e n d , r4 )
ia64_os_mca_virtual_end :
2005-09-11 11:22:53 +04:00
END( i a64 _ o s _ m c a _ v i r t u a l _ b e g i n )
/ / switch b a c k t o p r e v i o u s s t a c k
alloc r14 =ar . p f s ,0 ,0 ,0 ,0 / / r e m o v e t h e M C A h a n d l e r f r a m e
mov r3 =IA64_MCA_CPU_MCA_STACK_OFFSET / / u s e t h e M C A s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ o l d _ s t a c k
1 :
mov r3 =IA64_MCA_CPU_MCA_STACK_OFFSET / / u s e t h e M C A s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ s t a t e _ r e s t o r e / / r e s t o r e t h e S A L s t a t e
1 :
mov b0 =r12 / / S A L _ C H E C K r e t u r n a d d r e s s
br b0
/ / EndMain/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / StartMain/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
[IA64] kexec: Make INIT safe while transition to
kdump/kexec kernel
Summary:
Asserting INIT on the beginning of kdump/kexec kernel will result
in unexpected behavior because INIT handler for previous kernel is
invoked on new kernel.
Description:
In panic situation, we can receive INIT while kernel transition,
i.e. from beginning of panic to bootstrap of kdump kernel.
Since we initialize registers on leave from current kernel, no
longer monarch/slave handlers of current kernel in virtual mode are
called safely. (In fact system goes hang as far as I confirmed)
How to Reproduce:
Start kdump
# echo c > /proc/sysrq-trigger
Then assert INIT while kdump kernel is booting, before new INIT
handler for kdump kernel is registered.
Expected(Desirable) result:
kdump kernel boots without any problem, crashdump retrieved
Actual result:
INIT handler for previous kernel is invoked on kdump kernel
=> panic, hang etc. (unexpected)
Proposed fix:
We can unregister these init handlers from SAL before jumping into
new kernel, however then the INIT will fallback to default behavior,
result in warmboot by SAL (according to the SAL specification) and
we cannot retrieve the crashdump.
Therefore this patch introduces a NOP init handler and register it
to SAL before leave from current kernel, to start kdump safely by
preventing INITs from entering virtual mode and resulting in warmboot.
On the other hand, in case of kexec that not for kdump, it also
has same problem with INIT while kernel transition.
This patch handles this case differently, because for kexec
unregistering handlers will be preferred than registering NOP
handler, since the situation "no handlers registered" is usual
state for kernel's entry.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Haren Myneni <hbabu@us.ibm.com>
Cc: kexec@lists.infradead.org
Acked-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
2009-08-07 01:51:56 +04:00
/ /
/ / NOP i n i t h a n d l e r f o r k d u m p . I n p a n i c s i t u a t i o n , w e m a y r e c e i v e I N I T
/ / while k e r n e l t r a n s i t i o n . S i n c e w e i n i t i a l i z e r e g i s t e r s o n l e a v e f r o m
/ / current k e r n e l , n o l o n g e r m o n a r c h / s l a v e h a n d l e r s o f c u r r e n t k e r n e l i n
/ / virtual m o d e a r e c a l l e d s a f e l y .
/ / We c a n u n r e g i s t e r t h e s e i n i t h a n d l e r s f r o m S A L , h o w e v e r t h e n t h e I N I T
/ / will r e s u l t i n w a r m b o o t b y S A L a n d w e c a n n o t r e t r i e v e t h e c r a s h d u m p .
/ / Therefore r e g i s t e r t h i s N O P f u n c t i o n t o S A L , t o p r e v e n t e n t e r i n g v i r t u a l
/ / mode a n d r e s u l t i n g w a r m b o o t b y S A L .
/ /
ia64_os_init_on_kdump :
mov r8 =r0 / / I A 6 4 _ I N I T _ R E S U M E
mov r9 =r10 / / S A L _ G P
mov r22 =r17 / / * m i n s t a t e
;;
mov r10 =r0 / / r e t u r n t o s a m e c o n t e x t
mov b0 =r12 / / S A L _ C H E C K r e t u r n a d d r e s s
br b0
2005-09-11 11:22:53 +04:00
/ /
/ / SAL t o O S e n t r y p o i n t f o r I N I T o n a l l p r o c e s s o r s . T h i s h a s b e e n d e f i n e d f o r
/ / registration p u r p o s e s w i t h S A L a s a p a r t o f i a64 _ m c a _ i n i t . M o n a r c h a n d
/ / slave I N I T h a v e i d e n t i c a l p r o c e s s i n g , e x c e p t f o r t h e v a l u e o f t h e
/ / sos- > m o n a r c h f l a g i n r19 .
/ /
ia64_os_init_dispatch_monarch :
mov r19 =1 / / B o w , b o w , y e l o w e r m i d d l e c l a s s e s !
br. s p t k i a64 _ o s _ i n i t _ d i s p a t c h
ia64_os_init_dispatch_slave :
mov r19 =0 / / < i g o r > y e t h , m a t h t e r < / i g o r >
ia64_os_init_dispatch :
mov r3 =IA64_MCA_CPU_INIT_STACK_OFFSET / / u s e t h e I N I T s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ s t a t e _ s a v e / / s a v e t h e s t a t e t h a t i s n o t i n m i n s t a t e
1 :
/ / switch t o p e r c p u I N I T s t a c k
mov r3 =IA64_MCA_CPU_INIT_STACK_OFFSET / / u s e t h e I N I T s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ n e w _ s t a c k
1 :
/ / everything s a v e d , n o w w e c a n s e t t h e k e r n e l r e g i s t e r s
mov r3 =IA64_MCA_CPU_INIT_STACK_OFFSET / / u s e t h e I N I T s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ s e t _ k e r n e l _ r e g i s t e r s
1 :
/ / This m u s t b e d o n e i n p h y s i c a l m o d e
2005-04-17 02:20:36 +04:00
GET_ I A 6 4 _ M C A _ D A T A ( r2 )
;;
2005-09-11 11:22:53 +04:00
mov r7 =r2
/ / Enter v i r t u a l m o d e f r o m p h y s i c a l m o d e
VIRTUAL_ M O D E _ E N T E R ( r2 , r3 , i a64 _ o s _ i n i t _ v i r t u a l _ b e g i n , r4 )
/ / This c o d e r e t u r n s t o S A L v i a S O S r2 , i n g e n e r a l S A L h a s n o u n w i n d
/ / data. T o g e t a c l e a n t e r m i n a t i o n w h e n b a c k t r a c i n g t h e C M C A / I N I T
/ / handler, s e t a d u m m y r e t u r n a d d r e s s o f 0 i n t h i s r o u t i n e . T h a t
/ / requires t h a t i a64 _ o s _ i n i t _ v i r t u a l _ b e g i n b e a g l o b a l f u n c t i o n .
ENTRY( i a64 _ o s _ i n i t _ v i r t u a l _ b e g i n )
.prologue
.save rp,r0
.body
mov a r . r s c =3 / / s e t e a g e r m o d e f o r C h a n d l e r
mov r2 =r7 / / s e e G E T _ I A 6 4 _ M C A _ D A T A a b o v e
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
/ / Call v i r t u a l m o d e h a n d l e r
alloc r14 =ar . p f s ,0 ,0 ,3 ,0
;;
DATA_ P A _ T O _ V A ( r2 ,r7 )
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
add o u t 0 =IA64_MCA_CPU_INIT_STACK_OFFSET + M C A _ P T _ R E G S _ O F F S E T , r2
add o u t 1 =IA64_MCA_CPU_INIT_STACK_OFFSET + M C A _ S W I T C H _ S T A C K _ O F F S E T , r2
add o u t 2 =IA64_MCA_CPU_INIT_STACK_OFFSET + M C A _ S O S _ O F F S E T , r2
br. c a l l . s p t k . m a n y b0 =ia64_init_handler
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
/ / Revert b a c k t o p h y s i c a l m o d e b e f o r e g o i n g b a c k t o S A L
PHYSICAL_ M O D E _ E N T E R ( r2 , r3 , i a64 _ o s _ i n i t _ v i r t u a l _ e n d , r4 )
ia64_os_init_virtual_end :
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
END( i a64 _ o s _ i n i t _ v i r t u a l _ b e g i n )
mov r3 =IA64_MCA_CPU_INIT_STACK_OFFSET / / u s e t h e I N I T s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ s t a t e _ r e s t o r e / / r e s t o r e t h e S A L s t a t e
1 :
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
/ / switch b a c k t o p r e v i o u s s t a c k
alloc r14 =ar . p f s ,0 ,0 ,0 ,0 / / r e m o v e t h e I N I T h a n d l e r f r a m e
mov r3 =IA64_MCA_CPU_INIT_STACK_OFFSET / / u s e t h e I N I T s t a c k
LOAD_ P H Y S I C A L ( p0 ,r2 ,1 f ) / / r e t u r n a d d r e s s
br. s p t k i a64 _ o l d _ s t a c k
1 :
mov b0 =r12 / / S A L _ C H E C K r e t u r n a d d r e s s
2005-04-17 02:20:36 +04:00
br b0
2005-09-11 11:22:53 +04:00
2005-04-17 02:20:36 +04:00
/ / EndMain/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
2005-09-11 11:22:53 +04:00
/ / common d e f i n e s f o r t h e s t u b s
# define m s r4
# define r e g s r5
# define t e m p1 r2 / * c a r e f u l , i t o v e r l a p s w i t h i n p u t r e g i s t e r s * /
# define t e m p2 r3 / * c a r e f u l , i t o v e r l a p s w i t h i n p u t r e g i s t e r s * /
# define t e m p3 r7
# define t e m p4 r14
2005-04-17 02:20:36 +04:00
/ / + +
/ / Name :
2005-09-11 11:22:53 +04:00
/ / ia6 4 _ s t a t e _ s a v e ( )
2005-04-17 02:20:36 +04:00
/ /
/ / Stub D e s c r i p t i o n :
/ /
2005-09-11 11:22:53 +04:00
/ / Save t h e s t a t e t h a t i s n o t i n m i n s t a t e . T h i s i s s e n s i t i v e t o t h e l a y o u t o f
/ / struct i a64 _ s a l _ o s _ s t a t e i n m c a . h .
/ /
/ / r2 c o n t a i n s t h e r e t u r n a d d r e s s , r3 c o n t a i n s e i t h e r
/ / IA6 4 _ M C A _ C P U _ M C A _ S T A C K _ O F F S E T o r I A 6 4 _ M C A _ C P U _ I N I T _ S T A C K _ O F F S E T .
/ /
/ / The O S t o S A L s e c t i o n o f s t r u c t i a64 _ s a l _ o s _ s t a t e i s s e t t o a d e f a u l t
/ / value o f c o l d b o o t ( M C A ) o r w a r m b o o t ( I N I T ) a n d r e t u r n t o t h e s a m e
/ / context. i a64 _ s a l _ o s _ s t a t e i s a l s o u s e d t o h o l d s o m e r e g i s t e r s t h a t
/ / need t o b e s a v e d a n d r e s t o r e d a c r o s s t h e s t a c k s w i t c h e s .
/ /
/ / Most i n p u t r e g i s t e r s t o t h i s s t u b c o m e f r o m P A L / S A L
/ / r1 o s g p , p h y s i c a l
/ / r8 p a l _ p r o c e n t r y p o i n t
/ / r9 s a l _ p r o c e n t r y p o i n t
/ / r1 0 s a l g p
/ / r1 1 M C A - r e n d e v z o u s s t a t e , I N I T - r e a s o n c o d e
/ / r1 2 s a l r e t u r n a d d r e s s
/ / r1 7 p a l m i n _ s t a t e
/ / r1 8 p r o c e s s o r s t a t e p a r a m e t e r
/ / r1 9 m o n a r c h f l a g , s e t b y t h e c a l l e r o f t h i s r o u t i n e
/ /
/ / In a d d i t i o n t o t h e S A L t o O S s t a t e , t h i s r o u t i n e s a v e s a l l t h e
/ / registers t h a t a p p e a r i n s t r u c t p t _ r e g s a n d s t r u c t s w i t c h _ s t a c k ,
/ / excluding t h o s e t h a t a r e a l r e a d y i n t h e P A L m i n s t a t e a r e a . T h i s
/ / results i n a p a r t i a l p t _ r e g s a n d s w i t c h _ s t a c k , t h e C c o d e c o p i e s t h e
/ / remaining r e g i s t e r s f r o m P A L m i n s t a t e t o p t _ r e g s a n d s w i t c h _ s t a c k . T h e
/ / resulting s t r u c t u r e s c o n t a i n a l l t h e s t a t e o f t h e o r i g i n a l p r o c e s s w h e n
/ / MCA/ I N I T o c c u r r e d .
2005-04-17 02:20:36 +04:00
/ /
/ / - -
2005-09-11 11:22:53 +04:00
ia64_state_save :
add r e g s =MCA_SOS_OFFSET , r3
add m s =MCA_SOS_OFFSET + 8 , r3
mov b0 =r2 / / s a v e r e t u r n a d d r e s s
cmp. e q p1 ,p2 =IA64_MCA_CPU_MCA_STACK_OFFSET , r3
;;
GET_ I A 6 4 _ M C A _ D A T A ( t e m p2 )
;;
add t e m p1 =temp2 , r e g s / / s t r u c t i a64 _ s a l _ o s _ s t a t e o n M C A o r I N I T s t a c k
add t e m p2 =temp2 , m s / / s t r u c t i a64 _ s a l _ o s _ s t a t e + 8 o n M C A o r I N I T s t a c k
;;
mov r e g s =temp1 / / s a v e t h e s t a r t o f s o s
st8 [ t e m p1 ] =r1 ,1 6 / / o s _ g p
st8 [ t e m p2 ] =r8 ,1 6 / / p a l _ p r o c
;;
st8 [ t e m p1 ] =r9 ,1 6 / / s a l _ p r o c
st8 [ t e m p2 ] =r11 ,1 6 / / r v _ r c
mov r11 =cr . i i p a
;;
2006-04-07 12:08:11 +04:00
st8 [ t e m p1 ] =r18 / / p r o c _ s t a t e _ p a r a m
st8 [ t e m p2 ] =r19 / / m o n a r c h
2005-09-11 11:22:53 +04:00
mov r6 =IA64_KR ( C U R R E N T )
2006-04-07 12:08:11 +04:00
add t e m p1 =SOS ( S A L _ R A ) , r e g s
add t e m p2 =SOS ( S A L _ G P ) , r e g s
2005-09-11 11:22:53 +04:00
;;
st8 [ t e m p1 ] =r12 ,1 6 / / s a l _ r a
st8 [ t e m p2 ] =r10 ,1 6 / / s a l _ g p
mov r12 =cr . i s r
;;
st8 [ t e m p1 ] =r17 ,1 6 / / p a l _ m i n _ s t a t e
st8 [ t e m p2 ] =r6 ,1 6 / / p r e v _ I A 6 4 _ K R _ C U R R E N T
2005-09-22 12:49:15 +04:00
mov r6 =IA64_KR ( C U R R E N T _ S T A C K )
;;
st8 [ t e m p1 ] =r6 ,1 6 / / p r e v _ I A 6 4 _ K R _ C U R R E N T _ S T A C K
st8 [ t e m p2 ] =r0 ,1 6 / / p r e v _ t a s k , s t a r t s o f f a s N U L L
2005-09-11 11:22:53 +04:00
mov r6 =cr . i f a
;;
2005-09-22 12:49:15 +04:00
st8 [ t e m p1 ] =r12 ,1 6 / / c r . i s r
st8 [ t e m p2 ] =r6 ,1 6 / / c r . i f a
2005-09-11 11:22:53 +04:00
mov r12 =cr . i t i r
;;
2005-09-22 12:49:15 +04:00
st8 [ t e m p1 ] =r12 ,1 6 / / c r . i t i r
st8 [ t e m p2 ] =r11 ,1 6 / / c r . i i p a
2005-09-11 11:22:53 +04:00
mov r12 =cr . i i m
;;
2006-04-07 12:08:11 +04:00
st8 [ t e m p1 ] =r12 / / c r . i i m
2005-09-11 11:22:53 +04:00
( p1 ) m o v r12 =IA64_MCA_COLD_BOOT
( p2 ) m o v r12 =IA64_INIT_WARM_BOOT
2005-09-22 12:49:15 +04:00
mov r6 =cr . i h a
2006-04-07 12:08:11 +04:00
add t e m p1 =SOS ( O S _ S T A T U S ) , r e g s
2005-09-11 11:22:53 +04:00
;;
2006-04-07 12:08:11 +04:00
st8 [ t e m p2 ] =r6 / / c r . i h a
add t e m p2 =SOS ( C O N T E X T ) , r e g s
2005-09-22 12:49:15 +04:00
st8 [ t e m p1 ] =r12 / / o s _ s t a t u s , d e f a u l t i s c o l d b o o t
2005-09-11 11:22:53 +04:00
mov r6 =IA64_MCA_SAME_CONTEXT
;;
2006-01-24 04:31:26 +03:00
st8 [ t e m p2 ] =r6 / / c o n t e x t , d e f a u l t i s s a m e c o n t e x t
2005-09-11 11:22:53 +04:00
/ / Save t h e p t _ r e g s d a t a t h a t i s n o t i n m i n s t a t e . T h e p r e v i o u s c o d e
/ / left r e g s a t s o s .
add r e g s =MCA_PT_REGS_OFFSET - M C A _ S O S _ O F F S E T , r e g s
;;
add t e m p1 =PT ( B 6 ) , r e g s
mov t e m p3 =b6
mov t e m p4 =b7
add t e m p2 =PT ( B 7 ) , r e g s
;;
st8 [ t e m p1 ] =temp3 ,P T ( A R _ C S D ) - P T ( B 6 ) / / s a v e b6
st8 [ t e m p2 ] =temp4 ,P T ( A R _ S S D ) - P T ( B 7 ) / / s a v e b7
mov t e m p3 =ar . c s d
mov t e m p4 =ar . s s d
cover / / m u s t b e l a s t i n g r o u p
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
st8 [ t e m p1 ] =temp3 ,P T ( A R _ U N A T ) - P T ( A R _ C S D ) / / s a v e a r . c s d
st8 [ t e m p2 ] =temp4 ,P T ( A R _ P F S ) - P T ( A R _ S S D ) / / s a v e a r . s s d
mov t e m p3 =ar . u n a t
mov t e m p4 =ar . p f s
;;
st8 [ t e m p1 ] =temp3 ,P T ( A R _ R N A T ) - P T ( A R _ U N A T ) / / s a v e a r . u n a t
st8 [ t e m p2 ] =temp4 ,P T ( A R _ B S P S T O R E ) - P T ( A R _ P F S ) / / s a v e a r . p f s
mov t e m p3 =ar . r n a t
mov t e m p4 =ar . b s p s t o r e
;;
st8 [ t e m p1 ] =temp3 ,P T ( L O A D R S ) - P T ( A R _ R N A T ) / / s a v e a r . r n a t
st8 [ t e m p2 ] =temp4 ,P T ( A R _ F P S R ) - P T ( A R _ B S P S T O R E ) / / s a v e a r . b s p s t o r e
mov t e m p3 =ar . b s p
;;
sub t e m p3 =temp3 , t e m p4 / / a r . b s p - a r . b s p s t o r e
mov t e m p4 =ar . f p s r
;;
shl t e m p3 =temp3 ,1 6 / / c o m p u t e a r . r s c t o b e u s e d f o r " l o a d r s "
;;
st8 [ t e m p1 ] =temp3 ,P T ( A R _ C C V ) - P T ( L O A D R S ) / / s a v e l o a d r s
st8 [ t e m p2 ] =temp4 ,P T ( F 6 ) - P T ( A R _ F P S R ) / / s a v e a r . f p s r
mov t e m p3 =ar . c c v
;;
st8 [ t e m p1 ] =temp3 ,P T ( F 7 ) - P T ( A R _ C C V ) / / s a v e a r . c c v
stf. s p i l l [ t e m p2 ] =f6 ,P T ( F 8 ) - P T ( F 6 )
;;
stf. s p i l l [ t e m p1 ] =f7 ,P T ( F 9 ) - P T ( F 7 )
stf. s p i l l [ t e m p2 ] =f8 ,P T ( F 1 0 ) - P T ( F 8 )
;;
stf. s p i l l [ t e m p1 ] =f9 ,P T ( F 1 1 ) - P T ( F 9 )
stf. s p i l l [ t e m p2 ] =f10
;;
stf. s p i l l [ t e m p1 ] =f11
/ / Save t h e s w i t c h _ s t a c k d a t a t h a t i s n o t i n m i n s t a t e n o r p t _ r e g s . T h e
/ / previous c o d e l e f t r e g s a t p t _ r e g s .
add r e g s =MCA_SWITCH_STACK_OFFSET - M C A _ P T _ R E G S _ O F F S E T , r e g s
;;
add t e m p1 =SW ( F 2 ) , r e g s
add t e m p2 =SW ( F 3 ) , r e g s
;;
stf. s p i l l [ t e m p1 ] =f2 ,3 2
stf. s p i l l [ t e m p2 ] =f3 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f4 ,3 2
stf. s p i l l [ t e m p2 ] =f5 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f12 ,3 2
stf. s p i l l [ t e m p2 ] =f13 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f14 ,3 2
stf. s p i l l [ t e m p2 ] =f15 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f16 ,3 2
stf. s p i l l [ t e m p2 ] =f17 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f18 ,3 2
stf. s p i l l [ t e m p2 ] =f19 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f20 ,3 2
stf. s p i l l [ t e m p2 ] =f21 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f22 ,3 2
stf. s p i l l [ t e m p2 ] =f23 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f24 ,3 2
stf. s p i l l [ t e m p2 ] =f25 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f26 ,3 2
stf. s p i l l [ t e m p2 ] =f27 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f28 ,3 2
stf. s p i l l [ t e m p2 ] =f29 ,3 2
;;
stf. s p i l l [ t e m p1 ] =f30 ,S W ( B 2 ) - S W ( F 3 0 )
stf. s p i l l [ t e m p2 ] =f31 ,S W ( B 3 ) - S W ( F 3 1 )
mov t e m p3 =b2
mov t e m p4 =b3
;;
st8 [ t e m p1 ] =temp3 ,1 6 / / s a v e b2
st8 [ t e m p2 ] =temp4 ,1 6 / / s a v e b3
mov t e m p3 =b4
mov t e m p4 =b5
;;
st8 [ t e m p1 ] =temp3 ,S W ( A R _ L C ) - S W ( B 4 ) / / s a v e b4
st8 [ t e m p2 ] =temp4 / / s a v e b5
mov t e m p3 =ar . l c
;;
st8 [ t e m p1 ] =temp3 / / s a v e a r . l c
/ / FIXME : Some p r o m s a r e i n c o r r e c t l y a c c e s s i n g t h e m i n s t a t e a r e a a s
/ / cached d a t a . T h e C c o d e u s e s r e g i o n 6 , u n c a c h e d v i r t u a l . E n s u r e
/ / that t h e r e i s n o c a c h e d a t a l y i n g a r o u n d f o r t h e f i r s t 1 K o f t h e
/ / minstate a r e a .
/ / Remove t h i s c o d e i n S e p t e m b e r 2 0 0 6 , t h a t g i v e s p l a t f o r m s a y e a r t o
/ / fix t h e i r p r o m s a n d g e t t h e i r c u s t o m e r s u p d a t e d .
add r1 =32 * 1 ,r17
add r2 =32 * 2 ,r17
add r3 =32 * 3 ,r17
add r4 =32 * 4 ,r17
add r5 =32 * 5 ,r17
add r6 =32 * 6 ,r17
add r7 =32 * 7 ,r17
;;
fc r17
fc r1
fc r2
fc r3
fc r4
fc r5
fc r6
fc r7
add r17 =32 * 8 ,r17
add r1 =32 * 8 ,r1
add r2 =32 * 8 ,r2
add r3 =32 * 8 ,r3
add r4 =32 * 8 ,r4
add r5 =32 * 8 ,r5
add r6 =32 * 8 ,r6
add r7 =32 * 8 ,r7
;;
fc r17
fc r1
fc r2
fc r3
fc r4
fc r5
fc r6
fc r7
add r17 =32 * 8 ,r17
add r1 =32 * 8 ,r1
add r2 =32 * 8 ,r2
add r3 =32 * 8 ,r3
add r4 =32 * 8 ,r4
add r5 =32 * 8 ,r5
add r6 =32 * 8 ,r6
add r7 =32 * 8 ,r7
;;
fc r17
fc r1
fc r2
fc r3
fc r4
fc r5
fc r6
fc r7
add r17 =32 * 8 ,r17
add r1 =32 * 8 ,r1
add r2 =32 * 8 ,r2
add r3 =32 * 8 ,r3
add r4 =32 * 8 ,r4
add r5 =32 * 8 ,r5
add r6 =32 * 8 ,r6
add r7 =32 * 8 ,r7
;;
fc r17
fc r1
fc r2
fc r3
fc r4
fc r5
fc r6
fc r7
br. s p t k b0
2005-04-17 02:20:36 +04:00
/ / EndStub/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / + +
/ / Name :
2005-09-11 11:22:53 +04:00
/ / ia6 4 _ s t a t e _ r e s t o r e ( )
2005-04-17 02:20:36 +04:00
/ /
/ / Stub D e s c r i p t i o n :
/ /
2005-09-11 11:22:53 +04:00
/ / Restore t h e S A L / O S s t a t e . T h i s i s s e n s i t i v e t o t h e l a y o u t o f s t r u c t
/ / ia6 4 _ s a l _ o s _ s t a t e i n m c a . h .
/ /
/ / r2 c o n t a i n s t h e r e t u r n a d d r e s s , r3 c o n t a i n s e i t h e r
/ / IA6 4 _ M C A _ C P U _ M C A _ S T A C K _ O F F S E T o r I A 6 4 _ M C A _ C P U _ I N I T _ S T A C K _ O F F S E T .
/ /
/ / In a d d i t i o n t o t h e S A L t o O S s t a t e , t h i s r o u t i n e r e s t o r e s a l l t h e
/ / registers t h a t a p p e a r i n s t r u c t p t _ r e g s a n d s t r u c t s w i t c h _ s t a c k ,
/ / excluding t h o s e i n t h e P A L m i n s t a t e a r e a .
2005-04-17 02:20:36 +04:00
/ /
/ / - -
2005-09-11 11:22:53 +04:00
ia64_state_restore :
/ / Restore t h e s w i t c h _ s t a c k d a t a t h a t i s n o t i n m i n s t a t e n o r p t _ r e g s .
add r e g s =MCA_SWITCH_STACK_OFFSET , r3
mov b0 =r2 / / s a v e r e t u r n a d d r e s s
;;
GET_ I A 6 4 _ M C A _ D A T A ( t e m p2 )
;;
add r e g s =temp2 , r e g s
;;
add t e m p1 =SW ( F 2 ) , r e g s
add t e m p2 =SW ( F 3 ) , r e g s
;;
ldf. f i l l f2 = [ t e m p1 ] ,3 2
ldf. f i l l f3 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f4 = [ t e m p1 ] ,3 2
ldf. f i l l f5 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f12 = [ t e m p1 ] ,3 2
ldf. f i l l f13 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f14 = [ t e m p1 ] ,3 2
ldf. f i l l f15 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f16 = [ t e m p1 ] ,3 2
ldf. f i l l f17 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f18 = [ t e m p1 ] ,3 2
ldf. f i l l f19 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f20 = [ t e m p1 ] ,3 2
ldf. f i l l f21 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f22 = [ t e m p1 ] ,3 2
ldf. f i l l f23 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f24 = [ t e m p1 ] ,3 2
ldf. f i l l f25 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f26 = [ t e m p1 ] ,3 2
ldf. f i l l f27 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f28 = [ t e m p1 ] ,3 2
ldf. f i l l f29 = [ t e m p2 ] ,3 2
;;
ldf. f i l l f30 = [ t e m p1 ] ,S W ( B 2 ) - S W ( F 3 0 )
ldf. f i l l f31 = [ t e m p2 ] ,S W ( B 3 ) - S W ( F 3 1 )
;;
ld8 t e m p3 = [ t e m p1 ] ,1 6 / / r e s t o r e b2
ld8 t e m p4 = [ t e m p2 ] ,1 6 / / r e s t o r e b3
;;
mov b2 =temp3
mov b3 =temp4
ld8 t e m p3 = [ t e m p1 ] ,S W ( A R _ L C ) - S W ( B 4 ) / / r e s t o r e b4
ld8 t e m p4 = [ t e m p2 ] / / r e s t o r e b5
;;
mov b4 =temp3
mov b5 =temp4
ld8 t e m p3 = [ t e m p1 ] / / r e s t o r e a r . l c
;;
mov a r . l c =temp3
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
/ / Restore t h e p t _ r e g s d a t a t h a t i s n o t i n m i n s t a t e . T h e p r e v i o u s c o d e
/ / left r e g s a t s w i t c h _ s t a c k .
add r e g s =MCA_PT_REGS_OFFSET - M C A _ S W I T C H _ S T A C K _ O F F S E T , r e g s
;;
add t e m p1 =PT ( B 6 ) , r e g s
add t e m p2 =PT ( B 7 ) , r e g s
;;
ld8 t e m p3 = [ t e m p1 ] ,P T ( A R _ C S D ) - P T ( B 6 ) / / r e s t o r e b6
ld8 t e m p4 = [ t e m p2 ] ,P T ( A R _ S S D ) - P T ( B 7 ) / / r e s t o r e b7
;;
mov b6 =temp3
mov b7 =temp4
ld8 t e m p3 = [ t e m p1 ] ,P T ( A R _ U N A T ) - P T ( A R _ C S D ) / / r e s t o r e a r . c s d
ld8 t e m p4 = [ t e m p2 ] ,P T ( A R _ P F S ) - P T ( A R _ S S D ) / / r e s t o r e a r . s s d
;;
mov a r . c s d =temp3
mov a r . s s d =temp4
ld8 t e m p3 = [ t e m p1 ] / / r e s t o r e a r . u n a t
add t e m p1 =PT ( A R _ C C V ) - P T ( A R _ U N A T ) , t e m p1
ld8 t e m p4 = [ t e m p2 ] ,P T ( A R _ F P S R ) - P T ( A R _ P F S ) / / r e s t o r e a r . p f s
;;
mov a r . u n a t =temp3
mov a r . p f s =temp4
/ / ar. r n a t , a r . b s p s t o r e , l o a d r s a r e r e s t o r e i n i a64 _ o l d _ s t a c k .
ld8 t e m p3 = [ t e m p1 ] ,P T ( F 6 ) - P T ( A R _ C C V ) / / r e s t o r e a r . c c v
ld8 t e m p4 = [ t e m p2 ] ,P T ( F 7 ) - P T ( A R _ F P S R ) / / r e s t o r e a r . f p s r
;;
mov a r . c c v =temp3
mov a r . f p s r =temp4
ldf. f i l l f6 = [ t e m p1 ] ,P T ( F 8 ) - P T ( F 6 )
ldf. f i l l f7 = [ t e m p2 ] ,P T ( F 9 ) - P T ( F 7 )
;;
ldf. f i l l f8 = [ t e m p1 ] ,P T ( F 1 0 ) - P T ( F 8 )
ldf. f i l l f9 = [ t e m p2 ] ,P T ( F 1 1 ) - P T ( F 9 )
;;
ldf. f i l l f10 = [ t e m p1 ]
ldf. f i l l f11 = [ t e m p2 ]
/ / Restore t h e S A L t o O S s t a t e . T h e p r e v i o u s c o d e l e f t r e g s a t p t _ r e g s .
add r e g s =MCA_SOS_OFFSET - M C A _ P T _ R E G S _ O F F S E T , r e g s
2005-04-17 02:20:36 +04:00
;;
2006-04-07 12:08:11 +04:00
add t e m p1 =SOS ( S A L _ R A ) , r e g s
add t e m p2 =SOS ( S A L _ G P ) , r e g s
2005-09-11 11:22:53 +04:00
;;
ld8 r12 = [ t e m p1 ] ,1 6 / / s a l _ r a
ld8 r9 = [ t e m p2 ] ,1 6 / / s a l _ g p
;;
2005-09-22 12:49:15 +04:00
ld8 r22 = [ t e m p1 ] ,1 6 / / p a l _ m i n _ s t a t e , v i r t u a l
2006-04-07 10:34:34 +04:00
ld8 r13 = [ t e m p2 ] ,1 6 / / p r e v _ I A 6 4 _ K R _ C U R R E N T
2005-09-11 11:22:53 +04:00
;;
2005-09-22 12:49:15 +04:00
ld8 r16 = [ t e m p1 ] ,1 6 / / p r e v _ I A 6 4 _ K R _ C U R R E N T _ S T A C K
ld8 r20 = [ t e m p2 ] ,1 6 / / p r e v _ t a s k
;;
2005-09-11 11:22:53 +04:00
ld8 t e m p3 = [ t e m p1 ] ,1 6 / / c r . i s r
ld8 t e m p4 = [ t e m p2 ] ,1 6 / / c r . i f a
;;
mov c r . i s r =temp3
mov c r . i f a =temp4
ld8 t e m p3 = [ t e m p1 ] ,1 6 / / c r . i t i r
ld8 t e m p4 = [ t e m p2 ] ,1 6 / / c r . i i p a
;;
mov c r . i t i r =temp3
mov c r . i i p a =temp4
2006-04-07 12:08:11 +04:00
ld8 t e m p3 = [ t e m p1 ] / / c r . i i m
ld8 t e m p4 = [ t e m p2 ] / / c r . i h a
add t e m p1 =SOS ( O S _ S T A T U S ) , r e g s
add t e m p2 =SOS ( C O N T E X T ) , r e g s
2005-09-11 11:22:53 +04:00
;;
mov c r . i i m =temp3
mov c r . i h a =temp4
2006-01-14 01:01:01 +03:00
dep r22 =0 ,r22 ,6 2 ,1 / / p a l _ m i n _ s t a t e , p h y s i c a l , u n c a c h e d
2006-04-07 10:34:34 +04:00
mov I A 6 4 _ K R ( C U R R E N T ) =r13
2005-09-11 11:22:53 +04:00
ld8 r8 = [ t e m p1 ] / / o s _ s t a t u s
ld8 r10 = [ t e m p2 ] / / c o n t e x t
2005-09-22 12:49:15 +04:00
/ * Wire I A 6 4 _ T R _ C U R R E N T _ S T A C K t o t h e s t a c k t h a t w e a r e r e s u m i n g t o . T o
* avoid a n y d e p e n d e n c i e s o n t h e a l g o r i t h m i n i a64 _ s w i t c h _ t o ( ) , j u s t
* purge a n y e x i s t i n g C U R R E N T _ S T A C K m a p p i n g a n d i n s e r t t h e n e w o n e .
*
2006-04-07 10:34:34 +04:00
* r1 6 c o n t a i n s p r e v _ I A 6 4 _ K R _ C U R R E N T _ S T A C K , r13 c o n t a i n s
2005-09-22 12:49:15 +04:00
* prev_ I A 6 4 _ K R _ C U R R E N T , t h e s e v a l u e s m a y h a v e b e e n c h a n g e d b y t h e C
* code. D o n o t u s e r8 , r9 , r10 , r22 , t h e y c o n t a i n v a l u e s r e a d y f o r
* the r e t u r n t o S A L .
* /
mov r15 =IA64_KR ( C U R R E N T _ S T A C K ) / / p h y s i c a l g r a n u l e m a p p e d b y I A 6 4 _ T R _ C U R R E N T _ S T A C K
;;
shl r15 =r15 ,I A 6 4 _ G R A N U L E _ S H I F T
;;
dep r15 = - 1 ,r15 ,6 1 ,3 / / v i r t u a l g r a n u l e
mov r18 =IA64_GRANULE_SHIFT < < 2 / / f o r c r . i t i r . p s
;;
ptr. d r15 ,r18
;;
srlz. d
2006-04-07 10:34:34 +04:00
extr. u r19 =r13 ,6 1 ,3 / / r13 = p r e v _ I A 6 4 _ K R _ C U R R E N T
2005-09-22 12:49:15 +04:00
shl r20 =r16 ,I A 6 4 _ G R A N U L E _ S H I F T / / r16 = p r e v _ I A 6 4 _ K R _ C U R R E N T _ S T A C K
movl r21 =PAGE_KERNEL / / p a g e p r o p e r t i e s
;;
mov I A 6 4 _ K R ( C U R R E N T _ S T A C K ) =r16
cmp. n e p6 ,p0 =RGN_KERNEL ,r19 / / n e w s t a c k i s i n t h e k e r n e l r e g i o n ?
or r21 =r20 ,r21 / / c o n s t r u c t P A | p a g e p r o p e r t i e s
( p6 ) b r . s p n t 1 f / / t h e d r e a d e d c p u 0 i d l e t a s k i n r e g i o n 5 : (
;;
mov c r . i t i r =r18
2006-04-07 10:34:34 +04:00
mov c r . i f a =r13
2005-09-22 12:49:15 +04:00
mov r20 =IA64_TR_CURRENT_STACK
;;
itr. d d t r [ r20 ] =r21
;;
srlz. d
1 :
2005-09-11 11:22:53 +04:00
br. s p t k b0
2005-04-17 02:20:36 +04:00
/ / EndStub/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
2005-09-11 11:22:53 +04:00
/ / + +
/ / Name :
/ / ia6 4 _ n e w _ s t a c k ( )
2005-04-17 02:20:36 +04:00
/ /
2005-09-11 11:22:53 +04:00
/ / Stub D e s c r i p t i o n :
2005-04-17 02:20:36 +04:00
/ /
2005-09-11 11:22:53 +04:00
/ / Switch t o t h e M C A / I N I T s t a c k .
2005-04-17 02:20:36 +04:00
/ /
2005-09-11 11:22:53 +04:00
/ / r2 c o n t a i n s t h e r e t u r n a d d r e s s , r3 c o n t a i n s e i t h e r
/ / IA6 4 _ M C A _ C P U _ M C A _ S T A C K _ O F F S E T o r I A 6 4 _ M C A _ C P U _ I N I T _ S T A C K _ O F F S E T .
2005-04-17 02:20:36 +04:00
/ /
2005-09-11 11:22:53 +04:00
/ / On e n t r y R B S i s s t i l l o n t h e o r i g i n a l s t a c k , t h i s r o u t i n e s w i t c h e s R B S
/ / to u s e t h e M C A / I N I T s t a c k .
2005-04-17 02:20:36 +04:00
/ /
2005-09-11 11:22:53 +04:00
/ / On e n t r y , s o s - > p a l _ m i n _ s t a t e i s p h y s i c a l , o n e x i t i t i s v i r t u a l .
/ /
/ / - -
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
ia64_new_stack :
add r e g s =MCA_PT_REGS_OFFSET , r3
2006-04-07 12:08:11 +04:00
add t e m p2 =MCA_SOS_OFFSET + S O S ( P A L _ M I N _ S T A T E ) , r3
2005-09-11 11:22:53 +04:00
mov b0 =r2 / / s a v e r e t u r n a d d r e s s
GET_ I A 6 4 _ M C A _ D A T A ( t e m p1 )
invala
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
add t e m p2 =temp2 , t e m p1 / / s t r u c t i a64 _ s a l _ o s _ s t a t e . p a l _ m i n _ s t a t e o n M C A o r I N I T s t a c k
add r e g s =regs , t e m p1 / / s t r u c t p t _ r e g s o n M C A o r I N I T s t a c k
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
/ / Address o f m i n s t a t e a r e a p r o v i d e d b y P A L i s p h y s i c a l , u n c a c h e a b l e .
/ / Convert t o L i n u x v i r t u a l a d d r e s s i n r e g i o n 6 f o r C c o d e .
ld8 m s = [ t e m p2 ] / / p a l _ m i n _ s t a t e , p h y s i c a l
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
dep t e m p1 = - 1 ,m s ,6 2 ,2 / / s e t r e g i o n 6
mov t e m p3 =IA64_RBS_OFFSET - M C A _ P T _ R E G S _ O F F S E T
;;
st8 [ t e m p2 ] =temp1 / / p a l _ m i n _ s t a t e , v i r t u a l
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
add t e m p4 =temp3 , r e g s / / s t a r t o f b s p s t o r e o n n e w s t a c k
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
mov a r . b s p s t o r e =temp4 / / s w i t c h R B S t o M C A / I N I T s t a c k
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
flushrs / / m u s t b e f i r s t i n g r o u p
br. s p t k b0
/ / EndStub/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / + +
/ / Name :
/ / ia6 4 _ o l d _ s t a c k ( )
/ /
/ / Stub D e s c r i p t i o n :
/ /
/ / Switch t o t h e o l d s t a c k .
/ /
/ / r2 c o n t a i n s t h e r e t u r n a d d r e s s , r3 c o n t a i n s e i t h e r
/ / IA6 4 _ M C A _ C P U _ M C A _ S T A C K _ O F F S E T o r I A 6 4 _ M C A _ C P U _ I N I T _ S T A C K _ O F F S E T .
/ /
/ / On e n t r y , p a l _ m i n _ s t a t e i s v i r t u a l , o n e x i t i t i s p h y s i c a l .
/ /
/ / On e n t r y R B S i s o n t h e M C A / I N I T s t a c k , t h i s r o u t i n e s w i t c h e s R B S
/ / back t o t h e p r e v i o u s s t a c k .
/ /
/ / The p s r i s s e t t o a l l z e r o e s . S A L r e t u r n r e q u i r e s e i t h e r a l l z e r o e s o r
/ / just p s r . m c s e t . L e a v i n g p s r . m c o f f a l l o w s I N I T t o b e i s s u e d i f t h i s
/ / code d o e s n o t p e r f o r m c o r r e c t l y .
/ /
/ / The d i r t y r e g i s t e r s a t t h e t i m e o f t h e e v e n t w e r e f l u s h e d t o t h e
/ / MCA/ I N I T s t a c k i n i a64 _ p t _ r e g s _ s a v e ( ) . R e s t o r e t h e d i r t y r e g i s t e r s
/ / before r e v e r t i n g t o t h e p r e v i o u s b s p s t o r e .
/ / - -
ia64_old_stack :
add r e g s =MCA_PT_REGS_OFFSET , r3
mov b0 =r2 / / s a v e r e t u r n a d d r e s s
GET_ I A 6 4 _ M C A _ D A T A ( t e m p2 )
LOAD_ P H Y S I C A L ( p0 ,t e m p1 ,1 f )
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
mov c r . i p s r =r0
mov c r . i f s =r0
mov c r . i i p =temp1
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
invala
2005-04-17 02:20:36 +04:00
rfi
2005-09-11 11:22:53 +04:00
1 :
add r e g s =regs , t e m p2 / / s t r u c t p t _ r e g s o n M C A o r I N I T s t a c k
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
add t e m p1 =PT ( L O A D R S ) , r e g s
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
ld8 t e m p2 = [ t e m p1 ] ,P T ( A R _ B S P S T O R E ) - P T ( L O A D R S ) / / r e s t o r e l o a d r s
2005-04-17 02:20:36 +04:00
;;
2005-09-11 11:22:53 +04:00
ld8 t e m p3 = [ t e m p1 ] ,P T ( A R _ R N A T ) - P T ( A R _ B S P S T O R E ) / / r e s t o r e a r . b s p s t o r e
mov a r . r s c =temp2
;;
loadrs
ld8 t e m p4 = [ t e m p1 ] / / r e s t o r e a r . r n a t
;;
mov a r . b s p s t o r e =temp3 / / b a c k t o o l d s t a c k
;;
mov a r . r n a t =temp4
;;
br. s p t k b0
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
/ / EndStub/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
/ / + +
/ / Name :
/ / ia6 4 _ s e t _ k e r n e l _ r e g i s t e r s ( )
2005-04-17 02:20:36 +04:00
/ /
2005-09-11 11:22:53 +04:00
/ / Stub D e s c r i p t i o n :
/ /
/ / Set t h e r e g i s t e r s t h a t a r e r e q u i r e d b y t h e C c o d e i n o r d e r t o r u n o n a n
/ / MCA/ I N I T s t a c k .
/ /
/ / r2 c o n t a i n s t h e r e t u r n a d d r e s s , r3 c o n t a i n s e i t h e r
/ / IA6 4 _ M C A _ C P U _ M C A _ S T A C K _ O F F S E T o r I A 6 4 _ M C A _ C P U _ I N I T _ S T A C K _ O F F S E T .
2005-04-17 02:20:36 +04:00
/ /
2005-09-11 11:22:53 +04:00
/ / - -
ia64_set_kernel_registers :
add t e m p3 =MCA_SP_OFFSET , r3
mov b0 =r2 / / s a v e r e t u r n a d d r e s s
GET_ I A 6 4 _ M C A _ D A T A ( t e m p1 )
;;
add r12 =temp1 , t e m p3 / / k e r n e l s t a c k p o i n t e r o n M C A / I N I T s t a c k
add r13 =temp1 , r3 / / s e t c u r r e n t t o s t a r t o f M C A / I N I T s t a c k
2005-09-22 12:49:15 +04:00
add r20 =temp1 , r3 / / p h y s i c a l s t a r t o f M C A / I N I T s t a c k
2005-09-11 11:22:53 +04:00
;;
DATA_ P A _ T O _ V A ( r12 ,t e m p2 )
DATA_ P A _ T O _ V A ( r13 ,t e m p3 )
;;
mov I A 6 4 _ K R ( C U R R E N T ) =r13
2005-09-22 12:49:15 +04:00
/ * Wire I A 6 4 _ T R _ C U R R E N T _ S T A C K t o t h e M C A / I N I T h a n d l e r s t a c k . T o a v o i d
* any d e p e n d e n c i e s o n t h e a l g o r i t h m i n i a64 _ s w i t c h _ t o ( ) , j u s t p u r g e
* any e x i s t i n g C U R R E N T _ S T A C K m a p p i n g a n d i n s e r t t h e n e w o n e .
* /
mov r16 =IA64_KR ( C U R R E N T _ S T A C K ) / / p h y s i c a l g r a n u l e m a p p e d b y I A 6 4 _ T R _ C U R R E N T _ S T A C K
;;
shl r16 =r16 ,I A 6 4 _ G R A N U L E _ S H I F T
;;
dep r16 = - 1 ,r16 ,6 1 ,3 / / v i r t u a l g r a n u l e
mov r18 =IA64_GRANULE_SHIFT < < 2 / / f o r c r . i t i r . p s
;;
ptr. d r16 ,r18
;;
srlz. d
shr. u r16 =r20 ,I A 6 4 _ G R A N U L E _ S H I F T / / r20 = p h y s i c a l s t a r t o f M C A / I N I T s t a c k
movl r21 =PAGE_KERNEL / / p a g e p r o p e r t i e s
;;
mov I A 6 4 _ K R ( C U R R E N T _ S T A C K ) =r16
or r21 =r20 ,r21 / / c o n s t r u c t P A | p a g e p r o p e r t i e s
;;
mov c r . i t i r =r18
mov c r . i f a =r13
mov r20 =IA64_TR_CURRENT_STACK
2006-09-19 03:37:15 +04:00
movl r17 =FPSR_DEFAULT
;;
mov. m a r . f p s r =r17 / / s e t a r . f p s r t o k e r n e l d e f a u l t v a l u e
2005-09-22 12:49:15 +04:00
;;
itr. d d t r [ r20 ] =r21
;;
srlz. d
2005-09-11 11:22:53 +04:00
br. s p t k b0
/ / EndStub/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
# undef m s
# undef r e g s
# undef t e m p1
# undef t e m p2
# undef t e m p3
# undef t e m p4
2005-04-17 02:20:36 +04:00
2005-09-11 11:22:53 +04:00
/ / Support f u n c t i o n f o r m c a . c , i t i s h e r e t o a v o i d u s i n g i n l i n e a s m . G i v e n t h e
/ / address o f a n r n a t s l o t , i f t h a t a d d r e s s i s b e l o w t h e c u r r e n t a r . b s p s t o r e
/ / then r e t u r n t h e c o n t e n t s o f t h a t s l o t , o t h e r w i s e r e t u r n t h e c o n t e n t s o f
/ / ar. r n a t .
GLOBAL_ E N T R Y ( i a64 _ g e t _ r n a t )
alloc r14 =ar . p f s ,1 ,0 ,0 ,0
mov a r . r s c =0
;;
mov r14 =ar . b s p s t o r e
;;
cmp. l t p6 ,p7 =in0 ,r14
;;
( p6 ) l d8 r8 = [ i n 0 ]
( p7 ) m o v r8 =ar . r n a t
mov a r . r s c =3
br. r e t . s p t k . m a n y r p
END( i a64 _ g e t _ r n a t )
[IA64] kdump: Mask MCA/INIT on frozen cpus
Summary:
INIT asserted on kdump kernel invokes INIT handler not only on a
cpu that running on the kdump kernel, but also BSP of the panicked
kernel, because the (badly) frozen BSP can be thawed by INIT.
Description:
The kdump_cpu_freeze() is called on cpus except one that initiates
panic and/or kdump, to stop/offline the cpu (on ia64, it means we
pass control of cpus to SAL, or put them in spinloop). Note that
CPU0(BSP) always go to spinloop, so if panic was happened on an AP,
there are at least 2cpus (= the AP and BSP) which not back to SAL.
On the spinning cpus, interrupts are disabled (rsm psr.i), but INIT
is still interruptible because psr.mc for mask them is not set unless
kdump_cpu_freeze() is not called from MCA/INIT context.
Therefore, assume that a panic was happened on an AP, kdump was
invoked, new INIT handlers for kdump kernel was registered and then
an INIT is asserted. From the viewpoint of SAL, there are 2 online
cpus, so INIT will be delivered to both of them. It likely means
that not only the AP (= a cpu executing kdump) enters INIT handler
which is newly registered, but also BSP (= another cpu spinning in
panicked kernel) enters the same INIT handler. Of course setting of
registers in BSP are still old (for panicked kernel), so what happen
with running handler with wrong setting will be extremely unexpected.
I believe this is not desirable behavior.
How to Reproduce:
Start kdump on one of APs (e.g. cpu1)
# taskset 0x2 echo c > /proc/sysrq-trigger
Then assert INIT after kdump kernel is booted, after new INIT handler
for kdump kernel is registered.
Expected results:
An INIT handler is invoked only on the AP.
Actual results:
An INIT handler is invoked on the AP and BSP.
Sample of results:
I got following console log by asserting INIT after prompt "root:/>".
It seems that two monarchs appeared by one INIT, and one panicked at
last. And it also seems that the panicked one supposed there were
4 online cpus and no one did rendezvous:
:
[ 0 %]dropping to initramfs shell
exiting this shell will reboot your system
root:/> Entered OS INIT handler. PSP=fff301a0 cpu=0 monarch=0
ia64_init_handler: Promoting cpu 0 to monarch.
Delaying for 5 seconds...
All OS INIT slaves have reached rendezvous
Processes interrupted by INIT - 0 (cpu 0 task 0xa000000100af0000)
:
<<snip>>
:
Entered OS INIT handler. PSP=fff301a0 cpu=0 monarch=1
Delaying for 5 seconds...
mlogbuf_finish: printing switched to urgent mode, MCA/INIT might be dodgy or fail.
OS INIT slave did not rendezvous on cpu 1 2 3
INIT swapper 0[0]: bugcheck! 0 [1]
:
<<snip>>
:
Kernel panic - not syncing: Attempted to kill the idle task!
Proposed fix:
To avoid this problem, this patch inserts ia64_set_psr_mc() to mask
INIT on cpus going to be frozen. This masking have no effect if the
kdump_cpu_freeze() is called from INIT handler when kdump_on_init == 1,
because psr.mc is already turned on to 1 before entering OS_INIT.
I confirmed that weird log like above are disappeared after applying
this patch.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Haren Myneni <hbabu@us.ibm.com>
Cc: kexec@lists.infradead.org
Acked-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
2009-08-07 01:51:56 +04:00
/ / void i a64 _ s e t _ p s r _ m c ( v o i d )
/ /
/ / Set p s r . m c b i t t o m a s k M C A / I N I T .
GLOBAL_ E N T R Y ( i a64 _ s e t _ p s r _ m c )
rsm p s r . i | p s r . i c / / d i s a b l e i n t e r r u p t s
;;
srlz. d
;;
mov r14 = p s r / / g e t p s r { 3 6 : 3 5 ,3 1 : 0 }
movl r15 = 1 f
;;
dep r14 = - 1 , r14 , P S R _ M C , 1 / / s e t p s r . m c
;;
dep r14 = - 1 , r14 , P S R _ I C , 1 / / s e t p s r . i c
;;
dep r14 = - 1 , r14 , P S R _ B N , 1 / / k e e p b a n k 1 i n u s e
;;
mov c r . i p s r = r14
mov c r . i f s = r0
mov c r . i i p = r15
;;
rfi
1 :
br. r e t . s p t k . m a n y r p
END( i a64 _ s e t _ p s r _ m c )