mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: add speculative barrier
Data can be speculativerly stored and
code flow can be hijacked.
To mitigate this problem insert a
speculation barrier.
Bug 200447167
Change-Id: Ia865ff2add8b30de49aa970715625b13e8f71c08
Signed-off-by: Ranjanikar Nikhil Prabhakarrao <rprabhakarra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1972221
(cherry picked from commit f0762ed483)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/1996052
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Deepak Nibade <dnibade@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
bbef4c6927
commit
f56874aec2
@@ -290,6 +290,7 @@ static int gk20a_channel_cycle_stats_snapshot(struct channel_gk20a *ch,
|
||||
if (!args->dmabuf_fd)
|
||||
return -EINVAL;
|
||||
|
||||
nvgpu_speculation_barrier();
|
||||
/* handle the command (most frequent cases first) */
|
||||
switch (args->cmd) {
|
||||
case NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT_CMD_FLUSH:
|
||||
@@ -874,6 +875,7 @@ clean_up:
|
||||
*/
|
||||
u32 nvgpu_get_common_runlist_level(u32 level)
|
||||
{
|
||||
nvgpu_speculation_barrier();
|
||||
switch (level) {
|
||||
case NVGPU_RUNLIST_INTERLEAVE_LEVEL_LOW:
|
||||
return NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_LOW;
|
||||
@@ -982,6 +984,7 @@ u32 nvgpu_get_ioctl_compute_preempt_mode(u32 compute_preempt_mode)
|
||||
*/
|
||||
static u32 nvgpu_get_common_graphics_preempt_mode(u32 graphics_preempt_mode)
|
||||
{
|
||||
nvgpu_speculation_barrier();
|
||||
switch (graphics_preempt_mode) {
|
||||
case NVGPU_GRAPHICS_PREEMPTION_MODE_WFI:
|
||||
return NVGPU_PREEMPTION_MODE_GRAPHICS_WFI;
|
||||
@@ -998,6 +1001,7 @@ static u32 nvgpu_get_common_graphics_preempt_mode(u32 graphics_preempt_mode)
|
||||
*/
|
||||
static u32 nvgpu_get_common_compute_preempt_mode(u32 compute_preempt_mode)
|
||||
{
|
||||
nvgpu_speculation_barrier();
|
||||
switch (compute_preempt_mode) {
|
||||
case NVGPU_COMPUTE_PREEMPTION_MODE_WFI:
|
||||
return NVGPU_PREEMPTION_MODE_COMPUTE_WFI;
|
||||
@@ -1121,6 +1125,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
/* this ioctl call keeps a ref to the file which keeps a ref to the
|
||||
* channel */
|
||||
|
||||
nvgpu_speculation_barrier();
|
||||
switch (cmd) {
|
||||
case NVGPU_IOCTL_CHANNEL_OPEN:
|
||||
err = gk20a_channel_open_ioctl(ch->g,
|
||||
|
||||
Reference in New Issue
Block a user