tee_drv.h references struct device, but does not include device.h nor
platform_device.h. Therefore, if tee_drv.h is included by some file
that does not pull device.h nor platform_device.h beforehand, we have a
compile warning. Fix this by adding a forward declaration.
Signed-off-by: Jerome Forissier <jerome.forissier(a)linaro.org>
---
include/linux/tee_drv.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
index 8614713..07bd226 100644
--- a/include/linux/tee_drv.h
+++ b/include/linux/tee_drv.h
@@ -29,6 +29,7 @@
#define TEE_SHM_DMA_BUF BIT(1) /* Memory with dma-buf handle */
#define TEE_SHM_EXT_DMA_BUF BIT(2) /* Memory with dma-buf handle */
+struct device;
struct tee_device;
struct tee_shm;
struct tee_shm_pool;
--
2.7.4
Fixes the static checker warning in optee_release().
error: uninitialized symbol 'parg'.
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
Signed-off-by: Jens Wiklander <jens.wiklander(a)linaro.org>
---
drivers/tee/optee/core.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 58169e519422..857141e29e80 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -224,13 +224,14 @@ static void optee_release(struct tee_context *ctx)
if (!IS_ERR(shm)) {
arg = tee_shm_get_va(shm, 0);
/*
- * If va2pa fails for some reason, we can't call
- * optee_close_session(), only free the memory. Secure OS
- * will leak sessions and finally refuse more sessions, but
- * we will at least let normal world reclaim its memory.
+ * If va2pa fails for some reason, we can't call into
+ * secure world, only free the memory. Secure OS will leak
+ * sessions and finally refuse more sessions, but we will
+ * at least let normal world reclaim its memory.
*/
if (!IS_ERR(arg))
- tee_shm_va2pa(shm, arg, &parg);
+ if (tee_shm_va2pa(shm, arg, &parg))
+ arg = NULL; /* prevent usage of parg below */
}
list_for_each_entry_safe(sess, sess_tmp, &ctxdata->sess_list,
--
2.7.4
Hi,
Trying to port OP-TEE to Atmel SAMA5D2 board (ATSAMA5D2-XULT) - single
core ARM A5. I do not see any serial messages after MMU gets enabled
(bl cpu_mmu_enable), neither does op-tee go onto load linux kernel.
Intended boot flow: at91bootstrap -> u-boot (loads tee.bin/zImage/dtb)
-> op-tee -> kernel
Things I have already verified:
- UART is setup to use MEM_AREA_IO_NSEC and UART data is setup as __early_bss
"static struct atmel_uart_data console_data __early_bss;
register_phys_mem(MEM_AREA_IO_NSEC, CONSOLE_UART_BASE, CORE_MMU_DEVICE_SIZE);"
- UART is setup to use virtual address after MMU is enabled
"static vaddr_t chip_to_base(struct serial_chip *chip) {
struct atmel_uart_data *pd = container_of(chip, struct atmel_uart_data, chip);
return io_pa_or_va(&pd->base); }
static void atmel_uart_putc(struct serial_chip *chip, int ch) {
vaddr_t base = chip_to_base(chip);
while (!(read32(base + ATMEL_UART_SR) & ATMEL_SR_TXRDY)) ;
write32(ch, base + ATMEL_UART_THR); }"
- CFG_WITH_PAGER is not set
- CFG_WITH_LPAE is not set
- CFG_PL310 is not set (both in u-boot and in op-tee)
- u-boot/kernel is setup to not use the DDR memory address range which
op-tee uses (32MB space, 0x3E000000 to 0x40000000)
- Issue seen with both master branch and 2.4.0 tag
- Printing a message immediately after bl cpu_mmu_enable does not show up.
"bl ugly_trace -> prints correctly
bl cpu_mmu_enable
bl ugly_trace -> does not print
void ugly_trace(void);
void ugly_trace(void) { MSG("ugly trace"); }"
Log:
DEBUG: [0x5f5ed35e] TEE-CORE:add_phys_mem:324: CFG_SHMEM_START type
NSEC_SHM 0x3e000000 size 0x00400000
DEBUG: [0x5f5ed35e] TEE-CORE:add_phys_mem:324: CFG_TA_RAM_START type
TA_RAM 0x3e500000 size 0x01b00000
DEBUG: [0x5f5ed35e] TEE-CORE:add_phys_mem:324: CFG_TEE_RAM_START
type TEE_RAM 0x3e400000 size 0x00100000
DEBUG: [0x5f5ed35e] TEE-CORE:add_phys_mem:324: CONSOLE_UART_BASE
type IO_NSEC 0xf8000000 size 0x00200000
DEBUG: [0x5f5ed35e] TEE-CORE:add_va_space:363: type RES_VASPACE size
0x00a00000
DEBUG: [0x5f5ed35e] TEE-CORE:dump_mmap_table:476: type TEE_RAM
va 0x3e400000..0x3e4fffff pa 0x3e400000..0x3e4fffff size 0x00100000
(pgdir)
DEBUG: [0x5f5ed35e] TEE-CORE:dump_mmap_table:476: type TA_RAM
va 0x3e500000..0x3fffffff pa 0x3e500000..0x3fffffff size 0x01b00000
(pgdir)
DEBUG: [0x5f5ed35e] TEE-CORE:dump_mmap_table:476: type NSEC_SHM
va 0x40000000..0x403fffff pa 0x3e000000..0x3e3fffff size 0x00400000
(pgdir)
DEBUG: [0x5f5ed35e] TEE-CORE:dump_mmap_table:476: type IO_NSEC
va 0x40400000..0x405fffff pa 0xf8000000..0xf81fffff size 0x00200000
(pgdir)
DEBUG: [0x5f5ed35e] TEE-CORE:dump_mmap_table:476: type RES_VASPACE
va 0x40600000..0x40ffffff pa 0x00000000..0x009fffff size 0x00a00000
(pgdir)
MESSAGE: [0x5f5ed35e] TEE-CORE:core_init_mmu_regs:822: TTBR0 = 0x3e45404a
MESSAGE: [0x5f5ed35e] TEE-CORE:core_init_mmu_regs:823: TTBR1 = 0x3e45404a
MESSAGE: [0x5f5ed35e] TEE-CORE:ugly_trace:52: ugly trace
Any pointers on what to check next is appreciated.
Thanks,
Akshay
Hi.
I have a Juno R2 board and followed the process described here:
https://github.com/OP-TEE/build/blob/master/README.md
...to build op-tee and all the other related components. I copied
all the relevant bits to my Juno to update the firmware and other images
but things hang here:
[cut]
NOTICE: Booting Trusted Firmware
NOTICE: BL1: v1.2(release):0d6e84b
NOTICE: BL1: Built : 17:32:54, May 3 2017
NOTICE: BL1: Booting BL2
NOTICE: BL2: v1.2(release):0d6e84b
NOTICE: BL2: Built : 17:32:54, May 3 2017
NOTICE: BL1: Booting BL31
NOTICE: BL31: v1.2(release):0d6e84b
NOTICE: BL31: Built : 17:32:54, May 3 2017
So, it appears the bootloader never gets started.
Anyone have ideas as to what I might be missing? ...I'll start further
analysis and debug, but was expecting the canned build process to
produce something that worked out of the box.
Thanks,
Stuart