Skip to content

Commit e4f55c4

Browse files
committed
Add DSP_LIBRARY_PATH mappings for target machines
Add DSP_LIBRARY_PATH entries in a new YAML file for the supported machines to enable consistent, machine-specific DSP library resolution. The machine entries are sorted alphabetically by machine name to ensure maintainability and stability as new properties are added in the future. Also update the test script (check.py) to validate that paths in config.txt are consistent with entries in machine_dsp_paths.yml, and update the Makefile to install the YAML file to the conf.d directory alongside the DSP binaries. Signed-off-by: Vinayak Katoch <[email protected]>
1 parent a0ea88b commit e4f55c4

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ clean:
1010

1111
install:
1212
./scripts/install.sh config.txt ${DESTDIR}/${DSPDIR}
13+
install -D -m 0644 machine_dsp_paths.yml ${DESTDIR}/${DSPDIR}/conf.d/machine_dsp_paths.yml
1314

1415
TAG = $(shell git describe)
1516
NAME = hexagon-dsp-binaries

machine_dsp_paths.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Machine entries are sorted alphabetically by machine name (key)
2+
# This sorting order ensures maintainability and stability as new properties are added
3+
machines:
4+
"Qualcomm SA8775P Ride":
5+
DSP_LIBRARY_PATH: "sa8775p/Qualcomm/SA8775P-RIDE/dsp"
6+
"Qualcomm SA8775P Ride Rev3":
7+
DSP_LIBRARY_PATH: "sa8775p/Qualcomm/SA8775P-RIDE/dsp"
8+
"Qualcomm Technologies, Inc. DB820c":
9+
DSP_LIBRARY_PATH: "apq8096/Qualcomm/db820c/dsp"
10+
"Qualcomm Technologies, Inc. Hamoa IoT EVK":
11+
DSP_LIBRARY_PATH: "x1e80100/Qualcomm/Hamoa-IoT-EVK/dsp"
12+
"Qualcomm Technologies, Inc. Lemans EVK":
13+
DSP_LIBRARY_PATH: "sa8775p/Qualcomm/IQ9075-EVK/dsp"
14+
"Qualcomm Technologies, Inc. Monaco EVK":
15+
DSP_LIBRARY_PATH: "qcs8300/Qualcomm/IQ8275-EVK/dsp"
16+
"Qualcomm Technologies, Inc. QCS615 Ride (IQ-615 Beta EVK)":
17+
DSP_LIBRARY_PATH: "qcs615/Qualcomm/QCS615-RIDE/dsp"
18+
"Qualcomm Technologies, Inc. QCS8300 Ride":
19+
DSP_LIBRARY_PATH: "qcs8300/Qualcomm/QCS8300-RIDE/dsp"
20+
"Qualcomm Technologies, Inc. QRB4210 RB2":
21+
DSP_LIBRARY_PATH: "qrb4210/Thundercomm/RB2/dsp"
22+
"Qualcomm Technologies, Inc. Robotics RB1":
23+
DSP_LIBRARY_PATH: "qcm2290/Thundercomm/RB1/dsp"
24+
"Qualcomm Technologies, Inc. Robotics RB3gen2":
25+
DSP_LIBRARY_PATH: "qcm6490/Thundercomm/RB3gen2/dsp"
26+
"Qualcomm Technologies, Inc. Robotics RB5":
27+
DSP_LIBRARY_PATH: "sm8250/Thundercomm/RB5/dsp"
28+
"Thundercomm Dragonboard 845c":
29+
DSP_LIBRARY_PATH: "sdm845/Thundercomm/db845c/dsp"

scripts/check.py

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: MIT
33
# Copyright (c) 2024-2025 Linaro Ltd.
44

5-
import os, re, sys
5+
import os, re, sys, yaml
66

77
def empty_data():
88
return {'dirs': {}}
@@ -175,6 +175,60 @@ def list_git():
175175
if git.close():
176176
sys.stderr.write("WHENCE: skipped contents validation, git file listing failed\n")
177177

178+
def load_machine_dsp_paths():
179+
"""Load and parse machine_dsp_paths.yml to get valid DSP library paths."""
180+
try:
181+
with open("machine_dsp_paths.yml", encoding="utf-8") as file:
182+
data = yaml.safe_load(file)
183+
if not data or 'machines' not in data:
184+
return set()
185+
186+
# Extract base paths (without /dsp suffix) from DSP_LIBRARY_PATH
187+
paths = set()
188+
for machine_name, machine_data in data['machines'].items():
189+
if 'DSP_LIBRARY_PATH' in machine_data:
190+
dsp_path = machine_data['DSP_LIBRARY_PATH']
191+
# Remove /dsp suffix to get base path
192+
if dsp_path.endswith('/dsp'):
193+
base_path = dsp_path[:-4]
194+
paths.add(base_path)
195+
return paths
196+
except FileNotFoundError:
197+
sys.stderr.write("Warning: machine_dsp_paths.yml not found, skipping path consistency check\n")
198+
return None
199+
except Exception as e:
200+
sys.stderr.write("Error loading machine_dsp_paths.yml: %s\n" % e)
201+
return None
202+
203+
def check_config_against_machine_paths(config_data, machine_paths):
204+
"""Check that config.txt paths are consistent with machine_dsp_paths.yml."""
205+
if machine_paths is None:
206+
return True
207+
208+
ret = True
209+
reported_paths = set() # Track paths we've already reported as missing
210+
211+
for data in config_data:
212+
if data[0] == "install":
213+
(lineno, path, dsp, subdir) = data[1:]
214+
if path not in machine_paths and path not in reported_paths:
215+
sys.stderr.write("config.txt:%d: Install path '%s' not found in machine_dsp_paths.yml\n" % (lineno, path))
216+
reported_paths.add(path)
217+
ret = False
218+
elif data[0] == "link":
219+
(lineno, src_path, dst_path) = data[1:]
220+
# Extract base path from link target (dst_path)
221+
# Link format: path/to/device/dsp/dsptype
222+
parts = dst_path.split('/')
223+
if len(parts) >= 2 and parts[-2] == 'dsp':
224+
base_path = '/'.join(parts[:-2])
225+
if base_path not in machine_paths and base_path not in reported_paths:
226+
sys.stderr.write("config.txt:%d: Link target base path '%s' not found in machine_dsp_paths.yml\n" % (lineno, base_path))
227+
reported_paths.add(base_path)
228+
ret = False
229+
230+
return ret
231+
178232
def check_dir(subdir):
179233
pattern_shell = re.compile("^fastrpc_shell(_unsigned)?_[0-9]$")
180234
pattern_library = re.compile("^[-_+0-9a-zA-Z]*\\.so(\\.[0-9]*)?$")
@@ -212,7 +266,7 @@ def main():
212266
if 'licence' in data:
213267
licences[data['licence'][0]] = None
214268

215-
known_files = ['config.txt', 'Makefile', 'TODO', 'README.md', 'WHENCE']
269+
known_files = ['config.txt', 'Makefile', 'TODO', 'README.md', 'WHENCE', 'machine_dsp_paths.yml']
216270

217271
for file in list_git():
218272
if os.path.dirname(file) in dirs:
@@ -233,15 +287,25 @@ def main():
233287
sys.stderr.write("WHENCE: file %s is not under a listed directory\n" % file)
234288
okay = False
235289

290+
# Load machine_dsp_paths.yml for consistency checking
291+
machine_paths = load_machine_dsp_paths()
292+
293+
# Collect config data for consistency check
294+
config_data = []
236295
try:
237296
for data in load_config():
297+
config_data.append(data)
238298
if not check_config(data, dirs):
239299
okay = False
240300

241301
except Exception as e:
242302
sys.stderr.write("%s\n" % e)
243303
okay = False
244304

305+
# Check config.txt paths against machine_dsp_paths.yml
306+
if not check_config_against_machine_paths(config_data, machine_paths):
307+
okay = False
308+
245309
for entry in dirs.keys():
246310
if not check_dir(entry):
247311
sys.stderr.write("WHENCE: subdir %s failed the checks\n" % entry)

0 commit comments

Comments
 (0)