From patchwork Tue Oct 17 09:27:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13424877 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3424C41513 for ; Tue, 17 Oct 2023 09:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234855AbjJQJ2T (ORCPT ); Tue, 17 Oct 2023 05:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234930AbjJQJ16 (ORCPT ); Tue, 17 Oct 2023 05:27:58 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01D89FA for ; Tue, 17 Oct 2023 02:27:49 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2c518a1d83fso38115151fa.3 for ; Tue, 17 Oct 2023 02:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1697534868; x=1698139668; darn=vger.kernel.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=bMI+v5JGEkAeGE6amxnpwA2cqSf6wNCzc4JGdgBy3X4=; b=KAkp/MwwI/V2bscZGIksbdbyL+N+COCdQ45SHryXFt1iAyrerswS8GPl6EWr8XlUAI /Otkw44x9v+fGQ4ix3bbqG/VIOW/kpC7YeN6QYXwgbCP3QpV9+BF0kl95KHh/KRtextt ypPQlgWq8WBSDnViP7cXaeE91ksia0yzRsADGJr2NBQ/NpqjcdkouD/jpiamsB++cXLi 01SB3xgyUSX8A+apj2O5q9mBvyIsm5j+kz/Q/r6MjgZgHF/m/bdEP7K9kO8REBe4l2bR TWXKX0TZHU/6Ox2bub3PKCabyrpLKBTsKw9f6yfPpKKE/lFODRZ3Mv/j/NquZTUECBoE UCxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697534868; x=1698139668; 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=bMI+v5JGEkAeGE6amxnpwA2cqSf6wNCzc4JGdgBy3X4=; b=LXYl4PdbKM6at7L/IBKl8PHoCuxvYFuFkuI/JgDi47Nce1BL/Z/mSt3YRc9IxTXgJB VTRzcYVrMCsuW7RB3gvlFt2uazJx/3/BDYD8ajbS0hkBfxGMPfUBSPQpnW5xaPKcmQhT 6I8htQCraXkpHSFIxweIk0g9DwZriixRUfZqyeudth0gkQPmMHFs/aJ1Liy4aorWlJJL zRD0PdQiLyqn2++uynKOvZFuYio5RGDA7mpIMrQ2R8cNPtVXPDjd3j9709Xp9GU5bkPP +E3aMBuMZXHXspWl7IwYOhf7LxPebgK8+BxmQIrkSt3/b7V2qdMlHp1OevayhGydpea6 wvvA== X-Gm-Message-State: AOJu0YxAM8JTnHdudZ+bN0lgrWZ38qcY4c6EjVYYuTlbazDAj1yE1HMk xYPzvkX8UfGxnYrycF4yS9lndg== X-Google-Smtp-Source: AGHT+IHNNereFp3sYYFj5YQWzN8ujHjmEFC1efFd1F3L5LClgjZ/rCYZ7GPiGczXfXxmwm2eWJN4pQ== X-Received: by 2002:a2e:920b:0:b0:2c5:aff:f936 with SMTP id k11-20020a2e920b000000b002c50afff936mr1161859ljg.53.1697534868374; Tue, 17 Oct 2023 02:27:48 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:f1ee:b000:ce90:ed14]) by smtp.gmail.com with ESMTPSA id j5-20020a05600c1c0500b003fe1c332810sm9460787wms.33.2023.10.17.02.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 02:27:47 -0700 (PDT) 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 Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@quicinc.com, Bartosz Golaszewski Subject: [PATCH v5 09/15] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() use the TZ allocator Date: Tue, 17 Oct 2023 11:27:26 +0200 Message-Id: <20231017092732.19983-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231017092732.19983-1-brgl@bgdev.pl> References: <20231017092732.19983-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.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 --- 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 31071a714cf1..11638daa2fe5 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);