From 927e0eedfcd8f773fc89da1a750ea191aa94492c Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 5 Oct 2021 13:51:38 -0400 Subject: CI: Update to LLVM-13 - Switch sources and CI scripts to install and use LLVM-13 - Update to latest "focal" tag. Signed-off-by: Tom Rini --- .azure-pipelines.yml | 4 ++-- .gitlab-ci.yml | 4 ++-- tools/docker/Dockerfile | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 53f86f5184..2ca146c0fd 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -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" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a3e2f0ceb..699ce991fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 92113dcb72..1a44423d77 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -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 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 \ -- cgit v1.2.3 From b04f64aa48eeaf099fe52c28c512f956690f5eec Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 5 Oct 2021 20:18:00 -0600 Subject: pytest: Shorten traceback length by default This produces a lot of code output which is not very helpful and is quite annoying to wade through. Use the short format by default. Signed-off-by: Simon Glass --- doc/develop/py_testing.rst | 7 +++++++ test/py/test.py | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/doc/develop/py_testing.rst b/doc/develop/py_testing.rst index 4f1e1f66e7..52238ca54d 100644 --- a/doc/develop/py_testing.rst +++ b/doc/develop/py_testing.rst @@ -103,6 +103,13 @@ 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. +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 ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/test/py/test.py b/test/py/test.py index 285fda5425..95859a66e2 100755 --- a/test/py/test.py +++ b/test/py/test.py @@ -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)) -- cgit v1.2.3 From b9caab8b47ae6ad6a317a9ed05e90475248739d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 7 Oct 2021 14:50:57 +0200 Subject: pci: Skip configuring PCI Rom Address for unsupported header types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PCI Rom Address is currently supported only for Normal (0x00) and Bridge (0x01) header types. Fix code accordingly. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- drivers/pci/pci_auto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 08082460eb..288f7996c7 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -131,7 +131,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); -- cgit v1.2.3 From 63ae80dd98d4c0d1123317043cdf2596e724e43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 7 Oct 2021 14:50:58 +0200 Subject: pci: Skip configuring invalid P2P bridge devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Function dm_pci_hose_probe_bus() expects that bus is valid PCI device with Bridge header type (0x01). So add check before touching PCI config space to prevent misconfiguring some non-standard device. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- drivers/pci/pci-uclass.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 044babee16..5da3515f5f 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -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), -- cgit v1.2.3 From c7cd6f734b7cded1e1e1967c2374b08f344a6878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 7 Oct 2021 14:50:59 +0200 Subject: pci: Fix configuring BARs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Number of BARs is defined by header type, not by class code. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- drivers/pci/pci_auto.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index 288f7996c7..5af4ee6e56 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -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,8 +150,6 @@ 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_NORMAL || header_type == PCI_HEADER_TYPE_BRIDGE) { rom_addr = (header_type == PCI_HEADER_TYPE_NORMAL) ? @@ -343,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) @@ -356,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))); @@ -388,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; } -- cgit v1.2.3 From e6335d3eaafc60b74bd05761b2bf0e57ad429aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 7 Oct 2021 14:51:00 +0200 Subject: pci: Fix showing bars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Header type is 7-bit number so properly clear upper 8th bit which indicates multifunction device. And do not try to show bars for unsupported header types. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- cmd/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/pci.c b/cmd/pci.c index cfabdc0f30..4a82854db7 100644 --- a/cmd/pci.c +++ b/cmd/pci.c @@ -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; -- cgit v1.2.3 From 43dad07cd45dba129487a8dc55de9f4f850ae7d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 7 Oct 2021 14:51:01 +0200 Subject: pci: Fix showing registers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Header type is 7-bit number so use all 7 bits when detecting header type and not only 2 bits. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- cmd/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/pci.c b/cmd/pci.c index 4a82854db7..3b1863f139 100644 --- a/cmd/pci.c +++ b/cmd/pci.c @@ -239,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; -- cgit v1.2.3 From c3aea6870595bfb41c8ea0108874e3ee3ee42407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Fri, 8 Oct 2021 17:01:24 +0200 Subject: pci: Fix printf format for regions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correct printf format for unsigned long long is %llx and not %llxx. Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- drivers/pci/pci_auto_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci_auto_common.c b/drivers/pci/pci_auto_common.c index c0a53dcc92..2f4aff0104 100644 --- a/drivers/pci/pci_auto_common.c +++ b/drivers/pci/pci_auto_common.c @@ -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, -- cgit v1.2.3 From 35839eda8b17f85a94e8f83a681079ac2d30413f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 8 Oct 2021 09:15:23 -0600 Subject: pytest: Show a message when sandbox crashes When a test hands on a real board there is no way on the console to obtain any information about why it hung. With sandbox we can actually find out that it died and get a signal or exit code. Add this to make it easier to figure out what happened. So instead of: test/py/u_boot_spawn.py:171: in expect c = os.read(self.fd, 1024).decode(errors='replace') E OSError: [Errno 5] Input/output error We get: 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) Signed-off-by: Simon Glass --- doc/develop/py_testing.rst | 8 +++++++ test/py/u_boot_spawn.py | 56 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/doc/develop/py_testing.rst b/doc/develop/py_testing.rst index 52238ca54d..06f919609b 100644 --- a/doc/develop/py_testing.rst +++ b/doc/develop/py_testing.rst @@ -103,6 +103,14 @@ 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 ~~~~~~~~~~~~~~~~~~ diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index 6991b78cca..e34cb217e8 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -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,25 +82,44 @@ class Spawn(object): os.kill(self.pid, sig) - def isalive(self): + def checkalive(self): """Determine whether the child process is still running. - Args: - None. - Returns: - Boolean indicating whether process is alive. + 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 + return False, self.exit_code, self.exit_info w = os.waitpid(self.pid, os.WNOHANG) if w[0] == 0: - return True - + 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 + return False, self.exit_code, self.exit_info + + def isalive(self): + """Determine whether the child process is still running. + + Args: + None. + + Returns: + Boolean indicating whether process is alive. + """ + 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 -- cgit v1.2.3 From 35b2b5f04c71efb73ec0f1a01535542e4b602e15 Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Tue, 12 Oct 2021 08:50:38 +0200 Subject: board/km: update MAINTAINERS files Update the e-mail addresses and person responsible. Signed-off-by: Holger Brunck CC: Aleksandar Gerasimovski CC: Rainer Boschung --- board/keymile/km83xx/MAINTAINERS | 2 +- board/keymile/km_arm/MAINTAINERS | 2 +- board/keymile/pg-wcom-ls102xa/MAINTAINERS | 5 ++--- board/keymile/secu1/MAINTAINERS | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/board/keymile/km83xx/MAINTAINERS b/board/keymile/km83xx/MAINTAINERS index 9268719a74..9fd5a8500d 100644 --- a/board/keymile/km83xx/MAINTAINERS +++ b/board/keymile/km83xx/MAINTAINERS @@ -1,5 +1,5 @@ KM83XX BOARD -M: Holger Brunck +M: Holger Brunck M: Heiko Schocher S: Maintained F: board/keymile/km83xx/ diff --git a/board/keymile/km_arm/MAINTAINERS b/board/keymile/km_arm/MAINTAINERS index 8da58da962..bc6858be13 100644 --- a/board/keymile/km_arm/MAINTAINERS +++ b/board/keymile/km_arm/MAINTAINERS @@ -1,5 +1,5 @@ KM_ARM BOARD -M: Valentin Longchamp +M: Holger Brunck S: Maintained F: board/keymile/km_arm/ F: include/configs/km_kirkwood.h diff --git a/board/keymile/pg-wcom-ls102xa/MAINTAINERS b/board/keymile/pg-wcom-ls102xa/MAINTAINERS index 26b202316c..966c88b681 100644 --- a/board/keymile/pg-wcom-ls102xa/MAINTAINERS +++ b/board/keymile/pg-wcom-ls102xa/MAINTAINERS @@ -1,7 +1,6 @@ Hitachi Power Grids LS102XA BOARD -M: Aleksandar Gerasimovski -M: Rainer Boschung -M: Matteo Ghidoni +M: Aleksandar Gerasimovski +M: Rainer Boschung S: Maintained F: board/keymile/pg-wcom-ls102xa/ F: include/configs/km/pg-wcom-ls102xa.h diff --git a/board/keymile/secu1/MAINTAINERS b/board/keymile/secu1/MAINTAINERS index 3e40eef3cc..833b3fdeab 100644 --- a/board/keymile/secu1/MAINTAINERS +++ b/board/keymile/secu1/MAINTAINERS @@ -1,5 +1,5 @@ Hitachi Power Grids SECU1 BOARD -M: Holger Brunck +M: Holger Brunck S: Maintained F: include/configs/socfpga_arria5_secu1.h F: configs/socfpga_secu1_defconfig -- cgit v1.2.3