From patchwork Wed Aug 2 13:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ekansh Gupta X-Patchwork-Id: 129979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp592061vqx; Wed, 2 Aug 2023 09:54:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlHc9mGcpSMLwl7RVrPjDxMNO+F0zT05b3szGOw0Ay7L0lIcPPUr2r85ejIeoCQklIghSfLK X-Received: by 2002:a17:906:cc58:b0:993:f127:2391 with SMTP id mm24-20020a170906cc5800b00993f1272391mr7947366ejb.32.1690995251582; Wed, 02 Aug 2023 09:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690995251; cv=none; d=google.com; s=arc-20160816; b=I0YqKmNAjb6i+ekz9FHNzEmbUo7NAPi5Y0WMO/rbj6A2SBuzBhSw1CZ7ZBif3I7s0N OMfV+C0DB1kC128ZhLU8zp1Z/HzGgQr0vPyUoeygdELVkJxAj6dzSP6ptRliizJw3D9P glYIZp4mX+HOYz1c9cK5YjrjRdq0aSdAJW/tfoFU4EwHG7n7+jyc5yEhUdhzoGfIcxaD bqapm6Fl8/TarVBDBP04jfGL76W3UtBl3W0Lw2fA+fN/uIKt9Ybv2BDb07hNiJzHAyyX 9jz+GuEMVW4qPxUzNKGQvXkaXzDaWxZSlt/BKlyEDGpaMWqUVDVLsADMphlDOK4X00dd vkfw== 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=sWj8obACQFbEnjg4uaL7NELGgqPZR+Qi4sKG9WHVfXw=; fh=TnMRDi3L0sQlniDGL1hLZ2IIl7MhP13XMPTS/HLyrTU=; b=gGtgH5oSBHJGjDuaiOU9Hfw0CsQbF/C0eJUymJOiUfMaW7gDA5p+5xpQia//aoTKcy ZQc/FWdwBllpfK+Vu8rvD2zqznleEGUbj93TUq0zT4jrd8C7gSsMjGfKjtJBFIXVJhfz /x6/ADdhcXlWPLV7x0jwmblkX2kdy32n/ulAjeiRpXomlVmQEmpQUTzFqwDYKNkIIBwT Gv8FNfTE+rfOhhNuREL3WK/i1yEbKTrBIqtqJlsBS25iTZpZdpz2XWEQ/7LIfHT61OMa 8QVV8DL9PREvmVNFf1MzUf6B2A1DcEStz1ZfDFnOSmpfl/QlRU0/8c2/IDXEpuY2FghZ YTtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=itS5Svhc; 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 dv22-20020a170906b81600b009920f18a5e9si11485474ejb.728.2023.08.02.09.53.46; Wed, 02 Aug 2023 09:54:11 -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=itS5Svhc; 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 S234146AbjHBNxu (ORCPT + 99 others); Wed, 2 Aug 2023 09:53:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231612AbjHBNxs (ORCPT ); Wed, 2 Aug 2023 09:53:48 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BC83E4E; Wed, 2 Aug 2023 06:53:47 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 372CkcUk027380; Wed, 2 Aug 2023 13:53:39 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=sWj8obACQFbEnjg4uaL7NELGgqPZR+Qi4sKG9WHVfXw=; b=itS5SvhcVc4+usGtReKhFOq0P9nw+72PFi5k8oTAtBTmbbS5jjCdJCS8tiNAx/NwEeda 9Bdx6oaHNbCKwZoB87DY58vhYiy83aTBWHrSAgmaHZNUHRzOcTBQGGC84Q2ESIw83ajP VpnJtRH2KNHKh++PBcQwSc9zs9O/cqY+8ja3WjSOaNn7YBRfXWKIrPKL9qW+3rZvJAkj RwPtFMUf/InZl4hUd9hHC1sobXRG2uxbnatZF6ZK0wtcQVba6gUinZFvGwsKAbCXZzlS D0lAbCeZJVBOM+HHMrru32gc49hYFTIbBkDSNkJcMoXe9hqdEsS/whaWhBUWoIOiIOdE /A== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s76jv2crx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Aug 2023 13:53:39 +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 372DrcK3001178 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 2 Aug 2023 13:53:38 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; Wed, 2 Aug 2023 06:53:35 -0700 From: Ekansh Gupta To: , CC: Ekansh Gupta , , , , , stable Subject: [PATCH v4] misc: fastrpc: Pass proper scm arguments for static process init Date: Wed, 2 Aug 2023 19:23:31 +0530 Message-ID: <1690984411-4448-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: W5UOhQF4tLB9XTmCUYhoVo5uyyFSMLmf X-Proofpoint-GUID: W5UOhQF4tLB9XTmCUYhoVo5uyyFSMLmf 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_09,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 mlxscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308020123 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: INBOX X-GMAIL-THRID: 1773131937512484987 X-GMAIL-MSGID: 1773137036774982403 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 Changes in v3: - Reuse channel context perms for source perms Changes in v4: - Add correct formatting drivers/misc/fastrpc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 30d4d04..87df6a0 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1322,13 +1322,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);