Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3087974rdh; Mon, 27 Nov 2023 06:19:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwAhxIlsI0SXBuYrjpMwTrROEEumxNnScO38VF2bZxZHSdfy2rlYEnOsbMo3amUDjWSz3e X-Received: by 2002:a05:6a00:9385:b0:6cb:90d6:ee8c with SMTP id ka5-20020a056a00938500b006cb90d6ee8cmr11907778pfb.6.1701094791208; Mon, 27 Nov 2023 06:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701094791; cv=none; d=google.com; s=arc-20160816; b=iZeqp6Mf15QBnBRNrxWvEbj5J30lJDBqy9YDih79BgfdJ9Go/ua4mffUqH9YIP0nW/ uV9BQIvEURqZK1A9pFveJKZ2h9ilZ1fKxiPD4eoz6Pdv4E070rduh+cqWHyhRus5mzR3 tW/T2HUhmaHSnTBg+dB3W8oJyqj5cr2JMY/BLoz9LRqYs4+0N9VDx8y+ArmF5U4KEc1W MG/1l8Q1dsyhrR+OYAGXcrx7+NW72u7C7MGwTYNgbTbTFFdGB7uYmDw6m3Fhm77UKAzU SJKgUbhHf688JeioKGa8N+kZNCo9/5C+l2MbPXUatBs1LoposydkQ8mUKlPitRFoF/6B jVXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WkxpnfZSZT5EN0UFZSvV8zs0Wwv4/j6hiBpdKDk1HxA=; fh=lirm1ccAeXZZB1cIo+N1DqklpgcFmD/vJ7PCWNIL0HU=; b=X8UjGQ6KsKc34KCEXs/nwrssT7xhjNfzlD18RKeCrZqA/5po9bJpldrzTzmT83dWwL y+SkZDBD/H+NzbvmowEIVQpOTZ2o/FJCcX+Bvuvfe27ksnk1aP9FeAiSV648E2qLGzke yac9SFCH9A2ucTKc6KUCcA94BObh9fHsH4NOGwZRs4gd0BE9G5+e+ZcKaY551Mv1Qz1L blPCBVPGYMyh17dQfK/GEU1eF40BNwU5/cLwVqpKr/2ildnhqKX2ZAB0E8TxZTO/UkW4 HGPQNHeQsmSReGQD6+wIae7HsCS/tbqwd7fkUgvvxNL43BrM4XtrHuSFRo5WrRQOHji+ MFNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=0mVI+iDA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t32-20020a634620000000b00578d0d070f4si9919934pga.844.2023.11.27.06.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:19:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=0mVI+iDA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 08586809FCA8; Mon, 27 Nov 2023 06:19:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233729AbjK0OTd (ORCPT + 99 others); Mon, 27 Nov 2023 09:19:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233697AbjK0OSt (ORCPT ); Mon, 27 Nov 2023 09:18:49 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A2AB3C01 for ; Mon, 27 Nov 2023 06:16:21 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40b472f99a0so6017375e9.3 for ; Mon, 27 Nov 2023 06:16:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1701094580; x=1701699380; darn=vger.kernel.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=WkxpnfZSZT5EN0UFZSvV8zs0Wwv4/j6hiBpdKDk1HxA=; b=0mVI+iDAJgxg6XwiCvCPssrs22QZco0Y19B0HO8OBqq8OdqxNCd9tOFnLG7gwAbscJ 3ZMT3u7CD6oJZKw0giKA1BLhN9ImGSEPZWOs1t7CLy1rcV/lnkSgJn/HpLrlMKDR8Iim XHnBkYlqtG8LHTZ9zjVEFm9A8fvZsdtWshV3FWz7udFhOSS4FjfnE4X8/SKWHFw/sRjN BM93c4lYBvKn1QL2XPyNzToB0Fhinrf+I+9M/6BWuxTy+mIuD8AkmgIYN2DQyPRjXbuU VVS/8mfHEPa4LdIa9FQcoZz8XzEy8t0d2Zt/Hz8mKjUX+wRZaLVlJLH5bJCkjUexkuUh 9uMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701094580; x=1701699380; 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=WkxpnfZSZT5EN0UFZSvV8zs0Wwv4/j6hiBpdKDk1HxA=; b=uF4Ydv7r5doUXY535sMNJw5cHdeYk73AiPJTGzKT+wT3f8Y5yTFKkzTaBROsH4/w8H SKGRV7mT0yK83o9XN5xexHFme0gh1ThS0WmKnkSlVX7D3riaJKv7lzcvx2gXmnJ/uHEz aJjY6jIw2yVMIq7F0KeTDvjoFfI4ewm/xvYDC11M1kgi0kfgA9EhMWj+QTZTy6/0znCB aY+FHm8bKuGr3ZMIRFolZRXv4KTIz5nisgiXV6jstUkLMMA5Y3ReMSBFzu9cCTecCGW2 dYBKR+hT9H8aXawhCGQGHuhh0FS6RSvZmJjx4/+odJkfE87+psunGhRMQ5ZAV2RzZ7Sn BEKQ== X-Gm-Message-State: AOJu0YzXwLw8h/rOZsxnBAGFT28om9ICcFllWEFuk0GGpNYd5HekpxBw gl+v0tQoyA7c1/rpLjMxdK7pQg== X-Received: by 2002:a05:600c:444b:b0:40a:3e41:7df1 with SMTP id v11-20020a05600c444b00b0040a3e417df1mr8884896wmn.37.1701094578887; Mon, 27 Nov 2023 06:16:18 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:16:18 -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 08/13] firmware: qcom: scm: make qcom_scm_qseecom_app_get_id() use the TZ allocator Date: Mon, 27 Nov 2023 15:15:55 +0100 Message-Id: <20231127141600.20929-9-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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:19:50 -0800 (PST) From: Bartosz Golaszewski Let's use the new TZ memory allocator to obtain a buffer for this call instead of manually kmalloc()ing it and then mapping to physical space. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney Tested-by: Maximilian Luz Tested-by: Andrew Halaney # sc8280xp-lenovo-thinkpad-x13s --- drivers/firmware/qcom/qcom_scm.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 11638daa2fe5..3a6cefb4eb2e 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -1525,37 +1525,27 @@ int qcom_scm_qseecom_app_get_id(const char *app_name, u32 *app_id) unsigned long app_name_len = strlen(app_name); struct qcom_scm_desc desc = {}; struct qcom_scm_qseecom_resp res = {}; - dma_addr_t name_buf_phys; - char *name_buf; int status; if (app_name_len >= name_buf_size) return -EINVAL; - name_buf = kzalloc(name_buf_size, GFP_KERNEL); + char *name_buf __free(qcom_tzmem) = qcom_tzmem_alloc(__scm->mempool, + name_buf_size, + GFP_KERNEL); if (!name_buf) return -ENOMEM; memcpy(name_buf, app_name, app_name_len); - name_buf_phys = dma_map_single(__scm->dev, name_buf, name_buf_size, DMA_TO_DEVICE); - status = dma_mapping_error(__scm->dev, name_buf_phys); - if (status) { - kfree(name_buf); - dev_err(__scm->dev, "qseecom: failed to map dma address\n"); - return status; - } - desc.owner = QSEECOM_TZ_OWNER_QSEE_OS; desc.svc = QSEECOM_TZ_SVC_APP_MGR; desc.cmd = QSEECOM_TZ_CMD_APP_LOOKUP; desc.arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_RW, QCOM_SCM_VAL); - desc.args[0] = name_buf_phys; + desc.args[0] = qcom_tzmem_to_phys(name_buf); desc.args[1] = app_name_len; status = qcom_scm_qseecom_call(&desc, &res); - dma_unmap_single(__scm->dev, name_buf_phys, name_buf_size, DMA_TO_DEVICE); - kfree(name_buf); if (status) return status; -- 2.40.1