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

Pull in AMD System Device Tree flow work up to April 7 2024 #42

Merged
merged 14 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion recipes-openamp/libmetal/libmetal.inc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ EXTRA_OECMAKE = " \
-DLIBEXEC_INSTALL_DIR=${libexecdir} \
-DMACHINE=${LIBMETAL_MACHINE} \
-DWITH_EXAMPLES=ON \
-DSOC_FAMILY="${SOC_FAMILY}" \
"

ALLOW_EMPTY:${PN}-demos = "1"
Expand Down
2 changes: 1 addition & 1 deletion recipes-openamp/rpmsg-examples/rpmsg-example.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ REPO = "git://github.com/OpenAMP/openamp-system-reference;protocol=https"
# OPENAMP_SYS_REF_BRANCH="main"
#
# These values select the commit tagged by v2023.10.0
OPENAMP_SYS_REF_SRCREV ?= "3716dbba0154259d5efa3fa359313cce69cd163d"
OPENAMP_SYS_REF_SRCREV ?= "2c5d2064e45faf7e3a542d1232593beec40ff940"
OPENAMP_SYS_REF_BRANCH ?= "v2023.10"

# This include is used by multiple recipes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ B:xilinx-standalone = "${WORKDIR}/build"
OECMAKE_SOURCEPATH:xilinx-standalone = "${S}/"
PROVIDES:xilinx-standalone = "libmetal"

DEPENDS:xilinx-standalone:append = " libxil doxygen-native xilstandalone nativesdk-xilinx-lops "
DEPENDS:xilinx-standalone:arm:append = " scugic xiltimer "
DEPENDS:xilinx-standalone:append = " doxygen-native xilstandalone scugic xiltimer libxil nativesdk-xilinx-lops "
DEPENDS:xilinx-standalone:append:xilinx-freertos = " freertos10-xilinx "
DEPENDS:xilinx-standalone:remove = " sysfsutils eudev "
DEPENDS:remove:microblaze = " scugic xiltimer "
DEPENDS:remove:xilinx-standalone = " sysfsutils eudev "

COMPATIBLE_HOST:xilinx-standalone = ".*-elf"
COMPATIBLE_HOST:xilinx-standalone:arm = "[^-]*-[^-]*-eabi"
Expand All @@ -37,8 +37,9 @@ LIBMETAL_DEMO ?= "OFF"

EXTRA_OECMAKE:armv7r = "\
-DWITH_EXAMPLES=${LIBMETAL_DEMO} \
-DSOC_FAMILY=${SOC_FAMILY} \
"

CFLAGS:append = " -DSDT -DXLNX_PLATFORM "
OECMAKE_C_LINK_FLAGS:append:xilinx-standalone = " -lxilstandalone -lscugic -lxiltimer -lgcc"

FILES:${PN}:xilinx-standalone:append = " ${libdir}/*.a ${bindir}/*elf "
Expand All @@ -65,6 +66,5 @@ cmake_do_generate_toolchain_file:append:xilinx-standalone() {
include (cross-${LIBMETAL_GCC_INCLUDE}-gcc)
set (WITH_DOC OFF)
set (DEMO_LINK_FLAGS "${DEMO_LINK_FLAGS}" CACHE STRING "")
add_definitions(-DSDT -DXLNX_PLATFORM)
EOF
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ PROVIDES:armv7r:xilinx-standalone = " open-amp open-amp-xlnx "
RPROVIDES:${PN} += "open-amp"
RPROVIDES:${PN}-demos += "open-amp-demos"

inherit ccmake cmake python3-dir deploy plnx-deploy
inherit ccmake cmake python3-dir deploy

LOPS_DIR="${RECIPE_SYSROOT_NATIVE}/${PYTHON_SITEPACKAGES_DIR}/lopper/lops/"
OPENAMP_DTFILE ?= "${SYSTEM_DTFILE}"
LOPPER_OPENAMP_OUT_DTB = "${WORKDIR}/openamp-lopper-output.dtb"

EXTRA_OECMAKE:append = " -DYOCTO=ON "
S = "${WORKDIR}/git"
Expand All @@ -27,7 +26,6 @@ OPENAMP_OVERLAY_DEFAULT:versal-net ??= "openamp-overlay-versal-net.yaml"
OPENAMP_OVERLAY ?= "${OPENAMP_OVERLAY_DEFAULT}"
SRC_URI:append = " file://${OPENAMP_OVERLAY} "


OECMAKE_C_LINK_FLAGS:xilinx-standalone:append = " --sysroot=${STAGING_DIR_HOST} "
CFLAGS:append = " -DSDT -D_AMD_GENERATED_ "
CFLAGS:xilinx-standalone:append = " -O3 -DXLNX_PLATFORM \
Expand Down Expand Up @@ -131,7 +129,9 @@ do_run_set_lopper_targets() {
sed -i -e 's/psv_cortexa72_0/${LOP_LINUX_HOST}/g' ${LOPS_DIR}/lop-gen_domain_dts-invoke.dts
}

LOPPER_OPENAMP_OUT_DTB ?= "${WORKDIR}/openamp-lopper-output.dtb"
addtask run_lopper after run_set_lopper_targets
addtask run_lopper after do_fetch
addtask run_lopper before do_generate_toolchain_file
do_run_lopper() {
export LOPPER_DTC_FLAGS="-b 0 -@"
Expand All @@ -143,9 +143,17 @@ do_run_lopper() {
-i ${LOPS_DIR}/lop-xlate-yaml.dts \
-i ${LOPS_DIR}/lop-openamp-invoke.dts \
${OPENAMP_LOPPER_INPUTS} ${OPENAMP_DTFILE} \
${LOPPER_OPENAMP_OUT_DTB}
${LOPPER_OPENAMP_OUT_DTB} > do_run_lopper.log.txt

cd -

if [ ! -f ${WORKDIR}/amd_platform_info.h ]; then
bberror "Unable to generate file amd_platform_info.h from OpenAMP Lopper run. See Below log:"

out=$(cat ${WORKDIR}/do_run_lopper.log.txt)
bberror "$out"
exit 1
fi
}

SOC_FAMILY_ARCH:linux ??= "${TUNE_PKGARCH}"
Expand All @@ -159,23 +167,12 @@ OPENAMP_MACHINE:xilinx-standalone = "zynqmp_r5"

DEPLOY_MACHINE = "${@ d.getVar('MACHINE_ARCH').replace('_','-') }"
STANDALONE_SHOULD_DEPLOY = "${@'true' if ( 'Standalone' in d.getVar('DISTRO_NAME') ) else 'false'}"
LOPPER_OPENAMP_OUT_DTB ?= "${WORKDIR}/openamp-lopper-output.dtb"

do_deploy() {
# remove existing DTB if applicable
if test -f ${DEPLOYDIR}${LOPPER_OPENAMP_OUT_DTB}; then
rm ${DEPLOYDIR}${LOPPER_OPENAMP_OUT_DTB}
fi

install -Dm 0644 ${LOPPER_OPENAMP_OUT_DTB} ${DEPLOYDIR}

# remove existing DTB if applicable
if test -f ${PLNX_DEPLOY_DIR}${LOPPER_OPENAMP_OUT_DTB}; then
rm ${PLNX_DEPLOY_DIR}${LOPPER_OPENAMP_OUT_DTB}
fi

install -Dm 0644 ${LOPPER_OPENAMP_OUT_DTB} ${PLNX_DEPLOY_DIR}

}

do_deploy:armv7r() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
definitions:
OpenAMP:
openamp_channel0_access_srams: &openamp_channel0_access_srams # used for access in each domain
- dev: CIPS_0_pspmc_0_psv_r5_0_atcm_global
- dev: psv_r5_0_atcm_global
flags: 0
- dev: CIPS_0_pspmc_0_psv_r5_0_btcm_global
- dev: psv_r5_0_btcm_global
flags: 0

rproc0: &rproc0
Expand Down Expand Up @@ -38,7 +38,7 @@ domains:
el: 0x3
access:
# if we want to have a list merge, it should be in a list
- dev: ipi6 # used for Open AMP RPMsg IPC
- dev: ipi3 # used for Open AMP RPMsg IPC
flags: 0
- <<+: *openamp_channel0_access_srams

Expand All @@ -54,8 +54,8 @@ domains:
remote:
- openamp_r5_0_cluster
elfload:
- CIPS_0_pspmc_0_psv_r5_0_atcm_global
- CIPS_0_pspmc_0_psv_r5_0_btcm_global
- psv_r5_0_atcm_global
- psv_r5_0_btcm_global
- rproc0

rpmsg-relation:
Expand All @@ -64,7 +64,7 @@ domains:
remote:
- openamp_r5_0_cluster
mbox:
- ipi6
- ipi3
carveouts:
- rpu0vdev0vring0
- rpu0vdev0vring1
Expand All @@ -80,7 +80,7 @@ domains:
secure: true
access:
- dev:
- ipi4 # used for Open AMP RPMsg IPC
- ipi1 # used for Open AMP RPMsg IPC
flags: 0
- <<+: *openamp_channel0_access_srams # TCM banks used for firmware memory
reserved-memory:
Expand All @@ -94,7 +94,7 @@ domains:
host:
- openamp_a72_0_cluster
mbox:
- ipi4
- ipi1
carveouts:
- rpu0vdev0vring0
- rpu0vdev0vring1
Expand Down
5 changes: 5 additions & 0 deletions vendor/xilinx/recipes-openamp/libmetal/libmetal-xlnx.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LIBMETAL_DEF:zynqmp = " -DPLATFORM_ZYNQMP"
LIBMETAL_DEF:versal = " -Dversal"
LIBMETAL_DEF:versal-net = " -DVERSAL_NET"
LIBMETAL_DEF ?= ""
TARGET_CFLAGS:append = " ${LIBMETAL_DEF} "
1 change: 1 addition & 0 deletions vendor/xilinx/recipes-openamp/libmetal/libmetal_%.bbappend
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
LIBMETAL_MACHINE:versal = "zynqmp"
LIBMETAL_MACHINE:versal-net = "zynqmp"

EXTRA_OECMAKE:append:zynqmp = " -DWITH_VFIO=on"
EXTRA_OECMAKE:append:versal = " -DWITH_VFIO=on"
Expand Down
37 changes: 37 additions & 0 deletions vendor/xilinx/recipes-openamp/open-amp/open-amp-xlnx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,43 @@ CFLAGS:append:versal-net = " -DVERSAL_NET "
EXTRA_OECMAKE:append:zynqmp = " -DWITH_APPS=ON"
EXTRA_OECMAKE:append:versal = " -DWITH_APPS=ON"


OPENAMP_SHM_DEV_NAME ?= ""
OPENAMP_IPI_DEV_NAME ?= ""

# Do this so that C String Literals can propagate properly with '"' and '.'
do_configure:append () {
if [ -n "${OPENAMP_IPI_DEV_NAME}" ]; then
cat << EOF >> ${WORKDIR}/git/apps/machine/zynqmp/platform_info.h
#ifdef IPI_DEV_NAME
#undef IPI_DEV_NAME
#endif
#define IPI_DEV_NAME "${OPENAMP_IPI_DEV_NAME}"
EOF
fi
if [ -n "${OPENAMP_SHM_DEV_NAME}" ]; then
cat << EOF >> ${WORKDIR}/git/apps/machine/zynqmp/platform_info.h
#ifdef SHM_DEV_NAME
#undef SHM_DEV_NAME
#endif
#define SHM_DEV_NAME "${OPENAMP_SHM_DEV_NAME}"
EOF
fi

}

OPENAMP_IPI_CHN_BITMASK ?= ""
OECMAKE_C_FLAGS:append = " ${@'-DIPI_CHN_BITMASK=${OPENAMP_IPI_CHN_BITMASK}' if d.getVar('OPENAMP_IPI_CHN_BITMASK') else ''}"

OPENAMP_RSC_MEM_PA ?= ""
OECMAKE_C_FLAGS:append = " ${@'-DRSC_MEM_PA=${OPENAMP_RSC_MEM_PA}' if d.getVar('OPENAMP_RSC_MEM_PA') else ''}"

OPENAMP_VRING_MEM_PA ?= ""
OECMAKE_C_FLAGS:append = " ${@'-DVRING_MEM_PA=${OPENAMP_VRING_MEM_PA}' if d.getVar('OPENAMP_VRING_MEM_PA') else ''}"

OPENAMP_SHARED_BUF_PA ?= ""
OECMAKE_C_FLAGS:append = " ${@'-DSHARED_BUF_PA=${OPENAMP_SHARED_BUF_PA}' if d.getVar('OPENAMP_SHARED_BUF_PA') else ''}"

do_install:append () {
# Only install echo test client, matrix multiplication client,
# and proxy app server for ZynqMP
Expand Down