foss-for-synopsys-dwc-arc-processors/linux

Updating ARC board to linux 5.12 ?

cooperxduffin opened this issue · 11 comments

I was building images for the ARC board using buildroot-2019.02.1 linux 5.0 . I am able to get that working and it seems like all the PCIe drivers work as I am able to get linkup when I do lspci.

I recently tried to upgrade to linux 5.12 using buildroot-2021.02.x because it contains new PCIe drivers and some other features I am interested in. I am able to get an image that boots onto the ARC board, however it seems to be still using the linux 4.2 headers which are not supported with the latest buildroot. I tried lspci and I keep getting this error:

pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.

I have been following dwc_pcie_controller_sw_user.pdf documentation and it does say that other versions of linux and buildroot might cause things to break so not a huge surprise. I was wondering if anyone might have insight into this, or if you happen to know if there will be a more updated image for the ARC board in the future?

@cooperxduffin could you please post here your complete Buildroot's .config?
Also you may easily switch to newer Linux headers in your Buildroot and see if it helps.

@cooperxduffin may I also see your full bootlog and Linux kernel's .config (you may find it in output/build/linux-xxx/.config)?

@cooperxduffin I see this in your kernel configuration:

#
# Device Drivers
#
CONFIG_HAVE_PCI=y
# CONFIG_PCI is not set

Which says "PCI support" support is disabled (# CONFIG_PCI is not set). So you need to run make menuconfig and enable PCI and drivers for your PCI controller.

pci_enable

I cant seem to find that specific option in the menuconfig if I search for CONFIG_PCI or "PCI support" it does not seem to be able to find it. Do you have an Idea on what the prompt/location is?

OK, I see. You're now referring to Buildroot's menuconfig - sorry for the confusion :)
But what I meant and what you really need is the Linux's menuconfig where you may change kernel's configuration - enable more drivers etc. To access it from Buildroot's sources you need to execute make linux-menuconfig.

Alright I enabled the driver in linux-menuconfig this is what I am getting now, still no lspci either.
linux512_driver_enabled.txt
also here is an example of it working for reference
linux50arc.txt

@cooperxduffin which Linux kernel sources do you use? My feeling is your kernel is missing device tree description of the he Host/PCI bridge node in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arc/boot/dts/hsdk.dts. See https://elinux.org/Device_Tree_Usage#PCI_Host_Bridge for more details.
Note though, you need to be careful adding that PCI node in the .dts file to match exactly your HW configuration.

So in arc_build/software/PCI/Linux/main runing make menuconfig I set the buildroot version there
main_buildroot_setting (2)

and then followed by running make menuconfig in software/PCI/Linux/main/build-hsdk-rc/buildroot-2021.02.x i set which version of linux there
buildroot_512set (2)

Hopefully that answers your question. I did a diff of the hsdk.dts and they are identical, so you are saying that I should add the PCI_Host_bridge to the .dts file? Seems a bit strange that it is required for linux 5.12 and not 5.0. I do see in the output of linux 5.0 that the PCI host bridge is host bridge /haps_tunnel/pcie@0xe0000000 ranges

dw-pcie efc00000.pcie: use nonncoherent DMA ops
dw-pcie efc00000.pcie: host bridge /haps_tunnel/pcie@0xe0000000 ranges:
dw-pcie efc00000.pcie: No bus range found for /haps_tunnel/pcie@0xe0000000, using [bus 00-ff]
dw-pcie efc00000.pcie: IO 0xee000000..0xee00ffff -> 0x00000000
dw-pcie efc00000.pcie: MEM 0xe0400000..0xed3fffff -> 0xe0400000
dw-pcie efc00000.pcie: Phy link never came up
dw-pcie efc00000.pcie: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [bus 00-ff]
pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
pci_bus 0000:00: root bus resource [mem 0xe0400000-0xed3fffff]
pci 0000:00:00.0: [16c3:eddc] type 01 class 0x060400
pci 0000:00:00.0: reg 0x38: [mem 0x00000000-0x0000ffff pref]
pci 0000:00:00.0: supports D1
pci 0000:00:00.0: PME# supported from D0 D1 D3hot D3cold
pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
pci 0000:00:00.0: BAR 6: assigned [mem 0xe0400000-0xe040ffff pref]
pci 0000:00:00.0: PCI bridge to [bus 01]
pcieport 0000:00:00.0: use nonncoherent DMA ops
aer 0000:00:00.0:pcie002: AER enabled with IRQ 2

@cooperxduffin OK it looks like there're some patches which needs to be applied on top of the vanilla Linux kernel sources and they seem to be dependent on the kernel version.
Note there's a message in your screenshot saying that changing those parameters might break your build, which seems to be happening.

So now the question is what is your motivation to update Buildroot version? Just out of curiosity or something really important is missing in an older Buildroot version and you try to find it in a newer one?

I suggest you to keep using working version for now, but if there's a good reason to move to a newer version you'll need to figure out where those additional patches come from and make sure they are applied in case of newer Buildroot as well.