From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 536EFC432BE for ; Fri, 27 Aug 2021 07:20:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1F40260FD7 for ; Fri, 27 Aug 2021 07:20:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1F40260FD7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0QqYWSWM7C/wZ0B3q+KwrDzOkRbU1VslpHWFm5iRXAQ=; b=yjpaKybQBcsLi/ ZGHhuqSLuJB1cN8ly6oZV8NJwmiwNAQXq3BAi+mLmwZA6PXuAuhjy2GVKvfRMCrtrlM/x3pcnJ8BD dwJMODlOJLmP57lxocOCU/hLMtzk5I3hhBdgdTA/li5WMBrIkOpEYSb7t2sxWja/g33CIztxnsVRM I4YPTPg7Z/32X9IRsH3ETpLFfeNNhJ25ZdMhYQ0RMJ+ZTwIkKQAbv74SPnrEmgaLpNltky9kZavvn 0d6FNb53xz1JqYHHY1LcyCeO6RVH2ZXADVonmNYPmgmHTwlatHhvXBzF5se0ZcHrF3Y1r219IYq8p gSXMmQCgG5Kkfs6wXhKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJW8H-00Bp7R-Lj; Fri, 27 Aug 2021 07:18:33 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJW8B-00Bp6F-1i for linux-arm-kernel@lists.infradead.org; Fri, 27 Aug 2021 07:18:30 +0000 Received: by mail-lf1-x134.google.com with SMTP id bq28so12423993lfb.7 for ; Fri, 27 Aug 2021 00:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=S+IaJSyNL4XREuBWuDPEiRbo2KPBBJ5fT6qyNyePHaw=; b=y+G6iIlpHNWO2KVAhN69bnLiEzDWsnLPF0tng6P0p3Jzp1kYmtwEpe0v8ZuGQP7R6N phMOcrdKEy7VCt5iVD5loFIab0ibDThJDNC5WiF20xXZN2lF6j/g4/Ws/S2lQLK1Q2VT wlWcYJej1ERzvjW12sX2oEjyZ6chuW35AMXy9rUZOVGoRiQl7jZFPKSA1GDcWKH32haM taWCNJnx1tc+204U7v0aLlPZ1A/nU7bEwFD1SnjsAKp9FhCwh4ESgBTIjZQLRFRgmhY+ TB2VtWiyVL/gWYUqx2ZCeQdsVk8UpkICZ+ebdvHlr9Sr9kjZe2K7h6yCLelKLP+OV6Ge baLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=S+IaJSyNL4XREuBWuDPEiRbo2KPBBJ5fT6qyNyePHaw=; b=VLsGUadn4pngA/f05tMhlTaGdiV27O++VGgh2U6phWTZK1D+KbPI4mdCxC/o2dlxWz ff5UJZsnjdwCtolbm+/MqMSs+U1Latz5JZ246d9UVH7DddmUPm/Aag4W3mP61BjPTzTI nefO9y2nsN8wMpI65G04oXWvRgvVPm2rX/V+/QeAgCMnfl0Ydp5U+BK4ArZLcy/qRUbf ojH2TRxGkOqYaCnXyUUbt7p8wCdRzpepG49yvgmp6iqC6M/d2XEXeHLsIEDzHUkRXXaz dj4shAkPmVSSXq8uqvV9NDIHXpwz2eEL9344F3E2A+ktueokOg5f3HgdKS8gtNCVDKpL RgLQ== X-Gm-Message-State: AOAM532QSDEjV1TzH5i3W9cAiQhZbgdjzYCsRLYn7Bo005obTzTcjX5Y nEiWTZGNUSTOq9Zy6qN65tnxUoMdS86ZFg== X-Google-Smtp-Source: ABdhPJznjOCdiL0auSRnxZt0ZMAfi6ahqS92zMenjcjhZt+Q5aOpZtlUL2Oi4LINid49S57KHQYWdw== X-Received: by 2002:ac2:50c6:: with SMTP id h6mr5535335lfm.343.1630048704725; Fri, 27 Aug 2021 00:18:24 -0700 (PDT) Received: from jade (81-236-179-152-no272.tbcn.telia.com. [81.236.179.152]) by smtp.gmail.com with ESMTPSA id a23sm588234ljb.95.2021.08.27.00.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 00:18:24 -0700 (PDT) Date: Fri, 27 Aug 2021 09:18:22 +0200 From: Jens Wiklander To: Sumit Garg Cc: Linux Kernel Mailing List , linux-arm-kernel , OP-TEE TrustedFirmware , Sudeep Holla , Marc Bonnici , Jerome Forissier , Sughosh Ganu Subject: Re: [PATCH v4 4/5] optee: isolate smc abi Message-ID: <20210827071822.GA1748471@jade> References: <20210819110655.739318-1-jens.wiklander@linaro.org> <20210819110655.739318-5-jens.wiklander@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210827_001827_171692_C5929325 X-CRM114-Status: GOOD ( 34.60 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 25, 2021 at 05:11:00PM +0530, Sumit Garg wrote: > On Thu, 19 Aug 2021 at 16:37, Jens Wiklander wrote: > > > > Isolate the ABI based on raw SMCs. Code specific to the raw SMC ABI is > > moved into smc_abi.c. This makes room for other ABIs with a clear > > separation. > > > > The driver changes to use module_init()/module_exit() instead of > > module_platform_driver(). The platform_driver_register() and > > platform_driver_unregister() functions called directly to keep the same > > behavior. This is needed because module_platform_driver() is based on > > module_driver() which can only be used once in a module. > > > > A function optee_rpc_cmd() is factored out from the function > > handle_rpc_func_cmd() to handle the ABI independent part of RPC > > processing. > > > > This patch is not supposed to change the driver behavior, it's only a > > matter of reorganizing the code. > > > > Signed-off-by: Jens Wiklander > > --- > > drivers/tee/optee/Makefile | 6 +- > > drivers/tee/optee/call.c | 339 +------- > > drivers/tee/optee/core.c | 688 +-------------- > > drivers/tee/optee/optee_private.h | 103 ++- > > drivers/tee/optee/rpc.c | 217 +---- > > drivers/tee/optee/shm_pool.c | 89 -- > > drivers/tee/optee/shm_pool.h | 14 - > > drivers/tee/optee/smc_abi.c | 1299 +++++++++++++++++++++++++++++ > > 8 files changed, 1439 insertions(+), 1316 deletions(-) > > delete mode 100644 drivers/tee/optee/shm_pool.c > > delete mode 100644 drivers/tee/optee/shm_pool.h > > create mode 100644 drivers/tee/optee/smc_abi.c > > > > Apart from minor comments below including one related to rebase, this > looks good to me. So feel free to add: > > Reviewed-by: Sumit Garg > > > diff --git a/drivers/tee/optee/Makefile b/drivers/tee/optee/Makefile > > index 3aa33ea9e6a6..e92f77462f40 100644 > > --- a/drivers/tee/optee/Makefile > > +++ b/drivers/tee/optee/Makefile > > @@ -4,8 +4,10 @@ optee-objs += core.o > > optee-objs += call.o > > optee-objs += rpc.o > > optee-objs += supp.o > > -optee-objs += shm_pool.o > > optee-objs += device.o > > > > +optee-smc-abi-y = smc_abi.o > > +optee-objs += $(optee-ffa-abi-y) > > Did you mean optee-smc-abi-y here? Yes, I'll fix, thanks. [snip] > > index d767eebf30bd..000000000000 > > --- a/drivers/tee/optee/shm_pool.c > > +++ /dev/null > > @@ -1,89 +0,0 @@ > > -// SPDX-License-Identifier: GPL-2.0-only > > -/* > > - * Copyright (c) 2015, Linaro Limited > > - * Copyright (c) 2017, EPAM Systems > > - */ > > -#include > > -#include > > -#include > > -#include > > -#include > > -#include "optee_private.h" > > -#include "optee_smc.h" > > -#include "shm_pool.h" > > - > > -static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, > > - struct tee_shm *shm, size_t size) > > -{ > > - unsigned int order = get_order(size); > > - struct page *page; > > - int rc = 0; > > - > > - page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); > > - if (!page) > > - return -ENOMEM; > > - > > - shm->kaddr = page_address(page); > > - shm->paddr = page_to_phys(page); > > - shm->size = PAGE_SIZE << order; > > - > > - if (shm->flags & TEE_SHM_DMA_BUF) { > > I guess this series needs to be rebased on top of mainline, since now > we have TEE_SHM_PRIV flag here [1]? > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/tee/optee/shm_pool.c Right, I'll take care of that in the next patchset. [snip] > > --- /dev/null > > +++ b/drivers/tee/optee/smc_abi.c > > @@ -0,0 +1,1299 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +/* > > + * Copyright (c) 2015-2021, Linaro Limited > > + * Copyright (c) 2016, EPAM Systems > > + */ > > + > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include "optee_private.h" > > +#include "optee_smc.h" > > +#include "optee_rpc_cmd.h" > > +#define CREATE_TRACE_POINTS > > +#include "optee_trace.h" > > + > > +/* > > + * This file implement the SMC ABI used when communicating with secure world > > + * OP-TEE OS via raw SMCs. > > + * This file is divided into the follow sections: > > s/follow/following/ I'll fix. Thanks, Jens _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel