From patchwork Mon Oct 9 15:34:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13413933 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 A0AFAE95A9B for ; Mon, 9 Oct 2023 15:35:31 +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=BhxSHdOCiSj3aQcgXAklb2+Zhay7VmZ3P4VS2rt+W/A=; b=liPq0RHhknBnyn z/kPyE2OTAcf/uy+zPb2Bjt4pSQgTDTv244IvIrJYEcmhuUAneeLHPmV6CQnsWHlhyhCtZjNj7JjW LU7Z40Gtj3rAzHflrf8tevvElTXO4Am/C9OyHNfXuGHwMS28qf34t7CC1eJm/Wcyfq/A2V1qQTklw sE2ZBzkTmZTOQA3fxH4E1tv0RpJlEKpZ0M8NS3X07M8EQzeyZef3xpR2MoqEYPvdm7LKxe0AMj/SN /8ANu9U2GfvayV2vSa+jJuKHq62RuTAM3PQHKHlBeP9VtJs141sB+Md9vYfeFUpoowVwlZvtE1lAy 2AlvBAwTmzNxBLrNct1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qpsHf-00B47u-0p; Mon, 09 Oct 2023 15:35:03 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qpsHU-00B401-20 for linux-arm-kernel@lists.infradead.org; Mon, 09 Oct 2023 15:34:53 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3296b87aa13so2820738f8f.3 for ; Mon, 09 Oct 2023 08:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1696865691; x=1697470491; 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=VbTZKQqdpJrILRniIPDrMxLXgf0p/DyB9D6pPMY/qic=; b=e19Jqby4Tj0v7VeYa/TJHDSRwUFZGBjHDwfZfM3h/VsNz7XBZzNP5NUwoH9SWzKQeM fM5z7JxyWdzVzT+WC2587AM8WJm+6hbMmHU0Evbul2I/hh3nnQKfeb7c3wbz+8p3lPK5 BNL9IDdoIbsdm33KdF6E82IxR52tRtZY2XY8FyEADZxvSRFKRSmTWH3iUzQMVEMYG3/m B0QFAZSJ7YliylOzIeFeEvpIVjzT7sTVvk4R3I1IcHZtmBuAu8+ymWuXXpQltvbn59kf m2v2qAM8Yy1VPB4pW//Yp1dCSWm5en1E7YDMoexQPcP1PB0K8IfsrYLe3IckmKTW8ij0 SLgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696865691; x=1697470491; 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=VbTZKQqdpJrILRniIPDrMxLXgf0p/DyB9D6pPMY/qic=; b=ejmCofyF7tNmv16ycIM41uLNWEi6Y81ydcoJ0LJdETLllf5SIdLHniKNXRJx7cNczu M73mXdjkTcEIADYnk0ais9NebLo9xjdT5PwsQJj2eQUPdDhv1tqDFMNnAbZBp2j3hkz8 499ss1pVPp6UHGAUQ1B7tRy2cd94UP11K6sQcedqJ0DhwhY9Qs4EJnaJqls+kn7zXs+j zLASrine491ZEZ9tYB+JcnvqhipTDkZtUXcKIkguWq6tEI0mhkgZEiQAU8+SMQSL8OfN y0uFQrcKqeILLPPR7xnjW99KUAxxW3Byi9Yig/WeP9Z0zRx+vTY3OnYU94N2bViL/EjR zb6g== X-Gm-Message-State: AOJu0Yw5nWYbhnIsJjowbYKjmiBl4Q6+mSvQxRLLiXpxoy2xK1WDcP37 nbzFdFUrdRUAp4ksY4UBcGzGCA== X-Google-Smtp-Source: AGHT+IGQF2q6zQswu+XOUXPGnGNpbRCfcHwX//5E5r9lPC5kW2bwvkYXF5J2WzPCCp+4tjNW7qT8Jw== X-Received: by 2002:a5d:54cf:0:b0:31f:9838:dfc4 with SMTP id x15-20020a5d54cf000000b0031f9838dfc4mr13054433wrv.33.1696865690821; Mon, 09 Oct 2023 08:34:50 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:f20d:2959:7545:e99f]) by smtp.gmail.com with ESMTPSA id b3-20020adff243000000b0031431fb40fasm10016521wrp.89.2023.10.09.08.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:34:50 -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 v3 09/15] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() use the TZ allocator Date: Mon, 9 Oct 2023 17:34:21 +0200 Message-Id: <20231009153427.20951-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009153427.20951-1-brgl@bgdev.pl> References: <20231009153427.20951-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231009_083452_691563_416CA686 X-CRM114-Status: GOOD ( 11.95 ) 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);