Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp946061rdg; Fri, 11 Aug 2023 05:17:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGU04f3fMEfaOF7UqjYoJmWRrmbKE7RVwcUT8+O028075cGNI29x3pkcG5nqiTkkegVMMuY X-Received: by 2002:a05:6e02:1c42:b0:349:9778:da0c with SMTP id d2-20020a056e021c4200b003499778da0cmr2342230ilg.5.1691756226033; Fri, 11 Aug 2023 05:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691756226; cv=none; d=google.com; s=arc-20160816; b=Djv1LD1TU93F+xiK3INLPfX6e9htcmW9AW7YZpdZVs5I/XEIqd1q4vK94qtdP559GL nvuyJn0w+HaMUikD4ZM27bX64wgV8WdCYySatWO6dx5gs+6msO4qC2IZnK3DyVOy+Gb2 dTennAhaVRrPUH4PMRLDa7DWBjCeMOwP/Q2D3rZO70lRs30TFI8SbeIO0y7kv6CRDC49 Vku7uIHpWKbyJgBw0u9BQrwC8GvtZXBWxyWqB/f+Y5SS2ce4UB+lxUi0yBj5pGPJrLJb MYxxdMjT9fQPOh4HrMpmPs7uRnmDRo3EbBDAW5Md+OvCAQqSuAdM5OxhW08ViPOhKZSY c6hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0KbOGymP7OaffTHBxIipa1qriFrse7ok8bc9+6gM8Bo=; fh=CFwWa/wFi2T7MkQkyT3fgxbew9+oGKG8zaK55FnmIWo=; b=xi1/sCHWOSBPxsUstY3wCJ6IpEYAvItO/XmDD3PAK33Ks/E79TiJhvb0fwUWUIlmjj 9Y9ANRXzCV3SbIYq+QmOKqwtaE6fuB6jEEsO7+oYkZ0mDPHNT7JXqL5EAA7S6g3jF8Pp 65jPO6CNSJhtrAK7XDK/qcWiXcX8WdVlK7oMgntZbJe0sa3ko2WptSSn8dj6F1cafe6+ Kat6scinbY2+GF77ptrRcFBS0eM5loTTLeIqk6BjEJV0IFdrGMj9z9u6JmEsj8ORRTW7 FZMc5Wd20JZ1boA2y9FbARLFuVv3LjlonbCMVsIuWBiDNbUa3jHH0O2X1OoA1zdq3thf lcJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SUJDwsnT; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m1-20020a656a01000000b005655bf61e2fsi2864077pgu.27.2023.08.11.05.16.52; Fri, 11 Aug 2023 05:17:06 -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=@linaro.org header.s=google header.b=SUJDwsnT; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234936AbjHKL4y (ORCPT + 99 others); Fri, 11 Aug 2023 07:56:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233772AbjHKL4w (ORCPT ); Fri, 11 Aug 2023 07:56:52 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C93F110 for ; Fri, 11 Aug 2023 04:56:51 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-99c4923195dso263889166b.2 for ; Fri, 11 Aug 2023 04:56:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691755010; x=1692359810; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0KbOGymP7OaffTHBxIipa1qriFrse7ok8bc9+6gM8Bo=; b=SUJDwsnTW6pbG7vD+g67dznFE3s3+YgkqWsX1abky6jdEPQM0ziAqQujZfLELDSzP/ Ax+pTse635fKzsGn2yquOaJDMXxbZyYmZyU/IvsKQm8u9BKU5bETs64ahDDIdxHVOGyB Jzrl4Z/7AVi8sKOod30vD6VWIUcYpLXF0Up0zvW/eGGY9ln5hkXVrdo+CYZnh0TzqfWJ mDeFdoGBUQGv7Ee70VGDfU8MqEUeTuJnJ3uwlsrCOHLSyFfZvX1oqtScIjxkjp7784hP vALP9lBBPkqG398pnc6QCRenNkUh07W9ax81SovmDhhN85HxgecUgQ6kAXgLqoKMQQKW zfOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691755010; x=1692359810; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0KbOGymP7OaffTHBxIipa1qriFrse7ok8bc9+6gM8Bo=; b=LoXD+nB9V9nzAU9KvaY2LNrq3gimd5e6u8tQCUC7KrUvXzhll2x38j8NMWIBcJO5oL QLLb6gVEwZ5YpbNtE8D2xAJN6avYFxkKX+FRJlM+j5nDBegtU3rsjEwLRLYI/yEJS59l tKvg/Lau1LoXYm76WG4JFbfZY7a4vD5ytDK9GDdKpNmckoZ4obPEHIasqrjN2P7K0XUw WFP/N4udke66ghIdk39/KLNLwzCzaLr+NI0peXbmuFAtqLkStwTym+SfvfxZfMQSkVjY A6azDDqAxwRyumYtIn4m0oWRC15Q3shfhz+VB509wAwga0jjhwDOQWny8Tl4ofAMDk4u wZ3w== X-Gm-Message-State: AOJu0YxtYgymyzaBJQh1F0DgcyFduCtLzu8uHQk7VppBVJN0774vXGRY +74ikJ8uxUtOHw49zmi58JaRZg== X-Received: by 2002:a17:906:31c6:b0:994:3207:cddd with SMTP id f6-20020a17090631c600b009943207cdddmr1569351ejf.34.1691755010074; Fri, 11 Aug 2023 04:56:50 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id f16-20020a170906561000b00992076f4a01sm2165395ejq.190.2023.08.11.04.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 04:56:49 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable , Srinivas Kandagatla Subject: [PATCH 1/3] misc: fastrpc: Fix remote heap allocation request Date: Fri, 11 Aug 2023 12:56:41 +0100 Message-Id: <20230811115643.38578-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230811115643.38578-1-srinivas.kandagatla@linaro.org> References: <20230811115643.38578-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_NONE, SPF_HELO_NONE,SPF_PASS,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 From: Ekansh Gupta Remote heap is used by DSP audioPD on need basis. This memory is allocated from reserved CMA memory region and is then shared with audioPD to use it for it's functionality. Current implementation of remote heap is not allocating the memory from CMA region, instead it is allocating the memory from SMMU context bank. The arguments passed to scm call for the reassignment of ownership is also not correct. Added changes to allocate CMA memory and have a proper ownership reassignment. Fixes: 532ad70c6d44 ("misc: fastrpc: Add mmap request assigning for static PD pool") Cc: stable Tested-by: Ekansh Gupta Signed-off-by: Ekansh Gupta Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 9666d28037e1..2faabbd12755 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1866,7 +1866,11 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp) return -EINVAL; } - err = fastrpc_buf_alloc(fl, fl->sctx->dev, req.size, &buf); + if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR) + err = fastrpc_remote_heap_alloc(fl, dev, req.size, &buf); + else + err = fastrpc_buf_alloc(fl, dev, req.size, &buf); + if (err) { dev_err(dev, "failed to allocate buffer\n"); return err; @@ -1905,12 +1909,8 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp) /* Add memory to static PD pool, protection thru hypervisor */ if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { - struct qcom_scm_vmperm perm; - - perm.vmid = QCOM_SCM_VMID_HLOS; - perm.perm = QCOM_SCM_PERM_RWX; - err = qcom_scm_assign_mem(buf->phys, buf->size, - &fl->cctx->perms, &perm, 1); + err = qcom_scm_assign_mem(buf->phys, (u64)buf->size, + &fl->cctx->perms, fl->cctx->vmperms, fl->cctx->vmcount); if (err) { dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d", buf->phys, buf->size, err); -- 2.25.1