Bug 16063

Summary: Bogus bogus alignment message
Product: Drivers Reporter: Alexander Bezrukov (phmagic)
Component: PCIAssignee: drivers_pci (drivers_pci)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, bjorn, jbarnes, lucent, phmagic
Priority: P1    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.32.14 2.6.32.13 Subsystem:
Regression: No Bisected commit-id:
Attachments: My config

Description Alexander Bezrukov 2010-05-28 00:26:10 UTC
Created attachment 26565 [details]
My config

Hello,

I'm trying to debug a custom x86 board, the problem I am debugging is completely unrelated to the PCI subsystem in this domain. Whenever I re-scan the PCI bus, I get the following message:

test-mm ~ # echo 1 >/sys/bus/pci/rescan
[ 1574.273328] pci 0000:05:00.0: BAR 6: bogus alignment [0x0-0x0] flags 0x2

During the boot there no problems regarding resource allocation reported in the dmesg log.

The device 0000:05:00.0 is an AST2050 processor connected to the conventional PCI bus (conforming to PCI Spec rev. 2.3).

First of all, there exists no BAR 6 unless this is some unofficial name for another register. Then, I see no problems with alignment as can be seen from the session below:

test-mm ~ # lspci -nnvvvxx -s 05:00.0
05:00.0 VGA compatible controller [0300]: ASPEED Technology, Inc. ASPEED Graphics Family [1a03:2000] (rev 10) (prog-if 00 [VGA controller])
	Subsystem: ASPEED Technology, Inc. ASPEED Graphics Family [1a03:2000]
	Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Interrupt: pin A routed to IRQ 0
	Region 0: Memory at fe000000 (32-bit, non-prefetchable) [size=8M]
	Region 1: Memory at feae0000 (32-bit, non-prefetchable) [size=128K]
	Region 2: I/O ports at df80 [size=128]
	Expansion ROM at <unassigned> [disabled]
	Capabilities: [40] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
00: 03 1a 00 20 03 00 10 02 10 00 00 03 00 00 00 00
10: 00 00 00 fe 00 00 ae fe 81 df 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 03 1a 00 20
30: 00 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00


test-mm ~ # for i in `seq -f BASE_ADDRESS_%.0f 0 5` ROM_ADDRESS; do
      j=$(setpci -s 05:00.0 $i) &&
      echo -n $i\ \ Read:\ $j \ \ Init:\  &&
      setpci -s 05:00.0 $i=FFFFFFFF &&
      setpci -s 05:00.0 $i && 
      setpci -s 05:00.0 $i=$j;
done
BASE_ADDRESS_0  Read: fe000000   Init: ff800000
BASE_ADDRESS_1  Read: feae0000   Init: fffe0000
BASE_ADDRESS_2  Read: 0000df81   Init: ffffff81
BASE_ADDRESS_3  Read: 00000000   Init: 00000000
BASE_ADDRESS_4  Read: 00000000   Init: 00000000
BASE_ADDRESS_5  Read: 00000000   Init: 00000000
ROM_ADDRESS  Read: 00000000   Init: 00000000

test-mm ~ # grep CONFIG_PCI_IOV /usr/src/linux/.config
# CONFIG_PCI_IOV is not set

test-mm ~ # uname -a
Linux test-mm 2.6.32.14-x86-alb #1 SMP Fri May 28 11:16:03 MSD 2010 i686 Intel(R) Core(TM) Duo CPU T2350 @ 1.86GHz GenuineIntel GNU/Linux

test-mm ~ # cat /proc/cmdline 
root=/dev/sda1 console=tty0

test-mm ~ # cat /etc/*release
Gentoo Base System release 1.12.13

I am sorry, I haven't used the kernel bugzilla since early 1990s so I may create this bug in not an appropriate place. I would be happy to provide any additional information.
Comment 1 Jesse Barnes 2010-06-18 17:55:08 UTC
Looks like the message itself is bogus for zero sized BARs?  BAR6 should be the ROM BAR, we just don't print a special name for it.

does this patch silence the warning?

diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 92379e2..68e15a5 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -230,8 +230,10 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
 
 		r_align = pci_resource_alignment(dev, r);
 		if (!r_align) {
-			dev_warn(&dev->dev, "BAR %d: %pR has bogus alignment\n",
-				 i, r);
+			if (r->start)
+				dev_warn(&dev->dev,
+					 "BAR %d: %pR has bogus alignment\n",
+					 i, r);
 			continue;
 		}
 		for (list = head; ; list = list->next) {
Comment 2 Bjorn Helgaas 2011-05-27 16:26:55 UTC
What's the status of this issue?  Can it be closed?  Jesse's patch above is not in the upstream kernel (2.6.39).
Comment 3 Alan 2012-07-20 12:38:30 UTC
No further info from the reporter
Comment 4 Eric Shattow 2016-05-13 18:02:20 UTC
Still seeing this on Intel i915 graphics from Dell Inspiron 1420n laptop with Linux kernel 4.5.0 :
$ sudo dmesg -C
$ echo 1 | sudo tee /sys/bus/pci/rescan
1
$ sudo dmesg
[11773.801413] i915 0000:00:02.0: BAR 6: [??? 0x00000000 flags 0x2] has bogus alignment
[11773.801426] lpc_ich 0000:00:1f.0: BAR 13: [io  size 0x0080] has bogus alignment
Comment 5 Bjorn Helgaas 2016-06-08 16:36:47 UTC
This should be fixed by 63e22924f5dc, which appeared in v4.6-rc1.  I'm going to close this as fixed, but please reopen it if you see it on  v4.6 or later.

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