<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nvidia-tegra-modules.git/drivers/media/platform, branch gpu-paging</title>
<subtitle>NVIDIA's kernel modules to support tegra chips (used in Jetson boards)</subtitle>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/'/>
<entry>
<title>media: tegra: camera: vi2: refactor low-latency mode code</title>
<updated>2022-01-07T14:10:42+00:00</updated>
<author>
<name>Ken Chang</name>
<email>kenc@nvidia.com</email>
</author>
<published>2021-12-13T05:04:12+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=643a51e0eb2b3eb2c3cecc6777e20ff040e2483b'/>
<id>643a51e0eb2b3eb2c3cecc6777e20ff040e2483b</id>
<content type='text'>
A frame capture may fail somewhere between the frame start and the frame
end,e.g., the below error prints:

2021-11-04T10:11:31.561+00:00 kernel: [  794.777229] tc358840 1-001f: event: resolution change (EQ_BYPS=1): 3840x2160p29.94 (4400x2250)
2021-11-04T10:11:32.167+00:00 kernel: [  795.379917] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
2021-11-04T10:11:32.167+00:00 kernel: [  795.386292] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
2021-11-04T10:11:32.191+00:00 kernel: [  795.404274] vi 54080000.vi: tegra_channel_error_status:error 20022 frame 0

This means checking SOF in the capture thread doesn't help avoid a failure
in the release thread. Hence we can simplify the capture thread to program only
the capture released settings, skip the checking of SOF and leave the checking
of vi/csi status and the recovery process to be done in the release thread.

Also simplify vi2_channel_stop_streaming() to not invoke tegra_channel_capture_done()
as the buffers shall be well handled in tegra_channel_queued_buf_done() with
VB2_BUF_STATE_ERROR state.

In the original implementation, chan-&gt;syncpt[index][] will be re-allocated for
every single stop_streaming()/start_streaming() pair, so the syncpt IDs may
change. This is causing the problem: the syncpt IDs armed for the previous
failing capture are still queued in the FIFO and will be used for the next
successfull frame capture, however new syncpt IDs are allocated for the new
coming frames, e.g, the below error prints:

2021-11-23T08:12:59.038+00:00 kernel: [  590.029312] tegra_channel_capture_frame_multi_thread[570]: rv 4, cv 3, stm Y
2021-11-23T08:12:59.038+00:00 kernel: [  590.036865] tegra_channel_enable_stream[212] -- begin
2021-11-23T08:12:59.044+00:00 kernel: [  590.042437] tegra_channel_enable_stream[221] -- end
2021-11-23T08:12:59.263+00:00 kernel: [  590.251676] video4linux video0: frame start syncpt timeout!0
2021-11-23T08:12:59.263+00:00 kernel: [  590.257419] tegra_channel_ec_recover[337] -- begin

2021-12-03T11:14:36.763+00:00 kernel: [ 1049.109289] vi2_channel_start_streaming[912] -- begin
2021-12-03T11:14:36.763+00:00 kernel: [ 1049.115121] vi2_channel_start_streaming[949]: syncpt id 24, max 5064, min 5064
2021-12-03T11:14:36.771+00:00 kernel: [ 1049.123116] vi2_channel_start_streaming[949]: syncpt id 28, max 1614, min 1614
--&gt; the syncpt id being used for this streaming are 24/28, these two syncpts are used since the first streaming
...
2021-12-03T11:14:39.244+00:00 kernel: [ 1051.597885] tegra_channel_capture_frame_multi_thread[624] -- end: release_thresh 5101
2021-12-03T11:14:39.303+00:00 kernel: [ 1051.663550] tegra_channel_release_frame[701] -- end: buf-&gt;thresh 5101
2021-12-03T11:14:39.350+00:00 kernel: [ 1051.703617] vi2_channel_stop_streaming[1065] -- end
--&gt; no problem observed, and capture cancelled due to stop_streaming
...
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.871259] vi2_channel_start_streaming[912] -- begin
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.876860] vi2_channel_start_streaming[949]: syncpt id 36, max 0, min 0
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.884187] vi2_channel_start_streaming[949]: syncpt id 38, max 0, min 0
--&gt; the syncpt id being used now are changed to 36/38
...
2021-12-03T11:15:09.534+00:00 kernel: [ 1081.891728] tegra_channel_capture_frame_multi_thread[514] -- begin
2021-12-03T11:15:09.534+00:00 kernel: [ 1081.891771] vi2_channel_start_streaming[992] -- end
2021-12-03T11:15:09.552+00:00 kernel: [ 1081.904384] tegra_channel_capture_frame_multi_thread[569]: rv 119, cv 119, stm N
2021-12-03T11:15:09.606+00:00 kernel: [ 1081.958030] tegra_channel_capture_frame_multi_thread[624] -- end: release_thresh 1
2021-12-03T11:15:09.606+00:00 kernel: [ 1081.958086] tegra_channel_release_frame[669] -- begin
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.162133] video4linux video0: tegra_channel_release_frame: MW_ACK_DONE syncpoint time out!0
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.170683] tegra_channel_release_frame[680]: buf-&gt;thresh[0] 1
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.176972] tegra_channel_release_frame[683]: syncpt 36, hw val 0
2021-12-03T11:15:09.829+00:00 kernel: [ 1082.183715] tegra_channel_ec_recover[337] -- begin

Given Hw doesn't support SYNCPT FIFO reset per stream, reuse the same syncpt IDs
until the channel is powered off.

Also skip invoking tegra_channel_capture_done() from vi2_channel_stop_streaming()
and tegra_channel_release_frame() from tegra_channel_stop_kthreads() as streaming
shall be stoped immediately and the queued buffers shall be well handled in
tegra_channel_queued_buf_done() with the VB2_BUF_STATE_ERROR state.

Bug 3423623

Change-Id: I53280bc9b1b3c33054d766aa920eb082b3311d92
Signed-off-by: Ken Chang &lt;kenc@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2645502
Reviewed-by: Frank Chen &lt;frankc@nvidia.com&gt;
Reviewed-by: Jerry Chang &lt;jerchang@nvidia.com&gt;
Reviewed-by: Anubhav Rai &lt;arai@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A frame capture may fail somewhere between the frame start and the frame
end,e.g., the below error prints:

2021-11-04T10:11:31.561+00:00 kernel: [  794.777229] tc358840 1-001f: event: resolution change (EQ_BYPS=1): 3840x2160p29.94 (4400x2250)
2021-11-04T10:11:32.167+00:00 kernel: [  795.379917] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
2021-11-04T10:11:32.167+00:00 kernel: [  795.386292] video4linux video0: TEGRA_VI_CSI_ERROR_STATUS 0x00000000
2021-11-04T10:11:32.191+00:00 kernel: [  795.404274] vi 54080000.vi: tegra_channel_error_status:error 20022 frame 0

This means checking SOF in the capture thread doesn't help avoid a failure
in the release thread. Hence we can simplify the capture thread to program only
the capture released settings, skip the checking of SOF and leave the checking
of vi/csi status and the recovery process to be done in the release thread.

Also simplify vi2_channel_stop_streaming() to not invoke tegra_channel_capture_done()
as the buffers shall be well handled in tegra_channel_queued_buf_done() with
VB2_BUF_STATE_ERROR state.

In the original implementation, chan-&gt;syncpt[index][] will be re-allocated for
every single stop_streaming()/start_streaming() pair, so the syncpt IDs may
change. This is causing the problem: the syncpt IDs armed for the previous
failing capture are still queued in the FIFO and will be used for the next
successfull frame capture, however new syncpt IDs are allocated for the new
coming frames, e.g, the below error prints:

2021-11-23T08:12:59.038+00:00 kernel: [  590.029312] tegra_channel_capture_frame_multi_thread[570]: rv 4, cv 3, stm Y
2021-11-23T08:12:59.038+00:00 kernel: [  590.036865] tegra_channel_enable_stream[212] -- begin
2021-11-23T08:12:59.044+00:00 kernel: [  590.042437] tegra_channel_enable_stream[221] -- end
2021-11-23T08:12:59.263+00:00 kernel: [  590.251676] video4linux video0: frame start syncpt timeout!0
2021-11-23T08:12:59.263+00:00 kernel: [  590.257419] tegra_channel_ec_recover[337] -- begin

2021-12-03T11:14:36.763+00:00 kernel: [ 1049.109289] vi2_channel_start_streaming[912] -- begin
2021-12-03T11:14:36.763+00:00 kernel: [ 1049.115121] vi2_channel_start_streaming[949]: syncpt id 24, max 5064, min 5064
2021-12-03T11:14:36.771+00:00 kernel: [ 1049.123116] vi2_channel_start_streaming[949]: syncpt id 28, max 1614, min 1614
--&gt; the syncpt id being used for this streaming are 24/28, these two syncpts are used since the first streaming
...
2021-12-03T11:14:39.244+00:00 kernel: [ 1051.597885] tegra_channel_capture_frame_multi_thread[624] -- end: release_thresh 5101
2021-12-03T11:14:39.303+00:00 kernel: [ 1051.663550] tegra_channel_release_frame[701] -- end: buf-&gt;thresh 5101
2021-12-03T11:14:39.350+00:00 kernel: [ 1051.703617] vi2_channel_stop_streaming[1065] -- end
--&gt; no problem observed, and capture cancelled due to stop_streaming
...
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.871259] vi2_channel_start_streaming[912] -- begin
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.876860] vi2_channel_start_streaming[949]: syncpt id 36, max 0, min 0
2021-12-03T11:15:09.524+00:00 kernel: [ 1081.884187] vi2_channel_start_streaming[949]: syncpt id 38, max 0, min 0
--&gt; the syncpt id being used now are changed to 36/38
...
2021-12-03T11:15:09.534+00:00 kernel: [ 1081.891728] tegra_channel_capture_frame_multi_thread[514] -- begin
2021-12-03T11:15:09.534+00:00 kernel: [ 1081.891771] vi2_channel_start_streaming[992] -- end
2021-12-03T11:15:09.552+00:00 kernel: [ 1081.904384] tegra_channel_capture_frame_multi_thread[569]: rv 119, cv 119, stm N
2021-12-03T11:15:09.606+00:00 kernel: [ 1081.958030] tegra_channel_capture_frame_multi_thread[624] -- end: release_thresh 1
2021-12-03T11:15:09.606+00:00 kernel: [ 1081.958086] tegra_channel_release_frame[669] -- begin
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.162133] video4linux video0: tegra_channel_release_frame: MW_ACK_DONE syncpoint time out!0
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.170683] tegra_channel_release_frame[680]: buf-&gt;thresh[0] 1
2021-12-03T11:15:09.817+00:00 kernel: [ 1082.176972] tegra_channel_release_frame[683]: syncpt 36, hw val 0
2021-12-03T11:15:09.829+00:00 kernel: [ 1082.183715] tegra_channel_ec_recover[337] -- begin

Given Hw doesn't support SYNCPT FIFO reset per stream, reuse the same syncpt IDs
until the channel is powered off.

Also skip invoking tegra_channel_capture_done() from vi2_channel_stop_streaming()
and tegra_channel_release_frame() from tegra_channel_stop_kthreads() as streaming
shall be stoped immediately and the queued buffers shall be well handled in
tegra_channel_queued_buf_done() with the VB2_BUF_STATE_ERROR state.

Bug 3423623

Change-Id: I53280bc9b1b3c33054d766aa920eb082b3311d92
Signed-off-by: Ken Chang &lt;kenc@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2645502
Reviewed-by: Frank Chen &lt;frankc@nvidia.com&gt;
Reviewed-by: Jerry Chang &lt;jerchang@nvidia.com&gt;
Reviewed-by: Anubhav Rai &lt;arai@nvidia.com&gt;
Reviewed-by: Bibek Basu &lt;bbasu@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>camera: modify debugfs_name size avoid boot failed</title>
<updated>2021-10-29T12:40:00+00:00</updated>
<author>
<name>snchen</name>
<email>snchen@nvidia.com</email>
</author>
<published>2021-08-06T08:43:15+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=fbce379d66157b2cdd5deb231e130b1c5207fcf7'/>
<id>fbce379d66157b2cdd5deb231e130b1c5207fcf7</id>
<content type='text'>
fixed when the size of debugfs_name in sensor driver
more than 9 cause system can't boot.

bug 200759786

Change-Id: Ic34c7a2118095c82c58a1ef01561cedbacd27b2f
Signed-off-by: Shan Neng Chen &lt;snchen@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2571796
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Anubhav Rai &lt;arai@nvidia.com&gt;
Reviewed-by: Sudhir Vyas &lt;svyas@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fixed when the size of debugfs_name in sensor driver
more than 9 cause system can't boot.

bug 200759786

Change-Id: Ic34c7a2118095c82c58a1ef01561cedbacd27b2f
Signed-off-by: Shan Neng Chen &lt;snchen@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2571796
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Anubhav Rai &lt;arai@nvidia.com&gt;
Reviewed-by: Sudhir Vyas &lt;svyas@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>capture: Added NULL check for buf_ctx</title>
<updated>2021-10-18T12:54:55+00:00</updated>
<author>
<name>Devang Kubavat</name>
<email>dkubavat@nvidia.com</email>
</author>
<published>2021-09-06T09:10:38+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=3477d4b47e8112357a1e21bea291f72ed897763b'/>
<id>3477d4b47e8112357a1e21bea291f72ed897763b</id>
<content type='text'>
Added NULL check for capture-&gt;buf_ctx before using it in
vi_capture_shutdown.

Bug 200769105

Change-Id: Icf38a287054f0d264ed493d919dc06e1bfee8424
Signed-off-by: Devang Kubavat &lt;dkubavat@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2589937
Reviewed-by: svcacv &lt;svcacv@nvidia.com&gt;
Reviewed-by: Jerry Chang &lt;jerchang@nvidia.com&gt;
Reviewed-by: Aditya Tomar &lt;adtomar@nvidia.com&gt;
Reviewed-by: Anubhav Rai &lt;arai@nvidia.com&gt;
Reviewed-by: Frank Chen &lt;frankc@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: Jerry Chang &lt;jerchang@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added NULL check for capture-&gt;buf_ctx before using it in
vi_capture_shutdown.

Bug 200769105

Change-Id: Icf38a287054f0d264ed493d919dc06e1bfee8424
Signed-off-by: Devang Kubavat &lt;dkubavat@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2589937
Reviewed-by: svcacv &lt;svcacv@nvidia.com&gt;
Reviewed-by: Jerry Chang &lt;jerchang@nvidia.com&gt;
Reviewed-by: Aditya Tomar &lt;adtomar@nvidia.com&gt;
Reviewed-by: Anubhav Rai &lt;arai@nvidia.com&gt;
Reviewed-by: Frank Chen &lt;frankc@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: Jerry Chang &lt;jerchang@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>tegra-vi: Fix return value check.</title>
<updated>2021-08-13T20:10:46+00:00</updated>
<author>
<name>Achal Verma</name>
<email>achalv@nvidia.com</email>
</author>
<published>2021-07-29T09:03:12+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=a363ad9c09df7b3f5bd57c217c35f58fb9872738'/>
<id>a363ad9c09df7b3f5bd57c217c35f58fb9872738</id>
<content type='text'>
This fixes coverity issue: 7112979, 7112981

Bug 200741055

Change-Id: Ie9eb8daa31eaed930889008a5fb20b5d87b86463
Signed-off-by: Achal Verma &lt;achalv@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2575311
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Phoenix Jung &lt;pjung@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes coverity issue: 7112979, 7112981

Bug 200741055

Change-Id: Ie9eb8daa31eaed930889008a5fb20b5d87b86463
Signed-off-by: Achal Verma &lt;achalv@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2575311
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Phoenix Jung &lt;pjung@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tegra-camera: Fix potential NULL ptr dereference</title>
<updated>2021-08-12T19:24:50+00:00</updated>
<author>
<name>Achal Verma</name>
<email>achalv@nvidia.com</email>
</author>
<published>2021-08-06T12:59:11+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=866ba8d085b43f2815bb4621576c3cb1a531922c'/>
<id>866ba8d085b43f2815bb4621576c3cb1a531922c</id>
<content type='text'>
This fix coverity issue : 9741833, 9741834

Bug 200741055

Change-Id: I0d6ab11a32fb7f29430adfe28c54a7b2b2a22698
Signed-off-by: Achal Verma &lt;achalv@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2571929
Reviewed-by: svcacv &lt;svcacv@nvidia.com&gt;
Reviewed-by: Dmitry Pervushin &lt;dpervushin@nvidia.com&gt;
Reviewed-by: Amrita Deshmukh &lt;amritad@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
(cherry picked from commit 954e8d421ec24359a64542dd2777267b3d9bdb81)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2574546
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Phoenix Jung &lt;pjung@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fix coverity issue : 9741833, 9741834

Bug 200741055

Change-Id: I0d6ab11a32fb7f29430adfe28c54a7b2b2a22698
Signed-off-by: Achal Verma &lt;achalv@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2571929
Reviewed-by: svcacv &lt;svcacv@nvidia.com&gt;
Reviewed-by: Dmitry Pervushin &lt;dpervushin@nvidia.com&gt;
Reviewed-by: Amrita Deshmukh &lt;amritad@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
(cherry picked from commit 954e8d421ec24359a64542dd2777267b3d9bdb81)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2574546
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Phoenix Jung &lt;pjung@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>capture-isp: use separate ringbuffer to pass iovas to rtcpu</title>
<updated>2021-06-21T08:55:13+00:00</updated>
<author>
<name>Kirill Artamonov</name>
<email>kartamonov@nvidia.com</email>
</author>
<published>2021-06-15T14:13:46+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=b3060acfe7d3777892c02f69832f356f52d0dbbc'/>
<id>b3060acfe7d3777892c02f69832f356f52d0dbbc</id>
<content type='text'>
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 &lt;kartamonov@nvidia.com&gt;
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 &lt;smalinen@nvidia.com&gt;
Reviewed-by: Pekka Pessi &lt;ppessi@nvidia.com&gt;
Reviewed-by: Mika Liljeberg &lt;mliljeberg@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;kartamonov@nvidia.com&gt;
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 &lt;smalinen@nvidia.com&gt;
Reviewed-by: Pekka Pessi &lt;ppessi@nvidia.com&gt;
Reviewed-by: Mika Liljeberg &lt;mliljeberg@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>capture-isp: Fix allocations for unpins_list</title>
<updated>2021-06-21T08:55:08+00:00</updated>
<author>
<name>Kirill Artamonov</name>
<email>kartamonov@nvidia.com</email>
</author>
<published>2021-06-15T13:39:18+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=a3e0092daa86331377677f31cac622c04e7a184d'/>
<id>a3e0092daa86331377677f31cac622c04e7a184d</id>
<content type='text'>
When allocating a memory for a list of pinned buffers, capture-isp wrongly
uses size of a pointer to "unpin" element instead of a size of element
itself. As a result, allocation size is too small to fit all possible
unpin buffer elements for a longer ISP capture requests, resulting in
out-of-bound array access.

Use full capture element size when calculating a total size of unpins_list
allocation.

Bug 3272255

Change-Id: I9fc96787c84d18e9416ce374540374c99bb5c7fc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2495613
Signed-off-by: Kirill Artamonov &lt;kartamonov@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545371
Reviewed-by: svcacv &lt;svcacv@nvidia.com&gt;
Reviewed-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Reviewed-by: Semi Malinen &lt;smalinen@nvidia.com&gt;
Reviewed-by: Pekka Pessi &lt;ppessi@nvidia.com&gt;
Reviewed-by: Mika Liljeberg &lt;mliljeberg@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When allocating a memory for a list of pinned buffers, capture-isp wrongly
uses size of a pointer to "unpin" element instead of a size of element
itself. As a result, allocation size is too small to fit all possible
unpin buffer elements for a longer ISP capture requests, resulting in
out-of-bound array access.

Use full capture element size when calculating a total size of unpins_list
allocation.

Bug 3272255

Change-Id: I9fc96787c84d18e9416ce374540374c99bb5c7fc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2495613
Signed-off-by: Kirill Artamonov &lt;kartamonov@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545371
Reviewed-by: svcacv &lt;svcacv@nvidia.com&gt;
Reviewed-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Reviewed-by: Semi Malinen &lt;smalinen@nvidia.com&gt;
Reviewed-by: Pekka Pessi &lt;ppessi@nvidia.com&gt;
Reviewed-by: Mika Liljeberg &lt;mliljeberg@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>capture-vi: use separate ringbuffer to pass iova to rtcpu</title>
<updated>2021-06-21T08:55:03+00:00</updated>
<author>
<name>Kirill Artamonov</name>
<email>kartamonov@nvidia.com</email>
</author>
<published>2021-06-15T00:11:28+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=6e262c637e5116e3057b73788c02358bafe2b725'/>
<id>6e262c637e5116e3057b73788c02358bafe2b725</id>
<content type='text'>
Passing iova pointers using capture descriptor is not safe since
usermode application can access them.

Use additional ringbuffer shared between kernel and rtcpu to
pass iova pointers securely.

Related changes and bugfixes:

Use permanent vmap mapping for VI capture 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 parameter capture_data from tegra_channel to
avoid confusing null pointer investigation when accidentally
using it.

Check for zero pin count at submit to avoid potential memory
mapping leak which will happen if usermode submits same capture
descriptor without waiting for completion.

Reboot rtcpu if fail to communicate with rtcpu during
channel release IVC call.

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.

CAMASIL-7466

bug 2768992
bug 3231670
bug 200688288
bug 200690078
CAMASIL-7460
CAMASIL-7477
CAMASIL-4619
CAMASIL-7465

Change-Id: Ia39de887093bbc158c72008ae387287ce30ebd82
Signed-off-by: Kirill Artamonov &lt;kartamonov@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2475799
(cherry picked from commit 71ad1f9d54a45e54767d5fa9411a4aee83374398)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545006
Reviewed-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Reviewed-by: Semi Malinen &lt;smalinen@nvidia.com&gt;
Reviewed-by: Pekka Pessi &lt;ppessi@nvidia.com&gt;
Reviewed-by: Mika Liljeberg &lt;mliljeberg@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Passing iova pointers using capture descriptor is not safe since
usermode application can access them.

Use additional ringbuffer shared between kernel and rtcpu to
pass iova pointers securely.

Related changes and bugfixes:

Use permanent vmap mapping for VI capture 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 parameter capture_data from tegra_channel to
avoid confusing null pointer investigation when accidentally
using it.

Check for zero pin count at submit to avoid potential memory
mapping leak which will happen if usermode submits same capture
descriptor without waiting for completion.

Reboot rtcpu if fail to communicate with rtcpu during
channel release IVC call.

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.

CAMASIL-7466

bug 2768992
bug 3231670
bug 200688288
bug 200690078
CAMASIL-7460
CAMASIL-7477
CAMASIL-4619
CAMASIL-7465

Change-Id: Ia39de887093bbc158c72008ae387287ce30ebd82
Signed-off-by: Kirill Artamonov &lt;kartamonov@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2475799
(cherry picked from commit 71ad1f9d54a45e54767d5fa9411a4aee83374398)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545006
Reviewed-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Reviewed-by: Semi Malinen &lt;smalinen@nvidia.com&gt;
Reviewed-by: Pekka Pessi &lt;ppessi@nvidia.com&gt;
Reviewed-by: Mika Liljeberg &lt;mliljeberg@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>nvcapture: capture buffer management</title>
<updated>2021-06-21T08:54:53+00:00</updated>
<author>
<name>Ziqi Qing</name>
<email>zqing@nvidia.com</email>
</author>
<published>2019-03-14T23:46:21+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=582806934788414445291cb103f8560bfd1618d6'/>
<id>582806934788414445291cb103f8560bfd1618d6</id>
<content type='text'>
Buffer management in KMD allow client to pin and setup a set of surface
before any capture request. Also keep the compatibility to pin the
surface when it is not registered before.

- Add ioctl to handle buffer pin request.
- Add capture buffer table.

Bug 2462034

Change-Id: I71021a241aab4e61d27bd504fb5657b169e56643
Signed-off-by: Ziqi Qing &lt;zqing@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/1972655
(cherry picked from commit 05c14274b4070aaa0fd02f07166554d07ede85ec)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545282
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Kirill Artamonov &lt;kartamonov@nvidia.com&gt;
Reviewed-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Reviewed-by: Semi Malinen &lt;smalinen@nvidia.com&gt;
Reviewed-by: Pekka Pessi &lt;ppessi@nvidia.com&gt;
Reviewed-by: Mika Liljeberg &lt;mliljeberg@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: Kirill Artamonov &lt;kartamonov@nvidia.com&gt;
Tested-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Buffer management in KMD allow client to pin and setup a set of surface
before any capture request. Also keep the compatibility to pin the
surface when it is not registered before.

- Add ioctl to handle buffer pin request.
- Add capture buffer table.

Bug 2462034

Change-Id: I71021a241aab4e61d27bd504fb5657b169e56643
Signed-off-by: Ziqi Qing &lt;zqing@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/1972655
(cherry picked from commit 05c14274b4070aaa0fd02f07166554d07ede85ec)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545282
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Kirill Artamonov &lt;kartamonov@nvidia.com&gt;
Reviewed-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Reviewed-by: Semi Malinen &lt;smalinen@nvidia.com&gt;
Reviewed-by: Pekka Pessi &lt;ppessi@nvidia.com&gt;
Reviewed-by: Mika Liljeberg &lt;mliljeberg@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
Tested-by: Kirill Artamonov &lt;kartamonov@nvidia.com&gt;
Tested-by: Igor Mitsyanko &lt;imitsyanko@nvidia.com&gt;
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
</pre>
</div>
</content>
</entry>
<entry>
<title>fusa-capture: clear memory allocated on stack</title>
<updated>2021-06-14T22:24:10+00:00</updated>
<author>
<name>rdai</name>
<email>rdai@nvidia.com</email>
</author>
<published>2021-06-02T06:22:29+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/nvidia-tegra-modules.git/commit/?id=087bc404e95c180ea949b4fc857dff4141005d3f'/>
<id>087bc404e95c180ea949b4fc857dff4141005d3f</id>
<content type='text'>
Clear memory allocated on stack to avoid leak
kernel information to client

Bug 3288458

Change-Id: Ie632cf6e26f45f9c43b481164c0e4a8ced55e6d7
Signed-off-by: rdai &lt;rdai@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2538246
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Martin Radev &lt;mradev@nvidia.com&gt;
Reviewed-by: Sachin Nikam &lt;snikam@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clear memory allocated on stack to avoid leak
kernel information to client

Bug 3288458

Change-Id: Ie632cf6e26f45f9c43b481164c0e4a8ced55e6d7
Signed-off-by: rdai &lt;rdai@nvidia.com&gt;
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2538246
Reviewed-by: svc-mobile-coverity &lt;svc-mobile-coverity@nvidia.com&gt;
Reviewed-by: Martin Radev &lt;mradev@nvidia.com&gt;
Reviewed-by: Sachin Nikam &lt;snikam@nvidia.com&gt;
Reviewed-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions &lt;svcmobile_promotions@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
