Bug 96241

Summary: sparc64 bus_to_resource fails for 64-bit bus addresses
Product: Drivers Reporter: Bjorn Helgaas (bjorn)
Component: PCIAssignee: Yinghai Lu (yinghai)
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
URL: http://lkml.kernel.org/r/CAE9FiQU1gJY1LYrxs+ma5LCTEEe4xmtjRG0aXJ9K_Tsu+m9Wuw@mail.gmail.com
Kernel Version: v4.0 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg log (failing)

Description Bjorn Helgaas 2015-04-07 03:11:01 UTC
Created attachment 173271 [details]
dmesg log (failing)

David Ahern reported that v4.0-rc1 doesn't boot on sparc/T5-8.  See attached
dmesg log.

  pci_sun4v f02dbcfc: PCI host bridge to bus 0000:00
  pci_bus 0000:00: root bus resource [mem 0x800000000000-0x80007effffff] (bus address [0x00000000-0x7effffff])

  pci 0000:00:01.0: can't claim BAR 15 [mem 0x100000000-0x4afffffff pref]: no compatible bridge window

The PCI core doesn't know about a host bridge aperture that contains [mem 0x100000000-0x4afffffff pref].  It assumes a BAR value of 0x100000000 is not translated, so the corresponding resource value (CPU physical address) is 0x100000000, which is incorrect.

The host bridge actually does have an aperture that contains this BAR value:

  pci_bus 0000:00: root bus resource [mem 0x800100000000-0x8007ffffffff] (bus address [0x100000000-0x7ffffffff])

The correct resource would be:

  pci 0000:00:01.0: BAR 15 [mem 0x800100000000-0x8004afffffff pref]

(The resource itself is not printed by the sparc64 PCI code.)

Yinghai already posted a patch to the sparc64 OF parsing code to fix this on sparc64.  I'm opening this bugzilla both to archive the logs related to that issue and as a reminder to make similar fixes to the following functions, which are essentially identical to the sparc64 one:

  drivers/of/address.c                  of_bus_pci_get_flags()
  arch/powerpc/kernel/pci_of_scan.c     pci_parse_of_flags()
  arch/sparc/kernel/of_device_32.c      of_bus_pci_get_flags()
  arch/sparc/kernel/of_device_64.c      of_bus_pci_get_flags()
Comment 1 Bjorn Helgaas 2016-12-28 21:31:38 UTC
Yinghai's sparc64 change is af86fa4001ca ("sparc/PCI: Add mem64 resource parsing for root bus"), which appeared in v4.4-rc1:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=af86fa4001ca

I think we still should make similar changes to the functions I mentioned, but I don't think this is actually a regression, so I'm going to remove the regression tag.