: SILO Niagara/SUN4V support
PATCH 1/1 : SILO Niagara/SUN4V support
This patch against silo-1.4.10 makes SILO work on Niagara/SUN4V:
1) Don't try to access %ver register on Niagara, this will trap because it's a hyperprivileged operation on SUN4V.
We detect SUN4V with an ugly trick, we try to write to the PSTATE_AG bit of %pstate. If it reads back zero, it is SUN4V.
A better way to do this would be to fetch the "compatible" property of the OBP root node and check if it is "sun4v" but that might not be so easy to do this early.
To be honest, the necessity of this I-cache flushing code itself is suspect. I bet we can delete the whole thing or replace it with a portable loop that does "flush %reg" over the area we want the be I-cache synced.
2) Kill all of this code flushing the fixed SUN4U TLB entries. We don't load the TLB entries by hand any more so this code is just noise and would be wrong on SUN4V in any event.
3) Kill all of the %tick{_cmpr} register poking.
All this timer code cares about is that it records %tick when it starts, and then later make relative measurements using that saved value.
The rest of the code touching %tick{_cmpr} is superfluous.
Besides you can't write to %tick on SUN4V as that is a hyperprivileged operation.
4) Return 'sun4u' from silo_get_architecture() when we detect 'sun4v', we want to run the same code paths.
We could add a "sun4v" architecture type but I see no gain from that as it would just bloat up all the sun4u tests with a new "||" branch.
If someone could at least do some light testing of this on SUN4U I'd really appreciate this. Ben, please don't apply this until you or someone else does at least one SUN4U smoke test.
I've successfully tested this on a T-200 with 16GB of ram.
Thanks.
first-isofs/crt0.S renamed from first-isofs/crt0.S.~1~ +19 -0
@@ -112,6 +112,25 @@ flush_icache: tst %i4 /* quit unless it's Sun4u */ be 0f nop + + /* Careful, we cannot read the %ver register on sun4v because + * there that register is hyperprivileged and we are executing + * in privileged mode. + * + * This early on it's difficult to portably detect sun4v as + * that requires OBP calls. So do this super-ugly trick of + * trying to set the PSTATE_AG bit in %pstate which will read + * back as zero on sun4u. + */ + rdpr %pstate, %l0 + or %l0, 0x1, %l1 + wrpr %l1, %pstate + rdpr %pstate, %l1 + wrpr %l0, %pstate + andcc %l1, 0x1, %g0 + be,pn %xcc, 0f + nop + rdpr %ver, %l0 srlx %l0, (32 + 16), %l1 cmp %l1, 0x3e
second/memory.c renamed from second/memory.c.~1~ +0 -45
75 lines not on this page · raw message
second/crt0.S renamed from second/crt0.S.~1~ +19 -0
@@ -183,6 +183,25 @@ flush_icache: tst %i4 /* quit unless it's Sun4u */ be 0f nop + + /* Careful, we cannot read the %ver register on sun4v because + * there that register is hyperprivileged and we are executing + * in privileged mode. + * + * This early on it's difficult to portably detect sun4v as + * that requires OBP calls. So do this super-ugly trick of + * trying to set the PSTATE_AG bit in %pstate which will read + * back as zero on sun4u. + */ + rdpr %pstate, %l0 + or %l0, 0x1, %l1 + wrpr %l1, %pstate + rdpr %pstate, %l1 + wrpr %l0, %pstate + andcc %l1, 0x1, %g0 + be,pn %xcc, 0f + nop + rdpr %ver, %l0 srlx %l0, (32 + 16), %l1 cmp %l1, 0x3e
second/timer.c renamed from second/timer.c.~1~ +0 -19
@@ -40,8 +40,6 @@ static volatile struct sun4m_timer_regsstatic volatile struct sun4c_timer_info *sun4c_timer;static unsigned char *addr_to_free =0 ;static int len_to_free; -static unsigned long long sun4u_tickcmpr; -static int sun4u_notimer =0 ;static struct mostek48t02 *mregs;static long clock_frequency;
@@ -156,16 +154,6 @@ static inline int sun4u_init_timer () }if (!foundcpu || !clock_frequency) clock_frequency =prom_getint (prom_root_node,"clock-frequency" ) /100 ; -if (notimer) { - sun4u_notimer =1 ; - __asm__ __volatile__ ("\t" -"rd %%tick_cmpr, %%g1\n\t" -"stx %%g1, [%0]\n\t" -"mov 1, %%g1\n\t" -"sllx %%g1, 63, %%g1\n\t" -"wr %%g1, 0, %%tick_cmpr" - : :"r" (&sun4u_tickcmpr) :"g1" ); - }return 0 ; }
@@ -206,13 +194,6 @@ int init_timer ()void close_timer () { -if (sun4u_notimer) { - __asm__ __volatile__("\t" -"ldx [%0], %%g1\n\t" -"wrpr %%g0, 0, %%tick\n\t" -"wr %%g1, 0, %%tick_cmpr" - : :"r" (&sun4u_tickcmpr) :"g1" ); - }if (addr_to_free) {if (addr_to_free = (unsigned char *)0xffffffff )sun4c_unmapio (TICKER_VIRTUAL );
second/misc.c renamed from second/misc.c.~1~ +1 -0
@@ -518,6 +518,7 @@ enum arch silo_get_architecture(void)case 'e' :return sun4e;case 'u' : +case 'v' :return sun4u;default :for (i =0 ; i <NUM_SUN_MACHINES ; i++)
Quoted 1 line · David S. Miller
This patch against silo-1.4.10 makes SILO work on Niagara/SUN4V:
In order for me to test this patch completely, I'll need you to send me that sun4v system for a few weeks (stress testing and all) :)
I'll give it a go on my e3k tonight. It can usually expose bugs if they exist. While I'm at it, I'll do a build with the niagara patches to see if it causes any regressions as well.
Signature · 4 lines
Ubuntu - http://www.ubuntu.com/ Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ SwissDisk - http://www.swissdisk.com/
Hi,
Quoted 10 lines · Ben Collins
Quoted 1 line · David S. Miller
This patch against silo-1.4.10 makes SILO work on Niagara/SUN4V:
In order for me to test this patch completely, I'll need you to send me that sun4v system for a few weeks (stress testing and all) :)
I'll give it a go on my e3k tonight. It can usually expose bugs if they exist. While I'm at it, I'll do a build with the niagara patches to see if it causes any regressions as well.
If it's worth anything, i did cook up a silo SRPM for myself with this Niagara/SUN4V and '[PATCH]: Fix SILO initrd calculations' patch.
Booted just fine on
# cat /proc/cpuinfo cpu : TI UltraSparc II (BlackBird) fpu : UltraSparc II integrated FPU promlib : Version 3 Revision 31 prom : 3.31.0 type : sun4u ncpus probed : 2 ncpus active : 2 Cpu1Bogo : 876.54 Cpu1ClkTck : 000000001a3af0b8 Cpu2Bogo : 876.54 Cpu2ClkTck : 000000001a3af0b8 MMU Type : Spitfire State: CPU1: online CPU2: online
(Netra T 1405).
# silo -V SILO version 1.4.10
Signature · 1 line
Pasi Pirhonen - [email protected] - http://iki.fi/upi/
From: Pasi Pirhonen <[email protected]>
Date: Sat, 25 Feb 2006 21:16:05 +0200
Quoted 4 lines
If it's worth anything, i did cook up a silo SRPM for myself with this Niagara/SUN4V and '[PATCH]: Fix SILO initrd calculations' patch.
Booted just fine on
Thanks for testing the patch.