From patchwork Mon May 27 12:54:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13675195 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 8D293C25B74 for ; Mon, 27 May 2024 12:57:18 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M/JWeYs7WDkedKu/G+42GK8a2U8DrxSSWZzT3R2szUc=; b=a2pCAf0EJmKsnT +6BHL5SF5P8BbTGh29FaEfNYRDOBmagKS5HPLZs92YcyxUeJxw3pjx7uVI5GujBAw8rFpNMDO9kCi n7a36uZWC6sR3iUazDB4iHf8B11/vgmRong9GRygQKqRbC+OuNPLbGnSAW2MhbBIK4Fpi4SKOGZlE PNx7J7KPObV2VeEBIWmDqIioptg6T63UamQjV5CO+JU79Xpm8QsVYyewKElMEdalxWku65F8qVSZJ /sf62gXHjxRK8QGg2TAkYOA0bmn/pvyQftQRYRarVMnYkGlKil3CoJgvRn4tO9wlyRnUcywMtvzh6 /tf48MkGhNiSTAehXlpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBZuX-0000000Exnf-1A9X; Mon, 27 May 2024 12:57:09 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBZuI-0000000Exbk-3e1C for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 12:56:56 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4202ca70289so79104605e9.1 for ; Mon, 27 May 2024 05:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1716814611; x=1717419411; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7As7Pf6G/hV1h3Ey95u5CfG80vP81J/j45cSsKKCTWU=; b=WGXcAKjetdU+lOWhD3+LhYTZBPvwXgF5fuPz1hGB+lhn8hdD8T2P9M1booYJfmtcNb C5HbnaeooBGgxe0bxeUpsWkU786PoZYLWbl2Js/AsyIwkm3TSZ8FNxi4n8FSywt25aQa fZfY1Ij9WD/x8/rD6BlRP7SGTsb4xnS5EOzdcBZE3DLlige/GjQdWvMGQ8pGRbAn2w19 a/gBuxrAIAmpDt4HqpIrOXp+11Nk+Pw+LO5Tp1r+fvfqxg8HAz0ZuRmktaqH7zaASwWr lcCsAL1YqGduHQbkkA4dLdmo1Mqe6doXk50ntf8YhsSLqDu9+VCUu0c4A7zW2yVapupy I2mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716814611; x=1717419411; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7As7Pf6G/hV1h3Ey95u5CfG80vP81J/j45cSsKKCTWU=; b=bMb251S9YT+A6Ueh8QxtuHbKNvmW0pw/8HmQCgiVeffioeGtmnqdfp8QeVl5cknIex EtaSqJ9A3b1n+fMNnc5X23FJZ/VQtDM2+yhH9UibijkFDD8sOlhr4jFqLIRn8wGDK4Ww Xb5V5bcgsZtOby8dXtppFPip2wIGVQQ8eTFf/x70c3nOC4Di5EtBkiCMKAGmAKeZuk72 XGpVDGHgKJnhw41n4DRfsMpnUtruAnQi4Y7Cn+yREoSUoT1gkmcWOIUrqUSFsL11TJXz QXcox3Og0XZdQT4R/CZ9m8sl8f3l9wQBaJocUOPLrFCkPrqqadl+rKgs2AKMJ/65wTff YFzw== X-Forwarded-Encrypted: i=1; AJvYcCVVFHvPSM2ywVYINFaRO9bAcgHg6Q0Meb7PkgPFFoh9TuTVBwsYPgRMKZGq5TmZq3y8GJXPCnv+nYFpk3sLjFUbyO088sgtV0BFRNYN/Gkwx/MqNew= X-Gm-Message-State: AOJu0Yyb6B2+wzg/kW/AlGxc2YSGfQp/+AIsmaUGzGmRrqj5ZIyNNK7o m7cjLVrGo1L0pHLh73aLwNSE05qnrMIfApi8JICqcSqiQmKGsiiwCgFZRVvpT2c= X-Google-Smtp-Source: AGHT+IFDkoVmx20IGGH6ONvLMGqFlUHjz0w87BRBxDaAOe40qnJ2TAftpyz3HfCVNoRGzx38/nx2wA== X-Received: by 2002:a7b:c00c:0:b0:419:f31e:267c with SMTP id 5b1f17b1804b1-421089d18fcmr66894205e9.7.1716814611426; Mon, 27 May 2024 05:56:51 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:75a:e000:c322:131e:ff9d:ef41]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f64f98sm138753635e9.24.2024.05.27.05.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 05:56:51 -0700 (PDT) From: Bartosz Golaszewski Date: Mon, 27 May 2024 14:54:57 +0200 Subject: [PATCH v10 07/15] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() use the TZ allocator MIME-Version: 1.0 Message-Id: <20240527-shm-bridge-v10-7-ce7afaa58d3a@linaro.org> References: <20240527-shm-bridge-v10-0-ce7afaa58d3a@linaro.org> In-Reply-To: <20240527-shm-bridge-v10-0-ce7afaa58d3a@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robert Marko , Das Srinagesh , Bartosz Golaszewski , Maximilian Luz , Catalin Marinas , Will Deacon , Srini Kandagatla , Arnd Bergmann , Elliot Berman , Alex Elder Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@quicinc.com, Andrew Halaney , Deepti Jaggi X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1927; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=ccNi+/2cVrwYK/FlOZHun8hUJt/1weLgkQkfP/49qfM=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBmVIMJXiuUV4um9jG2pga3byQ2edB6XT9XASHYQ 37O7TvxYTuJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCZlSDCQAKCRARpy6gFHHX crmDD/4wi1vmUxHQ7UxDBl5o9C5P+ki4uXhb199ow3MfzdReUFh3mwh1oSxFrinmbmOd2WE1aar AflMky+43nXzzhOvxgK99KiLLFXuqyyhfRO28EBYcEX9lwRA42XVUeXRNzTvO6S4AQu5lyFDmTc h/w9EEh/yVwP1BPhLu1IN2d0kDlFBBotxN1n2mlLuLMwjctrpVs8m5O6f0LJrrbVu45T8UIjObY LQqMQcPXGIPbnFb5f2nSxnmyeTSJx2u161fMLbNKRKjYVw8/PEMQZRTciK4D/0cIQELIEcV9Cop OhpVA4ymdYvyXcjL4669D3i2FCurPy72Gpdsgt1OIPZXRUTsVSWxqh1DbKawVHeVxHwHg9KQVha i2pxdaicQchzsD1BGmAe4WNxJoPqrOdtknzPULTgNakmH5bNS2i3U4l07MWSwzg1/w18NsyFMZ0 xePtFOfG/Tfve0hRTfEcQLbxeB9NvVZ1IInqzKspqrQvjbbrNJ4gdjfB9wjBrG36Js0edtMQmo6 5XJRWOW1EgEgx5In/OGtl1f+UpTTq9vtJ26b/8VB/Q1tMwKxbs6YWyldsQXQbUy5IkwqnDpyR3G fP5fhUyCyXYck4P8pnY6D1yXxgjvPk2ls9pSs38HSGGDHZFFShNu2YIwgzvKMFwVV5wYKJLuVPb j5FVUVOu+zowTdA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_055655_062399_1CB22DA8 X-CRM114-Status: GOOD ( 11.38 ) 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 2c350de1df07..431c279df12b 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -1361,8 +1361,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 = { @@ -1377,7 +1375,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; @@ -1387,11 +1387,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);