mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
- moved reg fields to gk20a - added os abstract register accessor in nvgpu/io.h - defined linux register access abstract implementation - hook up with posix. posix implementation of the register accessor uses the high 4 bit of address to identify register apertures then call the according callbacks. It helps to unify code across OSes. Bug 2999617 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Change-Id: Ifcb737e4b4d5b1d8bae310ae50b1ce0aa04f750c Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2497937 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
62 lines
1.7 KiB
C
62 lines
1.7 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/>.
|
|
*/
|
|
|
|
#include <nvgpu/types.h>
|
|
|
|
#include "os_linux.h"
|
|
|
|
/*
|
|
* Locks out the driver from accessing GPU registers. This prevents access to
|
|
* thse registers after the GPU has been clock or power gated. This should help
|
|
* find annoying bugs where register reads and writes are silently dropped
|
|
* after the GPU has been turned off. On older chips these reads and writes can
|
|
* also lock the entire CPU up.
|
|
*/
|
|
void nvgpu_lockout_usermode_registers(struct gk20a *g)
|
|
{
|
|
g->usermode_regs = 0U;
|
|
}
|
|
|
|
/*
|
|
* Undoes t19x_lockout_registers().
|
|
*/
|
|
void nvgpu_restore_usermode_registers(struct gk20a *g)
|
|
{
|
|
g->usermode_regs = g->usermode_regs_saved;
|
|
}
|
|
|
|
void nvgpu_remove_usermode_support(struct gk20a *g)
|
|
{
|
|
if (g->usermode_regs) {
|
|
g->usermode_regs = 0U;
|
|
}
|
|
}
|
|
|
|
void nvgpu_init_usermode_support(struct gk20a *g)
|
|
{
|
|
if (g->ops.usermode.base == NULL) {
|
|
return;
|
|
}
|
|
|
|
if (g->usermode_regs == 0U) {
|
|
g->usermode_regs = g->regs + g->ops.usermode.bus_base(g);
|
|
g->usermode_regs_saved = g->usermode_regs;
|
|
}
|
|
|
|
g->usermode_regs_bus_addr = g->regs_bus_addr +
|
|
g->ops.usermode.bus_base(g);
|
|
}
|