Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-s…
Browse files Browse the repository at this point in the history
…emihosting-280222-1' into staging

Testing and semihosting updates:

  - restore TESTS/IMAGES filtering to docker tests
  - add NOUSER to alpine image
  - bump lcitool version
  - move arm64/s390x cross build images to lcitool
  - add aarch32 runner CI scripts
  - expand testing to more vectors
  - update s390x jobs to focal for gitlab/travis
  - disable threadcount for all sh4
  - fix semihosting SYS_HEAPINFO and test

# gpg: Signature made Mon 28 Feb 2022 18:46:41 GMT
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-and-semihosting-280222-1:
  tests/tcg: port SYS_HEAPINFO to a system test
  semihosting/arm-compat: replace heuristic for softmmu SYS_HEAPINFO
  tests/tcg: completely disable threadcount for sh4
  gitlab: upgrade the job definition for s390x to 20.04
  travis.yml: Update the s390x jobs to Ubuntu Focal
  tests/tcg: add vectorised sha512 versions
  tests/tcg: add sha512 test
  tests/tcg: build sha1-vector with O3 and compare
  tests/tcg/ppc64: clean-up handling of byte-reverse
  gitlab: add a new aarch32 custom runner definition
  scripts/ci: allow for a secondary runner
  scripts/ci: add build env rules for aarch32 on aarch64
  tests/docker: introduce debian-riscv64-test-cross
  tests/docker: update debian-s390x-cross with lcitool
  tests/docker: update debian-arm64-cross with lcitool
  tests/lcitool: update to latest version
  tests/docker: add NOUSER for alpine image
  tests/docker: restore TESTS/IMAGES filtering

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Mar 2, 2022
2 parents c26fc53 + b904a90 commit 44efeb9
Show file tree
Hide file tree
Showing 32 changed files with 1,811 additions and 182 deletions.
20 changes: 9 additions & 11 deletions .gitlab-ci.d/container-cross.yml
Expand Up @@ -21,18 +21,10 @@ amd64-debian-user-cross-container:

arm64-debian-cross-container:
extends: .container_job_template
stage: containers-layer2
needs: ['amd64-debian10-container']
stage: containers
variables:
NAME: debian-arm64-cross

arm64-test-debian-cross-container:
extends: .container_job_template
stage: containers-layer2
needs: ['amd64-debian11-container']
variables:
NAME: debian-arm64-test-cross

armel-debian-cross-container:
extends: .container_job_template
stage: containers-layer2
Expand Down Expand Up @@ -139,10 +131,16 @@ riscv64-debian-cross-container:
variables:
NAME: debian-riscv64-cross

s390x-debian-cross-container:
# we can however build TCG tests using a non-sid base
riscv64-debian-test-cross-container:
extends: .container_job_template
stage: containers-layer2
needs: ['amd64-debian10-container']
variables:
NAME: debian-riscv64-test-cross

s390x-debian-cross-container:
extends: .container_job_template
stage: containers
variables:
NAME: debian-s390x-cross

Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.d/custom-runners.yml
Expand Up @@ -14,6 +14,6 @@ variables:
GIT_STRATEGY: clone

include:
- local: '/.gitlab-ci.d/custom-runners/ubuntu-18.04-s390x.yml'
- local: '/.gitlab-ci.d/custom-runners/ubuntu-20.04-s390x.yml'
- local: '/.gitlab-ci.d/custom-runners/ubuntu-20.04-aarch64.yml'
- local: '/.gitlab-ci.d/custom-runners/centos-stream-8-x86_64.yml'
@@ -1,12 +1,12 @@
# All ubuntu-18.04 jobs should run successfully in an environment
# All ubuntu-20.04 jobs should run successfully in an environment
# setup by the scripts/ci/setup/build-environment.yml task
# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
# "Install basic packages to build QEMU on Ubuntu 20.04/20.04"

ubuntu-18.04-s390x-all-linux-static:
ubuntu-20.04-s390x-all-linux-static:
needs: []
stage: build
tags:
- ubuntu_18.04
- ubuntu_20.04
- s390x
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
Expand All @@ -21,11 +21,11 @@ ubuntu-18.04-s390x-all-linux-static:
- make --output-sync -j`nproc` check V=1
- make --output-sync -j`nproc` check-tcg V=1

ubuntu-18.04-s390x-all:
ubuntu-20.04-s390x-all:
needs: []
stage: build
tags:
- ubuntu_18.04
- ubuntu_20.04
- s390x
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
Expand All @@ -37,11 +37,11 @@ ubuntu-18.04-s390x-all:
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1

ubuntu-18.04-s390x-alldbg:
ubuntu-20.04-s390x-alldbg:
needs: []
stage: build
tags:
- ubuntu_18.04
- ubuntu_20.04
- s390x
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
Expand All @@ -58,11 +58,11 @@ ubuntu-18.04-s390x-alldbg:
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1

ubuntu-18.04-s390x-clang:
ubuntu-20.04-s390x-clang:
needs: []
stage: build
tags:
- ubuntu_18.04
- ubuntu_20.04
- s390x
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
Expand All @@ -78,11 +78,11 @@ ubuntu-18.04-s390x-clang:
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1

ubuntu-18.04-s390x-tci:
ubuntu-20.04-s390x-tci:
needs: []
stage: build
tags:
- ubuntu_18.04
- ubuntu_20.04
- s390x
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
Expand All @@ -97,11 +97,11 @@ ubuntu-18.04-s390x-tci:
- ../configure --disable-libssh --enable-tcg-interpreter
- make --output-sync -j`nproc`

ubuntu-18.04-s390x-notcg:
ubuntu-20.04-s390x-notcg:
needs: []
stage: build
tags:
- ubuntu_18.04
- ubuntu_20.04
- s390x
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
Expand Down
23 changes: 23 additions & 0 deletions .gitlab-ci.d/custom-runners/ubuntu-20.40-aarch32.yml
@@ -0,0 +1,23 @@
# All ubuntu-20.04 jobs should run successfully in an environment
# setup by the scripts/ci/setup/qemu/build-environment.yml task
# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"

ubuntu-20.04-aarch32-all:
needs: []
stage: build
tags:
- ubuntu_20.04
- aarch32
rules:
- if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/'
when: manual
allow_failure: true
- if: "$AARCH32_RUNNER_AVAILABLE"
when: manual
allow_failure: true
script:
- mkdir build
- cd build
- ../configure --cross-prefix=arm-linux-gnueabihf-
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
1 change: 1 addition & 0 deletions MAINTAINERS
Expand Up @@ -3549,6 +3549,7 @@ S: Maintained
F: semihosting/
F: include/semihosting/
F: tests/tcg/multiarch/arm-compat-semi/
F: tests/tcg/aarch64/system/semiheap.c

Multi-process QEMU
M: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Expand Down
7 changes: 7 additions & 0 deletions docs/devel/ci-jobs.rst.inc
Expand Up @@ -44,6 +44,13 @@ If you've got access to an aarch64 host that can be used as a gitlab-CI
runner, you can set this variable to enable the tests that require this
kind of host. The runner should be tagged with "aarch64".

AARCH32_RUNNER_AVAILABLE
~~~~~~~~~~~~~~~~~~~~~~~~
If you've got access to an armhf host or an arch64 host that can run
aarch32 EL0 code to be used as a gitlab-CI runner, you can set this
variable to enable the tests that require this kind of host. The
runner should be tagged with "aarch32".

S390X_RUNNER_AVAILABLE
~~~~~~~~~~~~~~~~~~~~~~
If you've got access to an IBM Z host that can be used as a gitlab-CI
Expand Down
86 changes: 86 additions & 0 deletions hw/core/loader.c
Expand Up @@ -1333,6 +1333,92 @@ static Rom *find_rom(hwaddr addr, size_t size)
return NULL;
}

typedef struct RomSec {
hwaddr base;
int se; /* start/end flag */
} RomSec;


/*
* Sort into address order. We break ties between rom-startpoints
* and rom-endpoints in favour of the startpoint, by sorting the 0->1
* transition before the 1->0 transition. Either way round would
* work, but this way saves a little work later by avoiding
* dealing with "gaps" of 0 length.
*/
static gint sort_secs(gconstpointer a, gconstpointer b)
{
RomSec *ra = (RomSec *) a;
RomSec *rb = (RomSec *) b;

if (ra->base == rb->base) {
return ra->se - rb->se;
}
return ra->base > rb->base ? 1 : -1;
}

static GList *add_romsec_to_list(GList *secs, hwaddr base, int se)
{
RomSec *cand = g_new(RomSec, 1);
cand->base = base;
cand->se = se;
return g_list_prepend(secs, cand);
}

RomGap rom_find_largest_gap_between(hwaddr base, size_t size)
{
Rom *rom;
RomSec *cand;
RomGap res = {0, 0};
hwaddr gapstart = base;
GList *it, *secs = NULL;
int count = 0;

QTAILQ_FOREACH(rom, &roms, next) {
/* Ignore blobs being loaded to special places */
if (rom->mr || rom->fw_file) {
continue;
}
/* ignore anything finishing bellow base */
if (rom->addr + rom->romsize <= base) {
continue;
}
/* ignore anything starting above the region */
if (rom->addr >= base + size) {
continue;
}

/* Save the start and end of each relevant ROM */
secs = add_romsec_to_list(secs, rom->addr, 1);

if (rom->addr + rom->romsize < base + size) {
secs = add_romsec_to_list(secs, rom->addr + rom->romsize, -1);
}
}

/* sentinel */
secs = add_romsec_to_list(secs, base + size, 1);

secs = g_list_sort(secs, sort_secs);

for (it = g_list_first(secs); it; it = g_list_next(it)) {
cand = (RomSec *) it->data;
if (count == 0 && count + cand->se == 1) {
size_t gap = cand->base - gapstart;
if (gap > res.size) {
res.base = gapstart;
res.size = gap;
}
} else if (count == 1 && count + cand->se == 0) {
gapstart = cand->base;
}
count += cand->se;
}

g_list_free_full(secs, g_free);
return res;
}

/*
* Copies memory from registered ROMs to dest. Any memory that is contained in
* a ROM between addr and addr + size is copied. Note that this can involve
Expand Down
14 changes: 14 additions & 0 deletions include/hw/loader.h
Expand Up @@ -343,4 +343,18 @@ int rom_add_option(const char *file, int32_t bootindex);
* overflow on real hardware too. */
#define UBOOT_MAX_GUNZIP_BYTES (64 << 20)

typedef struct RomGap {
hwaddr base;
size_t size;
} RomGap;

/**
* rom_find_largest_gap_between: return largest gap between ROMs in given range
*
* Given a range of addresses, this function finds the largest
* contiguous subrange which has no ROMs loaded to it. That is,
* it finds the biggest gap which is free for use for other things.
*/
RomGap rom_find_largest_gap_between(hwaddr base, size_t size);

#endif
25 changes: 25 additions & 0 deletions scripts/ci/setup/build-environment.yml
Expand Up @@ -19,6 +19,13 @@
- '((ansible_version.major == 2) and (ansible_version.minor >= 8)) or (ansible_version.major >= 3)'
msg: "Unsuitable ansible version, please use version 2.8.0 or later"

- name: Add armhf foreign architecture to aarch64 hosts
command: dpkg --add-architecture armhf
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['architecture'] == 'aarch64'
- ansible_facts['distribution_version'] == '20.04'

- name: Update apt cache / upgrade packages via apt
apt:
update_cache: yes
Expand Down Expand Up @@ -115,6 +122,24 @@
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['distribution_version'] == '20.04'

- name: Install armhf cross-compile packages to build QEMU on AArch64 Ubuntu 20.04
package:
name:
- binutils-arm-linux-gnueabihf
- gcc-arm-linux-gnueabihf
- libblkid-dev:armhf
- libc6-dev:armhf
- libffi-dev:armhf
- libglib2.0-dev:armhf
- libmount-dev:armhf
- libpcre2-dev:armhf
- libpixman-1-dev:armhf
- zlib1g-dev:armhf
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['distribution_version'] == '20.04'
- ansible_facts['architecture'] == 'aarch64'

- name: Install basic packages to build QEMU on EL8
dnf:
# This list of packages start with tests/docker/dockerfiles/centos8.docker
Expand Down
38 changes: 38 additions & 0 deletions scripts/ci/setup/gitlab-runner.yml
Expand Up @@ -69,3 +69,41 @@
name: gitlab-runner
state: started
enabled: yes

- name: Download secondary gitlab-runner
get_url:
dest: /usr/local/bin/gitlab-runner-arm
url: "https://s3.amazonaws.com/gitlab-runner-downloads/v{{ gitlab_runner_version }}/binaries/gitlab-runner-{{ gitlab_runner_os }}-arm"
owner: gitlab-runner
group: gitlab-runner
mode: u=rwx,g=rwx,o=rx
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['architecture'] == 'aarch64'
- ansible_facts['distribution_version'] == '20.04'

- name: Register secondary gitlab-runner
command: "/usr/local/bin/gitlab-runner-arm register --non-interactive --url {{ gitlab_runner_server_url }} --registration-token {{ gitlab_runner_registration_token }} --executor shell --tag-list aarch32,{{ ansible_facts[\"distribution\"]|lower }}_{{ ansible_facts[\"distribution_version\"] }} --description '{{ ansible_facts[\"distribution\"] }} {{ ansible_facts[\"distribution_version\"] }} {{ ansible_facts[\"architecture\"] }} ({{ ansible_facts[\"os_family\"] }})'"
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['architecture'] == 'aarch64'
- ansible_facts['distribution_version'] == '20.04'

- name: Install the secondary gitlab-runner service using its own functionality
command: /usr/local/bin/gitlab-runner-arm install --user gitlab-runner --working-directory /home/gitlab-runner/arm -n gitlab-runner-arm
register: gitlab_runner_install_service_result
failed_when: "gitlab_runner_install_service_result.rc != 0 and \"already exists\" not in gitlab_runner_install_service_result.stderr"
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['architecture'] == 'aarch64'
- ansible_facts['distribution_version'] == '20.04'

- name: Enable the secondary gitlab-runner service
service:
name: gitlab-runner-arm
state: started
enabled: yes
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['architecture'] == 'aarch64'
- ansible_facts['distribution_version'] == '20.04'

0 comments on commit 44efeb9

Please sign in to comment.