<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/tee, branch v5.4.122</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.4.122</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.4.122'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2021-05-11T12:04:06Z</updated>
<entry>
<title>tee: optee: do not check memref size on return from Secure World</title>
<updated>2021-05-11T12:04:06Z</updated>
<author>
<name>Jerome Forissier</name>
<email>jerome@forissier.org</email>
</author>
<published>2021-03-22T10:40:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fe53f8fd64d7ef200a189a4430e9cd6bc7f5d537'/>
<id>urn:sha1:fe53f8fd64d7ef200a189a4430e9cd6bc7f5d537</id>
<content type='text'>
[ Upstream commit c650b8dc7a7910eb25af0aac1720f778b29e679d ]

When Secure World returns, it may have changed the size attribute of the
memory references passed as [in/out] parameters. The GlobalPlatform TEE
Internal Core API specification does not restrict the values that this
size can take. In particular, Secure World may increase the value to be
larger than the size of the input buffer to indicate that it needs more.

Therefore, the size check in optee_from_msg_param() is incorrect and
needs to be removed. This fixes a number of failed test cases in the
GlobalPlatform TEE Initial Configuratiom Test Suite v2_0_0_0-2017_06_09
when OP-TEE is compiled without dynamic shared memory support
(CFG_CORE_DYN_SHM=n).

Reviewed-by: Sumit Garg &lt;sumit.garg@linaro.org&gt;
Suggested-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Jerome Forissier &lt;jerome@forissier.org&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>tee: optee: replace might_sleep with cond_resched</title>
<updated>2021-02-03T22:25:58Z</updated>
<author>
<name>Rouven Czerwinski</name>
<email>r.czerwinski@pengutronix.de</email>
</author>
<published>2021-01-05T10:28:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=65543408f25750c0dbf46cd43c5866c7678d776e'/>
<id>urn:sha1:65543408f25750c0dbf46cd43c5866c7678d776e</id>
<content type='text'>
commit dcb3b06d9c34f33a249f65c08805461fb0c4325b upstream.

might_sleep() is a debugging aid and triggers rescheduling only for
certain kernel configurations. Replace with an explicit check and
reschedule to work for all kernel configurations. Fixes the following
trace:

  [  572.945146] rcu: INFO: rcu_sched self-detected stall on CPU
  [  572.949275] rcu:     0-....: (2099 ticks this GP) idle=572/1/0x40000002 softirq=7412/7412 fqs=974
  [  572.957964]  (t=2100 jiffies g=10393 q=21)
  [  572.962054] NMI backtrace for cpu 0
  [  572.965540] CPU: 0 PID: 165 Comm: xtest Not tainted 5.8.7 #1
  [  572.971188] Hardware name: STM32 (Device Tree Support)
  [  572.976354] [&lt;c011163c&gt;] (unwind_backtrace) from [&lt;c010b7f8&gt;] (show_stack+0x10/0x14)
  [  572.984080] [&lt;c010b7f8&gt;] (show_stack) from [&lt;c0511e4c&gt;] (dump_stack+0xc4/0xd8)
  [  572.991300] [&lt;c0511e4c&gt;] (dump_stack) from [&lt;c0519abc&gt;] (nmi_cpu_backtrace+0x90/0xc4)
  [  572.999130] [&lt;c0519abc&gt;] (nmi_cpu_backtrace) from [&lt;c0519bdc&gt;] (nmi_trigger_cpumask_backtrace+0xec/0x130)
  [  573.008706] [&lt;c0519bdc&gt;] (nmi_trigger_cpumask_backtrace) from [&lt;c01a5184&gt;] (rcu_dump_cpu_stacks+0xe8/0x110)
  [  573.018453] [&lt;c01a5184&gt;] (rcu_dump_cpu_stacks) from [&lt;c01a4234&gt;] (rcu_sched_clock_irq+0x7fc/0xa88)
  [  573.027416] [&lt;c01a4234&gt;] (rcu_sched_clock_irq) from [&lt;c01acdd0&gt;] (update_process_times+0x30/0x8c)
  [  573.036291] [&lt;c01acdd0&gt;] (update_process_times) from [&lt;c01bfb90&gt;] (tick_sched_timer+0x4c/0xa8)
  [  573.044905] [&lt;c01bfb90&gt;] (tick_sched_timer) from [&lt;c01adcc8&gt;] (__hrtimer_run_queues+0x174/0x358)
  [  573.053696] [&lt;c01adcc8&gt;] (__hrtimer_run_queues) from [&lt;c01aea2c&gt;] (hrtimer_interrupt+0x118/0x2bc)
  [  573.062573] [&lt;c01aea2c&gt;] (hrtimer_interrupt) from [&lt;c09ad664&gt;] (arch_timer_handler_virt+0x28/0x30)
  [  573.071536] [&lt;c09ad664&gt;] (arch_timer_handler_virt) from [&lt;c0190f50&gt;] (handle_percpu_devid_irq+0x8c/0x240)
  [  573.081109] [&lt;c0190f50&gt;] (handle_percpu_devid_irq) from [&lt;c018ab8c&gt;] (generic_handle_irq+0x34/0x44)
  [  573.090156] [&lt;c018ab8c&gt;] (generic_handle_irq) from [&lt;c018b194&gt;] (__handle_domain_irq+0x5c/0xb0)
  [  573.098857] [&lt;c018b194&gt;] (__handle_domain_irq) from [&lt;c052ac50&gt;] (gic_handle_irq+0x4c/0x90)
  [  573.107209] [&lt;c052ac50&gt;] (gic_handle_irq) from [&lt;c0100b0c&gt;] (__irq_svc+0x6c/0x90)
  [  573.114682] Exception stack(0xd90dfcf8 to 0xd90dfd40)
  [  573.119732] fce0:                                                       ffff0004 00000000
  [  573.127917] fd00: 00000000 00000000 00000000 00000000 00000000 00000000 d93493cc ffff0000
  [  573.136098] fd20: d2bc39c0 be926998 d90dfd58 d90dfd48 c09f3384 c01151f0 400d0013 ffffffff
  [  573.144281] [&lt;c0100b0c&gt;] (__irq_svc) from [&lt;c01151f0&gt;] (__arm_smccc_smc+0x10/0x20)
  [  573.151854] [&lt;c01151f0&gt;] (__arm_smccc_smc) from [&lt;c09f3384&gt;] (optee_smccc_smc+0x3c/0x44)
  [  573.159948] [&lt;c09f3384&gt;] (optee_smccc_smc) from [&lt;c09f4170&gt;] (optee_do_call_with_arg+0xb8/0x154)
  [  573.168735] [&lt;c09f4170&gt;] (optee_do_call_with_arg) from [&lt;c09f4638&gt;] (optee_invoke_func+0x110/0x190)
  [  573.177786] [&lt;c09f4638&gt;] (optee_invoke_func) from [&lt;c09f1ebc&gt;] (tee_ioctl+0x10b8/0x11c0)
  [  573.185879] [&lt;c09f1ebc&gt;] (tee_ioctl) from [&lt;c029f62c&gt;] (ksys_ioctl+0xe0/0xa4c)
  [  573.193101] [&lt;c029f62c&gt;] (ksys_ioctl) from [&lt;c0100060&gt;] (ret_fast_syscall+0x0/0x54)
  [  573.200750] Exception stack(0xd90dffa8 to 0xd90dfff0)
  [  573.205803] ffa0:                   be926bf4 be926a78 00000003 8010a403 be926908 004e3cf8
  [  573.213987] ffc0: be926bf4 be926a78 00000000 00000036 be926908 be926918 be9269b0 bffdf0f8
  [  573.222162] ffe0: b6d76fb0 be9268fc b6d66621 b6c7e0d8

seen on STM32 DK2 with CONFIG_PREEMPT_NONE.

Fixes: 9f02b8f61f29 ("tee: optee: add might_sleep for RPC requests")
Signed-off-by: Rouven Czerwinski &lt;r.czerwinski@pengutronix.de&gt;
Tested-by: Sumit Garg &lt;sumit.garg@linaro.org&gt;
[jw: added fixes tag + small adjustments in the code]
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>optee: add writeback to valid memory type</title>
<updated>2020-12-02T07:49:53Z</updated>
<author>
<name>Rui Miguel Silva</name>
<email>rui.silva@linaro.org</email>
</author>
<published>2020-11-13T15:06:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5c4c6b2be717f1bcec6f6b0373f93761a76375ba'/>
<id>urn:sha1:5c4c6b2be717f1bcec6f6b0373f93761a76375ba</id>
<content type='text'>
[ Upstream commit 853735e404244f5496cdb6188c5ed9a0f9627ee6 ]

Only in smp systems the cache policy is setup as write alloc, in
single cpu systems the cache policy is set as writeback and it is
normal memory, so, it should pass the is_normal_memory check in the
share memory registration.

Add the right condition to make it work in no smp systems.

Fixes: cdbcf83d29c1 ("tee: optee: check type of registered shared memory")
Signed-off-by: Rui Miguel Silva &lt;rui.silva@linaro.org&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>tee: optee: Fix compilation issue with nommu</title>
<updated>2020-02-05T21:22:49Z</updated>
<author>
<name>Vincenzo Frascino</name>
<email>vincenzo.frascino@arm.com</email>
</author>
<published>2020-01-10T12:28:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=281f32e343826e871a4cb795020335da263b22fc'/>
<id>urn:sha1:281f32e343826e871a4cb795020335da263b22fc</id>
<content type='text'>
[ Upstream commit 9e0caab8e0f96f0af7d1dd388e62f44184a75372 ]

The optee driver uses specific page table types to verify if a memory
region is normal. These types are not defined in nommu systems. Trying
to compile the driver in these systems results in a build error:

  linux/drivers/tee/optee/call.c: In function ‘is_normal_memory’:
  linux/drivers/tee/optee/call.c:533:26: error: ‘L_PTE_MT_MASK’ undeclared
     (first use in this function); did you mean ‘PREEMPT_MASK’?
     return (pgprot_val(p) &amp; L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC;
                             ^~~~~~~~~~~~~
                             PREEMPT_MASK
  linux/drivers/tee/optee/call.c:533:26: note: each undeclared identifier is
     reported only once for each function it appears in
  linux/drivers/tee/optee/call.c:533:44: error: ‘L_PTE_MT_WRITEALLOC’ undeclared
     (first use in this function)
     return (pgprot_val(p) &amp; L_PTE_MT_MASK) == L_PTE_MT_WRITEALLOC;
                                            ^~~~~~~~~~~~~~~~~~~

Make the optee driver depend on MMU to fix the compilation issue.

Signed-off-by: Vincenzo Frascino &lt;vincenzo.frascino@arm.com&gt;
[jw: update commit title]
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>optee: Fix multi page dynamic shm pool alloc</title>
<updated>2020-01-26T09:01:09Z</updated>
<author>
<name>Sumit Garg</name>
<email>sumit.garg@linaro.org</email>
</author>
<published>2019-12-30T13:22:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=15763f047ea2785a253d53edc91892ed7acb304f'/>
<id>urn:sha1:15763f047ea2785a253d53edc91892ed7acb304f</id>
<content type='text'>
[ Upstream commit 5a769f6ff439cedc547395a6dc78faa26108f741 ]

optee_shm_register() expected pages to be passed as an array of page
pointers rather than as an array of contiguous pages. So fix that via
correctly passing pages as per expectation.

Fixes: a249dd200d03 ("tee: optee: Fix dynamic shm pool allocations")
Reported-by: Vincent Cao &lt;vincent.t.cao@intel.com&gt;
Signed-off-by: Sumit Garg &lt;sumit.garg@linaro.org&gt;
Tested-by: Vincent Cao &lt;vincent.t.cao@intel.com&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>tee: optee: fix device enumeration error handling</title>
<updated>2020-01-26T09:01:07Z</updated>
<author>
<name>Jens Wiklander</name>
<email>jens.wiklander@linaro.org</email>
</author>
<published>2019-11-06T15:48:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b30a9b012a4e9b400a3e3caa0e4c83d77089ef7b'/>
<id>urn:sha1:b30a9b012a4e9b400a3e3caa0e4c83d77089ef7b</id>
<content type='text'>
[ Upstream commit 03212e347f9443e524d6383c6806ac08295c1fb0 ]

Prior to this patch in optee_probe() when optee_enumerate_devices() was
called the struct optee was fully initialized. If
optee_enumerate_devices() returns an error optee_probe() is supposed to
clean up and free the struct optee completely, but will at this late
stage need to call optee_remove() instead. This isn't done and thus
freeing the struct optee prematurely.

With this patch the call to optee_enumerate_devices() is done after
optee_probe() has returned successfully and in case
optee_enumerate_devices() fails everything is cleaned up with a call to
optee_remove().

Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
Reviewed-by: Sumit Garg &lt;sumit.garg@linaro.org&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>tee: optee: Fix dynamic shm pool allocations</title>
<updated>2020-01-26T09:01:07Z</updated>
<author>
<name>Sumit Garg</name>
<email>sumit.garg@linaro.org</email>
</author>
<published>2019-11-08T11:27:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5c179c003b45909df8bf55c072df897bcb2ef0e0'/>
<id>urn:sha1:5c179c003b45909df8bf55c072df897bcb2ef0e0</id>
<content type='text'>
[ Upstream commit a249dd200d03791cab23e47571f3e13d9c72af6c ]

In case of dynamic shared memory pool, kernel memory allocated using
dmabuf_mgr pool needs to be registered with OP-TEE prior to its usage
during optee_open_session() or optee_invoke_func().

So fix dmabuf_mgr pool allocations via an additional call to
optee_shm_register().

Also, allow kernel pages to be registered as shared memory with OP-TEE.

Fixes: 9733b072a12a ("optee: allow to work without static shared memory")
Signed-off-by: Sumit Garg &lt;sumit.garg@linaro.org&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>tee/shm: untag user pointers in tee_shm_register</title>
<updated>2019-09-26T00:51:41Z</updated>
<author>
<name>Andrey Konovalov</name>
<email>andreyknvl@google.com</email>
</author>
<published>2019-09-25T23:48:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=78063a9dd9637c0450cf6eacc03f42eb1295917f'/>
<id>urn:sha1:78063a9dd9637c0450cf6eacc03f42eb1295917f</id>
<content type='text'>
This patch is a part of a series that extends kernel ABI to allow to pass
tagged user pointers (with the top byte set to something else other than
0x00) as syscall arguments.

tee_shm_register()-&gt;optee_shm_unregister()-&gt;check_mem_type() uses provided
user pointers for vma lookups (via __check_mem_type()), which can only by
done with untagged pointers.

Untag user pointers in this function.

Link: http://lkml.kernel.org/r/4b993f33196b3566ac81285ff8453219e2079b45.1563904656.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Cc: Dave Hansen &lt;dave.hansen@intel.com&gt;
Cc: Eric Auger &lt;eric.auger@redhat.com&gt;
Cc: Felix Kuehling &lt;Felix.Kuehling@amd.com&gt;
Cc: Khalid Aziz &lt;khalid.aziz@oracle.com&gt;
Cc: Mauro Carvalho Chehab &lt;mchehab+samsung@kernel.org&gt;
Cc: Mike Rapoport &lt;rppt@linux.ibm.com&gt;
Cc: Vincenzo Frascino &lt;vincenzo.frascino@arm.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>tee: optee: add might_sleep for RPC requests</title>
<updated>2019-07-08T20:38:56Z</updated>
<author>
<name>Rouven Czerwinski</name>
<email>r.czerwinski@pengutronix.de</email>
</author>
<published>2019-07-03T10:03:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9f02b8f61f29f4518581770d57bfffe99b1ea599'/>
<id>urn:sha1:9f02b8f61f29f4518581770d57bfffe99b1ea599</id>
<content type='text'>
If the kernel is compiled with CONFIG_PREEMPT_VOLUNTARY and OP-TEE is
executing a long running workload, the following errors are raised:

[ 1705.971228] rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
[ 1705.977195] rcu:     (detected by 0, t=2102 jiffies, g=51977, q=3)
[ 1705.983152] rcu: All QSes seen, last rcu_sched kthread activity 2102 (140596-138494), jiffies_till_next_fqs=1, root -&gt;qsmask 0x0
[ 1705.994729] optee-xtest     R  running task        0   169    157 0x00000002

While OP-TEE is returning regularly to the kernel due to timer
interrupts, the OPTEE_SMC_FUNC_FOREIGN_INTR case does not contain an
explicit rescheduling point. Add a might_sleep() to the RPC request case
to ensure that the kernel can reschedule another task if OP-TEE requests
RPC handling.

Signed-off-by: Rouven Czerwinski &lt;r.czerwinski@pengutronix.de&gt;
Signed-off-by: Jens Wiklander &lt;jens.wiklander@linaro.org&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282</title>
<updated>2019-06-05T15:36:37Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2019-05-29T14:17:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9c92ab61914157664a2fbdf926df0eb937838e45'/>
<id>urn:sha1:9c92ab61914157664a2fbdf926df0eb937838e45</id>
<content type='text'>
Based on 1 normalized pattern(s):

  this software is licensed under the terms of the gnu general public
  license version 2 as published by the free software foundation and
  may be copied distributed and modified under those terms this
  program is distributed in the hope that it will be useful but
  without any warranty without even the implied warranty of
  merchantability or fitness for a particular purpose see the gnu
  general public license for more details

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 285 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Alexios Zavras &lt;alexios.zavras@intel.com&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.642774971@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
