From dec8625b88d1430f4bf3eac37954fbb732de3f1a Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 25 May 2018 14:25:01 -0700 Subject: gpu: nvgpu: Move SW scratch register read to bus SW scratch register is in bus register range. Move query of that register to bus HAL from bios. JIRA NVGPU-588 Change-Id: I69f35af3d5f8da3550eb68fe7d060a3ec48ce275 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1730898 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/bus/bus_gv100.c | 39 ++++++++++++++++++++++++++++++++ drivers/gpu/nvgpu/common/bus/bus_gv100.h | 33 +++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 drivers/gpu/nvgpu/common/bus/bus_gv100.c create mode 100644 drivers/gpu/nvgpu/common/bus/bus_gv100.h (limited to 'drivers/gpu/nvgpu/common/bus') diff --git a/drivers/gpu/nvgpu/common/bus/bus_gv100.c b/drivers/gpu/nvgpu/common/bus/bus_gv100.c new file mode 100644 index 00000000..2aa15e67 --- /dev/null +++ b/drivers/gpu/nvgpu/common/bus/bus_gv100.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#include "bus_gv100.h" +#include "gk20a/gk20a.h" + +#include + +u32 gv100_bus_read_sw_scratch(struct gk20a *g, u32 index) +{ + return gk20a_readl(g, bus_sw_scratch_r(index)); +} + +void gv100_bus_write_sw_scratch(struct gk20a *g, u32 index, u32 val) +{ + gk20a_writel(g, bus_sw_scratch_r(index), val); +} diff --git a/drivers/gpu/nvgpu/common/bus/bus_gv100.h b/drivers/gpu/nvgpu/common/bus/bus_gv100.h new file mode 100644 index 00000000..b6b608da --- /dev/null +++ b/drivers/gpu/nvgpu/common/bus/bus_gv100.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef NVGPU_GV100_BUS +#define NVGPU_GV100_BUS + +#include + +struct gk20a; + +u32 gv100_bus_read_sw_scratch(struct gk20a *g, u32 index); +void gv100_bus_write_sw_scratch(struct gk20a *g, u32 index, u32 val); + +#endif -- cgit v1.2.2