From patchwork Thu Sep 28 18:04:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 9976633 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 26A176034B for ; Thu, 28 Sep 2017 18:07:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AF6E296D2 for ; Thu, 28 Sep 2017 18:07:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FBD3296D9; Thu, 28 Sep 2017 18:07:43 +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 0378F296D2 for ; Thu, 28 Sep 2017 18:07:42 +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=O2ESFRhxnCJZXUv4SkgplE0ANWxO7Fi2oHaewVEdq4A=; b=uuVxtYFHuUYpvx vC10qLuyduvps5KQB+dA5oflqV0tck1mqsxvu3MOBCrGZfurTYCcHmZMsxllcKQjaudPaKGZppero nsLUWD2pNIYwNn0Sb7VsEKFqC2c5ZWV3gvseRlbNGh3l3EiagNbDq3SAmXpa1DTCNbl9imSsEf2KC lh93Upww/ZkuJBqIt77/0r7T8npEFcIRTZo7EtCjw+4Ps0A/lEtOUSsX8EAbbjZ2Ow2pLLZjeq5Fl BQhf8z/3I3JvMI5C/IcJEdZr+ulLbPJV9yfTqiioTW8rsTZ/G/HEZFOpTyLM3zSg7IWi8PD+983KR eZGXV5lafF+KdOcSo8AA==; 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 1dxdDi-0006mK-EY; Thu, 28 Sep 2017 18:07:34 +0000 Received: from mail-eopbgr30070.outbound.protection.outlook.com ([40.107.3.70] helo=EUR03-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dxdBc-0003Xk-Cv for linux-arm-kernel@lists.infradead.org; Thu, 28 Sep 2017 18:05:29 +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=zDnHUt2BQEDlsuzacWYGMXhKcMjir/zqZus6wWCzox4=; b=C7wtrI12tShtPFtqIKuWbMLyejvREvU0tHJZGA1cBcsN1TIphC13FSqFxgK2Ilv7iI42mE9+HFtxfry+8aiqYdLi6lR4AAsqt9xA6jYPMJyMufwVtNMnPl/YwXBqixAkVODeiS3WQE4bb3oDaKPEiRrYkrXQZMB9r+NiQNuhRmE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Volodymyr_Babchuk@epam.com; Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.59) by AM4PR0301MB2129.eurprd03.prod.outlook.com (2603:10a6:200:4d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 28 Sep 2017 18:05:00 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Thu, 28 Sep 2017 21:04:55 +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: Thu, 28 Sep 2017 21:04:01 +0300 Message-Id: <1506621851-6929-5-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506621851-6929-1-git-send-email-volodymyr_babchuk@epam.com> References: <1506621851-6929-1-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.59] X-ClientProxiedBy: HE1PR0102CA0046.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::23) To AM4PR0301MB2129.eurprd03.prod.outlook.com (2603:10a6:200:4d::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5c1b54d5-7db8-4f9c-c9ca-08d5069b6fdc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:AM4PR0301MB2129; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0301MB2129; 3:Bllc0cpnOY6C7ByBbe7TjNsKdgKrnbVaktIbyCvkszk5wZbPqcvnUfWYlMkuNsjC0i4cBPM3QggJ4mFZR0NR5Cdfn239PSVXzecJxSU8XjL9hh54Jr77NFKven74yV+bkuOBXuAHJD13J/rqv+9EYXkG1oXeXeb0s+hQFdJfrOa5TPOkkNidbwIEkLcJsO3aLDyclhubQo8t+7tNFOsybCy+yCB0e1TLtbgAqgxgKGS5aye8QJx7IQBDeNroDQEG; 25:YEuJyttPFf+HmAHbZjJAunLq3xj+CKPznP2csBq/ms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X52P22Ko4kx1TRr4YBJiKYD6o3gFeubnXk6KgNck6263AHC4HL+u; 4:miIcTurk6sHCsEiEpabNcbCV3QaCU+p/DjWsB+VzdlpJ3Q4MQV75AU+neIZ0O2JQo0mn30m9vuEO4eMkGKvW+0Aqoj6lXoMFOJYQdFgxobohAxrbyCJXIpFc3EXz12Jk3qJeRF4T6DbYNrusmngaEq82jhmeQno58Nz+zOaBa95WJsMjtQIDOfg2mGQAXvVtWe0+QeZczcdzaqfCzf88ttT/2pu/niJdZtINf9u80SrUIYYJLzYZwpv/2mrDYPs3 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)(100000703101)(100105400095)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM4PR0301MB2129; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM4PR0301MB2129; X-Forefront-PRVS: 0444EB1997 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(376002)(346002)(189002)(199003)(81156014)(53936002)(5660300001)(81166006)(97736004)(8676002)(8936002)(7736002)(4326008)(305945005)(72206003)(316002)(50986999)(76176999)(42186006)(80792005)(86362001)(16586007)(50466002)(101416001)(48376002)(2906002)(66066001)(478600001)(50226002)(2950100002)(6666003)(6916009)(36756003)(68736007)(6116002)(122856001)(47776003)(189998001)(106356001)(3846002)(105586002)(33646002)(39060400002)(5003940100001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0301MB2129; H:EPUAKYIW2556.kyiv.epam.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; AM4PR0301MB2129; 23:hZ2/em0N7ZYKbiwvyk8TYaYue0PFf6n6JIC8aJn?= =?us-ascii?Q?SBeA6uDdmwmzYgIAIIU2rqNfEe2B7Os9ebDhfmNusKiogBu3PzK1nWNQ7SAz?= =?us-ascii?Q?lPwjw0c7QaLS4DAkxNiD0ao+9udJpUhN6rBhFTWktO0HxT8Q5nacFdXsiZdS?= =?us-ascii?Q?SPLvKEa+wa58i7cqizbeadWoPB0fZ7BdRoaQ2BHYeB0pWFicU4wLQEpYQuXM?= =?us-ascii?Q?L60+IC1kKTCUo3x5B3xZ+8tGROJ7M/jlAVoxiO7BR+8LkZHUam25v+IK/mMK?= =?us-ascii?Q?Q5D3pmQPbEZVaAS4OPlP9TnDKSdk4AGzAG/tz3IU1ss8XO0YQ198G19NnM4n?= =?us-ascii?Q?oCvSrenA4Ch7879vicMys5u6fkC+9QxHV5H1m61PElRYWQjxa6Ch4gzGKPWI?= =?us-ascii?Q?8K2JXQjuYjjynxCpy+g0Q7edG2tR2TqUD0WNtc9r2y1IfvN8a4h+0xz81ilD?= =?us-ascii?Q?DwxWbAvfysIrn88726IX+23DiW+R9Qjww+tjlr8Dmte83tCSh+QeUVTSNEcu?= =?us-ascii?Q?8AotwFfPRTc4b2cM8aMpF9WLP5+h2w+S4JnZy0kLnxQO9i9M//jaYdTh1JfD?= =?us-ascii?Q?YdOK1qVmd1/+7n6hJVhwoql7NoG3DS86Q56K/CQsOnOBGwUvMXji6FaBh0oT?= =?us-ascii?Q?AvEH9s5Ku4a7YizbXnesZtqyqQyj4JJ51tnQHF+9mAdYIIkdBcj50a3vABTB?= =?us-ascii?Q?F0lHrD6gflOMS7j9kBRC/X19e/lR+4b7kgB/72H4nFjkud+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SBmFb7gQYgN8+RlDHZRu9xS57ygcHaRdYNOQ==; 24:G2lh6jYJoo9H9YvAD9q974cB6kw8/GTPmRVKjPELGYwNa+CbsbbJm7gWB7T0tGcEpltVKBKwrsF+P1waKDDgPDabAEcfslZUHWWvNq1I4kw=; 7:ovEMRCB6rrrxNZQltTDmMBNJQeLb/bk4jJho0QDqQz2XsALhkewLRolpfmvxUsW/pkwDj6SILVd1ora/5kNMOIVTef4NbLab4tmdVUbbfLGla22Xj9+inRoCleZhecAc0Tskq6Yzs8maKbfuw3OiNOg2Nmdzq49MIiOmSX/gp2H8312YeFSy+btj1fonwSUBfqixd0m/QMQ8rI59HomTUWtGHQARiXyti8XfPvKHblU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2017 18:05:00.2512 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0301MB2129 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170928_110525_153967_B7ACFE41 X-CRM114-Status: UNSURE ( 8.53 ) 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 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 --- include/linux/tee_drv.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index 6ba8b76..d773827 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -394,6 +394,20 @@ 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) +{ + if (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