From 2dfa05ba507445b5c0bba58f419f6cca85f65298 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Tue, 25 Aug 2020 16:13:42 -0700 Subject: [PATCH] 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 Change-Id: Iba98063c4a5cc007459319b0311e546ff10604a4 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2403813 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Seshendra Gadagottu Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/hal/fifo/usermode_tu104.c | 7 ++++--- drivers/gpu/nvgpu/os/linux/module_usermode.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nvgpu/hal/fifo/usermode_tu104.c b/drivers/gpu/nvgpu/hal/fifo/usermode_tu104.c index 92728381c..71e73fe6b 100644 --- a/drivers/gpu/nvgpu/hal/fifo/usermode_tu104.c +++ b/drivers/gpu/nvgpu/hal/fifo/usermode_tu104.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "usermode_tu104.h" @@ -34,7 +35,7 @@ u64 tu104_usermode_base(struct gk20a *g) { - return usermode_cfg0_r(); + return func_cfg0_r(); } u64 tu104_usermode_bus_base(struct gk20a *g) @@ -66,6 +67,6 @@ void tu104_usermode_ring_doorbell(struct nvgpu_channel *ch) nvgpu_log_info(ch->g, "channel ring door bell %d, runlist %d", ch->chid, ch->runlist_id); - nvgpu_func_writel(ch->g, func_doorbell_r(), - tu104_usermode_doorbell_token(ch)); + nvgpu_usermode_writel(ch->g, func_doorbell_r(), + ch->g->ops.usermode.doorbell_token(ch)); } diff --git a/drivers/gpu/nvgpu/os/linux/module_usermode.c b/drivers/gpu/nvgpu/os/linux/module_usermode.c index afd662520..2babce43f 100644 --- a/drivers/gpu/nvgpu/os/linux/module_usermode.c +++ b/drivers/gpu/nvgpu/os/linux/module_usermode.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. + * 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, @@ -60,7 +60,7 @@ void nvgpu_init_usermode_support(struct gk20a *g) } if (l->usermode_regs == NULL) { - l->usermode_regs = l->regs + g->ops.usermode.base(g); + l->usermode_regs = l->regs + g->ops.usermode.bus_base(g); l->usermode_regs_saved = l->usermode_regs; }