Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1215439lqb; Thu, 30 May 2024 04:04:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQN29gDvA1iR1m+lQKR8MsBGFFAVv+ppoGlJ5i32EL3Rwtq8Z6NPLAE46BtxzZBXoVycdwIDMetv83WNAayCGYqywKX1yj3uOSePcG7A== X-Google-Smtp-Source: AGHT+IGGqWDJD2Uy+9jvF5NL+6KeRvUdpXmX0vp2kUkAHTfsC8cWljwH9148PwLbBsthSf0OfvE3 X-Received: by 2002:a17:906:31ce:b0:a59:c728:5430 with SMTP id a640c23a62f3a-a65e923ed75mr100111966b.76.1717067083109; Thu, 30 May 2024 04:04:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717067083; cv=pass; d=google.com; s=arc-20160816; b=l+oziy85DN0ooGPe81AvHh9HXDxiEYbQ504Hses/YiZqls709bh1SQdBUKwOhetXJv x/xJFQtc2I4tq1OhFHtQ5AKp8khi8NLzvAI1apuAWqBOO/uexhSUY1FGiqDwxt1ltZyE r6V3lPhA44PB5NsDtDFvqPB+IES+OuGCnJjMi1fx4lQ0OatmpQ2d9ijmMJIEAWGOKrjJ Bx7w75ZundUiW1eeihPEe05VTBzD/4tqWonVrnULfxMpOwJ/x44bO1D+qA+CKgdZ7Vh5 wEdEPl2gjCjmjbBHlZKuKORiiUmXikF/nPhf/YTNpl4p64qaAvsIsRxPdGTFwtCAWyyc 7/Uw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=u35KwFFrk5otVU6exhXdwQqr/XhSn0MEkEW/FOP8hLs=; fh=UEnWVJbCEjALqNAyK6RQtobIq10EhjDNoZKgWk7IuNI=; b=Y/p68LIxBluni1oMuUN6qM40xQWhKBbFfE+8mgIO00O+pwOiV6Yeihqmo6e5DSLTwx zTiYG5pVWLhpLa9dyB54v8kjagTcQ7RrfL/IJSUGzrq2tmLscJiyIBTM31bij1jNZGoY m4m7rMB5r/LR6yoRUQy2CD7UjXVMj0uGKTzn4xK94r2xq9tbsec91fixjluivhpBEsFK FNMKZcXrmOyqAruz3bdc/eg/tmnFMNiui5sKZzmWo7WVhBxqQFMwkeygYen3Fqx0XWUd /bDMqdqT3qxO0rR1wlTiHsoW+R+vvJeKlYlUCL3sIG9vVzV7iaCDpIi2U29xBcRxL8bE jXQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aqiic8Xa; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-195284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a631e324844si399003366b.236.2024.05.30.04.04.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 04:04:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aqiic8Xa; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-195284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A44A31F21C91 for ; Thu, 30 May 2024 11:04:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8724A16F0F3; Thu, 30 May 2024 11:04:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aqiic8Xa" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37C5C161302 for ; Thu, 30 May 2024 11:04:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717067074; cv=none; b=KkOJGj3j7FVZ7Ge8QforrEOi+fa0RiSmjQpmAHmB9eDIxiF9oqNbJhdY6yy5nS9xVPSJtj8ysclH9M/FiNHfoC/ax2/cVDaAQr1I1jkcSLkJJ5qh0oM6K1A1H1G4/r67hsiqwUwFgCsKLarapfsCKF0g9/fOW/Ck5uNVI7JWZbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717067074; c=relaxed/simple; bh=j8t1IDHBfbZrDTk0a3VFZXXPA3Q6Ry6baCh8GrC4Is8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PTJ0O8Tc4etHx6GAOSwSLuS3RLCkPvtPbD/DYSABoWD2GXZlCVu+hQEUUyaGF8aSbisFSVBVoMAJROR4Z1dYK3Qg6hcCCD/ilTIqWGxUKIF0Q72USWBkh5wTrnIe5gd/InOYkcBJX2iXmmB6e1WONW1tefW8GsuKLIi/aNHSITU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=aqiic8Xa; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52ae14e78e5so805649e87.3 for ; Thu, 30 May 2024 04:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717067070; x=1717671870; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=u35KwFFrk5otVU6exhXdwQqr/XhSn0MEkEW/FOP8hLs=; b=aqiic8XavNu6/w46GjLUn8PYE0yLVZ/iwXkImZ4mE9eVcnb6alSjmc25z9F4fX4gvs WfzHLTViGa7F9wkVRC6k4rtMB27xlKurMV7/NQh0V8zrWFlsaSstIvD2grEiZrz4NNs5 JVaMpHosjSopGTDGPJ/1rASE3Q7Sb4A0eRIZkyUSilIVzW93Y8IceCSfo9Fq3hJuT26M 9LXHF8Ohx6IQ4f58bGPoCzpOniYm90N4w3qhI85l5jD07Mi2XxyR+T+zHfEQwTtr9io4 F61D/S3U5OLvPLBEZD4my4AaoXNwZNf3m+3l4EagGcj4ZwGjSghOS0dOTQr57wcGz/uv H2HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717067070; x=1717671870; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=u35KwFFrk5otVU6exhXdwQqr/XhSn0MEkEW/FOP8hLs=; b=G7VoJ9e9eNh/mgGvmvSbtjnFPTSdPP4xHerjt2SJ5ImG49GnAXc4ws6A0dQgzeimT7 qjC5yCl6ppCmc/YObiY2iNlpm4sr5BLujUBprOstfwlbUCBkM7+n9gtiD7KW//iqcJeX QDWh/m9F6KWFjUxgzPbae0cXupnynJl0nIwHk8VyPWbIb8iImtsy1zdVG2usA3CmJTe5 eKdqLp3U2QoKGf/K8G/QxGAYrOWyaOokcjw73l62AwWwpjLxc625eBWm7EBo3Uzqf95p 6Re84LKV40TZzbBjoZAMm4uCvRZdTfjWgu2ius/zZwqCXzcvOU1UXCdTqcDeX36E7xSD NzZQ== X-Forwarded-Encrypted: i=1; AJvYcCUYaY4PmOQw3s8NwOVmc26mZQx8/TCdyPjo6IFVqXcyqBpYwdQs8R5p1EL0sCCfMBa7JjgSnOE+BvdGkTNrjM/mtl9aTdWEi1wFzS7K X-Gm-Message-State: AOJu0Yz4a+g6Il8U7QeKavdJsXjxffh2Hwi/p5hGUCLZFNoYv8P+Pc4B 32QXZN1Y+EGeRLGoTBP2B6mQ/W+aVsw6HdZWE5l74MHL9lMUlyzqoUEOdgMD/Sg= X-Received: by 2002:ac2:5608:0:b0:523:aeaa:7df1 with SMTP id 2adb3069b0e04-52b7d434dcdmr951664e87.34.1717067070327; Thu, 30 May 2024 04:04:30 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzdbxzyyyyyyyyyyyykxt-3.rev.dnainternet.fi. [2001:14ba:a0c3:3a00::227]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-529a62f301dsm1275583e87.188.2024.05.30.04.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 04:04:29 -0700 (PDT) Date: Thu, 30 May 2024 14:04:28 +0300 From: Dmitry Baryshkov To: Ekansh Gupta Cc: srinivas.kandagatla@linaro.org, linux-arm-msm@vger.kernel.org, gregkh@linuxfoundation.org, quic_bkumar@quicinc.com, linux-kernel@vger.kernel.org, quic_chennak@quicinc.com Subject: Re: [PATCH v3 4/9] misc: fastrpc: Add static PD restart support Message-ID: References: <20240530102032.27179-1-quic_ekangupt@quicinc.com> <20240530102032.27179-5-quic_ekangupt@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240530102032.27179-5-quic_ekangupt@quicinc.com> On Thu, May 30, 2024 at 03:50:22PM +0530, Ekansh Gupta wrote: > Static PDs on the audio and sensor domains are expected to support > PD restart. The kernel resource handling for the PDs are expected > to be handled by fastrpc driver. For this, there is a requirement > of PD service locator to get the event notifications for static PD > services. Also when events are received, the driver needs to handle > based on PD states. Added changes to add service locator for audio > and sensor domain static PDs and handle the PD restart sequence. Let me repeat a comment from v2: Please see Documentation/process/submitting-patches.rst for a suggested language. Please extend the commit message with the description of why sensors and audio are handled in a different way. > > Signed-off-by: Ekansh Gupta > --- > drivers/misc/Kconfig | 2 + > drivers/misc/fastrpc.c | 205 ++++++++++++++++++++++++++++++++++++++--- > 2 files changed, 195 insertions(+), 12 deletions(-) > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig > index faf983680040..e2d83cd085b5 100644 > --- a/drivers/misc/Kconfig > +++ b/drivers/misc/Kconfig > @@ -280,8 +280,10 @@ config QCOM_FASTRPC > tristate "Qualcomm FastRPC" > depends on ARCH_QCOM || COMPILE_TEST > depends on RPMSG > + depends on NET > select DMA_SHARED_BUFFER > select QCOM_SCM > + select QCOM_PDR_HELPERS > help > Provides a communication mechanism that allows for clients to > make remote method invocations across processor boundary to > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index 3e1ab58038ed..d115860fc356 100644 > --- a/drivers/misc/fastrpc.c > +++ b/drivers/misc/fastrpc.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > #define ADSP_DOMAIN_ID (0) > #define MDSP_DOMAIN_ID (1) > @@ -29,6 +30,7 @@ > #define CDSP_DOMAIN_ID (3) > #define FASTRPC_DEV_MAX 4 /* adsp, mdsp, slpi, cdsp*/ > #define FASTRPC_MAX_SESSIONS 14 > +#define FASTRPC_MAX_SPD 4 > #define FASTRPC_MAX_VMIDS 16 > #define FASTRPC_ALIGN 128 > #define FASTRPC_MAX_FDLIST 16 > @@ -105,6 +107,18 @@ > > #define miscdev_to_fdevice(d) container_of(d, struct fastrpc_device, miscdev) > > +#define AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME "audio_pdr_adsp" > +#define AUDIO_PDR_ADSP_SERVICE_NAME "avs/audio" > +#define ADSP_AUDIOPD_NAME "msm/adsp/audio_pd" > + > +#define SENSORS_PDR_ADSP_SERVICE_LOCATION_CLIENT_NAME "sensors_pdr_adsp" > +#define SENSORS_PDR_ADSP_SERVICE_NAME "tms/servreg" > +#define ADSP_SENSORPD_NAME "msm/adsp/sensor_pd" > + > +#define SENSORS_PDR_SLPI_SERVICE_LOCATION_CLIENT_NAME "sensors_pdr_slpi" > +#define SENSORS_PDR_SLPI_SERVICE_NAME SENSORS_PDR_ADSP_SERVICE_NAME > +#define SLPI_SENSORPD_NAME "msm/slpi/sensor_pd" > + > static const char *domains[FASTRPC_DEV_MAX] = { "adsp", "mdsp", > "sdsp", "cdsp"}; > struct fastrpc_phy_page { > @@ -259,6 +273,15 @@ struct fastrpc_session_ctx { > bool valid; > }; > > +struct fastrpc_static_pd { > + char *servloc_name; > + char *spdname; > + void *pdrhandle; > + struct fastrpc_channel_ctx *cctx; > + struct fastrpc_user *fl; > + bool ispdup; > +}; > + > struct fastrpc_channel_ctx { > int domain_id; > int sesscount; > @@ -266,6 +289,7 @@ struct fastrpc_channel_ctx { > struct qcom_scm_vmperm vmperms[FASTRPC_MAX_VMIDS]; > struct rpmsg_device *rpdev; > struct fastrpc_session_ctx session[FASTRPC_MAX_SESSIONS]; > + struct fastrpc_static_pd spd[FASTRPC_MAX_SPD]; > spinlock_t lock; > struct idr ctx_idr; > struct list_head users; > @@ -297,10 +321,12 @@ struct fastrpc_user { > struct fastrpc_channel_ctx *cctx; > struct fastrpc_session_ctx *sctx; > struct fastrpc_buf *init_mem; > + struct fastrpc_static_pd *spd; > > int tgid; > int pd; > bool is_secure_dev; > + char *servloc_name; > /* Lock for lists */ > spinlock_t lock; > /* lock for allocations */ > @@ -1230,12 +1256,33 @@ static bool is_session_rejected(struct fastrpc_user *fl, bool unsigned_pd_reques > return false; > } > > +static struct fastrpc_static_pd *fastrpc_get_spd_session( > + struct fastrpc_user *fl) > +{ > + int i; > + struct fastrpc_static_pd *spd = NULL; > + struct fastrpc_channel_ctx *cctx = fl->cctx; > + > + for (i = 0; i < FASTRPC_MAX_SPD ; i++) { > + if (!cctx->spd[i].servloc_name) > + continue; > + if (!strcmp(fl->servloc_name, cctx->spd[i].servloc_name)) { > + spd = &cctx->spd[i]; > + spd->fl = fl; > + break; > + } > + } > + > + return spd; > +} > + > static int fastrpc_init_create_static_process(struct fastrpc_user *fl, > char __user *argp) > { > struct fastrpc_init_create_static init; > struct fastrpc_invoke_args *args; > struct fastrpc_phy_page pages[1]; > + struct fastrpc_static_pd *spd = NULL; > char *name; > int err; > struct { > @@ -1270,6 +1317,19 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, > goto err_name; > } > > + fl->servloc_name = AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME; > + > + spd = fastrpc_get_spd_session(fl); > + if (!spd) { > + err = -EUSERS; > + goto err_name; > + } > + > + if (!spd->ispdup) { > + err = -ENOTCONN; > + goto err_name; > + } > + fl->spd = spd; > if (!fl->cctx->remote_heap) { > err = fastrpc_remote_heap_alloc(fl, fl->sctx->dev, init.memlen, > &fl->cctx->remote_heap); > @@ -1645,6 +1705,7 @@ static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp) > static int fastrpc_init_attach(struct fastrpc_user *fl, int pd) > { > struct fastrpc_invoke_args args[1]; > + struct fastrpc_static_pd *spd = NULL; > int tgid = fl->tgid; > u32 sc; > > @@ -1654,6 +1715,22 @@ static int fastrpc_init_attach(struct fastrpc_user *fl, int pd) > sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_ATTACH, 1, 0); > fl->pd = pd; > > + if (pd == SENSORS_PD) { > + if (fl->cctx->domain_id == ADSP_DOMAIN_ID) > + fl->servloc_name = SENSORS_PDR_ADSP_SERVICE_LOCATION_CLIENT_NAME; > + else if (fl->cctx->domain_id == SDSP_DOMAIN_ID) > + fl->servloc_name = SENSORS_PDR_SLPI_SERVICE_LOCATION_CLIENT_NAME; > + > + spd = fastrpc_get_spd_session(fl); > + if (!spd) > + return -EUSERS; > + > + if (!spd->ispdup) > + return -ENOTCONN; > + > + fl->spd = spd; > + } > + > return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, > sc, &args[0]); > } > @@ -2129,6 +2206,64 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int cmd, > return err; > } > > +static void fastrpc_notify_users(struct fastrpc_user *user) > +{ > + struct fastrpc_invoke_ctx *ctx; > + > + spin_lock(&user->lock); > + list_for_each_entry(ctx, &user->pending, node) { > + ctx->retval = -EPIPE; > + complete(&ctx->work); > + } > + spin_unlock(&user->lock); > +} > + > +static void fastrpc_notify_pdr_drivers(struct fastrpc_channel_ctx *cctx, > + char *servloc_name) > +{ > + struct fastrpc_user *fl; > + unsigned long flags; > + > + spin_lock_irqsave(&cctx->lock, flags); > + list_for_each_entry(fl, &cctx->users, user) { > + if (fl->servloc_name && !strcmp(servloc_name, fl->servloc_name)) > + fastrpc_notify_users(fl); > + } > + spin_unlock_irqrestore(&cctx->lock, flags); > +} > + > +static void fastrpc_pdr_cb(int state, char *service_path, void *priv) > +{ > + struct fastrpc_static_pd *spd = (struct fastrpc_static_pd *)priv; > + struct fastrpc_channel_ctx *cctx; > + > + if (!spd) > + return; > + > + cctx = spd->cctx; > + switch (state) { > + case SERVREG_SERVICE_STATE_DOWN: > + dev_info(&cctx->rpdev->dev, > + "%s: %s (%s) is down for PDR on %s\n", > + __func__, spd->spdname, > + spd->servloc_name, > + domains[cctx->domain_id]); > + spd->ispdup = false; > + fastrpc_notify_pdr_drivers(cctx, spd->servloc_name); > + break; > + case SERVREG_SERVICE_STATE_UP: > + dev_info(&cctx->rpdev->dev, > + "%s: %s (%s) is up for PDR on %s\n", > + __func__, spd->spdname, > + spd->servloc_name, > + domains[cctx->domain_id]); > + spd->ispdup = true; > + break; > + default: > + break; > + } > +} > + > static const struct file_operations fastrpc_fops = { > .open = fastrpc_device_open, > .release = fastrpc_device_release, > @@ -2248,6 +2383,39 @@ static int fastrpc_device_register(struct device *dev, struct fastrpc_channel_ct > return err; > } > > +static int fastrpc_setup_service_locator(struct fastrpc_channel_ctx *cctx, char *client_name, > + char *service_name, char *service_path, int domain, int spd_session) > +{ > + int err = 0; > + struct pdr_handle *handle = NULL; > + struct pdr_service *service = NULL; > + > + /* Register the service locator's callback function */ > + handle = pdr_handle_alloc(fastrpc_pdr_cb, &cctx->spd[spd_session]); > + if (IS_ERR(handle)) { > + err = PTR_ERR(handle); > + goto bail; > + } > + cctx->spd[spd_session].pdrhandle = handle; > + cctx->spd[spd_session].servloc_name = client_name; > + cctx->spd[spd_session].spdname = service_path; > + cctx->spd[spd_session].cctx = cctx; > + service = pdr_add_lookup(handle, service_name, service_path); > + if (IS_ERR(service)) { > + err = PTR_ERR(service); > + goto bail; > + } > + pr_info("fastrpc: %s: pdr_add_lookup enabled for %s (%s, %s)\n", > + __func__, service_name, client_name, service_path); > + > +bail: > + if (err) { > + pr_warn("fastrpc: %s: failed for %s (%s, %s)with err %d\n", > + __func__, service_name, client_name, service_path, err); > + } > + return err; > +} > + > static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) > { > struct device *rdev = &rpdev->dev; > @@ -2326,6 +2494,25 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) > goto fdev_error; > } > > + if (domain_id == ADSP_DOMAIN_ID) { > + err = fastrpc_setup_service_locator(data, AUDIO_PDR_SERVICE_LOCATION_CLIENT_NAME, > + AUDIO_PDR_ADSP_SERVICE_NAME, ADSP_AUDIOPD_NAME, domain_id, 0); > + if (err) > + goto populate_error; > + > + err = fastrpc_setup_service_locator(data, > + SENSORS_PDR_ADSP_SERVICE_LOCATION_CLIENT_NAME, > + SENSORS_PDR_ADSP_SERVICE_NAME, ADSP_SENSORPD_NAME, domain_id, 1); > + if (err) > + goto populate_error; > + } else if (domain_id == SDSP_DOMAIN_ID) { > + err = fastrpc_setup_service_locator(data, > + SENSORS_PDR_SLPI_SERVICE_LOCATION_CLIENT_NAME, > + SENSORS_PDR_SLPI_SERVICE_NAME, SLPI_SENSORPD_NAME, domain_id, 0); > + if (err) > + goto populate_error; > + } > + > kref_init(&data->refcount); > > dev_set_drvdata(&rpdev->dev, data); > @@ -2355,24 +2542,13 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) > return err; > } > > -static void fastrpc_notify_users(struct fastrpc_user *user) > -{ > - struct fastrpc_invoke_ctx *ctx; > - > - spin_lock(&user->lock); > - list_for_each_entry(ctx, &user->pending, node) { > - ctx->retval = -EPIPE; > - complete(&ctx->work); > - } > - spin_unlock(&user->lock); > -} > - > static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev) > { > struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); > struct fastrpc_buf *buf, *b; > struct fastrpc_user *user; > unsigned long flags; > + int i; > > /* No invocations past this point */ > spin_lock_irqsave(&cctx->lock, flags); > @@ -2393,6 +2569,11 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev) > if (cctx->remote_heap) > fastrpc_buf_free(cctx->remote_heap); > > + for (i = 0; i < FASTRPC_MAX_SPD; i++) { > + if (cctx->spd[i].pdrhandle) > + pdr_handle_release(cctx->spd[i].pdrhandle); > + } > + > of_platform_depopulate(&rpdev->dev); > > fastrpc_channel_ctx_put(cctx); > -- > 2.43.0 > -- With best wishes Dmitry