Files
linux-nvgpu/drivers/gpu/nvgpu/os/linux/module_usermode.c
Jon Hunter 261d4bed13 gpu: nvgpu: Enable -Wmissing-prototypes
The compiler option -Wmissing-prototypes is being enabled globally in
the upstream Linux kernel and this causes build failures for nvgpu. The
build failures occur because either the driver is missing an include
file which has the prototype or because the function is not declared
statically when it should be (ie. there are no external users).

Fix the various build failures and enable -Wmissing-prototypes to
prevent any new instances from occurring.

Bug 4404965

Change-Id: I551922836e37b0c94c158232d6277f4053e9d2d3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3027483
(cherry picked from commit e8cbf90db2d0db7277db9e3eec9fb88d69c7fcc7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3035518
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-15 14:09:44 -08:00

50 lines
1.2 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvgpu/types.h>
#include "os_linux.h"
#include "module_usermode.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);
}