[LWN Logo]

Date: Tue, 15 Sep 1998 23:45:25 +0200
From: Stefan Traby <stefan@sime.com>
To: axp-list@redhat.com
Subject: Re: Problem rebooting AlphaStation 200 with SRM from RedHat 5.1?

Hi Peter !

> > I am trying to get 1.1.121 to work.  It compiles, but will not boot after
> > it unzips.
> 
> Same problem here (SX164, egcs-1.1b). 
> Currently running 2.1.120.
> Linux picu-sgh.demon.co.uk 2.1.120 #3 Mon Sep 7 17:27:20 BST 1998 alpha unknown

The problem lies in the IRQ setup. Please apply the following patch
made by --Jay++ (it will be hopefully included in 2.1.122)


diff -ur TEMP/rth-120-14/arch/alpha/kernel/irq.c PATCH/rth-120-14/arch/alpha/kernel/irq.c
--- TEMP/rth-120-14/arch/alpha/kernel/irq.c	Mon Sep  7 22:33:40 1998
+++ PATCH/rth-120-14/arch/alpha/kernel/irq.c	Tue Sep  8 17:21:42 1998
@@ -311,26 +311,39 @@
 
 int get_irq_list(char *buf)
 {
-	int i, len = 0;
+	int i, j;
 	struct irqaction * action;
-	int cpu = smp_processor_id();
+	char *p = buf;
+
+	p += sprintf(p, "           ");
+	for (j = 0; j < smp_num_cpus; j++)
+		p += sprintf(p, "CPU%d       ", j);
+	*p++ = '\n';
 
 	for (i = 0; i < NR_IRQS; i++) {
 		action = irq_action[i];
 		if (!action) 
 			continue;
-		len += sprintf(buf+len, "%2d: %10u %c %s",
-			       i, kstat.irqs[cpu][i],
-			       (action->flags & SA_INTERRUPT) ? '+' : ' ',
-			       action->name);
+		p += sprintf(p, "%3d: ",i);
+#ifndef __SMP__
+		p += sprintf(p, "%10u ", kstat_irqs(i));
+#else
+		for (j = 0; j < smp_num_cpus; j++)
+			p += sprintf(p, "%10u ",
+				     kstat.irqs[cpu_logical_map(j)][i]);
+#endif
+		p += sprintf(p, "  %c%s",
+			     (action->flags & SA_INTERRUPT)?'+':' ',
+			     action->name);
+
 		for (action=action->next; action; action = action->next) {
-			len += sprintf(buf+len, ", %s%s",
-				       (action->flags & SA_INTERRUPT) ? "+":"",
-				       action->name);
+			p += sprintf(p, ", %c%s",
+				     (action->flags & SA_INTERRUPT)?'+':' ',
+				     action->name);
 		}
-		len += sprintf(buf+len, "\n");
+		*p++ = '\n';
 	}
-	return len;
+	return p - buf;
 }
 
 #ifdef __SMP__
diff -ur TEMP/rth-120-14/arch/alpha/kernel/irq.h PATCH/rth-120-14/arch/alpha/kernel/irq.h
--- TEMP/rth-120-14/arch/alpha/kernel/irq.h	Mon Sep  7 22:33:40 1998
+++ PATCH/rth-120-14/arch/alpha/kernel/irq.h	Wed Sep  9 20:47:11 1998
@@ -11,11 +11,8 @@
 #define STANDARD_INIT_IRQ_PROLOG	\
 	outb(0, DMA1_RESET_REG);	\
 	outb(0, DMA2_RESET_REG);	\
-	outb(0, DMA1_MASK_REG);		\
-	outb(0, DMA2_MASK_REG);		\
 	outb(0, DMA1_CLR_MASK_REG);	\
-	outb(0, DMA2_CLR_MASK_REG);	\
-	outb(DMA_MODE_CASCADE, DMA2_MODE_REG)
+	outb(0, DMA2_CLR_MASK_REG);
 
 
 extern unsigned long alpha_irq_mask;
diff -ur TEMP/rth-120-14/arch/alpha/kernel/smc37c93x.c PATCH/rth-120-14/arch/alpha/kernel/smc37c93x.c
--- TEMP/rth-120-14/arch/alpha/kernel/smc37c93x.c	Mon Sep  7 22:33:41 1998
+++ PATCH/rth-120-14/arch/alpha/kernel/smc37c93x.c	Thu Sep 10 09:57:56 1998
@@ -8,6 +8,7 @@
 #include <linux/malloc.h>
 #include <linux/mm.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 
 #include <asm/hwrpb.h>
 #include <asm/io.h>
@@ -86,21 +87,28 @@
 	unsigned long indexPort;
 	unsigned long dataPort;
 
+	int i;
+
 	configPort = indexPort = baseAddr;
 	dataPort = configPort + 1;
 
-	outb(CONFIG_ON_KEY, configPort);
-	outb(CONFIG_ON_KEY, configPort);
-	outb(DEVICE_ID, indexPort);
-	devId = inb(dataPort);
-	if ( devId == VALID_DEVICE_ID ) {
-		outb(DEVICE_REV, indexPort);
-		devRev = inb(dataPort);
-	}
-	else {
-		baseAddr = 0;
+#define NUM_RETRIES 5
+
+	for (i = 0; i < NUM_RETRIES; i++)
+	{
+		outb(CONFIG_ON_KEY, configPort);
+		outb(CONFIG_ON_KEY, configPort);
+		outb(DEVICE_ID, indexPort);
+		devId = inb(dataPort);
+		if (devId == VALID_DEVICE_ID) {
+			outb(DEVICE_REV, indexPort);
+			devRev = inb(dataPort);
+			break;
+		}
+		else
+			udelay(100);
 	}
-	return baseAddr;
+	return (i != NUM_RETRIES) ? baseAddr : 0L;
 }
 
 static void __init SMCRunState(unsigned long baseAddr)
diff -ur TEMP/rth-120-14/arch/alpha/kernel/smp.c PATCH/rth-120-14/arch/alpha/kernel/smp.c
--- TEMP/rth-120-14/arch/alpha/kernel/smp.c	Mon Sep  7 22:33:41 1998
+++ PATCH/rth-120-14/arch/alpha/kernel/smp.c	Wed Sep  9 12:48:53 1998
@@ -39,6 +39,7 @@
 
 unsigned int boot_cpu_id = 0;
 static int smp_activated = 0;
+static unsigned long ipicnt[NR_CPUS] = {0,}; /* IPI counts */
 
 int smp_found_config = 0; /* Have we found an SMP box */
 static int max_cpus = -1;
@@ -702,6 +703,8 @@
 	int ops;
 
 	mb();
+
+	ipicnt[this_cpu]++;
 #if 0
 	printk("handle_ipi: on CPU %d ops 0x%x PC 0x%lx\n",
 	       this_cpu, *pending_ipis, regs->pc);
@@ -737,8 +740,13 @@
 
 int smp_info(char *buffer)
 {
-        return sprintf(buffer, "CPUs probed %d active %d map 0x%x\n",
-		       smp_num_probed, smp_num_cpus, cpu_present_map);
+	int i;
+	unsigned long sum = 0;
+	for (i = 0; i < NR_CPUS; i++)
+		sum += ipicnt[i];
+
+        return sprintf(buffer, "CPUs probed %d active %d map 0x%x IPIs %ld\n",
+		       smp_num_probed, smp_num_cpus, cpu_present_map, sum);
 }
 
 /* wrapper for call from panic() */
@@ -876,6 +884,8 @@
 	long tmp;
 	long stuck;
 	void *inline_pc = __builtin_return_address(0);
+	int printed = 0;
+	unsigned long started = jiffies;
 
  try_again:
 
@@ -905,12 +915,23 @@
 	: "2" (stuck));
 
 	if (stuck < 0) {
-		printk("spinlock stuck at %p (cur=%p, own=%p, prev=%p)\n",
-		       inline_pc, current, lock->task, lock->previous);
+		if (!printed) {
+			printk("spinlock stuck at %p on %x, "
+			       "owned at %p on %x\n",
+			       inline_pc, smp_processor_id(),
+			       lock->previous, lock->task);
+			printed = 1;
+		}
 		goto try_again;
 	} else {
 		lock->previous = inline_pc;
-		lock->task = current;
+		lock->task = smp_processor_id();
+		if (printed) {
+			printk("spinlock waited at %p on %x "
+			       "for %ld ticks\n",
+			       inline_pc, smp_processor_id(),
+			       jiffies - started);
+		}
 	}
 }
 #endif /* DEBUG_SPINLOCK */
diff -ur TEMP/rth-120-14/arch/alpha/kernel/sys_sx164.c PATCH/rth-120-14/arch/alpha/kernel/sys_sx164.c
--- TEMP/rth-120-14/arch/alpha/kernel/sys_sx164.c	Mon Sep  7 22:33:41 1998
+++ PATCH/rth-120-14/arch/alpha/kernel/sys_sx164.c	Thu Sep 10 13:34:23 1998
@@ -103,7 +103,10 @@
 static void
 sx164_init_irq(void)
 {
-	STANDARD_INIT_IRQ_PROLOG;
+	outb(0, DMA1_RESET_REG);
+	outb(0, DMA2_RESET_REG);
+	outb(DMA_MODE_CASCADE, DMA2_MODE_REG);
+	outb(0, DMA2_MASK_REG);
 
 	if (alpha_using_srm) {
 		alpha_mv.update_irq_hw = sx164_srm_update_irq_hw;
Only in PATCH/rth-120-14/arch/alpha/kernel: sys_sx164.c~
diff -ur TEMP/rth-120-14/include/asm-alpha/hardirq.h PATCH/rth-120-14/include/asm-alpha/hardirq.h
--- TEMP/rth-120-14/include/asm-alpha/hardirq.h	Mon Sep  7 22:33:42 1998
+++ PATCH/rth-120-14/include/asm-alpha/hardirq.h	Tue Sep  8 18:18:16 1998
@@ -32,6 +32,7 @@
 
 #include <asm/atomic.h>
 #include <asm/spinlock.h>
+#include <asm/smp.h>
 
 extern int global_irq_holder;
 extern spinlock_t global_irq_lock;


----------------------------------------------------------------------
-- 
  ciao - 
    Stefan

Stefan Traby                            phone:  +43-3133-6107-2
Mitterlasznitzstr. 13                     fax:  +43-3133-6107-9
8302 Nestelbach                        mailto://stefan@sime.com
Austria

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com