Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2933464lqp; Mon, 25 Mar 2024 13:34:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYjjzQ7ya1KpkONyxsqs5CyCXp9ig5HTwk6mCGghYFMZzuH4gBWxr9wQW1/vmOior/HKWij0fYBsZgfo8q5xLyzUEATIl+TAypCIxHsA== X-Google-Smtp-Source: AGHT+IEwgcVuCgibz0En4JfJ5u/RIR44Egqr2tgEiqDWUMonKt6msRBZmN7EvcnIuVuDhbEhHASs X-Received: by 2002:a05:6a00:3d51:b0:6e7:9a5e:3b45 with SMTP id lp17-20020a056a003d5100b006e79a5e3b45mr8710821pfb.11.1711398896921; Mon, 25 Mar 2024 13:34:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711398896; cv=pass; d=google.com; s=arc-20160816; b=bfHwZj0M1tkVTzWP7mKW09giIElUNXCGXl7P86e26N36h5YaFdFlPQcUUFVfMov7BR yt49b1SYo1SgHzfiV4Cu3c2RO9XWUaZpAZmMgJf1LnFgN3WaDpDXamzOj0RZr/+Rg3Ta fTm0AiO6v4GQUPmsLRZBGMRJwjD+xuih7LHpUVCMSxvzz2CgQlo9tD0Atge1gkiPJhRl U2t253ImsA52vAd3FlYT2RG2vTPhEpszRlO7onr1eqh8QRgUffVqjZmy0QsagE2+8YSS /jPj+YkpnUTPS8kPXN9l2Sb/N4RP3F36Go5RZpG/Hp35olDUTQNzGvlRKwgYJ2/0mYf7 RRhw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xufcXpqu9meZgvOhjobiZ3mAJVgm6XQHol02lU9mgVE=; fh=Apn5lfLUdbPw+K7tVKVuBV3iu/DNXnu/Sl3+qy8MtE4=; b=x7Urs9Zyh+0HMCgADa7sYj4jjhRIY42gMEBJoaEXs6W8pg5/L5cHZhfZcxX3tBo3NC CXk0m18Di8umQ8GWB+ijW01EUfn0U4iu3NvAWbJvPYVXvKietRhwv2jMIwBCTNbh6SOX fUNzWHJB50zy2J1QdBA21MxI+d8KAkrft7wgFS+iCyDmstTCfKCT4abTDHGqnaQ/cejJ 3OWa/RIvo4e8MSVmfkj4EJ+BobcnBC5+CYUpLj5VE35Pn3u25rdpGlz3X5kl5PO87LnW WzAutBPtqCAtBLHWMMoM27u9zSDPYhOJCthfTY2cBrejT8X22E3n3vLBb5mbv+HEH81+ S9TQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=m5yH7W7E; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-116794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116794-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 5-20020a630d45000000b005dc816b234esi8248398pgn.629.2024.03.25.13.34.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 13:34:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=m5yH7W7E; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-116794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116794-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4DED92E1C73 for ; Mon, 25 Mar 2024 14:00:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 543A2183B90; Mon, 25 Mar 2024 10:47:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="m5yH7W7E" Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A51EE18181A for ; Mon, 25 Mar 2024 10:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711361056; cv=none; b=tYTEPYAtV8mJP4Caj4sPlbG8onZVTGktvUqnsfx82Ppci3GJOMhMxfXn9t4iz61AuNachIujkzHNHg/AhZVp7WXNyQk7ZVdeJq9+JNWLG1R+i5WWPNP8cRGNO7bVf5xOVS2ccksCQ29dUGwOOEK3WNTYg0RjmTD70I/9aDGifxg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711361056; c=relaxed/simple; bh=IUqejzqcyuNGIBnKywmHdqb016FeW5Y+vRvwo1J5vYo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Q+cYUto4qQAMFa2q1f8aEjfWfd8M8CkwliYiURPzfewPjoxC5xscr+b1gfZAICIWG80XhrfrjS/U4kYYnCEMNKBLzL6JQNHl97v8Ru8z3TBWjcXhqkQBYZLskwKmhJftMonA3MCmwNe/M5rrM8jSjw7TpD5NrVHvKuZWq6f+geM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=m5yH7W7E; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-513da1c1f26so5208734e87.3 for ; Mon, 25 Mar 2024 03:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1711361053; x=1711965853; 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=xufcXpqu9meZgvOhjobiZ3mAJVgm6XQHol02lU9mgVE=; b=m5yH7W7E7M8VY9S30xP3BZ+wCgmEbGBMN8UTskyUd1M/Re/arN94yKa2eEk1J974x8 Knk96Zrd6zkgZLPKslfcsuBUY8eVjlx0cNOpj/EC+4+Dz5dG9UeSSu9As25aeKQ8t15M /ZGiBZhxWQ04AjS24CT7J0JAuhIf3Alc8YFw0+NtOPWiFy0n6bH+/eroD6SmKOWxPltF ArBKEQUw4maVc1bD6E95MoxYL/jF2Cke6xXvTWkL3iIGtLaVqll4qqwrFDbmihj3fKw+ RdIR6/YrHokFZNY+l+zhzGOeAhUfAtreoOSwFHgLGm8e0tOZIHMwSyzPGx+dnysBFyhz uMqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711361053; x=1711965853; 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=xufcXpqu9meZgvOhjobiZ3mAJVgm6XQHol02lU9mgVE=; b=Kip3WGIJXyKa9sS+7MGNrJNxsP7XBGzvXbu4P6nd02+LNI4F5lgqvRNGcoRBkd/7KP OktagOPY3EbOfXn0u/6iP3kLyMgLoYDDL5japtHLD7RyADks+NH5A+V74eMtYPnHmeol sa+05Stwk1WGb+HewrDyYXEbw7r8q/MyaXN6KeennZFxvZmtKjiUGGdVLZIL9YTazZtI oEEjnZcIg/3GtAh44sxmnuc4M2lsPFWTPtUVIQwjK3NX9zFasaea62qmxFhCKb9nNNl+ Jzfjq0eqRJVs3im+izOjqybCztbcNGh0j1Qdkx8K0DBnlbbT4pwSbUrzgTENlA+xc3jQ rJ7A== X-Forwarded-Encrypted: i=1; AJvYcCXsE+dyxMCmtxcodiqZWXVg8r1g+n6pmbnB08BaUwR3f3MbnCXA89FDj/V59F6WD5rQPL9sbGvz39WjO+DaB7DzruLRw5J0HsaGUZtx X-Gm-Message-State: AOJu0YyqPJXYXlKaTNwgp1JjMrW4dzg7lyo4fGnbOHiaXaySSdx1gFEn ImaZhQQ6p6ucmrk/acCqIHxX70SrjBZ8BDIpc7GO4Z3YP4a4S0FfofMPLi8qJ6o= X-Received: by 2002:a05:6512:3282:b0:515:a8c9:6ec0 with SMTP id p2-20020a056512328200b00515a8c96ec0mr2202428lfe.36.1711361052810; Mon, 25 Mar 2024 03:04:12 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:75a:e000:861d:8b72:a859:4ce9]) by smtp.gmail.com with ESMTPSA id dv13-20020a0560000d8d00b0033e25c39ac3sm9086874wrb.80.2024.03.25.03.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:04:12 -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 , 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: [PATCH v9 07/13] firmware: qcom: scm: make qcom_scm_qseecom_app_get_id() use the TZ allocator Date: Mon, 25 Mar 2024 11:03:53 +0100 Message-Id: <20240325100359.17001-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240325100359.17001-1-brgl@bgdev.pl> References: <20240325100359.17001-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Tested-by: Deepti Jaggi #sa8775p-ride Reviewed-by: Elliot Berman --- 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 feb44cc03d2c..d9b189632e61 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -1528,37 +1528,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