[PATCH 1/3] Revert "staging: vchiq_arm: Improve initial VCHIQ connect"
Maíra Canal
mcanal at igalia.com
Sun Jul 13 11:37:47 PDT 2025
On 11/07/25 12:40, Stefan Wahren wrote:
> The commit 3e5def4249b9 ("staging: vchiq_arm: Improve initial VCHIQ connect")
> based on the assumption that in good case the VCHIQ connect always happen and
> therefore the keep-alive thread is guaranteed to be woken up. This is wrong,
> because in certain configurations there are no VCHIQ users and so the VCHIQ
> connect never happen. So revert it.
>
> Fixes: 3e5def4249b9 ("staging: vchiq_arm: Improve initial VCHIQ connect")
> Reported-by: Maíra Canal <mcanal at igalia.com>
> Closes: https://lore.kernel.org/linux-staging/ba35b960-a981-4671-9f7f-060da10feaa1@usp.br/
> Cc: <stable at kernel.org>
> Signed-off-by: Stefan Wahren <wahrenst at gmx.net>
Reviewed-by: Maíra Canal <mcanal at igalia.com>
Best Regards,
- Maíra
> ---
> .../interface/vchiq_arm/vchiq_arm.c | 28 ++++++++++++++-----
> .../interface/vchiq_arm/vchiq_core.c | 1 -
> .../interface/vchiq_arm/vchiq_core.h | 2 --
> 3 files changed, 21 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 5dbf8d53db09..cdf5687ad4f0 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -97,6 +97,13 @@ struct vchiq_arm_state {
> * tracked separately with the state.
> */
> int peer_use_count;
> +
> + /*
> + * Flag to indicate that the first vchiq connect has made it through.
> + * This means that both sides should be fully ready, and we should
> + * be able to suspend after this point.
> + */
> + int first_connect;
> };
>
> static int
> @@ -1329,19 +1336,26 @@ vchiq_check_service(struct vchiq_service *service)
> return ret;
> }
>
> -void vchiq_platform_connected(struct vchiq_state *state)
> -{
> - struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
> -
> - wake_up_process(arm_state->ka_thread);
> -}
> -
> void vchiq_platform_conn_state_changed(struct vchiq_state *state,
> enum vchiq_connstate oldstate,
> enum vchiq_connstate newstate)
> {
> + struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
> +
> dev_dbg(state->dev, "suspend: %d: %s->%s\n",
> state->id, get_conn_state_name(oldstate), get_conn_state_name(newstate));
> + if (state->conn_state != VCHIQ_CONNSTATE_CONNECTED)
> + return;
> +
> + write_lock_bh(&arm_state->susp_res_lock);
> + if (arm_state->first_connect) {
> + write_unlock_bh(&arm_state->susp_res_lock);
> + return;
> + }
> +
> + arm_state->first_connect = 1;
> + write_unlock_bh(&arm_state->susp_res_lock);
> + wake_up_process(arm_state->ka_thread);
> }
>
> static const struct of_device_id vchiq_of_match[] = {
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> index e7b0c800a205..e2cac0898b8f 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -3343,7 +3343,6 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc
> return -EAGAIN;
>
> vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
> - vchiq_platform_connected(state);
> complete(&state->connect);
> }
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> index 3b5c0618e567..9b4e766990a4 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -575,8 +575,6 @@ int vchiq_send_remote_use(struct vchiq_state *state);
>
> int vchiq_send_remote_use_active(struct vchiq_state *state);
>
> -void vchiq_platform_connected(struct vchiq_state *state);
> -
> void vchiq_platform_conn_state_changed(struct vchiq_state *state,
> enum vchiq_connstate oldstate,
> enum vchiq_connstate newstate);
More information about the linux-arm-kernel
mailing list