aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Dechesne <ndechesne@users.noreply.github.com>2021-04-06 19:23:14 +0200
committerGitHub <noreply@github.com>2021-04-06 19:23:14 +0200
commit3aa57c3e44bef0b981b5f9990513adb777050cbd (patch)
tree739e0c5d3f2692c216eac3b808aa71dea2a323b2
parenteef27b4dbe43281c265a652d491f790fb3bab49b (diff)
parentce077064a4e5cc426e8198d90083e1be07d13637 (diff)
downloadmeta-qcom-3aa57c3e44bef0b981b5f9990513adb777050cbd.tar.gz
meta-qcom-3aa57c3e44bef0b981b5f9990513adb777050cbd.tar.bz2
meta-qcom-3aa57c3e44bef0b981b5f9990513adb777050cbd.zip
Merge pull request #292 from lumag/fastrpc-dunfell
Fastrpc fixes backported to dunfell
-rw-r--r--recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch128
-rw-r--r--recipes-support/fastrpc/fastrpc/adsprpcd.service9
-rw-r--r--recipes-support/fastrpc/fastrpc/cdsprpcd.service9
-rw-r--r--recipes-support/fastrpc/fastrpc/mount-dsp.sh26
-rw-r--r--recipes-support/fastrpc/fastrpc/usr-lib-rfsa.service16
-rw-r--r--recipes-support/fastrpc/fastrpc_git.bb43
6 files changed, 225 insertions, 6 deletions
diff --git a/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch b/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch
new file mode 100644
index 0000000..1206c6e
--- /dev/null
+++ b/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch
@@ -0,0 +1,128 @@
+From 771c3bc695a18b3bdedea6fac44b3e71708cc540 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Sat, 6 Mar 2021 04:25:01 +0300
+Subject: [PATCH] apps_std_fopen_with_env: account for domain kinds when
+ looking for data
+
+Currenty apps_std_fopen_with_env() will care about domain only in the
+fallback path when looking into /dsp/ dir (/dsp/adsp, /dsp/cdsp, etc).
+Account for different domains when looking for the file in the path (so
+that e.g. cDSP files will be looked up in the /usr/lib/rfsa/cdsp
+directory rather than the default /usr/lib/rfsa/adsp).
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Change-Id: I1dac61d36edc9e8ff1fdc2d56f968d2578f10399
+---
+ src/apps_std_imp.c | 60 ++++++++++++++++++++++------------------------
+ 1 file changed, 28 insertions(+), 32 deletions(-)
+
+diff --git a/src/apps_std_imp.c b/src/apps_std_imp.c
+index d2559c60d2d6..701d799f5608 100644
+--- a/src/apps_std_imp.c
++++ b/src/apps_std_imp.c
+@@ -662,6 +662,7 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna
+ char *absName = NULL;
+ uint16 absNameLen = 0;
+ int domain;
++ const char *dspName = NULL;
+
+ VERIFYC(NULL != mode, AEE_EINVALIDMODE);
+ VERIFYC(NULL != delim, AEE_EINVALIDFORMAT);
+@@ -670,8 +671,23 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna
+ VERIFY(0 == (nErr = get_dirlist_from_env(envvarname, &dirListBuf )));
+ VERIFYC(NULL != (dirList = dirListBuf), AEE_EMEMPTR);
+
++ domain = get_domain_id() & DOMAIN_ID_MASK;
++
++ if (domain == ADSP_DOMAIN_ID){
++ dspName = "adsp";
++ } else if (domain == MDSP_DOMAIN_ID){
++ dspName = "mdsp";
++ } else if (domain == SDSP_DOMAIN_ID){
++ dspName = "sdsp";
++ } else if (domain == CDSP_DOMAIN_ID) {
++ dspName = "cdsp";
++ } else {
++ dspName = "adsp";
++ }
++
+ while(dirList)
+ {
++ int dirNameLen;
+ pos = strstr(dirList, delim);
+ dirName = dirList;
+ if (pos) {
+@@ -682,10 +698,13 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna
+ }
+
+ // Account for slash char
+- absNameLen = std_strlen(dirName) + std_strlen(name) + 2;
++ dirNameLen = std_strlen(dirName);
++ absNameLen = dirNameLen + std_strlen(name) + 2;
+ VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY);
+ if ('\0' != *dirName) {
+ std_strlcpy(absName, dirName, absNameLen);
++ if (!std_strcmp(absName + dirNameLen - 4, "adsp"))
++ std_memscpy(absName + dirNameLen - 4, 4, dspName, 4);
+ std_strlcat(absName, "/", absNameLen);
+ std_strlcat(absName, name, absNameLen);
+ } else {
+@@ -699,47 +718,24 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna
+ goto bail;
+ }
+ }
+- domain = get_domain_id() & DOMAIN_ID_MASK;
+
+ #ifdef ANDROID_P
+ absNameLen = std_strlen("/vendor/dsp/adsp/") + std_strlen(name) + 1;
+ VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY);
+
+- if (domain == ADSP_DOMAIN_ID){
+- std_strlcpy(absName, "/vendor/dsp/adsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == MDSP_DOMAIN_ID){
+- std_strlcpy(absName, "/vendor/dsp/mdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == SDSP_DOMAIN_ID){
+- std_strlcpy(absName, "/vendor/dsp/sdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == CDSP_DOMAIN_ID) {
+- std_strlcpy(absName, "/vendor/dsp/cdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else {
+- absName[0] = '\0';
+- }
++ std_strlcpy(absName, "/vendor/dsp/", absNameLen);
++ std_strlcat(absName, dspName, absNameLen);
++ std_strlcat(absName, "/", absNameLen);
++ std_strlcat(absName, name,absNameLen);
+ nErr = apps_std_fopen(absName, mode, psout);
+ #else
+ absNameLen = std_strlen("/dsp/adsp/") + std_strlen(name) + 1;
+ VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY);
+
+- if (domain == ADSP_DOMAIN_ID){
+- std_strlcpy(absName, "/dsp/adsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == MDSP_DOMAIN_ID){
+- std_strlcpy(absName, "/dsp/mdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == SDSP_DOMAIN_ID){
+- std_strlcpy(absName, "/dsp/sdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == CDSP_DOMAIN_ID) {
+- std_strlcpy(absName, "/dsp/cdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else {
+- absName[0] = '\0';
+- }
++ std_strlcpy(absName, "/dsp/", absNameLen);
++ std_strlcat(absName, dspName, absNameLen);
++ std_strlcat(absName, "/", absNameLen);
++ std_strlcat(absName, name,absNameLen);
+ nErr = apps_std_fopen(absName, mode, psout);
+ #endif
+ bail:
+--
+2.30.0
+
diff --git a/recipes-support/fastrpc/fastrpc/adsprpcd.service b/recipes-support/fastrpc/fastrpc/adsprpcd.service
new file mode 100644
index 0000000..c2b09bf
--- /dev/null
+++ b/recipes-support/fastrpc/fastrpc/adsprpcd.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=aDSP RPC daemon
+
+[Service]
+Type=exec
+ExecStart=/usr/bin/adsprpcd
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-support/fastrpc/fastrpc/cdsprpcd.service b/recipes-support/fastrpc/fastrpc/cdsprpcd.service
new file mode 100644
index 0000000..39b7300
--- /dev/null
+++ b/recipes-support/fastrpc/fastrpc/cdsprpcd.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=cDSP RPC daemon
+
+[Service]
+Type=exec
+ExecStart=/usr/bin/cdsprpcd
+
+[Install]
+WantedBy=multi-user.target
diff --git a/recipes-support/fastrpc/fastrpc/mount-dsp.sh b/recipes-support/fastrpc/fastrpc/mount-dsp.sh
new file mode 100644
index 0000000..1bacfb8
--- /dev/null
+++ b/recipes-support/fastrpc/fastrpc/mount-dsp.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+if [ -r /sys/devices/soc0/machine ] ; then
+ MACHINE=`cat /sys/devices/soc0/machine`
+ case $MACHINE in
+ SM8250|QRB5160)
+ WHAT=/lib/firmware/qcom/sm8250/dspso.bin
+ ;;
+ esac
+fi
+
+if [ -z "$WHAT" -o ! -r "$WHAT"] ; then
+ if [ -h /dev/disk/by-partlabel/dsp_a ] ; then
+ WHAT=/dev/disk/by-partlabel/dsp_a
+ else
+ WHAT=/dev/disk/by-partlabel/dsp
+ fi
+fi
+
+if [ -e "$WHAT" ] ; then
+ mount $WHAT /usr/lib/rfsa -o ro
+else
+ echo "Not mounting /usr/lib/rfsa, partition/image not found" 1>&2
+fi
diff --git a/recipes-support/fastrpc/fastrpc/usr-lib-rfsa.service b/recipes-support/fastrpc/fastrpc/usr-lib-rfsa.service
new file mode 100644
index 0000000..f5fc76a
--- /dev/null
+++ b/recipes-support/fastrpc/fastrpc/usr-lib-rfsa.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Mount DSP partition to /usr/lib/rfsa
+DefaultDependencies=false
+Before=umount.target local-fs.target
+After=local-pre-fs.target
+Conflicts=umount.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=Yes
+TimeoutSec=0
+ExecStart=/usr/sbin/mount-dsp.sh
+ExecStop=/bin/umount /usr/lib/rfsa
+
+[Install]
+WantedBy=local-fs.target
diff --git a/recipes-support/fastrpc/fastrpc_git.bb b/recipes-support/fastrpc/fastrpc_git.bb
index 875bea5..179d42b 100644
--- a/recipes-support/fastrpc/fastrpc_git.bb
+++ b/recipes-support/fastrpc/fastrpc_git.bb
@@ -6,21 +6,52 @@ LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://src/fastrpc_apps_user.c;beginline=1;endline=29;md5=f94f3a7beba14ae2f59f817e9634f891"
SRCREV = "bc36c705c9b057ca880a423021d3c19f02edeadd"
-SRC_URI = "git://git.linaro.org/landing-teams/working/qualcomm/fastrpc.git;branch=automake;protocol=https"
+SRC_URI = "\
+ git://git.linaro.org/landing-teams/working/qualcomm/fastrpc.git;branch=automake;protocol=https \
+ file://0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch \
+ file://adsprpcd.service \
+ file://cdsprpcd.service \
+ file://usr-lib-rfsa.service \
+ file://mount-dsp.sh \
+"
PV = "0.0+${SRCPV}"
S = "${WORKDIR}/git"
-inherit autotools
+inherit autotools systemd
+
+PACKAGES += "${PN}-systemd"
+RRECOMMENDS_${PN} += "${PN}-systemd"
+
+SYSTEMD_PACKAGES = "${PN} ${PN}-systemd"
+
+SYSTEMD_SERVICE_${PN} = "usr-lib-rfsa.service"
+
+SYSTEMD_SERVICE_${PN}-systemd = "adsprpcd.service cdsprpcd.service"
+SYSTEMD_AUTO_ENABLE_${PN}-systemd = "disable"
+
+do_install_append() {
+ install -d ${D}${libdir}/rfsa
+
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/usr-lib-rfsa.service ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/adsprpcd.service ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/cdsprpcd.service ${D}${systemd_unitdir}/system
+
+ install -d ${D}${sbindir}
+ install -m 0755 ${WORKDIR}/mount-dsp.sh ${D}${sbindir}
+}
FILES_${PN} += " \
+ ${libdir}/rfsa \
${libdir}/libadsp_default_listener.so \
${libdir}/libcdsp_default_listener.so \
-"
-
-FILES_${PN}-dev_remove = "${FILES_SOLIBSDEV}"
-FILES_${PN}-dev += " \
${libdir}/libadsprpc.so \
${libdir}/libcdsprpc.so \
"
+
+FILES_${PN}-dev_remove = "${FILES_SOLIBSDEV}"
+
+# We need to include lib*dsprpc.so into fastrpc for compatibility with Hexagon SDK
+ERROR_QA_remove = "dev-so"