Subject: Fixed! And some questions (Was Re: R5K L2 Cache problem again)
To: None <port-sgimips@netbsd.org>
From: sgimips NetBSD list <sgimips@mrynet.com>
List: port-sgimips
Date: 12/17/2001 20:49:20
OK, I've found a hack I was missing to get the current kernel sources
to build a working kernel for the R5K.  Here are the patches that allow
the kernel to work on both the R4400 and the R5K:

--- /usr/src/sys/arch/sgimips/sgimips/ip22.c    Sun Dec  2 19:44:58 2001
+++ /usr/src/sys/arch/sgimips/sgimips/ip22.c.old        Thu Nov 29 23:32:43 2001
@@ -452,11 +452,15 @@
         * If we don't have an R4000-style cache, then initialize the
         * IP22 SysAD L2 cache.
         */
+#if defined(L2_CACHE_ACTUALLY_WORKS)
        if (mips_sdcache_line_size == 0) {
+#endif
                /* XXX */ 
                printf("%s: disabling IP22 SysAD L2 cache\n", self->dv_xname);
                ip22_sdcache_disable();
+#if defined(L2_CACHE_ACTUALLY_WORKS)
        }
+#endif
 }

 #endif /* IP22 */
--- /usr/src/sys/arch/sgimips/sgimips/cpu.c.orig        Mon Dec 17 19:58:04 2001
+++ /usr/src/sys/arch/sgimips/sgimips/cpu.c     Mon Dec 17 20:06:08 2001
@@ -71,8 +71,10 @@
        case COMPONENT_TYPE_SecondaryDCache:
        case COMPONENT_TYPE_SecondaryCache:
                mips_sdcache_size = COMPONENT_KEY_Cache_CacheSize(comp->Key);
+#ifdef NOTYET
                mips_sdcache_line_size =
                    COMPONENT_KEY_Cache_LineSize(comp->Key);
+#endif
                /* XXX */
                mips_sdcache_ways = 1;
                break;

I'm about to release on my site a snapshot with installation
images for bootp, netboot/NFS and bootable CDrom.  I'll be 
using the above patches for the kernels distributed.

Now the questions:

o	Can anyone tell me what the ramifications of running this
	mod on the R4400 are?  I see it disabling the L2 Cache on the
	R5000, but I'm not sure what the second patch affects--does
	running such a kernel on the R4400 affect performance?
o	The elf 'boot' program is necessary on the R4400 and R5000
	machines I have here.  What machines require the ecoff boot
	block?
o	My R4400 and R5000 require the elf kernel as well.  What
	machines require the ecoff kernel?

Thanks for any help on all this.  I'll be releasing the release 
images tonight after testing both platforms with all the possible
installation methods.

-scott

> Well, I have a complete distribution with new CD image for the INDYs
> ready to go, but...
> 
> I can't build a working kernel again for the INDY R5000.
> The kernel works fine on the R4400.  Appears to be L2 Cache problem again.
> I'm already disabling the L2 Cache forcefully with code previously
> suggested by Chris Sekiya:
> 	--- /usr/src/sys/arch/sgimips/sgimips/ip22.c    Fri Nov 16 05:11:55 2001
> 	+++ ip22.c      Sun Nov 25 22:11:04 2001
> 	@@ -452,11 +452,15 @@
>          	* If we don't have an R4000-style cache, then initialize the
>          	* IP22 SysAD L2 cache.
>          	*/
> 	+#if defined(L2_CACHE_ACTUALLY_WORKS)
>         	if (mips_sdcache_line_size == 0) {
> 	+#endif
>                 	/* XXX */
>                 	printf("%s: disabling IP22 SysAD L2 cache\n", self->dv_xname);
>                 	ip22_sdcache_disable();
> 	+#if defined(L2_CACHE_ACTUALLY_WORKS)
>         	}
> 	+#endif
>  	}
> 
> Has anyone build a kernel recently using the latest cvs sources?
> Any suggestions or other info I can provide?  This is the only
> thing holding up a new test release distribution :)
> 
> -scott
> 
> Here's the output when booting on the R5K:
> 
> NetBSD 1.5Z (MRYINDY2) #4: Mon Dec 17 08:29:19 CST 2001
>     root@mod80:/usr/src/sys/arch/sgimips/compile/MRYINDY2
> 128 MB memory, 115 MB free, 768 KB for ARCS, 6656 KB in 1664 buffers
> mainbus0 (root): SGI-IP22 [SGI, 690b5eb1], 1 processor
> cpu0 at mainbus0: MIPS R5000 CPU (0x2310) Rev. 1.0 with built-in FPU Rev. 1.0
> cpu0: 32KB/32B 2-way set-associative L1 Instruction cache, 48 TLB entries
> cpu0: 32KB/32B 2-way set-associative write-back L1 Data cache
> cpu0: 512KB/32B direct-mapped write-back L2 Data cache
> cpu0: disabling IP22 SysAD L2 cache
> imc0 at mainbus0 addr 0x1fa00000
> imc0: Revision 3
> gio0 at imc0
> hpc0 at gio0 addr 0x1fb80000: SGI HPC3
> zsc0 at hpc0 offset 0x59830
> zstty0 at zsc0 channel 1 (console i/o)
> zstty1 at zsc0 channel 0
> sq0 at hpc0 offset 0x54000: SGI Seeq 80c03
> sq0: Ethernet address 08:00:69:0b:5e:b1
> wdsc0 at hpc0 offset 0x44000: WD33C93B SCSI, rev=0, target 7
> scsibus0 at wdsc0: 8 targets, 8 luns per target
> dsclock0 at hpc0 offset 0x60000
> biomask 07 netmask 07 ttymask 0f clockmask bf
> scsibus0: waiting 5 seconds for devices to settle...
> sd0 at scsibus0 target 1 lun 0: <SEAGATE, ST34573N, 6244> SCSI2 0/direct fixed
> sd0: 4340 MB, 7501 cyl, 5 head, 237 sec, 512 bytes/sect x 8888924 sectors
> sd0: sync (200.0ns offset 12), 8-bit (5.000MB/s) transfers, tagged queueing
> sd1 at scsibus0 target 2 lun 0: <SEAGATE, ST34573N, 6244> SCSI2 0/direct fixed
> sd1: 4340 MB, 7501 cyl, 5 head, 237 sec, 512 bytes/sect x 8888924 sectors
> sd1: sync (200.0ns offset 12), 8-bit (5.000MB/s) transfers, tagged queueing
> sd2 at scsibus0 target 3 lun 0: <SEAGATE, ST34573N, 6244> SCSI2 0/direct fixed
> sd2: 4340 MB, 7501 cyl, 5 head, 237 sec, 512 bytes/sect x 8888924 sectors
> sd2: sync (200.0ns offset 12), 8-bit (5.000MB/s) transfers, tagged queueing
> cd0 at scsibus0 target 4 lun 0: <TOSHIBA, CD-ROM XM-5401TA, 3605> SCSI2 5/cdrom removable
> cd0: sync (300.0ns offset 12), 8-bit (3.333MB/s) transfers
> boot device: sd1
> root on sd1a dumps on sd1b
> mountroot: trying cd9660...
> mountroot: trying nfs...
> mountroot: trying ffs...
> readclock: 2001/12/17/14/30/21
> root file system type: ffs
> trap: TLB miss (load or instr. fetch) in kernel mode
> status=0xff03, cause=0x8, epc=0x0, vaddr=0x0
> pid=1 cmd=init usp=0x0 ksp=0xc9d4de58
> Stopped in pid 1 (init) at               0:     invalid address.
> db>
> 
> 
> And here's the config file:
> 
> mod80# cat MRYINDY2
> #       $NetBSD: TEAL,v 1.9 2001/11/22 01:11:51 soren Exp $
> 
> include         "arch/sgimips/conf/std.sgimips"
> 
> #makeoptions     TEXTADDR=0x80002000     # O2/INDY
> makeoptions    TEXTADDR=0x88069000     # O2/INDY Symmon
> #makeoptions    TEXTADDR=0x8001c000     # IP27
> #makeoptions    TEXTADDR=0x80300000     # IP27 Symmon
> 
> maxusers        32
> 
> options         SCSI_DELAY=5
> 
> options         MIPS3
> options         MIPS3_L2CACHE_ABSENT
> #options        MIPS3_L2CACHE_PRESENT
> 
> options         KTRACE
> options         SYSVMSG                 # System V message queues
> options         SYSVSEM                 # System V semaphores
> options         SYSVSHM                 # System V shared memory
> 
> options         PARANOIADIAG
> 
> options         DDB
> options         DDB_HISTORY_SIZE=100
> options         DEBUG
> options         DIAGNOSTIC
> 
> #options        KGDB
> #options        KGDB_DEV=0x2301         # KGDB port - this is Serial(1)
> #options        KGDB_DEVRATE=19200      # KGDB Baud Rate
> 
> #makeoptions    DEBUG="-g"
> 
> file-system     FFS
> file-system     NFS
> file-system     KERNFS
> file-system     PROCFS
> file-system     CD9660          # ISO 9660 + Rock Ridge file system
> 
> options         NFSSERVER
> options         FFS_EI
> options         SOFTDEP
> 
> options         INET
> 
> options         SCSIVERBOSE
> 
> options         NFS_BOOT_DHCP
> #options        NFS_BOOT_BOOTPARAM
> 
> options         IP22
> 
> config          netbsd          root on ? type ?
> 
> mainbus0        at root
> cpu0            at mainbus0
> 
> imc0            at mainbus0 addr 0x1fa00000
> gio0            at imc0
> eisa0           at imc0
> 
> hpc0            at gio? addr 0x1fb80000
> hpc1            at gio? addr 0x1fb00000
> #hpc2           at gio? addr 0x1f980000
> 
> sq*             at hpc0 offset ?
> wdsc*           at hpc0 offset ?
> dsclock*        at hpc0 offset ?
> 
> #
> # As always, the zs chip is wired funny, so channel 1 is actually the
> # first serial port and channel 0 is the second.
> #
> zsc*            at hpc0 offset ? # pbus0 device ?
> zstty*          at zsc? channel ?
> 
> #pbus0          at hpc0
> 
> #pckbc0         at pbus0 device ?
> 
> scsibus* at wdsc?
> sd*     at scsibus? target ? lun ?      # SCSI disks
> st*     at scsibus? target ? lun ?      # SCSI tapes
> cd*     at scsibus? target ? lun ?      # SCSI CD-ROMs
> ch*     at scsibus? target ? lun ?      # SCSI changer devices
> 
> pseudo-device   loop
> pseudo-device   pty
> pseudo-device   bpfilter        8
> pseudo-device   md              1
> pseudo-device   rnd                     # /dev/random and in-kernel generator
> pseudo-device   vnd             4
> mod80# 
>