Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2416770rbb; Wed, 28 Feb 2024 00:41:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW0jeLt4yNYubzAGu5lgc4FcEG+GhK/GmdE8D2H+VADGYl6uvKkIvV3MoOIMVUQJApn68VO/yujhYCdXr4+1wzCnIuxQlfYx9nppYrZTQ== X-Google-Smtp-Source: AGHT+IHkOEZ/urqoMEnVJgUkaPCP4znBdHCLi9N6WNjaOe3i4L+wtXp/eFOVoPzO+PHqm3qqnXfK X-Received: by 2002:a92:d250:0:b0:365:b56f:ff8 with SMTP id v16-20020a92d250000000b00365b56f0ff8mr2267682ilg.15.1709109678092; Wed, 28 Feb 2024 00:41:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709109678; cv=pass; d=google.com; s=arc-20160816; b=HXhNI4JAoxIcnyuJxStU0jCv/aVR08RsMyrFZaZ/ypSdbG2us3m7HyRN6YNAkIXbw9 1jPEPawLEQQrg2xGA6Vr41hCGfvkIKVR7LtScCgLqkZJBQgjFOY/BZ5HCtrUbmkZQuWi WyxltVfYr7dVZOMyxoxq77Cxtp/XY1rkVu/QsQ8NciYNzOMkZx2eIK3rLdckvmHhRzd2 DWT/IKGsQpJuSBhEQxWPoxyFv3+V6RDRxauQ2ZWw/4g2Hr3ttEb/mAI4jQSyc0OQdLUr biII3YFCuuMozfWev7Dm4/fD2GTYZgl4iVsRR5mp28JW5K7N6KA9zB4CeEjZByM3LR7G 2hTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=oloRY23bmCenkucSXxe8sY8KoPpHk012VyqqNCEkUko=; fh=SAQgZetqd7QYEbunZpgnM5rJTOch+yXBNsY7F8KiDs4=; b=02WclZpwURUYJqNoVEXqpPeZT1qnJz7UqG52V6/3MmO0Sb9g2LUEY8WNhqbCsd+8FA nILl6x9n/O+75yG6uxBLW/6mzBL+gaz/E7G7oJYphJIurYr4C+FhajJHyXa63wFMQFQu AFCBsMIALCz4/gRvGhX4ZlquaiazBWEh19QV8Xa1/6FAQnRci6mhlmQoTSmIXw+OTEEK aWIYqoPh5OYYX8InpL47V4w52bsfPJzlQ+VqGhOY5nwjI4131Yl1xXEtT0xN61p/kSAz 8ESrRKobeXUy4XJUHA/x1a4qLywFKTqEh2jdwywSffq3OFCmo9ycCoUXFL9iIcC3U6k/ U73w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qPS9GF0G; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-84692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84692-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q8-20020a17090311c800b001dc879957desi2974688plh.634.2024.02.28.00.41.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:41:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qPS9GF0G; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-84692-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84692-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 C28612833EB for ; Wed, 28 Feb 2024 08:41:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 106892D05D; Wed, 28 Feb 2024 08:41:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qPS9GF0G" Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (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 9C25A2C6B8 for ; Wed, 28 Feb 2024 08:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709109670; cv=none; b=PL8jSWm3r+RyPL6PueE1zUUPK40s/2+GfYSpjDHnBvF8AE1tRCz8YMOLyWZdRdKauqtu/cYM6XXTL3h/8k1CRbstpzBlvJ4OTEpCWbvQOV/aAugFMEg+BxFNWn/ADDIfddcxBCjA29YlQMzmLPZxDSBD4R7CQHavIFZljH1DWtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709109670; c=relaxed/simple; bh=2kzias5Fk7aTKcGGkjTT6RQgXcDAlJOnjNzlZIVBjqE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Z5OJ8dB1KeLL0t9gPIfIMAPsNDgbQXZRQUjpP/m5axSV0A5pH3bO/qhx0Iinu1+UcUhN1oZKZfDWCn9S8uWXeB76dK4JeS76cJd9EqwMx4ph/TNmrFP1ECtAylM/Bfon/YKe8gv556OsnLY5wup4DM6eKtKC1YDQHg755AXmjqo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qPS9GF0G; arc=none smtp.client-ip=209.85.161.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5a02eb63ebcso2646002eaf.0 for ; Wed, 28 Feb 2024 00:41:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709109667; x=1709714467; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oloRY23bmCenkucSXxe8sY8KoPpHk012VyqqNCEkUko=; b=qPS9GF0GQbprId+w2eXZtlC9Ddlu0Y2eLjfXJ8n2KIBsCbsrAnKgUws6CvH+xoPFfh pcOhgaxfT1MDHD0t4f+AFAyEQBGmkoZi4blLV+X7goBgsZSSk1owBKAXyrXg23m88Oy6 7SZVKyc0wWWT2Po/sWYA4qbA+gkfcEfA6G8fYPLtlhgtkLhdAa9zIikupgd2uV/G64+a piFImysXhGWVbUXkjhQjTp82/zVXHhPFoHGGZ+EM2/4povFbrz7gdH43TJeRIQv545c5 hY4xhAv2BtivZEx0pySi6pIyjmaqfb6cWnZnXYvqmom2yuF71ddiqBf1l2FTDePlEaM8 qGHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709109667; x=1709714467; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oloRY23bmCenkucSXxe8sY8KoPpHk012VyqqNCEkUko=; b=tmeFQ34x676kJxpZdtQolkCw89zvKmCqRdbKezWFXDvyq2DeZqISLXHfkaFHg8KGlY elaVJeiujWs7Yj9UGMyCHajoWt8rfF1WfZPqJLX3CLbRZqFuTHRbNyw3bmG6iT/Ctv6e 1fp20Ndg5ePLtBpgaKuazjxOmmwNGQG5lCLKnCz9Bema+h0ia3ruiqplG2aSb0alcT05 zYrryPRr8ENRAeXiqka2FRKaM7Mv6DRkI1QFA043etVPtwobdLq2Ross/jT9++a9KN73 Bz94J0a2qqPuCh6wIKThA8ThY3c7ZAU3dYy+Ct8G86VC6iTMb/JzyDKwS38VZr11sAMb I6pw== X-Forwarded-Encrypted: i=1; AJvYcCX5PlSfaV4iFzOznmdNpftGNyZbMYRR/sNLQ57DZ/3p+kpaxGQKAobsFoDtMZxodAVKiqcSeBnY28Zx+QoCxypGJvVrFCauchpAOkXf X-Gm-Message-State: AOJu0Yx1iXTyYwr1FHOzcs2LmqaseuWUUpkCHEI9HhyBMPioqok5myLr 76GwU8nHIx2IYj61nMx3LAQk+zFU5ziIKUecBwZH52g+ARFg8lMELlWmKym1TMHg9Mu5wafpoio mUXhmjRmxzmFpgAxi+IQITtH1ssfXVGdcnjhspg== X-Received: by 2002:a4a:385e:0:b0:5a0:c476:3461 with SMTP id o30-20020a4a385e000000b005a0c4763461mr1752589oof.9.1709109666716; Wed, 28 Feb 2024 00:41:06 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240223095133.109046-1-balint.dobszay@arm.com> <20240223095133.109046-2-balint.dobszay@arm.com> In-Reply-To: From: Jens Wiklander Date: Wed, 28 Feb 2024 09:40:55 +0100 Message-ID: Subject: Re: [PATCH v2 1/3] tee: optee: Move pool_op helper functions To: Sumit Garg Cc: Balint Dobszay , op-tee@lists.trustedfirmware.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, corbet@lwn.net, sudeep.holla@arm.com, rdunlap@infradead.org, krzk@kernel.org, gyorgy.szing@arm.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 28, 2024 at 6:58=E2=80=AFAM Sumit Garg = wrote: > > On Tue, 27 Feb 2024 at 21:20, Jens Wiklander = wrote: > > > > On Tue, Feb 27, 2024 at 7:06=E2=80=AFAM Sumit Garg wrote: [snip] > > > > --- a/include/linux/tee_drv.h > > > > +++ b/include/linux/tee_drv.h > > > > @@ -275,6 +275,17 @@ void *tee_get_drvdata(struct tee_device *teede= v); > > > > struct tee_shm *tee_shm_alloc_priv_buf(struct tee_context *ctx, si= ze_t size); > > > > struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, = size_t size); > > > > > > > > +int tee_shm_pool_op_alloc_helper(struct tee_shm_pool *pool, struct= tee_shm *shm, > > > > + size_t size, size_t align, > > > > + int (*shm_register)(struct tee_con= text *ctx, > > > > + struct tee_shm= *shm, > > > > + struct page **= pages, > > > > + size_t num_pag= es, > > > > + unsigned long = start)); > > > > +void tee_shm_pool_op_free_helper(struct tee_shm_pool *pool, struct= tee_shm *shm, > > > > + int (*shm_unregister)(struct tee_c= ontext *ctx, > > > > + struct tee_s= hm *shm)); > > > > + > > > > > > These rather belong to drivers/tee/tee_private.h as we shouldn't > > > expose them to other kernel client drivers. > > > > This is the right place, this .h file is for TEE drivers too. > > > > But this is shared with other kernel TEE client drivers and we > shouldn't expose internal APIs which aren't meant for them with a side > effect of API abuse too. Any particular reason to not use > drivers/tee/tee_private.h? drivers/tee/tee_private.h is supposed to be used internally by only the files in drivers/tee. If you look in include/linux/tee_drv.h you'll find a few functions and other definitions that a kernel TEE client driver should not use, for instance, tee_device_register() and tee_device_unregister(). This kernel TEE client interface was introduced with commit 25559c22cef8 ("tee: add kernel internal client interface"). include/linux/tee_drv.h existed before we even had any kernel TEE client interface. Cheers, Jens