On Mon, Jul 30, 2018 at 05:05:15PM +1000, NeilBrown wrote: > On Mon, Jul 30 2018, Sergio Paracuellos wrote: > > > On Mon, Jul 30, 2018 at 03:20:47PM +1000, NeilBrown wrote: > >> On Fri, Jul 27 2018, Sergio Paracuellos wrote: > >> > >> > map_bus callback is called before every .read/.write operation. > >> > Implement it and change custom read write operations for the > >> > pci subsystem generics. Make the probe function to don't use > >> > legacy stuff and request bus resources directly. Get pci register > >> > base from device tree. > >> > > >> > Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx> > >> > >> Thanks for your persistence! > >> Something still isn't right ... weird hangs, though my serial connector > >> seems to be causing problems, which doesn't help. > >> > >> I tried one patch at a time, and this first patch doesn't work. > >> > >> It gets to pcibios_align_resource() and crashes because in: > >> if (start < PCIBIOS_MIN_MEM + hose->mem_resource->start) > >> start = PCIBIOS_MIN_MEM + hose->mem_resource->start; > >> > >> hose->mem_resource (which is pcie->mem_resource in mt7621_pci_probe()) > >> is NULL. > >> > >> The call stack is: > >> > >> [ 2.490000] Call Trace: > >> [ 2.500000] [<804a5948>] pcibios_align_resource+0xa0/0xb4 > >> [ 2.510000] [<8002ceb4>] __find_resource+0x150/0x230 > >> [ 2.520000] [<8002d17c>] allocate_resource+0x1e8/0x224 > >> [ 2.530000] [<80365e94>] pci_bus_alloc_resource+0x168/0x1c8 > >> [ 2.540000] [<80374450>] _pci_assign_resource+0xa8/0x180 > >> [ 2.550000] [<803749a4>] pci_assign_resource+0xf4/0x25c > >> [ 2.560000] [<80376820>] assign_requested_resources_sorted+0x90/0xe4 > >> [ 2.570000] [<803771ec>] __assign_resources_sorted+0x110/0x4f8 > >> [ 2.580000] [<80378618>] __pci_bus_assign_resources+0x74/0x240 > >> [ 2.590000] [<803790c8>] pci_assign_unassigned_bus_resources+0x70/0xe8 > >> [ 2.610000] [<804998f8>] mt7621_pci_probe+0x9e8/0xa44 > >> [ 2.620000] [<803b1708>] platform_drv_probe+0x40/0x7c > >> [ 2.630000] [<803afc88>] driver_probe_device+0x31c/0x474 > >> [ 2.640000] [<803afe94>] __driver_attach+0xb4/0x138 > >> [ 2.650000] [<803ad730>] bus_for_each_dev+0x6c/0xb0 > >> [ 2.650000] [<803ae968>] bus_add_driver+0x204/0x24c > >> [ 2.660000] [<803b07d8>] driver_register+0xd0/0x118 > >> [ 2.670000] [<80001618>] do_one_initcall+0x84/0x19c > >> [ 2.680000] [<80741ed0>] kernel_init_freeable+0x248/0x250 > >> [ 2.690000] [<805f549c>] kernel_init+0x14/0x110 > >> > >> So presumably the resources aren't getting initialised properly? > > > > I think you cannot take this separately because it is mixing > > pci legacy code with the new one. > > That's a same. It is generally best if each patch is correct in itself. > It makes review and bisecting much harder if that isn't the case. Yes, you are right. That is the best but it gets a difficult diff to be easily reviewed. Maybe I can reorder a bit patches to get things easier to review. > > I've sprinkled printks around, and it is hanging in ahci_enable_ahci(): > > [ 9.610000] [<803f61b8>] ahci_enable_ahci+0x40/0x144 > [ 9.620000] [<803f6860>] ahci_save_initial_config+0x48/0x428 > [ 9.630000] [<803f49a4>] ahci_init_one+0x4d4/0xb40 > [ 9.640000] [<80371a70>] pci_device_probe+0x90/0x120 > [ 9.650000] [<803afca8>] driver_probe_device+0x31c/0x474 > [ 9.660000] [<803afeb4>] __driver_attach+0xb4/0x138 > [ 9.670000] [<803ad750>] bus_for_each_dev+0x6c/0xb0 > [ 9.680000] [<803ae988>] bus_add_driver+0x204/0x24c > [ 9.690000] [<803b07f8>] driver_register+0xd0/0x118 > [ 9.700000] [<80001618>] do_one_initcall+0x84/0x19c > [ 9.710000] [<80741ed0>] kernel_init_freeable+0x248/0x250 > [ 9.720000] [<805f50bc>] kernel_init+0x14/0x110 > > I have a printk() immediately after the readl() at the top of the > function, and sometimes parts of that are printed, and sometimes not. > So that 'readl' must be causing a problem. > The address it reads from is c4017004. > The value it reads (when it actually gets printed) is 409a1000. > (without patches, it reads from the same place and the returned value is > 80000002 - so something's probably mapped wrongly). Yes the assigned BAR's in one and another trace are very different, and that is not good at all. I am going to try another approach closer to the actual legacy-code implementation and see what happends. I hope to send v6 with those changes tonight (GMT+2). > > The dmesg with patches applied is > > [ 0.000000] Linux version 4.18.0-rc5+ (neilb@noble) (gcc version 7.2.0 (GCC)) #250 SMP Mon Jul 30 16:49:51 AEST 2018 > [ 0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3 > [ 0.000000] bootconsole [early0] enabled > [ 0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc) > [ 0.000000] MIPS: machine is GB-PC1 > [ 0.000000] Determined physical RAM map: > [ 0.000000] memory: 1c000000 @ 00000000 (usable) > [ 0.000000] memory: 04000000 @ 20000000 (usable) > [ 0.000000] Initrd not found or empty - disabling initrd > [ 0.000000] VPE topology {2,2} total 4 > [ 0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. > [ 0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes > [ 0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes. > [ 0.000000] Zone ranges: > [ 0.000000] Normal [mem 0x0000000000000000-0x000000001fffffff] > [ 0.000000] HighMem [mem 0x0000000020000000-0x0000000023ffffff] > [ 0.000000] Movable zone start for each node > [ 0.000000] Early memory node ranges > [ 0.000000] node 0: [mem 0x0000000000000000-0x000000001bffffff] > [ 0.000000] node 0: [mem 0x0000000020000000-0x0000000023ffffff] > [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000023ffffff] > [ 0.000000] random: get_random_bytes called from start_kernel+0xb4/0x4ec with crng_init=0 > [ 0.000000] percpu: Embedded 15 pages/cpu @(ptrval) s30480 r8192 d22768 u61440 > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 130048 > [ 0.000000] Kernel command line: console=ttyS0,57600 > [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) > [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) > [ 0.000000] Writing ErrCtl register=00014882 > [ 0.000000] Readback ErrCtl register=00014882 > [ 0.000000] Memory: 504788K/524288K available (6131K kernel code, 232K rwdata, 1052K rodata, 6524K init, 241K bss, 19500K reserved, 0K cma-reserved, 65536K highmem) > [ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 > [ 0.000000] Hierarchical RCU implementation. > [ 0.000000] NR_IRQS: 256 > [ 0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcf914c9718, max_idle_ns: 440795231327 ns > [ 0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns > [ 0.010000] Calibrating delay loop... 597.60 BogoMIPS (lpj=2988032) > [ 0.070000] pid_max: default: 32768 minimum: 301 > [ 0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) > [ 0.090000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) > [ 0.100000] Hierarchical SRCU implementation. > [ 0.110000] smp: Bringing up secondary CPUs ... > [ 0.120000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. > [ 0.120000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes > [ 0.120000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes. > [ 0.120000] CPU1 revision is: 0001992f (MIPS 1004Kc) > [ 0.180000] Synchronize counters for CPU 1: done. > [ 0.220000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. > [ 0.220000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes > [ 0.220000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes. > [ 0.220000] CPU2 revision is: 0001992f (MIPS 1004Kc) > [ 0.280000] Synchronize counters for CPU 2: done. > [ 0.320000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. > [ 0.320000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes > [ 0.320000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes. > [ 0.320000] CPU3 revision is: 0001992f (MIPS 1004Kc) > [ 0.380000] Synchronize counters for CPU 3: done. > [ 0.420000] smp: Brought up 1 node, 4 CPUs > [ 0.430000] devtmpfs: initialized > [ 0.480000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns > [ 0.490000] futex hash table entries: 1024 (order: 3, 32768 bytes) > [ 0.500000] pinctrl core: initialized pinctrl subsystem > [ 0.510000] NET: Registered protocol family 16 > [ 0.870000] ***** Xtal 40MHz ***** > [ 0.880000] Port 0 N_FTS = 1b102800 > [ 0.880000] Port 1 N_FTS = 1b102800 > [ 0.890000] Port 2 N_FTS = 1b102800 > [ 1.950000] PCIE0 enabled > [ 1.950000] PCIE1 enabled > [ 1.960000] PCIE2 enabled > [ 1.960000] mt7621-pci 1e140000.pcie: host bridge /pcie@1e140000 ranges: > [ 1.980000] mt7621-pci 1e140000.pcie: MEM 0x60000000..0x6fffffff -> 0x00000000 > [ 1.990000] mt7621-pci 1e140000.pcie: IO 0x1e160000..0x1e16ffff -> 0x00000000 > [ 2.010000] mt7621-pci 1e140000.pcie: PCI host bridge to bus 0000:00 > [ 2.020000] pci_bus 0000:00: root bus resource [bus 00-ff] > [ 2.030000] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff] (bus address [0x00000000-0x0fffffff]) > [ 2.050000] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring > [ 2.070000] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring > [ 2.080000] pci 0000:00:02.0: bridge configuration invalid ([bus 00-00]), reconfiguring > [ 2.100000] pci 0000:00:00.0: PCI bridge to [bus 01-ff] > [ 2.120000] pci 0000:00:01.0: PCI bridge to [bus 02-ff] > [ 2.130000] pci 0000:00:02.0: PCI bridge to [bus 03-ff] > [ 2.140000] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000] > [ 2.150000] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000] > [ 2.170000] pci 0000:00:01.0: BAR 0: no space for [mem size 0x80000000] > [ 2.180000] pci 0000:00:01.0: BAR 0: failed to assign [mem size 0x80000000] > [ 2.190000] pci 0000:00:02.0: BAR 0: no space for [mem size 0x80000000] > [ 2.210000] pci 0000:00:02.0: BAR 0: failed to assign [mem size 0x80000000] > [ 2.220000] pci 0000:00:00.0: BAR 8: assigned [mem 0x60000000-0x600fffff] > [ 2.230000] pci 0000:00:00.0: BAR 9: assigned [mem 0x60100000-0x601fffff pref] > [ 2.250000] pci 0000:00:01.0: BAR 8: assigned [mem 0x60200000-0x602fffff] > [ 2.260000] pci 0000:00:01.0: BAR 9: assigned [mem 0x60300000-0x603fffff pref] > [ 2.270000] pci 0000:00:02.0: BAR 8: assigned [mem 0x60400000-0x604fffff] > [ 2.290000] pci 0000:00:02.0: BAR 9: assigned [mem 0x60500000-0x605fffff pref] > [ 2.300000] pci 0000:00:00.0: BAR 1: assigned [mem 0x60600000-0x6060ffff] > [ 2.320000] pci 0000:00:01.0: BAR 1: assigned [mem 0x60610000-0x6061ffff] > [ 2.330000] pci 0000:00:02.0: BAR 1: assigned [mem 0x60620000-0x6062ffff] This BAR9 is a bit odd and it is not in the original trace. > [ 2.340000] pci 0000:00:00.0: BAR 7: no space for [io size 0x1000] > [ 2.350000] pci 0000:00:00.0: BAR 7: failed to assign [io size 0x1000] > [ 2.370000] pci 0000:00:01.0: BAR 7: no space for [io size 0x1000] > [ 2.380000] pci 0000:00:01.0: BAR 7: failed to assign [io size 0x1000] > [ 2.390000] pci 0000:00:02.0: BAR 7: no space for [io size 0x1000] > [ 2.400000] pci 0000:00:02.0: BAR 7: failed to assign [io size 0x1000] > [ 2.420000] pci 0000:01:00.0: BAR 5: assigned [mem 0x60000000-0x600001ff] > [ 2.430000] pci 0000:01:00.0: BAR 4: no space for [io size 0x0010] > [ 2.440000] pci 0000:01:00.0: BAR 4: failed to assign [io size 0x0010] > [ 2.460000] pci 0000:01:00.0: BAR 0: no space for [io size 0x0008] > [ 2.470000] pci 0000:01:00.0: BAR 0: failed to assign [io size 0x0008] > [ 2.480000] pci 0000:01:00.0: BAR 2: no space for [io size 0x0008] > [ 2.490000] pci 0000:01:00.0: BAR 2: failed to assign [io size 0x0008] > [ 2.510000] pci 0000:01:00.0: BAR 1: no space for [io size 0x0004] > [ 2.520000] pci 0000:01:00.0: BAR 1: failed to assign [io size 0x0004] > [ 2.530000] pci 0000:01:00.0: BAR 3: no space for [io size 0x0004] > [ 2.540000] pci 0000:01:00.0: BAR 3: failed to assign [io size 0x0004] > [ 2.560000] pci 0000:00:00.0: PCI bridge to [bus 01] > [ 2.570000] pci 0000:00:00.0: bridge window [mem 0x60000000-0x600fffff] > [ 2.580000] pci 0000:00:00.0: bridge window [mem 0x60100000-0x601fffff pref] > [ 2.590000] pci 0000:02:00.0: BAR 5: assigned [mem 0x60200000-0x602001ff] > [ 2.610000] pci 0000:02:00.0: BAR 4: no space for [io size 0x0010] > [ 2.620000] pci 0000:02:00.0: BAR 4: failed to assign [io size 0x0010] > [ 2.630000] pci 0000:02:00.0: BAR 0: no space for [io size 0x0008] > [ 2.640000] pci 0000:02:00.0: BAR 0: failed to assign [io size 0x0008] > [ 2.660000] pci 0000:02:00.0: BAR 2: no space for [io size 0x0008] > [ 2.670000] pci 0000:02:00.0: BAR 2: failed to assign [io size 0x0008] > [ 2.680000] pci 0000:02:00.0: BAR 1: no space for [io size 0x0004] > [ 2.700000] pci 0000:02:00.0: BAR 1: failed to assign [io size 0x0004] > [ 2.710000] pci 0000:02:00.0: BAR 3: no space for [io size 0x0004] > [ 2.720000] pci 0000:02:00.0: BAR 3: failed to assign [io size 0x0004] > [ 2.730000] pci 0000:00:01.0: PCI bridge to [bus 02] > [ 2.740000] pci 0000:00:01.0: bridge window [mem 0x60200000-0x602fffff] > [ 2.760000] pci 0000:00:01.0: bridge window [mem 0x60300000-0x603fffff pref] > [ 2.770000] pci 0000:03:00.0: BAR 5: assigned [mem 0x60400000-0x604001ff] > [ 2.780000] pci 0000:03:00.0: BAR 4: no space for [io size 0x0010] > [ 2.800000] pci 0000:03:00.0: BAR 4: failed to assign [io size 0x0010] > [ 2.810000] pci 0000:03:00.0: BAR 0: no space for [io size 0x0008] > [ 2.820000] pci 0000:03:00.0: BAR 0: failed to assign [io size 0x0008] > [ 2.830000] pci 0000:03:00.0: BAR 2: no space for [io size 0x0008] > [ 2.850000] pci 0000:03:00.0: BAR 2: failed to assign [io size 0x0008] > [ 2.860000] pci 0000:03:00.0: BAR 1: no space for [io size 0x0004] > [ 2.870000] pci 0000:03:00.0: BAR 1: failed to assign [io size 0x0004] > [ 2.880000] pci 0000:03:00.0: BAR 3: no space for [io size 0x0004] > [ 2.900000] pci 0000:03:00.0: BAR 3: failed to assign [io size 0x0004] > [ 2.910000] pci 0000:00:02.0: PCI bridge to [bus 03] > [ 2.920000] pci 0000:00:02.0: bridge window [mem 0x60400000-0x604fffff] > [ 2.930000] pci 0000:00:02.0: bridge window [mem 0x60500000-0x605fffff pref] > [ 3.010000] random: fast init done > [ 3.020000] SCSI subsystem initialized > [ 3.040000] clocksource: Switched to clocksource GIC > [ 3.070000] NET: Registered protocol family 2 > [ 3.080000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes) > [ 3.100000] TCP established hash table entries: 4096 (order: 2, 16384 bytes) > [ 3.110000] TCP bind hash table entries: 4096 (order: 3, 32768 bytes) > [ 3.120000] TCP: Hash tables configured (established 4096 bind 4096) > [ 3.140000] UDP hash table entries: 256 (order: 1, 8192 bytes) > [ 3.150000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes) > [ 3.160000] NET: Registered protocol family 1 > [ 8.120000] Initialise system trusted keyrings > [ 8.130000] workingset: timestamp_bits=30 max_order=17 bucket_order=0 > [ 8.260000] squashfs: version 4.0 (2009/01/31) Phillip Lougher > [ 8.270000] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. > [ 8.300000] SGI XFS with security attributes, no debug enabled > [ 8.350000] Key type asymmetric registered > [ 8.360000] Asymmetric key parser 'x509' registered > [ 8.370000] bounce: pool size: 64 pages > [ 8.380000] io scheduler noop registered > [ 8.390000] io scheduler deadline registered (default) > [ 8.400000] io scheduler mq-deadline registered (default) > [ 8.410000] io scheduler kyber registered > [ 8.430000] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled > [ 8.450000] console [ttyS0] disabled > [ 8.460000] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 18, base_baud = 3125000) is a 16550A > [ 8.470000] console [ttyS0] enabled > [ 8.470000] console [ttyS0] enabled > [ 8.490000] bootconsole [early0] disabled > [ 8.490000] bootconsole [early0] disabled > [ 8.510000] cacheinfo: Failed to find cpu0 device node > [ 8.520000] cacheinfo: Unable to detect cache hierarchy for CPU 0 > [ 8.600000] loop: module loaded > [ 8.970000] pci 0000:00:00.0: enabling device (0004 -> 0006) > [ 9.340000] ahci 0000:01:00.0: enabling device (0000 -> 0002) It should just initializes this not enabling this because it is just access through the bridge 00:00.0 (which has properly Memory access (bit 1) and master bit (bit 2) set: 0006 -> 0000 0000 0000 0110). It is the same for all the bridges in original code. It is properly being enabled but it should not be enabling this as it is doing here. If you have interest PCI_COMMAND register layout is described here: https://wiki.osdev.org/PCI > > > Without the patches, the dmesg is : > > [ 0.000000] Linux version 4.18.0-rc5+ (neilb@noble) (gcc version 7.2.0 (GCC)) #251 SMP Mon Jul 30 16:57:08 AEST 2018 > [ 0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3 > [ 0.000000] bootconsole [early0] enabled > [ 0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc) > [ 0.000000] MIPS: machine is GB-PC1 > [ 0.000000] Determined physical RAM map: > [ 0.000000] memory: 1c000000 @ 00000000 (usable) > [ 0.000000] memory: 04000000 @ 20000000 (usable) > [ 0.000000] Initrd not found or empty - disabling initrd > [ 0.000000] VPE topology {2,2} total 4 > [ 0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. > [ 0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes > [ 0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes. > [ 0.000000] Zone ranges: > [ 0.000000] Normal [mem 0x0000000000000000-0x000000001fffffff] > [ 0.000000] HighMem [mem 0x0000000020000000-0x0000000023ffffff] > [ 0.000000] Movable zone start for each node > [ 0.000000] Early memory node ranges > [ 0.000000] node 0: [mem 0x0000000000000000-0x000000001bffffff] > [ 0.000000] node 0: [mem 0x0000000020000000-0x0000000023ffffff] > [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000023ffffff] > [ 0.000000] random: get_random_bytes called from start_kernel+0xb4/0x4ec with crng_init=0 > [ 0.000000] percpu: Embedded 15 pages/cpu @(ptrval) s30480 r8192 d22768 u61440 > [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 130048 > [ 0.000000] Kernel command line: console=ttyS0,57600 > [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) > [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) > [ 0.000000] Writing ErrCtl register=00014882 > [ 0.000000] Readback ErrCtl register=00014882 > [ 0.000000] Memory: 504788K/524288K available (6131K kernel code, 232K rwdata, 1052K rodata, 6524K init, 241K bss, 19500K reserved, 0K cma-reserved, 65536K highmem) > [ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 > [ 0.000000] Hierarchical RCU implementation. > [ 0.000000] NR_IRQS: 256 > [ 0.000000] clocksource: GIC: mask: 0xffffffffffffffff max_cycles: 0xcf914c9718, max_idle_ns: 440795231327 ns > [ 0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns > [ 0.010000] Calibrating delay loop... 597.60 BogoMIPS (lpj=2988032) > [ 0.070000] pid_max: default: 32768 minimum: 301 > [ 0.080000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) > [ 0.090000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) > [ 0.100000] Hierarchical SRCU implementation. > [ 0.110000] smp: Bringing up secondary CPUs ... > [ 0.120000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. > [ 0.120000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes > [ 0.120000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes. > [ 0.120000] CPU1 revision is: 0001992f (MIPS 1004Kc) > [ 0.180000] Synchronize counters for CPU 1: done. > [ 0.220000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. > [ 0.220000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes > [ 0.220000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes. > [ 0.220000] CPU2 revision is: 0001992f (MIPS 1004Kc) > [ 0.280000] Synchronize counters for CPU 2: done. > [ 0.320000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. > [ 0.320000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes > [ 0.320000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes. > [ 0.320000] CPU3 revision is: 0001992f (MIPS 1004Kc) > [ 0.380000] Synchronize counters for CPU 3: done. > [ 0.420000] smp: Brought up 1 node, 4 CPUs > [ 0.430000] devtmpfs: initialized > [ 0.480000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns > [ 0.490000] futex hash table entries: 1024 (order: 3, 32768 bytes) > [ 0.500000] pinctrl core: initialized pinctrl subsystem > [ 0.510000] NET: Registered protocol family 16 > [ 0.870000] ***** Xtal 40MHz ***** > [ 0.880000] Port 0 N_FTS = 1b102800 > [ 0.880000] Port 1 N_FTS = 1b102800 > [ 0.890000] Port 2 N_FTS = 1b102800 > [ 1.950000] PCIE0 enabled > [ 1.950000] PCIE1 enabled > [ 1.960000] PCIE2 enabled > [ 1.960000] PCI host bridge /pcie@1e140000 ranges: > [ 1.970000] MEM 0x0000000060000000..0x000000006fffffff > [ 1.980000] IO 0x000000001e160000..0x000000001e16ffff > [ 1.990000] PCI coherence region base: 0x60000000, mask/settings: 0xf0000002 This is the weird hack I was commented in my last mail. > [ 2.070000] SCSI subsystem initialized > [ 2.080000] PCI host bridge to bus 0000:00 > [ 2.090000] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff] > [ 2.110000] pci_bus 0000:00: root bus resource [io 0xffffffff] > [ 2.120000] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0] > [ 2.130000] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff] > [ 2.150000] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring > [ 2.170000] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring > [ 2.180000] pci 0000:00:02.0: bridge configuration invalid ([bus 00-00]), reconfiguring > [ 2.200000] random: fast init done > [ 2.210000] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000] > [ 2.230000] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000] > [ 2.240000] pci 0000:00:01.0: BAR 0: no space for [mem size 0x80000000] > [ 2.250000] pci 0000:00:01.0: BAR 0: failed to assign [mem size 0x80000000] > [ 2.270000] pci 0000:00:02.0: BAR 0: no space for [mem size 0x80000000] > [ 2.280000] pci 0000:00:02.0: BAR 0: failed to assign [mem size 0x80000000] > [ 2.290000] pci 0000:00:00.0: BAR 8: assigned [mem 0x60000000-0x600fffff] > [ 2.310000] pci 0000:00:01.0: BAR 8: assigned [mem 0x60100000-0x601fffff] > [ 2.320000] pci 0000:00:02.0: BAR 8: assigned [mem 0x60200000-0x602fffff] > [ 2.330000] pci 0000:00:00.0: BAR 1: assigned [mem 0x60300000-0x6030ffff] > [ 2.350000] pci 0000:00:01.0: BAR 1: assigned [mem 0x60310000-0x6031ffff] > [ 2.360000] pci 0000:00:02.0: BAR 1: assigned [mem 0x60320000-0x6032ffff] Here there is not BAR 9 at all. And all of this have much more sense. > [ 2.370000] pci 0000:00:00.0: BAR 7: no space for [io size 0x1000] > [ 2.380000] pci 0000:00:00.0: BAR 7: failed to assign [io size 0x1000] > [ 2.400000] pci 0000:00:01.0: BAR 7: no space for [io size 0x1000] > [ 2.410000] pci 0000:00:01.0: BAR 7: failed to assign [io size 0x1000] > [ 2.420000] pci 0000:00:02.0: BAR 7: no space for [io size 0x1000] > [ 2.440000] pci 0000:00:02.0: BAR 7: failed to assign [io size 0x1000] > [ 2.450000] pci 0000:01:00.0: BAR 5: assigned [mem 0x60000000-0x600001ff] > [ 2.460000] pci 0000:01:00.0: BAR 4: no space for [io size 0x0010] > [ 2.470000] pci 0000:01:00.0: BAR 4: failed to assign [io size 0x0010] > [ 2.490000] pci 0000:01:00.0: BAR 0: no space for [io size 0x0008] > [ 2.500000] pci 0000:01:00.0: BAR 0: failed to assign [io size 0x0008] > [ 2.510000] pci 0000:01:00.0: BAR 2: no space for [io size 0x0008] > [ 2.520000] pci 0000:01:00.0: BAR 2: failed to assign [io size 0x0008] > [ 2.540000] pci 0000:01:00.0: BAR 1: no space for [io size 0x0004] > [ 2.550000] pci 0000:01:00.0: BAR 1: failed to assign [io size 0x0004] > [ 2.560000] pci 0000:01:00.0: BAR 3: no space for [io size 0x0004] > [ 2.570000] pci 0000:01:00.0: BAR 3: failed to assign [io size 0x0004] > [ 2.590000] pci 0000:00:00.0: PCI bridge to [bus 01] > [ 2.600000] pci 0000:00:00.0: bridge window [mem 0x60000000-0x600fffff] > [ 2.610000] pci 0000:02:00.0: BAR 5: assigned [mem 0x60100000-0x601001ff] > [ 2.620000] pci 0000:02:00.0: BAR 4: no space for [io size 0x0010] > [ 2.640000] pci 0000:02:00.0: BAR 4: failed to assign [io size 0x0010] > [ 2.650000] pci 0000:02:00.0: BAR 0: no space for [io size 0x0008] > [ 2.660000] pci 0000:02:00.0: BAR 0: failed to assign [io size 0x0008] > [ 2.670000] pci 0000:02:00.0: BAR 2: no space for [io size 0x0008] > [ 2.690000] pci 0000:02:00.0: BAR 2: failed to assign [io size 0x0008] > [ 2.700000] pci 0000:02:00.0: BAR 1: no space for [io size 0x0004] > [ 2.710000] pci 0000:02:00.0: BAR 1: failed to assign [io size 0x0004] > [ 2.720000] pci 0000:02:00.0: BAR 3: no space for [io size 0x0004] > [ 2.740000] pci 0000:02:00.0: BAR 3: failed to assign [io size 0x0004] > [ 2.750000] pci 0000:00:01.0: PCI bridge to [bus 02] > [ 2.760000] pci 0000:00:01.0: bridge window [mem 0x60100000-0x601fffff] > [ 2.770000] pci 0000:03:00.0: BAR 5: assigned [mem 0x60200000-0x602001ff] > [ 2.790000] pci 0000:03:00.0: BAR 4: no space for [io size 0x0010] > [ 2.800000] pci 0000:03:00.0: BAR 4: failed to assign [io size 0x0010] > [ 2.810000] pci 0000:03:00.0: BAR 0: no space for [io size 0x0008] > [ 2.820000] pci 0000:03:00.0: BAR 0: failed to assign [io size 0x0008] > [ 2.840000] pci 0000:03:00.0: BAR 2: no space for [io size 0x0008] > [ 2.850000] pci 0000:03:00.0: BAR 2: failed to assign [io size 0x0008] > [ 2.860000] pci 0000:03:00.0: BAR 1: no space for [io size 0x0004] > [ 2.870000] pci 0000:03:00.0: BAR 1: failed to assign [io size 0x0004] > [ 2.890000] pci 0000:03:00.0: BAR 3: no space for [io size 0x0004] > [ 2.900000] pci 0000:03:00.0: BAR 3: failed to assign [io size 0x0004] > [ 2.910000] pci 0000:00:02.0: PCI bridge to [bus 03] > [ 2.920000] pci 0000:00:02.0: bridge window [mem 0x60200000-0x602fffff] > [ 2.940000] clocksource: Switched to clocksource GIC > [ 2.960000] NET: Registered protocol family 2 > [ 2.970000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes) > [ 2.990000] TCP established hash table entries: 4096 (order: 2, 16384 bytes) > [ 3.000000] TCP bind hash table entries: 4096 (order: 3, 32768 bytes) > [ 3.020000] TCP: Hash tables configured (established 4096 bind 4096) > [ 3.030000] UDP hash table entries: 256 (order: 1, 8192 bytes) > [ 3.040000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes) > [ 3.050000] NET: Registered protocol family 1 > [ 8.030000] Initialise system trusted keyrings > [ 8.040000] workingset: timestamp_bits=30 max_order=17 bucket_order=0 > [ 8.160000] squashfs: version 4.0 (2009/01/31) Phillip Lougher > [ 8.170000] jffs2: version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. > [ 8.200000] SGI XFS with security attributes, no debug enabled > [ 8.250000] Key type asymmetric registered > [ 8.250000] Asymmetric key parser 'x509' registered > [ 8.260000] bounce: pool size: 64 pages > [ 8.270000] io scheduler noop registered > [ 8.280000] io scheduler deadline registered (default) > [ 8.290000] io scheduler mq-deadline registered (default) > [ 8.300000] io scheduler kyber registered > [ 8.320000] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled > [ 8.340000] console [ttyS0] disabled > [ 8.350000] 1e000c00.uartlite: ttyS0 at MMIO 0x1e000c00 (irq = 18, base_baud = 3125000) is a 16550A > [ 8.370000] console [ttyS0] enabled > [ 8.370000] console [ttyS0] enabled > [ 8.380000] bootconsole [early0] disabled > [ 8.380000] bootconsole [early0] disabled > [ 8.400000] cacheinfo: Failed to find cpu0 device node > [ 8.410000] cacheinfo: Unable to detect cache hierarchy for CPU 0 > [ 8.490000] loop: module loaded > [ 8.500000] pci 0000:00:00.0: enabling device (0004 -> 0006) > [ 8.510000] ahci 0000:01:00.0: SSS flag set, parallel bus scan disabled > [ 8.520000] ahci 0000:01:00.0: AHCI 0001.0200 32 slots 2 ports 6 Gbps 0x3 impl IDE mode > [ 8.540000] ahci 0000:01:00.0: flags: 64bit ncq sntf stag led clo pmp pio slum part ccc sxs Enables ONLY the bridge to access the attached device. > [ 8.560000] scsi host0: ahci > [ 8.570000] scsi host1: ahci > [ 8.580000] ata1: SATA max UDMA/133 abar m512@0x60000000 port 0x60000100 irq 23 > [ 8.600000] ata2: SATA max UDMA/133 abar m512@0x60000000 port 0x60000180 irq 23 > [ 8.610000] pci 0000:00:01.0: enabling device (0004 -> 0006) > [ 8.620000] ahci 0000:02:00.0: SSS flag set, parallel bus scan disabled > [ 8.640000] ahci 0000:02:00.0: AHCI 0001.0200 32 slots 2 ports 6 Gbps 0x3 impl IDE mode > [ 8.650000] ahci 0000:02:00.0: flags: 64bit ncq sntf stag led clo pmp pio slum part ccc sxs Enables ONLY the bridge to access the attached device. > [ 8.680000] scsi host2: ahci > [ 8.690000] scsi host3: ahci > [ 8.690000] ata3: SATA max UDMA/133 abar m512@0x60100000 port 0x60100100 irq 24 > [ 8.710000] ata4: SATA max UDMA/133 abar m512@0x60100000 port 0x60100180 irq 24 > [ 8.720000] pci 0000:00:02.0: enabling device (0004 -> 0006) > [ 8.740000] ahci 0000:03:00.0: SSS flag set, parallel bus scan disabled > [ 8.750000] ahci 0000:03:00.0: AHCI 0001.0200 32 slots 2 ports 6 Gbps 0x3 impl IDE mode > [ 8.770000] ahci 0000:03:00.0: flags: 64bit ncq sntf stag led clo pmp pio slum part ccc sxs Enables ONLY the bridge to access the attached device. > [ 8.790000] scsi host4: ahci > [ 8.800000] scsi host5: ahci > [ 8.810000] ata5: SATA max UDMA/133 abar m512@0x60200000 port 0x60200100 irq 25 > [ 8.820000] ata6: SATA max UDMA/133 abar m512@0x60200000 port 0x60200180 irq 25 > [ 8.840000] libphy: Fixed MDIO Bus: probed > [ 8.850000] tun: Universal TUN/TAP device driver, 1.6 > [ 8.870000] sdhci: Secure Digital Host Controller Interface driver > [ 8.880000] sdhci: Copyright(c) Pierre Ossman > [ 8.890000] spi-mt7621 1e000b00.spi: sys_freq: 225000000 > [ 8.900000] m25p80 spi0.0: w25q256 (32768 Kbytes) > [ 8.910000] 4 fixed-partitions partitions found on MTD device spi0.0 > [ 8.930000] Creating 4 MTD partitions on "spi0.0": > [ 8.940000] 0x000000000000-0x000000030000 : "u-boot" > [ 8.940000] ata1: SATA link down (SStatus 0 SControl 300) > [ 8.950000] 0x000000030000-0x000000040000 : "u-boot-env" > [ 8.970000] 0x000000040000-0x000000050000 : "factory" > [ 8.990000] 0x000000050000-0x000002000000 : "firmware" > [ 9.060000] libphy: mdio: probed > [ 9.060000] ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) > [ 9.080000] ata3.00: ATA-8: Hitachi HDS721010CLA332, JP4OA3EA, max UDMA/133 > [ 9.090000] ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 32), AA > [ 9.110000] ata3.00: configured for UDMA/133 > [ 9.130000] mtk_soc_eth 1e100000.ethernet: generated random MAC address 7e:0f:08:c9:54:ca > [ 9.150000] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 21 > [ 9.170000] ata5: SATA link down (SStatus 0 SControl 300) > [ 9.180000] NET: Registered protocol family 10 > [ 9.200000] Segment Routing with IPv6 > [ 9.210000] NET: Registered protocol family 17 > [ 9.220000] 8021q: 802.1Q VLAN Support v1.8 > [ 9.230000] Loading compiled-in X.509 certificates > [ 9.250000] hctosys: unable to open rtc device (rtc0) > [ 9.280000] mmc0: new high speed SD card at address 0002 > [ 9.300000] ata2: SATA link down (SStatus 0 SControl 300) > [ 9.310000] mmcblk0: mmc0:0002 00000 1.88 GiB > [ 9.310000] scsi 2:0:0:0: Direct-Access ATA Hitachi HDS72101 A3EA PQ: 0 ANSI: 5 > [ 9.340000] sd 2:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB) > [ 9.360000] sd 2:0:0:0: [sda] Write Protect is off > [ 9.370000] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA > [ 9.400000] sda: sda1 sda2 sda3 sda4 > [ 9.420000] sd 2:0:0:0: [sda] Attached SCSI disk > [ 9.670000] ata4: SATA link down (SStatus 0 SControl 300) > [ 10.010000] ata6: SATA link down (SStatus 0 SControl 300) > > > does not work... Anyway we should check that bridges have properly set the 'master' > > bit before it hangs. This can be done just reading the PCI_COMMAND register with > > pci_read_config_word. The bit it should be set is the bit 2. > > Could you give me some code and tell me where to put it? As I have just said I'll send new v6 getting the resources in a closer way it is being doing now. The bridges are properly being enabled but the mapping are not being properly created with the patches applied. > > Thanks, > NeilBrown This was really helpful. Thank you very much. Best regards, Sergio Paracuellos _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel