summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKirill Artamonov <kartamonov@nvidia.com>2021-06-15 10:13:46 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2021-06-21 04:55:13 -0400
commitb3060acfe7d3777892c02f69832f356f52d0dbbc (patch)
tree54a899628acd43356e3f04934bfc631c61eb2f64 /include
parenta3e0092daa86331377677f31cac622c04e7a184d (diff)
capture-isp: use separate ringbuffer to pass iovas to rtcpu
Passing iova pointers using capture descriptor is not safe since usermode application can access them. Use additional ringbuffers shared between kernel and rtcpu to pass iova pointers securely. Related changes and bugfixes: Use permanent vmap mapping for ISP capture and program descriptors This should also improve performance and reduce fragmentation of kernel address space. Don't use relocs. Access descriptor like normal C structure. Remove unused reloc API. Fix map error reporting capture_common_pin_and_get_iova(). Allocate fixed size unpin buffer at setup time istead of relying on kzalloc/kfree during each request. This is to simplify critical runtime codepath and remove flexible array struct member which is prohibited by MISRA C conventions. Add unpin check to prevent submission of requests which are still in progress bug 2768992 bug 3231670 bug 200688288 bug 200690078 CAMASIL-7472 CAMASIL-7474 Signed-off-by: Kirill Artamonov <kartamonov@nvidia.com> Change-Id: Ie2c556cc61334ae478c7edc7e062e16e8b142031 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2487425 (cherry picked from commit 23186dfdd7b090e6b93c3a6daed60860225b9663) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545380 Reviewed-by: Semi Malinen <smalinen@nvidia.com> Reviewed-by: Pekka Pessi <ppessi@nvidia.com> Reviewed-by: Mika Liljeberg <mliljeberg@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'include')
-rw-r--r--include/media/capture_common.h30
1 files changed, 8 insertions, 22 deletions
diff --git a/include/media/capture_common.h b/include/media/capture_common.h
index ccee4df06..7042ba5fa 100644
--- a/include/media/capture_common.h
+++ b/include/media/capture_common.h
@@ -1,13 +1,14 @@
1/* 1/*
2 * Tegra capture common operations 2 * Copyright (c) 2017-2021 NVIDIA Corporation. All rights reserved.
3 * 3 *
4 * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
5 * 7 *
6 * Author: Sudhir Vyas <svyas@nvidia.com> 8 * This program is distributed in the hope it will be useful, but WITHOUT
7 * 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8 * This program is free software; you can redistribute it and/or modify 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
9 * it under the terms of the GNU General Public License version 2 as 11 * more details.
10 * published by the Free Software Foundation.
11 */ 12 */
12 13
13#include <media/mc_common.h> 14#include <media/mc_common.h>
@@ -63,19 +64,6 @@ struct capture_common_unpins {
63 struct capture_mapping *data[MAX_PIN_BUFFER_PER_REQUEST]; /**< Surface buffers to unpin */ 64 struct capture_mapping *data[MAX_PIN_BUFFER_PER_REQUEST]; /**< Surface buffers to unpin */
64}; 65};
65 66
66struct capture_common_pin_req {
67 struct device *dev;
68 struct device *rtcpu_dev;
69 struct capture_buffer_table *table;
70 struct capture_common_unpins *unpins;
71 struct capture_common_buf *requests;
72 uint32_t request_size;
73 uint32_t request_offset;
74 struct dma_buf *requests_mem;
75 uint32_t num_relocs;
76 uint32_t __user *reloc_user;
77};
78
79struct capture_common_status_notifier { 67struct capture_common_status_notifier {
80 struct dma_buf *buf; 68 struct dma_buf *buf;
81 void *va; 69 void *va;
@@ -101,8 +89,6 @@ int capture_common_pin_memory(struct device *dev,
101 89
102void capture_common_unpin_memory(struct capture_common_buf *unpin_data); 90void capture_common_unpin_memory(struct capture_common_buf *unpin_data);
103 91
104int capture_common_request_pin_and_reloc(struct capture_common_pin_req *req);
105
106/** 92/**
107 * @brief Pins (maps) the physical address for provided capture surface address 93 * @brief Pins (maps) the physical address for provided capture surface address
108 * and updates the iova pointer. 94 * and updates the iova pointer.