Files
linux-nvgpu/drivers/gpu/nvgpu/include/nvgpu/linux/barrier.h
Richard Zhao 9ac7550f35 gpu: nvgpu: unify NV_READ_ONCE and NV_WRITE_ONCE
Implemented NV_READ_ONCE and NV_WRITE_ONCE in common code.

Jira GVSCI-10879

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Change-Id: I5465b4bd1cd44fc7bc1592da01d6be455b1fcdcc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2541559
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Aparna Das <aparnad@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2021-06-09 03:15:39 -07:00

39 lines
1.2 KiB
C

/*
* Copyright (c) 2017-2021, 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,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __NVGPU_BARRIER_LINUX_H__
#define __NVGPU_BARRIER_LINUX_H__
#include <asm/barrier.h>
#define nvgpu_mb_impl() mb()
#define nvgpu_rmb_impl() rmb()
#define nvgpu_wmb_impl() wmb()
#define nvgpu_smp_mb_impl() smp_mb()
#define nvgpu_smp_rmb_impl() smp_rmb()
#define nvgpu_smp_wmb_impl() smp_wmb()
#ifdef speculation_barrier
#define nvgpu_speculation_barrier_impl() speculation_barrier()
#else
#define nvgpu_speculation_barrier_impl() ({ \
asm volatile("dsb sy\n" \
"isb\n" : : : "memory"); })
#endif
#endif /* __NVGPU_BARRIER_LINUX_H__ */