From patchwork Mon Mar 25 10:03:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13601738 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 7CB9EC54E64 for ; Mon, 25 Mar 2024 10:04:51 +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=PRqN3QtjzDhjmBq4AesFrihQUp/o+hAo+ZhI5OtZtGk=; b=j0KKu3ozgmpbdF Hu/8N/FJKsMYW3H6CEmCq7PpsmZ6QwDM7y66DfFZMRNRBSUCbQ7P+mCh4frHhEbs4JgbGX/CBdyCI GxxUL1pXp7eyQrn7GnCK+Zfa4Bkv0DuH7VNRAkxn4W5liRK5lajwfnQV4ZalO3C7VrqXcPgbXA7S+ F98HP2cfDmnzRKZGyBqTwNAQ2EFWdniROSo/rH/lVOsBwfsG+l46bbO8cNAj1yhVcO4WdTmjfL8f2 4fBFvHNCVV4ofyPtdxKhjBlNpmeZdzz+luL2beN82l1VX8NjLWk+tdZvUAqYoj5rnHtFq9kzc5yhj HHz2n4clc2DIjMzAxXuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rohBy-0000000Gcf7-1jWW; Mon, 25 Mar 2024 10:04:34 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rohBd-0000000GcRN-3G3a for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2024 10:04:15 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-341b9f6fb2eso1796327f8f.2 for ; Mon, 25 Mar 2024 03:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1711361052; x=1711965852; 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=2Pvx+Hod+Kla6c/44/4Di1ACsNH6U9GMcNcbC9Uj+TQ=; b=yiQKh+ZjVzETOomzkoB4eq3yC13JZl8kYB/zEWaOmFOT3X494dOhRRmGMWrzU3tgH8 Co3V6iawkw2fF7u+L3xQVzVlo4CL6yqX73ROcZ5SaDukbiUu4/gGFTlNwDJWd28YMLMR pPkjqJlN6Y1AG0BvMdU1x9tzHSd3ZNXQbsnfvQxrmlYR3TPqihmq6RFA1UX6DZPyAZ3L Fi3YNmd6Tz0rQ6P1D9evHxZOj6v9kdHxl/mZnRF205HydY4Fv/Y6q+PQBLm7FYNy/FQ/ fjgyOvfFgRtDN4UdmPWe/ge32vipXFE7EY1WaOzpnF1YCOAoaEbBV7Tlib4AOPjhokUD KJ+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711361052; x=1711965852; 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=2Pvx+Hod+Kla6c/44/4Di1ACsNH6U9GMcNcbC9Uj+TQ=; b=DnlKPj2lMnN0xy7gm9Ac5Q29SVOos4zbTvgOT8jP9zLBkMYnju281XdUrXDbKrT8pZ yXAB3YDRFzYf767qIz4XccIbqc7OanWYP+ao9ZWqL8wuSBnChBg4plISBfzm0u2p6Kw/ J2VNrZ+qsQr9IVxDkhnTlMqdnNDlKduoGfXiRmwWE75gadjmZN5lC65nIoJDPuwP2g62 SGk6CUwLXZhHiJAO71VkVN7E15/F5mv3CqrLA3IV8HcEPVFbpUb1JA5JTkhD893KR7qf wkS72ZsoifzgppafvgBoW+M29sXV1BPtCGPYqmI212LIkeQancVx53QMv6UN646aowvD 9pbA== X-Forwarded-Encrypted: i=1; AJvYcCXJG2qKxg1HmesK1fijgPdYdfItyStQG597VY6DhQeALjL+TCZyrBwA696OJVu0Ow9qlCeM25azQ1T7gwGgCOKSAqX8RDtCVOXuElT2T7NGIrDuVA8= X-Gm-Message-State: AOJu0Yyo53H7eueBM3Gh5jwCP1tluBXUov7uuVihQT5Ead+1pKr6kNK3 NvMrABa/JK93qDZgHI8aDtJloy3KzkM3XhXpOu8Atiq0oaLvZBdiSfVyqQaYYak= X-Google-Smtp-Source: AGHT+IF/JifOKum2RJKJjuImyaM+c3DW2K0mf/mB+xqoUjr7FECmMn9fB6GN+Y/rnUOjDbOdeYspBA== X-Received: by 2002:adf:e8c6:0:b0:33e:7a71:1a34 with SMTP id k6-20020adfe8c6000000b0033e7a711a34mr4747426wrn.57.1711361051756; Mon, 25 Mar 2024 03:04:11 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:75a:e000:861d:8b72:a859:4ce9]) by smtp.gmail.com with ESMTPSA id dv13-20020a0560000d8d00b0033e25c39ac3sm9086874wrb.80.2024.03.25.03.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:04:10 -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 , 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 v9 06/13] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() use the TZ allocator Date: Mon, 25 Mar 2024 11:03:52 +0100 Message-Id: <20240325100359.17001-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240325100359.17001-1-brgl@bgdev.pl> References: <20240325100359.17001-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240325_030413_929165_F16B76D7 X-CRM114-Status: GOOD ( 11.98 ) 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 de66319cbfb9..feb44cc03d2c 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -1343,8 +1343,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 = { @@ -1359,7 +1357,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; @@ -1369,11 +1369,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);