From patchwork Mon Jan 22 10:21:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13525127 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 7B785C47DAF for ; Mon, 22 Jan 2024 10:23:02 +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=OB52cnLDzEPy0Aq6yuaiYddN2R6x6aXx+xQlkRx+Nik=; b=pSjR8YVa092kVJ Rqbh3hPUr7dbbUS8Ad8XkQlBHCD8GDicnPRnaBi6lkOTfXSEWi7xgyGmKPcPu9TAZ4Sf0BQ/Kv69q XZL2YH8mVyAomxNMquv5dYZ1sHKza1b5SudwCfkgyH1IE5fqN0Sa63r7PsdSLlLYRzoigDFiH3wng 6YuWrpUG7hSsFXXGKGTGfpDeOUl9cZbffxSkUeZSCvideQArz33iCrmM6nkz4a/g3pvIanfB0/XbA v1wPaZE+LwRK98UytrBxvLQKlYDfdax+/s48KYzMnlHNEo8+ff1QaZjj/zR5o3VQMG3kf1qMD5GvA snZpmnhiPlAWL7alxCHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rRrRk-00BUge-2O; Mon, 22 Jan 2024 10:22:28 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rRrRc-00BUVj-0P for linux-arm-kernel@lists.infradead.org; Mon, 22 Jan 2024 10:22:23 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40e87d07c07so38348155e9.1 for ; Mon, 22 Jan 2024 02:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1705918931; x=1706523731; 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=Y0tdf3eyAnzGsNLeuGvazlCndWizgRVXM7rJoHxIMZA=; b=sun2+1Mr0nSPtl6Opxs9A2TvQXMQ25vf6ePoWOJ3KMwHUeiF9HtuhnkC64oTfEqiH+ Jc1uiuz1lUTTkVrhSYM8+yMs+Bh2Ud8j1tWFMjvI9v4rb/x/fbpgP/nNb25teyzcRJ25 EJzEKl0FWgmKLsn1Bt+Olly3Dj1Jre5F+6wGMJc3FBUjKihngb6KBQzT4ojRSg1uX5NA M3mVgBtVOYsiLW38/CG6EjIKl5N8i221dpUK1hBFyIP0a10YUh2cq+xx092IvmdfSy9x +MMvRcsnYvrrR1JO+5RHsXxtMSApfSeAq65h2RoXa5wTNgkP/Kj6lK61mkpZHRSWqYLp CQbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705918931; x=1706523731; 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=Y0tdf3eyAnzGsNLeuGvazlCndWizgRVXM7rJoHxIMZA=; b=NocvREaPN6xL7vMzyshT1p8SrVB/T2tQAs4BkjaCdOhH6k2frg4o38pSmr9KRr/mle LEOFtLvOQuC+Czc0S4VuP0o4Lob/mrfKlgoEhgu9JZMfjt56zuRHR7KGD5sENL0SLeTC zhmXpZLsjaBDhfKDHPQjKtTfsRgglTciFDqbah/NVjcV80ZlYcJkgHDrk4k9DufsrBtd SGTe1rwVeyZgVdOHT+EMrzMeIH0hGGx/voqGXgCirURaGND7RViYZPiQv5tFPt4BWo1f qVbx8JetlEW85L3xtx6V4HC0wTI5UbC6JVQR3wDDBJwo9ZRptW9AtEfJrlpSn2rJLeSB MWoA== X-Gm-Message-State: AOJu0YxX00sSdt9NPwKuC832hF6q5gvnpZ8sBYrruPkv0ZiVVmGslk+h bQOa6yxtD2RHyjWPl5SjMEcMUNCVt7kxOfSc7hnKdMTI3oaBnr0ucbAL/V9TTRw= X-Google-Smtp-Source: AGHT+IH+B9VN5ZNnUgonoCwpyLkf6Q3Qt2MIRkE7DG5TIqy+hV7NtfjVLOWQzZ7VrxUQpy3bxMFZdQ== X-Received: by 2002:a7b:c38f:0:b0:40e:6617:fc33 with SMTP id s15-20020a7bc38f000000b0040e6617fc33mr2146170wmj.146.1705918931763; Mon, 22 Jan 2024 02:22:11 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:92a0:6172:d229:1898]) by smtp.gmail.com with ESMTPSA id q7-20020adffec7000000b0033926505eafsm6377904wrs.32.2024.01.22.02.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 02:22:11 -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 , Catalin Marinas , Will Deacon , 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: [RESEND PATCH v6 06/12] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() use the TZ allocator Date: Mon, 22 Jan 2024 11:21:51 +0100 Message-Id: <20240122102157.22761-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240122102157.22761-1-brgl@bgdev.pl> References: <20240122102157.22761-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240122_022220_181258_E83E5D22 X-CRM114-Status: GOOD ( 12.13 ) 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 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);