diff --git a/ci/MACHINES.json b/ci/MACHINES.json index 7ef482c..44d8ecd 100644 --- a/ci/MACHINES.json +++ b/ci/MACHINES.json @@ -1,4 +1,20 @@ { - "qcs9100-ride-r3": ["sa8775p-ride", "qcs9100-ride"], - "qcs8300-ride": ["qcs8300-ride", "qcs8300-ride"] -} + "qcs6490-rb3gen2": { + "deviceTree": "qcs6490-rb3gen2", + "linuxFirmware": "qcs6490", + "lavaDeviceName": "qcs6490", + "hexDSPBinary": "qcm6490" + }, + "qcs9100-ride-r3": { + "deviceTree": "qcs9100-ride-r3", + "linuxFirmware": "sa8775p", + "lavaDeviceName": "qcs9100-ride", + "hexDSPBinary": "sa8775p" + }, + "qcs8300-ride": { + "deviceTree": "qcs8300-ride", + "linuxFirmware": "qcs8300", + "lavaDeviceName": "qcs8300-ride", + "hexDSPBinary": "qcs8300" + } +} \ No newline at end of file diff --git a/debian/README.source b/debian/README.source index 117aadf..c0b5a6b 100644 --- a/debian/README.source +++ b/debian/README.source @@ -1,6 +1,3 @@ -Library packages -================ - The upstream fastrpc library comprises six shared libraries and one set of include files. The shared libraries are in pairs, supporting three classes of DSP. The shared libraries for each class support a common ABI @@ -24,28 +21,3 @@ safe, as permitted under Debian policy section 8.1. libfastrpc1 ships all six shared libraries, and libfastrpc-dev ships the six .so symlinks and the single set of headers. - -Test suite binaries -=================== - -Currently upstream is unable to ship the sources for the test suite that is -included in the upstream release for technical toolchain reasons, contrary to -DFSG. Upstream aim to address this and this is tracked upstream at -https://github.com/qualcomm/fastrpc/issues/235. - -However, they remain licensed under BSD-3-Clause, so are redistributable -by Debian. For this reason, I didn't bother with a repack to exclude the -files, instead just ensuring that these do not end up in any binary -builds. The upstream build system simply installs these directly with -`make install`, so it is trivial to put these files into -debian/not-installed with a high degree of confidence that they will not -slip through. - -lintian source-contains-prebuilt-binary tags are overriden accordingly, -but only for the current set of named files so as not to miss anything -else that might have a different reason for being present. - -Since the build system selects 'linux' and not 'android', binaries -shipped in test/android/ do not get installed by `make install` and -therefore do not appear in debian/not-installed even though they are -overridden in lintian. diff --git a/debian/changelog b/debian/changelog index c7ed9ce..a4a3ac5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +fastrpc (1.0.1-1) UNRELEASED; urgency=medium + + * New upstream release. + * d/p/dlopen-abi-version: drop (fixed upstream). + + -- Robie Basak Tue, 16 Dec 2025 15:05:04 +0000 + fastrpc (1.0.0-1) unstable; urgency=medium * Initial packaging. (Closes: #1116042) diff --git a/debian/control b/debian/control index 475d482..b0973ca 100644 --- a/debian/control +++ b/debian/control @@ -39,3 +39,12 @@ Description: Qualcomm FastRPC - support daemons and udev rules This package provides the necessary support daemons used to supply object code to the DSPs and the udev rules to make the DSPs available to users. Depends: adduser, hexagon-dsp-binaries, ${misc:Depends}, ${shlibs:Depends} + +Package: fastrpc-tests +Architecture: arm64 +Description: Qualcomm FastRPC - test programs + FastRPC is the Qualcomm-proprietary RPC mechanism used to enable remote + function calls between the CPU and aDSP. Development package. + . + This package provides the FastRPC test suite. +Depends: ${misc:Depends}, ${shlibs:Depends} diff --git a/debian/fastrpc-tests.install b/debian/fastrpc-tests.install new file mode 100644 index 0000000..d012475 --- /dev/null +++ b/debian/fastrpc-tests.install @@ -0,0 +1,10 @@ +usr/bin/fastrpc_test +usr/lib/${DEB_HOST_MULTIARCH}/fastrpc_test/libcalculator.so +usr/lib/${DEB_HOST_MULTIARCH}/fastrpc_test/libhap_example.so +usr/lib/${DEB_HOST_MULTIARCH}/fastrpc_test/libmultithreading.so +usr/share/fastrpc_test/v68/libcalculator_skel.so +usr/share/fastrpc_test/v68/libhap_example_skel.so +usr/share/fastrpc_test/v68/libmultithreading_skel.so +usr/share/fastrpc_test/v75/libcalculator_skel.so +usr/share/fastrpc_test/v75/libhap_example_skel.so +usr/share/fastrpc_test/v75/libmultithreading_skel.so diff --git a/debian/fastrpc-tests.lintian-overrides b/debian/fastrpc-tests.lintian-overrides new file mode 100644 index 0000000..9a41f97 --- /dev/null +++ b/debian/fastrpc-tests.lintian-overrides @@ -0,0 +1,6 @@ +# These are binaries built for DSPs, not the host +fastrpc-tests binary: arch-dependent-file-in-usr-share [usr/share/fastrpc_test/*] +fastrpc-tests binary: binary-from-other-architecture [usr/share/fastrpc_test/*] +fastrpc-tests binary: hardening-no-relro [usr/share/fastrpc_test/*] +fastrpc-tests binary: library-not-linked-against-libc [usr/share/fastrpc_test/*] +fastrpc-tests binary: shared-library-lacks-stack-section [usr/share/fastrpc_test/*] diff --git a/debian/gbp.conf b/debian/gbp.conf index 13bb1a0..17d382d 100644 --- a/debian/gbp.conf +++ b/debian/gbp.conf @@ -1,2 +1,3 @@ [DEFAULT] debian-branch = debian/latest +upstream-tag = upstream/v%(version)s diff --git a/debian/not-installed b/debian/not-installed index a201114..f8722d1 100644 --- a/debian/not-installed +++ b/debian/not-installed @@ -5,15 +5,3 @@ usr/lib/${DEB_HOST_MULTIARCH}/libcdsp_default_listener.la usr/lib/${DEB_HOST_MULTIARCH}/libcdsprpc.la usr/lib/${DEB_HOST_MULTIARCH}/libsdsp_default_listener.la usr/lib/${DEB_HOST_MULTIARCH}/libsdsprpc.la - -# fastrpc_test components cannot currently ship in Debian; see README.source -usr/bin/fastrpc_test -usr/lib/${DEB_HOST_MULTIARCH}/fastrpc_test/libcalculator.so -usr/lib/${DEB_HOST_MULTIARCH}/fastrpc_test/libhap_example.so -usr/lib/${DEB_HOST_MULTIARCH}/fastrpc_test/libmultithreading.so -usr/share/fastrpc_test/v68/libcalculator_skel.so -usr/share/fastrpc_test/v68/libhap_example_skel.so -usr/share/fastrpc_test/v68/libmultithreading_skel.so -usr/share/fastrpc_test/v75/libcalculator_skel.so -usr/share/fastrpc_test/v75/libhap_example_skel.so -usr/share/fastrpc_test/v75/libmultithreading_skel.so diff --git a/debian/patches/dlopen-abi-version b/debian/patches/dlopen-abi-version deleted file mode 100644 index e841a46..0000000 --- a/debian/patches/dlopen-abi-version +++ /dev/null @@ -1,28 +0,0 @@ -From: Robie Basak -Description: use versioned .so.1 names when calling dlopen() - Since Debian does not ship the .so symlink in its runtime library packages, - they cannot be used at runtime. Explicitly referencing the required ABI version - is the correct way to do this, to avoid problems with any future ABI - incompatilities. -Bug: https://github.com/qualcomm/fastrpc/issues/230 -Last-Update: 2025-10-22 - ---- a/src/dsprpcd.c -+++ b/src/dsprpcd.c -@@ -16,13 +16,13 @@ - #include - - #ifndef ADSP_DEFAULT_LISTENER_NAME --#define ADSP_DEFAULT_LISTENER_NAME "libadsp_default_listener.so" -+#define ADSP_DEFAULT_LISTENER_NAME "libadsp_default_listener.so.1" - #endif - #ifndef CDSP_DEFAULT_LISTENER_NAME --#define CDSP_DEFAULT_LISTENER_NAME "libcdsp_default_listener.so" -+#define CDSP_DEFAULT_LISTENER_NAME "libcdsp_default_listener.so.1" - #endif - #ifndef SDSP_DEFAULT_LISTENER_NAME --#define SDSP_DEFAULT_LISTENER_NAME "libsdsp_default_listener.so" -+#define SDSP_DEFAULT_LISTENER_NAME "libsdsp_default_listener.so.1" - #endif - #ifndef GDSP_DEFAULT_LISTENER_NAME - #define GDSP_DEFAULT_LISTENER_NAME "libcdsp_default_listener.so.1" diff --git a/debian/patches/series b/debian/patches/series index 4be349c..22ec3fe 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1 @@ -dlopen-abi-version open-shell-path diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides deleted file mode 100644 index ddfb274..0000000 --- a/debian/source/lintian-overrides +++ /dev/null @@ -1,13 +0,0 @@ -# See README.source -fastrpc source: source-contains-prebuilt-binary [test/android/libcalculator.so] -fastrpc source: source-contains-prebuilt-binary [test/android/libhap_example.so] -fastrpc source: source-contains-prebuilt-binary [test/android/libmultithreading.so] -fastrpc source: source-contains-prebuilt-binary [test/linux/libcalculator.so] -fastrpc source: source-contains-prebuilt-binary [test/linux/libhap_example.so] -fastrpc source: source-contains-prebuilt-binary [test/linux/libmultithreading.so] -fastrpc source: source-contains-prebuilt-binary [test/v68/libcalculator_skel.so] -fastrpc source: source-contains-prebuilt-binary [test/v68/libhap_example_skel.so] -fastrpc source: source-contains-prebuilt-binary [test/v68/libmultithreading_skel.so] -fastrpc source: source-contains-prebuilt-binary [test/v75/libcalculator_skel.so] -fastrpc source: source-contains-prebuilt-binary [test/v75/libhap_example_skel.so] -fastrpc source: source-contains-prebuilt-binary [test/v75/libmultithreading_skel.so] diff --git a/inc/Makefile.am b/inc/Makefile.am index 24f281f..fa89ed3 100644 --- a/inc/Makefile.am +++ b/inc/Makefile.am @@ -1,16 +1,16 @@ # Export fastrpc headers fastrpc_includedir = $(includedir)/fastrpc fastrpc_include_HEADERS = $(top_srcdir)/inc/AEEStdErr.h +fastrpc_include_HEADERS += $(top_srcdir)/inc/AEEStdDef.h fastrpc_include_HEADERS += $(top_srcdir)/inc/remote.h fastrpc_include_HEADERS += $(top_srcdir)/inc/rpcmem.h +fastrpc_include_HEADERS += $(top_srcdir)/inc/HAP_farf.h +fastrpc_include_HEADERS += $(top_srcdir)/inc/HAP_debug.h noinst_HEADERS = \ AEEBufBound.h \ AEEQList.h \ - AEEStdDef.h \ AEEstd.h \ - HAP_debug.h \ - HAP_farf.h \ HAP_farf_internal.h \ HAP_pls.h \ adsp_current_process.h \ diff --git a/src/dsprpcd.c b/src/dsprpcd.c index b3d01f8..348049a 100644 --- a/src/dsprpcd.c +++ b/src/dsprpcd.c @@ -15,39 +15,80 @@ #include #include -#ifndef ADSP_DEFAULT_LISTENER_NAME -#define ADSP_DEFAULT_LISTENER_NAME "libadsp_default_listener.so" +#ifndef ADSP_LISTENER_VERSIONED +#define ADSP_LISTENER_VERSIONED "libadsp_default_listener.so.1" +#define ADSP_LISTENER_UNVERSIONED "libadsp_default_listener.so" #endif -#ifndef CDSP_DEFAULT_LISTENER_NAME -#define CDSP_DEFAULT_LISTENER_NAME "libcdsp_default_listener.so" +#ifndef CDSP_LISTENER_VERSIONED +#define CDSP_LISTENER_VERSIONED "libcdsp_default_listener.so.1" +#define CDSP_LISTENER_UNVERSIONED "libcdsp_default_listener.so" #endif -#ifndef SDSP_DEFAULT_LISTENER_NAME -#define SDSP_DEFAULT_LISTENER_NAME "libsdsp_default_listener.so" +#ifndef SDSP_LISTENER_VERSIONED +#define SDSP_LISTENER_VERSIONED "libsdsp_default_listener.so.1" +#define SDSP_LISTENER_UNVERSIONED "libsdsp_default_listener.so" #endif -#ifndef GDSP_DEFAULT_LISTENER_NAME -#define GDSP_DEFAULT_LISTENER_NAME "libcdsp_default_listener.so.1" +#ifndef GDSP_LISTENER_VERSIONED +#define GDSP_LISTENER_VERSIONED "libcdsp_default_listener.so.1" +#define GDSP_LISTENER_UNVERSIONED "libcdsp_default_listener.so" #endif typedef int (*dsp_default_listener_start_t)(int argc, char *argv[]); +// Result struct for dlopen. +struct dlopen_result { + void *handle; + const char *loaded_lib_name; +}; + +/** + * Attempts to load a shared library using dlopen. + * If the versioned name fails, falls back to the unversioned name. + * Returns both the handle and the name of the library successfully loaded. + */ +static struct dlopen_result try_dlopen(const char *versioned, const char *unversioned) { + struct dlopen_result result = { NULL, NULL }; + + result.handle = dlopen(versioned, RTLD_NOW); + if (result.handle) { + result.loaded_lib_name = versioned; + return result; + } + + if (unversioned) { + VERIFY_IPRINTF("dlopen failed for %s: %s; attempting fallback %s", + versioned, dlerror(), unversioned); + result.handle = dlopen(unversioned, RTLD_NOW); + if (result.handle) { + result.loaded_lib_name = unversioned; + return result; + } + } + return result; +} + int main(int argc, char *argv[]) { int nErr = 0; - void *dsphandler = NULL; - const char* lib_name; + struct dlopen_result dlres = { NULL, NULL }; + const char* lib_versioned; + const char* lib_unversioned; const char* dsp_name; dsp_default_listener_start_t listener_start; #ifdef USE_ADSP - lib_name = ADSP_DEFAULT_LISTENER_NAME; + lib_versioned = ADSP_LISTENER_VERSIONED; + lib_unversioned = ADSP_LISTENER_UNVERSIONED; dsp_name = "ADSP"; #elif defined(USE_SDSP) - lib_name = SDSP_DEFAULT_LISTENER_NAME; + lib_versioned = SDSP_LISTENER_VERSIONED; + lib_unversioned = SDSP_LISTENER_UNVERSIONED; dsp_name = "SDSP"; #elif defined(USE_CDSP) - lib_name = CDSP_DEFAULT_LISTENER_NAME; + lib_versioned = CDSP_LISTENER_VERSIONED; + lib_unversioned = CDSP_LISTENER_UNVERSIONED; dsp_name = "CDSP"; #elif defined(USE_GDSP) - lib_name = GDSP_DEFAULT_LISTENER_NAME; + lib_versioned = GDSP_LISTENER_VERSIONED; + lib_unversioned = GDSP_LISTENER_UNVERSIONED; dsp_name = "GDSP"; #else goto bail; @@ -55,14 +96,15 @@ int main(int argc, char *argv[]) { VERIFY_EPRINTF("%s daemon starting", dsp_name); while (1) { - if (NULL != (dsphandler = dlopen(lib_name,RTLD_NOW))) { + dlres = try_dlopen(lib_versioned, lib_unversioned); + if (NULL != dlres.handle) { if (NULL != (listener_start = (dsp_default_listener_start_t)dlsym( - dsphandler, "adsp_default_listener_start"))) { + dlres.handle, "adsp_default_listener_start"))) { VERIFY_IPRINTF("adsp_default_listener_start called"); nErr = listener_start(argc, argv); } - if (0 != dlclose(dsphandler)) { - VERIFY_EPRINTF("dlclose failed for %s", lib_name); + if (0 != dlclose(dlres.handle)) { + VERIFY_EPRINTF("dlclose failed for %s", dlres.loaded_lib_name); } } else { VERIFY_EPRINTF("%s daemon error %s", dsp_name, dlerror()); diff --git a/src/fastrpc_apps_user.c b/src/fastrpc_apps_user.c index 81fef0a..9668c06 100644 --- a/src/fastrpc_apps_user.c +++ b/src/fastrpc_apps_user.c @@ -4040,15 +4040,6 @@ static int domain_init(int domain, int *dev) { ret == (int)(DSP_AEE_EOFFSET + AEE_EUNSUPPORTED), ret); } -#ifdef PD_EXCEPTION_LOGGING - if ((dom != SDSP_DOMAIN_ID) && hlist[domain].dsppd == ROOT_PD) { - remote_handle64 handle = 0; - handle = get_adspmsgd_adsp1_handle(domain); - if (handle != INVALID_HANDLE) { - adspmsgd_init(handle, 0x10); // enable PD exception logging - } - } -#endif fastrpc_perf_init(hlist[domain].dev, domain); VERIFY(AEE_SUCCESS == (nErr = fastrpc_latency_init(hlist[domain].dev, &hlist[domain].qos))); @@ -4059,6 +4050,13 @@ static int domain_init(int domain, int *dev) { VERIFY(AEE_SUCCESS == (nErr = listener_android_domain_init( domain, hlist[domain].th_params.update_requested, &hlist[domain].th_params.r_sem))); + if ((dom != SDSP_DOMAIN_ID) && hlist[domain].dsppd == ROOT_PD) { + remote_handle64 handle = 0; + handle = get_adspmsgd_adsp1_handle(domain); + if (handle != INVALID_HANDLE) { + adspmsgd_init(handle, 0x10); // enable PD exception logging + } + } bail: if (nErr != AEE_SUCCESS) { domain_deinit(domain); @@ -4171,6 +4169,7 @@ static int fastrpc_apps_user_init(void) { VERIFY(AEE_SUCCESS == (nErr = PL_INIT(gpls))); VERIFY(AEE_SUCCESS == (nErr = PL_INIT(rpcmem))); + VERIFY(AEE_SUCCESS == (nErr = pthread_key_create(&tlsKey, exit_thread))); fastrpc_mem_init(); fastrpc_context_table_init(); fastrpc_log_init(); @@ -4201,7 +4200,6 @@ static int fastrpc_apps_user_init(void) { pthread_mutex_init(&hlist[i].async_init_deinit_mut, 0); } listener_android_init(); - VERIFY(AEE_SUCCESS == (nErr = pthread_key_create(&tlsKey, exit_thread))); VERIFY(AEE_SUCCESS == (nErr = PL_INIT(apps_std))); GenCrc32Tab(POLY32, crc_table); fastrpc_notif_init();