On Thu, Jul 26, 2018 at 1:24 PM, Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx> wrote: > On Thu, Jul 26, 2018 at 08:02:17PM +1000, NeilBrown wrote: >> On Thu, Jul 26 2018, Sergio Paracuellos wrote: >> >> > >> > Ok, I think the problem is we are not setting the bridge->windows retrieved >> > with devm_request_pci_bus_resources in "res". So we have to set those properly >> > to the bridge to get all correctly assigned. So I think adding this should make >> > the system to work: >> > >> > + list_splice_init(&res, &bridge->windows); >> > bridge->busnr = 0; >> > bridge->dev.parent = dev; >> > bridge->sysdata = pcie; >> > >> > >> > (Sorry don't access to code now and cannot diff). >> > >> > Let me know if this works. Is this the hopefully good one? >> >> This one, at least, makes a difference. >> >> I now see >> [ 2.420000] pci 0000:01:00.0: BAR 5: assigned [mem 0x60000000-0x600001ff] >> >> which is promising. > > Yes, this and also the dmesg are promising and seems resources are correctly > assigned now. > >> >> However it gets to: >> >> [ 8.620000] pci 0000:00:00.0: enabling device (0004 -> 0006) >> [ 8.640000] ahci 0000:01:00.0: enabling device (0000 -> 0002) >> > > So after setup the PCI system topology is the driver responsability to enable > the device. It means only make the hardware memory space accesible and > this is the (0000-> 0002) of the log message (set the memory space bit of PCI COMMAND > register to 1 to make it accesible to allow the device to respond to memory space acceses). > So it is correct the behaviour of trying to enable this but it should not hang. This trace is in > drivers/pci/setup-res.c +495 (function pci_enable_resources). It would be helpful > a more deeper debug to know exactly where it really hangs. I was thinking a reason for this to hang could be the access bridge has not set the "bus master" bit enabled in its PCI_COMMAND register but it should be set because this is done inside "pci_assign_unassigned_bridge_resources" concretely when "pci_enable_bridges(parent);" is called. This function internally call pci_set_master(dev); that should set the bit active for each bridge. Best regards, Sergio Paracuellos > > Thanks in advance. > >> and hangs. >> >> Full dmesg pasted below. >> >> Thanks, >> NeilBrown > > Best regards, > Sergio Paracuellos >> >> >> [ 0.000000] Linux version 4.18.0-rc5+ (neilb@noble) (gcc version 7.2.0 (GCC)) #231 SMP Thu Jul 26 19:57:52 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=00010882 >> [ 0.000000] Readback ErrCtl register=00010882 >> [ 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.570000] mt7621-pci 1e140000.pcie: host bridge /pcie@1e140000 ranges: >> [ 0.580000] mt7621-pci 1e140000.pcie: MEM 0x60000000..0x6fffffff -> 0x00000000 >> [ 0.590000] mt7621-pci 1e140000.pcie: IO 0x1e160000..0x1e16ffff -> 0x00000000 >> [ 0.910000] ***** Xtal 40MHz ***** >> [ 0.920000] Port 0 N_FTS = 1b102800 >> [ 0.920000] Port 1 N_FTS = 1b102800 >> [ 0.930000] Port 2 N_FTS = 1b102800 >> [ 1.990000] PCIE0 enabled >> [ 2.000000] PCIE1 enabled >> [ 2.000000] PCIE2 enabled >> [ 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.090000] 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.280000] 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] >> [ 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.410000] 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.650000] 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.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 0x60400000-0x604fffff] >> [ 2.930000] pci 0000:00:02.0: bridge window [mem 0x60500000-0x605fffff pref] >> [ 3.020000] SCSI subsystem initialized >> [ 3.030000] random: fast init done >> [ 3.040000] clocksource: Switched to clocksource GIC >> [ 3.060000] NET: Registered protocol family 2 >> [ 3.080000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes) >> [ 3.090000] 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.130000] UDP hash table entries: 256 (order: 1, 8192 bytes) >> [ 3.140000] 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.380000] io scheduler deadline registered (default) >> [ 8.400000] io scheduler mq-deadline registered (default) >> [ 8.410000] io scheduler kyber registered >> [ 8.420000] Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled >> [ 8.450000] console [ttyS0] disabled >> [ 8.450000] 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.480000] bootconsole [early0] disabled >> [ 8.480000] bootconsole [early0] disabled >> [ 8.500000] cacheinfo: Failed to find cpu0 device node >> [ 8.510000] cacheinfo: Unable to detect cache hierarchy for CPU 0 >> [ 8.600000] loop: module loaded >> [ 8.610000] pci 0000:00:00.0: enabling device (0004 -> 0006) >> [ 8.620000] ahci 0000:01:00.0: enabling device (0000 -> 0002) > > _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel