Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI (Aarch64, Power) #285

Merged
merged 11 commits into from
Nov 3, 2022
Merged
2 changes: 2 additions & 0 deletions .github/workflows/aarch64_linux_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
strategy:
matrix:
targets: [
[aarch64],
[aarch64be],
[aarch64-linux-gnu],
[aarch64_be-linux-gnu]
]
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/power_linux_cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: POWER Linux CMake

on:
push:
pull_request:
schedule:
# min hours day(month) month day(week)
- cron: '0 0 7,22 * *'

jobs:
# Building using the github runner environement directly.
make:
runs-on: ubuntu-latest
strategy:
matrix:
targets: [
[ppc],
[ppc64],
[ppc64le],
]
fail-fast: false
env:
TARGET: ${{ matrix.targets[0] }}
steps:
- uses: actions/checkout@v2
- name: Build
run: make --directory=cmake/ci ${TARGET}_build
- name: Test
run: make --directory=cmake/ci ${TARGET}_test
7 changes: 7 additions & 0 deletions cmake/ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ help:
@echo -e "\t\t${BOLD}armeb-linux-gnueabihf${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}armeb-linux-gnueabi${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}aarch64-linux-gnu${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}aarch64${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}aarch64_be-linux-gnu${RESET} (linaro toolchain)"
@echo -e "\t\t${BOLD}aarch64be${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}mips32${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips64${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips32el${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}mips64el${RESET} (codespace toolchain)"
@echo -e "\t\t${BOLD}ppc${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}ppc64${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}ppc64le${RESET} (bootlin toolchain)"
@echo -e "\t\t${BOLD}s390x${RESET} (bootlin toolchain)"
@echo
@echo -e "\tWith ${BOLD}<toolchain_stage>${RESET}:"
Expand Down Expand Up @@ -144,9 +149,11 @@ $(clean_targets_amd64): clean_amd64_%:
## TOOLCHAIN ##
###############
TOOLCHAIN_TARGETS = \
aarch64 aarch64be \
arm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi armeb-linux-gnueabihf armeb-linux-gnueabi \
aarch64-linux-gnu aarch64_be-linux-gnu \
mips32 mips32el mips64 mips64el \
ppc ppc64 ppc64le \
s390x
TOOLCHAIN_STAGES = env devel build test
define toolchain-stage-target =
Expand Down
87 changes: 67 additions & 20 deletions scripts/run_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function unpack() {
if [[ ! -d "${DESTINATION}" ]] ; then
echo "Downloading ${URL}..."
local -r ARCHIVE_NAME=$(basename "${URL}")
test -f "${ARCHIVE_NAME}" || wget --no-verbose "${URL}"
[[ -f "${ARCHIVE_NAME}" ]] || wget --no-verbose "${URL}"
extract "${ARCHIVE_NAME}"
rm -f "${ARCHIVE_NAME}"
fi
Expand All @@ -33,7 +33,7 @@ function install_qemu() {
>&2 echo 'QEMU is disabled !'
return 0
fi
local -r QEMU_VERSION=${QEMU_VERSION:=5.2.0}
local -r QEMU_VERSION=${QEMU_VERSION:=7.1.0}
local -r QEMU_TARGET=${QEMU_ARCH}-linux-user

if echo "${QEMU_VERSION} ${QEMU_TARGET}" | cmp --silent "${QEMU_INSTALL}/.build" -; then
Expand Down Expand Up @@ -70,11 +70,7 @@ function install_qemu() {
--disable-opengl \
--disable-sdl \
--disable-virglrenderer \
--disable-vte \
--enable-modules

# --static Not supported on Archlinux
# so we use --enable-modules
--disable-vte

# wrapper on ninja
make -j8
Expand Down Expand Up @@ -145,6 +141,27 @@ function expand_bootlin_config() {
local -r GCC_DIR=${ARCHIVE_DIR}/${GCC_RELATIVE_DIR}

case "${TARGET}" in
"aarch64")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="aarch64"
;;
"aarch64be")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64be/tarballs/aarch64be--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="aarch64_be"
;;
"ppc64le")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc64le-power8/tarballs/powerpc64le-power8--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="powerpc64le"
;;
"ppc64")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc64-power8/tarballs/powerpc64-power8--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="powerpc64"
;;
"ppc")
#local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc-e500mc/tarballs/powerpc-e500mc--glibc--stable-2021.11-1.tar.bz2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While QEmu provide a single ppc target (as well as docker), bootlin provide several flavors
440fp and e500mc for PowerPC while here I arbitrarily the 440fp we could have choose the other one...

An other way would be to have ppc-e500mc and ppc-440fp (and ppc alias of ppc-440fp ?)

ref:

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
...
Setting /usr/bin/qemu-ppc-static as binfmt interpreter for ppc
Setting /usr/bin/qemu-ppc64-static as binfmt interpreter for ppc64
Setting /usr/bin/qemu-ppc64le-static as binfmt interpreter for ppc64le

note: same issue with ppc64[le]: power8, e5500, 'e6500', le-power8...

local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/powerpc-440fp/tarballs/powerpc-440fp--glibc--stable-2021.11-1.tar.bz2"
local -r GCC_PREFIX="powerpc"
;;
"s390x")
local -r POWER_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/s390x-z13/tarballs/s390x-z13--glibc--stable-2022.08-1.tar.bz2"
local -r GCC_PREFIX="s390x"
Expand Down Expand Up @@ -197,15 +214,21 @@ QEMU_ARGS+=( -E LD_PRELOAD="${SYSROOT_DIR}/usr/lib/libstdc++.so.6:${SYSROOT_DIR}
}

function expand_codescape_config() {
# https://www.mips.com/develop/tools/codescape-mips-sdk/mips-toolchain-configurations/
# mips-mti: MIPS32R6 and MIPS64R6
# mips-img: MIPS32R2 and MIPS64R2

# ref: https://codescape.mips.com/components/toolchain/2020.06-01/downloads.html
# ref: https://codescape.mips.com/components/toolchain/2019.02-04/downloads.html
local -r DATE=2020.06-01
#local -r DATE=2019.02-04
local -r CODESCAPE_URL=https://codescape.mips.com/components/toolchain/${DATE}/Codescape.GNU.Tools.Package.${DATE}.for.MIPS.MTI.Linux.CentOS-6.x86_64.tar.gz
#local -r CODESCAPE_URL=https://codescape.mips.com/components/toolchain/${DATE}/Codescape.GNU.Tools.Package.${DATE}.for.MIPS.IMG.Linux.CentOS-6.x86_64.tar.gz
local -r GCC_URL=${CODESCAPE_URL}
local -r GCC_RELATIVE_DIR="mips-mti-linux-gnu/${DATE}"

# ref: https://codescape.mips.com/components/toolchain/2019.02-04/downloads.html
#local -r DATE=2019.02-04
#local -r CODESCAPE_URL=https://codescape.mips.com/components/toolchain/${DATE}/Codescape.GNU.Tools.Package.${DATE}.for.MIPS.IMG.Linux.CentOS-6.x86_64.tar.gz
#local -r GCC_RELATIVE_DIR="mips-img-linux-gnu/${DATE}"

local -r GCC_URL=${CODESCAPE_URL}
unpack "${GCC_URL}" "${GCC_RELATIVE_DIR}"

local -r GCC_DIR=${ARCHIVE_DIR}/${GCC_RELATIVE_DIR}
Expand All @@ -230,12 +253,14 @@ function expand_codescape_config() {
"mips64")
MIPS_FLAGS="-EB -mips64r6 -mabi=64"
FLAVOUR="mips-r6-hard"
#MIPS_FLAGS="-EB -mips64r2 -mabi=64"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here and below, why do you need to keep these comments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here maybe we could have a flag to decide which version to use so user can easily reuse this script to target the correct CPU by just changing one line, so while we only enable one flavor it's easy for the community to adapt.

Or again we should/could have both mips-r6/mips-r2 and a mips alias to target the last one aka mips-r6 ?

#FLAVOUR="mips-r2-hard"
LIBC_DIR_SUFFIX="lib64"
;;
"mips64el")
MIPS_FLAGS="-EL -mips64r6 -mabi=64"
FLAVOUR="mipsel-r6-hard"
#MIPS_FLAGS="-EL -mips64r2 -mabi=64"
#FLAVOUR="mipsel-r2-hard"
LIBC_DIR_SUFFIX="lib64"
;;
Expand All @@ -259,13 +284,17 @@ set(CMAKE_STAGING_PREFIX ${STAGING_DIR})

set(tools ${GCC_DIR})

# R6
set(CMAKE_C_COMPILER \${tools}/bin/mips-mti-linux-gnu-gcc)
#set(CMAKE_C_COMPILER \${tools}/bin/mips-img-linux-gnu-gcc)
set(CMAKE_C_FLAGS "${MIPS_FLAGS}")

set(CMAKE_CXX_COMPILER \${tools}/bin/mips-mti-linux-gnu-g++)
set(CMAKE_CXX_FLAGS "${MIPS_FLAGS} -L${SYSROOT_DIR}/usr/lib64")

# R2
#set(CMAKE_C_COMPILER \${tools}/bin/mips-img-linux-gnu-gcc)
#set(CMAKE_C_FLAGS "${MIPS_FLAGS}")
#set(CMAKE_CXX_COMPILER \${tools}/bin/mips-img-linux-gnu-g++)
set(CMAKE_CXX_FLAGS "${MIPS_FLAGS}")
#set(CMAKE_CXX_FLAGS "${MIPS_FLAGS}")

set(CMAKE_FIND_ROOT_PATH ${GCC_DIR})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Expand Down Expand Up @@ -320,11 +349,14 @@ DESCRIPTION
\tYou MUST define the following variables before running this script:
\t* TARGET:
\t\tx86_64
\t\taarch64-linux-gnu aarch64_be-linux-gnu
\t\tarm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi
\t\tarmeb-linux-gnueabihf armeb-linux-gnueabi
\t\tmips32 mips32el
\t\tmips64 mips64el
\t\taarch64 aarch64be (bootlin)
\t\taarch64-linux-gnu aarch64_be-linux-gnu (linaro)
\t\tarm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi (linaro)
\t\tarmeb-linux-gnueabihf armeb-linux-gnueabi (linaro)
\t\tmips32 mips32el (codespace)
\t\tmips64 mips64el (codespace)
\t\tppc (bootlin)
\t\tppc64 ppc64le (bootlin)
\t\ts390x (bootlin)

OPTIONS
Expand Down Expand Up @@ -383,7 +415,13 @@ function main() {
declare -r QEMU_ARCH=aarch64 ;;
aarch64_be-linux-gnu)
expand_linaro_config
declare -r QEMU_ARCH=DISABLED ;;
declare -r QEMU_ARCH=aarch64_be ;;
aarch64)
expand_bootlin_config
declare -r QEMU_ARCH=aarch64 ;;
aarch64be)
expand_bootlin_config
declare -r QEMU_ARCH=aarch64_be ;;
mips32)
expand_codescape_config
declare -r QEMU_ARCH=mips ;;
Expand All @@ -396,6 +434,15 @@ function main() {
mips64el)
expand_codescape_config
declare -r QEMU_ARCH=mips64el ;;
ppc64le)
expand_bootlin_config
declare -r QEMU_ARCH=ppc64le ;;
ppc64)
expand_bootlin_config
declare -r QEMU_ARCH=ppc64 ;;
ppc)
expand_bootlin_config
declare -r QEMU_ARCH=ppc ;;
s390x)
expand_bootlin_config
declare -r QEMU_ARCH=s390x ;;
Expand Down
1 change: 1 addition & 0 deletions src/impl_ppc_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
LINE(PPC_SCV, scv, "scv", 0, PPC_FEATURE2_SCV) \
LINE(PPC_HTM_NO_SUSPEND, htm_no_suspend, "htm-no-suspend", 0, \
PPC_FEATURE2_HTM_NO_SUSPEND)
#undef PPC // Remove conflict with compiler generated preprocessor
#define INTROSPECTION_PREFIX PPC
#define INTROSPECTION_ENUM_PREFIX PPC
#include "define_introspection_and_hwcaps.inl"
Expand Down