Files
linux-nvgpu/drivers/gpu/nvgpu/os/linux/module_usermode.c
Richard Zhao 2dfa05ba50 gpu: nvgpu: fixes for tu104 usermode register write
- correct user register base l->usermode_regs. It should be bar0 address
plus .usermode.bus_base(). .bus_base() returns user register base offset
relative to bar0.
- correct .usermode.base for tu104. .base should be user register base
relative to virtual function base.
- use nvgpu_usermode_writel for tu104 ring doorbell.

Jira GVSCI-4650

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Change-Id: Iba98063c4a5cc007459319b0311e546ff10604a4
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2403813
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Seshendra Gadagottu <sgadagottu@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>
2020-12-15 14:13:28 -06:00

70 lines
1.9 KiB
C

/*
* Copyright (c) 2017-2020, 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)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
l->usermode_regs = NULL;
}
/*
* Undoes t19x_lockout_registers().
*/
void nvgpu_restore_usermode_registers(struct gk20a *g)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
l->usermode_regs = l->usermode_regs_saved;
}
void nvgpu_remove_usermode_support(struct gk20a *g)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
if (l->usermode_regs) {
l->usermode_regs = NULL;
}
}
void nvgpu_init_usermode_support(struct gk20a *g)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
if (g->ops.usermode.base == NULL) {
return;
}
if (l->usermode_regs == NULL) {
l->usermode_regs = l->regs + g->ops.usermode.bus_base(g);
l->usermode_regs_saved = l->usermode_regs;
}
l->usermode_regs_bus_addr = l->regs_bus_addr +
g->ops.usermode.bus_base(g);
}