From patchwork Fri Oct 13 19:32:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 10005767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 94499602B3 for ; Fri, 13 Oct 2017 19:35:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 870582911F for ; Fri, 13 Oct 2017 19:35:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B8F529144; Fri, 13 Oct 2017 19:35:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 079642911F for ; Fri, 13 Oct 2017 19:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=E0ZNnezNAqJRfjlR58J9HS8D6L35AROR66UpUsnKd7Q=; b=DSZzVjCeLxU1i6 TzXC7EpHQ5JzgcLA0PiYURXj5umZw+nqTMHs8q+mrSpxEe3pZBWPKDbnuWuDelacMt5v5p2eiqWlf h2X1Z9avTqANRVPI3iRBfgwnfnRKxZWnoVQJrH+rnm+Jbk++WOjDPF5att0GLUmlARJZjwvzM1Y3H nrH103MZQe7glyH7zaNs05PK1PSCcOneMB0BdHvGe0g9K4ObeZyYmmOh3gxWzoGCv8Lq+r6zMbZgQ yTcOI5Io/BogPsnfE7FcCA6oOwxLwdRE1sBAJfyO9ReAH9nYEtWD+1jnPF+3x5KGRvQQN9cm9yM3w g8DBBJxMjndmimxbPT2Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e35k1-0000w6-57; Fri, 13 Oct 2017 19:35:29 +0000 Received: from mail-eopbgr00078.outbound.protection.outlook.com ([40.107.0.78] helo=EUR02-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e35iS-0006rk-IM for linux-arm-kernel@lists.infradead.org; Fri, 13 Oct 2017 19:34:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=EPAM.onmicrosoft.com; s=selector1-epam-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qmZpci2sqpvgwVHtKRSZlCSfaHTlmhSb4p363wyEGQ8=; b=eiOu2Zdsu1BONhMKZM1NMdOoAsmBePTDd4hykEkmc7MRnkqfmOgTVF2lvPfjuPCQP5NKFH4DEindkrttQmy+FQE8jjhy2RkPzccC0WXzb/gjG3cA8WErFRIyx9ZQUduxR6xFcdpLV625cc7WENdQytRjXQSs2j2cTXTQjFNfjhU= Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.52) by DB6PR0301MB2133.eurprd03.prod.outlook.com (2603:10a6:4:46::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 13 Oct 2017 19:33:28 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Fri, 13 Oct 2017 22:33:23 +0300 From: Volodymyr Babchuk To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tee-dev@lists.linaro.org, Jens Wiklander Subject: [PATCH v1 04/14] tee: shm: add page accessor functions Date: Fri, 13 Oct 2017 22:32:34 +0300 Message-Id: <1507923164-12796-5-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507923164-12796-1-git-send-email-volodymyr_babchuk@epam.com> References: <1506621851-6929-1-git-send-email-volodymyr_babchuk@epam.com> <1507923164-12796-1-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.52] X-ClientProxiedBy: DB3PR0202CA0012.eurprd02.prod.outlook.com (2603:10a6:8:1::25) To DB6PR0301MB2133.eurprd03.prod.outlook.com (2603:10a6:4:46::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 395d52f8-4a30-4143-45d9-08d5127147b7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DB6PR0301MB2133; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0301MB2133; 3:Nx1yq4tKTKOkCfDwoqNOtPFy7JuXSOM9BkQRZXkZE/Fx2pifPdWSRR6zBPlWOoWQ0FnJICoB8MhdYLeq/yuBxgm5bnaO4dqCdNk0UC7S3b82AvCsapKO0xtAsXbnWmF3MJLF4+NYvS1Y5rr/f2bIf0Hfx/zyKFjo6BZg41I6AFjJj6qJCSnhL+5kVvV0EcrGMZirs/v6TdsgNB86RtcGh77r4CETez1sDjXTg2sIS2sJWzRALPHt216e70XX1AXw; 25:vX9GSID3SuhsFE3IaLJTQxy4UDDWjxR3wz3nPgbZRppR4h9zVusy+3oV4+o/AUFwSjIQw51DX0Wn8ZV/dTGMIn9Vsx8oX6xwwb+Ba8tFJ1WRxPzbmPMdUQM7gDurmrTSZSrNLqobvkJHkfIZF0HEP8oItrhsrzd+ZQqzneRHlUensGW+9rObhDGSubGHiZskeQHybBmfGAsbqOW1vkwNxjY77E9fiOPI6KXo2xFVdGJTU6n4grPfONhRr74xjfxcq82FB66fVnn2nuWkmbsFN1CwwjM1nFJ4KS7eyOMS5vdBKkWlvVOUdT6LGZ58yyGTLK3hO3XRSGRCT3EjRYvKhQ==; 31:wZ8O64izE4C/ZOIcP93VtDMqFvSuB/im4Sp7zxt+6fR45EoWRBVV+Mg2s+QqCdLgyskjavpY4m4qCISSZ0Am63soSHQeZwZsOfKkhN3MRWNA6OnFA5rGCsWwvmJd52W9IJof52cpshh2pb/ysyjC3ePTs2wlkhclflU5rI4WuZxoxuf7E/r6ja8CmRRSLhIUVRyDFlqazj6jqrtPtfDDLd+z/CYfH74wGOPPsL2aIXc= X-MS-TrafficTypeDiagnostic: DB6PR0301MB2133: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Volodymyr_Babchuk@epam.com; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0301MB2133; 20:SQN/aR9EQ70TA93mOx4NLpEXQ4lH8XNHbKx4b0gxHWurQcfLOhk/A4OM3yeBYjmp9Mn5HbeBkm+ECPhlEYcaUC90W4XC/9OAzZVO7cSR2pLJDYfvslKbPcB7smWFkpIfLqsUXVXDZ327/9nE87E3bSjfQRq6i7mi+WkNjCztw4RuvAKluPncpXekrSj4jAmFhWTHpS/cBraR/B6WA/U+pquTJYsh7WTWYPtBNKd6CGn3LSsTpp44fAZEmSUMkbiRvKgkRuL2DSoCHJeOa4MciXIKuAHZy/plkhUrpri25/gjR5XR2uvJf/watYgKWc6p48DHblK68WFylFv/h8Yev/clTo0zoDdb3fRMOQw3MSCdK/7U5xzSaIyCzaxczsjoZYloI2hWSz9pBtp+2NelIOhoUuxF05JgJYR3tQ01seEoses9NGz/FWhS71pfcJXWdY6X9CXx+7FfxzMln+g+Vc/a/IeZQ3oR6CHc1ZkjOsdiGz+8wQ2cOJygcTzASU02; 4:k1gVoG02lZ2MUg+AQMUMT1z9NIsw62Vqk6XySjnJdX0PQVTtTrtEk6R4G6tKARFyySFPOOKYLEjYwQcQHoYts5HpVkpVTfeeWqmJHcyv20byYQHoUv/CIrintJNXKiL/bu2BqCgnKKA9Ah+mqVM1YWilPNP9yVE+l92N/JC9B3m0N1jRcc63/ZwbGm4sH2kAUbPuTSOy38RkETGLyOOjFtrOfF9Bxyy1MEzQ1t56gUcCv1k07SwKybYJnX9o9+sl X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123564025)(20161123555025)(20161123558100)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0301MB2133; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0301MB2133; X-Forefront-PRVS: 04599F3534 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(199003)(189002)(8936002)(305945005)(81166006)(3846002)(7736002)(6116002)(2950100002)(6916009)(33646002)(2906002)(5003940100001)(8676002)(106356001)(105586002)(81156014)(86362001)(189998001)(5660300001)(42186006)(16586007)(316002)(66066001)(6666003)(36756003)(101416001)(72206003)(478600001)(50466002)(50986999)(76176999)(48376002)(47776003)(68736007)(122856001)(50226002)(80792005)(39060400002)(97736004)(107886003)(4326008)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0301MB2133; H:EPUAKYIW2556.kyiv.epam.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: epam.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0301MB2133; 23:8wrQgi3KMuC/imHFn0Pp+drhtEdULFklbtzwZUf?= =?us-ascii?Q?LxjkfPXvZxUHcXN8n+ddkBiLkubeiLHKLyOT1+7sD32Ra5XqtQVOYfUjMQIY?= =?us-ascii?Q?6SSoIbJZdY0C4YFOsqoedAUx9lOcZzfvEz4QLZKvJ++fGQ3BAqZEHpYYxsZX?= =?us-ascii?Q?7YXi5zk8Dz9SDOdo3udmpOtaYtK25EB6yjCunaCmYijpwsxjBzYFqUoe7FEu?= =?us-ascii?Q?IKH1yKXazcgnf4PM182q+/yjmP8Byg6aXbGr+3Y2sJlHENK2qH6MYsk7zqsm?= =?us-ascii?Q?ooX26qKBXuDWURHdC3qA5O0zqZk5c3HgBNDRyDcRoigXISVpL7we+vmrIoB7?= =?us-ascii?Q?41CBLZR7KJCrM0Y/YDvaHsiUoO9M++OZ5N2xPhPv9KNRIcRDrF3zAkn/tqc2?= =?us-ascii?Q?ZS1i1Q+2wCBEZm/rIA5o5nvZ6OqRYUg73hw+Eg4ooMatV5CvUaz6UP6zjudX?= =?us-ascii?Q?FjOHpN+6KVhua2eqXhgVQP2Qf+CJ9vom6IXXHf6Dl/l98TPBQnqyAKbLDtTP?= =?us-ascii?Q?GEATqgK/LixG9hHtm0XvHygDIfK1oeBsv49m4rMUjx0fC+UbUXNDF1Xr4bQV?= =?us-ascii?Q?/QKkuVZqZVE7pStFQuw6bSETN4GSofMHqSjNBpaINosdx1OUDY0gBSuIsKEA?= =?us-ascii?Q?mR5vxnKrKfQde7K7GjKs+RPrJ5c6s79Do3WpSa5l2VkR7b8VYhcu2NorpCmd?= =?us-ascii?Q?fMZ9Kjpx79YFwuIa/SlnAgVet47201EOPTjamAc6IIJMwUs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Pjg8B/O6KugF7zknp2wPwx51dxhxEc=; 7:MKP/2VLxq8FnRVVm5csNDXHrXtPKwFgmaWF1q2/EikFoaD7o4OddEcio2Pvh4Gjokf2A5t0RrjQRM25yBZoiGoCESnekm0Ewo+iDwz30fJZWLzBgrQzdUgOt+i9TvRP3AdDynsO0nwn1w50Cj+jzPzQheRAG1fGWGWvK42dnGAaDuF36+enQtQRAuQJ1v7tS1RXZwSRk9MUFfKs+ofxGh0xAja5GNXFQOPkj5KFrDoQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2017 19:33:28.1434 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0301MB2133 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171013_123353_668811_5A4F1C7B X-CRM114-Status: UNSURE ( 7.94 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Volodymyr Babchuk , volodymyr_babchuk@epam.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Volodymyr Babchuk In order to register a shared buffer in TEE, we need accessor function that return list of pages for that buffer. Signed-off-by: Volodymyr Babchuk --- * Removed check for validity of num_pages pointer. As Yury Norov pointed, this check can lead to mistakes in the future. --- include/linux/tee_drv.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index 0d7f2a5..5489c38 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -394,6 +394,19 @@ static inline size_t tee_shm_get_size(struct tee_shm *shm) } /** + * tee_shm_get_pages() - Get list of pages that hold shared buffer + * @shm: Shared memory handle + * @num_pages: Number of pages will be stored there + * @returns pointer to pages array + */ +static inline struct page **tee_shm_get_pages(struct tee_shm *shm, + size_t *num_pages) +{ + *num_pages = shm->num_pages; + return shm->pages; +} + +/** * tee_shm_get_page_offset() - Get shared buffer offset from page start * @shm: Shared memory handle * @returns page offset of shared buffer