PERFORCE change 93086 for review
Kip Macy
kmacy at FreeBSD.org
Thu Mar 9 17:13:19 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=93086
Change 93086 by kmacy at kmacy_storage:sun4v_work on 2006/03/10 01:13:01
support 64-bit spill traps at TL 1
handle case of pmap_activate not being called
support user page fault in from kernel
start_init makes it to execve
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/include/asmacros.h#7 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/include/tsb.h#10 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/include/tte_hash.h#5 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/exception.S#22 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#20 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tsb.c#9 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tte_hash.c#7 edit
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/wbuf.S#3 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/include/asmacros.h#7 (text+ko) ====
@@ -200,6 +200,42 @@
ldx [TF + TF_O6], %i6; \
ldx [TF + TF_O7], %i7;
+#define SAVE_WINDOW(SBP) \
+ stx %l0, [SBP + (0*8)]; \
+ stx %l1, [SBP + (1*8)]; \
+ stx %l2, [SBP + (2*8)]; \
+ stx %l3, [SBP + (3*8)]; \
+ stx %l4, [SBP + (4*8)]; \
+ stx %l5, [SBP + (5*8)]; \
+ stx %l6, [SBP + (6*8)]; \
+ stx %l7, [SBP + (7*8)]; \
+ stx %i0, [SBP + (8*8)]; \
+ stx %i1, [SBP + (9*8)]; \
+ stx %i2, [SBP + (10*8)]; \
+ stx %i3, [SBP + (11*8)]; \
+ stx %i4, [SBP + (12*8)]; \
+ stx %i5, [SBP + (13*8)]; \
+ stx %i6, [SBP + (14*8)]; \
+ stx %i7, [SBP + (15*8)];
+
+#define SAVE_WINDOW_ASI(SBP) \
+ stxa %l0, [SBP + (0*8)]%asi; \
+ stxa %l1, [SBP + (1*8)]%asi; \
+ stxa %l2, [SBP + (2*8)]%asi; \
+ stxa %l3, [SBP + (3*8)]%asi; \
+ stxa %l4, [SBP + (4*8)]%asi; \
+ stxa %l5, [SBP + (5*8)]%asi; \
+ stxa %l6, [SBP + (6*8)]%asi; \
+ stxa %l7, [SBP + (7*8)]%asi; \
+ stxa %i0, [SBP + (8*8)]%asi; \
+ stxa %i1, [SBP + (9*8)]%asi; \
+ stxa %i2, [SBP + (10*8)]%asi; \
+ stxa %i3, [SBP + (11*8)]%asi; \
+ stxa %i4, [SBP + (12*8)]%asi; \
+ stxa %i5, [SBP + (13*8)]%asi; \
+ stxa %i6, [SBP + (14*8)]%asi; \
+ stxa %i7, [SBP + (15*8)]%asi;
+
#endif /* LOCORE */
#endif /* _KERNEL */
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/include/tsb.h#10 (text+ko) ====
@@ -24,7 +24,7 @@
struct hv_tsb_info;
-vm_paddr_t tsb_init(struct hv_tsb_info *tsb);
+vm_paddr_t tsb_init(struct hv_tsb_info *tsb, uint64_t *scratchval);
void tsb_deinit(struct hv_tsb_info *tsb);
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/include/tte_hash.h#5 (text+ko) ====
@@ -10,7 +10,7 @@
tte_hash_t tte_hash_kernel_create(vm_offset_t, uint64_t);
-tte_hash_t tte_hash_create(uint64_t context);
+tte_hash_t tte_hash_create(uint64_t context, uint64_t *scratchval);
void tte_hash_destroy(tte_hash_t th);
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/exception.S#22 (text+ko) ====
@@ -763,6 +763,7 @@
tl1_reserved 8 ! 0x228-0x22f
tl1_data_excptn_230:
data_excptn ! 0x230
+tl1_data_miss_231:
data_miss ! 0x231
tl1_reserved 2 ! 0x232-0x233
tl1_align:
@@ -1020,12 +1021,17 @@
SAVE_OUTS(%l7) ! for the call bug workaround
wrpr %g0, PSTATE_KERNEL, %pstate ! enable ints
! MAGIC_TRAP_OFF
+ #if 0
call critical_enter
nop
+ #endif
+ stx %l4, [%l7 + TF_TYPE] ! save trap type
jmpl %l3, %o7 ! call trap handler
mov %l7, %o0
+ #if 0
call critical_exit
nop
+ #endif
! MAGIC_TRAP_ON
ENTRY(krtt)
GET_PCPU_SCRATCH
@@ -1088,8 +1094,10 @@
set ktl0, %g4
save %sp, -(CCFSZ + TF_SIZEOF), %sp
+
mov %g2, %l3 ! set trap/interrupt for tl0
-
+ or %g1, T_KERNEL, %l4 ! pil/trap type
+
! if the kwbuf is full we need to save to the stack now
ld [PCPU_REG + PC_KWBUF_FULL], %o0
brz,pt %o0, 1f
@@ -1122,6 +1130,7 @@
! %g7 == PCPU
! %g3-%g5 temporaries
ENTRY(tl0_trap)
+ GET_PCPU_SCRATCH
rdpr %tstate, %g3
btst TSTATE_PRIV, %g3
and %g3, TSTATE_CWP_MASK, %g4
@@ -1202,7 +1211,7 @@
illtrap ! give up
3:
#endif
- sethi %hi(PAGE_MASK), %g7
+ sethi %hi(PAGE_SIZE), %g7
sub %g7, 1, %g7 ! %g7==PAGE_MASK
and %g2, %g7, %g4 ! size stored in lower 13 bits
@@ -1266,10 +1275,10 @@
4: ! not found
! we need to jump to tl0_trap to drop us back down to tl0
! and take us to trap(...) to service the fault
- ! skipping this step for the moment so we just do an illtrap
+ mov T_DATA_MISS, %g1
+ sethi %hi(trap), %g2
ba %xcc, tl0_trap
- mov T_DATA_MISS, %g1
-
+ or %g2, %lo(trap), %g2
tsb_miss_found:
5: !found
! %g1 == abs index %g2 == THE pointer %g3 == flags
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/pmap.c#20 (text+ko) ====
@@ -342,7 +342,7 @@
pmap_activate(struct thread *td)
{
pmap_t pmap, oldpmap;
-
+ printf("activating pmap\n");
critical_enter();
pmap = vmspace_pmap(td->td_proc->p_vmspace);
@@ -1176,8 +1176,8 @@
KASSERT(context < PMAP_CONTEXT_MAX,
("max context limit hit - need to implement context recycling"));
- pmap->pm_hash = tte_hash_create(pmap->pm_context);
- pmap->pm_tsb_ra = tsb_init(&pmap->pm_tsb);
+ pmap->pm_hash = tte_hash_create(pmap->pm_context, &pmap->pm_hashscratch);
+ pmap->pm_tsb_ra = tsb_init(&pmap->pm_tsb, &pmap->pm_tsbscratch);
pmap->pm_active = 0;
TAILQ_INIT(&pmap->pm_pvlist);
bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tsb.c#9 (text+ko) ====
@@ -62,10 +62,11 @@
#endif
vm_paddr_t
-tsb_init(hv_tsb_info_t *hvtsb)
+tsb_init(hv_tsb_info_t *hvtsb, uint64_t *scratchval)
{
vm_page_t m;
int granted;
+ uint64_t tsb_pages;
static int color;
granted = 0;
@@ -86,6 +87,9 @@
hvtsb->hvtsb_pgszs = TSB8K;
hvtsb->hvtsb_rsvd = 0;
hvtsb->hvtsb_pa = VM_PAGE_TO_PHYS(m);
+
+ tsb_pages = hvtsb->hvtsb_ntte >> (PAGE_SHIFT - TTE_SHIFT);
+ *scratchval = hvtsb->hvtsb_pa | tsb_pages;
return vtophys(hvtsb);
}
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/tte_hash.c#7 (text+ko) ====
@@ -141,7 +141,7 @@
tte_hash_t
-tte_hash_create(uint64_t context)
+tte_hash_create(uint64_t context, uint64_t *scratchval)
{
tte_hash_t th;
vm_page_t m, hash_pages[HASH_SIZE];
@@ -175,6 +175,7 @@
if ((hash_pages[i]->flags & PG_ZERO) == 0)
pmap_zero_page(hash_pages[i]);
}
+ *scratchval = ((vm_offset_t)th->th_hashtable) | ((vm_offset_t)th->th_size);
return (th);
}
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/wbuf.S#3 (text+ko) ====
@@ -30,6 +30,14 @@
END(fault_32bit_sk)
ENTRY(fault_64bit_sk)
+ GET_PCPU_SCRATCH
+ stx %sp, [PCPU_REG + PC_KWBUF_SP]
+ add PCPU_REG, PC_KWBUF, %g6
+ SAVE_WINDOW(%g6)
+ mov 1, %g6
+ st %g6, [PCPU_REG + PC_KWBUF_FULL]
+ saved
+ retry
END(fault_64bit_sk)
More information about the p4-projects
mailing list