From patchwork Fri Oct 13 11:48:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13420789 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 DE335CDB482 for ; Fri, 13 Oct 2023 11:49:53 +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=HvHeNrLtE99oAyaYkdnbAVwgNqQk/L8DwgtX7dSNjAc=; b=X7iqHKNXWtACp+ rckXfYxy4I4nPFVKkP9PXRexa3GT3iRIptX8pL4p3W7Z9f6rvPJf0wX/6vP97yeEe/EcjjNqHwub6 smxDR+vV9S1ETuG0BJ0bhfd1WKr/4JDkUFttiWG08q9sNDqoaV3L+0kym06EKl2OlmC9VGbZ37Bq4 r0DbyqDhHelTT02Nm/TOGcxwQ9imT7lP7dxIY++Sx9e7H6xU3SESh/bfPo9QEPcKKG0D5gAWwSVca s1Vr1i92TPACOTb2U/8exmXqwKRyU68p1aEdS8EfxYwCQ0fVBw65GjExFOAFOMkIS0tSA07fWiE2h eTkPGfG/GR/aAutAuD0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qrGfa-003LmH-2X; Fri, 13 Oct 2023 11:49:30 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qrGfD-003LT1-0J for linux-arm-kernel@lists.infradead.org; Fri, 13 Oct 2023 11:49:11 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4066692ad35so20910885e9.1 for ; Fri, 13 Oct 2023 04:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1697197742; x=1697802542; 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=p/0qKoBBzx1o8heobCmZaZFWvw6elFeS/Pei4C+kHSs=; b=xYpR3FsUCNTKPkeKfGXMbzIRD03XRR0GHZoiiQ7XfUgMzuG7juPCrTzx/0ywm7zZCD fdw4v+EQc6vI9pMW3hSY1P22QjB8H2rEWHT4SfTOrSVWlAUxGkdunAkIu7mE+9SjLxbV juuw93j6v2rCM3r8IqCjIEb5CPzeVVUFBNWZVjd7+AMTvjsMZKs0thQsxHNXdGjswlc8 2L6cOKHedMe7tq0px8HNTpBC2LW+ZXfDbNzYvdgc5zLJ8AFLTGfgCCcU75HM3sg2In2a PXOISqj0M93HWwpPUjsnQ1F2WVNIB1Fu60qqLlZs4MZq2rtRhExR8WhEsHIuI0suVzmJ 4xvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697197742; x=1697802542; 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=p/0qKoBBzx1o8heobCmZaZFWvw6elFeS/Pei4C+kHSs=; b=NRVJasXQsytpm8DqO24UxMCCkCablL9VNk7Stpwa55HRDNIQH5QlRrm0RCgOgBBY1U ypyDl0MofYb0DDFwpPKCewrIz8WI1HVPcHQowgfZbb0Yi0U+8BpSSUCuimaWYAFVfwZg VNb6SjkkZuo6/cqcd5vtr/jHMUqBYnkxs1M9BQVTpipbz5dgCb9ZZuHLd1pactAUWO+I YbyciIq1ETrmvmBLS87O21wEFnDLMQ0onGbJbNBctRgMtubXLkTnSTvlZskkz/igce9+ WvlrdZY/YibYSo0N0e+bU+ZdhpVBnE3w6vScSQDCmdt14d/xrudSawvMVAmahjjz8BLr dpDQ== X-Gm-Message-State: AOJu0YwuC5n65tCGlFMW6XuUoWpnFwKTED1dS5Vb82W2oB4tr4yw05nm iSlKkdSC2+HmjjNAVDrRBz7sgg== X-Google-Smtp-Source: AGHT+IHoBO8HhGjm81+tFaTERty06vctUqUtTt7LVjwozBsdYYmJBEYr6WrYmoqnx9XpNk3164HUaQ== X-Received: by 2002:a1c:f718:0:b0:405:3a63:6d12 with SMTP id v24-20020a1cf718000000b004053a636d12mr23826471wmh.17.1697197741772; Fri, 13 Oct 2023 04:49:01 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:4209:13a:988d:80be]) by smtp.gmail.com with ESMTPSA id j23-20020a05600c1c1700b00407754b998dsm974509wms.27.2023.10.13.04.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 04:49:01 -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 v4 09/15] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() use the TZ allocator Date: Fri, 13 Oct 2023 13:48:37 +0200 Message-Id: <20231013114843.63205-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231013114843.63205-1-brgl@bgdev.pl> References: <20231013114843.63205-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231013_044907_144757_DF12E339 X-CRM114-Status: GOOD ( 11.44 ) 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 --- 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);