Message ID | 1690952549-31819-1-git-send-email-quic_ekangupt@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp225214vqx; Tue, 1 Aug 2023 22:37:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlESUGOA5BYBK2gu7AHSixx2SgGiMs8j0f2/YW7lG4wVlYilkMylWPL7SBO2P7GqDbJl1sl0 X-Received: by 2002:a17:907:7782:b0:993:d88e:41ed with SMTP id ky2-20020a170907778200b00993d88e41edmr3991809ejc.3.1690954668247; Tue, 01 Aug 2023 22:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690954668; cv=none; d=google.com; s=arc-20160816; b=MzOksBV0X6RFpiGS347Ex2RUgDxFHaWetKxze4HljTxnO09PT2trlkkkswxlqRojMd aKjF4XkQLiYxl5wJ/7W6Fv2s1Pay1w3WXFDQG2j6PSLrPOfeLcNjQJm+E0IPLRFuWZ5D /rRIQXu08ow1GtZoPceGw2D6q+OWS8X0L4nOUlKGCcuZxalrbyOu/6zpjg9veI21I1Q0 3H/kpVpjRuTQ751tUJa+HNkja9pfViWarM/JQPSNcTqQTw7OqzFUsuMFMgqGYYG5L3Ve 2fHkeIi58taM4rcghYup0LowjInee1HtAAY6FAA+bLvqB6uFfshpH+KNUEt/kHk3k7J6 jFaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=ma47urIk9cRBNt7qW0XUc4ZbaKVgTk2w0omDWbM+PoY=; fh=TnMRDi3L0sQlniDGL1hLZ2IIl7MhP13XMPTS/HLyrTU=; b=tJrWO29JptQLswypMCOWz3FL6k0M4tHXghB4pdrzrrAD9NNoQX4jXaSOdGhUUBgtP+ RKoZ6HJvNXmBog8Tix9vdIU8gWgVl2GvP8jhIRvmU8ZjIYZaNUFTSxd7YYOL07N1VBn7 oe6Dhoh7XldQDbDLPhch1JNnsO8CIEXi0dXcZnuudgXowamJgeRQSR8iIRjrXLY8JD2q sRDDhvOKEuStKCyw9+drUpcwitDklbg6GTVia/QyXl1/YAISguhlZ3813pqKoOouPjSu rn4upPAGlag+6MTuoSeLKhjwkKhm4hfABCiALmtuP5inE1RTlxGqFoyhlRBrDqWOjxZl 1O4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DGFvj8ai; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id op12-20020a170906bcec00b00988c81e980dsi7298001ejb.1039.2023.08.01.22.37.24; Tue, 01 Aug 2023 22:37:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DGFvj8ai; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231613AbjHBFCr (ORCPT <rfc822;maxi.paulin@gmail.com> + 99 others); Wed, 2 Aug 2023 01:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231573AbjHBFCp (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Aug 2023 01:02:45 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87F4211B; Tue, 1 Aug 2023 22:02:41 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3723pTYD027469; Wed, 2 Aug 2023 05:02:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=ma47urIk9cRBNt7qW0XUc4ZbaKVgTk2w0omDWbM+PoY=; b=DGFvj8aiPIT82pjSroyXl7dw7tzuIMIM7bnjTPVuy3bXHWpUz05DUAjNchcdE44Nwkcs Rd6QXhocbCRQDrT00vtBdpSd8G5LAFIDu6zK5FgoQhk3Hts2BYtPk/v/fmCrliodjesV CkYAZkz99+vkIf0o7uwCHLopuWP4yP9oToiTTPUV0GkiZ8GZJa2Dcynt21KbcwiLlPHy 2vaH7jGF5OLVn9bK9rvP7lFRaKwl0wlfDgZNPDyL3LRu/R6HEFHTp1HGuXjf8H8Tbwn0 1Lpv6JWc02CF2FRx4HdjepQqhZNSL8PYu1d8sTzY1b3Hkt2Cse1eKRWrg+yBO5FHkoy2 zg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s760c14bh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Aug 2023 05:02:37 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 37252aKo026124 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 2 Aug 2023 05:02:36 GMT Received: from ekangupt-linux.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Tue, 1 Aug 2023 22:02:33 -0700 From: Ekansh Gupta <quic_ekangupt@quicinc.com> To: <srinivas.kandagatla@linaro.org>, <linux-arm-msm@vger.kernel.org> CC: Ekansh Gupta <quic_ekangupt@quicinc.com>, <ekangupt@qti.qualcomm.com>, <gregkh@linuxfoundation.org>, <linux-kernel@vger.kernel.org>, <fastrpc.upstream@qti.qualcomm.com>, stable <stable@kernel.org> Subject: [PATCH v3] misc: fastrpc: Pass proper scm arguments for static process init Date: Wed, 2 Aug 2023 10:32:29 +0530 Message-ID: <1690952549-31819-1-git-send-email-quic_ekangupt@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: XfEsMTmizlpweRvBSnPKnSC5_Yz1if6S X-Proofpoint-ORIG-GUID: XfEsMTmizlpweRvBSnPKnSC5_Yz1if6S X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-02_02,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 impostorscore=0 mlxscore=0 phishscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308020044 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773094482186048571 X-GMAIL-MSGID: 1773094482186048571 |
Series |
[v3] misc: fastrpc: Pass proper scm arguments for static process init
|
|
Commit Message
Ekansh Gupta
Aug. 2, 2023, 5:02 a.m. UTC
Memory is allocated for dynamic loading when audio daemon is trying to attach to audioPD on DSP side. This memory is allocated from reserved CMA memory region and needs ownership assignment to new VMID in order to use it from audioPD. In the current implementation, arguments are not correctly passed to the scm call which might result in failure of dynamic loading on audioPD. Added changes to pass correct arguments during daemon attach request. Fixes: 0871561055e6 ("misc: fastrpc: Add support for audiopd") Cc: stable <stable@kernel.org> Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com> --- Changes in v2: - Removed redundant code Changes in v3: - Reuse channel context perms for source perms drivers/misc/fastrpc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
Comments
On 02/08/2023 06:02, Ekansh Gupta wrote: > Memory is allocated for dynamic loading when audio daemon is trying > to attach to audioPD on DSP side. This memory is allocated from > reserved CMA memory region and needs ownership assignment to > new VMID in order to use it from audioPD. > > In the current implementation, arguments are not correctly passed > to the scm call which might result in failure of dynamic loading > on audioPD. Added changes to pass correct arguments during daemon > attach request. > > Fixes: 0871561055e6 ("misc: fastrpc: Add support for audiopd") > Cc: stable <stable@kernel.org> > Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com> > Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com> > --- > Changes in v2: > - Removed redundant code > Changes in v3: > - Reuse channel context perms for source perms > > drivers/misc/fastrpc.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index 30d4d04..5a1268f 100644 > --- a/drivers/misc/fastrpc.c > +++ b/drivers/misc/fastrpc.c > @@ -1280,8 +1280,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, > if (fl->cctx->vmcount) { > err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, > (u64)fl->cctx->remote_heap->size, > - &fl->cctx->perms, > - fl->cctx->vmperms, fl->cctx->vmcount); > + &fl->cctx->perms, fl->cctx->vmperms, fl->cctx->vmcount); this change does not look correct, Looks totally like converting multiple lines to a single line. --srini > if (err) { > dev_err(fl->sctx->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d", > fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); > @@ -1322,13 +1321,18 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, > return 0; > err_invoke: > if (fl->cctx->vmcount) { > - struct qcom_scm_vmperm perm; > + u64 src_perms = 0; > + struct qcom_scm_vmperm dst_perms; > + u32 i; > > - perm.vmid = QCOM_SCM_VMID_HLOS; > - perm.perm = QCOM_SCM_PERM_RWX; > + for (i = 0; i < fl->cctx->vmcount; i++) > + src_perms |= BIT(fl->cctx->vmperms[i].vmid); > + > + dst_perms.vmid = QCOM_SCM_VMID_HLOS; > + dst_perms.perm = QCOM_SCM_PERM_RWX; > err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, > (u64)fl->cctx->remote_heap->size, > - &fl->cctx->perms, &perm, 1); > + &src_perms, &dst_perms, 1); > if (err) > dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d", > fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err);
On 8/2/2023 7:07 PM, Srinivas Kandagatla wrote: > > > On 02/08/2023 06:02, Ekansh Gupta wrote: >> Memory is allocated for dynamic loading when audio daemon is trying >> to attach to audioPD on DSP side. This memory is allocated from >> reserved CMA memory region and needs ownership assignment to >> new VMID in order to use it from audioPD. >> >> In the current implementation, arguments are not correctly passed >> to the scm call which might result in failure of dynamic loading >> on audioPD. Added changes to pass correct arguments during daemon >> attach request. >> >> Fixes: 0871561055e6 ("misc: fastrpc: Add support for audiopd") >> Cc: stable <stable@kernel.org> >> Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com> >> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com> >> --- >> Changes in v2: >> - Removed redundant code >> Changes in v3: >> - Reuse channel context perms for source perms >> >> drivers/misc/fastrpc.c | 16 ++++++++++------ >> 1 file changed, 10 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c >> index 30d4d04..5a1268f 100644 >> --- a/drivers/misc/fastrpc.c >> +++ b/drivers/misc/fastrpc.c >> @@ -1280,8 +1280,7 @@ static int >> fastrpc_init_create_static_process(struct fastrpc_user *fl, >> if (fl->cctx->vmcount) { >> err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, >> (u64)fl->cctx->remote_heap->size, >> - &fl->cctx->perms, >> - fl->cctx->vmperms, fl->cctx->vmcount); >> + &fl->cctx->perms, fl->cctx->vmperms, >> fl->cctx->vmcount); > > this change does not look correct, Looks totally like converting > multiple lines to a single line. Thanks for pointing this out, I might have missed keeping the correct formatting while reverting the change. I will update this in next patch. > > --srini > >> if (err) { >> dev_err(fl->sctx->dev, "Failed to assign memory with >> phys 0x%llx size 0x%llx err %d", >> fl->cctx->remote_heap->phys, >> fl->cctx->remote_heap->size, err); >> @@ -1322,13 +1321,18 @@ static int >> fastrpc_init_create_static_process(struct fastrpc_user *fl, >> return 0; >> err_invoke: >> if (fl->cctx->vmcount) { >> - struct qcom_scm_vmperm perm; >> + u64 src_perms = 0; >> + struct qcom_scm_vmperm dst_perms; >> + u32 i; >> - perm.vmid = QCOM_SCM_VMID_HLOS; >> - perm.perm = QCOM_SCM_PERM_RWX; >> + for (i = 0; i < fl->cctx->vmcount; i++) >> + src_perms |= BIT(fl->cctx->vmperms[i].vmid); >> + >> + dst_perms.vmid = QCOM_SCM_VMID_HLOS; >> + dst_perms.perm = QCOM_SCM_PERM_RWX; >> err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, >> (u64)fl->cctx->remote_heap->size, >> - &fl->cctx->perms, &perm, 1); >> + &src_perms, &dst_perms, 1); >> if (err) >> dev_err(fl->sctx->dev, "Failed to assign memory phys >> 0x%llx size 0x%llx err %d", >> fl->cctx->remote_heap->phys, >> fl->cctx->remote_heap->size, err);
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 30d4d04..5a1268f 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1280,8 +1280,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, if (fl->cctx->vmcount) { err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, (u64)fl->cctx->remote_heap->size, - &fl->cctx->perms, - fl->cctx->vmperms, fl->cctx->vmcount); + &fl->cctx->perms, fl->cctx->vmperms, fl->cctx->vmcount); if (err) { dev_err(fl->sctx->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d", fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); @@ -1322,13 +1321,18 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, return 0; err_invoke: if (fl->cctx->vmcount) { - struct qcom_scm_vmperm perm; + u64 src_perms = 0; + struct qcom_scm_vmperm dst_perms; + u32 i; - perm.vmid = QCOM_SCM_VMID_HLOS; - perm.perm = QCOM_SCM_PERM_RWX; + for (i = 0; i < fl->cctx->vmcount; i++) + src_perms |= BIT(fl->cctx->vmperms[i].vmid); + + dst_perms.vmid = QCOM_SCM_VMID_HLOS; + dst_perms.perm = QCOM_SCM_PERM_RWX; err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, (u64)fl->cctx->remote_heap->size, - &fl->cctx->perms, &perm, 1); + &src_perms, &dst_perms, 1); if (err) dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d", fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err);