Re: [PATCH v2] PCI: Batch BAR sizing operations

Oleg Nesterov
2025-02-09T15:45:48Z

On 01/20, Alex Williamson wrote:
>
> static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
> {
> + u32 rombar, stdbars[PCI_STD_NUM_BARS];
> unsigned int pos, reg;
> + u16 orig_cmd;
> +
> + BUILD_BUG_ON(howmany > PCI_STD_NUM_BARS);

FYI, I can't build the kernel after this patch:

$ make drivers/pci/probe.o
UPD include/config/kernel.release
UPD include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC drivers/pci/probe.o
In file included from <command-line>:0:0:
drivers/pci/probe.c: In function ‘pci_read_bases’:
././include/linux/compiler_types.h:542:38: error: call to ‘__compiletime_assert_338’ declared with attribute error: BUILD_BUG_ON failed: howmany > PCI_STD_NUM_BARS
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
././include/linux/compiler_types.h:523:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix(); \
^
././include/linux/compiler_types.h:542:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
./include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
drivers/pci/probe.c:348:2: note: in expansion of macro ‘BUILD_BUG_ON’
BUILD_BUG_ON(howmany > PCI_STD_NUM_BARS);

Yes, my gcc version 5.3.1 is very old, but according to Documentation/process/changes.rst
it should still be supported, the minimal version is 5.1.

Oleg.