Subject: Re: Ultra 30 almost working
To: None <cg2v+@andrew.cmu.edu, eeh@netbsd.org, port-sparc64@netbsd.org>
From: None <eeh@netbsd.org>
List: port-sparc64
Date: 12/19/2001 00:41:06
| Excerpts from mail: 18-Dec-101 Re: Ultra 30 almost working by eeh@netbsd.org 
| > This doesn't make much sense to me.  Are you sure that setting it to
| > 0xff makes a difference?  What's the default setting?  
| Yes, it makes a difference. a kernel I build with the "final" psycho.c
| patch has scsi timeouts if I don't change 1fe.0000.1a00 from it's
| default value
|
| ok 1fe.0000.1a00 15 spacex@ .
| fffff

Hm.  Interesting.  Let's see...  That's the maximum 35 msec retry
interval.  You say you're getting SCSI timeouts?  SCSI timeouts 
should be in the 1s range.  What other devices do you have and 
what sort of load are you running?

Let's see...  256 iterations of a 66.7Mhz clock is about a 3-6usec
retry interval.  Well, I fail to see why tweaking this should have
any influence on SCSI timeouts, but since you say it does let's try
the following patch:

ndex: psycho.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc64/dev/psycho.c,v
retrieving revision 1.39
diff -u -r1.39 psycho.c
--- psycho.c    2001/10/07 20:30:41     1.39
+++ psycho.c    2001/12/19 00:40:47
@@ -416,6 +416,7 @@
         * arrive here, start up the IOMMU and get a config space tag.
         */
        if (osc == NULL) {
+               uint64_t timeo;
 
                /*
                 * Establish handlers for interesting interrupts....
@@ -444,6 +445,26 @@
                psycho_set_intr(sc, 1, psycho_wakeup,
                        &sc->sc_regs->pwrmgt_int_map, 
                        &sc->sc_regs->pwrmgt_clr_int);
+
+
+               /*
+                * Apparently a number of machines with psycho and psycho+
+                * controllers have interrupt latency issues.  We'll try
+                * setting the interrupt retry timeout to 0xff which gives us
+                * a retry of 3-6 usec (which is what sysio is set to) for the
+                * moment, which seems to help alleviate this problem.
+                */
+               timeo = bus_space_read_8(sc->sc_bustag,
+                       (bus_space_handle_t)
+                       (u_long)&sc->sc_regs->intr_retry_timer, 0);
+               if (timeo > 0xfff) {
+                       printf("decreasing interrupt retry timeout "
+                               "from %lx to 0xff\n", (long)timeo);
+                       bus_space_write_8(sc->sc_bustag,
+                               (bus_space_handle_t)
+                               (u_long)&sc->sc_regs->intr_retry_timer, 0,
+                               0xff);
+               }
 
                /*
                 * Setup IOMMU and PCI configuration if we're the first