diff mbox

[5/5] sparc32: genirq support

Message ID 1298234400-22378-5-git-send-email-sam@ravnborg.org
State Changes Requested
Delegated to: David Miller
Headers show

Commit Message

Sam Ravnborg Feb. 20, 2011, 8:40 p.m. UTC
The conversion of sparc32 to genirq is based on original work done
by David S. Miller.

generic
   Introduce use of GENERIC_HARDIRQS
   Allocate 64 IRQs - which is enough even for SS2000
   Use a table of irq_bucket to maintain uses IRQs
      irq_bucket is also used to chain several irq's that
      must be called when the same intrrupt is asserted
   Use irq_link to link a interrupt source to the irq
   All plafforms must now supply their own build_device_irq method
   Use show_interrupts from sparc64
   handler_irq rewriten to use generic irq support


floppy
   Read FLOPPY_IRQ from plat_From device
   Use generic request_irq to register the floppy interrupt
   Rewrote sparc_floppy_irq to use the generic irq support

pcic:
   Introduce irq_chip
   Store mask in chip_data for use in mask/unmask functions
   Add build_device_irq for pcic
   Use pcic_build_device_irq in pci_time_init
   allocate virtual irqs in pcic_fill_irq

sun4c:
   Introduce irq_chip
   Store mask in chip_data for use in mask/unmask functions
   Add build_device_irq for sun4c
   Use sun4c_build_device_irq in sun4c_init_timers

sun4m:
   Introduce irq_chip
   Introduce dedicated mask/unmask methods
   Introduce sun4m_handler_data that allow easy access to necessary
     data in the mask/unmask functions
   Add a helper method to enable profile_timer (used from smp)
   Added sun4m_build_device_irq
   Use sun4m_build_device_irq in sun4m_init_timers

   TODO:
      There is no replacement for smp_rotate that always scheduled
      next CPU as interrupt target upon an interrupt

sun4d:
   Introduce irq_chip
   Introduce dedicated mask/unmask methods
   Introduce sun4d_handler_data that allow easy access to
   necessary data in mask/unmask fuctions
   Rename sbus_tid to board_to_cpu
   Rewrote sun4d_handler_irq to use generic irq support

   TODO:
      The original implmentation of enable/disable had:

          if (irq < NR_IRQS)
               return;

      The new implmentation does not distingush between SBUS and cpu
      interrupts.
      I am no sure what is right here. I assume we need to do
      something for the cpu interrupts.

      I have (not yet at least) sun4d hardware available,
      and my understanding of this platfrom is limited.
      So I would be a bit suprised if this works.

leon:
   Introduce irq_chip
   Store mask in chip_data for use in mask/unmask functions
   Add build_device_irq for leon
   Use leon_build_device_irq in leon_init_timers

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 arch/sparc/Kconfig                 |    5 +-
 arch/sparc/include/asm/floppy_32.h |   41 +++-
 arch/sparc/include/asm/irq_32.h    |    8 +-
 arch/sparc/include/asm/system_32.h |    5 -
 arch/sparc/kernel/Makefile         |    4 -
 arch/sparc/kernel/irq.h            |   44 ++--
 arch/sparc/kernel/irq_32.c         |  501 ++++++++---------------------------
 arch/sparc/kernel/kernel.h         |    1 +
 arch/sparc/kernel/leon_kernel.c    |   62 ++++-
 arch/sparc/kernel/pcic.c           |   82 ++++--
 arch/sparc/kernel/sun4c_irq.c      |  144 ++++++-----
 arch/sparc/kernel/sun4d_irq.c      |  477 ++++++++++++----------------------
 arch/sparc/kernel/sun4m_irq.c      |  174 +++++++------
 arch/sparc/kernel/sun4m_smp.c      |   16 +-
 14 files changed, 625 insertions(+), 939 deletions(-)

Comments

Josip Rodin Feb. 20, 2011, 9:30 p.m. UTC | #1
On Sun, Feb 20, 2011 at 09:40:00PM +0100, Sam Ravnborg wrote:
> --- a/arch/sparc/kernel/pcic.c
> +++ b/arch/sparc/kernel/pcic.c

> -static void pcic_load_profile_irq(int cpu, unsigned int limit)
> +static unsigned int pcic_startup_irq(struct irq_data *data)
>  {
> -	printk("PCIC: unimplemented code: FILE=%s LINE=%d", __FILE__, __LINE__);
> +	irq_link(data->irq);
> +	pcic_unmask_irq(data);
> +	return 0;
>  }

> -static void pcic_enable_pil_irq(unsigned int pil)
> +
> +static void pcic_load_profile_irq(int cpu, unsigned int limit)
>  {
> -	writel(get_irqmask(pil), pcic0.pcic_regs+PCI_SYS_INT_TARGET_MASK_CLEAR);
> +	printk("PCIC: unimplemented code: FILE=%s LINE=%d", __FILE__, __LINE__);
>  }

So, continuing on my previous line of nitpicking :) you could also rearrange
these two a bit, so they don't clutter up the diff like this.

> --- a/arch/sparc/kernel/sun4d_irq.c
> +++ b/arch/sparc/kernel/sun4d_irq.c

> -int sun4d_request_irq(unsigned int irq,
> +static void sun4d_mask_irq(struct irq_data *data)

> -static void sun4d_disable_irq(unsigned int irq)
> +static void sun4d_unmask_irq(struct irq_data *data)

> -static void sun4d_enable_irq(unsigned int irq)
> +/* XXX Do we need shutdown too for sun4d? */
> +static unsigned int sun4d_startup_irq(struct irq_data *data)

Also possibly rearrange these two pairs, so that the
sun4d_mask_irq/sun4d_disable_irq and sun4d_unmask_irq/sun4d_enable_irq
diffs are shown, which would seem to be logical, if I read this right.

> --- a/arch/sparc/kernel/sun4m_irq.c
> +++ b/arch/sparc/kernel/sun4m_irq.c

> -static unsigned long sun4m_get_irqmask(unsigned int irq)
> +static void sun4m_mask_irq(struct irq_data *data)

> -static void sun4m_disable_irq(unsigned int irq_nr)
> +static void sun4m_unmask_irq(struct irq_data *data)

> -static void sun4m_enable_irq(unsigned int irq_nr)

Here too, you probably want us to see the diff
sun4m_disable_irq vs. sun4m_mask_irq, and then
sun4m_enable_irq vs. sun4m_unmask_irq, rather than this.
Sam Ravnborg Feb. 22, 2011, 6:22 p.m. UTC | #2
On Sun, Feb 20, 2011 at 10:30:05PM +0100, Josip Rodin wrote:
> On Sun, Feb 20, 2011 at 09:40:00PM +0100, Sam Ravnborg wrote:
> > --- a/arch/sparc/kernel/pcic.c
> > +++ b/arch/sparc/kernel/pcic.c
> 
> > -static void pcic_load_profile_irq(int cpu, unsigned int limit)
> > +static unsigned int pcic_startup_irq(struct irq_data *data)
> >  {
> > -	printk("PCIC: unimplemented code: FILE=%s LINE=%d", __FILE__, __LINE__);
> > +	irq_link(data->irq);
> > +	pcic_unmask_irq(data);
> > +	return 0;
> >  }
> 
> > -static void pcic_enable_pil_irq(unsigned int pil)
> > +
> > +static void pcic_load_profile_irq(int cpu, unsigned int limit)
> >  {
> > -	writel(get_irqmask(pil), pcic0.pcic_regs+PCI_SYS_INT_TARGET_MASK_CLEAR);
> > +	printk("PCIC: unimplemented code: FILE=%s LINE=%d", __FILE__, __LINE__);
> >  }
> 
> So, continuing on my previous line of nitpicking :) you could also rearrange
> these two a bit, so they don't clutter up the diff like this.

I will try to split the changes in two patches.
There are several smaller things that can go in in first
patch.

I will prepare a v4 soon.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Feb. 26, 2011, 7:06 a.m. UTC | #3
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 22 Feb 2011 19:22:19 +0100

> I will prepare a v4 soon.

The first 4 patches are in the tree, so you only need to resubmit
this patch rather than the whole bunch.

I really look forward to applying v4, thanks Sam!
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg March 4, 2011, 9:48 p.m. UTC | #4
On Fri, Feb 25, 2011 at 11:06:13PM -0800, David Miller wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Tue, 22 Feb 2011 19:22:19 +0100
> 
> > I will prepare a v4 soon.
> 
> The first 4 patches are in the tree, so you only need to resubmit
> this patch rather than the whole bunch.
> 
> I really look forward to applying v4, thanks Sam!

Short update...

I will not post v4 until I can do a bit more testing.

Next week I get a SS1000E box (thanks to Chris <crn@netunix.com>) which
allows me to test the sun4d changes.

Huge thanks to Chris which has put a lot of effort in getting the
box operational again and for all the effort concerning the shipping!
I owe him more than one beer for this...

Kjetil mentioned he would try the genirq patches on his SS1000.
And I hope to get feedback from Gaisler too.

The patchset will likely not see testing on:
- Javastation (the pcic changes)
- sun4m with multiple CPUs
- sun4c

I have checked the nearby ebay's for relevant boxes - no luck.
On the other hand there is also a limit for the size of
my SUN museum :-)

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kjetil Oftedal March 4, 2011, 11:43 p.m. UTC | #5
On Fri, 4 Mar 2011, Sam Ravnborg wrote:

> On Fri, Feb 25, 2011 at 11:06:13PM -0800, David Miller wrote:
> > From: Sam Ravnborg <sam@ravnborg.org>
> > Date: Tue, 22 Feb 2011 19:22:19 +0100
> > 
> > > I will prepare a v4 soon.
> > 
> > The first 4 patches are in the tree, so you only need to resubmit
> > this patch rather than the whole bunch.
> > 
> > I really look forward to applying v4, thanks Sam!
> 
> Short update...
> 
> I will not post v4 until I can do a bit more testing.
> 
> Next week I get a SS1000E box (thanks to Chris <crn@netunix.com>) which
> allows me to test the sun4d changes.
> 
> Huge thanks to Chris which has put a lot of effort in getting the
> box operational again and for all the effort concerning the shipping!
> I owe him more than one beer for this...
> 
> Kjetil mentioned he would try the genirq patches on his SS1000.
> And I hope to get feedback from Gaisler too.
> 
> The patchset will likely not see testing on:
> - Javastation (the pcic changes)
> - sun4m with multiple CPUs
> - sun4c
> 
> I have checked the nearby ebay's for relevant boxes - no luck.
> On the other hand there is also a limit for the size of
> my SUN museum :-)
> 
> 	Sam

Hi,

With regards to testing on sun4d, I have run into problems with the 
existing kernel, during the process of getting a test system up and 
running. The system is unable to mount partitions correctly, 
(both ext2 on a hdd, and iso8859 on a cdrom), however dd, running from an 
initrd filesystem is able to read the ext2 blocks correctly. So I have 
started investigating this instead. 

Is there anyone aware of any alignment requirements in the sun4d on DMA 
transfers and such ? Or have the datasheet for the FAS2x6 (236) scsi 
controllers ? 

Sorry for highjacking the thread a bit.

Regards,
Kjetil Oftedal


--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Julian Calaby March 5, 2011, 2:10 a.m. UTC | #6
On Sat, Mar 5, 2011 at 08:48, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Fri, Feb 25, 2011 at 11:06:13PM -0800, David Miller wrote:
>> From: Sam Ravnborg <sam@ravnborg.org>
>> Date: Tue, 22 Feb 2011 19:22:19 +0100
>>
>> > I will prepare a v4 soon.
>>
>> The first 4 patches are in the tree, so you only need to resubmit
>> this patch rather than the whole bunch.
>>
>> I really look forward to applying v4, thanks Sam!
>
> Short update...
>
> I will not post v4 until I can do a bit more testing.
>
> Next week I get a SS1000E box (thanks to Chris <crn@netunix.com>) which
> allows me to test the sun4d changes.
>
> Huge thanks to Chris which has put a lot of effort in getting the
> box operational again and for all the effort concerning the shipping!
> I owe him more than one beer for this...
>
> Kjetil mentioned he would try the genirq patches on his SS1000.
> And I hope to get feedback from Gaisler too.
>
> The patchset will likely not see testing on:
> - sun4m with multiple CPUs

I have one of these, however it currently lacks any way to boot it.

If you could send me your tips for building tftpboot images and stuff,
it'd save me some time.

Thanks,
Chris Newport March 5, 2011, 1:32 p.m. UTC | #7
On Sat, 5 Mar 2011, Kjetil Oftedal wrote:
>
> Hi,
>
> With regards to testing on sun4d, I have run into problems with the
> existing kernel, during the process of getting a test system up and
> running. The system is unable to mount partitions correctly,
> (both ext2 on a hdd, and iso8859 on a cdrom), however dd, running from an
> initrd filesystem is able to read the ext2 blocks correctly. So I have
> started investigating this instead.
>
> Is there anyone aware of any alignment requirements in the sun4d on DMA
> transfers and such ? Or have the datasheet for the FAS2x6 (236) scsi
> controllers ?

First check that you can see the drive correctly from the OBP
ok> probe-scsi-all

If that is OK try booting with no SMP, I forget the correct incantation
but something like "max-cpus=1" sounds familiar.

You could also try booting with a 2.2.x kernel, if that does not work
something is SERIOUSLY wrong. 2.2.x does not support SMP and has
always booted OK for me.

Do you have Solaris, it should boot and run 2.6, 7, or 8 (last supported).
If this fails you certainly have hardware issues.

Sorry to be vague, there has been no properly working Sun4d kernel
since 2.2.x so expect to find bitrot in all sorts of obscure places.

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 5, 2011, 2:49 p.m. UTC | #8
Hi Sam,

> The patchset will likely not see testing on:
> -  Javastation (the pcic changes)
> - sun4m with multiple CPUs
> - sun4c
>
> I have checked the nearby ebay's for relevant boxes - no luck.
> On the other hand there is also a limit for the size of
> my SUN museum :-)

I've got a small "SUN museum" ...
sun4c: SPARCstation IPX
sun4m: SPARCstation5 (microSPARC II)
sun4m: SPARCstation20 (two-way superSPARC II)
sun4m: SPARCstation20 (four-way hyperSPARC Colorado-3)

Never got the IPX running on 2.6, but the others are spinning just
fine on some 2.6.1x UP (x=low).
I'm looking forward to give your patchset a try.

Best,
M


On Sat, Mar 5, 2011 at 2:32 PM,  <crn@netunix.com> wrote:
>
>
> On Sat, 5 Mar 2011, Kjetil Oftedal wrote:
>>
>> Hi,
>>
>> With regards to testing on sun4d, I have run into problems with the
>> existing kernel, during the process of getting a test system up and
>> running. The system is unable to mount partitions correctly,
>> (both ext2 on a hdd, and iso8859 on a cdrom), however dd, running from an
>> initrd filesystem is able to read the ext2 blocks correctly. So I have
>> started investigating this instead.
>>
>> Is there anyone aware of any alignment requirements in the sun4d on DMA
>> transfers and such ? Or have the datasheet for the FAS2x6 (236) scsi
>> controllers ?
>
> First check that you can see the drive correctly from the OBP
> ok> probe-scsi-all
>
> If that is OK try booting with no SMP, I forget the correct incantation
> but something like "max-cpus=1" sounds familiar.
>
> You could also try booting with a 2.2.x kernel, if that does not work
> something is SERIOUSLY wrong. 2.2.x does not support SMP and has
> always booted OK for me.
>
> Do you have Solaris, it should boot and run 2.6, 7, or 8 (last supported).
> If this fails you certainly have hardware issues.
>
> Sorry to be vague, there has been no properly working Sun4d kernel
> since 2.2.x so expect to find bitrot in all sorts of obscure places.
>
> --
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg March 5, 2011, 4:25 p.m. UTC | #9
On Sat, Mar 05, 2011 at 03:49:08PM +0100, Marcel van Nies wrote:
> Hi Sam,
> 
> > The patchset will likely not see testing on:
> > -  Javastation (the pcic changes)
> > - sun4m with multiple CPUs
> > - sun4c
> >
> > I have checked the nearby ebay's for relevant boxes - no luck.
> > On the other hand there is also a limit for the size of
> > my SUN museum :-)
> 
> I've got a small "SUN museum" ...
> sun4c: SPARCstation IPX
> sun4m: SPARCstation5 (microSPARC II)
> sun4m: SPARCstation20 (two-way superSPARC II)
> sun4m: SPARCstation20 (four-way hyperSPARC Colorado-3)
> 
> Never got the IPX running on 2.6, but the others are spinning just
> fine on some 2.6.1x UP (x=low).
> I'm looking forward to give your patchset a try.

Great!

If you fetch sparc-next-2.6.git:

   git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git

then you only need to apply the patch from this mail:

    http://marc.info/?l=linux-sparc&m=129823440700712&w=2

I'm looking forward for the result of the tests.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 6, 2011, 7:23 a.m. UTC | #10
The hyperSPARC boots, but fails when starting init. It runs fine on 2.6.17.

[   11.116665] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.

[   11.123332] Freeing unused kernel memory: 108k freed

[   11.186665] init[1]: segfault at 0 ip 5000dac8 (rpc f000eea8) sp
efe738a0 error 30001 in ld-2.3.5.so[50000000+1a000]

[   12.029998] Kernel panic - not syncing: Attempted to kill init!

[   12.033332] [f002ed74 : do_group_exit+0x84/0xb4 ] [f0039a24 :
get_signal_to_deliver+0x338/0x35c ] [f0011fbc : do_signal+0x30/0x914 ]
[f00128b4 : do_notify_resume+0x14/0x38 ] [f000fd50 :
signal_p+0x14/0x24 ] [f000eea8 : srmmu_fault+0x58/0x68 ]

[   12.079998] Press Stop-A (L1-A) to return to the boot prom

The superSPARC is running ...

# uname -a
Linux viking 2.6.38-rc2-up #4 Sat Mar 5 22:15:54 CET 2011 sparc sun4m
Texas Instruments, Inc. - SuperSparc-(II) GNU/Linux

SPARCstation 20 MP (2 X SuperSPARC-II), No Keyboard

ROM Rev. 2.25, 448 MB memory installed, Serial #8021487.

Ethernet address 8:0:20:7a:65:ef, Host ID: 727a65ef.







Boot device: /iommu/sbus/espdma@f,400000/esp@f,800000/sd@3,0  File and args:

SILO Version 1.4.13

boot:

Loaded kernel version 2.6.38

PROMLIB: obio_ranges 5

OF stdout device is: /obio/zs@0,100000:a

Booting Linux...

[    0.000000] PROMLIB: Sun Boot Prom Version 3 Revision 2

[    0.000000] Linux version 2.6.38-rc2-up (root@jalapeno) (gcc
version 4.4.4 (Gentoo 4.4.4-r2 p1.3, pie-0.4.5) ) #4 Sat Mar 5
22:15:54 CET 2011

[    0.000000] ARCH: SUN4M

[    0.000000] TYPE: Sun4m SparcStation10/20

[    0.000000] Ethernet address: 08:00:20:7a:65:ef

[    0.000000] Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek
(jj@ultra.linux.cz). Patching kernel for srmmu[TI Viking/MXCC]/iommu

[    0.000000] 255MB HIGHMEM available.

[    0.000000] OF stdout device is: /obio/zs@0,100000:a

[    0.000000] PROM: Built device tree with 26777 bytes of memory.

[    0.000000] Power off control detected.

[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 112944

[    0.000000] Kernel command line: root=/dev/sda4

[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)

[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)

[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)

[    0.000000] Memory: 445352k/457964k available (1872k kernel code,
12612k reserved, 484k data, 108k init, 261356k highmem)

[    0.000000] SLUB: Genslabs=15, HWalign=32, Order=0-3, MinObjects=0,
CPUs=1, Nodes=1

[    0.000000] NR_IRQS:64

[    0.000000] Console: colour dummy device 80x25

[    0.000000] console [tty0] enabled

[    0.000000] Calibrating delay loop... 74.60 BogoMIPS (lpj=124160)

[    0.059999] pid_max: default: 32768 minimum: 301

[    0.059999] Mount-cache hash table entries: 512

[    0.066666] NET: Registered protocol family 16

[    0.089999] IOMMU: impl 1 vers 3 table 0xfbc80000[262144 B] map [65536 b]

[    0.099999] bio: create slab <bio-0> at 0

[    0.106666] SCSI subsystem initialized

[    0.146666] NET: Registered protocol family 2

[    0.146666] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)

[    0.149999] TCP established hash table entries: 8192 (order: 4, 65536 bytes)

[    0.149999] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)

[    0.153333] TCP: Hash tables configured (established 8192 bind 8192)

[    0.153333] TCP reno registered

[    0.153333] UDP hash table entries: 256 (order: 0, 4096 bytes)

[    0.153333] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

[    0.156666] highmem bounce pool size: 64 pages

[    0.233333] msgmni has been set to 359

[    0.236666] Block layer SCSI generic (bsg) driver version 0.4
loaded (major 253)

[    0.236666] io scheduler noop registered

[    0.236666] io scheduler deadline registered (default)

[    0.246666] ffd5c3c0: ttyS0 at MMIO 0xf1100000 (irq = 8) is a zs (ESCC)

[    0.246666] Console: ttyS0 (SunZilog zs0)

[    0.253333] console [ttyS0] enabled

[    0.256666] ffd5c3c0: ttyS1 at MMIO 0xf1100004 (irq = 8) is a zs (ESCC)

[    0.266666] ffd5c4a0: Keyboard at MMIO 0xf1000000 (irq = 8) is a zs

[    0.273333] ffd5c4a0: Mouse at MMIO 0xf1000004 (irq = 8) is a zs

[    0.283333] esp: esp0, regs[fd00a000:fd009000] irq[2]

[    0.286666] esp: esp0 is a FAS100A, 40 MHz (ccf=0), SCSI ID 7

[    3.293333] scsi0 : esp

[    4.003332] scsi 0:0:3:0: Direct-Access     FUJITSU  MAP3735N
SUN72G  0401 PQ: 0 ANSI: 4

[    4.006666] scsi target0:0:3: Beginning Domain Validation

[    4.013332] scsi target0:0:3: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)

[    4.016666] scsi target0:0:3: Domain Validation skipping write tests

[    4.019999] scsi target0:0:3: Ending Domain Validation

[    4.503332] scsi 0:0:6:0: CD-ROM            PLEXTOR  CD-R
PX-W4220T 1.04 PQ: 0 ANSI: 2

[    4.509999] scsi target0:0:6: Beginning Domain Validation

[    4.516666] scsi target0:0:6: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 8)

[    4.523332] scsi target0:0:6: Domain Validation skipping write tests

[    4.526666] scsi target0:0:6: Ending Domain Validation

[    4.536666] esp: esp1, regs[fd00c000:fd00b000] irq[7]

[    4.539999] esp: esp1 is a FASHME, 40 MHz (ccf=0), SCSI ID 7

[    7.546665] scsi1 : esp

[   11.069998] mousedev: PS/2 mouse device common for all mice

[   11.073332] rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t08 as rtc0

[   11.076665] TCP cubic registered

[   11.083332] rtc-m48t59 rtc-m48t59.0: setting system clock to
2007-04-29 05:49:08 UTC (1177825748)

[   11.093332] sd 0:0:3:0: [sda] 143374738 512-byte logical blocks:
(73.4 GB/68.3 GiB)

[   11.099998] sd 0:0:3:0: [sda] Write Protect is off

[   11.106665] sd 0:0:3:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA

[   11.126665]  sda: sda1 sda2 sda3 sda4 sda5 sda6 sda7

[   11.139998] sd 0:0:3:0: [sda] Attached SCSI disk

[   11.156665] EXT3-fs: barriers not enabled

[   11.166665] kjournald starting.  Commit interval 5 seconds

[   11.169998] EXT3-fs (sda4): mounted filesystem with ordered data mode

[   11.173332] VFS: Mounted root (ext3 filesystem) readonly on device 8:4.

[   11.179998] Freeing unused kernel memory: 108k freed

INIT: version 2.86 booting

[   12.723332] NET: Registered protocol family 1



Gentoo Linux; http://www.gentoo.org/

 Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2



blahblah...

INIT: Entering runlevel: 3
blahblah...
login:

Marcel


On Sat, Mar 5, 2011 at 5:25 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Sat, Mar 05, 2011 at 03:49:08PM +0100, Marcel van Nies wrote:
>> Hi Sam,
>>
>> > The patchset will likely not see testing on:
>> > -  Javastation (the pcic changes)
>> > - sun4m with multiple CPUs
>> > - sun4c
>> >
>> > I have checked the nearby ebay's for relevant boxes - no luck.
>> > On the other hand there is also a limit for the size of
>> > my SUN museum :-)
>>
>> I've got a small "SUN museum" ...
>> sun4c: SPARCstation IPX
>> sun4m: SPARCstation5 (microSPARC II)
>> sun4m: SPARCstation20 (two-way superSPARC II)
>> sun4m: SPARCstation20 (four-way hyperSPARC Colorado-3)
>>
>> Never got the IPX running on 2.6, but the others are spinning just
>> fine on some 2.6.1x UP (x=low).
>> I'm looking forward to give your patchset a try.
>
> Great!
>
> If you fetch sparc-next-2.6.git:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
>
> then you only need to apply the patch from this mail:
>
>    http://marc.info/?l=linux-sparc&m=129823440700712&w=2
>
> I'm looking forward for the result of the tests.
>
>        Sam
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 6, 2011, 9:13 a.m. UTC | #11
Hi,

The hyperSPARC gives the same error without the final genirq patch.

Marcel



On Sun, Mar 6, 2011 at 8:23 AM, Marcel van Nies <morcles@gmail.com> wrote:
> The hyperSPARC boots, but fails when starting init. It runs fine on 2.6.17.
>
> [   11.116665] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
>
> [   11.123332] Freeing unused kernel memory: 108k freed
>
> [   11.186665] init[1]: segfault at 0 ip 5000dac8 (rpc f000eea8) sp
> efe738a0 error 30001 in ld-2.3.5.so[50000000+1a000]
>
> [   12.029998] Kernel panic - not syncing: Attempted to kill init!
>
> [   12.033332] [f002ed74 : do_group_exit+0x84/0xb4 ] [f0039a24 :
> get_signal_to_deliver+0x338/0x35c ] [f0011fbc : do_signal+0x30/0x914 ]
> [f00128b4 : do_notify_resume+0x14/0x38 ] [f000fd50 :
> signal_p+0x14/0x24 ] [f000eea8 : srmmu_fault+0x58/0x68 ]
>
> [   12.079998] Press Stop-A (L1-A) to return to the boot prom
>
> The superSPARC is running ...
>
> # uname -a
> Linux viking 2.6.38-rc2-up #4 Sat Mar 5 22:15:54 CET 2011 sparc sun4m
> Texas Instruments, Inc. - SuperSparc-(II) GNU/Linux
>
> SPARCstation 20 MP (2 X SuperSPARC-II), No Keyboard
>
> ROM Rev. 2.25, 448 MB memory installed, Serial #8021487.
>
> Ethernet address 8:0:20:7a:65:ef, Host ID: 727a65ef.
>
>
>
>
>
>
>
> Boot device: /iommu/sbus/espdma@f,400000/esp@f,800000/sd@3,0  File and args:
>
> SILO Version 1.4.13
>
> boot:
>
> Loaded kernel version 2.6.38
>
> PROMLIB: obio_ranges 5
>
> OF stdout device is: /obio/zs@0,100000:a
>
> Booting Linux...
>
> [    0.000000] PROMLIB: Sun Boot Prom Version 3 Revision 2
>
> [    0.000000] Linux version 2.6.38-rc2-up (root@jalapeno) (gcc
> version 4.4.4 (Gentoo 4.4.4-r2 p1.3, pie-0.4.5) ) #4 Sat Mar 5
> 22:15:54 CET 2011
>
> [    0.000000] ARCH: SUN4M
>
> [    0.000000] TYPE: Sun4m SparcStation10/20
>
> [    0.000000] Ethernet address: 08:00:20:7a:65:ef
>
> [    0.000000] Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek
> (jj@ultra.linux.cz). Patching kernel for srmmu[TI Viking/MXCC]/iommu
>
> [    0.000000] 255MB HIGHMEM available.
>
> [    0.000000] OF stdout device is: /obio/zs@0,100000:a
>
> [    0.000000] PROM: Built device tree with 26777 bytes of memory.
>
> [    0.000000] Power off control detected.
>
> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.
> Total pages: 112944
>
> [    0.000000] Kernel command line: root=/dev/sda4
>
> [    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
>
> [    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
>
> [    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
>
> [    0.000000] Memory: 445352k/457964k available (1872k kernel code,
> 12612k reserved, 484k data, 108k init, 261356k highmem)
>
> [    0.000000] SLUB: Genslabs=15, HWalign=32, Order=0-3, MinObjects=0,
> CPUs=1, Nodes=1
>
> [    0.000000] NR_IRQS:64
>
> [    0.000000] Console: colour dummy device 80x25
>
> [    0.000000] console [tty0] enabled
>
> [    0.000000] Calibrating delay loop... 74.60 BogoMIPS (lpj=124160)
>
> [    0.059999] pid_max: default: 32768 minimum: 301
>
> [    0.059999] Mount-cache hash table entries: 512
>
> [    0.066666] NET: Registered protocol family 16
>
> [    0.089999] IOMMU: impl 1 vers 3 table 0xfbc80000[262144 B] map [65536 b]
>
> [    0.099999] bio: create slab <bio-0> at 0
>
> [    0.106666] SCSI subsystem initialized
>
> [    0.146666] NET: Registered protocol family 2
>
> [    0.146666] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
>
> [    0.149999] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
>
> [    0.149999] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
>
> [    0.153333] TCP: Hash tables configured (established 8192 bind 8192)
>
> [    0.153333] TCP reno registered
>
> [    0.153333] UDP hash table entries: 256 (order: 0, 4096 bytes)
>
> [    0.153333] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
>
> [    0.156666] highmem bounce pool size: 64 pages
>
> [    0.233333] msgmni has been set to 359
>
> [    0.236666] Block layer SCSI generic (bsg) driver version 0.4
> loaded (major 253)
>
> [    0.236666] io scheduler noop registered
>
> [    0.236666] io scheduler deadline registered (default)
>
> [    0.246666] ffd5c3c0: ttyS0 at MMIO 0xf1100000 (irq = 8) is a zs (ESCC)
>
> [    0.246666] Console: ttyS0 (SunZilog zs0)
>
> [    0.253333] console [ttyS0] enabled
>
> [    0.256666] ffd5c3c0: ttyS1 at MMIO 0xf1100004 (irq = 8) is a zs (ESCC)
>
> [    0.266666] ffd5c4a0: Keyboard at MMIO 0xf1000000 (irq = 8) is a zs
>
> [    0.273333] ffd5c4a0: Mouse at MMIO 0xf1000004 (irq = 8) is a zs
>
> [    0.283333] esp: esp0, regs[fd00a000:fd009000] irq[2]
>
> [    0.286666] esp: esp0 is a FAS100A, 40 MHz (ccf=0), SCSI ID 7
>
> [    3.293333] scsi0 : esp
>
> [    4.003332] scsi 0:0:3:0: Direct-Access     FUJITSU  MAP3735N
> SUN72G  0401 PQ: 0 ANSI: 4
>
> [    4.006666] scsi target0:0:3: Beginning Domain Validation
>
> [    4.013332] scsi target0:0:3: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
>
> [    4.016666] scsi target0:0:3: Domain Validation skipping write tests
>
> [    4.019999] scsi target0:0:3: Ending Domain Validation
>
> [    4.503332] scsi 0:0:6:0: CD-ROM            PLEXTOR  CD-R
> PX-W4220T 1.04 PQ: 0 ANSI: 2
>
> [    4.509999] scsi target0:0:6: Beginning Domain Validation
>
> [    4.516666] scsi target0:0:6: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 8)
>
> [    4.523332] scsi target0:0:6: Domain Validation skipping write tests
>
> [    4.526666] scsi target0:0:6: Ending Domain Validation
>
> [    4.536666] esp: esp1, regs[fd00c000:fd00b000] irq[7]
>
> [    4.539999] esp: esp1 is a FASHME, 40 MHz (ccf=0), SCSI ID 7
>
> [    7.546665] scsi1 : esp
>
> [   11.069998] mousedev: PS/2 mouse device common for all mice
>
> [   11.073332] rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t08 as rtc0
>
> [   11.076665] TCP cubic registered
>
> [   11.083332] rtc-m48t59 rtc-m48t59.0: setting system clock to
> 2007-04-29 05:49:08 UTC (1177825748)
>
> [   11.093332] sd 0:0:3:0: [sda] 143374738 512-byte logical blocks:
> (73.4 GB/68.3 GiB)
>
> [   11.099998] sd 0:0:3:0: [sda] Write Protect is off
>
> [   11.106665] sd 0:0:3:0: [sda] Write cache: disabled, read cache:
> enabled, doesn't support DPO or FUA
>
> [   11.126665]  sda: sda1 sda2 sda3 sda4 sda5 sda6 sda7
>
> [   11.139998] sd 0:0:3:0: [sda] Attached SCSI disk
>
> [   11.156665] EXT3-fs: barriers not enabled
>
> [   11.166665] kjournald starting.  Commit interval 5 seconds
>
> [   11.169998] EXT3-fs (sda4): mounted filesystem with ordered data mode
>
> [   11.173332] VFS: Mounted root (ext3 filesystem) readonly on device 8:4.
>
> [   11.179998] Freeing unused kernel memory: 108k freed
>
> INIT: version 2.86 booting
>
> [   12.723332] NET: Registered protocol family 1
>
>
>
> Gentoo Linux; http://www.gentoo.org/
>
>  Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
>
>
>
> blahblah...
>
> INIT: Entering runlevel: 3
> blahblah...
> login:
>
> Marcel
>
>
> On Sat, Mar 5, 2011 at 5:25 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
>> On Sat, Mar 05, 2011 at 03:49:08PM +0100, Marcel van Nies wrote:
>>> Hi Sam,
>>>
>>> > The patchset will likely not see testing on:
>>> > -  Javastation (the pcic changes)
>>> > - sun4m with multiple CPUs
>>> > - sun4c
>>> >
>>> > I have checked the nearby ebay's for relevant boxes - no luck.
>>> > On the other hand there is also a limit for the size of
>>> > my SUN museum :-)
>>>
>>> I've got a small "SUN museum" ...
>>> sun4c: SPARCstation IPX
>>> sun4m: SPARCstation5 (microSPARC II)
>>> sun4m: SPARCstation20 (two-way superSPARC II)
>>> sun4m: SPARCstation20 (four-way hyperSPARC Colorado-3)
>>>
>>> Never got the IPX running on 2.6, but the others are spinning just
>>> fine on some 2.6.1x UP (x=low).
>>> I'm looking forward to give your patchset a try.
>>
>> Great!
>>
>> If you fetch sparc-next-2.6.git:
>>
>>   git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
>>
>> then you only need to apply the patch from this mail:
>>
>>    http://marc.info/?l=linux-sparc&m=129823440700712&w=2
>>
>> I'm looking forward for the result of the tests.
>>
>>        Sam
>>
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Josip Rodin March 6, 2011, 12:14 p.m. UTC | #12
On Sun, Mar 06, 2011 at 10:13:56AM +0100, Marcel van Nies wrote:
> The hyperSPARC gives the same error without the final genirq patch.
> 
> On Sun, Mar 6, 2011 at 8:23 AM, Marcel van Nies <morcles@gmail.com> wrote:
> > The hyperSPARC boots, but fails when starting init. It runs fine on 2.6.17.

I realize that it may be a difficult proposition, but you could try to
git bisect it.

Did you try it on anything after 2.6.17, maybe that narrows it down further?
Sam Ravnborg March 6, 2011, 12:58 p.m. UTC | #13
> 
> If you could send me your tips for building tftpboot images and stuff,
> it'd save me some time.

The userspace stuff I have is built with buildroot.
I used the attached configuration.

When building the kernel I use:

ROOTFS=/path/to/buildroot.git/output/images/rootfs.ext2
make ROOT_IMG=${ROOTFS} ARCH=sparc tftpboot.img

I then copy the final tftpboot.img to /var/lib/tftpboot/
as C0A800C8.SUN4M - this is the filename my sun4m box ask for.
I used tcpdump to check the name it requested.

I have rarp so my /etc/ethers define 
the relation between mac and IP like this:

08:00:20:05:38:d2       192.168.0.200


Initially my rarpd did not work.
I had to add following options:

# Do not check /tftpbootdir before response
OPTIONS="-v -e"

Until I realized this I uses

prom> boot net gateway-ip,,sun-ip

But it is much more convinient with rarp as I can then type "boot net".
And this is also default so I just turn on the box to boot it.

	Sam
#
# Automatically generated make config: don't edit
# Buildroot version: 2011.02-git-00192-g6527001
# Thu Dec 30 23:36:52 2010
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
# BR2_armeb is not set
# BR2_avr32 is not set
# BR2_i386 is not set
# BR2_mips is not set
# BR2_mipsel is not set
# BR2_powerpc is not set
# BR2_sh is not set
# BR2_sh64 is not set
BR2_sparc=y
# BR2_x86_64 is not set
# BR2_xtensa is not set
# BR2_sparc_v7 is not set
# BR2_sparc_cypress is not set
BR2_sparc_v8=y

#
# LEON SPARC needs gcc = 4.4.x
#
# BR2_sparc_sparchfleon is not set
# BR2_sparc_sparchfleonv8 is not set
# BR2_sparc_sparcsfleon is not set
# BR2_sparc_sparcsfleonv8 is not set
# BR2_sparc_supersparc is not set
# BR2_sparc_sparclite is not set
# BR2_sparc_f930 is not set
# BR2_sparc_f934 is not set
# BR2_sparc_hypersparc is not set
# BR2_sparc_sparclite86x is not set
# BR2_sparc_sparclet is not set
# BR2_sparc_tsc701 is not set
BR2_SPARC_TYPE="V8"
BR2_ARCH="sparc"
BR2_ENDIAN="BIG"
BR2_GCC_TARGET_TUNE="v8"

#
# Build options
#

#
# Commands
#
BR2_WGET="wget --passive-ftp -nd"
BR2_SVN="svn"
BR2_BZR="bzr"
BR2_GIT="git clone"
BR2_ZCAT="gzip -d -c"
BR2_BZCAT="bzcat"
BR2_TAR_OPTIONS=""
BR2_DL_DIR="$(TOPDIR)/dl"
BR2_STAGING_DIR="$(BASE_DIR)/staging"

#
# Mirrors and Download locations
#
BR2_PRIMARY_SITE=""
BR2_BACKUP_SITE="http://sources.buildroot.net/"
BR2_SOURCEFORGE_MIRROR="easynews"
BR2_KERNEL_MIRROR="http://www.kernel.org/pub/"
BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu"
BR2_DEBIAN_MIRROR="http://ftp.debian.org"
BR2_JLEVEL=2
# BR2_CCACHE is not set
# BR2_DEPRECATED is not set
# BR2_ENABLE_DEBUG is not set
BR2_STRIP_strip=y
# BR2_STRIP_sstrip is not set
# BR2_STRIP_none is not set
# BR2_OPTIMIZE_0 is not set
# BR2_OPTIMIZE_1 is not set
# BR2_OPTIMIZE_2 is not set
# BR2_OPTIMIZE_3 is not set
BR2_OPTIMIZE_S=y
# BR2_PREFER_STATIC_LIB is not set
# BR2_HAVE_DOCUMENTATION is not set
# BR2_HAVE_DEVFILES is not set

#
# Toolchain
#
BR2_TOOLCHAIN_BUILDROOT=y
# BR2_TOOLCHAIN_EXTERNAL is not set
# BR2_TOOLCHAIN_CTNG is not set

#
# Kernel Header Options
#
# BR2_KERNEL_HEADERS_2_6_34 is not set
# BR2_KERNEL_HEADERS_2_6_35 is not set
BR2_KERNEL_HEADERS_2_6_36=y
# BR2_KERNEL_HEADERS_VERSION is not set
# BR2_KERNEL_HEADERS_SNAP is not set
BR2_DEFAULT_KERNEL_HEADERS="2.6.36.2"

#
# uClibc Options
#
# BR2_UCLIBC_VERSION_0_9_30 is not set
BR2_UCLIBC_VERSION_0_9_31=y
# BR2_UCLIBC_VERSION_0_9_32 is not set
# BR2_UCLIBC_VERSION_SNAPSHOT is not set
BR2_UCLIBC_VERSION_STRING="0.9.31"
BR2_UCLIBC_CONFIG="toolchain/uClibc/uClibc-0.9.31.config"
# BR2_PTHREAD_DEBUG is not set
# BR2_UCLIBC_INSTALL_TEST_SUITE is not set

#
# Binutils Options
#
# BR2_BINUTILS_VERSION_2_20 is not set
BR2_BINUTILS_VERSION_2_20_1=y
BR2_BINUTILS_VERSION="2.20.1"
BR2_EXTRA_BINUTILS_CONFIG_OPTIONS=""

#
# GCC Options
#
# BR2_GCC_VERSION_4_2_4 is not set
# BR2_GCC_VERSION_4_3_X is not set
# BR2_GCC_VERSION_4_4_X is not set
BR2_GCC_VERSION_4_5_X=y
# BR2_GCC_VERSION_SNAP is not set
BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE=y
BR2_GCC_VERSION="4.5.2"
BR2_EXTRA_GCC_CONFIG_OPTIONS=""
# BR2_GCC_CROSS_OBJC is not set
# BR2_GCC_CROSS_FORTRAN is not set
# BR2_INSTALL_OBJC is not set
# BR2_INSTALL_FORTRAN is not set

#
# Gdb Options
#

#
# Gdb debugger for the target needs WCHAR support in toolchain
#
# BR2_PACKAGE_GDB_SERVER is not set
# BR2_PACKAGE_GDB_HOST is not set
BR2_TOOLCHAIN_HAS_THREADS=y
# BR2_ENABLE_LOCALE_PURGE is not set
BR2_NEEDS_GETTEXT=y
BR2_TARGET_OPTIMIZATION="-pipe"

#
# Toolchain Options
#
# BR2_TOOLCHAIN_BUILDROOT_LARGEFILE is not set
# BR2_TOOLCHAIN_BUILDROOT_INET_IPV6 is not set
# BR2_TOOLCHAIN_BUILDROOT_INET_RPC is not set
# BR2_TOOLCHAIN_BUILDROOT_WCHAR is not set
# BR2_TOOLCHAIN_BUILDROOT_LOCALE is not set
# BR2_TOOLCHAIN_BUILDROOT_PROGRAM_INVOCATION is not set
# BR2_TOOLCHAIN_BUILDROOT_CXX is not set
# BR2_TOOLCHAIN_BUILDROOT_USE_SSP is not set
# BR2_PTHREADS_NONE is not set
# BR2_PTHREADS is not set
BR2_PTHREADS_OLD=y
# BR2_ELF2FLT is not set
# BR2_MKLIBS is not set
# BR2_PACKAGE_SSTRIP_TARGET is not set
# BR2_PACKAGE_SSTRIP_HOST is not set
BR2_CROSS_TOOLCHAIN_TARGET_UTILS=y

#
# System configuration
#
BR2_TARGET_GENERIC_HOSTNAME="buildroot"
BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot"
# BR2_TARGET_GENERIC_GETTY is not set

#
# Package Selection for the target
#
BR2_PACKAGE_BUSYBOX=y
# BR2_BUSYBOX_VERSION_1_16_X is not set
# BR2_BUSYBOX_VERSION_1_17_X is not set
BR2_BUSYBOX_VERSION_1_18_X=y
# BR2_PACKAGE_BUSYBOX_SNAPSHOT is not set
BR2_BUSYBOX_VERSION="1.18.1"
BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-1.17.x.config"
# BR2_PACKAGE_BUSYBOX_SHOW_OTHERS is not set
# BR2_PACKAGE_CUSTOMIZE is not set

#
# Audio and video libraries and applications
#
# BR2_PACKAGE_ALSA_LIB is not set

#
# alsa-utils requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_AUMIX is not set
# BR2_PACKAGE_FLAC is not set

#
# ffmpeg requires a toolchain with LARGEFILE support
#

#
# gstreamer requires a toolchain with WCHAR support
#

#
# gst-ffmpeg requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_LIBCDAUDIO is not set

#
# libdvdread requires a toolchain with LARGEFILE support
#

#
# libdvdnav requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_LIBID3TAG is not set
# BR2_PACKAGE_LIBMAD is not set

#
# libmms requires a toolchain with WCHAR support
#

#
# libmpd requires a toolchain with WCHAR support
#
# BR2_PACKAGE_LIBMPEG2 is not set
# BR2_PACKAGE_LIBOGG is not set
# BR2_PACKAGE_LIBSNDFILE is not set
# BR2_PACKAGE_LIBTHEORA is not set
# BR2_PACKAGE_LIBVORBIS is not set
# BR2_PACKAGE_MADPLAY is not set
# BR2_PACKAGE_MPG123 is not set
# BR2_PACKAGE_MPLAYER is not set
# BR2_PACKAGE_SPEEX is not set

#
# swfdec requires a toolchain with WCHAR and C++ support
#

#
# festival requires a toolchain with C++ support enabled
#

#
# taglib requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_TREMOR is not set

#
# Compressors and decompressors
#
# BR2_PACKAGE_LZOP is not set
# BR2_PACKAGE_XZ is not set

#
# Debugging, profiling and benchmark
#
# BR2_PACKAGE_DHRYSTONE is not set
# BR2_PACKAGE_DMALLOC is not set
# BR2_PACKAGE_KEXEC is not set

#
# lmbench requires a toolchain with RPC support
#

#
# lsof requires a toolchain with RPC support
#
# BR2_PACKAGE_LTP_TESTSUITE is not set
# BR2_PACKAGE_LTRACE is not set
# BR2_PACKAGE_MEMSTAT is not set
# BR2_PACKAGE_NETPERF is not set

#
# oprofile requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_STRACE is not set
# BR2_PACKAGE_WHETSTONE is not set

#
# Development tools
#
# BR2_PACKAGE_AUTOCONF is not set
# BR2_PACKAGE_AUTOMAKE is not set

#
# bison requires a toolchain with WCHAR support
#
# BR2_PACKAGE_BSDIFF is not set
# BR2_PACKAGE_CCACHE is not set
# BR2_PACKAGE_DISTCC is not set
# BR2_PACKAGE_FAKEROOT is not set
# BR2_PACKAGE_FLEX is not set

#
# native toolchain needs development files in target filesystem
#

#
# gettext requires a toolchain with WCHAR support
#
# BR2_PACKAGE_GMP is not set

#
# gperf requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_MAKE is not set
# BR2_PACKAGE_MPC is not set
# BR2_PACKAGE_MPFR is not set
# BR2_PACKAGE_LIBTOOL is not set

#
# m4 requires a toolchain with WCHAR support
#

#
# pkg-config requires a toolchain with WCHAR support
#

#
# Games
#
# BR2_PACKAGE_GNUCHESS is not set
# BR2_PACKAGE_PRBOOM is not set

#
# Graphic libraries and applications (graphic/text)
#

#
# Graphic applications
#

#
# rrdtool requires a toolchain with WCHAR support
#

#
# graphic libraries
#
# BR2_PACKAGE_DIRECTFB is not set
# BR2_PACKAGE_FBDUMP is not set
# BR2_PACKAGE_FBGRAB is not set
# BR2_PACKAGE_FBV is not set
# BR2_PACKAGE_IMAGEMAGICK is not set
# BR2_PACKAGE_LINUX_FUSION is not set
# BR2_PACKAGE_SDL is not set

#
# other GUIs
#

#
# qt requires a toolchain with C++ support enabled
#

#
# X.org requires a toolchain with WCHAR support
#

#
# X libraries and helper libraries
#
# BR2_PACKAGE_LIBERATION is not set

#
# X Window managers
#

#
# X applications
#

#
# gob2 requires a toolchain with WCHAR support
#

#
# midori requires C++, WCHAR in toolchain and libgtk2
#

#
# Hardware handling
#

#
# cdrkit requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_CRAMFS is not set

#
# dbus not available (need expat or libxml2)
#

#
# dmraid requires a toolchain with LARGEFILE support
#

#
# dosfstools requires a toolchain with LARGEFILE support
#

#
# e2fsprogs requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_EEPROG is not set
# BR2_PACKAGE_FCONFIG is not set
# BR2_PACKAGE_FIS is not set
# BR2_PACKAGE_GADGETFS_TEST is not set
# BR2_PACKAGE_GENEXT2FS is not set
# BR2_PACKAGE_GENROMFS is not set
# BR2_PACKAGE_GPSD is not set

#
# gvfs requires a toolchain with LARGEFILE and WCHAR support
#

#
# hal requires a toolchain with WCHAR support
#
# BR2_PACKAGE_HWDATA is not set
# BR2_PACKAGE_I2C_TOOLS is not set
# BR2_PACKAGE_INPUT_TOOLS is not set
# BR2_PACKAGE_IOSTAT is not set
# BR2_PACKAGE_KBD is not set
# BR2_PACKAGE_LM_SENSORS is not set
# BR2_PACKAGE_LSUIO is not set

#
# lvm2 requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_MAKEDEVS is not set
# BR2_PACKAGE_MDADM is not set

#
# memtester requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_MTD is not set

#
# ntfs-3g requires a toolchain with LARGEFILE and WCHAR support
#

#
# ntfsprogs requires a toolchain with WCHAR and LARGEFILE support
#
# BR2_PACKAGE_PCIUTILS is not set
# BR2_PACKAGE_RNG_TOOLS is not set
# BR2_PACKAGE_SETSERIAL is not set
# BR2_PACKAGE_SMARTMONTOOLS is not set

#
# squashfs requires a toolchain with LARGEFILE support
#

#
# sshfs requires a toolchain with LARGEFILE and WCHAR support
#
# BR2_PACKAGE_SYSSTAT is not set
# BR2_PACKAGE_UDEV is not set
# BR2_PACKAGE_USB_MODESWITCH is not set
# BR2_PACKAGE_USBMOUNT is not set

#
# usbutils requires a toolchain with PROGRAM_INVOCATION support
#
# BR2_PACKAGE_WIPE is not set

#
# xfsprogs requires a toolchain with LARGEFILE support
#

#
# Interpreter languages and scripting
#
# BR2_PACKAGE_HASERL is not set
# BR2_PACKAGE_LUA is not set
# BR2_PACKAGE_MICROPERL is not set
# BR2_PACKAGE_PHP is not set

#
# python requires a toolchain with WCHAR support
#

#
# ruby requires a toolchain with WCHAR support
#
# BR2_PACKAGE_TCL is not set

#
# Libraries
#

#
# Compression and decompression
#

#
# libarchive requires a toolchain with WCHAR support
#
# BR2_PACKAGE_LZO is not set
BR2_PACKAGE_ZLIB=y

#
# Crypto
#
# BR2_PACKAGE_BEECRYPT is not set
# BR2_PACKAGE_LIBGCRYPT is not set
# BR2_PACKAGE_LIBGPG_ERROR is not set
# BR2_PACKAGE_OPENSSL is not set

#
# Database
#
# BR2_PACKAGE_BERKELEYDB is not set

#
# Mysql client requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_SQLITE is not set

#
# Filesystem
#

#
# gamin requires a toolchain with WCHAR support
#
# BR2_PACKAGE_LIBCONFIG is not set
# BR2_PACKAGE_LIBCONFUSE is not set

#
# libfuse requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_LIBLOCKFILE is not set
# BR2_PACKAGE_LIBSYSFS is not set

#
# Graphics
#

#
# atk requires a toolchain with WCHAR support
#
# BR2_PACKAGE_CAIRO is not set
# BR2_PACKAGE_FONTCONFIG is not set
# BR2_PACKAGE_FREETYPE is not set
# BR2_PACKAGE_JPEG is not set
# BR2_PACKAGE_LIBART is not set

#
# libgtk2 requires a toolchain with WCHAR and C++ support
#
# BR2_PACKAGE_LIBPNG is not set
# BR2_PACKAGE_LIBSVGTINY is not set
# BR2_PACKAGE_LIBUNGIF is not set

#
# pango requires a toolchain with WCHAR and C++ support
#
# BR2_PACKAGE_PIXMAN is not set
# BR2_PACKAGE_TIFF is not set

#
# webkit requires C++, WCHAR in toolchain and libgtk2
#

#
# Hardware handling
#
# BR2_PACKAGE_LIBAIO is not set
# BR2_PACKAGE_LIBRAW1394 is not set
# BR2_PACKAGE_TSLIB is not set
# BR2_PACKAGE_LIBUSB is not set

#
# Networking
#
# BR2_PACKAGE_LIBCGI is not set

#
# libcgicc requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_LIBCURL is not set
# BR2_PACKAGE_LIBDNET is not set
# BR2_PACKAGE_LIBEXOSIP2 is not set
# BR2_PACKAGE_LIBIDN is not set
# BR2_PACKAGE_LIBMICROHTTPD is not set
# BR2_PACKAGE_NEON is not set
# BR2_PACKAGE_LIBNL is not set
# BR2_PACKAGE_LIBPCAP is not set
# BR2_PACKAGE_LIBOSIP2 is not set
# BR2_PACKAGE_LIBRSYNC is not set

#
# libsoup requires a toolchain with WCHAR support
#

#
# libupnp requires a toolchain with LARGEFILE support
#

#
# Other
#
# BR2_PACKAGE_ARGP_STANDALONE is not set
# BR2_PACKAGE_LIBATOMIC_OPS is not set
# BR2_PACKAGE_LIBCAP is not set
# BR2_PACKAGE_LIBDAEMON is not set
# BR2_PACKAGE_LIBELF is not set
# BR2_PACKAGE_LIBEVENT is not set

#
# libglib2 requires a toolchain with WCHAR support
#
# BR2_PACKAGE_LIBOIL is not set

#
# Text and terminal handling
#

#
# enchant requires a toolchain with C++ and WCHAR support enabled
#

#
# icu requires a toolchain with C++ support and WCHAR enabled
#
# BR2_PACKAGE_LIBICONV is not set
# BR2_PACKAGE_NCURSES is not set
# BR2_PACKAGE_NEWT is not set
# BR2_PACKAGE_PCRE is not set
# BR2_PACKAGE_POPT is not set
# BR2_PACKAGE_READLINE is not set
# BR2_PACKAGE_SLANG is not set

#
# XML
#
# BR2_PACKAGE_EXPAT is not set
# BR2_PACKAGE_EZXML is not set
# BR2_PACKAGE_LIBXML2 is not set
# BR2_PACKAGE_LIBXSLT is not set

#
# xerces-c++ requires a toolchain with C++ support enabled
#

#
# Miscellaneous
#

#
# shared-mime-info requires a toolchain with WCHAR support
#

#
# Networking applications
#
# BR2_PACKAGE_ARGUS is not set
# BR2_PACKAGE_AVAHI is not set
# BR2_PACKAGE_AXEL is not set

#
# bind requires a toolchain with LARGEFILE support
#

#
# bmon requires a toolchain with IPv6 support
#
# BR2_PACKAGE_BRIDGE is not set

#
# ctorrent requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_CUPS is not set
# BR2_PACKAGE_DNSMASQ is not set
# BR2_PACKAGE_DROPBEAR is not set
# BR2_PACKAGE_ETHTOOL is not set
# BR2_PACKAGE_HOSTAPD is not set
# BR2_PACKAGE_IFPLUGD is not set

#
# iperf requires a toolchain with C++ support enabled
#

#
# iproute2 requires a toolchain with IPv6 support
#
# BR2_PACKAGE_IPSEC_TOOLS is not set

#
# iptables requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_IW is not set

#
# Kismet requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_XL2TP is not set
# BR2_PACKAGE_LINKS is not set
# BR2_PACKAGE_LRZSZ is not set
# BR2_PACKAGE_MII_DIAG is not set
# BR2_PACKAGE_MROUTED is not set

#
# mutt requires a toolchain with WCHAR support
#

#
# nbd requires a toolchain with WCHAR support
#

#
# ncftp requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_NETPLUG is not set
# BR2_PACKAGE_NETSNMP is not set
# BR2_PACKAGE_NETSTAT_NAT is not set

#
# nfs-utils requires a toolchain with 'Enable RPC' selected
#
# BR2_PACKAGE_NTP is not set
# BR2_PACKAGE_NUTTCP is not set

#
# olsr requires a toolchain with IPv6 support
#
# BR2_PACKAGE_OPENNTPD is not set
# BR2_PACKAGE_OPENSSH is not set
# BR2_PACKAGE_OPENVPN is not set

#
# portmap requires a toolchain with 'Enable RPC' selected
#
# BR2_PACKAGE_PPPD is not set
# BR2_PACKAGE_PPTP_LINUX is not set
# BR2_PACKAGE_PROFTPD is not set
# BR2_PACKAGE_QUAGGA is not set
# BR2_PACKAGE_RSH_REDONE is not set
# BR2_PACKAGE_RSYNC is not set
# BR2_PACKAGE_SAMBA is not set
# BR2_PACKAGE_SER2NET is not set
# BR2_PACKAGE_SOCAT is not set
# BR2_PACKAGE_SPAWN_FCGI is not set

#
# Squid requires a toolchain with C++ and IPv6 support enabled
#
# BR2_PACKAGE_TCPDUMP is not set
# BR2_PACKAGE_DHCPDUMP is not set
# BR2_PACKAGE_TCPREPLAY is not set
# BR2_PACKAGE_TN5250 is not set
# BR2_PACKAGE_TTCP is not set

#
# udpcast requires a toolchain with LARGEFILE support
#
# BR2_PACKAGE_VPNC is not set
# BR2_PACKAGE_VSFTPD is not set
# BR2_PACKAGE_VTUN is not set
# BR2_PACKAGE_WEBIF is not set
# BR2_PACKAGE_WIRELESS_TOOLS is not set
# BR2_PACKAGE_WPA_SUPPLICANT is not set

#
# Package managers
#
# BR2_PACKAGE_IPKG is not set

#
# Shell and utilities
#
# BR2_PACKAGE_AT is not set
# BR2_PACKAGE_DIALOG is not set
# BR2_PACKAGE_FILE is not set
# BR2_PACKAGE_LOCKFILE_PROGS is not set

#
# logrotate requires a toolchain with WCHAR support
#
# BR2_PACKAGE_SCREEN is not set
# BR2_PACKAGE_SUDO is not set
# BR2_PACKAGE_WHICH is not set

#
# System tools
#

#
# Text editors and viewers
#
# BR2_PACKAGE_ED is not set
# BR2_PACKAGE_NANO is not set
# BR2_PACKAGE_UEMACS is not set

#
# Target filesystem options
#
BR2_ROOTFS_POST_BUILD_SCRIPT=""
BR2_ROOTFS_DEVICE_TABLE="target/generic/device_table.txt"
BR2_ROOTFS_SKELETON_DEFAULT=y
# BR2_ROOTFS_SKELETON_CUSTOM is not set
# BR2_TARGET_ROOTFS_CRAMFS is not set
# BR2_TARGET_ROOTFS_CLOOP is not set
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_BLOCKS=0
BR2_TARGET_ROOTFS_EXT2_INODES=0
BR2_TARGET_ROOTFS_EXT2_RESBLKS=0
BR2_TARGET_ROOTFS_EXT2_SQUASH=y
BR2_TARGET_ROOTFS_EXT2_NONE=y
# BR2_TARGET_ROOTFS_EXT2_GZIP is not set
# BR2_TARGET_ROOTFS_EXT2_BZIP2 is not set
# BR2_TARGET_ROOTFS_EXT2_LZMA is not set
# BR2_TARGET_ROOTFS_JFFS2 is not set
# BR2_TARGET_ROOTFS_UBIFS is not set
# BR2_TARGET_ROOTFS_SQUASHFS is not set
# BR2_TARGET_ROOTFS_TAR is not set
# BR2_TARGET_ROOTFS_CPIO is not set
# BR2_TARGET_ROOTFS_INITRAMFS is not set
# BR2_TARGET_ROOTFS_ROMFS is not set

#
# Bootloaders
#
# BR2_TARGET_BAREBOX is not set
# BR2_TARGET_UBOOT is not set

#
# Kernel
#
BR2_LINUX_KERNEL=y
# BR2_LINUX_KERNEL_2_6_36 is not set
BR2_LINUX_KERNEL_SAME_AS_HEADERS=y
# BR2_LINUX_KERNEL_CUSTOM_VERSION is not set
# BR2_LINUX_KERNEL_CUSTOM_TARBALL is not set
BR2_LINUX_KERNEL_VERSION="2.6.36.2"
BR2_LINUX_KERNEL_PATCH=""
# BR2_LINUX_KERNEL_USE_DEFCONFIG is not set
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="sparcclassic.config"
BR2_LINUX_KERNEL_ZIMAGE=y
Marcel van Nies March 6, 2011, 2:39 p.m. UTC | #14
Hi,

> I realize that it may be a difficult proposition,
> but you could try to git bisect it.
>
> Did you try it on anything after 2.6.17, maybe that narrows it down further?

I was planning on doing that. Please be patient.

Marcel


On Sun, Mar 6, 2011 at 1:58 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
>>
>> If you could send me your tips for building tftpboot images and stuff,
>> it'd save me some time.
>
> The userspace stuff I have is built with buildroot.
> I used the attached configuration.
>
> When building the kernel I use:
>
> ROOTFS=/path/to/buildroot.git/output/images/rootfs.ext2
> make ROOT_IMG=${ROOTFS} ARCH=sparc tftpboot.img
>
> I then copy the final tftpboot.img to /var/lib/tftpboot/
> as C0A800C8.SUN4M - this is the filename my sun4m box ask for.
> I used tcpdump to check the name it requested.
>
> I have rarp so my /etc/ethers define
> the relation between mac and IP like this:
>
> 08:00:20:05:38:d2       192.168.0.200
>
>
> Initially my rarpd did not work.
> I had to add following options:
>
> # Do not check /tftpbootdir before response
> OPTIONS="-v -e"
>
> Until I realized this I uses
>
> prom> boot net gateway-ip,,sun-ip
>
> But it is much more convinient with rarp as I can then type "boot net".
> And this is also default so I just turn on the box to boot it.
>
>        Sam
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kjetil Oftedal March 6, 2011, 3:24 p.m. UTC | #15
On Sun, 6 Mar 2011, Sam Ravnborg wrote:
> > 
> > If you could send me your tips for building tftpboot images and stuff,
> > it'd save me some time.
> 
> The userspace stuff I have is built with buildroot.
> I used the attached configuration.
> 
> When building the kernel I use:
> 
> ROOTFS=/path/to/buildroot.git/output/images/rootfs.ext2
> make ROOT_IMG=${ROOTFS} ARCH=sparc tftpboot.img
> 
> I then copy the final tftpboot.img to /var/lib/tftpboot/
> as C0A800C8.SUN4M - this is the filename my sun4m box ask for.
> I used tcpdump to check the name it requested.
> 
> I have rarp so my /etc/ethers define 
> the relation between mac and IP like this:
> 
> 08:00:20:05:38:d2       192.168.0.200
> 
> 
> Initially my rarpd did not work.
> I had to add following options:
> 
> # Do not check /tftpbootdir before response
> OPTIONS="-v -e"
> 
> Until I realized this I uses
> 
> prom> boot net gateway-ip,,sun-ip
> 
> But it is much more convinient with rarp as I can then type "boot net".
> And this is also default so I just turn on the box to boot it.
> 
> 	Sam
> 

The C0A800C8.SUN4M string is generated based upon ip-address and 
architecture. The C0A800C8 is the IP address obtained by rarp translated to 
hex. (192 = C0. 168 = A8. 0 = 00. 200 = C8). 

Kjetil Oftedal
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Julian Calaby March 6, 2011, 8:49 p.m. UTC | #16
On Sun, Mar 6, 2011 at 23:58, Sam Ravnborg <sam@ravnborg.org> wrote:
>>
>> If you could send me your tips for building tftpboot images and stuff,
>> it'd save me some time.
>
> The userspace stuff I have is built with buildroot.
> I used the attached configuration.
>
> When building the kernel I use:
>
> ROOTFS=/path/to/buildroot.git/output/images/rootfs.ext2
> make ROOT_IMG=${ROOTFS} ARCH=sparc tftpboot.img

Cool, thanks - I haven't fiddled around with buildroot yet.

> I then copy the final tftpboot.img to /var/lib/tftpboot/
> as C0A800C8.SUN4M - this is the filename my sun4m box ask for.
> I used tcpdump to check the name it requested.
>
> I have rarp so my /etc/ethers define
> the relation between mac and IP like this:
>
> 08:00:20:05:38:d2       192.168.0.200
>
>
> Initially my rarpd did not work.
> I had to add following options:
>
> # Do not check /tftpbootdir before response
> OPTIONS="-v -e"
>
> Until I realized this I uses
>
> prom> boot net gateway-ip,,sun-ip
>
> But it is much more convinient with rarp as I can then type "boot net".
> And this is also default so I just turn on the box to boot it.

I'm all over tftpboot and rarp - I use tftp / rarp to install these boxes.

I'll have a go when I get home tonight, and hopefully have some sort
of result tomorrow.

Thanks,
Bob Breuer March 6, 2011, 9:11 p.m. UTC | #17
Josip Rodin wrote:
> On Sun, Mar 06, 2011 at 10:13:56AM +0100, Marcel van Nies wrote:
>> The hyperSPARC gives the same error without the final genirq patch.
>>
>> On Sun, Mar 6, 2011 at 8:23 AM, Marcel van Nies <morcles@gmail.com> wrote:
>>> The hyperSPARC boots, but fails when starting init. It runs fine on 2.6.17.
> 
> I realize that it may be a difficult proposition, but you could try to
> git bisect it.
> 
> Did you try it on anything after 2.6.17, maybe that narrows it down further?
> 

You shouldn't have to go back that far...  I was last running 2.6.22 on
hyperSPARC successfully.  Ok, maybe that's not so helpful as it looks
like it's been a while since I've built a sparc kernel.  Probably time
for me to also try out a new kernel.

Bob

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 7, 2011, 6:59 a.m. UTC | #18
sparcSTATION 5 (microSPARC-II) works fine ...

~ # uname -a
Linux ss5 2.6.38-rc2-up #4 Sat Mar 5 22:15:54 CET 2011 sparc sun4m
Fujitsu MB86904 GNU/Linux



screen not found.
Can't open input device.
Keyboard not present.  Using tty for input and output.

SPARCstation 5, No Keyboard
ROM Rev. 2.24, 256 MB memory installed, Serial #8625209.
Ethernet address 8:0:20:83:9c:39, Host ID: 80839c39.

Rebooting with command:
Boot device: /iommu/sbus/espdma@5,8400000/esp@5,8800000/sd@3,0  File and args:
SILO Version 1.4.14
boot:
Loaded kernel version 2.6.38
PROMLIB: obio_ranges 1
OF stdout device is: /obio/zs@0,100000:a
Booting Linux...
[    0.000000] PROMLIB: Sun Boot Prom Version 3 Revision 2
[    0.000000] Linux version 2.6.38-rc2-up (root@jalapeno) (gcc
version 4.4.4 (Gentoo 4.4.4-r2 p1.3, pie-0.4.5) ) #4 Sat Mar 5
22:15:54 CET 2011
[    0.000000] ARCH: SUN4M
[    0.000000] TYPE: SPARCstation 5
[    0.000000] Ethernet address: 08:00:20:83:9c:39
[    0.000000] Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek
(jj@ultra.linux.cz). Patching kernel for srmmu[Fujitsu Swift]/iommu
[    0.000000] 63MB HIGHMEM available.
[    0.000000] OF stdout device is: /obio/zs@0,100000:a
[    0.000000] PROM: Built device tree with 19644 bytes of memory.
[    0.000000] Power off control detected.
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 64296
[    0.000000] Kernel command line: root=/dev/sda6
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 253844k/261840k available (1872k kernel code,
7996k reserved, 484k data, 108k init, 65232k highmem)
[    0.000000] SLUB: Genslabs=15, HWalign=32, Order=0-3, MinObjects=0,
CPUs=1, Nodes=1
[    0.000000] NR_IRQS:64
[    0.000000] Console: colour dummy device 80x25
[    0.000000] console [tty0] enabled
[    0.000000] Calibrating delay loop... 107.32 BogoMIPS (lpj=179712)
[    0.059999] pid_max: default: 32768 minimum: 301
[    0.059999] Mount-cache hash table entries: 512
[    0.069999] NET: Registered protocol family 16
[    0.089999] IOMMU: impl 0 vers 4 table 0xfbc80000[262144 B] map [65536 b]
[    0.106666] bio: create slab <bio-0> at 0
[    0.113333] SCSI subsystem initialized
[    0.169999] NET: Registered protocol family 2
[    0.169999] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.173333] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[    0.173333] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[    0.176666] TCP: Hash tables configured (established 8192 bind 8192)
[    0.176666] TCP reno registered
[    0.176666] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.176666] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.179999] apc: power management initialized
[    0.183333] highmem bounce pool size: 64 pages
[    0.279999] msgmni has been set to 368
[    0.286666] Block layer SCSI generic (bsg) driver version 0.4
loaded (major 253)
[    0.286666] io scheduler noop registered
[    0.286666] io scheduler deadline registered (default)
[    0.289999] ffd2c580: ttyS0 at MMIO 0x71100000 (irq = 6) is a zs
[    0.289999] Console: ttyS0 (SunZilog zs0)
[    0.293333] console [ttyS0] enabled
[    0.296666] ffd2c580: ttyS1 at MMIO 0x71100004 (irq = 6) is a zs
[    0.299999] ffd2c634: Keyboard at MMIO 0x71000000 (irq = 6) is a zs
[    0.303333] ffd2c634: Mouse at MMIO 0x71000004 (irq = 6) is a zs
[    0.313333] esp: esp0, regs[fd00b000:fd00a000] irq[2]
[    0.316666] esp: esp0 is a FAS100A, 40 MHz (ccf=0), SCSI ID 7
[    3.326666] scsi0 : esp
[    4.049999] scsi 0:0:3:0: Direct-Access     FUJITSU  MAP3735N
SUN72G  0401 PQ: 0 ANSI: 4
[    4.053332] scsi target0:0:3: Beginning Domain Validation
[    4.069999] scsi target0:0:3: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
[    4.083332] scsi target0:0:3: Domain Validation skipping write tests
[    4.086666] scsi target0:0:3: Ending Domain Validation
[    4.583332] scsi 0:0:6:0: CD-ROM            PLEXTOR  CD-R
PX-W4220T 1.04 PQ: 0 ANSI: 2
[    4.586666] scsi target0:0:6: Beginning Domain Validation
[    4.603332] scsi target0:0:6: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 8)
[    4.616666] scsi target0:0:6: Domain Validation skipping write tests
[    4.619999] scsi target0:0:6: Ending Domain Validation
[    4.633332] mousedev: PS/2 mouse device common for all mice
[    4.639999] rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t08 as rtc0
[    4.646666] TCP cubic registered
[    4.653332] rtc-m48t59 rtc-m48t59.0: setting system clock to
2011-03-07 06:46:37 UTC (1299480397)
[    4.673332] sd 0:0:3:0: [sda] 143374738 512-byte logical blocks:
(73.4 GB/68.3 GiB)
[    4.683332] sd 0:0:3:0: [sda] Write Protect is off
[    4.696666] sd 0:0:3:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[    4.729999]  sda: sda1 sda2 sda3 sda4 sda5 sda6 sda7 sda8
[    4.756666] sd 0:0:3:0: [sda] Attached SCSI disk
[    4.779999] EXT3-fs: barriers not enabled
[    4.793332] kjournald starting.  Commit interval 5 seconds
[    4.796666] EXT3-fs (sda6): mounted filesystem with ordered data mode
[    4.799999] VFS: Mounted root (ext3 filesystem) readonly on device 8:6.
[    4.803332] Freeing unused kernel memory: 108k freed
INIT: version 2.86 booting
[    6.569999] NET: Registered protocol family 1

Gentoo Linux; http://www.gentoo.org/
 Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2

...
INIT: Entering runlevel: 3
...
login:

Marcel


On Sun, Mar 6, 2011 at 10:11 PM, Bob Breuer <breuerr@mc.net> wrote:
> Josip Rodin wrote:
>> On Sun, Mar 06, 2011 at 10:13:56AM +0100, Marcel van Nies wrote:
>>> The hyperSPARC gives the same error without the final genirq patch.
>>>
>>> On Sun, Mar 6, 2011 at 8:23 AM, Marcel van Nies <morcles@gmail.com> wrote:
>>>> The hyperSPARC boots, but fails when starting init. It runs fine on 2.6.17.
>>
>> I realize that it may be a difficult proposition, but you could try to
>> git bisect it.
>>
>> Did you try it on anything after 2.6.17, maybe that narrows it down further?
>>
>
> You shouldn't have to go back that far...  I was last running 2.6.22 on
> hyperSPARC successfully.  Ok, maybe that's not so helpful as it looks
> like it's been a while since I've built a sparc kernel.  Probably time
> for me to also try out a new kernel.
>
> Bob
>
> --
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 7, 2011, 7:07 a.m. UTC | #19
Hi,

> You shouldn't have to go back that far...  I was last running 2.6.22 on
> hyperSPARC successfully.  Ok, maybe that's not so helpful as it looks
> like it's been a while since I've built a sparc kernel.  Probably time
> for me to also try out a new kernel.

2.6.32 is fine too:
Linux ross 2.6.32.27-up #2 Sun Mar 6 23:05:25 CET 2011 sparc sun4m
ROSS HyperSparc RT625 or RT626 GNU/Linux

Today, I'll try to find out which commit causes the problems.

Marcel


On Sun, Mar 6, 2011 at 10:11 PM, Bob Breuer <breuerr@mc.net> wrote:
> Josip Rodin wrote:
>> On Sun, Mar 06, 2011 at 10:13:56AM +0100, Marcel van Nies wrote:
>>> The hyperSPARC gives the same error without the final genirq patch.
>>>
>>> On Sun, Mar 6, 2011 at 8:23 AM, Marcel van Nies <morcles@gmail.com> wrote:
>>>> The hyperSPARC boots, but fails when starting init. It runs fine on 2.6.17.
>>
>> I realize that it may be a difficult proposition, but you could try to
>> git bisect it.
>>
>> Did you try it on anything after 2.6.17, maybe that narrows it down further?
>>
>
> You shouldn't have to go back that far...  I was last running 2.6.22 on
> hyperSPARC successfully.  Ok, maybe that's not so helpful as it looks
> like it's been a while since I've built a sparc kernel.  Probably time
> for me to also try out a new kernel.
>
> Bob
>
> --
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 1:10 a.m. UTC | #20
Hi,

git bisect came up with this:

4d14a459857bd151ecbd14bcd37b4628da00792b is the first bad commit
commit 4d14a459857bd151ecbd14bcd37b4628da00792b
Author: David S. Miller <davem@davemloft.net>
Date:   Thu Dec 10 23:32:10 2009 -0800

    sparc: Stop trying to be so fancy and use __builtin_{memcpy,memset}()

    This mirrors commit ff60fab71bb3b4fdbf8caf57ff3739ffd0887396
    (x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy)

    Signed-off-by: David S. Miller <davem@davemloft.net>

Marcel



On Mon, Mar 7, 2011 at 8:07 AM, Marcel van Nies <morcles@gmail.com> wrote:
> Hi,
>
>> You shouldn't have to go back that far...  I was last running 2.6.22 on
>> hyperSPARC successfully.  Ok, maybe that's not so helpful as it looks
>> like it's been a while since I've built a sparc kernel.  Probably time
>> for me to also try out a new kernel.
>
> 2.6.32 is fine too:
> Linux ross 2.6.32.27-up #2 Sun Mar 6 23:05:25 CET 2011 sparc sun4m
> ROSS HyperSparc RT625 or RT626 GNU/Linux
>
> Today, I'll try to find out which commit causes the problems.
>
> Marcel
>
>
> On Sun, Mar 6, 2011 at 10:11 PM, Bob Breuer <breuerr@mc.net> wrote:
>> Josip Rodin wrote:
>>> On Sun, Mar 06, 2011 at 10:13:56AM +0100, Marcel van Nies wrote:
>>>> The hyperSPARC gives the same error without the final genirq patch.
>>>>
>>>> On Sun, Mar 6, 2011 at 8:23 AM, Marcel van Nies <morcles@gmail.com> wrote:
>>>>> The hyperSPARC boots, but fails when starting init. It runs fine on 2.6.17.
>>>
>>> I realize that it may be a difficult proposition, but you could try to
>>> git bisect it.
>>>
>>> Did you try it on anything after 2.6.17, maybe that narrows it down further?
>>>
>>
>> You shouldn't have to go back that far...  I was last running 2.6.22 on
>> hyperSPARC successfully.  Ok, maybe that's not so helpful as it looks
>> like it's been a while since I've built a sparc kernel.  Probably time
>> for me to also try out a new kernel.
>>
>> Bob
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg March 8, 2011, 6 a.m. UTC | #21
Hi Marcel.

Added davem...
We see strange SEGV faults in userspace and fail to read from ext2..
All on some (but not all) sparc32 boxes.

On Tue, Mar 08, 2011 at 02:10:03AM +0100, Marcel van Nies wrote:
> Hi,
> 
> git bisect came up with this:
> 
> 4d14a459857bd151ecbd14bcd37b4628da00792b is the first bad commit
> commit 4d14a459857bd151ecbd14bcd37b4628da00792b
> Author: David S. Miller <davem@davemloft.net>
> Date:   Thu Dec 10 23:32:10 2009 -0800
> 
>     sparc: Stop trying to be so fancy and use __builtin_{memcpy,memset}()
> 
>     This mirrors commit ff60fab71bb3b4fdbf8caf57ff3739ffd0887396
>     (x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy)
> 
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> Marcel

Great work!

Did you try a clean revert on said commit on top of sparc-next?
Just to confirm that this indeed the commit causing the bug -
and that reverting it fixes the bug.
Maybe you already planned to do so...

Looking at the commit I can see that it will require same hand-editing
to revert it. Obviously you can skip the parts that touches
sparc64 files.
On the way out of the door - so I cannot produce a patch
for you right away.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 8, 2011, 7:01 a.m. UTC | #22
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 8 Mar 2011 07:00:39 +0100

> Added davem...
> We see strange SEGV faults in userspace and fail to read from ext2..
> All on some (but not all) sparc32 boxes.

I saw the original report.

But reverting this commit is the wrong thing to do from what I can
tell.

Either we have:

1) A compiler code gen bug.

2) Some piece of code which is sparc32 specific is invoking memset
   or memcpy in a way which makes assumptions which are in fact not
   valid

3) The code change is merely making cache offsets change, masking the
   true problem

Especially in cases #2 and #3 we're just hiding a heisen-bug and
not fixing the real problem.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg March 8, 2011, 7:08 a.m. UTC | #23
On Mon, Mar 07, 2011 at 11:01:20PM -0800, David Miller wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Tue, 8 Mar 2011 07:00:39 +0100
> 
> > Added davem...
> > We see strange SEGV faults in userspace and fail to read from ext2..
> > All on some (but not all) sparc32 boxes.
> 
> I saw the original report.
> 
> But reverting this commit is the wrong thing to do from what I can
> tell.
> 
> Either we have:
> 
> 1) A compiler code gen bug.
> 
> 2) Some piece of code which is sparc32 specific is invoking memset
>    or memcpy in a way which makes assumptions which are in fact not
>    valid
> 
> 3) The code change is merely making cache offsets change, masking the
>    true problem
> 
> Especially in cases #2 and #3 we're just hiding a heisen-bug and
> not fixing the real problem.
Agree on this.
But first step is to get confirmation that reverting this commit
indeed fixes the bug. Then we can go hunting for 2), 3) or 1).
I hope we will find that 2) is the culprint.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 8, 2011, 7:19 a.m. UTC | #24
From: Sam Ravnborg <sam@ravnborg.org>
Date: Tue, 8 Mar 2011 08:08:42 +0100

> But first step is to get confirmation that reverting this commit
> indeed fixes the bug. Then we can go hunting for 2), 3) or 1).
> I hope we will find that 2) is the culprint.

Agreed, information never hurts :-)
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 7:37 a.m. UTC | #25
Hi,

It appears that two consecutive commits are causing problems on
hyperSPARC, I noticed that too late.

Commit 4d14a459857bd151ecbd14bcd37b4628da00792b (the one I reported
earlier) only causes the system to hang, not panic:
[   11.266665] sd 0:0:1:0: [sda] Attached SCSI disk
[   11.279998] sd 0:0:3:0: [sdb] Attached SCSI disk
[   11.299998] kjournald starting.  Commit interval 5 seconds
[   11.303332] EXT3-fs: mounted filesystem with writeback data mode.
[   11.306665] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
[   11.309998] Freeing unused kernel memory: 100k freed
<system hangs here - stop-A does go back to prom>

and
commit c658ad1b4e1520511da8323aa5e60d444cc303ed
Author: David S. Miller <davem@davemloft.net>
Date:   Fri Dec 11 00:44:47 2009 -0800

    sparc64: Add syscall tracepoint support.

    Signed-off-by: David S. Miller <davem@davemloft.net>

actually makes the kernel panic:
[   11.336665] Freeing unused kernel memory: 100k freed
[   11.419998] Kernel panic - not syncing: Attempted to kill init!
[   11.423332] [f002f5b8 : do_group_exit+0x84/0xb4 ]
 [f0039490 : get_signal_to_deliver+0x338/0x35c ]
 [f00124cc : do_signal+0x30/0x8f0 ]
 [f0012da0 : do_notify_resume+0x14/0x38 ]
 [f000fca4 : signal_p+0x14/0x24 ]
 [f000edfc : srmmu_fault+0x58/0x68 ]
[   11.466665] Press Stop-A (L1-A) to return to the boot prom


Marcel


On Tue, Mar 8, 2011 at 8:08 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Mon, Mar 07, 2011 at 11:01:20PM -0800, David Miller wrote:
>> From: Sam Ravnborg <sam@ravnborg.org>
>> Date: Tue, 8 Mar 2011 07:00:39 +0100
>>
>> > Added davem...
>> > We see strange SEGV faults in userspace and fail to read from ext2..
>> > All on some (but not all) sparc32 boxes.
>>
>> I saw the original report.
>>
>> But reverting this commit is the wrong thing to do from what I can
>> tell.
>>
>> Either we have:
>>
>> 1) A compiler code gen bug.
>>
>> 2) Some piece of code which is sparc32 specific is invoking memset
>>    or memcpy in a way which makes assumptions which are in fact not
>>    valid
>>
>> 3) The code change is merely making cache offsets change, masking the
>>    true problem
>>
>> Especially in cases #2 and #3 we're just hiding a heisen-bug and
>> not fixing the real problem.
> Agree on this.
> But first step is to get confirmation that reverting this commit
> indeed fixes the bug. Then we can go hunting for 2), 3) or 1).
> I hope we will find that 2) is the culprint.
>
>        Sam
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 7:45 a.m. UTC | #26
Hi,

> But first step is to get confirmation that reverting this commit
> indeed fixes the bug

I'll try that.
M

On Tue, Mar 8, 2011 at 8:37 AM, Marcel van Nies <morcles@gmail.com> wrote:
> Hi,
>
> It appears that two consecutive commits are causing problems on
> hyperSPARC, I noticed that too late.
>
> Commit 4d14a459857bd151ecbd14bcd37b4628da00792b (the one I reported
> earlier) only causes the system to hang, not panic:
> [   11.266665] sd 0:0:1:0: [sda] Attached SCSI disk
> [   11.279998] sd 0:0:3:0: [sdb] Attached SCSI disk
> [   11.299998] kjournald starting.  Commit interval 5 seconds
> [   11.303332] EXT3-fs: mounted filesystem with writeback data mode.
> [   11.306665] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
> [   11.309998] Freeing unused kernel memory: 100k freed
> <system hangs here - stop-A does go back to prom>
>
> and
> commit c658ad1b4e1520511da8323aa5e60d444cc303ed
> Author: David S. Miller <davem@davemloft.net>
> Date:   Fri Dec 11 00:44:47 2009 -0800
>
>    sparc64: Add syscall tracepoint support.
>
>    Signed-off-by: David S. Miller <davem@davemloft.net>
>
> actually makes the kernel panic:
> [   11.336665] Freeing unused kernel memory: 100k freed
> [   11.419998] Kernel panic - not syncing: Attempted to kill init!
> [   11.423332] [f002f5b8 : do_group_exit+0x84/0xb4 ]
>  [f0039490 : get_signal_to_deliver+0x338/0x35c ]
>  [f00124cc : do_signal+0x30/0x8f0 ]
>  [f0012da0 : do_notify_resume+0x14/0x38 ]
>  [f000fca4 : signal_p+0x14/0x24 ]
>  [f000edfc : srmmu_fault+0x58/0x68 ]
> [   11.466665] Press Stop-A (L1-A) to return to the boot prom
>
>
> Marcel
>
>
> On Tue, Mar 8, 2011 at 8:08 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
>> On Mon, Mar 07, 2011 at 11:01:20PM -0800, David Miller wrote:
>>> From: Sam Ravnborg <sam@ravnborg.org>
>>> Date: Tue, 8 Mar 2011 07:00:39 +0100
>>>
>>> > Added davem...
>>> > We see strange SEGV faults in userspace and fail to read from ext2..
>>> > All on some (but not all) sparc32 boxes.
>>>
>>> I saw the original report.
>>>
>>> But reverting this commit is the wrong thing to do from what I can
>>> tell.
>>>
>>> Either we have:
>>>
>>> 1) A compiler code gen bug.
>>>
>>> 2) Some piece of code which is sparc32 specific is invoking memset
>>>    or memcpy in a way which makes assumptions which are in fact not
>>>    valid
>>>
>>> 3) The code change is merely making cache offsets change, masking the
>>>    true problem
>>>
>>> Especially in cases #2 and #3 we're just hiding a heisen-bug and
>>> not fixing the real problem.
>> Agree on this.
>> But first step is to get confirmation that reverting this commit
>> indeed fixes the bug. Then we can go hunting for 2), 3) or 1).
>> I hope we will find that 2) is the culprint.
>>
>>        Sam
>>
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 11:17 a.m. UTC | #27
Hi,

2.6.33.7 with commit 4d14a459857bd151ecbd14bcd37b4628da00792b reverted
does not segfault.
I also tried sparc-next-2.6, but I messed up my tree somehow. I will
try again later.

M

On Tue, Mar 8, 2011 at 8:45 AM, Marcel van Nies <morcles@gmail.com> wrote:
> Hi,
>
>> But first step is to get confirmation that reverting this commit
>> indeed fixes the bug
>
> I'll try that.
> M
>
> On Tue, Mar 8, 2011 at 8:37 AM, Marcel van Nies <morcles@gmail.com> wrote:
>> Hi,
>>
>> It appears that two consecutive commits are causing problems on
>> hyperSPARC, I noticed that too late.
>>
>> Commit 4d14a459857bd151ecbd14bcd37b4628da00792b (the one I reported
>> earlier) only causes the system to hang, not panic:
>> [   11.266665] sd 0:0:1:0: [sda] Attached SCSI disk
>> [   11.279998] sd 0:0:3:0: [sdb] Attached SCSI disk
>> [   11.299998] kjournald starting.  Commit interval 5 seconds
>> [   11.303332] EXT3-fs: mounted filesystem with writeback data mode.
>> [   11.306665] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
>> [   11.309998] Freeing unused kernel memory: 100k freed
>> <system hangs here - stop-A does go back to prom>
>>
>> and
>> commit c658ad1b4e1520511da8323aa5e60d444cc303ed
>> Author: David S. Miller <davem@davemloft.net>
>> Date:   Fri Dec 11 00:44:47 2009 -0800
>>
>>    sparc64: Add syscall tracepoint support.
>>
>>    Signed-off-by: David S. Miller <davem@davemloft.net>
>>
>> actually makes the kernel panic:
>> [   11.336665] Freeing unused kernel memory: 100k freed
>> [   11.419998] Kernel panic - not syncing: Attempted to kill init!
>> [   11.423332] [f002f5b8 : do_group_exit+0x84/0xb4 ]
>>  [f0039490 : get_signal_to_deliver+0x338/0x35c ]
>>  [f00124cc : do_signal+0x30/0x8f0 ]
>>  [f0012da0 : do_notify_resume+0x14/0x38 ]
>>  [f000fca4 : signal_p+0x14/0x24 ]
>>  [f000edfc : srmmu_fault+0x58/0x68 ]
>> [   11.466665] Press Stop-A (L1-A) to return to the boot prom
>>
>>
>> Marcel
>>
>>
>> On Tue, Mar 8, 2011 at 8:08 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
>>> On Mon, Mar 07, 2011 at 11:01:20PM -0800, David Miller wrote:
>>>> From: Sam Ravnborg <sam@ravnborg.org>
>>>> Date: Tue, 8 Mar 2011 07:00:39 +0100
>>>>
>>>> > Added davem...
>>>> > We see strange SEGV faults in userspace and fail to read from ext2..
>>>> > All on some (but not all) sparc32 boxes.
>>>>
>>>> I saw the original report.
>>>>
>>>> But reverting this commit is the wrong thing to do from what I can
>>>> tell.
>>>>
>>>> Either we have:
>>>>
>>>> 1) A compiler code gen bug.
>>>>
>>>> 2) Some piece of code which is sparc32 specific is invoking memset
>>>>    or memcpy in a way which makes assumptions which are in fact not
>>>>    valid
>>>>
>>>> 3) The code change is merely making cache offsets change, masking the
>>>>    true problem
>>>>
>>>> Especially in cases #2 and #3 we're just hiding a heisen-bug and
>>>> not fixing the real problem.
>>> Agree on this.
>>> But first step is to get confirmation that reverting this commit
>>> indeed fixes the bug. Then we can go hunting for 2), 3) or 1).
>>> I hope we will find that 2) is the culprint.
>>>
>>>        Sam
>>>
>>
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 8:22 p.m. UTC | #28
Hi,

The good news:
sparc-next-2.6 with commit 4d14a459857bd151ecbd14bcd37b4628da00792b reverted
does NOT segfault. I did not apply the genirq patch yet.

The bad news:
Segfault gone, say hello to EXT2 read failure   :o(

I'll rebuild this kernel with the esp_debug.patch Sam sent a couple of days ago.


[    0.233333] esp: esp0, regs[fd00a000:fd009000] irq[36]
[    0.236666] esp: esp0 is a FAS100A, 40 MHz (ccf=0), SCSI ID 7
[    3.243333] scsi0 : esp
[    3.483332] scsi 0:0:1:0: Direct-Access     FUJITSU  MAP3735N
SUN72G  0401 PQ: 0 ANSI: 4
[    3.486666] scsi target0:0:1: Beginning Domain Validation
[    3.493332] scsi target0:0:1: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
[    3.499999] scsi target0:0:1: Domain Validation skipping write tests
[    3.503332] scsi target0:0:1: Ending Domain Validation
[    3.743332] scsi 0:0:3:0: Direct-Access     FUJITSU  MAP3735N
SUN72G  0401 PQ: 0 ANSI: 4
[    3.746666] scsi target0:0:3: Beginning Domain Validation
[    3.753332] scsi target0:0:3: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
[    3.756666] scsi target0:0:3: Domain Validation skipping write tests
[    3.759999] scsi target0:0:3: Ending Domain Validation
[    4.469999] esp: esp1, regs[fd00c000:fd00b000] irq[53]
[    4.473332] esp: esp1 is a FASHME, 40 MHz (ccf=0), SCSI ID 7
[    7.479999] scsi1 : esp
...
[   11.029998] sd 0:0:1:0: [sda] 143374738 512-byte logical blocks:
(73.4 GB/68.3 GiB)
[   11.033332] sd 0:0:3:0: [sdb] 143374738 512-byte logical blocks:
(73.4 GB/68.3 GiB)
[   11.036665] sd 0:0:1:0: [sda] Write Protect is off
[   11.043332] sd 0:0:1:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[   11.046665] sd 0:0:3:0: [sdb] Write Protect is off
[   11.053332] sd 0:0:3:0: [sdb] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[   11.066665]  sda: sda1 sda2 sda3
[   11.073332]  sdb: sdb1 sdb2 sdb3 sdb4 sdb5 sdb6 sdb7
[   11.089998] sd 0:0:1:0: [sda] Attached SCSI disk
[   11.093332] sd 0:0:3:0: [sdb] Attached SCSI disk
[   11.106665] EXT3-fs: barriers not enabled
[   11.113332] kjournald starting.  Commit interval 5 seconds
[   11.116665] EXT3-fs (sdb4): mounted filesystem with ordered data mode
[   11.119998] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
[   11.123332] Freeing unused kernel memory: 108k freed
INIT: version 2.86 booting
[   12.673332] NET: Registered protocol family 1

Gentoo Linux; http://www.gentoo.org/
 Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2

 * Mounting proc at /proc ...                                             [ ok ]
 * Mounting sysfs at /sys ...                                             [ ok ]
 * Mounting /dev for udev ...                                             [ ok ]
...
blahblah
...
 * Checking root filesystem ...fsck.ext3: No such file or directory
while trying to open /dev/sdb4
/dev/sdb4:
The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

 * Filesystem couldn't be fixed :(
         [ !! ]
Give root password for maintenance
(or type Control-D to continue):


Marcel


On Tue, Mar 8, 2011 at 12:17 PM, Marcel van Nies <morcles@gmail.com> wrote:
> Hi,
>
> 2.6.33.7 with commit 4d14a459857bd151ecbd14bcd37b4628da00792b reverted
> does not segfault.
> I also tried sparc-next-2.6, but I messed up my tree somehow. I will
> try again later.
>
> M
>
> On Tue, Mar 8, 2011 at 8:45 AM, Marcel van Nies <morcles@gmail.com> wrote:
>> Hi,
>>
>>> But first step is to get confirmation that reverting this commit
>>> indeed fixes the bug
>>
>> I'll try that.
>> M
>>
>> On Tue, Mar 8, 2011 at 8:37 AM, Marcel van Nies <morcles@gmail.com> wrote:
>>> Hi,
>>>
>>> It appears that two consecutive commits are causing problems on
>>> hyperSPARC, I noticed that too late.
>>>
>>> Commit 4d14a459857bd151ecbd14bcd37b4628da00792b (the one I reported
>>> earlier) only causes the system to hang, not panic:
>>> [   11.266665] sd 0:0:1:0: [sda] Attached SCSI disk
>>> [   11.279998] sd 0:0:3:0: [sdb] Attached SCSI disk
>>> [   11.299998] kjournald starting.  Commit interval 5 seconds
>>> [   11.303332] EXT3-fs: mounted filesystem with writeback data mode.
>>> [   11.306665] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
>>> [   11.309998] Freeing unused kernel memory: 100k freed
>>> <system hangs here - stop-A does go back to prom>
>>>
>>> and
>>> commit c658ad1b4e1520511da8323aa5e60d444cc303ed
>>> Author: David S. Miller <davem@davemloft.net>
>>> Date:   Fri Dec 11 00:44:47 2009 -0800
>>>
>>>    sparc64: Add syscall tracepoint support.
>>>
>>>    Signed-off-by: David S. Miller <davem@davemloft.net>
>>>
>>> actually makes the kernel panic:
>>> [   11.336665] Freeing unused kernel memory: 100k freed
>>> [   11.419998] Kernel panic - not syncing: Attempted to kill init!
>>> [   11.423332] [f002f5b8 : do_group_exit+0x84/0xb4 ]
>>>  [f0039490 : get_signal_to_deliver+0x338/0x35c ]
>>>  [f00124cc : do_signal+0x30/0x8f0 ]
>>>  [f0012da0 : do_notify_resume+0x14/0x38 ]
>>>  [f000fca4 : signal_p+0x14/0x24 ]
>>>  [f000edfc : srmmu_fault+0x58/0x68 ]
>>> [   11.466665] Press Stop-A (L1-A) to return to the boot prom
>>>
>>>
>>> Marcel
>>>
>>>
>>> On Tue, Mar 8, 2011 at 8:08 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
>>>> On Mon, Mar 07, 2011 at 11:01:20PM -0800, David Miller wrote:
>>>>> From: Sam Ravnborg <sam@ravnborg.org>
>>>>> Date: Tue, 8 Mar 2011 07:00:39 +0100
>>>>>
>>>>> > Added davem...
>>>>> > We see strange SEGV faults in userspace and fail to read from ext2..
>>>>> > All on some (but not all) sparc32 boxes.
>>>>>
>>>>> I saw the original report.
>>>>>
>>>>> But reverting this commit is the wrong thing to do from what I can
>>>>> tell.
>>>>>
>>>>> Either we have:
>>>>>
>>>>> 1) A compiler code gen bug.
>>>>>
>>>>> 2) Some piece of code which is sparc32 specific is invoking memset
>>>>>    or memcpy in a way which makes assumptions which are in fact not
>>>>>    valid
>>>>>
>>>>> 3) The code change is merely making cache offsets change, masking the
>>>>>    true problem
>>>>>
>>>>> Especially in cases #2 and #3 we're just hiding a heisen-bug and
>>>>> not fixing the real problem.
>>>> Agree on this.
>>>> But first step is to get confirmation that reverting this commit
>>>> indeed fixes the bug. Then we can go hunting for 2), 3) or 1).
>>>> I hope we will find that 2) is the culprint.
>>>>
>>>>        Sam
>>>>
>>>
>>
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg March 8, 2011, 9:09 p.m. UTC | #29
On Tue, Mar 08, 2011 at 09:22:07PM +0100, Marcel van Nies wrote:
> Hi,
> 
> The good news:
> sparc-next-2.6 with commit 4d14a459857bd151ecbd14bcd37b4628da00792b reverted
> does NOT segfault. I did not apply the genirq patch yet.

Narrowing it down to a sinlge patch is good.

> 
> The bad news:
> Segfault gone, say hello to EXT2 read failure   :o(

So we are dealing with two faults. Not a suprise considering how
little we have tested on sparc32 lately.

> I'll rebuild this kernel with the esp_debug.patch Sam sent a couple of days ago.

I have tried said patch myself.
You may try to play around with the value as it produces a lot of output.

Regarding the segfault - the easiest way forward would be to split the
patch up in smaller chunks so we know which part causes the segfault to happen.

I assume you had to hand-apply the revert. If you could post the exact patch
you used for revert I will try to split it up in smaller logical parts.
But likely not until the weekend.

I have a sparcstation 5 that I managed to boot - unfortunately it
did not show erratic behaviour as you describe.
And for now I do not have any Ext2 filesystem on disk to play with.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 9:13 p.m. UTC | #30
Hi,

As expected, esp_debug gives a lot of ouput.
Is there anything in particular to look out for ?

Btw:
At this point:
> Give root password for maintenance
> (or type Control-D to continue):

I can logon, and reads from disk seem to go fine.

# mount -n -o remount,rw /
Then also writes to disk seem to go fine.


So, is this an ESP or EXT2 bug at all ?

Marcel

On Tue, Mar 8, 2011 at 9:22 PM, Marcel van Nies <morcles@gmail.com> wrote:
> Hi,
>
> The good news:
> sparc-next-2.6 with commit 4d14a459857bd151ecbd14bcd37b4628da00792b reverted
> does NOT segfault. I did not apply the genirq patch yet.
>
> The bad news:
> Segfault gone, say hello to EXT2 read failure   :o(
>
> I'll rebuild this kernel with the esp_debug.patch Sam sent a couple of days ago.
>
>
> [    0.233333] esp: esp0, regs[fd00a000:fd009000] irq[36]
> [    0.236666] esp: esp0 is a FAS100A, 40 MHz (ccf=0), SCSI ID 7
> [    3.243333] scsi0 : esp
> [    3.483332] scsi 0:0:1:0: Direct-Access     FUJITSU  MAP3735N
> SUN72G  0401 PQ: 0 ANSI: 4
> [    3.486666] scsi target0:0:1: Beginning Domain Validation
> [    3.493332] scsi target0:0:1: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
> [    3.499999] scsi target0:0:1: Domain Validation skipping write tests
> [    3.503332] scsi target0:0:1: Ending Domain Validation
> [    3.743332] scsi 0:0:3:0: Direct-Access     FUJITSU  MAP3735N
> SUN72G  0401 PQ: 0 ANSI: 4
> [    3.746666] scsi target0:0:3: Beginning Domain Validation
> [    3.753332] scsi target0:0:3: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
> [    3.756666] scsi target0:0:3: Domain Validation skipping write tests
> [    3.759999] scsi target0:0:3: Ending Domain Validation
> [    4.469999] esp: esp1, regs[fd00c000:fd00b000] irq[53]
> [    4.473332] esp: esp1 is a FASHME, 40 MHz (ccf=0), SCSI ID 7
> [    7.479999] scsi1 : esp
> ...
> [   11.029998] sd 0:0:1:0: [sda] 143374738 512-byte logical blocks:
> (73.4 GB/68.3 GiB)
> [   11.033332] sd 0:0:3:0: [sdb] 143374738 512-byte logical blocks:
> (73.4 GB/68.3 GiB)
> [   11.036665] sd 0:0:1:0: [sda] Write Protect is off
> [   11.043332] sd 0:0:1:0: [sda] Write cache: disabled, read cache:
> enabled, doesn't support DPO or FUA
> [   11.046665] sd 0:0:3:0: [sdb] Write Protect is off
> [   11.053332] sd 0:0:3:0: [sdb] Write cache: disabled, read cache:
> enabled, doesn't support DPO or FUA
> [   11.066665]  sda: sda1 sda2 sda3
> [   11.073332]  sdb: sdb1 sdb2 sdb3 sdb4 sdb5 sdb6 sdb7
> [   11.089998] sd 0:0:1:0: [sda] Attached SCSI disk
> [   11.093332] sd 0:0:3:0: [sdb] Attached SCSI disk
> [   11.106665] EXT3-fs: barriers not enabled
> [   11.113332] kjournald starting.  Commit interval 5 seconds
> [   11.116665] EXT3-fs (sdb4): mounted filesystem with ordered data mode
> [   11.119998] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
> [   11.123332] Freeing unused kernel memory: 108k freed
> INIT: version 2.86 booting
> [   12.673332] NET: Registered protocol family 1
>
> Gentoo Linux; http://www.gentoo.org/
>  Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
>
>  * Mounting proc at /proc ...                                             [ ok ]
>  * Mounting sysfs at /sys ...                                             [ ok ]
>  * Mounting /dev for udev ...                                             [ ok ]
> ...
> blahblah
> ...
>  * Checking root filesystem ...fsck.ext3: No such file or directory
> while trying to open /dev/sdb4
> /dev/sdb4:
> The superblock could not be read or does not describe a correct ext2
> filesystem.  If the device is valid and it really contains an ext2
> filesystem (and not swap or ufs or something else), then the superblock
> is corrupt, and you might try running e2fsck with an alternate superblock:
>    e2fsck -b 8193 <device>
>
>  * Filesystem couldn't be fixed :(
>         [ !! ]
> Give root password for maintenance
> (or type Control-D to continue):
>
>
> Marcel
>
>
> On Tue, Mar 8, 2011 at 12:17 PM, Marcel van Nies <morcles@gmail.com> wrote:
>> Hi,
>>
>> 2.6.33.7 with commit 4d14a459857bd151ecbd14bcd37b4628da00792b reverted
>> does not segfault.
>> I also tried sparc-next-2.6, but I messed up my tree somehow. I will
>> try again later.
>>
>> M
>>
>> On Tue, Mar 8, 2011 at 8:45 AM, Marcel van Nies <morcles@gmail.com> wrote:
>>> Hi,
>>>
>>>> But first step is to get confirmation that reverting this commit
>>>> indeed fixes the bug
>>>
>>> I'll try that.
>>> M
>>>
>>> On Tue, Mar 8, 2011 at 8:37 AM, Marcel van Nies <morcles@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> It appears that two consecutive commits are causing problems on
>>>> hyperSPARC, I noticed that too late.
>>>>
>>>> Commit 4d14a459857bd151ecbd14bcd37b4628da00792b (the one I reported
>>>> earlier) only causes the system to hang, not panic:
>>>> [   11.266665] sd 0:0:1:0: [sda] Attached SCSI disk
>>>> [   11.279998] sd 0:0:3:0: [sdb] Attached SCSI disk
>>>> [   11.299998] kjournald starting.  Commit interval 5 seconds
>>>> [   11.303332] EXT3-fs: mounted filesystem with writeback data mode.
>>>> [   11.306665] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
>>>> [   11.309998] Freeing unused kernel memory: 100k freed
>>>> <system hangs here - stop-A does go back to prom>
>>>>
>>>> and
>>>> commit c658ad1b4e1520511da8323aa5e60d444cc303ed
>>>> Author: David S. Miller <davem@davemloft.net>
>>>> Date:   Fri Dec 11 00:44:47 2009 -0800
>>>>
>>>>    sparc64: Add syscall tracepoint support.
>>>>
>>>>    Signed-off-by: David S. Miller <davem@davemloft.net>
>>>>
>>>> actually makes the kernel panic:
>>>> [   11.336665] Freeing unused kernel memory: 100k freed
>>>> [   11.419998] Kernel panic - not syncing: Attempted to kill init!
>>>> [   11.423332] [f002f5b8 : do_group_exit+0x84/0xb4 ]
>>>>  [f0039490 : get_signal_to_deliver+0x338/0x35c ]
>>>>  [f00124cc : do_signal+0x30/0x8f0 ]
>>>>  [f0012da0 : do_notify_resume+0x14/0x38 ]
>>>>  [f000fca4 : signal_p+0x14/0x24 ]
>>>>  [f000edfc : srmmu_fault+0x58/0x68 ]
>>>> [   11.466665] Press Stop-A (L1-A) to return to the boot prom
>>>>
>>>>
>>>> Marcel
>>>>
>>>>
>>>> On Tue, Mar 8, 2011 at 8:08 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
>>>>> On Mon, Mar 07, 2011 at 11:01:20PM -0800, David Miller wrote:
>>>>>> From: Sam Ravnborg <sam@ravnborg.org>
>>>>>> Date: Tue, 8 Mar 2011 07:00:39 +0100
>>>>>>
>>>>>> > Added davem...
>>>>>> > We see strange SEGV faults in userspace and fail to read from ext2..
>>>>>> > All on some (but not all) sparc32 boxes.
>>>>>>
>>>>>> I saw the original report.
>>>>>>
>>>>>> But reverting this commit is the wrong thing to do from what I can
>>>>>> tell.
>>>>>>
>>>>>> Either we have:
>>>>>>
>>>>>> 1) A compiler code gen bug.
>>>>>>
>>>>>> 2) Some piece of code which is sparc32 specific is invoking memset
>>>>>>    or memcpy in a way which makes assumptions which are in fact not
>>>>>>    valid
>>>>>>
>>>>>> 3) The code change is merely making cache offsets change, masking the
>>>>>>    true problem
>>>>>>
>>>>>> Especially in cases #2 and #3 we're just hiding a heisen-bug and
>>>>>> not fixing the real problem.
>>>>> Agree on this.
>>>>> But first step is to get confirmation that reverting this commit
>>>>> indeed fixes the bug. Then we can go hunting for 2), 3) or 1).
>>>>> I hope we will find that 2) is the culprint.
>>>>>
>>>>>        Sam
>>>>>
>>>>
>>>
>>
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 8, 2011, 9:19 p.m. UTC | #31
From: Marcel van Nies <morcles@gmail.com>
Date: Tue, 8 Mar 2011 22:13:05 +0100

> So, is this an ESP or EXT2 bug at all ?

The error message is that the program "fsck.ext3" cannot be found.
Does that binary exist in the correct location so that fsck can
find it?
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 9:20 p.m. UTC | #32
Hi Sam,

> Regarding the segfault - the easiest way forward would be to split the
> patch up in smaller chunks so we know which part causes the segfault to happen.

Yes, I'll see if I can work that out.

> I assume you had to hand-apply the revert.
That's what I did.

> If you could post the exact patch you used for revert
> I will try to split it up in smaller logical parts.
I'll post that patch later.

> I have a sparcstation 5 that I managed to boot -
> unfortunately itdid not show erratic behaviour as you describe.

My sparcSTATION 5 boots sparc-next-2.6 with your genirq patch just fine too.
It's up for almost 2 days now, doing things.  It has 4 EXT3
filesystems. No problemo.

Marcel


On Tue, Mar 8, 2011 at 10:09 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Tue, Mar 08, 2011 at 09:22:07PM +0100, Marcel van Nies wrote:
>> Hi,
>>
>> The good news:
>> sparc-next-2.6 with commit 4d14a459857bd151ecbd14bcd37b4628da00792b reverted
>> does NOT segfault. I did not apply the genirq patch yet.
>
> Narrowing it down to a sinlge patch is good.
>
>>
>> The bad news:
>> Segfault gone, say hello to EXT2 read failure   :o(
>
> So we are dealing with two faults. Not a suprise considering how
> little we have tested on sparc32 lately.
>
>> I'll rebuild this kernel with the esp_debug.patch Sam sent a couple of days ago.
>
> I have tried said patch myself.
> You may try to play around with the value as it produces a lot of output.
>
> Regarding the segfault - the easiest way forward would be to split the
> patch up in smaller chunks so we know which part causes the segfault to happen.
>
> I assume you had to hand-apply the revert. If you could post the exact patch
> you used for revert I will try to split it up in smaller logical parts.
> But likely not until the weekend.
>
> I have a sparcstation 5 that I managed to boot - unfortunately it
> did not show erratic behaviour as you describe.
> And for now I do not have any Ext2 filesystem on disk to play with.
>
>        Sam
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 9:27 p.m. UTC | #33
Hi,

/sbin/fsck.ext3 is there, it's used to check / in runlevel 1, i.e. every boot.

I can happily boot anything 2.6.32.27 or earlier.

Marcel

On Tue, Mar 8, 2011 at 10:19 PM, David Miller <davem@davemloft.net> wrote:
> From: Marcel van Nies <morcles@gmail.com>
> Date: Tue, 8 Mar 2011 22:13:05 +0100
>
>> So, is this an ESP or EXT2 bug at all ?
>
> The error message is that the program "fsck.ext3" cannot be found.
> Does that binary exist in the correct location so that fsck can
> find it?
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 9:30 p.m. UTC | #34
Correction:
/sbin/fsck.ext3 is a link to e2fsck.
/sbin/e2fsck is there.

Is the link the problem ?
Let's see.

M

On Tue, Mar 8, 2011 at 10:27 PM, Marcel van Nies <morcles@gmail.com> wrote:
> Hi,
>
> /sbin/fsck.ext3 is there, it's used to check / in runlevel 1, i.e. every boot.
>
> I can happily boot anything 2.6.32.27 or earlier.
>
> Marcel
>
> On Tue, Mar 8, 2011 at 10:19 PM, David Miller <davem@davemloft.net> wrote:
>> From: Marcel van Nies <morcles@gmail.com>
>> Date: Tue, 8 Mar 2011 22:13:05 +0100
>>
>>> So, is this an ESP or EXT2 bug at all ?
>>
>> The error message is that the program "fsck.ext3" cannot be found.
>> Does that binary exist in the correct location so that fsck can
>> find it?
>>
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 8, 2011, 9:30 p.m. UTC | #35
From: Marcel van Nies <morcles@gmail.com>
Date: Tue, 8 Mar 2011 22:27:39 +0100

> /sbin/fsck.ext3 is there, it's used to check / in runlevel 1, i.e. every boot.
> 
> I can happily boot anything 2.6.32.27 or earlier.

One large possibility is that there is a missing cache flush somewhere,
and reverting the memcpy/memset change masks it.

Or, like I said yesterday, bad gcc code generation wrt. those routines.

Looking at ESP logs is not going to give much information as that driver
has been stressed heavily on sparc64 for years without any blips.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 8, 2011, 9:51 p.m. UTC | #36
Hi,

> One large possibility is that there is a missing cache flush somewhere,
> and reverting the memcpy/memset change masks it.

2.6.33.7 with reverted commit is fine too, still leaving
2.6.34 - 2.6.38 for introducing weird behavior.



I've got 3 kinds of SPARC32 here, and the big difference is CPU.
All other hardware in the boxes is "the same".
The software (kernel et.al.) is pretty much the same too.
Everything is ok, except for hyperSPARC.

So what makes the difference? This one :
[    0.000000] Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek (jj@ultra.linux.cz).
 Patching kernel for srmmu[ROSS HyperSparc]/iommu

Combine that with srmmu_fault as in
init[1]: segfault at 0 ip 5000dac8 (rpc f000eea8) spefe738a0 error
30001 in ld-2.3.5.so[50000000+1a000]
Kernel panic - not syncing: Attempted to kill init!
 [f002ed74 : do_group_exit+0x84/0xb4 ]
 [f0039a24 : get_signal_to_deliver+0x338/0x35c ]
 [f0011fbc : do_signal+0x30/0x914 ]
 [f00128b4 : do_notify_resume+0x14/0x38 ]
 [f000fd50 : signal_p+0x14/0x24 ]
 [f000eea8 : srmmu_fault+0x58/0x68 ]

I start thinking there is something wrong with Jakub's srmmu patch for
hyperSPARC...

Marcel


On Tue, Mar 8, 2011 at 10:30 PM, David Miller <davem@davemloft.net> wrote:
> From: Marcel van Nies <morcles@gmail.com>
> Date: Tue, 8 Mar 2011 22:27:39 +0100
>
>> /sbin/fsck.ext3 is there, it's used to check / in runlevel 1, i.e. every boot.
>>
>> I can happily boot anything 2.6.32.27 or earlier.
>
> One large possibility is that there is a missing cache flush somewhere,
> and reverting the memcpy/memset change masks it.
>
> Or, like I said yesterday, bad gcc code generation wrt. those routines.
>
> Looking at ESP logs is not going to give much information as that driver
> has been stressed heavily on sparc64 for years without any blips.
>
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 8, 2011, 10 p.m. UTC | #37
From: Marcel van Nies <morcles@gmail.com>
Date: Tue, 8 Mar 2011 22:51:00 +0100

> I start thinking there is something wrong with Jakub's srmmu patch for
> hyperSPARC...

That's just the code that links up the cpu specific cache and tlb
flushing routines, it's been doing that for more than 10 years.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bob Breuer March 9, 2011, 5:25 a.m. UTC | #38
Marcel van Nies wrote:
> Hi,
> 
> The good news:
> sparc-next-2.6 with commit 4d14a459857bd151ecbd14bcd37b4628da00792b reverted
> does NOT segfault. I did not apply the genirq patch yet.
> 
> The bad news:
> Segfault gone, say hello to EXT2 read failure   :o(
> 
> I'll rebuild this kernel with the esp_debug.patch Sam sent a couple of days ago.
> 
> 
> [    0.233333] esp: esp0, regs[fd00a000:fd009000] irq[36]
> [    0.236666] esp: esp0 is a FAS100A, 40 MHz (ccf=0), SCSI ID 7
> [    3.243333] scsi0 : esp
> [    3.483332] scsi 0:0:1:0: Direct-Access     FUJITSU  MAP3735N
> SUN72G  0401 PQ: 0 ANSI: 4
> [    3.486666] scsi target0:0:1: Beginning Domain Validation
> [    3.493332] scsi target0:0:1: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
> [    3.499999] scsi target0:0:1: Domain Validation skipping write tests
> [    3.503332] scsi target0:0:1: Ending Domain Validation
> [    3.743332] scsi 0:0:3:0: Direct-Access     FUJITSU  MAP3735N
> SUN72G  0401 PQ: 0 ANSI: 4
> [    3.746666] scsi target0:0:3: Beginning Domain Validation
> [    3.753332] scsi target0:0:3: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 15)
> [    3.756666] scsi target0:0:3: Domain Validation skipping write tests
> [    3.759999] scsi target0:0:3: Ending Domain Validation
> [    4.469999] esp: esp1, regs[fd00c000:fd00b000] irq[53]
> [    4.473332] esp: esp1 is a FASHME, 40 MHz (ccf=0), SCSI ID 7
> [    7.479999] scsi1 : esp
> ...
> [   11.029998] sd 0:0:1:0: [sda] 143374738 512-byte logical blocks:
> (73.4 GB/68.3 GiB)
> [   11.033332] sd 0:0:3:0: [sdb] 143374738 512-byte logical blocks:
> (73.4 GB/68.3 GiB)
> [   11.036665] sd 0:0:1:0: [sda] Write Protect is off
> [   11.043332] sd 0:0:1:0: [sda] Write cache: disabled, read cache:
> enabled, doesn't support DPO or FUA
> [   11.046665] sd 0:0:3:0: [sdb] Write Protect is off
> [   11.053332] sd 0:0:3:0: [sdb] Write cache: disabled, read cache:
> enabled, doesn't support DPO or FUA
> [   11.066665]  sda: sda1 sda2 sda3
> [   11.073332]  sdb: sdb1 sdb2 sdb3 sdb4 sdb5 sdb6 sdb7
> [   11.089998] sd 0:0:1:0: [sda] Attached SCSI disk
> [   11.093332] sd 0:0:3:0: [sdb] Attached SCSI disk
> [   11.106665] EXT3-fs: barriers not enabled
> [   11.113332] kjournald starting.  Commit interval 5 seconds
> [   11.116665] EXT3-fs (sdb4): mounted filesystem with ordered data mode
> [   11.119998] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
> [   11.123332] Freeing unused kernel memory: 108k freed
> INIT: version 2.86 booting
> [   12.673332] NET: Registered protocol family 1
> 
> Gentoo Linux; http://www.gentoo.org/
>  Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
> 
>  * Mounting proc at /proc ...                                             [ ok ]
>  * Mounting sysfs at /sys ...                                             [ ok ]
>  * Mounting /dev for udev ...                                             [ ok ]
> ...
> blahblah
> ...
>  * Checking root filesystem ...fsck.ext3: No such file or directory
> while trying to open /dev/sdb4


Check if the device node for /dev/sdb4 exists.

For me, udev will sometimes fail to create a device node with the latest
kernel.  This is with a SuperSparc cpu, so it's not hyperSparc related.
 Of course, it could just be my udev acting up, as I get error messages
from udev such as:

Starting udev: udevd[88]: udev_event_run: fork of child failed: Invalid
argument
udevd[88]: udev_event_run: fork of child failed: Invalid argument
udevd[88]: udev_event_run: fork of child failed: Invalid argument
udevd[88]: udev_event_run: fork of child failed: Invalid argument

I'm not sure whether the invalid argument is a udev problem, userspace
incompatibility, kernel bug, or a kernel feature I left out.

Bob

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bob Breuer March 9, 2011, 6:16 a.m. UTC | #39
Marcel van Nies wrote:
> Hi,
> 
> git bisect came up with this:
> 
> 4d14a459857bd151ecbd14bcd37b4628da00792b is the first bad commit
> commit 4d14a459857bd151ecbd14bcd37b4628da00792b
> Author: David S. Miller <davem@davemloft.net>
> Date:   Thu Dec 10 23:32:10 2009 -0800
> 
>     sparc: Stop trying to be so fancy and use __builtin_{memcpy,memset}()
> 
>     This mirrors commit ff60fab71bb3b4fdbf8caf57ff3739ffd0887396
>     (x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy)
> 
>     Signed-off-by: David S. Miller <davem@davemloft.net>


My guess is that we're no longer using the special hyperSparc block copy
and fill from mm/hypersparc.S and are now leaving some data in the cache
that wasn't there before.

Unfortunately, my hyperSparc is failing from a completely different commit:
commit b6a2fea39318e43fee84fa7b0b90d68bed92d2ba
Author: Ollie Wild <aaw@google.com>
Date:   Thu Jul 19 01:48:16 2007 -0700

    mm: variable length argument support


The result I have is that the argv array for new commands looks
completely empty leading to this strange output when booting:

Freeing unused kernel memory: 144k freed
modprobe: FATAL: Module  not found.

INIT: version 2.86 booting
: : No such file or directory
INIT: Entering runlevel: 3
: : No such file or directory


There must be a missing cache flush somewhere in there that's needed for
the argv array...

Bob
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bob Breuer March 9, 2011, 6:37 a.m. UTC | #40
Marcel van Nies wrote:
> Hi,
> 
>> One large possibility is that there is a missing cache flush somewhere,
>> and reverting the memcpy/memset change masks it.
> 
> 2.6.33.7 with reverted commit is fine too, still leaving
> 2.6.34 - 2.6.38 for introducing weird behavior.
> 
> 
> 
> I've got 3 kinds of SPARC32 here, and the big difference is CPU.
> All other hardware in the boxes is "the same".
> The software (kernel et.al.) is pretty much the same too.
> Everything is ok, except for hyperSPARC.
> 
> So what makes the difference? This one :
> [    0.000000] Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek (jj@ultra.linux.cz).
>  Patching kernel for srmmu[ROSS HyperSparc]/iommu
> 
> Combine that with srmmu_fault as in
> init[1]: segfault at 0 ip 5000dac8 (rpc f000eea8) spefe738a0 error
> 30001 in ld-2.3.5.so[50000000+1a000]
> Kernel panic - not syncing: Attempted to kill init!
>  [f002ed74 : do_group_exit+0x84/0xb4 ]
>  [f0039a24 : get_signal_to_deliver+0x338/0x35c ]
>  [f0011fbc : do_signal+0x30/0x914 ]
>  [f00128b4 : do_notify_resume+0x14/0x38 ]
>  [f000fd50 : signal_p+0x14/0x24 ]
>  [f000eea8 : srmmu_fault+0x58/0x68 ]
> 
> I start thinking there is something wrong with Jakub's srmmu patch for
> hyperSPARC...

No, hyperSparc just accesses it's data cache in a peculiar way.  It is
1-way virtually indexed, so when you map the same physical page to 2
different virtual addresses, you can actually end up with 2 different
cache lines being used simultaneously for the same chunk of physical
memory.  This is known as cache-aliasing.  SuperSparc accesses it's
cache using the physical address and doesn't suffer from the same problem.

Bob

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 9, 2011, 8:17 p.m. UTC | #41
From: Bob Breuer <breuerr@mc.net>
Date: Wed, 09 Mar 2011 00:16:50 -0600

> My guess is that we're no longer using the special hyperSparc block copy
> and fill from mm/hypersparc.S and are now leaving some data in the cache
> that wasn't there before.

That is a possibility.

But let's be clear that this only applies to:

1) memcpy calls with constant "count" of PAGE_SIZE
2) memset calls with constant "c" of zero and "count" of PAGE_SIZE

Since those are the only cases where memset/memcpy gets translated
into calls to those optimized Hypersparc routines.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel van Nies March 11, 2011, 9:26 p.m. UTC | #42
Hi,

> Regarding the segfault - the easiest way forward would be to split the
> patch up in smaller chunks so we know which part causes the segfault to happen.
>
> I assume you had to hand-apply the revert. If you could post the exact patch
> you used for revert I will try to split it up in smaller logical parts.

I attached the patch which I used to revert commit
4d14a459857bd151ecbd14bcd37b4628da00792b

I did a split of this patch, and build kernels with only the memcpy or
only the memset part reverted.
They both segfault.

memset reverted
===============
[   11.129998] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
[   11.133332] Freeing unused kernel memory: 108k freed
[   11.196665] init[1]: segfault at 0 ip 5000dac8 (rpc f000eea4)
 sp eff4f8a0 error 30001 in ld-2.3.5.so[50000000+1a000]
[   12.023332] Kernel panic - not syncing: Attempted to kill init!
[   12.026665] [f002f494 : do_group_exit+0x84/0xb4 ]
 [f003a130 : get_signal_to_deliver+0x338/0x35c ]
 [f0012654 : do_signal+0x30/0x914 ]
 [f0012f4c : do_notify_resume+0x14/0x38 ]
 [f000fd4c : signal_p+0x14/0x24 ]
 [f000eea4 : srmmu_fault+0x58/0x68 ]
[   12.069998] Press Stop-A (L1-A) to return to the boot prom

memcpy reverted
===============
[   11.113332] VFS: Mounted root (ext3 filesystem) readonly on device 8:20.
[   11.119998] Freeing unused kernel memory: 108k freed
INIT: version 2.86 booting
[   12.453332] bash[23]: segfault at ffffffe8 ip 5015e81c (rpc 5015e80c)
 sp ef868ac8 error 30002 in libc-2.3.5.so[5009a000+11e000]
[   12.533332] rc[26]: segfault at 50189568 ip 50013ce0 (rpc 5000e034)
 sp efbb1558 error 30001 in ld-2.3.5.so[50000000+1a000]
[   13.156665] modprobe[43]: segfault at 24 ip 500aebdc (rpc 500aeb1c)
 sp ef8fd800 error 30001 in libc-2.3.5.so[5004e000+11e000]
modprobe: FATAL: Error inserting unix
(/lib/modules/2.6.38-rc2-up-rev-memcpy/kernel/net/unix/unix.ko):
Invalid module format
[   13.316665] modprobe[39]: segfault at 50 ip 500b7e28 (rpc 500b7e04)
 sp ef885e18 error 30001 in libc-2.3.5.so[5004e000+11e000]
modprobe: FATAL: Error inserting unix
(/lib/modules/2.6.38-rc2-up-rev-memcpy/kernel/net/unix/unix.ko):
Invalid module format
modprobe: *** glibc detected *** realloc(): invalid next size: 0x000262d0 ***
modprobe: FATAL: Error inserting unix
(/lib/modules/2.6.38-rc2-up-rev-memcpy/kernel/net/unix/unix.ko):
Invalid module format
modprobe: FATAL: Error inserting unix
(/lib/modules/2.6.38-rc2-up-rev-memcpy/kernel/net/unix/unix.ko):
Invalid module format
modprobe: FATAL: Error inserting unix
(/lib/modules/2.6.38-rc2-up-rev-memcpy/kernel/net/unix/unix.ko):
Invalid module format
modprobe: *** glibc detected *** realloc(): invalid pointer: 0x000262d0 ***
INIT: Entering runlevel: 3
[   14.169998] rc[44]: segfault at 3 ip 50013c2c (rpc 5000e034)
 sp eff09558 error 30001 in ld-2.3.5.so[50000000+1a000]

Marcel
Sam Ravnborg March 11, 2011, 10:40 p.m. UTC | #43
Hi Marcel.

On Fri, Mar 11, 2011 at 10:26:36PM +0100, Marcel van Nies wrote:
> Hi,
> 
> > Regarding the segfault - the easiest way forward would be to split the
> > patch up in smaller chunks so we know which part causes the segfault to happen.
> >
> > I assume you had to hand-apply the revert. If you could post the exact patch
> > you used for revert I will try to split it up in smaller logical parts.
> 
> I attached the patch which I used to revert commit
> 4d14a459857bd151ecbd14bcd37b4628da00792b
> 
> I did a split of this patch, and build kernels with only the memcpy or
> only the memset part reverted.

Thanks for all your effort!
I will during the weekend try to think how we can nail this,
but I'm a bit lost here as we are looking into areas I know little about.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Hellstrom March 16, 2011, 3:53 p.m. UTC | #44
David Miller wrote:

>From: Sam Ravnborg <sam@ravnborg.org>
>Date: Tue, 22 Feb 2011 19:22:19 +0100
>
>  
>
>>I will prepare a v4 soon.
>>    
>>
>
>The first 4 patches are in the tree, so you only need to resubmit
>this patch rather than the whole bunch.
>
>I really look forward to applying v4, thanks Sam!
>  
>

I think it is very good as well, it will save us a lot of problems in 
the future! However LEON needs VIRQ to map 1:1 to real IRQs. I figured 
that it does not hurt the SUNs if we map 1:1 as long as it is possible. 
The reason is that LEON drivers must have the possibility to do 
request_irq on IRQ and IRQ+1 and IRQ+2 and so on. Due to how the 
Plug&Play information is designed we can only know the first IRQ of a 
device, a device may have 2 IRQs (always IRQ and IRQ+1 in that case). 
And since VIRQ->REAL_IRQ but not VIRQ+1->REAL_IRQ+1 this will break.

Please see my patches sent to the list (not the APBUART patches), 
perhaps Sam can include the single patch into the PATCH5? The other 
patches for the exteneded IRQ controller and irq_shutdown must be 
applied afterwards.

Thanks,
Daniel

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller March 30, 2011, 9:22 a.m. UTC | #45
From: Daniel Hellstrom <daniel@gaisler.com>
Date: Wed, 16 Mar 2011 16:53:18 +0100

> I think it is very good as well, it will save us a lot of problems in
> the future! However LEON needs VIRQ to map 1:1 to real IRQs. I figured
> that it does not hurt the SUNs if we map 1:1 as long as it is
> possible. The reason is that LEON drivers must have the possibility to
> do request_irq on IRQ and IRQ+1 and IRQ+2 and so on. Due to how the
> Plug&Play information is designed we can only know the first IRQ of a
> device, a device may have 2 IRQs (always IRQ and IRQ+1 in that
> case). And since VIRQ->REAL_IRQ but not VIRQ+1->REAL_IRQ+1 this will
> break.
> 
> Please see my patches sent to the list (not the APBUART patches),
> perhaps Sam can include the single patch into the PATCH5? The other
> patches for the exteneded IRQ controller and irq_shutdown must be
> applied afterwards.

I disagree with the validity of your conclusion.

The physical interrupts can be anything.

What you need to do on LEON is convert this linear sequence of
physical IRQs to a set of virtual IRQs and make the drivers receive
this information.

The method by which the IRQs are communicated to the kernel is
absolutely arbitrary, and has no bearing on how this stuff must
or must not work.

Therefore, there is absolutely no 1:1 requirement, and I am strongly
against supporting such a mapping.  It makes the whole VIRQ exercise
pointless.

Make the drivers LEON drivers and able to receive a set of IRQs from
the kernel, instead of depending upon linearity.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Hellstrom March 30, 2011, 10:10 a.m. UTC | #46
David Miller wrote:

>From: Daniel Hellstrom <daniel@gaisler.com>
>Date: Wed, 16 Mar 2011 16:53:18 +0100
>
>  
>
>>I think it is very good as well, it will save us a lot of problems in
>>the future! However LEON needs VIRQ to map 1:1 to real IRQs. I figured
>>that it does not hurt the SUNs if we map 1:1 as long as it is
>>possible. The reason is that LEON drivers must have the possibility to
>>do request_irq on IRQ and IRQ+1 and IRQ+2 and so on. Due to how the
>>Plug&Play information is designed we can only know the first IRQ of a
>>device, a device may have 2 IRQs (always IRQ and IRQ+1 in that
>>case). And since VIRQ->REAL_IRQ but not VIRQ+1->REAL_IRQ+1 this will
>>break.
>>
>>Please see my patches sent to the list (not the APBUART patches),
>>perhaps Sam can include the single patch into the PATCH5? The other
>>patches for the exteneded IRQ controller and irq_shutdown must be
>>applied afterwards.
>>    
>>
>
>I disagree with the validity of your conclusion.
>
>The physical interrupts can be anything.
>
>What you need to do on LEON is convert this linear sequence of
>physical IRQs to a set of virtual IRQs and make the drivers receive
>this information.
>
>The method by which the IRQs are communicated to the kernel is
>absolutely arbitrary, and has no bearing on how this stuff must
>or must not work.
>
>Therefore, there is absolutely no 1:1 requirement, and I am strongly
>against supporting such a mapping.  It makes the whole VIRQ exercise
>pointless.
>  
>
I agree, but the problem is that due to hardware limitation the LEON IRQ 
layers or bootloader can not know this. Please see my reply to "[PATCH 
1/2 v2] sparc32,leon: APBUART driver must use ..."

>Make the drivers LEON drivers and able to receive a set of IRQs from
>the kernel, instead of depending upon linearity.
>
>  
>
That is no problem, I can have that done by today. The problem is the 
bootloader or the IRQ layer of sparc32-leon.

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e48f471..8a44dfa 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -25,6 +25,9 @@  config SPARC
 	select HAVE_DMA_ATTRS
 	select HAVE_DMA_API_DEBUG
 	select HAVE_ARCH_JUMP_LABEL
+	select HAVE_GENERIC_HARDIRQS
+	select GENERIC_HARDIRQS_NO_DEPRECATED
+
 
 config SPARC32
 	def_bool !64BIT
@@ -50,8 +53,6 @@  config SPARC64
 	select RTC_DRV_STARFIRE
 	select HAVE_PERF_EVENTS
 	select PERF_USE_VMALLOC
-	select HAVE_GENERIC_HARDIRQS
-	select GENERIC_HARDIRQS_NO_DEPRECATED
 
 config ARCH_DEFCONFIG
 	string
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h
index 86666f7..77bb638 100644
--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -281,28 +281,27 @@  static inline void sun_fd_enable_dma(void)
 	pdma_areasize = pdma_size;
 }
 
-/* Our low-level entry point in arch/sparc/kernel/entry.S */
-extern int sparc_floppy_request_irq(int irq, unsigned long flags,
-				    irq_handler_t irq_handler);
+extern int sparc_floppy_request_irq(unsigned int irq,
+                                    irq_handler_t irq_handler);
 
 static int sun_fd_request_irq(void)
 {
 	static int once = 0;
-	int error;
 
-	if(!once) {
+	if (!once) {
 		once = 1;
-		error = sparc_floppy_request_irq(FLOPPY_IRQ,
-						 IRQF_DISABLED,
-						 floppy_interrupt);
-		return ((error == 0) ? 0 : -1);
-	} else return 0;
+		return sparc_floppy_request_irq(FLOPPY_IRQ, floppy_interrupt);
+	} else {
+		return 0;
+	}
 }
 
 static struct linux_prom_registers fd_regs[2];
 
 static int sun_floppy_init(void)
 {
+	struct platform_device *op;
+	struct device_node *dp;
 	char state[128];
 	phandle tnode, fd_node;
 	int num_regs;
@@ -310,7 +309,6 @@  static int sun_floppy_init(void)
 
 	use_virtual_dma = 1;
 
-	FLOPPY_IRQ = 11;
 	/* Forget it if we aren't on a machine that could possibly
 	 * ever have a floppy drive.
 	 */
@@ -349,6 +347,27 @@  static int sun_floppy_init(void)
 	sun_fdc = (struct sun_flpy_controller *)
 	    of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
 
+	/*
+	 * Look up irq in platform_device.
+	 * We try "SUNW,fdtwo" and "fd"
+	 */
+	for_each_node_by_name(dp, "SUNW,fdtwo") {
+		op = of_find_device_by_node(dp);
+		if (op)
+			break;
+	}
+	if (!op) {
+		for_each_node_by_name(dp, "fd") {
+			op = of_find_device_by_node(dp);
+			if (op)
+				break;
+		}
+	}
+	if (!op)
+		goto no_sun_fdc;
+
+	FLOPPY_IRQ = op->archdata.irqs[0];
+
 	/* Last minute sanity check... */
 	if(sun_fdc->status_82072 == 0xff) {
 		sun_fdc = NULL;
diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h
index cbf4801..1618889 100644
--- a/arch/sparc/include/asm/irq_32.h
+++ b/arch/sparc/include/asm/irq_32.h
@@ -6,11 +6,17 @@ 
 #ifndef _SPARC_IRQ_H
 #define _SPARC_IRQ_H
 
-#define NR_IRQS    16
+/*
+ * Allocated number of logical irq numbers.
+ * sun4d boxes (ss2000e) should be OK with ~32.
+ * Be on the safe side and make room for 64
+ */
+#define NR_IRQS    64
 
 #include <linux/interrupt.h>
 
 #define irq_canonicalize(irq)	(irq)
 
 extern void __init init_IRQ(void);
+
 #endif
diff --git a/arch/sparc/include/asm/system_32.h b/arch/sparc/include/asm/system_32.h
index 890036b..47a7e86 100644
--- a/arch/sparc/include/asm/system_32.h
+++ b/arch/sparc/include/asm/system_32.h
@@ -15,11 +15,6 @@ 
 
 #include <linux/irqflags.h>
 
-static inline unsigned int probe_irq_mask(unsigned long val)
-{
-	return 0;
-}
-
 /*
  * Sparc (general) CPU types
  */
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 99aa4db..9cff270 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -71,10 +71,6 @@  obj-$(CONFIG_SPARC64)	+= pcr.o
 obj-$(CONFIG_SPARC64)	+= nmi.o
 obj-$(CONFIG_SPARC64_SMP) += cpumap.o
 
-# sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation
-obj-$(CONFIG_SPARC32)     += devres.o
-devres-y                  := ../../../kernel/irq/devres.o
-
 obj-y                     += dma.o
 
 obj-$(CONFIG_SPARC32_PCI) += pcic.o
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h
index 008453b..a43fc46 100644
--- a/arch/sparc/kernel/irq.h
+++ b/arch/sparc/kernel/irq.h
@@ -2,6 +2,23 @@ 
 
 #include <asm/btfixup.h>
 
+struct irq_bucket {
+        struct irq_bucket *next;
+        unsigned int real_irq;
+        unsigned int irq;
+        unsigned int pil;
+};
+
+#define SUN4D_MAX_BOARD 10
+#define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5)
+/*
+ * Map between the irq identifier used in hw to the
+ * irq_bucket. The map is sufficient large to hold
+ * the sun4d hw identifiers.
+ */
+extern struct irq_bucket *irq_map[SUN4D_MAX_IRQ];
+
+
 /* sun4m specific type definitions */
 
 /* This maps direct to CPU specific interrupt registers */
@@ -35,6 +52,9 @@  struct sparc_irq_config {
 };
 extern struct sparc_irq_config sparc_irq_config;
 
+unsigned int irq_alloc(unsigned int real_irq, unsigned int pil);
+void irq_link(unsigned int irq);
+void handler_irq(unsigned int pil, struct pt_regs *regs);
 
 /* Dave Redman (djhr@tadpole.co.uk)
  * changed these to function pointers.. it saves cycles and will allow
@@ -44,33 +64,9 @@  extern struct sparc_irq_config sparc_irq_config;
  * Changed these to btfixup entities... It saves cycles :)
  */
 
-BTFIXUPDEF_CALL(void, disable_irq, unsigned int)
-BTFIXUPDEF_CALL(void, enable_irq, unsigned int)
-BTFIXUPDEF_CALL(void, disable_pil_irq, unsigned int)
-BTFIXUPDEF_CALL(void, enable_pil_irq, unsigned int)
 BTFIXUPDEF_CALL(void, clear_clock_irq, void)
 BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
 
-static inline void __disable_irq(unsigned int irq)
-{
-	BTFIXUP_CALL(disable_irq)(irq);
-}
-
-static inline void __enable_irq(unsigned int irq)
-{
-	BTFIXUP_CALL(enable_irq)(irq);
-}
-
-static inline void disable_pil_irq(unsigned int irq)
-{
-	BTFIXUP_CALL(disable_pil_irq)(irq);
-}
-
-static inline void enable_pil_irq(unsigned int irq)
-{
-	BTFIXUP_CALL(enable_pil_irq)(irq);
-}
-
 static inline void clear_clock_irq(void)
 {
 	BTFIXUP_CALL(clear_clock_irq)();
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index 7c93df4..9ce6b97 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -15,6 +15,7 @@ 
 #include <linux/seq_file.h>
 
 #include <asm/cacheflush.h>
+#include <asm/cpudata.h>
 #include <asm/pcic.h>
 #include <asm/leon.h>
 
@@ -101,284 +102,163 @@  EXPORT_SYMBOL(arch_local_irq_restore);
  * directed CPU interrupts using the existing enable/disable irq code
  * with tweaks.
  *
+ * Sun4d complicates things even further.  IRQ numbers are arbitrary
+ * 32-bit values in that case.  Since this is similar to sparc64,
+ * we adopt a virtual IRQ numbering scheme as is done there.
+ * Virutal interrupt numbers are allocated by build_irq().  So NR_IRQS
+ * just becomes a limit of how many interrupt sources we can handle in
+ * a single system.  Even fully loaded SS2000 machines top off at
+ * about 32 interrupt sources or so, therefore a NR_IRQS value of 64
+ * is more than enough.
+  *
+ * We keep a map of per-PIL enable interrupts.  These get wired
+ * up via the irq_chip->startup() method which gets invoked by
+ * the generic IRQ layer during request_irq().
  */
 
 
+/* Table of allocated irqs. Unused entries has irq == 0 */
+static struct irq_bucket irq_table[NR_IRQS];
+
+/* Map between the irq identifier used in hw to theirq_bucket. */
+struct irq_bucket *irq_map[SUN4D_MAX_IRQ];
 
 /*
- * Dave Redman (djhr@tadpole.co.uk)
- *
- * There used to be extern calls and hard coded values here.. very sucky!
- * instead, because some of the devices attach very early, I do something
- * equally sucky but at least we'll never try to free statically allocated
- * space or call kmalloc before kmalloc_init :(.
- *
- * In fact it's the timer10 that attaches first.. then timer14
- * then kmalloc_init is called.. then the tty interrupts attach.
- * hmmm....
- *
+ * Allocate a new irq from the irq_table
  */
-#define MAX_STATIC_ALLOC	4
-struct irqaction static_irqaction[MAX_STATIC_ALLOC];
-int static_irq_count;
-
-static struct {
-	struct irqaction *action;
-	int flags;
-} sparc_irq[NR_IRQS];
-#define SPARC_IRQ_INPROGRESS 1
-
-/* Used to protect the IRQ action lists */
-DEFINE_SPINLOCK(irq_action_lock);
-
-int show_interrupts(struct seq_file *p, void *v)
+unsigned int irq_alloc(unsigned int real_irq, unsigned int pil)
 {
-	int i = *(loff_t *)v;
-	struct irqaction *action;
-	unsigned long flags;
-#ifdef CONFIG_SMP
-	int j;
-#endif
-
-	if (sparc_cpu_model == sun4d)
-		return show_sun4d_interrupts(p, v);
+	unsigned int i;
 
-	spin_lock_irqsave(&irq_action_lock, flags);
-	if (i < NR_IRQS) {
-		action = sparc_irq[i].action;
-		if (!action)
-			goto out_unlock;
-		seq_printf(p, "%3d: ", i);
-#ifndef CONFIG_SMP
-		seq_printf(p, "%10u ", kstat_irqs(i));
-#else
-		for_each_online_cpu(j) {
-			seq_printf(p, "%10u ",
-				    kstat_cpu(j).irqs[i]);
-		}
-#endif
-		seq_printf(p, " %c %s",
-			(action->flags & IRQF_DISABLED) ? '+' : ' ',
-			action->name);
-		for (action = action->next; action; action = action->next) {
-			seq_printf(p, ",%s %s",
-				(action->flags & IRQF_DISABLED) ? " +" : "",
-				action->name);
-		}
-		seq_putc(p, '\n');
+	for (i = 1; i < NR_IRQS; i++) {
+		if (irq_table[i].real_irq == real_irq && irq_table[i].pil == pil)
+			return i;
 	}
-out_unlock:
-	spin_unlock_irqrestore(&irq_action_lock, flags);
-	return 0;
-}
-
-void free_irq(unsigned int irq, void *dev_id)
-{
-	struct irqaction *action;
-	struct irqaction **actionp;
-	unsigned long flags;
-	unsigned int cpu_irq;
 
-	if (sparc_cpu_model == sun4d) {
-		sun4d_free_irq(irq, dev_id);
-		return;
-	}
-	cpu_irq = irq & (NR_IRQS - 1);
-	if (cpu_irq > 14) {  /* 14 irq levels on the sparc */
-		printk(KERN_ERR "Trying to free bogus IRQ %d\n", irq);
-		return;
+	for (i = 1; i < NR_IRQS; i++) {
+		if (!irq_table[i].irq)
+			break;
 	}
 
-	spin_lock_irqsave(&irq_action_lock, flags);
-
-	actionp = &sparc_irq[cpu_irq].action;
-	action = *actionp;
-
-	if (!action->handler) {
-		printk(KERN_ERR "Trying to free free IRQ%d\n", irq);
-		goto out_unlock;
-	}
-	if (dev_id) {
-		for (; action; action = action->next) {
-			if (action->dev_id == dev_id)
-				break;
-			actionp = &action->next;
-		}
-		if (!action) {
-			printk(KERN_ERR "Trying to free free shared IRQ%d\n",
-			       irq);
-			goto out_unlock;
-		}
-	} else if (action->flags & IRQF_SHARED) {
-		printk(KERN_ERR "Trying to free shared IRQ%d with NULL device ID\n",
-		       irq);
-		goto out_unlock;
-	}
-	if (action->flags & SA_STATIC_ALLOC) {
-		/*
-		 * This interrupt is marked as specially allocated
-		 * so it is a bad idea to free it.
-		 */
-		printk(KERN_ERR "Attempt to free statically allocated IRQ%d (%s)\n",
-		       irq, action->name);
-		goto out_unlock;
+	if (i >= NR_IRQS) {
+		printk(KERN_ERR "IRQ: Out of virtual IRQs.\n");
+		return 0;
 	}
+	irq_table[i].real_irq = real_irq;
+	irq_table[i].irq = i;
+	irq_table[i].pil = pil;
 
-	*actionp = action->next;
-
-	spin_unlock_irqrestore(&irq_action_lock, flags);
-
-	synchronize_irq(irq);
-
-	spin_lock_irqsave(&irq_action_lock, flags);
-
-	kfree(action);
-
-	if (!sparc_irq[cpu_irq].action)
-		__disable_irq(irq);
-
-out_unlock:
-	spin_unlock_irqrestore(&irq_action_lock, flags);
+	return i;
 }
-EXPORT_SYMBOL(free_irq);
 
 /*
- * This is called when we want to synchronize with
- * interrupts. We may for example tell a device to
- * stop sending interrupts: but to make sure there
- * are no interrupts that are executing on another
- * CPU we need to call this function.
+ * Based on a single pil handler_irq may need to call several
+ * interrupt handlers. Use irq_map as entry to irq_table,
+ * and let each entry in irq_table point to the next entry.
  */
-#ifdef CONFIG_SMP
-void synchronize_irq(unsigned int irq)
+void irq_link(unsigned int irq)
 {
-	unsigned int cpu_irq;
+	struct irq_bucket *p;
+	unsigned int pil;
 
-	cpu_irq = irq & (NR_IRQS - 1);
-	while (sparc_irq[cpu_irq].flags & SPARC_IRQ_INPROGRESS)
-		cpu_relax();
+	BUG_ON(irq >= NR_IRQS);
+
+	p = &irq_table[irq];
+	pil = p->pil;
+	BUG_ON(pil > SUN4D_MAX_IRQ);
+	p->next = irq_map[pil];
+	irq_map[pil] = p;
 }
-EXPORT_SYMBOL(synchronize_irq);
-#endif /* SMP */
 
-void unexpected_irq(int irq, void *dev_id, struct pt_regs *regs)
+int show_interrupts(struct seq_file *p, void *v)
 {
-	int i;
+	int i = *(loff_t *) v, j;
 	struct irqaction *action;
-	unsigned int cpu_irq;
+	unsigned long flags;
 
-	cpu_irq = irq & (NR_IRQS - 1);
-	action = sparc_irq[cpu_irq].action;
-
-	printk(KERN_ERR "IO device interrupt, irq = %d\n", irq);
-	printk(KERN_ERR "PC = %08lx NPC = %08lx FP=%08lx\n", regs->pc,
-		    regs->npc, regs->u_regs[14]);
-	if (action) {
-		printk(KERN_ERR "Expecting: ");
-		for (i = 0; i < 16; i++)
-			if (action->handler)
-				printk(KERN_CONT "[%s:%d:0x%x] ", action->name,
-				       i, (unsigned int)action->handler);
+	if (i == 0) {
+		seq_printf(p, "           ");
+		for_each_online_cpu(j)
+			seq_printf(p, "CPU%d       ",j);
+		seq_putc(p, '\n');
 	}
-	printk(KERN_ERR "AIEEE\n");
-	panic("bogus interrupt received");
+
+	if (i < NR_IRQS) {
+		raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
+		action = irq_desc[i].action;
+		if (!action)
+			goto skip;
+		seq_printf(p, "%3d: ",i);
+#ifndef CONFIG_SMP
+		seq_printf(p, "%10u ", kstat_irqs(i));
+#else
+		for_each_online_cpu(j)
+			seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
+#endif
+		seq_printf(p, " %9s", irq_desc[i].irq_data.chip->name);
+		seq_printf(p, "  %s", action->name);
+
+		for (action=action->next; action; action = action->next)
+			seq_printf(p, ", %s", action->name);
+
+		seq_putc(p, '\n');
+skip:
+		raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
+	} else if (i == NR_IRQS) {
+		seq_printf(p, "NMI: ");
+		for_each_online_cpu(j)
+			seq_printf(p, "%10u ", cpu_data(j).counter);
+		seq_printf(p, "     Non-maskable interrupts\n");
+	}
+	return 0;
 }
 
-void handler_irq(int pil, struct pt_regs *regs)
+void handler_irq(unsigned int pil, struct pt_regs *regs)
 {
 	struct pt_regs *old_regs;
-	struct irqaction *action;
-	int cpu = smp_processor_id();
+	struct irq_bucket *p;
 
+	BUG_ON(pil > 15);
 	old_regs = set_irq_regs(regs);
 	irq_enter();
-	disable_pil_irq(pil);
-#ifdef CONFIG_SMP
-	/* Only rotate on lower priority IRQs (scsi, ethernet, etc.). */
-	if ((sparc_cpu_model==sun4m) && (pil < 10))
-		smp4m_irq_rotate(cpu);
-#endif
-	action = sparc_irq[pil].action;
-	sparc_irq[pil].flags |= SPARC_IRQ_INPROGRESS;
-	kstat_cpu(cpu).irqs[pil]++;
-	do {
-		if (!action || !action->handler)
-			unexpected_irq(pil, NULL, regs);
-		action->handler(pil, action->dev_id);
-		action = action->next;
-	} while (action);
-	sparc_irq[pil].flags &= ~SPARC_IRQ_INPROGRESS;
-	enable_pil_irq(pil);
+
+	p = irq_map[pil];
+	while (p) {
+		struct irq_bucket *next = p->next;
+
+		generic_handle_irq(p->irq);
+		p = next;
+	}
 	irq_exit();
 	set_irq_regs(old_regs);
 }
 
 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
+static unsigned int floppy_irq;
 
-/*
- * Fast IRQs on the Sparc can only have one routine attached to them,
- * thus no sharing possible.
- */
-static int request_fast_irq(unsigned int irq,
-			    void (*handler)(void),
-			    unsigned long irqflags, const char *devname)
+int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler)
 {
-	struct irqaction *action;
-	unsigned long flags;
 	unsigned int cpu_irq;
-	int ret;
+	int err;
+
 #if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON
 	struct tt_entry *trap_table;
 #endif
-	cpu_irq = irq & (NR_IRQS - 1);
-	if (cpu_irq > 14) {
-		ret = -EINVAL;
-		goto out;
-	}
-	if (!handler) {
-		ret = -EINVAL;
-		goto out;
-	}
-
-	spin_lock_irqsave(&irq_action_lock, flags);
 
-	action = sparc_irq[cpu_irq].action;
-	if (action) {
-		if (action->flags & IRQF_SHARED)
-			panic("Trying to register fast irq when already shared.\n");
-		if (irqflags & IRQF_SHARED)
-			panic("Trying to register fast irq as shared.\n");
+	err = request_irq(irq, irq_handler, 0, "floppy", NULL);
+	if (err)
+		return -1;
 
-		/* Anyway, someone already owns it so cannot be made fast. */
-		printk(KERN_ERR "request_fast_irq: Trying to register yet already owned.\n");
-		ret = -EBUSY;
-		goto out_unlock;
-	}
+	/* Save for later use in floppy interrupt handler */
+	floppy_irq = irq;
 
-	/*
-	 * If this is flagged as statically allocated then we use our
-	 * private struct which is never freed.
-	 */
-	if (irqflags & SA_STATIC_ALLOC) {
-		if (static_irq_count < MAX_STATIC_ALLOC)
-			action = &static_irqaction[static_irq_count++];
-		else
-			printk(KERN_ERR "Fast IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n",
-			       irq, devname);
-	}
-
-	if (action == NULL)
-		action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
-	if (!action) {
-		ret = -ENOMEM;
-		goto out_unlock;
-	}
+	cpu_irq = (irq & (NR_IRQS - 1));
 
 	/* Dork with trap table if we get this far. */
 #define INSTANTIATE(table) \
 	table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_one = SPARC_RD_PSR_L0; \
 	table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two = \
-		SPARC_BRANCH((unsigned long) handler, \
+		SPARC_BRANCH((unsigned long) floppy_hardint, \
 			     (unsigned long) &table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_two);\
 	table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_three = SPARC_RD_WIM_L3; \
 	table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP;
@@ -399,22 +279,9 @@  static int request_fast_irq(unsigned int irq,
 	 * writing we have no CPU-neutral interface to fine-grained flushes.
 	 */
 	flush_cache_all();
-
-	action->flags = irqflags;
-	action->name = devname;
-	action->dev_id = NULL;
-	action->next = NULL;
-
-	sparc_irq[cpu_irq].action = action;
-
-	__enable_irq(irq);
-
-	ret = 0;
-out_unlock:
-	spin_unlock_irqrestore(&irq_action_lock, flags);
-out:
-	return ret;
+	return 0;
 }
+EXPORT_SYMBOL(sparc_floppy_request_irq);
 
 /*
  * These variables are used to access state from the assembler
@@ -440,154 +307,24 @@  EXPORT_SYMBOL(pdma_base);
 unsigned long pdma_areasize;
 EXPORT_SYMBOL(pdma_areasize);
 
-static irq_handler_t floppy_irq_handler;
-
+/*
+ * Use the generic irq support to call floppy_interrupt
+ * which was setup using request_irq() in sparc_floppy_request_irq().
+ * We only have one floppy interrupt so we do not need to check
+ * for additional handlers being wired up by irq_link()
+ */
 void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct pt_regs *old_regs;
-	int cpu = smp_processor_id();
 
 	old_regs = set_irq_regs(regs);
-	disable_pil_irq(irq);
 	irq_enter();
-	kstat_cpu(cpu).irqs[irq]++;
-	floppy_irq_handler(irq, dev_id);
+	generic_handle_irq(floppy_irq);
 	irq_exit();
-	enable_pil_irq(irq);
 	set_irq_regs(old_regs);
-	/*
-	 * XXX Eek, it's totally changed with preempt_count() and such
-	 * if (softirq_pending(cpu))
-	 *	do_softirq();
-	 */
 }
-
-int sparc_floppy_request_irq(int irq, unsigned long flags,
-			     irq_handler_t irq_handler)
-{
-	floppy_irq_handler = irq_handler;
-	return request_fast_irq(irq, floppy_hardint, flags, "floppy");
-}
-EXPORT_SYMBOL(sparc_floppy_request_irq);
-
 #endif
 
-int request_irq(unsigned int irq,
-		irq_handler_t handler,
-		unsigned long irqflags, const char *devname, void *dev_id)
-{
-	struct irqaction *action, **actionp;
-	unsigned long flags;
-	unsigned int cpu_irq;
-	int ret;
-
-	if (sparc_cpu_model == sun4d)
-		return sun4d_request_irq(irq, handler, irqflags, devname, dev_id);
-
-	cpu_irq = irq & (NR_IRQS - 1);
-	if (cpu_irq > 14) {
-		ret = -EINVAL;
-		goto out;
-	}
-	if (!handler) {
-		ret = -EINVAL;
-		goto out;
-	}
-
-	spin_lock_irqsave(&irq_action_lock, flags);
-
-	actionp = &sparc_irq[cpu_irq].action;
-	action = *actionp;
-	if (action) {
-		if (!(action->flags & IRQF_SHARED) || !(irqflags & IRQF_SHARED)) {
-			ret = -EBUSY;
-			goto out_unlock;
-		}
-		if ((action->flags & IRQF_DISABLED) != (irqflags & IRQF_DISABLED)) {
-			printk(KERN_ERR "Attempt to mix fast and slow interrupts on IRQ%d denied\n",
-			       irq);
-			ret = -EBUSY;
-			goto out_unlock;
-		}
-		for ( ; action; action = *actionp)
-			actionp = &action->next;
-	}
-
-	/* If this is flagged as statically allocated then we use our
-	 * private struct which is never freed.
-	 */
-	if (irqflags & SA_STATIC_ALLOC) {
-		if (static_irq_count < MAX_STATIC_ALLOC)
-			action = &static_irqaction[static_irq_count++];
-		else
-			printk(KERN_ERR "Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n",
-			       irq, devname);
-	}
-	if (action == NULL)
-		action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
-	if (!action) {
-		ret = -ENOMEM;
-		goto out_unlock;
-	}
-
-	action->handler = handler;
-	action->flags = irqflags;
-	action->name = devname;
-	action->next = NULL;
-	action->dev_id = dev_id;
-
-	*actionp = action;
-
-	__enable_irq(irq);
-
-	ret = 0;
-out_unlock:
-	spin_unlock_irqrestore(&irq_action_lock, flags);
-out:
-	return ret;
-}
-EXPORT_SYMBOL(request_irq);
-
-void disable_irq_nosync(unsigned int irq)
-{
-	__disable_irq(irq);
-}
-EXPORT_SYMBOL(disable_irq_nosync);
-
-void disable_irq(unsigned int irq)
-{
-	__disable_irq(irq);
-}
-EXPORT_SYMBOL(disable_irq);
-
-void enable_irq(unsigned int irq)
-{
-	__enable_irq(irq);
-}
-EXPORT_SYMBOL(enable_irq);
-
-/*
- * We really don't need these at all on the Sparc.  We only have
- * stubs here because they are exported to modules.
- */
-unsigned long probe_irq_on(void)
-{
-	return 0;
-}
-EXPORT_SYMBOL(probe_irq_on);
-
-int probe_irq_off(unsigned long mask)
-{
-	return 0;
-}
-EXPORT_SYMBOL(probe_irq_off);
-
-static unsigned int build_device_irq(struct platform_device *op,
-                                     unsigned int real_irq)
-{
-	return real_irq;
-}
-
 /* djhr
  * This could probably be made indirect too and assigned in the CPU
  * bits of the code. That would be much nicer I think and would also
@@ -598,8 +335,6 @@  static unsigned int build_device_irq(struct platform_device *op,
 
 void __init init_IRQ(void)
 {
-	sparc_irq_config.build_device_irq = build_device_irq;
-
 	switch (sparc_cpu_model) {
 	case sun4c:
 	case sun4:
@@ -632,9 +367,3 @@  void __init init_IRQ(void)
 	btfixup();
 }
 
-#ifdef CONFIG_PROC_FS
-void init_irq_proc(void)
-{
-	/* For now, nothing... */
-}
-#endif /* CONFIG_PROC_FS */
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index 24ad449..487d67a 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -37,6 +37,7 @@  extern void sun4c_init_IRQ(void);
 extern unsigned int lvl14_resolution;
 
 extern void sun4m_init_IRQ(void);
+extern void sun4m_unmask_profile_irq(void);
 extern void sun4m_clear_profile_irq(int cpu);
 
 /* sun4d_irq.c */
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index 2969f77..feaba14 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -83,20 +83,22 @@  static inline unsigned long get_irqmask(unsigned int irq)
 	return mask;
 }
 
-static void leon_enable_irq(unsigned int irq_nr)
+static void leon_unmask_irq(struct irq_data *data)
 {
 	unsigned long mask, flags;
-	mask = get_irqmask(irq_nr);
+
+	mask = (unsigned long)data->chip_data;
 	local_irq_save(flags);
 	LEON3_BYPASS_STORE_PA(LEON_IMASK,
 			      (LEON3_BYPASS_LOAD_PA(LEON_IMASK) | (mask)));
 	local_irq_restore(flags);
 }
 
-static void leon_disable_irq(unsigned int irq_nr)
+static void leon_mask_irq(struct irq_data *data)
 {
 	unsigned long mask, flags;
-	mask = get_irqmask(irq_nr);
+
+	mask = (unsigned long)data->chip_data;
 	local_irq_save(flags);
 	LEON3_BYPASS_STORE_PA(LEON_IMASK,
 			      (LEON3_BYPASS_LOAD_PA(LEON_IMASK) & ~(mask)));
@@ -104,6 +106,42 @@  static void leon_disable_irq(unsigned int irq_nr)
 
 }
 
+static unsigned int leon_startup_irq(struct irq_data *data)
+{
+	irq_link(data->irq);
+	leon_unmask_irq(data);
+	return 0;
+}
+
+static struct irq_chip leon_irq = {
+	.name		= "leon",
+	.irq_startup	= leon_startup_irq,
+	.irq_mask	= leon_mask_irq,
+	.irq_unmask	= leon_unmask_irq,
+};
+
+static unsigned int leon_build_device_irq(struct platform_device *op,
+                                          unsigned int real_irq)
+{
+	unsigned int irq;
+	unsigned long mask;
+
+	irq = 0;
+	mask = get_irqmask(real_irq);
+	if (mask == 0)
+		goto out;
+
+	irq = irq_alloc(real_irq, real_irq);
+	if (irq == 0)
+		goto out;
+
+	set_irq_chip_and_handler_name(irq, &leon_irq,
+	                              handle_level_irq, "LEON");
+	set_irq_chip_data(irq, (void *)mask);
+
+out:
+	return irq;
+}
 void __init leon_init_timers(irq_handler_t counter_fn)
 {
 	int irq;
@@ -112,6 +150,7 @@  void __init leon_init_timers(irq_handler_t counter_fn)
 	int len;
 	int cpu, icsel;
 	int ampopts;
+	int err;
 
 	leondebug_irq_disable = 0;
 	leon_debug_irqout = 0;
@@ -219,11 +258,10 @@  void __init leon_init_timers(irq_handler_t counter_fn)
 		goto bad;
 	}
 
-	irq = request_irq(leon3_gptimer_irq+leon3_gptimer_idx,
-			  counter_fn,
-			  (IRQF_DISABLED | SA_STATIC_ALLOC), "timer", NULL);
+	irq = leon_build_device_irq(NULL, leon3_gptimer_irq + leon3_gptimer_idx);
+	err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL);
 
-	if (irq) {
+	if (err) {
 		printk(KERN_ERR "leon_time_init: unable to attach IRQ%d\n",
 		       LEON_INTERRUPT_TIMER1);
 		prom_halt();
@@ -347,12 +385,8 @@  void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu)
 
 void __init leon_init_IRQ(void)
 {
-	sparc_irq_config.init_timers = leon_init_timers;
-
-	BTFIXUPSET_CALL(enable_irq, leon_enable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_irq, leon_disable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(enable_pil_irq, leon_enable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_pil_irq, leon_disable_irq, BTFIXUPCALL_NORM);
+	sparc_irq_config.init_timers      = leon_init_timers;
+	sparc_irq_config.build_device_irq = leon_build_device_irq;
 
 	BTFIXUPSET_CALL(clear_clock_irq, leon_clear_clock_irq,
 			BTFIXUPCALL_NORM);
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index aeaa09a..a762341 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -164,6 +164,9 @@  void __iomem *pcic_regs;
 volatile int pcic_speculative;
 volatile int pcic_trapped;
 
+/* forward */
+unsigned int pcic_build_device_irq(struct platform_device *op,
+                                   unsigned int real_irq);
 
 #define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (((unsigned int)bus) << 16) | (((unsigned int)device_fn) << 8) | (where & ~3))
 
@@ -523,6 +526,7 @@  static void
 pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
 {
 	struct pcic_ca2irq *p;
+	unsigned int real_irq;
 	int i, ivec;
 	char namebuf[64];
 
@@ -551,26 +555,26 @@  pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
 	i = p->pin;
 	if (i >= 0 && i < 4) {
 		ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_LO);
-		dev->irq = ivec >> (i << 2) & 0xF;
+		real_irq = ivec >> (i << 2) & 0xF;
 	} else if (i >= 4 && i < 8) {
 		ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI);
-		dev->irq = ivec >> ((i-4) << 2) & 0xF;
+		real_irq = ivec >> ((i-4) << 2) & 0xF;
 	} else {					/* Corrupted map */
 		printk("PCIC: BAD PIN %d\n", i); for (;;) {}
 	}
 /* P3 */ /* printk("PCIC: device %s pin %d ivec 0x%x irq %x\n", namebuf, i, ivec, dev->irq); */
 
 	/*
-	 * dev->irq=0 means PROM did not bother to program the upper
+	 * real_irq means PROM did not bother to program the upper
 	 * half of PCIC. This happens on JS-E with PROM 3.11, for instance.
 	 */
-	if (dev->irq == 0 || p->force) {
+	if (real_irq == 0 || p->force) {
 		if (p->irq == 0 || p->irq >= 15) {	/* Corrupted map */
 			printk("PCIC: BAD IRQ %d\n", p->irq); for (;;) {}
 		}
 		printk("PCIC: setting irq %d at pin %d for device %02x:%02x\n",
 		    p->irq, p->pin, dev->bus->number, dev->devfn);
-		dev->irq = p->irq;
+		real_irq = p->irq;
 
 		i = p->pin;
 		if (i >= 4) {
@@ -584,7 +588,8 @@  pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
 			ivec |= p->irq << (i << 2);
 			writew(ivec, pcic->pcic_regs+PCI_INT_SELECT_LO);
 		}
- 	}
+	}
+	dev->irq = pcic_build_device_irq(NULL, real_irq);
 }
 
 /*
@@ -731,6 +736,7 @@  void __init pci_time_init(void)
 	struct linux_pcic *pcic = &pcic0;
 	unsigned long v;
 	int timer_irq, irq;
+	int err;
 
 	do_arch_gettimeoffset = pci_gettimeoffset;
 
@@ -742,9 +748,10 @@  void __init pci_time_init(void)
 	timer_irq = PCI_COUNTER_IRQ_SYS(v);
 	writel (PCI_COUNTER_IRQ_SET(timer_irq, 0),
 		pcic->pcic_regs+PCI_COUNTER_IRQ);
-	irq = request_irq(timer_irq, pcic_timer_handler,
-			  (IRQF_DISABLED | SA_STATIC_ALLOC), "timer", NULL);
-	if (irq) {
+	irq = pcic_build_device_irq(NULL, timer_irq);
+	err = request_irq(irq, pcic_timer_handler,
+			  IRQF_TIMER, "timer", NULL);
+	if (err) {
 		prom_printf("time_init: unable to attach IRQ%d\n", timer_irq);
 		prom_halt();
 	}
@@ -805,50 +812,73 @@  static inline unsigned long get_irqmask(int irq_nr)
 	return 1 << irq_nr;
 }
 
-static void pcic_disable_irq(unsigned int irq_nr)
+static void pcic_mask_irq(struct irq_data *data)
 {
 	unsigned long mask, flags;
 
-	mask = get_irqmask(irq_nr);
+	mask = (unsigned long)data->chip_data;
 	local_irq_save(flags);
 	writel(mask, pcic0.pcic_regs+PCI_SYS_INT_TARGET_MASK_SET);
 	local_irq_restore(flags);
 }
 
-static void pcic_enable_irq(unsigned int irq_nr)
+static void pcic_unmask_irq(struct irq_data *data)
 {
 	unsigned long mask, flags;
 
-	mask = get_irqmask(irq_nr);
+	mask = (unsigned long)data->chip_data;
 	local_irq_save(flags);
 	writel(mask, pcic0.pcic_regs+PCI_SYS_INT_TARGET_MASK_CLEAR);
 	local_irq_restore(flags);
 }
 
-static void pcic_load_profile_irq(int cpu, unsigned int limit)
+static unsigned int pcic_startup_irq(struct irq_data *data)
 {
-	printk("PCIC: unimplemented code: FILE=%s LINE=%d", __FILE__, __LINE__);
+	irq_link(data->irq);
+	pcic_unmask_irq(data);
+	return 0;
 }
 
-/* We assume the caller has disabled local interrupts when these are called,
- * or else very bizarre behavior will result.
- */
-static void pcic_disable_pil_irq(unsigned int pil)
+static struct irq_chip pcic_irq = {
+	.name		= "pcic",
+	.irq_startup	= pcic_startup_irq,
+	.irq_mask	= pcic_mask_irq,
+	.irq_unmask	= pcic_unmask_irq,
+};
+
+unsigned int pcic_build_device_irq(struct platform_device *op,
+                                   unsigned int real_irq)
 {
-	writel(get_irqmask(pil), pcic0.pcic_regs+PCI_SYS_INT_TARGET_MASK_SET);
+	unsigned int irq;
+	unsigned long mask;
+
+	irq = 0;
+	mask = get_irqmask(real_irq);
+	if (mask == 0)
+		goto out;
+
+	irq = irq_alloc(real_irq, real_irq);
+	if (irq == 0)
+		goto out;
+
+	set_irq_chip_and_handler_name(irq, &pcic_irq,
+	                              handle_level_irq, "PCIC");
+	set_irq_chip_data(irq, (void *)mask);
+
+out:
+	return irq;
 }
 
-static void pcic_enable_pil_irq(unsigned int pil)
+
+static void pcic_load_profile_irq(int cpu, unsigned int limit)
 {
-	writel(get_irqmask(pil), pcic0.pcic_regs+PCI_SYS_INT_TARGET_MASK_CLEAR);
+	printk("PCIC: unimplemented code: FILE=%s LINE=%d", __FILE__, __LINE__);
 }
 
 void __init sun4m_pci_init_IRQ(void)
 {
-	BTFIXUPSET_CALL(enable_irq, pcic_enable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_irq, pcic_disable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(enable_pil_irq, pcic_enable_pil_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_pil_irq, pcic_disable_pil_irq, BTFIXUPCALL_NORM);
+	sparc_irq_config.build_device_irq = pcic_build_device_irq;
+
 	BTFIXUPSET_CALL(clear_clock_irq, pcic_clear_clock_irq, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(load_profile_irq, pcic_load_profile_irq, BTFIXUPCALL_NORM);
 }
diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c
index 90eea38..e9b47d4 100644
--- a/arch/sparc/kernel/sun4c_irq.c
+++ b/arch/sparc/kernel/sun4c_irq.c
@@ -65,62 +65,88 @@ 
  */
 unsigned char __iomem *interrupt_enable;
 
-static void sun4c_disable_irq(unsigned int irq_nr)
+static void sun4c_mask_irq(struct irq_data *data)
 {
-	unsigned long flags;
-	unsigned char current_mask, new_mask;
-
-	local_irq_save(flags);
-	irq_nr &= (NR_IRQS - 1);
-	current_mask = sbus_readb(interrupt_enable);
-	switch (irq_nr) {
-	case 1:
-		new_mask = ((current_mask) & (~(SUN4C_INT_E1)));
-		break;
-	case 8:
-		new_mask = ((current_mask) & (~(SUN4C_INT_E8)));
-		break;
-	case 10:
-		new_mask = ((current_mask) & (~(SUN4C_INT_E10)));
-		break;
-	case 14:
-		new_mask = ((current_mask) & (~(SUN4C_INT_E14)));
-		break;
-	default:
+	unsigned long mask = (unsigned long)data->chip_data;
+
+	if (mask) {
+		unsigned long flags;
+
+		local_irq_save(flags);
+		mask = sbus_readb(interrupt_enable) & ~mask;
+		sbus_writeb(mask, interrupt_enable);
 		local_irq_restore(flags);
-		return;
 	}
-	sbus_writeb(new_mask, interrupt_enable);
-	local_irq_restore(flags);
 }
 
-static void sun4c_enable_irq(unsigned int irq_nr)
+static void sun4c_unmask_irq(struct irq_data *data)
 {
-	unsigned long flags;
-	unsigned char current_mask, new_mask;
-
-	local_irq_save(flags);
-	irq_nr &= (NR_IRQS - 1);
-	current_mask = sbus_readb(interrupt_enable);
-	switch (irq_nr) {
-	case 1:
-		new_mask = ((current_mask) | SUN4C_INT_E1);
-		break;
-	case 8:
-		new_mask = ((current_mask) | SUN4C_INT_E8);
-		break;
-	case 10:
-		new_mask = ((current_mask) | SUN4C_INT_E10);
-		break;
-	case 14:
-		new_mask = ((current_mask) | SUN4C_INT_E14);
-		break;
-	default:
+	unsigned long mask = (unsigned long)data->chip_data;
+
+	if (mask) {
+		unsigned long flags;
+
+		local_irq_save(flags);
+		mask = sbus_readb(interrupt_enable) | mask;
+		sbus_writeb(mask, interrupt_enable);
 		local_irq_restore(flags);
-		return;
 	}
-	sbus_writeb(new_mask, interrupt_enable);
-	local_irq_restore(flags);
+}
+
+static unsigned int sun4c_startup_irq(struct irq_data *data)
+{
+	irq_link(data->irq);
+	sun4c_unmask_irq(data);
+
+	return 0;
+}
+
+static struct irq_chip sun4c_irq = {
+	.name		= "sun4c",
+	.irq_startup	= sun4c_startup_irq,
+	.irq_mask	= sun4c_mask_irq,
+	.irq_unmask	= sun4c_unmask_irq,
+};
+
+static unsigned int sun4c_build_device_irq(struct platform_device *op,
+					   unsigned int real_irq)
+{
+	 unsigned int irq;
+
+	if (real_irq >= 16) {
+		prom_printf("Bogus sun4c IRQ %u\n", real_irq);
+		prom_halt();
+	}
+
+	irq = irq_alloc(real_irq, real_irq);
+	if (irq) {
+		unsigned long mask = 0UL;
+
+		switch (real_irq) {
+		case 1:
+			mask = SUN4C_INT_E1;
+			break;
+		case 8:
+			mask = SUN4C_INT_E8;
+			break;
+		case 10:
+			mask = SUN4C_INT_E10;
+			break;
+		case 14:
+			mask = SUN4C_INT_E14;
+			break;
+		default:
+			/*
+			 * All the rest are either always enabled,
+			 * or are for signalling software interrupts.
+			 */
+			break;
+		}
+		set_irq_chip_and_handler_name(irq, &sun4c_irq,
+		                              handle_level_irq, "SUN4C");
+		set_irq_chip_data(irq, (void *)mask);
+	}
+	return irq;
 }
 
 struct sun4c_timer_info {
@@ -144,8 +170,9 @@  static void sun4c_load_profile_irq(int cpu, unsigned int limit)
 
 static void __init sun4c_init_timers(irq_handler_t counter_fn)
 {
-	const struct linux_prom_irqs *irq;
+	const struct linux_prom_irqs *prom_irqs;
 	struct device_node *dp;
+	unsigned int irq;
 	const u32 *addr;
 	int err;
 
@@ -163,9 +190,9 @@  static void __init sun4c_init_timers(irq_handler_t counter_fn)
 
 	sun4c_timers = (void __iomem *) (unsigned long) addr[0];
 
-	irq = of_get_property(dp, "intr", NULL);
+	prom_irqs = of_get_property(dp, "intr", NULL);
 	of_node_put(dp);
-	if (!irq) {
+	if (!prom_irqs) {
 		prom_printf("sun4c_init_timers: No intr property\n");
 		prom_halt();
 	}
@@ -178,15 +205,15 @@  static void __init sun4c_init_timers(irq_handler_t counter_fn)
 
 	master_l10_counter = &sun4c_timers->l10_count;
 
-	err = request_irq(irq[0].pri, counter_fn,
-			  (IRQF_DISABLED | SA_STATIC_ALLOC),
-			  "timer", NULL);
+	irq = sun4c_build_device_irq(NULL, prom_irqs[0].pri);
+	err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL);
 	if (err) {
 		prom_printf("sun4c_init_timers: request_irq() fails with %d\n", err);
 		prom_halt();
 	}
 
-	sun4c_disable_irq(irq[1].pri);
+	/* disable timer interrupt */
+	sun4c_mask_irq(irq_get_irq_data(irq));
 }
 
 #ifdef CONFIG_SMP
@@ -215,14 +242,11 @@  void __init sun4c_init_IRQ(void)
 
 	interrupt_enable = (void __iomem *) (unsigned long) addr[0];
 
-	BTFIXUPSET_CALL(enable_irq, sun4c_enable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_irq, sun4c_disable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(enable_pil_irq, sun4c_enable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_pil_irq, sun4c_disable_irq, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(clear_clock_irq, sun4c_clear_clock_irq, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(load_profile_irq, sun4c_load_profile_irq, BTFIXUPCALL_NOP);
 
-	sparc_irq_config.init_timers = sun4c_init_timers;
+	sparc_irq_config.init_timers      = sun4c_init_timers;
+	sparc_irq_config.build_device_irq = sun4c_build_device_irq;
 
 #ifdef CONFIG_SMP
 	BTFIXUPSET_CALL(set_cpu_int, sun4c_nop, BTFIXUPCALL_NOP);
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index 77b4a89..cf76db4 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -18,26 +18,25 @@ 
 #include "kernel.h"
 #include "irq.h"
 
-/* Sun4d interrupts fall roughly into two categories.  SBUS and
+/*
+ * Sun4d interrupts fall roughly into two categories.  SBUS and
  * cpu local.  CPU local interrupts cover the timer interrupts
  * and whatnot, and we encode those as normal PILs between
  * 0 and 15.
- *
- * SBUS interrupts are encoded integers including the board number
- * (plus one), the SBUS level, and the SBUS slot number.  Sun4D
- * IRQ dispatch is done by:
- *
- * 1) Reading the BW local interrupt table in order to get the bus
- *    interrupt mask.
- *
- *    This table is indexed by SBUS interrupt level which can be
- *    derived from the PIL we got interrupted on.
- *
- * 2) For each bus showing interrupt pending from #1, read the
- *    SBI interrupt state register.  This will indicate which slots
- *    have interrupts pending for that SBUS interrupt level.
+ * SBUS interrupts are encodes as a combination of board, level and slot.
  */
 
+struct sun4d_handler_data {
+	unsigned int cpuid;    /* target cpu */
+	unsigned int real_irq; /* interrupt level */
+};
+
+
+static unsigned int sun4d_encode_irq(int board, int lvl, int slot)
+{
+	return (board + 1) << 5 | (lvl << 2) | slot;
+}
+
 struct sun4d_timer_regs {
 	u32	l10_timer_limit;
 	u32	l10_cur_countx;
@@ -48,17 +47,13 @@  struct sun4d_timer_regs {
 
 static struct sun4d_timer_regs __iomem *sun4d_timers;
 
-#define TIMER_IRQ	10
-
-#define MAX_STATIC_ALLOC	4
-static unsigned char sbus_tid[32];
+#define SUN4D_TIMER_IRQ	10
 
-static struct irqaction *irq_action[NR_IRQS];
-
-static struct sbus_action {
-	struct irqaction *action;
-	/* For SMP this needs to be extended */
-} *sbus_actions;
+/*
+ * Specify which cpu handle interrupts from which board.
+ * Index is board, value is cpu.
+ */
+static unsigned char board_to_cpu[32];
 
 static int pil_to_sbus[] = {
 	0,
@@ -79,152 +74,82 @@  static int pil_to_sbus[] = {
 	0,
 };
 
-static int sbus_to_pil[] = {
-	0,
-	2,
-	3,
-	5,
-	7,
-	9,
-	11,
-	13,
-};
-
-static int nsbi;
-
 /* Exported for sun4d_smp.c */
 DEFINE_SPINLOCK(sun4d_imsk_lock);
 
-int show_sun4d_interrupts(struct seq_file *p, void *v)
+/*
+ * SBUS interrupts are encoded integers including the board number
+ * (plus one), the SBUS level, and the SBUS slot number.  Sun4D
+ * IRQ dispatch is done by:
+ *
+ * 1) Reading the BW local interrupt table in order to get the bus
+ *    interrupt mask.
+ *
+ *    This table is indexed by SBUS interrupt level which can be
+ *    derived from the PIL we got interrupted on.
+ *
+ * 2) For each bus showing interrupt pending from #1, read the
+ *    SBI interrupt state register.  This will indicate which slots
+ *    have interrupts pending for that SBUS interrupt level.
+ *
+ * 3) Call the genreric IRQ support.
+ */
+static void sun4d_sbus_handler_irq(int sbusl)
 {
-	int i = *(loff_t *) v, j = 0, k = 0, sbusl;
-	struct irqaction *action;
-	unsigned long flags;
-#ifdef CONFIG_SMP
-	int x;
-#endif
-
-	spin_lock_irqsave(&irq_action_lock, flags);
-	if (i < NR_IRQS) {
-		sbusl = pil_to_sbus[i];
-		if (!sbusl) {
-			action = *(i + irq_action);
-			if (!action)
-				goto out_unlock;
-		} else {
-			for (j = 0; j < nsbi; j++) {
-				for (k = 0; k < 4; k++)
-					action = sbus_actions[(j << 5) + (sbusl << 2) + k].action;
-					if (action)
-						goto found_it;
-			}
-			goto out_unlock;
-		}
-found_it:	seq_printf(p, "%3d: ", i);
-#ifndef CONFIG_SMP
-		seq_printf(p, "%10u ", kstat_irqs(i));
-#else
-		for_each_online_cpu(x)
-			seq_printf(p, "%10u ",
-			       kstat_cpu(cpu_logical_map(x)).irqs[i]);
-#endif
-		seq_printf(p, "%c %s",
-			(action->flags & IRQF_DISABLED) ? '+' : ' ',
-			action->name);
-		action = action->next;
-		for (;;) {
-			for (; action; action = action->next) {
-				seq_printf(p, ",%s %s",
-					(action->flags & IRQF_DISABLED) ? " +" : "",
-					action->name);
-			}
-			if (!sbusl)
-				break;
-			k++;
-			if (k < 4) {
-				action = sbus_actions[(j << 5) + (sbusl << 2) + k].action;
-			} else {
-				j++;
-				if (j == nsbi)
-					break;
-				k = 0;
-				action = sbus_actions[(j << 5) + (sbusl << 2)].action;
+	unsigned int bus_mask;
+	unsigned int sbino, slot;
+	unsigned int sbil;
+
+	bus_mask = bw_get_intr_mask(sbusl) & 0x3ffff;
+	bw_clear_intr_mask(sbusl, bus_mask);
+
+	sbil = (sbusl << 2);
+	/* Loop for each pending SBI */
+	for (sbino = 0; bus_mask; sbino++) {
+		unsigned int idx, mask;
+
+		bus_mask >>= 1;
+		if (!(bus_mask & 1))
+			continue;
+		/* XXX This seems to ACK the irq twice.  acquire_sbi()
+		 * XXX uses swap, therefore this writes 0xf << sbil,
+		 * XXX then later release_sbi() will write the individual
+		 * XXX bits which were set again.
+		 */
+		mask = acquire_sbi(SBI2DEVID(sbino), 0xf << sbil);
+		mask &= (0xf << sbil);
+
+		/* Loop for each pending SBI slot */
+		idx = 0;
+		slot = (1 << sbil);
+		while (mask != 0) {
+			unsigned int pil;
+			struct irq_bucket *p;
+
+			idx++;
+			slot <<= 1;
+			if (!(mask & slot))
+				continue;
+
+			mask &= ~slot;
+			pil = sun4d_encode_irq(sbino, sbil, idx);
+
+			p = irq_map[pil];
+			while (p) {
+				struct irq_bucket *next;
+
+				next = p->next;
+				generic_handle_irq(p->irq);
+				p = next;
 			}
+			release_sbi(SBI2DEVID(sbino), slot);
 		}
-		seq_putc(p, '\n');
-	}
-out_unlock:
-	spin_unlock_irqrestore(&irq_action_lock, flags);
-	return 0;
-}
-
-void sun4d_free_irq(unsigned int irq, void *dev_id)
-{
-	struct irqaction *action, **actionp;
-	struct irqaction *tmp = NULL;
-	unsigned long flags;
-
-	spin_lock_irqsave(&irq_action_lock, flags);
-	if (irq < 15)
-		actionp = irq + irq_action;
-	else
-		actionp = &(sbus_actions[irq - (1 << 5)].action);
-	action = *actionp;
-	if (!action) {
-		printk(KERN_ERR "Trying to free free IRQ%d\n", irq);
-		goto out_unlock;
-	}
-	if (dev_id) {
-		for (; action; action = action->next) {
-			if (action->dev_id == dev_id)
-				break;
-			tmp = action;
-		}
-		if (!action) {
-			printk(KERN_ERR "Trying to free free shared IRQ%d\n",
-			       irq);
-			goto out_unlock;
-		}
-	} else if (action->flags & IRQF_SHARED) {
-		printk(KERN_ERR "Trying to free shared IRQ%d with NULL device ID\n",
-		       irq);
-		goto out_unlock;
-	}
-	if (action->flags & SA_STATIC_ALLOC) {
-		/*
-		 * This interrupt is marked as specially allocated
-		 * so it is a bad idea to free it.
-		 */
-		printk(KERN_ERR "Attempt to free statically allocated IRQ%d (%s)\n",
-		       irq, action->name);
-		goto out_unlock;
 	}
-
-	if (tmp)
-		tmp->next = action->next;
-	else
-		*actionp = action->next;
-
-	spin_unlock_irqrestore(&irq_action_lock, flags);
-
-	synchronize_irq(irq);
-
-	spin_lock_irqsave(&irq_action_lock, flags);
-
-	kfree(action);
-
-	if (!(*actionp))
-		__disable_irq(irq);
-
-out_unlock:
-	spin_unlock_irqrestore(&irq_action_lock, flags);
 }
 
 void sun4d_handler_irq(int pil, struct pt_regs *regs)
 {
 	struct pt_regs *old_regs;
-	struct irqaction *action;
-	int cpu = smp_processor_id();
 	/* SBUS IRQ level (1 - 7) */
 	int sbusl = pil_to_sbus[pil];
 
@@ -235,158 +160,81 @@  void sun4d_handler_irq(int pil, struct pt_regs *regs)
 
 	old_regs = set_irq_regs(regs);
 	irq_enter();
-	kstat_cpu(cpu).irqs[pil]++;
-	if (!sbusl) {
-		action = *(pil + irq_action);
-		if (!action)
-			unexpected_irq(pil, NULL, regs);
-		do {
-			action->handler(pil, action->dev_id);
-			action = action->next;
-		} while (action);
+	if (sbusl == 0) {
+		/* cpu interrupt */
+		struct irq_bucket *p;
+
+		p = irq_map[pil];
+		while (p) {
+			struct irq_bucket *next;
+
+			next = p->next;
+			generic_handle_irq(p->irq);
+			p = next;
+		}
 	} else {
-		int bus_mask = bw_get_intr_mask(sbusl) & 0x3ffff;
-		int sbino;
-		struct sbus_action *actionp;
-		unsigned mask, slot;
-		int sbil = (sbusl << 2);
-
-		bw_clear_intr_mask(sbusl, bus_mask);
-
-		/* Loop for each pending SBI */
-		for (sbino = 0; bus_mask; sbino++, bus_mask >>= 1)
-			if (bus_mask & 1) {
-				mask = acquire_sbi(SBI2DEVID(sbino), 0xf << sbil);
-				mask &= (0xf << sbil);
-				actionp = sbus_actions + (sbino << 5) + (sbil);
-				/* Loop for each pending SBI slot */
-				for (slot = (1 << sbil); mask; slot <<= 1, actionp++)
-					if (mask & slot) {
-						mask &= ~slot;
-						action = actionp->action;
-
-						if (!action)
-							unexpected_irq(pil, NULL, regs);
-						do {
-							action->handler(pil, action->dev_id);
-							action = action->next;
-						} while (action);
-						release_sbi(SBI2DEVID(sbino), slot);
-					}
-			}
+		/* SBUS interrupt */
+		sun4d_sbus_handler_irq(sbusl);
 	}
 	irq_exit();
 	set_irq_regs(old_regs);
 }
 
-int sun4d_request_irq(unsigned int irq,
-		irq_handler_t handler,
-		unsigned long irqflags, const char *devname, void *dev_id)
+static void sun4d_mask_irq(struct irq_data *data)
 {
-	struct irqaction *action, *tmp = NULL, **actionp;
+	struct sun4d_handler_data *handler_data = data->handler_data;
+	unsigned int real_irq;
+#ifdef CONFIG_SMP
+	int cpuid = handler_data->cpuid;
 	unsigned long flags;
-	int ret;
-
-	if (irq > 14 && irq < (1 << 5)) {
-		ret = -EINVAL;
-		goto out;
-	}
-
-	if (!handler) {
-		ret = -EINVAL;
-		goto out;
-	}
-
-	spin_lock_irqsave(&irq_action_lock, flags);
-
-	if (irq >= (1 << 5))
-		actionp = &(sbus_actions[irq - (1 << 5)].action);
-	else
-		actionp = irq + irq_action;
-	action = *actionp;
-
-	if (action) {
-		if ((action->flags & IRQF_SHARED) && (irqflags & IRQF_SHARED)) {
-			for (tmp = action; tmp->next; tmp = tmp->next)
-				/* find last entry - tmp used below */;
-		} else {
-			ret = -EBUSY;
-			goto out_unlock;
-		}
-		if ((action->flags & IRQF_DISABLED) ^ (irqflags & IRQF_DISABLED)) {
-			printk(KERN_ERR "Attempt to mix fast and slow interrupts on IRQ%d denied\n",
-			       irq);
-			ret = -EBUSY;
-			goto out_unlock;
-		}
-		action = NULL;		/* Or else! */
-	}
-
-	/* If this is flagged as statically allocated then we use our
-	 * private struct which is never freed.
-	 */
-	if (irqflags & SA_STATIC_ALLOC) {
-		if (static_irq_count < MAX_STATIC_ALLOC)
-			action = &static_irqaction[static_irq_count++];
-		else
-			printk(KERN_ERR "Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n",
-			       irq, devname);
-	}
-
-	if (action == NULL)
-		action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
-
-	if (!action) {
-		ret = -ENOMEM;
-		goto out_unlock;
-	}
-
-	action->handler = handler;
-	action->flags = irqflags;
-	action->name = devname;
-	action->next = NULL;
-	action->dev_id = dev_id;
-
-	if (tmp)
-		tmp->next = action;
-	else
-		*actionp = action;
+#endif
 
-	__enable_irq(irq);
+	real_irq = handler_data->real_irq;
 
-	ret = 0;
-out_unlock:
-	spin_unlock_irqrestore(&irq_action_lock, flags);
-out:
-	return ret;
+#ifdef CONFIG_SMP
+	spin_lock_irqsave(&sun4d_imsk_lock, flags);
+	cc_set_imsk_other(cpuid, cc_get_imsk_other(cpuid) | (1 << real_irq));
+	spin_unlock_irqrestore(&sun4d_imsk_lock, flags);
+#else
+	cc_set_imsk(cc_get_imsk() | (1 << real_irq));
+#endif
 }
 
-static void sun4d_disable_irq(unsigned int irq)
+static void sun4d_unmask_irq(struct irq_data *data)
 {
-	int tid = sbus_tid[(irq >> 5) - 1];
+	struct sun4d_handler_data *handler_data = data->handler_data;
+	unsigned int real_irq;
+#ifdef CONFIG_SMP
+	int cpuid = handler_data->cpuid;
 	unsigned long flags;
+#endif
 
-	if (irq < NR_IRQS)
-		return;
+	real_irq = handler_data->real_irq;
 
+#ifdef CONFIG_SMP
 	spin_lock_irqsave(&sun4d_imsk_lock, flags);
-	cc_set_imsk_other(tid, cc_get_imsk_other(tid) | (1 << sbus_to_pil[(irq >> 2) & 7]));
+	cc_set_imsk_other(cpuid, cc_get_imsk_other(cpuid) | ~(1 << real_irq));
 	spin_unlock_irqrestore(&sun4d_imsk_lock, flags);
+#else
+	cc_set_imsk(cc_get_imsk() | ~(1 << real_irq));
+#endif
 }
 
-static void sun4d_enable_irq(unsigned int irq)
+/* XXX Do we need shutdown too for sun4d? */
+static unsigned int sun4d_startup_irq(struct irq_data *data)
 {
-	int tid = sbus_tid[(irq >> 5) - 1];
-	unsigned long flags;
-
-	if (irq < NR_IRQS)
-		return;
-
-	spin_lock_irqsave(&sun4d_imsk_lock, flags);
-	cc_set_imsk_other(tid, cc_get_imsk_other(tid) & ~(1 << sbus_to_pil[(irq >> 2) & 7]));
-	spin_unlock_irqrestore(&sun4d_imsk_lock, flags);
+	irq_link(data->irq);
+	sun4d_unmask_irq(data);
+	return 0;
 }
 
+struct irq_chip sun4d_irq = {
+	.name		= "sun4d",
+	.irq_startup	= sun4d_startup_irq,
+	.irq_unmask	= sun4d_unmask_irq,
+	.irq_mask	= sun4d_mask_irq,
+};
+
 #ifdef CONFIG_SMP
 static void sun4d_set_cpu_int(int cpu, int level)
 {
@@ -413,7 +261,7 @@  void __init sun4d_distribute_irqs(void)
 	for_each_node_by_name(dp, "sbi") {
 		int devid = of_getintprop_default(dp, "device-id", 0);
 		int board = of_getintprop_default(dp, "board#", 0);
-		sbus_tid[board] = cpuid;
+		board_to_cpu[board] = cpuid;
 		set_sbi_tid(devid, cpuid << 3);
 	}
 	printk(KERN_ERR "All sbus IRQs directed to CPU%d\n", cpuid);
@@ -443,15 +291,16 @@  static void __init sun4d_load_profile_irqs(void)
 unsigned int sun4d_build_device_irq(struct platform_device *op,
                                     unsigned int real_irq)
 {
-	static int pil_to_sbus[] = {
-		0, 0, 1, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 0,
-	};
 	struct device_node *dp = op->dev.of_node;
 	struct device_node *io_unit, *sbi = dp->parent;
 	const struct linux_prom_registers *regs;
+	struct sun4d_handler_data *handler_data;
+	unsigned int pil;
+	unsigned int irq;
 	int board, slot;
 	int sbusl;
 
+	irq = 0;
 	while (sbi) {
 		if (!strcmp(sbi->name, "sbi"))
 			break;
@@ -484,7 +333,28 @@  unsigned int sun4d_build_device_irq(struct platform_device *op,
 
 	sbusl = pil_to_sbus[real_irq];
 	if (sbusl)
-		return (((board + 1) << 5) + (sbusl << 2) + slot);
+		pil = sun4d_encode_irq(board, sbusl, slot);
+	else
+		pil = real_irq;
+
+	irq = irq_alloc(real_irq, pil);
+	if (irq == 0)
+		goto err_out;
+
+	handler_data = get_irq_data(irq);
+	if (unlikely(handler_data))
+		goto err_out;
+
+	handler_data = kzalloc(sizeof(struct sun4d_handler_data), GFP_ATOMIC);
+	if (unlikely(!handler_data)) {
+		prom_printf("IRQ: kzalloc(sun4d_handler_data) failed.\n");
+		prom_halt();
+	}
+	handler_data->cpuid    = board_to_cpu[board];
+	handler_data->real_irq = real_irq;
+	set_irq_chip_and_handler_name(irq, &sun4d_irq,
+	                              handle_level_irq, "SUN4D");
+	set_irq_data(irq, handler_data);
 
 err_out:
 	return real_irq;
@@ -518,6 +388,7 @@  static void __init sun4d_init_timers(irq_handler_t counter_fn)
 {
 	struct device_node *dp;
 	struct resource res;
+	unsigned int irq;
 	const u32 *reg;
 	int err;
 
@@ -552,9 +423,8 @@  static void __init sun4d_init_timers(irq_handler_t counter_fn)
 
 	master_l10_counter = &sun4d_timers->l10_cur_count;
 
-	err = request_irq(TIMER_IRQ, counter_fn,
-			  (IRQF_DISABLED | SA_STATIC_ALLOC),
-			  "timer", NULL);
+	irq = sun4d_build_device_irq(NULL, SUN4D_TIMER_IRQ);
+	err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL);
 	if (err) {
 		prom_printf("sun4d_init_timers: request_irq() failed with %d\n",
 		             err);
@@ -572,22 +442,13 @@  void __init sun4d_init_sbi_irq(void)
 #ifdef CONFIG_SMP
 	target_cpu = boot_cpu_id;
 #endif
-
-	nsbi = 0;
-	for_each_node_by_name(dp, "sbi")
-		nsbi++;
-	sbus_actions = kzalloc(nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
-	if (!sbus_actions) {
-		prom_printf("SUN4D: Cannot allocate sbus_actions, halting.\n");
-		prom_halt();
-	}
 	for_each_node_by_name(dp, "sbi") {
 		int devid = of_getintprop_default(dp, "device-id", 0);
 		int board = of_getintprop_default(dp, "board#", 0);
 		unsigned int mask;
 
 		set_sbi_tid(devid, target_cpu << 3);
-		sbus_tid[board] = target_cpu;
+		board_to_cpu[board] = target_cpu;
 
 		/* Get rid of pending irqs from PROM */
 		mask = acquire_sbi(devid, 0xffffffff);
@@ -603,12 +464,10 @@  void __init sun4d_init_IRQ(void)
 {
 	local_irq_disable();
 
-	BTFIXUPSET_CALL(enable_irq, sun4d_enable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_irq, sun4d_disable_irq, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(clear_clock_irq, sun4d_clear_clock_irq, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(load_profile_irq, sun4d_load_profile_irq, BTFIXUPCALL_NORM);
 
-	sparc_irq_config.init_timers = sun4d_init_timers;
+	sparc_irq_config.init_timers      = sun4d_init_timers;
 	sparc_irq_config.build_device_irq = sun4d_build_device_irq;
 
 #ifdef CONFIG_SMP
diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c
index 69df625..eda5685 100644
--- a/arch/sparc/kernel/sun4m_irq.c
+++ b/arch/sparc/kernel/sun4m_irq.c
@@ -100,6 +100,11 @@ 
 struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS];
 struct sun4m_irq_global __iomem *sun4m_irq_global;
 
+struct sun4m_handler_data {
+	bool    percpu;
+	long    mask;
+};
+
 /* Dave Redman (djhr@tadpole.co.uk)
  * The sun4m interrupt registers.
  */
@@ -142,9 +147,9 @@  struct sun4m_irq_global __iomem *sun4m_irq_global;
 #define	OBP_INT_LEVEL_VME	0x40
 
 #define SUN4M_TIMER_IRQ         (OBP_INT_LEVEL_ONBOARD | 10)
-#define SUM4M_PROFILE_IRQ       (OBP_INT_LEVEL_ONBOARD | 14)
+#define SUN4M_PROFILE_IRQ       (OBP_INT_LEVEL_ONBOARD | 14)
 
-static unsigned long irq_mask[0x50] = {
+static unsigned long sun4m_imask[0x50] = {
 	/* 0x00 - SMP */
 	0,  SUN4M_SOFT_INT(1),
 	SUN4M_SOFT_INT(2),  SUN4M_SOFT_INT(3),
@@ -169,7 +174,7 @@  static unsigned long irq_mask[0x50] = {
 	SUN4M_INT_VIDEO, SUN4M_INT_MODULE,
 	SUN4M_INT_REALTIME, SUN4M_INT_FLOPPY,
 	(SUN4M_INT_SERIAL | SUN4M_INT_KBDMS),
-	SUN4M_INT_AUDIO, 0, SUN4M_INT_MODULE_ERR,
+	SUN4M_INT_AUDIO, SUN4M_INT_E14, SUN4M_INT_MODULE_ERR,
 	/* 0x30 - sbus */
 	0, 0, SUN4M_INT_SBUS(0), SUN4M_INT_SBUS(1),
 	0, SUN4M_INT_SBUS(2), 0, SUN4M_INT_SBUS(3),
@@ -182,105 +187,103 @@  static unsigned long irq_mask[0x50] = {
 	0, SUN4M_INT_VME(6), 0, 0
 };
 
-static unsigned long sun4m_get_irqmask(unsigned int irq)
+static void sun4m_mask_irq(struct irq_data *data)
 {
-	unsigned long mask;
-
-	if (irq < 0x50)
-		mask = irq_mask[irq];
-	else
-		mask = 0;
+	struct sun4m_handler_data *handler_data = data->handler_data;
+	int cpu = smp_processor_id();
 
-	if (!mask)
-		printk(KERN_ERR "sun4m_get_irqmask: IRQ%d has no valid mask!\n",
-		       irq);
+	if (handler_data->mask) {
+		unsigned long flags;
 
-	return mask;
+		local_irq_save(flags);
+		if (handler_data->percpu) {
+			sbus_writel(handler_data->mask, &sun4m_irq_percpu[cpu]->set);
+		} else {
+			sbus_writel(handler_data->mask, &sun4m_irq_global->mask_set);
+		}
+		local_irq_restore(flags);
+	}
 }
 
-static void sun4m_disable_irq(unsigned int irq_nr)
+static void sun4m_unmask_irq(struct irq_data *data)
 {
-	unsigned long mask, flags;
+	struct sun4m_handler_data *handler_data = data->handler_data;
 	int cpu = smp_processor_id();
 
-	mask = sun4m_get_irqmask(irq_nr);
-	local_irq_save(flags);
-	if (irq_nr > 15)
-		sbus_writel(mask, &sun4m_irq_global->mask_set);
-	else
-		sbus_writel(mask, &sun4m_irq_percpu[cpu]->set);
-	local_irq_restore(flags);
-}
-
-static void sun4m_enable_irq(unsigned int irq_nr)
-{
-	unsigned long mask, flags;
-	int cpu = smp_processor_id();
+	if (handler_data->mask) {
+		unsigned long flags;
 
-	/* Dreadful floppy hack. When we use 0x2b instead of
-	 * 0x0b the system blows (it starts to whistle!).
-	 * So we continue to use 0x0b. Fixme ASAP. --P3
-	 */
-	if (irq_nr != 0x0b) {
-		mask = sun4m_get_irqmask(irq_nr);
 		local_irq_save(flags);
-		if (irq_nr > 15)
-			sbus_writel(mask, &sun4m_irq_global->mask_clear);
-		else
-			sbus_writel(mask, &sun4m_irq_percpu[cpu]->clear);
-		local_irq_restore(flags);
-	} else {
-		local_irq_save(flags);
-		sbus_writel(SUN4M_INT_FLOPPY, &sun4m_irq_global->mask_clear);
+		if (handler_data->percpu) {
+			sbus_writel(handler_data->mask, &sun4m_irq_percpu[cpu]->clear);
+		} else {
+			sbus_writel(handler_data->mask, &sun4m_irq_global->mask_clear);
+		}
 		local_irq_restore(flags);
 	}
 }
 
-static unsigned long cpu_pil_to_imask[16] = {
-/*0*/	0x00000000,
-/*1*/	0x00000000,
-/*2*/	SUN4M_INT_SBUS(0) | SUN4M_INT_VME(0),
-/*3*/	SUN4M_INT_SBUS(1) | SUN4M_INT_VME(1),
-/*4*/	SUN4M_INT_SCSI,
-/*5*/	SUN4M_INT_SBUS(2) | SUN4M_INT_VME(2),
-/*6*/	SUN4M_INT_ETHERNET,
-/*7*/	SUN4M_INT_SBUS(3) | SUN4M_INT_VME(3),
-/*8*/	SUN4M_INT_VIDEO,
-/*9*/	SUN4M_INT_SBUS(4) | SUN4M_INT_VME(4) | SUN4M_INT_MODULE_ERR,
-/*10*/	SUN4M_INT_REALTIME,
-/*11*/	SUN4M_INT_SBUS(5) | SUN4M_INT_VME(5) | SUN4M_INT_FLOPPY,
-/*12*/	SUN4M_INT_SERIAL  | SUN4M_INT_KBDMS,
-/*13*/	SUN4M_INT_SBUS(6) | SUN4M_INT_VME(6) | SUN4M_INT_AUDIO,
-/*14*/	SUN4M_INT_E14,
-/*15*/	SUN4M_INT_ERROR,
-};
-
-/* We assume the caller has disabled local interrupts when these are called,
- * or else very bizarre behavior will result.
- */
-static void sun4m_disable_pil_irq(unsigned int pil)
+static unsigned int sun4m_startup_irq(struct irq_data *data)
 {
-	sbus_writel(cpu_pil_to_imask[pil], &sun4m_irq_global->mask_set);
+	irq_link(data->irq);
+	sun4m_unmask_irq(data);
+	return 0;
 }
 
-static void sun4m_enable_pil_irq(unsigned int pil)
+static struct irq_chip sun4m_irq = {
+	.name		= "sun4m",
+	.irq_startup	= sun4m_startup_irq,
+	.irq_mask	= sun4m_mask_irq,
+	.irq_unmask	= sun4m_unmask_irq,
+};
+
+
+static unsigned int sun4m_build_device_irq(struct platform_device *op,
+					   unsigned int real_irq)
 {
-	sbus_writel(cpu_pil_to_imask[pil], &sun4m_irq_global->mask_clear);
+	struct sun4m_handler_data *handler_data;
+	unsigned int irq;
+	unsigned int pil;
+
+	if (real_irq >= OBP_INT_LEVEL_VME) {
+		prom_printf("Bogus sun4m IRQ %u\n", real_irq);
+		prom_halt();
+	}
+	pil = (real_irq & 0xf);
+	irq = irq_alloc(real_irq, pil);
+
+	if (irq == 0)
+		goto out;
+
+	handler_data = get_irq_data(irq);
+	if (unlikely(handler_data))
+		goto out;
+
+	handler_data = kzalloc(sizeof(struct sun4m_handler_data), GFP_ATOMIC);
+	if (unlikely(!handler_data)) {
+		prom_printf("IRQ: kzalloc(sun4m_handler_data) failed.\n");
+		prom_halt();
+	}
+
+	handler_data->mask = sun4m_imask[real_irq];
+	handler_data->percpu = real_irq < OBP_INT_LEVEL_ONBOARD;
+	set_irq_chip_and_handler_name(irq, &sun4m_irq,
+	                              handle_level_irq, "SUN4M");
+	set_irq_data(irq, handler_data);
+
+out:
+	return irq;
 }
 
 #ifdef CONFIG_SMP
 static void sun4m_send_ipi(int cpu, int level)
 {
-	unsigned long mask = sun4m_get_irqmask(level);
-
-	sbus_writel(mask, &sun4m_irq_percpu[cpu]->set);
+	sbus_writel(SUN4M_SOFT_INT(level), &sun4m_irq_percpu[cpu]->set);
 }
 
 static void sun4m_clear_ipi(int cpu, int level)
 {
-	unsigned long mask = sun4m_get_irqmask(level);
-
-	sbus_writel(mask, &sun4m_irq_percpu[cpu]->clear);
+	sbus_writel(SUN4M_SOFT_INT(level), &sun4m_irq_percpu[cpu]->clear);
 }
 
 static void sun4m_set_udt(int cpu)
@@ -343,7 +346,15 @@  void sun4m_nmi(struct pt_regs *regs)
 	prom_halt();
 }
 
-/* Exported for sun4m_smp.c */
+void sun4m_unmask_profile_irq(void)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+	sbus_writel(sun4m_imask[SUN4M_PROFILE_IRQ], &sun4m_irq_global->mask_clear);
+	local_irq_restore(flags);
+}
+
 void sun4m_clear_profile_irq(int cpu)
 {
 	sbus_readl(&timers_percpu[cpu]->l14_limit);
@@ -358,6 +369,7 @@  static void __init sun4m_init_timers(irq_handler_t counter_fn)
 {
 	struct device_node *dp = of_find_node_by_name(NULL, "counter");
 	int i, err, len, num_cpu_timers;
+	unsigned int irq;
 	const u32 *addr;
 
 	if (!dp) {
@@ -384,8 +396,9 @@  static void __init sun4m_init_timers(irq_handler_t counter_fn)
 
 	master_l10_counter = &timers_global->l10_count;
 
-	err = request_irq(SUN4M_TIMER_IRQ, counter_fn,
-			  (IRQF_DISABLED | SA_STATIC_ALLOC), "timer", NULL);
+	irq = sun4m_build_device_irq(NULL, SUN4M_TIMER_IRQ);
+
+	err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL);
 	if (err) {
 		printk(KERN_ERR "sun4m_init_timers: Register IRQ error %d.\n",
 			err);
@@ -452,14 +465,11 @@  void __init sun4m_init_IRQ(void)
 	if (num_cpu_iregs == 4)
 		sbus_writel(0, &sun4m_irq_global->interrupt_target);
 
-	BTFIXUPSET_CALL(enable_irq, sun4m_enable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_irq, sun4m_disable_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(enable_pil_irq, sun4m_enable_pil_irq, BTFIXUPCALL_NORM);
-	BTFIXUPSET_CALL(disable_pil_irq, sun4m_disable_pil_irq, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(clear_clock_irq, sun4m_clear_clock_irq, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(load_profile_irq, sun4m_load_profile_irq, BTFIXUPCALL_NORM);
 
 	sparc_irq_config.init_timers = sun4m_init_timers;
+	sparc_irq_config.build_device_irq = sun4m_build_device_irq;
 
 #ifdef CONFIG_SMP
 	BTFIXUPSET_CALL(set_cpu_int, sun4m_send_ipi, BTFIXUPCALL_NORM);
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index 5cc7dc5..58b8d84 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -150,20 +150,6 @@  void __init smp4m_smp_done(void)
 	/* Ok, they are spinning and ready to go. */
 }
 
-/* At each hardware IRQ, we get this called to forward IRQ reception
- * to the next processor.  The caller must disable the IRQ level being
- * serviced globally so that there are no double interrupts received.
- *
- * XXX See sparc64 irq.c.
- */
-void smp4m_irq_rotate(int cpu)
-{
-	int next = cpu_data(cpu).next;
-
-	if (next != cpu)
-		set_irq_udt(next);
-}
-
 static struct smp_funcall {
 	smpfunc_t func;
 	unsigned long arg1;
@@ -277,7 +263,7 @@  static void __cpuinit smp_setup_percpu_timer(void)
 	load_profile_irq(cpu, lvl14_resolution);
 
 	if (cpu == boot_cpu_id)
-		enable_pil_irq(14);
+		sun4m_unmask_profile_irq();
 }
 
 static void __init smp4m_blackbox_id(unsigned *addr)