On Tue, 9 Jan 2018, Lorenzo Pieralisi wrote: > On Mon, Jan 08, 2018 at 01:35:27PM -0500, Mikulas Patocka wrote: > > > > > > On Mon, 8 Jan 2018, Lorenzo Pieralisi wrote: > > > > > On Fri, Jan 05, 2018 at 01:49:58PM -0500, Mikulas Patocka wrote: > > > > > > > > > > > > On Fri, 5 Jan 2018, Lorenzo Pieralisi wrote: > > > > > > > > > On Tue, Jan 02, 2018 at 04:32:45PM -0500, Mikulas Patocka wrote: > > > > > > Hi > > > > > > > > > > > > The patch 0e4c2eeb758a91e68b9eaf7a4bee9bd5ed97ff2b ("alpha/PCI: Replace > > > > > > pci_fixup_irqs() call with host bridge IRQ mapping hooks") breaks > > > > > > networking on Alpha for me. I have an Alpha Avanti server with tulip > > > > > > network card. > > > > > > > > > > > > The patch 0e4c2eeb breaks it so that I get MCE when the network card > > > > > > driver is loaded. The patch 814eae59 fixes the MCE, the system boot > > > > > > completes, but the network card doesn't receive any interrupts (and soon > > > > > > it reports warning about timeout on tx queue). All kernels in the 4.14 > > > > > > branch have this bug. > > > > > > > > > > I reworked the patch, please let me know if it does fix the issue. > > > > > > > > > > Thanks, > > > > > Lorenzo > > > > > > > > Networking doesn't work, other interrupts work. > > > > > > > > With this patch, /proc/interrupts shows one interrupt for the network card > > > > (it used to be zero without this patch). > > > > > > It is getting harder to understand what's going on, here's an > > > incremental patch with some logging, it would be ideal to add > > > a similar logging with a working kernel so that we can actually > > > compare the IRQ level registers programming, please test it > > > when you have time. > > > > This patch works. The patch contains some small changes in the function > > noname_map_irq compared to your previous patch and these changes make it > > work. If I revert these changes, networking doesn't work. > > Yes - I am slowly understanding how this Alpha platform deals with IRQs, > thank you for your help and apologies for the drawn-out fix, I just > can't test on this platform. > > Patch below (minus pr_info that I will remove) should be the final one, > please test it and provide me with logs so that I can check. > > Thank you very much. This patch works - dmesg output is attached. Mikulas > -- >8 -- > diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c > index 37bd6d9b8eb9..754a890c8403 100644 > --- a/arch/alpha/kernel/sys_sio.c > +++ b/arch/alpha/kernel/sys_sio.c > @@ -102,6 +102,15 @@ sio_pci_route(void) > alpha_mv.sys.sio.route_tab); > } > > +static bool sio_pci_dev_irq_needs_level(const struct pci_dev *dev) > +{ > + if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) && > + (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA)) > + return false; > + > + return true; > +} > + > static unsigned int __init > sio_collect_irq_levels(void) > { > @@ -110,8 +119,7 @@ sio_collect_irq_levels(void) > > /* Iterate through the devices, collecting IRQ levels. */ > for_each_pci_dev(dev) { > - if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) && > - (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA)) > + if (!sio_pci_dev_irq_needs_level(dev)) > continue; > > if (dev->irq) > @@ -120,8 +128,7 @@ sio_collect_irq_levels(void) > return level_bits; > } > > -static void __init > -sio_fixup_irq_levels(unsigned int level_bits) > +static void __sio_fixup_irq_levels(unsigned int level_bits, bool reset) > { > unsigned int old_level_bits; > > @@ -139,10 +146,21 @@ sio_fixup_irq_levels(unsigned int level_bits) > */ > old_level_bits = inb(0x4d0) | (inb(0x4d1) << 8); > > - level_bits |= (old_level_bits & 0x71ff); > + if (reset) > + old_level_bits &= 0x71ff; > + > + level_bits |= old_level_bits; > > outb((level_bits >> 0) & 0xff, 0x4d0); > outb((level_bits >> 8) & 0xff, 0x4d1); > + > + pr_info("%s: level bits %x\n", __func__, level_bits); > +} > + > +static inline void > +sio_fixup_irq_levels(unsigned int level_bits) > +{ > + __sio_fixup_irq_levels(level_bits, true); > } > > static inline int > @@ -181,7 +199,14 @@ noname_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) > const long min_idsel = 6, max_idsel = 14, irqs_per_slot = 5; > int irq = COMMON_TABLE_LOOKUP, tmp; > tmp = __kernel_extbl(alpha_mv.sys.sio.route_tab, irq); > - return irq >= 0 ? tmp : -1; > + > + irq = irq >= 0 ? tmp : -1; > + > + /* Fixup IRQ level if an actual IRQ mapping is detected */ > + if (sio_pci_dev_irq_needs_level(dev) && irq >= 0) > + __sio_fixup_irq_levels(1 << irq, false); > + > + return irq; > } > > static inline int > -- > 2.15.0 >
[ 0.000000] Linux version 4.14.12 (mikulas@hydra) (gcc version 6.3.0 20170516 (Debian 6.3.0-18)) #4 Tue Jan 9 20:03:22 CET 2018 [ 0.000000] Booting on Avanti using machine vector Avanti from SRM [ 0.000000] Major Options: LEGACY_START VERBOSE_MCHECK MAGIC_SYSRQ [ 0.000000] Command line: ro root=/dev/hda1 console=ttyS0,115200 [ 0.000000] memcluster 0, usage 1, start 0, end 249 [ 0.000000] memcluster 1, usage 0, start 249, end 81919 [ 0.000000] memcluster 2, usage 1, start 81919, end 81920 [ 0.000000] freeing pages 249:384 [ 0.000000] freeing pages 1353:81919 [ 0.000000] reserving pages 1353:1355 [ 0.000000] 512K Bcache detected; load hit latency 17 cycles, load miss latency 113 cycles [ 0.000000] On node 0 totalpages: 81919 [ 0.000000] free_area_init_node: node 0, pgdat fffffc0000849470, node_mem_map fffffc0000a96000 [ 0.000000] DMA zone: 560 pages used for memmap [ 0.000000] DMA zone: 0 pages reserved [ 0.000000] DMA zone: 81919 pages, LIFO batch:15 [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 [ 0.000000] pcpu-alloc: [0] 0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 81359 [ 0.000000] Kernel command line: ro root=/dev/hda1 console=ttyS0,115200 [ 0.000000] PID hash table entries: 4096 (order: 2, 32768 bytes) [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 1048576 bytes) [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 524288 bytes) [ 0.000000] Sorting __ex_table... [ 0.000000] Memory: 639488K/655352K available (3905K kernel code, 292K rwdata, 1160K rodata, 136K init, 2156K bss, 15864K reserved, 0K cma-reserved) [ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [ 0.000000] NR_IRQS: 16 [ 0.000000] HWRPB cycle frequency bogus. Estimated 233363557 Hz [ 0.000000] Setting RTC_FREQ to 128 Hz (29) [ 0.000000] Console: colour dummy device 80x25 [ 0.140625] console [ttyS0] enabled [ 0.140625] Calibrating delay loop... 462.16 BogoMIPS (lpj=1806336) [ 0.187500] pid_max: default: 32768 minimum: 301 [ 0.195312] Mount-cache hash table entries: 2048 (order: 1, 16384 bytes) [ 0.203125] Mountpoint-cache hash table entries: 2048 (order: 1, 16384 bytes) [ 0.218750] devtmpfs: initialized [ 0.226562] random: get_random_u32 called from bucket_table_alloc+0x124/0x310 with crng_init=0 [ 0.234375] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 14931722236523437 ns [ 0.242187] futex hash table entries: 256 (order: -1, 6144 bytes) [ 0.250000] NET: Registered protocol family 16 [ 0.257812] PCI host bridge to bus 0000:00 [ 0.257812] pci_bus 0000:00: root bus resource [io 0x0000-0xffff] [ 0.265625] pci_bus 0000:00: root bus resource [mem 0x00000000-0x3fffffff] [ 0.273437] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff] [ 0.281250] pci 0000:00:06.0: [1000:0001] type 00 class 0x000000 [ 0.281250] pci 0000:00:06.0: reg 0x10: [io 0x10000-0x100ff] [ 0.281250] pci 0000:00:06.0: reg 0x14: [mem 0x82100100-0x821001ff] [ 0.281250] pci 0000:00:06.0: NCR 53c810 rev 1 PCI class overridden (0x000000 -> 0x010000) [ 0.289062] pci 0000:00:07.0: [8086:0484] type 00 class 0x000000 [ 0.296875] pci 0000:00:0b.0: [1011:0009] type 00 class 0x020000 [ 0.296875] pci 0000:00:0b.0: reg 0x10: [io 0x10100-0x1017f] [ 0.296875] pci 0000:00:0b.0: reg 0x14: [mem 0x82100200-0x8210027f] [ 0.296875] pci 0000:00:0b.0: reg 0x30: [mem 0x820c0000-0x820fffff pref] [ 0.296875] pci 0000:00:0c.0: [1011:0004] type 00 class 0x038000 [ 0.296875] pci 0000:00:0c.0: reg 0x10: [mem 0x88000000-0x89ffffff pref] [ 0.296875] pci 0000:00:0c.0: reg 0x30: [mem 0x82080000-0x820bffff pref] [ 0.296875] pci 0000:00:0d.0: [1095:0680] type 00 class 0x010400 [ 0.296875] pci 0000:00:0d.0: reg 0x10: [io 0x101c0-0x101c7] [ 0.296875] pci 0000:00:0d.0: reg 0x14: [io 0x101b0-0x101b3] [ 0.296875] pci 0000:00:0d.0: reg 0x18: [io 0x101a0-0x101a7] [ 0.296875] pci 0000:00:0d.0: reg 0x1c: [io 0x10190-0x10193] [ 0.296875] pci 0000:00:0d.0: reg 0x20: [io 0x10180-0x1018f] [ 0.296875] pci 0000:00:0d.0: reg 0x24: [mem 0x82100000-0x821000ff] [ 0.296875] pci 0000:00:0d.0: reg 0x30: [mem 0x82000000-0x8207ffff pref] [ 0.296875] pci 0000:00:0d.0: supports D1 D2 [ 0.296875] pci: enabling save/restore of SRM state [ 0.304687] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00 [ 0.304687] pci 0000:00:0c.0: BAR 0: assigned [mem 0x02000000-0x03ffffff pref] [ 0.312500] pci 0000:00:0d.0: BAR 6: assigned [mem 0x01200000-0x0127ffff pref] [ 0.320312] pci 0000:00:0b.0: BAR 6: assigned [mem 0x01280000-0x012bffff pref] [ 0.328125] pci 0000:00:0c.0: BAR 6: assigned [mem 0x012c0000-0x012fffff pref] [ 0.335937] pci 0000:00:06.0: BAR 0: assigned [io 0x8000-0x80ff] [ 0.343750] pci 0000:00:06.0: BAR 1: assigned [mem 0x01300000-0x013000ff] [ 0.343750] pci 0000:00:0d.0: BAR 5: assigned [mem 0x01301000-0x013010ff] [ 0.351562] pci 0000:00:0b.0: BAR 0: assigned [io 0x8400-0x847f] [ 0.359375] pci 0000:00:0b.0: BAR 1: assigned [mem 0x01302000-0x0130207f] [ 0.367187] pci 0000:00:0d.0: BAR 4: assigned [io 0x8480-0x848f] [ 0.375000] pci 0000:00:0d.0: BAR 0: assigned [io 0x8490-0x8497] [ 0.382812] pci 0000:00:0d.0: BAR 2: assigned [io 0x8498-0x849f] [ 0.382812] pci 0000:00:0d.0: BAR 1: assigned [io 0x84a0-0x84a3] [ 0.390625] pci 0000:00:0d.0: BAR 3: assigned [io 0x84a4-0x84a7] [ 0.398437] pci_bus 0000:00: resource 4 [io 0x0000-0xffff] [ 0.398437] pci_bus 0000:00: resource 5 [mem 0x00000000-0x3fffffff] [ 0.398437] sio_pci_route: PIRQ original 0xb0a0905 new 0xb0a050f [ 0.406250] __sio_fixup_irq_levels: level bits e20 [ 0.414062] Found PC87332 Super IO chip at 0x26e [ 0.414062] PC873xx enabling EPP v1.9 [ 0.437500] vgaarb: loaded [ 0.492187] NET: Registered protocol family 2 [ 0.500000] TCP established hash table entries: 8192 (order: 3, 65536 bytes) [ 0.507812] TCP bind hash table entries: 8192 (order: 3, 65536 bytes) [ 0.515625] TCP: Hash tables configured (established 8192 bind 8192) [ 0.523437] UDP hash table entries: 512 (order: 1, 16384 bytes) [ 0.531250] UDP-Lite hash table entries: 512 (order: 1, 16384 bytes) [ 0.539062] PCI: CLS 64 bytes, default 32 [ 0.546875] Using epoch 2000 for rtc year 18 [ 0.546875] platform rtc-alpha: rtc core: registered rtc-alpha as rtc0 [ 0.562500] workingset: timestamp_bits=62 max_order=17 bucket_order=0 [ 0.625000] random: fast init done [ 0.632812] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253) [ 0.640625] io scheduler noop registered [ 0.640625] io scheduler cfq registered (default) [ 0.648437] __sio_fixup_irq_levels: level bits e20 [ 0.664062] Console: switching to colour frame buffer device 80x30 [ 0.679687] tgafb: DC21030 [TGA] detected, rev=0x02 [ 0.687500] tgafb: at PCI bus 0, device 12, function 0 [ 0.687500] fb0: Digital ZLXp-E1 frame buffer device at 0x2000000 [ 0.695312] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled [ 0.710937] serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A [ 0.726562] serial8250: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A [ 0.734375] Uniform Multi-Platform E-IDE driver [ 0.742187] __sio_fixup_irq_levels: level bits e20 [ 0.742187] siimage 0000:00:0d.0: IDE controller (0x1095:0x0680 rev 0x02) [ 0.750000] siimage 0000:00:0d.0: BASE CLOCK == 133 [ 0.757812] siimage 0000:00:0d.0: 100% native mode on irq 10 [ 0.765625] ide0: MMIO-DMA [ 0.765625] ide1: MMIO-DMA [ 0.765625] Probing IDE interface ide0... [ 1.132812] hda: WDC WD400BB-00DEA0, ATA DISK drive [ 1.976562] hda: host max PIO4 wanted PIO255(auto-tune) selected PIO4 [ 1.976562] hda: UDMA/100 mode selected [ 1.976562] Probing IDE interface ide1... [ 2.687500] ide0 at 0xfffffc0301301080-0xfffffc0301301087,0xfffffc030130108a on irq 10 [ 2.695312] ide1 at 0xfffffc03013010c0-0xfffffc03013010c7,0xfffffc03013010ca on irq 10 [ 2.703125] ide-gd driver 1.18 [ 2.703125] hda: max request size: 64KiB [ 2.773437] hda: 78165360 sectors (40020 MB) w/2048KiB Cache, CHS=65535/16/63 [ 2.781250] hda: cache flushes not supported [ 2.789062] hda: hda1 hda2 [ 2.804687] serio: i8042 KBD port at 0x60,0x64 irq 1 [ 2.812500] serio: i8042 AUX port at 0x60,0x64 irq 12 [ 2.820312] mousedev: PS/2 mouse device common for all mice [ 2.828125] platform rtc-alpha: setting system clock to 2018-01-09 20:08:12 UTC (1515528492) [ 2.843750] atkbd serio0: keyboard reset failed on isa0060/serio0 [ 2.898437] atkbd serio1: keyboard reset failed on isa0060/serio1 [ 3.195312] VFS: Mounted root (spadfs filesystem) readonly on device 3:1. [ 3.203125] devtmpfs: mounted [ 3.210937] Freeing unused kernel memory: 136K [ 3.210937] This architecture does not have kernel memory protection. [ 5.203125] NET: Registered protocol family 1 [ 10.914062] tulip: Linux Tulip driver version 1.1.15-NAPI (Feb 27, 2007) [ 10.921875] __sio_fixup_irq_levels: level bits 8e20 [ 10.929687] tulip0: EEPROM default media type Autosense [ 10.937500] tulip0: Index #0 - Media MII (#11) described by a 21140 MII PHY (1) block [ 10.953125] tulip0: MII transceiver #5 config 2100 status 780f advertising 01e1 [ 10.968750] net eth0: Digital DS21140 Tulip rev 34 at MMIO 0x1302000, 00:00:f8:10:0b:42, IRQ 15 [ 11.109375] input: PC Speaker as /devices/platform/pcspkr/input/input2 [ 11.148437] SCSI subsystem initialized [ 11.335937] random: crng init done [ 11.531250] __sio_fixup_irq_levels: level bits 8e20 [ 11.539062] sym0: <810> rev 0x1 at pci 0000:00:06.0 irq 11 [ 11.750000] sym0: No NVRAM, ID 7, Fast-10, SE, parity checking [ 11.750000] sym0: SCSI BUS has been reset. [ 11.757812] scsi host0: sym-2.2.3 [ 13.796875] hda: task_no_data_intr: status=0x51 { DriveReady SeekComplete Error } [ 13.804687] hda: task_no_data_intr: error=0x04 { DriveStatusError } [ 13.812500] hda: possibly failed opcode: 0xef [ 15.140625] scsi 0:0:0:0: Direct-Access DEC RZ28M (C) DEC 0616 PQ: 0 ANSI: 2 [ 15.148437] scsi target0:0:0: tagged command queuing enabled, command queue depth 16. [ 15.156250] scsi target0:0:0: Beginning Domain Validation [ 15.203125] scsi target0:0:0: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 8) [ 15.242187] scsi target0:0:0: Domain Validation skipping write tests [ 15.242187] scsi target0:0:0: Ending Domain Validation [ 15.265625] scsi 0:0:1:0: Direct-Access SEAGATE ST39216N 0005 PQ: 0 ANSI: 3 [ 15.273437] scsi target0:0:1: tagged command queuing enabled, command queue depth 16. [ 15.281250] scsi target0:0:1: Beginning Domain Validation [ 15.328125] scsi target0:0:1: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 8) [ 15.343750] scsi target0:0:1: Domain Validation skipping write tests [ 15.351562] scsi target0:0:1: Ending Domain Validation [ 15.375000] scsi 0:0:2:0: Direct-Access DEC RZ28M (C) DEC 0616 PQ: 0 ANSI: 2 [ 15.382812] scsi target0:0:2: tagged command queuing enabled, command queue depth 16. [ 15.390625] scsi target0:0:2: Beginning Domain Validation [ 15.570312] scsi target0:0:2: FAST-10 SCSI 10.0 MB/s ST (100 ns, offset 8) [ 15.585937] scsi target0:0:2: Domain Validation skipping write tests [ 15.593750] scsi target0:0:2: Ending Domain Validation [ 15.921875] scsi 0:0:4:0: CD-ROM DEC RRD45 (C) DEC 0436 PQ: 0 ANSI: 2 [ 15.929687] scsi target0:0:4: Beginning Domain Validation [ 16.031250] scsi target0:0:4: FAST-5 SCSI 4.2 MB/s ST (236 ns, offset 8) [ 16.054687] scsi target0:0:4: Domain Validation skipping write tests [ 16.062500] scsi target0:0:4: Ending Domain Validation [ 16.921875] scsi 0:0:0:0: Attached scsi generic sg0 type 0 [ 16.945312] scsi 0:0:1:0: Attached scsi generic sg1 type 0 [ 16.960937] scsi 0:0:2:0: Attached scsi generic sg2 type 0 [ 16.968750] scsi 0:0:4:0: Attached scsi generic sg3 type 5 [ 17.031250] sd 0:0:0:0: [sda] 4110480 512-byte logical blocks: (2.10 GB/1.96 GiB) [ 17.039062] sd 0:0:1:0: [sdb] 17942584 512-byte logical blocks: (9.19 GB/8.56 GiB) [ 17.062500] sd 0:0:2:0: [sdc] 4110480 512-byte logical blocks: (2.10 GB/1.96 GiB) [ 17.093750] sd 0:0:0:0: [sda] Write Protect is off [ 17.093750] sd 0:0:0:0: [sda] Mode Sense: 7b 00 10 08 [ 17.093750] sd 0:0:1:0: [sdb] Write Protect is off [ 17.101562] sd 0:0:1:0: [sdb] Mode Sense: 9f 00 10 08 [ 17.101562] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, supports DPO and FUA [ 17.117187] sd 0:0:2:0: [sdc] Write Protect is off [ 17.125000] sd 0:0:2:0: [sdc] Mode Sense: 7b 00 10 08 [ 17.164062] sd 0:0:1:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA [ 17.195312] sd 0:0:2:0: [sdc] Write cache: disabled, read cache: enabled, supports DPO and FUA [ 17.335937] sr 0:0:4:0: [sr0] scsi-1 drive [ 17.343750] cdrom: Uniform CD-ROM driver Revision: 3.20 [ 17.359375] sda: sda1 sda2 sda3 [ 17.398437] sdc: sdc1 sdc2 [ 17.421875] sd 0:0:1:0: [sdb] Attached SCSI disk [ 17.437500] sd 0:0:0:0: [sda] Attached SCSI disk [ 17.445312] sr 0:0:4:0: Attached scsi CD-ROM sr0 [ 17.476562] sd 0:0:2:0: [sdc] Attached SCSI disk [ 18.187500] NET: Registered protocol family 17 [ 19.531250] sd 0:0:0:0: phase change 2-7 16@65b36360 resid=10. [ 19.546875] sd 0:0:0:0: phase change 2-7 16@65b36360 resid=10. [ 19.562500] sd 0:0:2:0: phase change 2-7 16@65b36360 resid=10. [ 19.578125] sd 0:0:2:0: phase change 2-7 16@65b36360 resid=10. [ 23.937500] tulip 0000:00:0b.0 eth0: tulip_stop_rxtx() failed (CSR5 0xfc660000 CSR6 0x320e2202) [ 23.937500] net eth0: Setting full-duplex based on MII#5 link partner capability of 85e1 [ 39.023437] Adding 4177912k swap on /swap. Priority:-2 extents:1 across:4177912k [ 41.609375] Adding 4177912k swap on /swap2. Priority:-3 extents:1 across:4177912k [ 43.984375] loop: module loaded [ 65.578125] NET: Registered protocol family 10 [ 65.625000] Segment Routing with IPv6