[PATCH v3] selftest: remoteproc: Add test for start/stop sequence

2024-10-24 Thread Wasim Nazir
Add test to validate end-to-end start/stop sequence for
each remoteproc instances available on target.

Add first test sequence to validated each instance sequencially
to identify any issue while booting each instance.
Add second test sequence to validate all instances concurrently
to identify any race scenario within instances doing bootup.

Additional user argument (--seqdelay) is available to add
delay is seconds, between start/stop sequence. This is added
as different target might have different threshold to start
any instance (default is 5 secs).

Running tests:
./remoteproc_test.sh --seqdelay 10

Signed-off-by: Wasim Nazir 
---
 MAINTAINERS   |   1 +
 tools/testing/selftests/Makefile  |   1 +
 tools/testing/selftests/remoteproc/Makefile   |   4 +
 tools/testing/selftests/remoteproc/config |   1 +
 .../selftests/remoteproc/remoteproc_test.sh   | 157 ++
 5 files changed, 164 insertions(+)
 create mode 100644 tools/testing/selftests/remoteproc/Makefile
 create mode 100644 tools/testing/selftests/remoteproc/config
 create mode 100644 tools/testing/selftests/remoteproc/remoteproc_test.sh


Test output with 4 remoteproc instances:

TAP version 13
1..5
# Testing rproc start/stop sequence for each instance sequencially
# Testing rproc sequence for 408.remoteproc
ok 1 408.remoteproc
# Testing rproc sequence for 370.remoteproc
ok 2 370.remoteproc
# Testing rproc sequence for 8a0.remoteproc
ok 3 8a0.remoteproc
# Testing rproc sequence for a30.remoteproc
ok 4 a30.remoteproc
# Testing rproc start/stop sequence for all instances concurrently
ok 5 for all remoteproc0 remoteproc1 remoteproc2 remoteproc3
# Totals: pass:5 fail:0 xfail:0 xpass:0 skip:0 error:0

Changes in v3:
- Add user argument for sequence delay (--sedelay).
- Update commit & add comments.
- v2: 
https://lore.kernel.org/all/20240927112132.3927298-1-quic_was...@quicinc.com/

diff --git a/MAINTAINERS b/MAINTAINERS
index e9659a5a7fb3..1f8182473be1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19481,6 +19481,7 @@ F:  Documentation/staging/remoteproc.rst
 F: drivers/remoteproc/
 F: include/linux/remoteproc.h
 F: include/linux/remoteproc/
+F: tools/testing/selftests/remoteproc/

 REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM
 M: Bjorn Andersson 
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 363d031a16f7..78669153be90 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -82,6 +82,7 @@ TARGETS += proc
 TARGETS += pstore
 TARGETS += ptrace
 TARGETS += openat2
+TARGETS += remoteproc
 TARGETS += resctrl
 TARGETS += riscv
 TARGETS += rlimits
diff --git a/tools/testing/selftests/remoteproc/Makefile 
b/tools/testing/selftests/remoteproc/Makefile
new file mode 100644
index ..a84b3934fd36
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+TEST_PROGS := remoteproc_test.sh
+
+include ../lib.mk
diff --git a/tools/testing/selftests/remoteproc/config 
b/tools/testing/selftests/remoteproc/config
new file mode 100644
index ..a5c237d2f3b4
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/config
@@ -0,0 +1 @@
+CONFIG_REMOTEPROC=y
diff --git a/tools/testing/selftests/remoteproc/remoteproc_test.sh 
b/tools/testing/selftests/remoteproc/remoteproc_test.sh
new file mode 100644
index ..d58c1e10005c
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/remoteproc_test.sh
@@ -0,0 +1,157 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+#
+
+DIR="$(dirname $(readlink -f "$0"))"
+
+KTAP_HELPERS="${DIR}/../kselftest/ktap_helpers.sh"
+if [ -e "$KTAP_HELPERS" ]; then
+. "$KTAP_HELPERS"
+else
+echo -n "1..0 # SKIP $KTAP_HELPERS file not found"
+exit 4
+fi
+
+RPROC_SYS=/sys/class/remoteproc
+RPROC_SEQ_SLEEP=5
+
+rproc_instances=
+num_tests=0
+test_err=0
+
+check_error() {
+   if [ $? -ne 0 ]; then
+   test_err=$((test_err+1))
+   ktap_print_msg "$@"
+   fi
+}
+
+parse_args() {
+   script=${0##*/}
+
+   if [ $# -eq 2 ] && [ "$1" = "--seqdelay" ]; then
+   shift || true
+   RPROC_SEQ_SLEEP=$1
+   else
+   ktap_print_msg "Usage: ${script} --seqdelay "
+   ktap_print_msg "Proceed with default sequence delay = 
$RPROC_SEQ_SLEEP"
+   fi
+}
+
+rproc_stop_instances() {
+   for instance in ${rproc_instances}; do
+   rproc=${RPROC_SYS}/$instance
+   rproc_name=$(cat $rproc/name)
+   rproc_state=$(cat $rproc/state)
+
+   echo stop > "$rproc/state"
+   check_error "$rproc_name sta

[RFC] remoteproc: Clean rproc-driver-data for each instance

2024-10-28 Thread Wasim Nazir
Currently, all Qualcomm remoteproc client drivers have data structures
with many common fields. Clean these data structures to categorize the
common fields and create macros to fill rproc-driver-data instances.
This will help reduce duplicates and make it easier for developers
to fill data using the macros.

Currently, changes have been added for the PAS driver only.

Signed-off-by: Wasim Nazir 
---
 drivers/remoteproc/qcom_q6v5_pas.c | 737 +
 1 file changed, 129 insertions(+), 608 deletions(-)

diff --git a/drivers/remoteproc/qcom_q6v5_pas.c 
b/drivers/remoteproc/qcom_q6v5_pas.c
index ef82835e98a4..58311c9ad609 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -819,613 +819,134 @@ static void adsp_remove(struct platform_device *pdev)
device_init_wakeup(adsp->dev, false);
 }

-static const struct adsp_data adsp_resource_init = {
-   .crash_reason_smem = 423,
-   .firmware_name = "adsp.mdt",
-   .pas_id = 1,
-   .auto_boot = true,
-   .ssr_name = "lpass",
-   .sysmon_name = "adsp",
-   .ssctl_id = 0x14,
-};
-
-static const struct adsp_data sa8775p_adsp_resource = {
-   .crash_reason_smem = 423,
-   .firmware_name = "adsp.mbn",
-   .pas_id = 1,
-   .minidump_id = 5,
-   .auto_boot = true,
-   .proxy_pd_names = (char*[]){
-   "lcx",
-   "lmx",
-   NULL
-   },
-   .load_state = "adsp",
-   .ssr_name = "lpass",
-   .sysmon_name = "adsp",
-   .ssctl_id = 0x14,
-};
-
-static const struct adsp_data sdm845_adsp_resource_init = {
-   .crash_reason_smem = 423,
-   .firmware_name = "adsp.mdt",
-   .pas_id = 1,
-   .auto_boot = true,
-   .load_state = "adsp",
-   .ssr_name = "lpass",
-   .sysmon_name = "adsp",
-   .ssctl_id = 0x14,
-};
-
-static const struct adsp_data sm6350_adsp_resource = {
-   .crash_reason_smem = 423,
-   .firmware_name = "adsp.mdt",
-   .pas_id = 1,
-   .auto_boot = true,
-   .proxy_pd_names = (char*[]){
-   "lcx",
-   "lmx",
-   NULL
-   },
-   .load_state = "adsp",
-   .ssr_name = "lpass",
-   .sysmon_name = "adsp",
-   .ssctl_id = 0x14,
-};
-
-static const struct adsp_data sm6375_mpss_resource = {
-   .crash_reason_smem = 421,
-   .firmware_name = "modem.mdt",
-   .pas_id = 4,
-   .minidump_id = 3,
-   .auto_boot = false,
-   .proxy_pd_names = (char*[]){
-   "cx",
-   NULL
-   },
-   .ssr_name = "mpss",
-   .sysmon_name = "modem",
-   .ssctl_id = 0x12,
-};
-
-static const struct adsp_data sm8150_adsp_resource = {
-   .crash_reason_smem = 423,
-   .firmware_name = "adsp.mdt",
-   .pas_id = 1,
-   .auto_boot = true,
-   .proxy_pd_names = (char*[]){
-   "cx",
-   NULL
-   },
-   .load_state = "adsp",
-   .ssr_name = "lpass",
-   .sysmon_name = "adsp",
-   .ssctl_id = 0x14,
-};
-
-static const struct adsp_data sm8250_adsp_resource = {
-   .crash_reason_smem = 423,
-   .firmware_name = "adsp.mdt",
-   .pas_id = 1,
-   .auto_boot = true,
-   .proxy_pd_names = (char*[]){
-   "lcx",
-   "lmx",
-   NULL
-   },
-   .load_state = "adsp",
-   .ssr_name = "lpass",
-   .sysmon_name = "adsp",
-   .ssctl_id = 0x14,
-};
-
-static const struct adsp_data sm8350_adsp_resource = {
-   .crash_reason_smem = 423,
-   .firmware_name = "adsp.mdt",
-   .pas_id = 1,
-   .auto_boot = true,
-   .proxy_pd_names = (char*[]){
-   "lcx",
-   "lmx",
-   NULL
-   },
-   .load_state = "adsp",
-   .ssr_name = "lpass",
-   .sysmon_name = "adsp",
-   .ssctl_id = 0x14,
-};
-
-static const struct adsp_data msm8996_adsp_resource = {
-   .crash_reason_smem = 423,
-   .firmware_name = "adsp.mdt",
-   .pas_id = 1,
-   .auto_boot = true,
-   .proxy_pd_names = (char*[]){
-   "cx",
-   NULL
-   },
-   .ssr_name = "lpass",
-   .sysmon_name = "adsp",
-   .ssctl_id = 0x14,
-};
-
-static const struct adsp_data cdsp_resource_init = {
-   .crash_reason_smem = 601,
-   .firmware_name = "cdsp.mdt",
-   .pas_id = 18,
-   .auto_boot = true,
-   .ssr_name = "cdsp",
-   .sysmon_name = "cdsp",
-   .ssctl_id = 0x17,
-};
-
-static const struct

[PATCH v2] selftest: remoteproc: Add basic test for start/stop sequence

2024-09-27 Thread Wasim Nazir
This test includes:
1) Start/stop test for each rproc instance sequencially
2) Start/stop test for all rproc instances concurrently

Changes in v2:
- Update commit message
- Addressed start/stop flow

Signed-off-by: Wasim Nazir 

diff --git a/MAINTAINERS b/MAINTAINERS
index a0cd96b8..02ebad5ae790 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19596,6 +19596,7 @@ F:  Documentation/staging/remoteproc.rst
 F: drivers/remoteproc/
 F: include/linux/remoteproc.h
 F: include/linux/remoteproc/
+F: tools/testing/selftests/remoteproc/

 REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM
 M: Bjorn Andersson 
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index b38199965f99..0c8a0f427d01 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -82,6 +82,7 @@ TARGETS += proc
 TARGETS += pstore
 TARGETS += ptrace
 TARGETS += openat2
+TARGETS += remoteproc
 TARGETS += resctrl
 TARGETS += riscv
 TARGETS += rlimits
diff --git a/tools/testing/selftests/remoteproc/Makefile 
b/tools/testing/selftests/remoteproc/Makefile
new file mode 100644
index ..a84b3934fd36
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+TEST_PROGS := remoteproc_test.sh
+
+include ../lib.mk
diff --git a/tools/testing/selftests/remoteproc/config 
b/tools/testing/selftests/remoteproc/config
new file mode 100644
index ..a5c237d2f3b4
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/config
@@ -0,0 +1 @@
+CONFIG_REMOTEPROC=y
diff --git a/tools/testing/selftests/remoteproc/remoteproc_test.sh 
b/tools/testing/selftests/remoteproc/remoteproc_test.sh
new file mode 100644
index ..589368285307
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/remoteproc_test.sh
@@ -0,0 +1,134 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+#
+
+DIR="$(dirname $(readlink -f "$0"))"
+
+KTAP_HELPERS="${DIR}/../kselftest/ktap_helpers.sh"
+if [ -e "$KTAP_HELPERS" ]; then
+. "$KTAP_HELPERS"
+else
+echo -n "1..0 # SKIP $KTAP_HELPERS file not found"
+exit 4
+fi
+
+RPROC_SYS=/sys/class/remoteproc
+RPROC_SEQ_SLEEP=5
+rproc_instances=
+# Declare an array to save initial states of each instance
+org_instance_to_state=""
+num_tests=0
+test_err=0
+
+check_error() {
+   if [ $? -ne 0 ]; then
+   test_err=$((test_err+1))
+   ktap_print_msg "$@"
+   fi
+}
+
+rproc_stop_instances() {
+   for instance in ${rproc_instances}; do
+   rproc=${RPROC_SYS}/$instance
+   rproc_name=$(cat $rproc/name)
+   rproc_state=$(cat $rproc/state)
+
+   echo stop > "$rproc/state"
+   check_error "$rproc_name state-stop failed at state 
$rproc_state"
+   done
+   sleep ${RPROC_SEQ_SLEEP}
+}
+
+rproc_start_instances() {
+   for instance in ${rproc_instances}; do
+   rproc=${RPROC_SYS}/$instance
+   rproc_name=$(cat $rproc/name)
+   rproc_state=$(cat $rproc/state)
+
+   echo start > "$rproc/state"
+   check_error "$rproc_name state-start failed at state 
$rproc_state"
+   done
+   sleep ${RPROC_SEQ_SLEEP}
+}
+
+rproc_seq_test_instance_one() {
+   instance=$1
+   rproc=${RPROC_SYS}/$instance
+   rproc_name=$(cat $rproc/name)
+   rproc_state=$(cat $rproc/state)
+   ktap_print_msg "Testing rproc sequence for $rproc_name"
+
+   # Reset test_err value
+   test_err=0
+
+   # Begin start/stop sequence
+   echo start > "$rproc/state"
+   check_error "$rproc_name state-start failed at state $rproc_state"
+
+   sleep ${RPROC_SEQ_SLEEP}
+
+   echo stop > "$rproc/state"
+   check_error "$rproc_name state-stop failed at state $rproc_state"
+
+   if [ $test_err -ne 0 ]; then
+   ktap_test_fail "$rproc_name"
+   else
+   ktap_test_pass "$rproc_name"
+   fi
+}
+
+rproc_seq_test_instances_concurrently() {
+   # Reset test_err value
+   test_err=0
+
+   rproc_start_instances
+
+   rproc_stop_instances
+
+   if [ $test_err -ne 0 ]; then
+   ktap_test_fail "for any of $rproc_instances"
+   else
+   ktap_test_pass "for all $rproc_instances"
+   fi
+}
+
+ktap_print_header
+
+if [ ! -d "${RPROC_SYS}" ]; then
+   ktap_skip_all "${RPROC_SYS} doesn't exist."
+   exit "${KSFT_SKIP}"
+fi
+
+rproc_instances=$(find ${RPROC_SYS}/remoteproc* -maxdepth 1 -exec basename {} 
\;)
+num_tests=$(echo ${rproc_instances} | wc -w)
+if [ "${num_tests}" -eq 0 ]; then
+   ktap_skip_

[PATCH] selftest: remoteproc: Add basic test for start/stop sequence

2024-09-20 Thread Wasim Nazir
Add new basic remoteproc test that check start/stop
sequence of all subsystems available.

diff --git a/MAINTAINERS b/MAINTAINERS
index e062b5328341..aff76edc4242 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18225,6 +18225,7 @@ F:  Documentation/staging/remoteproc.rst
 F: drivers/remoteproc/
 F: include/linux/remoteproc.h
 F: include/linux/remoteproc/
+F: tools/testing/selftests/remoteproc/

 REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM
 M: Bjorn Andersson 
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 697f13bbbc32..31db0311efdc 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -68,6 +68,7 @@ TARGETS += proc
 TARGETS += pstore
 TARGETS += ptrace
 TARGETS += openat2
+TARGETS += remoteproc
 TARGETS += resctrl
 TARGETS += riscv
 TARGETS += rlimits
diff --git a/tools/testing/selftests/remoteproc/Makefile 
b/tools/testing/selftests/remoteproc/Makefile
new file mode 100644
index ..a84b3934fd36
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+TEST_PROGS := remoteproc_test.sh
+
+include ../lib.mk
diff --git a/tools/testing/selftests/remoteproc/config 
b/tools/testing/selftests/remoteproc/config
new file mode 100644
index ..a5c237d2f3b4
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/config
@@ -0,0 +1 @@
+CONFIG_REMOTEPROC=y
diff --git a/tools/testing/selftests/remoteproc/remoteproc_test.sh 
b/tools/testing/selftests/remoteproc/remoteproc_test.sh
new file mode 100644
index ..88c8f15d8406
--- /dev/null
+++ b/tools/testing/selftests/remoteproc/remoteproc_test.sh
@@ -0,0 +1,165 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+#
+
+DIR="$(dirname $(readlink -f "$0"))"
+
+KTAP_HELPERS="${DIR}/../kselftest/ktap_helpers.sh"
+if [ -e "$KTAP_HELPERS" ]; then
+source "$KTAP_HELPERS"
+else
+echo -n "1..0 # SKIP $KTAP_HELPERS file not found"
+   exit 4
+fi
+
+RPROC_SYS=/sys/class/remoteproc
+RPROC_SEQ_SLEEP=5
+rproc_ss_files=
+num_tests=0
+test_err=0
+
+check_error() {
+   if [ $? -ne 0 ]; then
+   test_err=$((test_err+1))
+   ktap_print_msg "$@"
+   fi
+}
+
+rproc_seq_test_ss_one() {
+   ss=$1
+   rproc=${RPROC_SYS}/$ss
+   rproc_name=$(cat $rproc/name)
+   rproc_state=$(cat $rproc/state)
+   rproc_ssr=$(cat $rproc/recovery)
+   ktap_print_msg "Testing rproc sequence for $rproc_name"
+
+   # Reset test_err value
+   test_err=0
+   if [ "$rproc_ssr" != "enabled" ]; then
+   echo enabled > $rproc/recovery
+   check_error "$rproc_name SSR-enabled failed"
+   fi
+
+   if [ "$rproc_state" != "running" ]; then
+   echo start > "$rproc/state"
+   check_error "$rproc_name state-start failed"
+
+   sleep ${RPROC_SEQ_SLEEP}
+
+   echo stop > "$rproc/state"
+   check_error "$rproc_name state-stop failed"
+   else
+   echo stop > "$rproc/state"
+   check_error "$rproc_name state-stop failed"
+
+   sleep ${RPROC_SEQ_SLEEP}
+
+   echo start > "$rproc/state"
+   check_error "$rproc_name state-start failed"
+   fi
+
+   if [ $test_err -ne 0 ]; then
+   ktap_test_fail "$rproc_name"
+   else
+   ktap_test_pass "$rproc_name"
+   fi
+}
+
+rproc_seq_test_all_ss() {
+   # Declare an array to save initial states of each ss
+   org_ss_to_state=""
+
+   # Reset test_err value
+   test_err=0
+
+   for ss in ${rproc_ss_files}; do
+   rproc=${RPROC_SYS}/$ss
+   rproc_name=$(cat $rproc/name)
+   rproc_ssr=$(cat $rproc/recovery)
+
+   # Enable SSR-recovery support
+   if [ "$rproc_ssr" != "enabled" ]; then
+   echo enabled > $rproc/recovery
+   check_error "$rproc_name SSR-enabled failed"
+   fi
+   done
+
+   for ss in ${rproc_ss_files}; do
+   rproc=${RPROC_SYS}/$ss
+   rproc_name=$(cat $rproc/name)
+   rproc_state=$(cat $rproc/state)
+
+   # Save initial states for each ss
+   org_ss_to_state="$org_ss_to_state $rproc_state"
+
+   # Initiate start/stop sequence
+   if [ "$rproc_state" != "running" ]; then
+   echo start > "$rproc/state"
+   check_error "$rproc_name state-start failed"
+   else
+   echo stop > "$rproc/state"
+   check_error "$rproc_name state-stop failed"
+   fi
+   sleep ${RPROC_SEQ_SLEEP}
+   done
+
+   index=1
+   for ss in ${rproc_ss_files}; do
+   rproc=${RPROC_SYS}/$ss
+   rproc_name=$(cat $rproc/name

Re: [PATCH v2] selftest: remoteproc: Add basic test for start/stop sequence

2024-10-03 Thread Wasim Nazir
On Sun, Sep 29, 2024 at 10:03:23PM -0500, Bjorn Andersson wrote:
> On Fri, Sep 27, 2024 at 04:51:32PM GMT, Wasim Nazir wrote:
> > This test includes:
> > 1) Start/stop test for each rproc instance sequencially
> > 2) Start/stop test for all rproc instances concurrently
> > 
> 
> This fails to describe the purpose of the patch. Provide a proper commit
> mesasge.
> 
> In particular, I expect an argumentation for your test scheme. Will this
> work across all remoteproc instances? Does it have any dependencies,
> etc...
As we are tesing only the core ops based on the availabe sysfs entries,
it should work accross targets where remoteproc config is enabled & instances
are available. Otherwise I am skipping the tests.
Please correct me if I am missing anything here.

I will try to elaborate purpose of the tests in next patch.
> 
> > Changes in v2:
> > - Update commit message
> > - Addressed start/stop flow
> 
> The changelog goes below the '---' line, adjacent to your diffstat -
> which is missing from your patch. I don't know how you're sending these
> patches, but your system is either configured weirdly or you're not
> following my instructions on go/upstream.
> 
Will do the correction in next patch.
> > 
> > Signed-off-by: Wasim Nazir 
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index a0cd96b8..02ebad5ae790 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -19596,6 +19596,7 @@ F:  Documentation/staging/remoteproc.rst
> >  F: drivers/remoteproc/
> >  F: include/linux/remoteproc.h
> >  F: include/linux/remoteproc/
> > +F: tools/testing/selftests/remoteproc/
> > 
> >  REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM
> >  M: Bjorn Andersson 
> > diff --git a/tools/testing/selftests/Makefile 
> > b/tools/testing/selftests/Makefile
> > index b38199965f99..0c8a0f427d01 100644
> > --- a/tools/testing/selftests/Makefile
> > +++ b/tools/testing/selftests/Makefile
> > @@ -82,6 +82,7 @@ TARGETS += proc
> >  TARGETS += pstore
> >  TARGETS += ptrace
> >  TARGETS += openat2
> > +TARGETS += remoteproc
> >  TARGETS += resctrl
> >  TARGETS += riscv
> >  TARGETS += rlimits
> > diff --git a/tools/testing/selftests/remoteproc/Makefile 
> > b/tools/testing/selftests/remoteproc/Makefile
> > new file mode 100644
> > index ..a84b3934fd36
> > --- /dev/null
> > +++ b/tools/testing/selftests/remoteproc/Makefile
> > @@ -0,0 +1,4 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +TEST_PROGS := remoteproc_test.sh
> > +
> > +include ../lib.mk
> > diff --git a/tools/testing/selftests/remoteproc/config 
> > b/tools/testing/selftests/remoteproc/config
> > new file mode 100644
> > index ..a5c237d2f3b4
> > --- /dev/null
> > +++ b/tools/testing/selftests/remoteproc/config
> > @@ -0,0 +1 @@
> > +CONFIG_REMOTEPROC=y
> > diff --git a/tools/testing/selftests/remoteproc/remoteproc_test.sh 
> > b/tools/testing/selftests/remoteproc/remoteproc_test.sh
> > new file mode 100644
> > index ..589368285307
> > --- /dev/null
> > +++ b/tools/testing/selftests/remoteproc/remoteproc_test.sh
> > @@ -0,0 +1,134 @@
> > +#!/bin/sh
> > +# SPDX-License-Identifier: GPL-2.0
> > +#
> > +# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
> > +#
> > +
> > +DIR="$(dirname $(readlink -f "$0"))"
> > +
> > +KTAP_HELPERS="${DIR}/../kselftest/ktap_helpers.sh"
> > +if [ -e "$KTAP_HELPERS" ]; then
> > +. "$KTAP_HELPERS"
> > +else
> > +echo -n "1..0 # SKIP $KTAP_HELPERS file not found"
> > +exit 4
> > +fi
> > +
> > +RPROC_SYS=/sys/class/remoteproc
> > +RPROC_SEQ_SLEEP=5
> > +rproc_instances=
> > +# Declare an array to save initial states of each instance
> > +org_instance_to_state=""
> > +num_tests=0
> > +test_err=0
> > +
> > +check_error() {
> > +   if [ $? -ne 0 ]; then
> > +   test_err=$((test_err+1))
> > +   ktap_print_msg "$@"
> > +   fi
> > +}
> > +
> > +rproc_stop_instances() {
> > +   for instance in ${rproc_instances}; do
> > +   rproc=${RPROC_SYS}/$instance
> > +   rproc_name=$(cat $rproc/name)
> > +   rproc_state=$(cat $rproc/state)
> > +
> > +   echo stop > "$rproc/state"
> > +   check_error "$rproc_name state-stop failed at state 
> > $rproc_state"
>

Re: [PATCH] remoteproc: qcom: pas: Conclude the rename from adsp

2025-06-05 Thread Wasim Nazir
On Thu, Jun 05, 2025 at 10:23:51AM -0500, Bjorn Andersson wrote:
> The change that renamed the driver from "adsp" to "pas" didn't change
> any of the implementation. The result is an aesthetic eyesore, and
> confusing to many.
> 
> Conclude the rename of the driver, by updating function, structures and
> variable names to match what the driver actually is. The "Hexagon v5" is
> also dropped from the name and Kconfig, as this isn't correct either.
> 
> No functional change.
> 
> Fixes: 9e004f97161d ("remoteproc: qcom: Rename Hexagon v5 PAS driver")
> Signed-off-by: Bjorn Andersson 
> ---
>  drivers/remoteproc/Kconfig  |  11 +-
>  drivers/remoteproc/qcom_q6v5_adsp.c |  46 +--
>  drivers/remoteproc/qcom_q6v5_pas.c  | 617 
> ++--
>  3 files changed, 334 insertions(+), 340 deletions(-)
> 
> diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> index 
> 83962a114dc9fdb3260e6e922602f2da53106265..4a1e469acaf139334686af1eb962ce9420c6ddb1
>  100644
> --- a/drivers/remoteproc/Kconfig
> +++ b/drivers/remoteproc/Kconfig
> @@ -214,7 +214,7 @@ config QCOM_Q6V5_MSS
> handled by QCOM_Q6V5_PAS driver.
>  
>  config QCOM_Q6V5_PAS
> - tristate "Qualcomm Hexagon v5 Peripheral Authentication Service support"
> + tristate "Qualcomm Peripheral Authentication Service support"
>   depends on OF && ARCH_QCOM
>   depends on QCOM_SMEM
>   depends on RPMSG_QCOM_SMD || RPMSG_QCOM_SMD=n
> @@ -229,11 +229,10 @@ config QCOM_Q6V5_PAS
>   select QCOM_RPROC_COMMON
>   select QCOM_SCM
>   help
> -   Say y here to support the TrustZone based Peripheral Image Loader
> -   for the Qualcomm Hexagon v5 based remote processors. This is commonly
> -   used to control subsystems such as ADSP (Audio DSP),
> -   CDSP (Compute DSP), MPSS (Modem Peripheral SubSystem), and
> -   SLPI (Sensor Low Power Island).
> +   Say y here to support the TrustZone based Peripheral Image Loader for
> +   the Qualcomm based remote processors. This is commonly used to

Maybe "Qualcomm remote processors"?

> +   control subsystems such as ADSP (Audio DSP), CDSP (Compute DSP), MPSS
> +   (Modem Peripheral SubSystem), and SLPI (Sensor Low Power Island).
>  
>  config QCOM_Q6V5_WCSS
>   tristate "Qualcomm Hexagon based WCSS Peripheral Image Loader"
> diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c 
> b/drivers/remoteproc/qcom_q6v5_adsp.c
> index 
> 94af77baa7a1c5096f0663260c07a297c6bedd17..613826e0d7eff1712ca31ea102adef4f62d10f38
>  100644
> --- a/drivers/remoteproc/qcom_q6v5_adsp.c
> +++ b/drivers/remoteproc/qcom_q6v5_adsp.c
> @@ -77,7 +77,7 @@ struct adsp_pil_data {
>   const char *load_state;
>  };
>  
> -struct qcom_adsp {
> +struct qcom_pas {

Any reason to change in this file?

>   struct device *dev;
>   struct rproc *rproc;
>  
> @@ -116,10 +116,10 @@ struct qcom_adsp {
>   struct qcom_rproc_ssr ssr_subdev;
>   struct qcom_sysmon *sysmon;
>  
> - int (*shutdown)(struct qcom_adsp *adsp);
> + int (*shutdown)(struct qcom_pas *adsp);
>  };
>  
> -static int qcom_rproc_pds_attach(struct qcom_adsp *adsp, const char 
> **pd_names,
> +static int qcom_rproc_pds_attach(struct qcom_pas *adsp, const char 
> **pd_names,
>unsigned int num_pds)
>  {
>   struct device *dev = adsp->dev;
> @@ -145,7 +145,7 @@ static int qcom_rproc_pds_attach(struct qcom_adsp *adsp, 
> const char **pd_names,
>   return 0;
>  }
>  
> -static void qcom_rproc_pds_detach(struct qcom_adsp *adsp)
> +static void qcom_rproc_pds_detach(struct qcom_pas *adsp)
>  {
>   struct device *dev = adsp->dev;
>   struct dev_pm_domain_list *pds = adsp->pd_list;
> @@ -156,7 +156,7 @@ static void qcom_rproc_pds_detach(struct qcom_adsp *adsp)
>   pm_runtime_disable(adsp->dev);
>  }
>  
> -static int qcom_rproc_pds_enable(struct qcom_adsp *adsp)
> +static int qcom_rproc_pds_enable(struct qcom_pas *adsp)
>  {
>   struct device *dev = adsp->dev;
>   struct dev_pm_domain_list *pds = adsp->pd_list;
> @@ -187,7 +187,7 @@ static int qcom_rproc_pds_enable(struct qcom_adsp *adsp)
>   return ret;
>  }
>  
> -static void qcom_rproc_pds_disable(struct qcom_adsp *adsp)
> +static void qcom_rproc_pds_disable(struct qcom_pas *adsp)
>  {
>   struct device *dev = adsp->dev;
>   struct dev_pm_domain_list *pds = adsp->pd_list;
> @@ -207,7 +207,7 @@ static void qcom_rproc_pds_disable(struct qcom_adsp *adsp)
>   pm_runtime_put(dev);
>  }
>  
> -static int qcom_wpss_shutdown(struct qcom_adsp *adsp)
> +static int qcom_wpss_shutdown(struct qcom_pas *adsp)
>  {
>   unsigned int val;
>  
> @@ -247,7 +247,7 @@ static int qcom_wpss_shutdown(struct qcom_adsp *adsp)
>   return 0;
>  }
>  
> -static int qcom_adsp_shutdown(struct qcom_adsp *adsp)
> +static int qcom_adsp_shutdown(struct qcom_pas *adsp)
>  {
>   unsigned long timeout;
>   unsigned int val;
> @@ -314,7 +314,7 @@ static int qcom_adsp_s

Re: [PATCH v2] remoteproc: qcom: pas: Conclude the rename from adsp

2025-06-06 Thread Wasim Nazir
On Thu, Jun 05, 2025 at 05:17:47PM -0500, Bjorn Andersson wrote:
> The change that renamed the driver from "adsp" to "pas" didn't change
> any of the implementation. The result is an aesthetic eyesore, and
> confusing to many.
> 
> Conclude the rename of the driver, by updating function, structures and
> variable names to match what the driver actually is. The "Hexagon v5" is
> also dropped from the name and Kconfig, as this isn't correct either.
> 
> No functional change.
> 
> Fixes: 9e004f97161d ("remoteproc: qcom: Rename Hexagon v5 PAS driver")
> Signed-off-by: Bjorn Andersson 

Reviewed-by: Wasim Nazir 

--
Regards,
Wasim