From patchwork Wed Jun 9 10:23:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 456813 Delivered-To: patches@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp5115886jae; Wed, 9 Jun 2021 03:23:37 -0700 (PDT) X-Received: by 2002:a05:651c:157:: with SMTP id c23mr20880556ljd.393.1623234217535; Wed, 09 Jun 2021 03:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623234217; cv=none; d=google.com; s=arc-20160816; b=a08CIlHwER9PetlrGLVAJoBske641hzhsj+tVrWzL1gUiF0YNgN9xZeDqnjvLWrmcl R30YSdp+8Ay7DdcBwHMtffoFHeg2Qr/rzo5Hq6QwZoyRLg9wdeh4aIOdIWmFnRciqnBp 7oqGS/LQLUJZzPPqY9YlSFJdfFEp90FdxUO2TI48Oy4KI6lw9w7NIMDq7m9kcVyymO4v z51wGuh2AIJnfJvWw7BOeCRuUh0ddNGl9dhIuzwWZcOeKHSqvJt7KlaNq1KEwaUoECug lt5PnloMnqWNRcibTqWJaLOq1hOeHwAV2ustCRU6XwSf3mB3jE1xNPetZge1FW3ClN33 wqLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=7k+X7CK1t92BiWhgV+56w9YZbTfNSIvP69C+r0N5nUY=; b=qCM23KOeG0x9PBkVYxQWiSqJ4ZL+aWGD5kWXcd+bFrjpr0feJMzCwzpdKWmihGqtbe sIept8bDwOudFJcyaUinombymmKgTxUy1EMyFXVoc3yGec3j8O1DAhyX7JOCisVMQcsf A1mBLO5Nl5jhhLHtDtvdpC3mf8Pyg/Gv5GRJSqFdORSzbntFxEhckycm76JcisyHpf+Y BVkp/t0YiJ81XPEH75VX5ERzpqADRjxgPXCueAGyqhU43rAkbHOSeMuhxRnWMOvG3d+W DGWduMxr5HbWT8Bwa2eKRZ+s5dTeGuHJVoFsk4ful1dBIFcIS8ojt10LuyvOHeif6lgn Ck7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=riiSaDwl; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a23sor1130123ljb.48.2021.06.09.03.23.37 for (Google Transport Security); Wed, 09 Jun 2021 03:23:37 -0700 (PDT) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=riiSaDwl; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7k+X7CK1t92BiWhgV+56w9YZbTfNSIvP69C+r0N5nUY=; b=riiSaDwlPrILoa+dn8LTnJirS6z5UNlmyDKkq2oKKjtMmB31qolaw+BY1nmmHbi5ab KqI2buyeebORN25DkSI5Lsl7AprFGdHE9154XH3UrPr+ric6p3Jpx+6ZJvUtZXUhCHJw 4/WudfP65VmzqICS6U2X6RNPW/rxNTUchORslSSMmxQPapeMETvt02LYig0G38Rd1YDV Qhy3hHgI8SnUqneyMVMMw2yqGy0CcRIRK+JcRlAApOoR85eK+HEt3xUL++cj6KOyWFQI t8PPaGKYQl2+UAyzGExBjcGqyppVzUFf/n+7tOjcP4ZTBk/uRXgBIataPATeNdisidJ7 BFpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7k+X7CK1t92BiWhgV+56w9YZbTfNSIvP69C+r0N5nUY=; b=ZkbNaRP5jCZbV8jOwNfmX09kC6ASaKfEiZoCHgitmiTJX/HQiSC+fNf4iWqvQgLo/2 fB0lWmMyleaBvZO83gkpAjERfO6xDnwPY2IAJvP9wV6mfacUbmkIit8NQ7dz3TDN0Ql4 kUs6O9PB1oaFT3NezgowTk1ysQIidsnPfDcn2Zo9t0EbSuedV86GPSTvNKW1znOov56f WVqNjgO1L07eMiu0tV8sSWEzmlapxNIybazAVVX8lqd3a8KbV1VKFAN8tak/iJNLV4XM JQ834S7A8T0Y6KKUnou1swaFMnJxSuzqQDPCVA0eSsCiMGOsFfaHTlqJ7W8f92IhTo7/ SGqA== X-Gm-Message-State: AOAM531EzXaO8MyJSTblV4Xn7HkNGykhRn9bXHSP7eToSxJO9xk1BgGi +BAZ3ioanijIBopRLAzroOjEYwr3 X-Google-Smtp-Source: ABdhPJxab+7rKOPjvqtNoCA/sS6DcDEEV6CnuWiKYFXW+QhxpI6x8xsC6wkvE77QD5kBxEvAIi8NHQ== X-Received: by 2002:a2e:94d7:: with SMTP id r23mr22199127ljh.380.1623234217100; Wed, 09 Jun 2021 03:23:37 -0700 (PDT) Return-Path: Received: from jade.urgonet (h-79-136-85-3.A175.priv.bahnhof.se. [79.136.85.3]) by smtp.gmail.com with ESMTPSA id m4sm302966ljp.9.2021.06.09.03.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 03:23:36 -0700 (PDT) From: Jens Wiklander To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org Cc: Sumit Garg , Herbert Xu , Sakkinen , Sasha Levin , Thirupathaiah Annapureddy , Vikas Gupta , "David S . Miller" , Tyler Hicks , Jens Wiklander Subject: [PATCH 0/7] tee: shared memory updates Date: Wed, 9 Jun 2021 12:23:17 +0200 Message-Id: <20210609102324.2222332-1-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Hi all, Until now has the in-kernel tee clients, tpm_ftpm_tee, hwrng: optee-rng and firmware: tee_bnxt used shared memory objects which has been exported by dma-buf. Dma-buf isn't needed here since it's only an interaction between the kernel and secure world. This patchset fixes this by intruducing three new function tee_shm_alloc_user_buf(), tee_shm_alloc_kernel_buf() and tee_shm_alloc_anon_kernel_buf() to be used instead of the old tee_shm_alloc(). This should make the API a bit easier to use both within the TEE subsystem and for the tee clients in various drivers. The patch set starts with simplifying the shared memory pool handling, an internal matter for the two TEE drivers OP-TEE and AMDTEE. Thanks, Jens Jens Wiklander (7): tee: remove unused tee_shm_pool_alloc_res_mem() tee: simplify shm pool handling tee: add tee_shm_alloc_kernel_buf() hwrng: optee-rng: use tee_shm_alloc_kernel_buf() tpm_ftpm_tee: use tee_shm_alloc_kernel_buf() firmware: tee_bnxt: use tee_shm_alloc_kernel_buf() tee: replace tee_shm_alloc() drivers/char/hw_random/optee-rng.c | 6 +- drivers/char/tpm/tpm_ftpm_tee.c | 8 +- drivers/firmware/broadcom/tee_bnxt_fw.c | 5 +- drivers/tee/amdtee/shm_pool.c | 55 ++----- drivers/tee/optee/Kconfig | 8 - drivers/tee/optee/call.c | 16 +- drivers/tee/optee/core.c | 76 +-------- drivers/tee/optee/device.c | 5 +- drivers/tee/optee/rpc.c | 8 +- drivers/tee/optee/shm_pool.c | 51 +++--- drivers/tee/optee/shm_pool.h | 2 +- drivers/tee/tee_core.c | 2 +- drivers/tee/tee_private.h | 11 -- drivers/tee/tee_shm.c | 209 ++++++++++++++++++------ drivers/tee/tee_shm_pool.c | 160 ++++-------------- include/linux/tee_drv.h | 106 +++--------- 16 files changed, 291 insertions(+), 437 deletions(-) -- 2.31.1