From 373167883e4dccc826b665f7f6a70f22e3ac233c Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Fri, 11 Mar 2022 21:28:51 +0530 Subject: [PATCH] gpu: nvgpu: add write barrier after setting notifier info32 While checking the GPU error status, userspace polls on the error notifier 'status' and then verifies 'status' and 'info32'. nvgpu sets 'info32' before 'status', so put a write barrier between those two writes for the consistency between userspace and kernel view of the error notifier state. JIRA NVGPU-7538 Bug 200717195 Bug 3250920 Change-Id: I92ac0589283fee823f3366ac594d03b8f27f3590 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2680320 Reviewed-by: Konsta Holtta Reviewed-by: Alex Waterman --- drivers/gpu/nvgpu/os/linux/linux-channel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/os/linux/linux-channel.c b/drivers/gpu/nvgpu/os/linux/linux-channel.c index 2b064b3c5..87362f188 100644 --- a/drivers/gpu/nvgpu/os/linux/linux-channel.c +++ b/drivers/gpu/nvgpu/os/linux/linux-channel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2017-2022, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -137,6 +138,7 @@ void nvgpu_set_err_notifier_locked(struct nvgpu_channel *ch, u32 error) notification->time_stamp.nanoseconds[1] = (u32)(nsec >> 32); notification->info32 = error; + nvgpu_wmb(); notification->status = 0xffff; if (error == NVGPU_CHANNEL_RESETCHANNEL_VERIF_ERROR) {