From patchwork Fri Jun 23 13:57:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ekansh Gupta X-Patchwork-Id: 112154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5802856vqr; Fri, 23 Jun 2023 07:12:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66WnGrn3WiDjjTs+8NySJms9pvo6DjpR+Rr7gUEEgEJY3EOXCz6Av12rHA0xLl/LzKd4R/ X-Received: by 2002:a17:903:190:b0:1b1:9968:53be with SMTP id z16-20020a170903019000b001b1996853bemr15857916plg.64.1687529555293; Fri, 23 Jun 2023 07:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687529555; cv=none; d=google.com; s=arc-20160816; b=odkWpWt7RqVRxoO4QDdljspcqUVlVDbBbDNZmN6sMR+uUcJB3OMQl4jjjMimRKtFsB mmXqIL1DGNvzqjABcVcYSRYauO0MMqthaQ83nNG4XPm1QkfTCk0cF3ZXyk+MEgKB1OuF FbMnZAYybXewMxw6cGLvmBxMe9B5m9b8nE2DmHI215xVYQErqtIYWCAe8rtAz3lbeRym 76Zozczgi7qwbQgeb0mvBT9xVKSKWEC0VUi7ZJFkQtvOyo3jWF08qKy+qQYdy+yqRg9H C4Ly6nA5hTVaLSR+CfFAVmkBsmNS+TPyhq49DdnOgIiOUYafZrXqVPAdfL5nXCPRs2kv XpDw== 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=xUP22ueERUeqwsBoTBGp+gr9uvkxyM222vtHDY4eZrc=; b=KCTxlgO41M3ov86Mr/qxg6b1HpOIsXK6+QNGCQVnCjhodExQIV1WvLrQj17rxgEECE 8LUmS0XWNRgMvaJoKoFqgi1XTIBzJv227tK6IyDejfkWJC2nVZhSRK16o8LD/NVjV0jG dnnzsBTPhFvOm+SY86wierfSgX1nZJ1GKZ2VG0DqdwmUhWRP0mpgybxGM2QlCu6huMM7 eqrdjPrq+iRO41AmNuK9YAIlFtDxIbaKlifInU8DFPIzEqTTl20taIN0zuNEPdXaDyRt C2+n7LjTiQcdQo4KHwXDXJ8qUr/2DPagLUQwXpSGHNrjM3/vsSPwr8TK3L327o23GR0E lhiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Iy7vNdb6; 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 l13-20020a170903120d00b001b261eba754si2759078plh.165.2023.06.23.07.12.22; Fri, 23 Jun 2023 07:12:35 -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=Iy7vNdb6; 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 S231966AbjFWN56 (ORCPT + 99 others); Fri, 23 Jun 2023 09:57:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbjFWN55 (ORCPT ); Fri, 23 Jun 2023 09:57:57 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC038E48; Fri, 23 Jun 2023 06:57:56 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35NDsO1A014885; Fri, 23 Jun 2023 13:57:52 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=xUP22ueERUeqwsBoTBGp+gr9uvkxyM222vtHDY4eZrc=; b=Iy7vNdb6D4TeqtYSQkHhU9XTgWPtCv/OMS2Mn/evCL6cZZ3U6a5RVVNwIQpLHuGcG1fW UfZS+lVk2wgTx+o4r35WKK3bD0l6CUCQBPUimyZnIiKNcX1CwN3K1AB9oHWOI7mNZmTV Twn7RtjEKqlMnr07x2QHgzHgTEYRVkfp3y2TlORKcpZQTr1oAZuhAZo1v2tN0a/Qg1MB 4+Nm4AE5Zywt6r3iLv0ftT3EdhR55QaJeHEIWGDuF5dKszCVeg6wq1DdbgmWlUapcELF kGDmvsGfg1c2LbaNUMxDnTw1NrLunp/zz6zaDaeyfRL5pod7qCf8LYVAL89JGB/gKtDb tg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rc2rcnce2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Jun 2023 13:57:52 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35NDvp0K021284 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Jun 2023 13:57:51 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.986.42; Fri, 23 Jun 2023 06:57:48 -0700 From: Ekansh Gupta To: , CC: Ekansh Gupta , , , , , stable Subject: [PATCH v2] misc: fastrpc: Pass proper scm arguments for static process init Date: Fri, 23 Jun 2023 19:27:44 +0530 Message-ID: <1687528664-25235-1-git-send-email-quic_ekangupt@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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-ORIG-GUID: TsaPkDHEMeg7k1Dlyb3kLCMwxCKRrd2M X-Proofpoint-GUID: TsaPkDHEMeg7k1Dlyb3kLCMwxCKRrd2M 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-06-23_08,2023-06-22_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 priorityscore=1501 mlxscore=0 spamscore=0 impostorscore=0 adultscore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306230127 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767871715298912668?= X-GMAIL-MSGID: =?utf-8?q?1769502990835726286?= 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 Tested-by: Ekansh Gupta Signed-off-by: Ekansh Gupta --- Changes in v2: - Removed redundant code drivers/misc/fastrpc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 30d4d04..9a7074a 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1278,10 +1278,11 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl, /* Map if we have any heap VMIDs associated with this ADSP Static Process. */ if (fl->cctx->vmcount) { + u64 src_perms = BIT(QCOM_SCM_VMID_HLOS); + 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); + &src_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 +1323,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);