Merge branch '2021-10-14-assorted-updates'

- Update to LLVM-13 in CI, assorted PCI fixes and pytest in CI
  improvements
This commit is contained in:
Tom Rini
2021-10-15 07:50:59 -04:00
14 changed files with 120 additions and 35 deletions

View File

@@ -2,7 +2,7 @@ variables:
windows_vm: vs2017-win2016
ubuntu_vm: ubuntu-18.04
macos_vm: macOS-10.15
ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20210827-30Sep2021
ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20210921-05Oct2021
# Add '-u 0' options for Azure pipelines, otherwise we get "permission
# denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
# since our $(ci_runner_image) user is not root.
@@ -183,7 +183,7 @@ jobs:
TEST_PY_BD: "sandbox"
sandbox_clang:
TEST_PY_BD: "sandbox"
OVERRIDE: "-O clang-12"
OVERRIDE: "-O clang-13"
sandbox_spl:
TEST_PY_BD: "sandbox_spl"
TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"

View File

@@ -2,7 +2,7 @@
# Grab our configured image. The source for this is found at:
# https://source.denx.de/u-boot/gitlab-ci-runner
image: trini/u-boot-gitlab-ci-runner:focal-20210827-30Sep2021
image: trini/u-boot-gitlab-ci-runner:focal-20210921-05Oct2021
# We run some tests in different order, to catch some failures quicker.
stages:
@@ -190,7 +190,7 @@ sandbox test.py:
sandbox with clang test.py:
variables:
TEST_PY_BD: "sandbox"
OVERRIDE: "-O clang-12"
OVERRIDE: "-O clang-13"
<<: *buildman_and_testpy_dfn
sandbox_spl test.py:

View File

@@ -1,5 +1,5 @@
KM83XX BOARD
M: Holger Brunck <holger.brunck@hitachi-powergrids.com>
M: Holger Brunck <holger.brunck@hitachienergy.com>
M: Heiko Schocher <hs@denx.de>
S: Maintained
F: board/keymile/km83xx/

View File

@@ -1,5 +1,5 @@
KM_ARM BOARD
M: Valentin Longchamp <valentin.longchamp@hitachi-powergrids.com>
M: Holger Brunck <holger.brunck@hitachienergy.com>
S: Maintained
F: board/keymile/km_arm/
F: include/configs/km_kirkwood.h

View File

@@ -1,7 +1,6 @@
Hitachi Power Grids LS102XA BOARD
M: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com>
M: Rainer Boschung <rainer.boschung@hitachi-powergrids.com>
M: Matteo Ghidoni <matteo.ghidoni@hitachi-powergrids.com>
M: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachienergy.com>
M: Rainer Boschung <rainer.boschung@hitachienergy.com>
S: Maintained
F: board/keymile/pg-wcom-ls102xa/
F: include/configs/km/pg-wcom-ls102xa.h

View File

@@ -1,5 +1,5 @@
Hitachi Power Grids SECU1 BOARD
M: Holger Brunck <holger.brunck@hitachi-powergrids.com>
M: Holger Brunck <holger.brunck@hitachienergy.com>
S: Maintained
F: include/configs/socfpga_arria5_secu1.h
F: configs/socfpga_secu1_defconfig

View File

@@ -71,10 +71,15 @@ static int pci_bar_show(struct udevice *dev)
int prefetchable;
dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type);
header_type &= 0x7f;
if (header_type == PCI_HEADER_TYPE_CARDBUS) {
printf("CardBus doesn't support BARs\n");
return -ENOSYS;
} else if (header_type != PCI_HEADER_TYPE_NORMAL &&
header_type != PCI_HEADER_TYPE_BRIDGE) {
printf("unknown header type\n");
return -ENOSYS;
}
bar_cnt = (header_type == PCI_HEADER_TYPE_NORMAL) ? 6 : 2;
@@ -234,7 +239,7 @@ static void pci_header_show(struct udevice *dev)
pci_class_str(class));
pci_show_regs(dev, regs_rest);
switch (header_type & 0x03) {
switch (header_type & 0x7f) {
case PCI_HEADER_TYPE_NORMAL: /* "normal" PCI device */
pci_show_regs(dev, regs_normal);
break;

View File

@@ -103,6 +103,21 @@ will be written to `${build_dir}/test-log.html`. This is best viewed in a web
browser, but may be read directly as plain text, perhaps with the aid of the
`html2text` utility.
If sandbox crashes (e.g. with a segfault) you will see message like this::
test/py/u_boot_spawn.py:171: in expect
c = os.read(self.fd, 1024).decode(errors='replace')
E ValueError: U-Boot exited with signal 11 (Signals.SIGSEGV)
Controlling output
~~~~~~~~~~~~~~~~~~
By default a short backtrace is reported. If you would like a longer one,
pass ``--tb=long`` when running the test. See the pytest documentation for
more options.
Running tests in parallel
~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -627,6 +627,7 @@ int pci_generic_mmap_read_config(
int dm_pci_hose_probe_bus(struct udevice *bus)
{
u8 header_type;
int sub_bus;
int ret;
int ea_pos;
@@ -634,6 +635,14 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
debug("%s\n", __func__);
dm_pci_read_config8(bus, PCI_HEADER_TYPE, &header_type);
header_type &= 0x7f;
if (header_type != PCI_HEADER_TYPE_BRIDGE) {
debug("%s: Skipping PCI device %d with Non-Bridge Header Type 0x%x\n",
__func__, PCI_DEV(dm_pci_get_bdf(bus)), header_type);
return log_msg_ret("probe", -EINVAL);
}
ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA);
if (ea_pos) {
dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8),

View File

@@ -19,7 +19,7 @@
#define CONFIG_SYS_PCI_CACHE_LINE_SIZE 8
#endif
static void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
static void dm_pciauto_setup_device(struct udevice *dev,
struct pci_region *mem,
struct pci_region *prefetch,
struct pci_region *io)
@@ -28,6 +28,7 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
pci_size_t bar_size;
u16 cmdstat = 0;
int bar, bar_nr = 0;
int bars_num;
u8 header_type;
int rom_addr;
pci_addr_t bar_value;
@@ -39,6 +40,26 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
cmdstat = (cmdstat & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) |
PCI_COMMAND_MASTER;
dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type);
header_type &= 0x7f;
switch (header_type) {
case PCI_HEADER_TYPE_NORMAL:
bars_num = 6;
break;
case PCI_HEADER_TYPE_BRIDGE:
bars_num = 2;
break;
case PCI_HEADER_TYPE_CARDBUS:
/* CardBus header does not have any BAR */
bars_num = 0;
break;
default:
/* Skip configuring BARs for unknown header types */
bars_num = 0;
break;
}
for (bar = PCI_BASE_ADDRESS_0;
bar < PCI_BASE_ADDRESS_0 + (bars_num * 4); bar += 4) {
int ret = 0;
@@ -129,9 +150,8 @@ static void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
}
/* Configure the expansion ROM address */
dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type);
header_type &= 0x7f;
if (header_type != PCI_HEADER_TYPE_CARDBUS) {
if (header_type == PCI_HEADER_TYPE_NORMAL ||
header_type == PCI_HEADER_TYPE_BRIDGE) {
rom_addr = (header_type == PCI_HEADER_TYPE_NORMAL) ?
PCI_ROM_ADDRESS : PCI_ROM_ADDRESS1;
dm_pci_write_config32(dev, rom_addr, 0xfffffffe);
@@ -342,7 +362,7 @@ int dm_pciauto_config_device(struct udevice *dev)
debug("PCI Autoconfig: Found P2P bridge, device %d\n",
PCI_DEV(dm_pci_get_bdf(dev)));
dm_pciauto_setup_device(dev, 2, pci_mem, pci_prefetch, pci_io);
dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io);
ret = dm_pci_hose_probe_bus(dev);
if (ret < 0)
@@ -355,7 +375,7 @@ int dm_pciauto_config_device(struct udevice *dev)
* just do a minimal setup of the bridge,
* let the OS take care of the rest
*/
dm_pciauto_setup_device(dev, 0, pci_mem, pci_prefetch, pci_io);
dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io);
debug("PCI Autoconfig: Found P2CardBus bridge, device %d\n",
PCI_DEV(dm_pci_get_bdf(dev)));
@@ -387,7 +407,7 @@ int dm_pciauto_config_device(struct udevice *dev)
/* fall through */
default:
dm_pciauto_setup_device(dev, 6, pci_mem, pci_prefetch, pci_io);
dm_pciauto_setup_device(dev, pci_mem, pci_prefetch, pci_io);
break;
}

View File

@@ -74,7 +74,7 @@ static void pciauto_show_region(const char *name, struct pci_region *region)
{
pciauto_region_init(region);
debug("PCI Autoconfig: Bus %s region: [%llx-%llx],\n"
"\t\tPhysical Memory [%llx-%llxx]\n", name,
"\t\tPhysical Memory [%llx-%llx]\n", name,
(unsigned long long)region->bus_start,
(unsigned long long)(region->bus_start + region->size - 1),
(unsigned long long)region->phys_start,

View File

@@ -17,4 +17,9 @@ if __name__ == '__main__':
# argv; py.test test_directory_name user-supplied-arguments
args = [os.path.dirname(__file__) + '/tests']
args.extend(sys.argv)
# Use short format by default
if not [arg for arg in args if '--tb=' in arg]:
args.append('--tb=short')
sys.exit(pytest.main(args))

View File

@@ -35,6 +35,8 @@ class Spawn(object):
"""
self.waited = False
self.exit_code = 0
self.exit_info = ''
self.buf = ''
self.output = ''
self.logfile_read = None
@@ -80,6 +82,34 @@ class Spawn(object):
os.kill(self.pid, sig)
def checkalive(self):
"""Determine whether the child process is still running.
Returns:
tuple:
True if process is alive, else False
0 if process is alive, else exit code of process
string describing what happened ('' or 'status/signal n')
"""
if self.waited:
return False, self.exit_code, self.exit_info
w = os.waitpid(self.pid, os.WNOHANG)
if w[0] == 0:
return True, 0, 'running'
status = w[1]
if os.WIFEXITED(status):
self.exit_code = os.WEXITSTATUS(status)
self.exit_info = 'status %d' % self.exit_code
elif os.WIFSIGNALED(status):
signum = os.WTERMSIG(status)
self.exit_code = -signum
self.exit_info = 'signal %d (%s)' % (signum, signal.Signals(signum))
self.waited = True
return False, self.exit_code, self.exit_info
def isalive(self):
"""Determine whether the child process is still running.
@@ -89,16 +119,7 @@ class Spawn(object):
Returns:
Boolean indicating whether process is alive.
"""
if self.waited:
return False
w = os.waitpid(self.pid, os.WNOHANG)
if w[0] == 0:
return True
self.waited = True
return False
return self.checkalive()[0]
def send(self, data):
"""Send data to the sub-process's stdin.
@@ -168,9 +189,20 @@ class Spawn(object):
events = self.poll.poll(poll_maxwait)
if not events:
raise Timeout()
c = os.read(self.fd, 1024).decode(errors='replace')
if not c:
raise EOFError()
try:
c = os.read(self.fd, 1024).decode(errors='replace')
except OSError as err:
# With sandbox, try to detect when U-Boot exits when it
# shouldn't and explain why. This is much more friendly than
# just dying with an I/O error
if err.errno == 5: # Input/output error
alive, exit_code, info = self.checkalive()
if alive:
raise
else:
raise ValueError('U-Boot exited with %s' % info)
else:
raise
if self.logfile_read:
self.logfile_read.write(c)
self.buf += c

View File

@@ -2,7 +2,7 @@
# This Dockerfile is used to build an image containing basic stuff to be used
# to build U-Boot and run our test suites.
FROM ubuntu:focal-20210827
FROM ubuntu:focal-20210921
MAINTAINER Tom Rini <trini@konsulko.com>
LABEL Description=" This image is for building U-Boot inside a container"
@@ -12,7 +12,7 @@ ENV DEBIAN_FRONTEND=noninteractive
# Add LLVM repository
RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/*
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN echo deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main | tee /etc/apt/sources.list.d/llvm.list
RUN echo deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main | tee /etc/apt/sources.list.d/llvm.list
# Manually install the kernel.org "Crosstool" based toolchains for gcc-11.1.0
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/11.1.0/x86_64-gcc-11.1.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ
@@ -39,7 +39,7 @@ RUN apt-get update && apt-get install -y \
binutils-dev \
bison \
build-essential \
clang-12 \
clang-13 \
coreutils \
cpio \
cppcheck \