From patchwork Mon Nov 27 14:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13469720 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 71420C07D59 for ; Mon, 27 Nov 2023 14:17:21 +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=nsYm+nQcy7Pzv+g/umqEUR/5w3KFXjFQl1I6fg3q1WU=; b=sSC4U/JZ0oIGvb qK66fVQKxZYZ2H41AlKCDH57rhCcWR55ZkhSlOcK62zX/aMczWfQUON/kFaFyUnQ5EeReeGrc+0kH CC0U1hd4zUi8Eqx2zzHXFl1RVntPWflT/xFZSqZYNzJrjvITwG6HODowfrk49WYejfbyHg4uw/tQe 87bMaT4NqcdiZc+7wlRQISVxIie616i5q4gr2QAtUIvoLITKCk1C6HiKiwTbskAa56bmM5TnybEWK R/RWq+cCsO5sXjuOmeVTV0imqTKQ7nBjkSZ+MBGldDFJ+QA0Z2MiKvSIEogA/+wMciDu3SbNb4Tx3 0XNEmDneISG/0Iw7I+Dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7cPv-002fTA-1v; Mon, 27 Nov 2023 14:16:55 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7cPM-002fIy-0H for linux-arm-kernel@lists.infradead.org; Mon, 27 Nov 2023 14:16:22 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c87acba73bso56718411fa.1 for ; Mon, 27 Nov 2023 06:16:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1701094578; x=1701699378; 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=eVNRTBYkQ35refPua6fnWM3rCBTplvWDVxVAY6Q7+Wo=; b=DkN9HLomrayZhKJ70d4QLSj5fOhSb1wDFYLs69vTiaKS+wWQdpxicE8zMimgwKl1QQ SBYokmOPuqRn7aCtePyl94ZEfe74G994tuwdlsaIfgdchefXqPRdLmBkwnzZZ8nF2HNa 1KvCY/Or53j9BzpoSI8NfjIT5x78tGVFhdOTISlydH9pn7IFPCXbKgJdaFtleenBMlzt baIncQbUmg+OPfixtdI5vwXqV5q1IMC5DvGtxsTjFAz1+K4AzZO1A54hwK5Y/Rhqp0a0 ykcODoAqrUlTHU8BIJGxchdC3+hBJn3W2W+BS+QXqwPfUtiltKBA/rIurkfutMirAIxk DsQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701094578; x=1701699378; 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=eVNRTBYkQ35refPua6fnWM3rCBTplvWDVxVAY6Q7+Wo=; b=U93QLc92XaA2NifpFDUe2cFkKIdZj8kzQjZJhv45qCXr9Qa87IIkwReUHu4SvZh3gR 19+KzJgKTNU8egB7BXGEW9NsW9aDj/jwCpIwaYb34Opm1MOZWz4SZMSetH9RsAJmFROj mIldw1m83Iydi4UGN650kx9I36edwdwkTF+mYjK1XwqJcShIm4rxNvBcZIOqKtVJY72U usHK9sWZvTePBzoJeiqOyqU6CxjzAEjUq8hYpUAB8ZmK1jxILvjbAxLIjTlnj71TubTt uvFRa8DVfC12P2QEP/lD8nvaLEa1RsNBlXglfbuelokE0ipPUQEiu6XV/e8HiLIl1WAD jXuA== X-Gm-Message-State: AOJu0YzowhOKM4poBsMMjBfQnyr5ixH5kzU6eKjIAMBy5FwrfdaSNX7E QtsKQ3eLxgETUt/TXCPaEgP9jQ== X-Google-Smtp-Source: AGHT+IEZUxmSOKvYVwtL0F7BrhlYoGaqOU8AJQaYo2RkaaxHLkEg9bcAwxd0mdj4l3PkFiSHNjGBmg== X-Received: by 2002:a2e:b5b6:0:b0:2c9:9a20:f496 with SMTP id f22-20020a2eb5b6000000b002c99a20f496mr3657189ljn.29.1701094577880; Mon, 27 Nov 2023 06:16:17 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:bf33:77c7:8131:5e64]) by smtp.gmail.com with ESMTPSA id be7-20020a05600c1e8700b00405442edc69sm14658830wmb.14.2023.11.27.06.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:16:17 -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 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 v6 07/13] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() use the TZ allocator Date: Mon, 27 Nov 2023 15:15:54 +0100 Message-Id: <20231127141600.20929-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231127141600.20929-1-brgl@bgdev.pl> References: <20231127141600.20929-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231127_061620_134570_C38EE549 X-CRM114-Status: GOOD ( 11.53 ) 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 --- 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);