From patchwork Sun Mar 3 15:01:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13579819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D329FC54E49 for ; Sun, 3 Mar 2024 15:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=knrN8pBsqUjq+AXd1Y7HZGGeHZKs0rT5R3KAOZ2kMmw=; b=g9hfQbVpfmLIeu NVtf8+7PMc8v6BQYmBrsfAbaCMehoreZ8auMWN3j7wLamgc0CFYC6jwI3NCg0UUmdjnyjr3YpAJRy GqvIS95UKTMD/DhwGrAKWAqOfRSWI68M9BNCwumx9sd+83CDej9hSNG8nJu2G8TdlRRMNZGCF2cmp NcjHo3McuVjlgRHqcBNZKISHfA8jn+w2fG00bz6W1oCQS2SR25G/mWWkoUVwsnaS/UGDAGHrLeUrU ni8pXEkB15Q1iMtPQOhEVhBKM3hRpE3T7Kad085p/DTrt4tk5oaCEWvrWc1IDI1EFCzcD+CZXaH8d YqPDbVmp4yQ2nnaWyHrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgnLO-000000068L3-1dpH; Sun, 03 Mar 2024 15:01:38 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgnLG-000000068Ek-2gKd for linux-arm-kernel@lists.infradead.org; Sun, 03 Mar 2024 15:01:31 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-51326436876so3614926e87.1 for ; Sun, 03 Mar 2024 07:01:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1709478089; x=1710082889; darn=lists.infradead.org; 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=rwOsyagATLxiLLSOZuWrrte+FT3urOwesDO7wStwSyU=; b=y6KxbEj1wnV6av8GiOjHoLhrEXC3HPRJS2K5XuTNGEzNJymWuq2mKNiG5/CFblPBVE POGFwPBHd2BzL1H8MWmW+h95/ligfUyZffV/KPvS2xc+cev7Ubb25mLoaY11HykiV1ty 5iNIHjYYfVyxqDx4YqN44uvt9+oXlC9aRPDfVgpMqA1vFpfuJbMJm703rGpba4+qSJWO 9hepRWWBEIhkFUh6C2bFrn0iAumO7q80xGEF9tOF2rohyrbwzWAji/2Aos6pF6RpYBBD SMH6TbcxcidfNbseMUZKACU6Pby109ZjD+NIFoHIdgYB8cbsjoel+6wD9U7zm5HkFeTN EyUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709478089; x=1710082889; 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=rwOsyagATLxiLLSOZuWrrte+FT3urOwesDO7wStwSyU=; b=L4vTA9gBSsY6/hE5PwZ6M1oQMLW0nJyCfEdbkf7wNy72Hrw291tvsxDJRqamgQC8zJ QfTUKIKoBiMs6XRjf7oyZVXCxhmOwY+0nkXDURQYA/GvoDONVQw6n1YGijeOq1C3yQ2l mr+RmysumLy6ehG2NS6fSZpyM+Ku3jG8QX35qU47O+A/PiF1ZQzcbnWcBoMyFR+/BQm7 NSSSl65E59b3k2IuTev0F7AuyMgni4v7O3peSB6AqwG8Fop5F6WepMEsnT5rfRzZ0Rsu 9KEM23XKjzbumSOrRsM/Yu5wj9Bjkuc9jbyKGCSuLkck2B1Fo48IvIh4erkY+skhV4HU 8Uiw== X-Forwarded-Encrypted: i=1; AJvYcCUOEq2LrEIZ/dCe1yF0oxmv1qPiMiLSX7WOkzdYWql2yZdhJpOZfi7F3i3CjD6cHSLvTxqOSwdz47rJr42je5KkF4uiDkkeuv+G4F0dbLBXRWdKzGE= X-Gm-Message-State: AOJu0Yx2e7uqtWVVS2apIHVVQtNqilXrNOsAGnGHSYf8qDQJ606YYmjQ 4yp9J+e9Urs5Chfb7dn5DYgnRYjPBVmnJhxwuPyrEaml9nBMttmCnTTIJneJMIE= X-Google-Smtp-Source: AGHT+IHGQCA1nHfqiZlNwIm3ejWFnOM2lHkM5W3Q89+JQgso6u9tVFPfbbwJCf9MV7KbXIbcr0DDXA== X-Received: by 2002:a05:6512:3493:b0:512:d89e:946 with SMTP id v19-20020a056512349300b00512d89e0946mr3969996lfr.44.1709478089065; Sun, 03 Mar 2024 07:01:29 -0800 (PST) Received: from brgl-uxlite.. ([77.241.232.10]) by smtp.gmail.com with ESMTPSA id ch14-20020a170906c2ce00b00a42ea946917sm3740293ejb.130.2024.03.03.07.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 07:01:28 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Elliot Berman , Krzysztof Kozlowski , Guru Das Srinagesh , Andrew Halaney , Maximilian Luz , Alex Elder , Srini Kandagatla , Arnd Bergmann Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@quicinc.com, Bartosz Golaszewski , Deepti Jaggi Subject: [PATCH v8 06/12] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() use the TZ allocator Date: Sun, 3 Mar 2024 16:01:09 +0100 Message-Id: <20240303150115.133633-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240303150115.133633-1-brgl@bgdev.pl> References: <20240303150115.133633-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240303_070130_719150_D664C3C5 X-CRM114-Status: GOOD ( 11.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski Let's use the new TZ memory allocator to obtain a buffer for this call instead of using dma_alloc_coherent(). Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney Tested-by: Andrew Halaney # sc8280xp-lenovo-thinkpad-x13s Tested-by: Deepti Jaggi #sa8775p-ride Reviewed-by: Elliot Berman --- drivers/firmware/qcom/qcom_scm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 50c574fef3ac..ed2600bbd4eb 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -1340,8 +1340,6 @@ EXPORT_SYMBOL_GPL(qcom_scm_lmh_profile_change); int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val, u64 limit_node, u32 node_id, u64 version) { - dma_addr_t payload_phys; - u32 *payload_buf; int ret, payload_size = 5 * sizeof(u32); struct qcom_scm_desc desc = { @@ -1356,7 +1354,9 @@ int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val, .owner = ARM_SMCCC_OWNER_SIP, }; - payload_buf = dma_alloc_coherent(__scm->dev, payload_size, &payload_phys, GFP_KERNEL); + u32 *payload_buf __free(qcom_tzmem) = qcom_tzmem_alloc(__scm->mempool, + payload_size, + GFP_KERNEL); if (!payload_buf) return -ENOMEM; @@ -1366,11 +1366,10 @@ int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val, payload_buf[3] = 1; payload_buf[4] = payload_val; - desc.args[0] = payload_phys; + desc.args[0] = qcom_tzmem_to_phys(payload_buf); ret = qcom_scm_call(__scm->dev, &desc, NULL); - dma_free_coherent(__scm->dev, payload_size, payload_buf, payload_phys); return ret; } EXPORT_SYMBOL_GPL(qcom_scm_lmh_dcvsh);