drm/nouveau: initial support for GSP-RM 535.54.04 (and Ada GPUs)
Subsystems (4)
cover drm/nouveau: initial support for GSP-RM 535.54.04 (and Ada GPUs)
From: Ben Skeggs <[email protected]>
This series adds support for loading and running on top of NVIDIA's GSP-RM firmware, instead of directly programming large portions of the hardware ourselves.
The implementation is a little crude in places, but the goal of this series is to get (more-or-less) GSP-RM support on par with what we already support on HW. Next steps would be to look at what features GSP-RM enables us to more fully support, and clean up the GSP-RM integration once it's known what those will require.
Things should be somewhat faster when running on GSP-RM, as it's able to control GPU clocks, which wasn't possible for us previously.
SVM support is not available when running on top of GSP-RM at this point, due to GPU fault buffers not being implemented yet. This won't effect any real use-case, as SVM is experimental at best in nouveau anyway.
Aside from that, things should more or less work as normal.
GSP-RM support is disabled by default for now (except on Ada, where it's the only option) and can be enabled with nouveau.config=NvGspRm=1.
There'll likely be some nit-picky bugs to sort through, but I don't anticipate any huge disasters. I've smoke-tested this on a selection of GPUs right back to nv50, testing both HW and GSP paths depending on the GPU, and more thoroughly tested on Turing/Ampere/Ada, both discrete and laptop GPUs.
Firmware from NVIDIA is required to enable this support.
Ben Skeggs (44):
drm/nouveau/mmu/tu102-: remove write to 0x100e68 during tlb invalidate drm/nouveau/nvkm: bump maximum number of NVDEC drm/nouveau/nvkm: bump maximum number of NVJPG drm/nouveau/gsp: prepare for GSP-RM drm/nouveau/acr/tu102-: prepare for GSP-RM drm/nouveau/bar/tu102-: prepare for GSP-RM drm/nouveau/bus/tu102-: prepare for GSP-RM drm/nouveau/devinit/tu102-: prepare for GSP-RM drm/nouveau/fault/tu102-: prepare for GSP-RM drm/nouveau/fb/tu102-: prepare for GSP-RM drm/nouveau/fuse/tu102-: prepare for GSP-RM drm/nouveau/gpio/tu102-: prepare for GSP-RM drm/nouveau/i2c/tu102-: prepare for GSP-RM drm/nouveau/imem/tu102-: prepare for GSP-RM drm/nouveau/ltc/tu102-: prepare for GSP-RM drm/nouveau/mc/tu102-: prepare for GSP-RM drm/nouveau/mmu/tu102-: prepare for GSP-RM drm/nouveau/pmu/tu102-: prepare for GSP-RM drm/nouveau/privring/tu102-: prepare for GSP-RM drm/nouveau/therm/tu102-: prepare for GSP-RM drm/nouveau/top/tu102-: prepare for GSP-RM drm/nouveau/vfn/tu102-: prepare for GSP-RM drm/nouveau/ce/tu102-: prepare for GSP-RM drm/nouveau/disp/tu102-: prepare for GSP-RM drm/nouveau/fifo/tu102-: prepare for GSP-RM drm/nouveau/gr/tu102-: prepare for GSP-RM drm/nouveau/nvdec/tu102-: prepare for GSP-RM drm/nouveau/nvenc/tu102-: prepare for GSP-RM drm/nouveau/sec2/tu102-: prepare for GSP-RM drm/nouveau/kms/tu102-: disable vbios parsing when running on RM drm/nouveau/nvkm: support loading fws into sg_table drm/nouveau/gsp/r535: add support for booting GSP-RM drm/nouveau/gsp/r535: add support for rm control drm/nouveau/gsp/r535: add support for rm alloc drm/nouveau/gsp/r535: add interrupt handling drm/nouveau/mmu/r535: initial support drm/nouveau/disp/r535: initial support drm/nouveau/fifo/r535: initial support drm/nouveau/ce/r535: initial support
drm/nouveau/gr/r535: initial support drm/nouveau/nvdec/r535: initial support drm/nouveau/nvenc/r535: initial support drm/nouveau/nvjpg/r535: initial support drm/nouveau/ofa/r535: initial support
drivers/gpu/drm/nouveau/dispnv50/core.c | 1 + drivers/gpu/drm/nouveau/dispnv50/disp.c | 141 ++ drivers/gpu/drm/nouveau/include/nvif/cl0080.h | 3 + drivers/gpu/drm/nouveau/include/nvif/class.h | 21 + .../drm/nouveau/include/nvkm/core/device.h | 1 + .../drm/nouveau/include/nvkm/core/falcon.h | 7 + .../drm/nouveau/include/nvkm/core/firmware.h | 6 +- .../drm/nouveau/include/nvkm/core/layout.h | 6 +- .../drm/nouveau/include/nvkm/engine/disp.h | 19 + .../drm/nouveau/include/nvkm/engine/falcon.h | 4 + .../drm/nouveau/include/nvkm/engine/fifo.h | 19 + .../gpu/drm/nouveau/include/nvkm/engine/gr.h | 1 + .../drm/nouveau/include/nvkm/engine/nvdec.h | 3 + .../drm/nouveau/include/nvkm/engine/nvenc.h | 3 + .../drm/nouveau/include/nvkm/engine/nvjpg.h | 8 + .../gpu/drm/nouveau/include/nvkm/engine/ofa.h | 9 + .../gpu/drm/nouveau/include/nvkm/subdev/bar.h | 4 + .../drm/nouveau/include/nvkm/subdev/bios.h | 1 + .../gpu/drm/nouveau/include/nvkm/subdev/fb.h | 6 +- .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 435 ++++ .../drm/nouveau/include/nvkm/subdev/instmem.h | 7 + .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h | 11 + .../sdk/nvidia/inc/alloc/alloc_channel.h | 161 ++ .../common/sdk/nvidia/inc/class/cl0000.h | 38 + .../common/sdk/nvidia/inc/class/cl0005.h | 38 + .../common/sdk/nvidia/inc/class/cl0080.h | 43 + .../common/sdk/nvidia/inc/class/cl2080.h | 35 + .../nvidia/inc/class/cl2080_notification.h | 62 + .../common/sdk/nvidia/inc/class/cl84a0.h | 33 + .../common/sdk/nvidia/inc/class/cl90f1.h | 31 + .../common/sdk/nvidia/inc/class/clc0b5sw.h | 34 + .../nvidia/inc/ctrl/ctrl0073/ctrl0073common.h | 39 + .../nvidia/inc/ctrl/ctrl0073/ctrl0073dfp.h | 166 ++ .../sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073dp.h | 335 +++ .../inc/ctrl/ctrl0073/ctrl0073specific.h | 216 ++ .../nvidia/inc/ctrl/ctrl0073/ctrl0073system.h | 65 + .../nvidia/inc/ctrl/ctrl0080/ctrl0080fifo.h | 57 + .../nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h | 48 + .../sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h | 31 + .../nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h | 40 + .../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.h | 35 + .../nvidia/inc/ctrl/ctrl2080/ctrl2080event.h | 41 + .../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h | 51 + .../nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.h | 52 + .../nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h | 100 + .../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h | 41 + .../inc/ctrl/ctrl2080/ctrl2080internal.h | 162 ++ .../common/sdk/nvidia/inc/ctrl/ctrl90f1.h | 95 + .../nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.h | 42 + .../common/sdk/nvidia/inc/nvlimits.h | 33 + .../535.54.03/common/sdk/nvidia/inc/nvos.h | 148 ++ .../common/shared/msgq/inc/msgq/msgq_priv.h | 46 + .../uproc/os/common/include/libos_init_args.h | 52 + .../nvalloc/common/inc/gsp/gsp_fw_sr_meta.h | 79 + .../nvalloc/common/inc/gsp/gsp_fw_wpr_meta.h | 149 ++ .../arch/nvalloc/common/inc/rmRiscvUcode.h | 82 + .../nvidia/arch/nvalloc/common/inc/rmgspseq.h | 100 + .../535.54.03/nvidia/generated/g_allclasses.h | 33 + .../nvidia/generated/g_chipset_nvoc.h | 38 + .../535.54.03/nvidia/generated/g_fbsr_nvoc.h | 31 + .../535.54.03/nvidia/generated/g_gpu_nvoc.h | 35 + .../nvidia/generated/g_kernel_channel_nvoc.h | 62 + .../nvidia/generated/g_kernel_fifo_nvoc.h | 119 + .../nvidia/generated/g_mem_desc_nvoc.h | 32 + .../535.54.03/nvidia/generated/g_os_nvoc.h | 44 + .../nvidia/generated/g_rpc-structures.h | 124 + .../nvidia/generated/g_sdk-structures.h | 45 + .../nvidia/inc/kernel/gpu/gpu_acpi_data.h | 74 + .../nvidia/inc/kernel/gpu/gpu_engine_type.h | 86 + .../nvidia/inc/kernel/gpu/gsp/gsp_fw_heap.h | 33 + .../nvidia/inc/kernel/gpu/gsp/gsp_init_args.h | 57 + .../inc/kernel/gpu/gsp/gsp_static_config.h | 174 ++ .../nvidia/inc/kernel/gpu/intr/engine_idx.h | 57 + .../nvidia/inc/kernel/gpu/nvbitmask.h | 33 + .../nvidia/inc/kernel/os/nv_memory_type.h | 31 + .../nvidia/kernel/inc/vgpu/rpc_global_enums.h | 262 ++ .../nvidia/kernel/inc/vgpu/rpc_headers.h | 51 + .../nvidia/kernel/inc/vgpu/sdk-structures.h | 40 + .../gpu/drm/nouveau/include/nvrm/nvtypes.h | 24 + drivers/gpu/drm/nouveau/nouveau_bios.c | 5 +- drivers/gpu/drm/nouveau/nvif/disp.c | 1 + drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 74 +- drivers/gpu/drm/nouveau/nvkm/engine/Kbuild | 2 + drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/engine/ce/ga100.c | 4 + .../gpu/drm/nouveau/nvkm/engine/ce/ga102.c | 5 + drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h | 3 + drivers/gpu/drm/nouveau/nvkm/engine/ce/r535.c | 108 + .../gpu/drm/nouveau/nvkm/engine/ce/tu102.c | 5 + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 190 +- .../gpu/drm/nouveau/nvkm/engine/device/priv.h | 2 + .../gpu/drm/nouveau/nvkm/engine/device/user.c | 1 + .../gpu/drm/nouveau/nvkm/engine/disp/Kbuild | 3 + .../gpu/drm/nouveau/nvkm/engine/disp/ad102.c | 52 + .../gpu/drm/nouveau/nvkm/engine/disp/base.c | 8 +- .../gpu/drm/nouveau/nvkm/engine/disp/chan.h | 4 + .../gpu/drm/nouveau/nvkm/engine/disp/ga102.c | 4 + .../gpu/drm/nouveau/nvkm/engine/disp/gf119.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/disp/gv100.c | 6 +- .../gpu/drm/nouveau/nvkm/engine/disp/ior.h | 2 + .../gpu/drm/nouveau/nvkm/engine/disp/nv50.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/disp/outp.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/disp/priv.h | 14 +- .../gpu/drm/nouveau/nvkm/engine/disp/r535.c | 1671 +++++++++++++ .../gpu/drm/nouveau/nvkm/engine/disp/tu102.c | 4 + .../gpu/drm/nouveau/nvkm/engine/disp/uconn.c | 31 +- drivers/gpu/drm/nouveau/nvkm/engine/falcon.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/fifo/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 11 + .../gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c | 3 + .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c | 55 +- .../gpu/drm/nouveau/nvkm/engine/fifo/chan.h | 3 + .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 4 + .../gpu/drm/nouveau/nvkm/engine/fifo/ga102.c | 7 +- .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 4 + .../gpu/drm/nouveau/nvkm/engine/fifo/r535.c | 664 +++++ .../gpu/drm/nouveau/nvkm/engine/fifo/runl.h | 6 + .../gpu/drm/nouveau/nvkm/engine/fifo/tu102.c | 4 + .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c | 9 + drivers/gpu/drm/nouveau/nvkm/engine/gr/Kbuild | 3 + .../gpu/drm/nouveau/nvkm/engine/gr/ad102.c | 46 + drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c | 6 +- .../gpu/drm/nouveau/nvkm/engine/gr/ga102.c | 4 + .../gpu/drm/nouveau/nvkm/engine/gr/gf100.h | 2 + drivers/gpu/drm/nouveau/nvkm/engine/gr/r535.c | 508 ++++ .../gpu/drm/nouveau/nvkm/engine/gr/tu102.c | 5 + .../gpu/drm/nouveau/nvkm/engine/nvdec/Kbuild | 5 + .../gpu/drm/nouveau/nvkm/engine/nvdec/ad102.c | 44 + .../gpu/drm/nouveau/nvkm/engine/nvdec/base.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/nvdec/ga100.c | 44 + .../gpu/drm/nouveau/nvkm/engine/nvdec/ga102.c | 16 +- .../gpu/drm/nouveau/nvkm/engine/nvdec/gm107.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/nvdec/priv.h | 7 + .../gpu/drm/nouveau/nvkm/engine/nvdec/r535.c | 110 + .../gpu/drm/nouveau/nvkm/engine/nvdec/tu102.c | 44 + .../gpu/drm/nouveau/nvkm/engine/nvenc/Kbuild | 5 + .../gpu/drm/nouveau/nvkm/engine/nvenc/ad102.c | 44 + .../gpu/drm/nouveau/nvkm/engine/nvenc/base.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/nvenc/ga102.c | 44 + .../gpu/drm/nouveau/nvkm/engine/nvenc/gm107.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/nvenc/priv.h | 5 + .../gpu/drm/nouveau/nvkm/engine/nvenc/r535.c | 110 + .../gpu/drm/nouveau/nvkm/engine/nvenc/tu102.c | 44 + .../gpu/drm/nouveau/nvkm/engine/nvjpg/Kbuild | 5 + .../gpu/drm/nouveau/nvkm/engine/nvjpg/ad102.c | 44 + .../gpu/drm/nouveau/nvkm/engine/nvjpg/ga100.c | 44 + .../gpu/drm/nouveau/nvkm/engine/nvjpg/priv.h | 8 + .../gpu/drm/nouveau/nvkm/engine/nvjpg/r535.c | 107 + .../gpu/drm/nouveau/nvkm/engine/ofa/Kbuild | 6 + .../gpu/drm/nouveau/nvkm/engine/ofa/ad102.c | 44 + .../gpu/drm/nouveau/nvkm/engine/ofa/ga100.c | 44 + .../gpu/drm/nouveau/nvkm/engine/ofa/ga102.c | 44 + .../gpu/drm/nouveau/nvkm/engine/ofa/priv.h | 8 + .../gpu/drm/nouveau/nvkm/engine/ofa/r535.c | 107 + .../gpu/drm/nouveau/nvkm/engine/sec2/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/engine/sec2/ga102.c | 8 +- .../gpu/drm/nouveau/nvkm/engine/sec2/priv.h | 3 + .../gpu/drm/nouveau/nvkm/engine/sec2/r535.c | 54 + .../gpu/drm/nouveau/nvkm/engine/sec2/tu102.c | 8 +- drivers/gpu/drm/nouveau/nvkm/falcon/Kbuild | 1 + drivers/gpu/drm/nouveau/nvkm/falcon/base.c | 16 + drivers/gpu/drm/nouveau/nvkm/falcon/ga100.c | 6 + drivers/gpu/drm/nouveau/nvkm/falcon/ga102.c | 6 + drivers/gpu/drm/nouveau/nvkm/falcon/tu102.c | 28 + .../gpu/drm/nouveau/nvkm/subdev/acr/ga102.c | 4 + .../gpu/drm/nouveau/nvkm/subdev/acr/tu102.c | 3 + .../gpu/drm/nouveau/nvkm/subdev/bar/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/bar/base.c | 10 +- .../gpu/drm/nouveau/nvkm/subdev/bar/priv.h | 3 + .../gpu/drm/nouveau/nvkm/subdev/bar/r535.c | 186 ++ .../gpu/drm/nouveau/nvkm/subdev/bar/tu102.c | 4 + .../gpu/drm/nouveau/nvkm/subdev/bios/base.c | 8 + .../gpu/drm/nouveau/nvkm/subdev/bus/gf100.c | 5 + .../drm/nouveau/nvkm/subdev/devinit/Kbuild | 2 + .../drm/nouveau/nvkm/subdev/devinit/ga100.c | 15 + .../drm/nouveau/nvkm/subdev/devinit/priv.h | 3 + .../drm/nouveau/nvkm/subdev/devinit/r535.c | 51 + .../drm/nouveau/nvkm/subdev/devinit/tu102.c | 4 + .../gpu/drm/nouveau/nvkm/subdev/fault/tu102.c | 8 +- drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/fb/ga100.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/fb/ga102.c | 4 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h | 3 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c | 87 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.c | 46 +- .../gpu/drm/nouveau/nvkm/subdev/fb/tu102.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/gpio/ga102.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/gsp/Kbuild | 8 + .../gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c | 57 + .../gpu/drm/nouveau/nvkm/subdev/gsp/base.c | 78 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/fwsec.c | 359 +++ .../gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c | 74 + .../gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 148 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c | 4 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/priv.h | 57 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 2195 +++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c | 198 ++ .../gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c | 57 + .../gpu/drm/nouveau/nvkm/subdev/i2c/gm200.c | 5 + .../drm/nouveau/nvkm/subdev/instmem/Kbuild | 2 + .../drm/nouveau/nvkm/subdev/instmem/base.c | 40 +- .../drm/nouveau/nvkm/subdev/instmem/gk20a.c | 2 + .../drm/nouveau/nvkm/subdev/instmem/nv04.c | 45 + .../drm/nouveau/nvkm/subdev/instmem/nv50.c | 27 +- .../drm/nouveau/nvkm/subdev/instmem/priv.h | 13 + .../drm/nouveau/nvkm/subdev/instmem/r535.c | 333 +++ .../gpu/drm/nouveau/nvkm/subdev/ltc/ga102.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/ltc/gp102.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/mc/ga100.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/mc/gp100.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c | 4 + .../gpu/drm/nouveau/nvkm/subdev/mmu/priv.h | 6 + .../gpu/drm/nouveau/nvkm/subdev/mmu/r535.c | 123 + .../gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c | 4 + .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c | 6 + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 7 + .../drm/nouveau/nvkm/subdev/mmu/vmmtu102.c | 6 +- .../gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c | 5 + .../drm/nouveau/nvkm/subdev/privring/gm200.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/therm/gp100.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/top/ga100.c | 7 +- .../gpu/drm/nouveau/nvkm/subdev/top/gk104.c | 7 +- .../gpu/drm/nouveau/nvkm/subdev/vfn/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/vfn/ga100.c | 5 + .../gpu/drm/nouveau/nvkm/subdev/vfn/priv.h | 7 +- .../gpu/drm/nouveau/nvkm/subdev/vfn/r535.c | 50 + .../gpu/drm/nouveau/nvkm/subdev/vfn/tu102.c | 5 + 230 files changed, 13977 insertions(+), 140 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/include/nvkm/engine/nvjpg.h create mode 100644 drivers/gpu/drm/nouveau/include/nvkm/engine/ofa.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/alloc/alloc_channel.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0000.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0005.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0080.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080_notification.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl84a0.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl90f1.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/clc0b5sw.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073common.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073dfp.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073dp.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073specific.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073system.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080fifo.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080event.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080internal.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl90f1.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvos.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/shared/msgq/inc/msgq/msgq_priv.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/uproc/os/common/include/libos_init_args.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/gsp/gsp_fw_sr_meta.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/gsp/gsp_fw_wpr_meta.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/rmRiscvUcode.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/rmgspseq.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_allclasses.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_chipset_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_fbsr_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_gpu_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_channel_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_fifo_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_mem_desc_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_os_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_sdk-structures.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_acpi_data.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_fw_heap.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_init_args.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_static_config.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/intr/engine_idx.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/nvbitmask.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/os/nv_memory_type.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_global_enums.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/sdk-structures.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/nvtypes.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/ce/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/gr/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/gr/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ga100.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvdec/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvdec/tu102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvenc/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvenc/ga102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvenc/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvenc/tu102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/Kbuild create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ga100.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/priv.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/ofa/Kbuild create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/ofa/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/ofa/ga100.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/ofa/ga102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/ofa/priv.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/ofa/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/sec2/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/falcon/tu102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/fwsec.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/vfn/r535.c
Signature · 1 line
2.41.0
PATCH 1/44 drm/nouveau/mmu/tu102-: remove write to 0x100e68 during tlb invalidate
From: Ben Skeggs <[email protected]>
This was cargo-culted from traces of RM when the code was written, but we probably shouldn't be touching NV_PFB regs while GSP-RM is running.
From traces, it looks like NVIDIA dropped this sometime between 510.54 and 515.48.07, so I guess we can too.
--- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmtu102.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmtu102.c +0 -1
@@ -37,7 +37,6 @@ tu102_vmm_flush(struct nvkm_vmm *vmm, int depth)nvkm_wr32 (device,0xb830a0 , vmm->pd->pt[0 ]->addr >>8 );nvkm_wr32 (device,0xb830a4 ,0x00000000 ); -nvkm_wr32 (device,0x100e68 ,0x00000000 );nvkm_wr32 (device,0xb830b0 ,0x80000000 | type); nvkm_msec(device, 2000,
Signature · 1 line
2.41.0
PATCH 2/44 drm/nouveau/nvkm: bump maximum number of NVDEC
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
RM (and GH100) support 8 NVDEC instances.
--- drivers/gpu/drm/nouveau/include/nvkm/core/layout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/include/nvkm/core/layout.h +1 -1
@@ -42,7 +42,7 @@ NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSENC , struct nvkm_engine , msenc) NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSPDEC , struct nvkm_engine , mspdec) NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSPPP , struct nvkm_engine , msppp) NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSVLD , struct nvkm_engine , msvld) -NVKM_LAYOUT_INST(NVKM_ENGINE_NVDEC , struct nvkm_nvdec , nvdec, 5) +NVKM_LAYOUT_INST(NVKM_ENGINE_NVDEC , struct nvkm_nvdec , nvdec, 8) NVKM_LAYOUT_INST(NVKM_ENGINE_NVENC , struct nvkm_nvenc , nvenc, 3) NVKM_LAYOUT_ONCE(NVKM_ENGINE_NVJPG , struct nvkm_engine , nvjpg) NVKM_LAYOUT_ONCE(NVKM_ENGINE_OFA , struct nvkm_engine , ofa)
Signature · 1 line
2.41.0
PATCH 3/44 drm/nouveau/nvkm: bump maximum number of NVJPG
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
RM (and GH100) support 8 NVJPG instances.
--- drivers/gpu/drm/nouveau/include/nvkm/core/layout.h | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/top/ga100.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/layout.h +1 -1
@@ -44,7 +44,7 @@ NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSPPP , struct nvkm_engine , msppp) NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSVLD , struct nvkm_engine , msvld) NVKM_LAYOUT_INST(NVKM_ENGINE_NVDEC , struct nvkm_nvdec , nvdec, 8) NVKM_LAYOUT_INST(NVKM_ENGINE_NVENC , struct nvkm_nvenc , nvenc, 3) -NVKM_LAYOUT_ONCE(NVKM_ENGINE_NVJPG , struct nvkm_engine , nvjpg) +NVKM_LAYOUT_INST(NVKM_ENGINE_NVJPG , struct nvkm_engine , nvjpg, 8) NVKM_LAYOUT_ONCE(NVKM_ENGINE_OFA , struct nvkm_engine , ofa) NVKM_LAYOUT_ONCE(NVKM_ENGINE_PM , struct nvkm_pm , pm) NVKM_LAYOUT_ONCE(NVKM_ENGINE_SEC , struct nvkm_engine , sec)
drivers/gpu/drm/nouveau/nvkm/subdev/top/ga100.c +1 -1
@@ -76,7 +76,7 @@ ga100_top_parse(struct nvkm_top *top)case 0x00000012 :I_ (NVKM_SUBDEV_IOCTRL , inst);break ;case 0x00000013 :I_ (NVKM_ENGINE_CE , inst);break ;case 0x00000014 :O_ (NVKM_SUBDEV_GSP ,0 );break ; -case 0x00000015 :O_ (NVKM_ENGINE_NVJPG ,0 );break ; +case 0x00000015 :I_ (NVKM_ENGINE_NVJPG , inst);break ;case 0x00000016 :O_ (NVKM_ENGINE_OFA ,0 );break ;case 0x00000017 :O_ (NVKM_SUBDEV_FLA ,0 );break ;break ;
drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c +1 -1
@@ -89,7 +89,7 @@ gk104_top_parse(struct nvkm_top *top)case 0x00000012 :I_ (NVKM_SUBDEV_IOCTRL , inst);break ;case 0x00000013 :I_ (NVKM_ENGINE_CE , inst);break ;case 0x00000014 :O_ (NVKM_SUBDEV_GSP ,0 );break ; -case 0x00000015 :O_ (NVKM_ENGINE_NVJPG ,0 );break ; +case 0x00000015 :I_ (NVKM_ENGINE_NVJPG , inst);break ;default :break ; }
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 03/44] drm/nouveau/nvkm: bump maximum number of NVJPG
Quoted 3 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
RM (and GH100) support 8 NVJPG instances.
I don't think the commit message provides enough information. Instinctively I would read the RM as "remove", thus "remove support [for] 8 NVJPG instances" ???
Two sentences (with verb and object) would be helpful here, one describing the problem being addressed, the other what the commit does.
P.
Quoted 59 lines
Signed-off-by Ben Skeggs <[email protected]>---
drivers/gpu/drm/nouveau/include/nvkm/core/layout.h | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/top/ga100.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c | 2 +-3 files changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/nouveau/include/nvkm/core/layout.h +0
-1@@ -44,7 +44,7 @@ NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSPPP , struct nvkm_engine , msppp) NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSVLD , struct nvkm_engine , msvld) NVKM_LAYOUT_INST(NVKM_ENGINE_NVDEC , struct nvkm_nvdec , nvdec, 8) NVKM_LAYOUT_INST(NVKM_ENGINE_NVENC , struct nvkm_nvenc , nvenc, 3) -NVKM_LAYOUT_ONCE(NVKM_ENGINE_NVJPG , struct nvkm_engine ,nvjpg)
+NVKM_LAYOUT_INST(NVKM_ENGINE_NVJPG , struct nvkm_engine , nvjpg, 8)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_OFA , struct nvkm_engine , ofa)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_PM , struct nvkm_pm , pm)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_SEC , struct nvkm_engine , sec)drivers/gpu/drm/nouveau/nvkm/subdev/top/ga100.c +1
-1@@ -76,7 +76,7 @@ ga100_top_parse(struct nvkm_top *top) case 0x00000012: I_(NVKM_SUBDEV_IOCTRL, inst); break; case 0x00000013: I_(NVKM_ENGINE_CE , inst); break; case 0x00000014: O_(NVKM_SUBDEV_GSP , 0); break; - case 0x00000015: O_(NVKM_ENGINE_NVJPG , 0); break; + case 0x00000015: I_(NVKM_ENGINE_NVJPG , inst); break; case 0x00000016: O_(NVKM_ENGINE_OFA , 0); break; case 0x00000017: O_(NVKM_SUBDEV_FLA , 0); break; break;drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c +1
-1@@ -89,7 +89,7 @@ gk104_top_parse(struct nvkm_top *top) case 0x00000012: I_(NVKM_SUBDEV_IOCTRL, inst); break; case 0x00000013: I_(NVKM_ENGINE_CE , inst); break; case 0x00000014: O_(NVKM_SUBDEV_GSP , 0); break; - case 0x00000015: O_(NVKM_ENGINE_NVJPG , 0); break; + case 0x00000015: I_(NVKM_ENGINE_NVJPG , inst); break;default:
break;
}
Re: [Nouveau] [PATCH 03/44] drm/nouveau/nvkm: bump maximum number of NVJPG
Quoted 11 lines · Philipp Stanner
Quoted 3 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
RM (and GH100) support 8 NVJPG instances.
I don't think the commit message provides enough information. Instinctively I would read the RM as "remove", thus "remove support [for] 8 NVJPG instances" ???
Two sentences (with verb and object) would be helpful here, one describing the problem being addressed, the other what the commit does.
Agreed. Here is my understanding of what Ben meant to say:
Bump the maximum amount of NVJPG blocks to 8 to matching both what nvidia's kernel driver (resource manager) and GH100 support.
I hope this helps!
Martin
Quoted 64 lines
P.
Quoted 59 lines
Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/include/nvkm/core/layout.h | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/top/ga100.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/nouveau/include/nvkm/core/layout.h +0
-1@@ -44,7 +44,7 @@ NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSPPP , struct nvkm_engine , msppp) NVKM_LAYOUT_ONCE(NVKM_ENGINE_MSVLD , struct nvkm_engine , msvld) NVKM_LAYOUT_INST(NVKM_ENGINE_NVDEC , struct nvkm_nvdec , nvdec, 8) NVKM_LAYOUT_INST(NVKM_ENGINE_NVENC , struct nvkm_nvenc , nvenc, 3) -NVKM_LAYOUT_ONCE(NVKM_ENGINE_NVJPG , struct nvkm_engine ,nvjpg)
+NVKM_LAYOUT_INST(NVKM_ENGINE_NVJPG , struct nvkm_engine , nvjpg, 8)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_OFA , struct nvkm_engine ,
ofa)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_PM , struct nvkm_pm ,
pm)
NVKM_LAYOUT_ONCE(NVKM_ENGINE_SEC , struct nvkm_engine ,
sec)drivers/gpu/drm/nouveau/nvkm/subdev/top/ga100.c +1
-1@@ -76,7 +76,7 @@ ga100_top_parse(struct nvkm_top *top) case 0x00000012: I_(NVKM_SUBDEV_IOCTRL, inst); break; case 0x00000013: I_(NVKM_ENGINE_CE , inst); break; case 0x00000014: O_(NVKM_SUBDEV_GSP , 0); break; - case 0x00000015: O_(NVKM_ENGINE_NVJPG , 0); break; + case 0x00000015: I_(NVKM_ENGINE_NVJPG , inst); break; case 0x00000016: O_(NVKM_ENGINE_OFA , 0); break; case 0x00000017: O_(NVKM_SUBDEV_FLA , 0); break; break;drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c +1
-1@@ -89,7 +89,7 @@ gk104_top_parse(struct nvkm_top *top) case 0x00000012: I_(NVKM_SUBDEV_IOCTRL, inst); break; case 0x00000013: I_(NVKM_ENGINE_CE , inst); break; case 0x00000014: O_(NVKM_SUBDEV_GSP , 0); break; - case 0x00000015: O_(NVKM_ENGINE_NVJPG , 0); break; + case 0x00000015: I_(NVKM_ENGINE_NVJPG , inst); break; default: break; }
PATCH 4/44 drm/nouveau/gsp: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- move TOP after GSP, so we can disable TOP if GSP is in use
- provide plumbing to support falcon-only and GSP-RM paths
- provide a method for subdevs to detect GSP-RM paths
- split tu102/tu116/ga100 paths from gv100, which can't support GSP-RM
--- .../drm/nouveau/include/nvkm/core/layout.h | 2 +- .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 9 ++++ .../gpu/drm/nouveau/nvkm/engine/device/base.c | 11 +++-- .../gpu/drm/nouveau/nvkm/subdev/gsp/Kbuild | 3 ++ .../gpu/drm/nouveau/nvkm/subdev/gsp/base.c | 47 +++++++++++++++++-- .../gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c | 35 ++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 8 +--- .../gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c | 4 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/priv.h | 17 +++++-- .../gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c | 35 ++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c | 35 ++++++++++++++ 11 files changed, 182 insertions(+), 24 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c
drivers/gpu/drm/nouveau/include/nvkm/core/layout.h +1 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: MIT */ -NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TOP , struct nvkm_top , top) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp) +NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TOP , struct nvkm_top , top) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VFN , struct nvkm_vfn , vfn) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PCI , struct nvkm_pci , pci) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios)
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +9 -0
@@ -11,6 +11,15 @@ struct nvkm_gsp { struct nvkm_falcon falcon; }; +static inline bool +nvkm_gsp_rm (struct nvkm_gsp *gsp) +{ +return false; +} +int gv100_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **); +int tu102_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **); +int tu116_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **); +int ga100_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int ga102_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +6 -5
@@ -2408,7 +2408,7 @@ nv162_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu102_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },
@@ -2443,7 +2443,7 @@ nv164_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu102_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },
@@ -2478,7 +2478,7 @@ nv166_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu102_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },
@@ -2513,7 +2513,7 @@ nv167_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu116_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },
@@ -2548,7 +2548,7 @@ nv168_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu116_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },
@@ -2580,6 +2580,7 @@ nv170_chipset = { .fault = { 0x00000001, tu102_fault_new }, .fb = { 0x00000001, ga100_fb_new }, .gpio = { 0x00000001, gk104_gpio_new }, + .gsp = { 0x00000001, ga100_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, ga100_mc_new },
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/Kbuild +3 -0
@@ -1,4 +1,7 @@ # SPDX-License-Identifier: MIT nvkm-y += nvkm/subdev/gsp/base.o nvkm-y += nvkm/subdev/gsp/gv100.o +nvkm-y += nvkm/subdev/gsp/tu102.o +nvkm-y += nvkm/subdev/gsp/tu116.o +nvkm-y += nvkm/subdev/gsp/ga100.o nvkm-y += nvkm/subdev/gsp/ga102.o
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c +42 -5
68 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 2022 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +static struct nvkm_gsp_fwif +ga100_gsps[] = { + {-1 , gv100_gsp_nofw, &gv100_gsp }, + {} +}; + +int +ga100_gsp_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_gsp **pgsp) +{ +return nvkm_gsp_new_ (ga100_gsps, device, type, inst, pgsp); +}
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c +1 -7
@@ -39,15 +39,9 @@ ga102_gsp = { .flcn = &ga102_gsp_flcn, }; -static int -ga102_gsp_nofw (struct nvkm_gsp *gsp,int ver,const struct nvkm_gsp_fwif *fwif) -{ -return 0 ; -} -static struct nvkm_gsp_fwif ga102_gsps[] = { - {-1 , ga102_gsp_nofw, &ga102_gsp }, + {-1 , gv100_gsp_nofw, &ga102_gsp }, {} };
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c +2 -2
@@ -34,12 +34,12 @@ gv100_gsp_flcn = { .dmem_pio = &gm200_flcn_dmem_pio, }; -static const struct nvkm_gsp_func +const struct nvkm_gsp_func gv100_gsp = { .flcn = &gv100_gsp_flcn, }; -static int +int gv100_gsp_nofw (struct nvkm_gsp *gsp,int ver,const struct nvkm_gsp_fwif *fwif) {return 0 ;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/priv.h +13 -4
@@ -4,16 +4,25 @@#include <subdev/gsp.h> enum nvkm_acr_lsf_id ; -struct nvkm_gsp_func { -const struct nvkm_falcon_func *flcn; -}; -struct nvkm_gsp_fwif {int version;int (*load)(struct nvkm_gsp *,int ver,const struct nvkm_gsp_fwif *);const struct nvkm_gsp_func *func; }; +int gv100_gsp_nofw (struct nvkm_gsp *,int ,const struct nvkm_gsp_fwif *); + +struct nvkm_gsp_func { +const struct nvkm_falcon_func *flcn; + +void (*dtor)(struct nvkm_gsp *); +int (*oneinit)(struct nvkm_gsp *); +int (*init)(struct nvkm_gsp *); +int (*fini)(struct nvkm_gsp *,bool suspend); +}; +int nvkm_gsp_new_ (const struct nvkm_gsp_fwif *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **); + +extern const struct nvkm_gsp_func gv100_gsp;#endif
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 2022 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +static struct nvkm_gsp_fwif +tu102_gsps[] = { + {-1 , gv100_gsp_nofw, &gv100_gsp }, + {} +}; + +int +tu102_gsp_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_gsp **pgsp) +{ +return nvkm_gsp_new_ (tu102_gsps, device, type, inst, pgsp); +}
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright 2022 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +static struct nvkm_gsp_fwif +tu116_gsps[] = { + {-1 , gv100_gsp_nofw, &gv100_gsp }, + {} +}; + +int +tu116_gsp_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_gsp **pgsp) +{ +return nvkm_gsp_new_ (tu116_gsps, device, type, inst, pgsp); +}
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 04/44] drm/nouveau/gsp: prepare for GSP-RM
Quoted 194 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
- move TOP after GSP, so we can disable TOP if GSP is in use
- provide plumbing to support falcon-only and GSP-RM paths
- provide a method for subdevs to detect GSP-RM paths
- split tu102/tu116/ga100 paths from gv100, which can't support GSP-RMSigned-off-by Ben Skeggs <[email protected]>--- .../drm/nouveau/include/nvkm/core/layout.h | 2 +- .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 9 ++++ .../gpu/drm/nouveau/nvkm/engine/device/base.c | 11 +++-- .../gpu/drm/nouveau/nvkm/subdev/gsp/Kbuild | 3 ++ .../gpu/drm/nouveau/nvkm/subdev/gsp/base.c | 47 +++++++++++++++++-- .../gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c | 35 ++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 8 +--- .../gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c | 4 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/priv.h | 17 +++++-- .../gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c | 35 ++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c | 35 ++++++++++++++ 11 files changed, 182 insertions(+), 24 deletions(-)create mode 100644
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.ccreate mode 100644drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.ccreate mode 100644drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu116.cdrivers/gpu/drm/nouveau/include/nvkm/core/layout.h +1
-1@@ -1,6 +1,6 @@/* SPDX-License-Identifier: MIT */ -NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TOP , struct nvkm_top , top) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp) +NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TOP , struct nvkm_top , top) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VFN , struct nvkm_vfn , vfn) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PCI , struct nvkm_pci , pci) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios)drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +9
-0@@ -11,6 +11,15 @@ struct nvkm_gsp { struct nvkm_falcon falcon; }; +static inline bool +nvkm_gsp_rm (struct nvkm_gsp *gsp) +{ +return false; +} +int gv100_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **); +int tu102_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **); +int tu116_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **); +int ga100_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int ga102_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);#endif drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +6
-5@@ -2408,7 +2408,7 @@ nv162_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu102_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },@@ -2443,7 +2443,7 @@ nv164_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu102_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },@@ -2478,7 +2478,7 @@ nv166_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu102_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },@@ -2513,7 +2513,7 @@ nv167_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu116_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },@@ -2548,7 +2548,7 @@ nv168_chipset = { .fb = { 0x00000001, tu102_fb_new }, .fuse = { 0x00000001, gm107_fuse_new }, .gpio = { 0x00000001, gk104_gpio_new }, - .gsp = { 0x00000001, gv100_gsp_new }, + .gsp = { 0x00000001, tu116_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .ltc = { 0x00000001, gp102_ltc_new },@@ -2580,6 +2580,7 @@ nv170_chipset = { .fault = { 0x00000001, tu102_fault_new }, .fb = { 0x00000001, ga100_fb_new }, .gpio = { 0x00000001, gk104_gpio_new }, + .gsp = { 0x00000001, ga100_gsp_new }, .i2c = { 0x00000001, gm200_i2c_new }, .imem = { 0x00000001, nv50_instmem_new }, .mc = { 0x00000001, ga100_mc_new },drivers/gpu/drm/nouveau/nvkm/subdev/gsp/Kbuild +3
-0@@ -1,4 +1,7 @@ # SPDX-License-Identifier: MIT nvkm-y += nvkm/subdev/gsp/base.o nvkm-y += nvkm/subdev/gsp/gv100.o +nvkm-y += nvkm/subdev/gsp/tu102.o +nvkm-y += nvkm/subdev/gsp/tu116.o +nvkm-y += nvkm/subdev/gsp/ga100.o nvkm-y += nvkm/subdev/gsp/ga102.odrivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c +40
-4@@ -20,15 +20,48 @@* OTHER DEALINGS IN THE SOFTWARE. */ #include "priv.h" -#include <core/falcon.h> -#include <core/firmware.h> -#include <subdev/acr.h> -#include <subdev/top.h> + +static int +nvkm_gsp_fini (struct nvkm_subdev *subdev,bool suspend) +{ +struct nvkm_gsp *gsp =nvkm_gsp (subdev); + +if (!gsp->func->fini) +return 0 ; + +return gsp->func->fini (gsp, suspend); +} + +static int +nvkm_gsp_init (struct nvkm_subdev *subdev) +{ +struct nvkm_gsp *gsp =nvkm_gsp (subdev); + +if (!gsp->func->init) +return 0 ; + +return gsp->func->init (gsp); +} + +static int +nvkm_gsp_oneinit (struct nvkm_subdev *subdev) +{ +struct nvkm_gsp *gsp =nvkm_gsp (subdev); + +if (!gsp->func->oneinit) +return 0 ; + +return gsp->func->oneinit (gsp); +}static void *nvkm_gsp_dtor (struct nvkm_subdev *subdev) {struct nvkm_gsp *gsp =nvkm_gsp (subdev); + +if (gsp->func && gsp->func->dtor) + gsp->func->dtor (gsp); +nvkm_falcon_dtor (&gsp->falcon);return gsp; }@@ -36,6 +69,9 @@ nvkm_gsp_dtor(struct nvkm_subdev *subdev)static const struct nvkm_subdev_func nvkm_gsp = { .dtor = nvkm_gsp_dtor, + .oneinit = nvkm_gsp_oneinit, + .init = nvkm_gsp_init, + .fini = nvkm_gsp_fini, };int
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device, · line 94
Quoted 5 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c +1
-1@@ -55,5 +91,6 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device, gsp->func = fwif->func; -return nvkm_falcon_ctor (gsp->func->flcn, &gsp->subdev, gsp->subdev.name,0 , &gsp->falcon); + return nvkm_falcon_ctor(gsp->func->flcn, &gsp->subdev, gsp->subdev.name, 0x110000,
Is this the GSP Falcon base register offset?
Quoted 19 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c +1
-0+ &gsp->falcon); }drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c new file +11
-0@@ -0,0 +1,35 @@ +/* +* Copyright 2022 Red Hat Inc. +* +* 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
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c line 21
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c new file +10
-0+* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. +*/
Should probably prefer SPDX licence tags here, below and in quite a few other places.
Quoted 170 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c new file +14
-0+#include "priv.h" + +static struct nvkm_gsp_fwif +ga100_gsps[] = { + {-1 , gv100_gsp_nofw, &gv100_gsp }, + {} +}; + +int +ga100_gsp_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_gsp **pgsp) +{ +return nvkm_gsp_new_ (ga100_gsps, device, type, inst, pgsp); +}drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c +1
-7@@ -39,15 +39,9 @@ ga102_gsp = { .flcn = &ga102_gsp_flcn, }; -static int -ga102_gsp_nofw (struct nvkm_gsp *gsp,int ver,const struct nvkm_gsp_fwif *fwif) -{ -return 0 ; -} -static struct nvkm_gsp_fwif ga102_gsps[] = { - {-1 , ga102_gsp_nofw, &ga102_gsp }, + {-1 , gv100_gsp_nofw, &ga102_gsp }, {} };drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c +2
-2@@ -34,12 +34,12 @@ gv100_gsp_flcn = { .dmem_pio = &gm200_flcn_dmem_pio, }; -static const struct nvkm_gsp_func +const struct nvkm_gsp_func gv100_gsp = { .flcn = &gv100_gsp_flcn, }; -static int +int gv100_gsp_nofw (struct nvkm_gsp *gsp,int ver,const struct nvkm_gsp_fwif *fwif) {return 0 ;drivers/gpu/drm/nouveau/nvkm/subdev/gsp/priv.h +13
-4@@ -4,16 +4,25 @@#include <subdev/gsp.h> enum nvkm_acr_lsf_id ; -struct nvkm_gsp_func { -const struct nvkm_falcon_func *flcn; -}; -struct nvkm_gsp_fwif {int version;int (*load)(struct nvkm_gsp *,int ver,const struct nvkm_gsp_fwif *);const struct nvkm_gsp_func *func; }; +int gv100_gsp_nofw (struct nvkm_gsp *,int ,const struct nvkm_gsp_fwif *); + +struct nvkm_gsp_func { +const struct nvkm_falcon_func *flcn; + +void (*dtor)(struct nvkm_gsp *); +int (*oneinit)(struct nvkm_gsp *); +int (*init)(struct nvkm_gsp *); +int (*fini)(struct nvkm_gsp *,bool suspend); +}; +int nvkm_gsp_new_ (const struct nvkm_gsp_fwif *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **); + +extern const struct nvkm_gsp_func gv100_gsp;#endif drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c new file +35
-0@@ -0,0 +1,35 @@ +/* +* Copyright 2022 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +static struct nvkm_gsp_fwif +tu102_gsps[] = { + {-1 , gv100_gsp_nofw, &gv100_gsp }, + {} +}; + +int +tu102_gsp_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_gsp **pgsp) +{ +return nvkm_gsp_new_ (tu102_gsps, device, type, inst, pgsp); +}drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c new file +35
-0@@ -0,0 +1,35 @@ +/* +* Copyright 2022 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +static struct nvkm_gsp_fwif +tu116_gsps[] = { + {-1 , gv100_gsp_nofw, &gv100_gsp }, + {} +}; + +int +tu116_gsp_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_gsp **pgsp) +{ +return nvkm_gsp_new_ (tu116_gsps, device, type, inst, pgsp); +}
PATCH 5/44 drm/nouveau/acr/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable ACR completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c | 4 ++++ drivers/gpu/drm/nouveau/nvkm/subdev/acr/tu102.c | 3 +++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c +4 -0
@@ -20,6 +20,7 @@* OTHER DEALINGS IN THE SOFTWARE. */ #include "priv.h" +#include <subdev/gsp.h> #include <nvfw/acr.h>
@@ -322,5 +323,8 @@ int ga102_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_acr **pacr) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_acr_new_(ga102_acr_fwif, device, type, inst, pacr); }
drivers/gpu/drm/nouveau/nvkm/subdev/acr/tu102.c +3 -0
@@ -201,5 +201,8 @@ int tu102_acr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_acr **pacr) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_acr_new_(tu102_acr_fwif, device, type, inst, pacr); }
Signature · 1 line
2.41.0
PATCH 6/44 drm/nouveau/bar/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
- move BAR2 teardown from dtor(), it doesn't belong there
--- drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c | 10 +++++++++- drivers/gpu/drm/nouveau/nvkm/subdev/bar/tu102.c | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c +9 -1
@@ -93,8 +93,16 @@ static int nvkm_bar_fini(struct nvkm_subdev *subdev, bool suspend) {struct nvkm_bar *bar =nvkm_bar (subdev); + +if (!subdev->use.enabled) +return 0 ; +if (bar->func->bar1.fini) bar->func->bar1.fini (bar); + +if (!suspend)/* Handled by instmem. */ +nvkm_bar_bar2_fini (subdev->device); +return 0 ; }
@@ -120,7 +128,7 @@ static void * nvkm_bar_dtor(struct nvkm_subdev *subdev) {struct nvkm_bar *bar =nvkm_bar (subdev); -nvkm_bar_bar2_fini (subdev->device); +return bar->func->dtor (bar); }
drivers/gpu/drm/nouveau/nvkm/subdev/bar/tu102.c +4 -0
@@ -22,6 +22,7 @@#include "gf100.h" #include <core/memory.h> +#include <subdev/gsp.h> #include <subdev/timer.h> static void
@@ -95,5 +96,8 @@ int tu102_bar_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_bar **pbar) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return gf100_bar_new_(&tu102_bar, device, type, inst, pbar); }
Signature · 1 line
2.41.0
PATCH 7/44 drm/nouveau/bus/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable BUS completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/bus/gf100.c +5 -0
@@ -24,6 +24,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static void gf100_bus_intr (struct nvkm_bus *bus) {
@@ -72,5 +74,8 @@ int gf100_bus_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_bus **pbus) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_bus_new_(&gf100_bus, device, type, inst, pbus); }
Signature · 1 line
2.41.0
PATCH 8/44 drm/nouveau/devinit/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- add R535 implementation of DEVINIT, we need some of this for boot
- add display disable fuse for ga100-
--- .../drm/nouveau/nvkm/subdev/devinit/Kbuild | 2 + .../drm/nouveau/nvkm/subdev/devinit/ga100.c | 15 ++++++ .../drm/nouveau/nvkm/subdev/devinit/priv.h | 3 ++ .../drm/nouveau/nvkm/subdev/devinit/r535.c | 51 +++++++++++++++++++ .../drm/nouveau/nvkm/subdev/devinit/tu102.c | 4 ++ 5 files changed, 75 insertions(+) create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/Kbuild +2 -0
@@ -16,3 +16,5 @@ nvkm-y += nvkm/subdev/devinit/gm200.o nvkm-y += nvkm/subdev/devinit/gv100.o nvkm-y += nvkm/subdev/devinit/tu102.o nvkm-y += nvkm/subdev/devinit/ga100.o + +nvkm-y += nvkm/subdev/devinit/r535.o
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/ga100.c +15 -0
@@ -24,6 +24,7 @@#include <subdev/bios.h> #include <subdev/bios/pll.h> #include <subdev/clk/pll.h> +#include <subdev/gsp.h> static int ga100_devinit_pll_set (struct nvkm_devinit *init,u32 type,u32 freq)
@@ -62,8 +63,19 @@ ga100_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)return ret; } +static void +ga100_devinit_disable (struct nvkm_devinit *init) +{ +struct nvkm_device *device = init->subdev.device; +u32 r820c04 =nvkm_rd32 (device,0x820c04 ); + +if (r820c04 &0x00000001 ) +nvkm_subdev_disable (device,NVKM_ENGINE_DISP ,0 ); +} +static const struct nvkm_devinit_func ga100_devinit = { + .disable = ga100_devinit_disable, .init = nv50_devinit_init, .post = tu102_devinit_post, .pll_set = ga100_devinit_pll_set,
@@ -73,5 +85,8 @@ int ga100_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_devinit **pinit) { + if (nvkm_gsp_rm(device->gsp)) + return r535_devinit_new(&ga100_devinit, device, type, inst, pinit); + return nv50_devinit_new_(&ga100_devinit, device, type, inst, pinit); }
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/priv.h +3 -0
@@ -4,6 +4,9 @@#define nvkm_devinit (p) container_of((p), struct nvkm_devinit, subdev)#include <subdev/devinit.h> +int r535_devinit_new (const struct nvkm_devinit_func *, +struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_devinit **); +struct nvkm_devinit_func {void *(*dtor)(struct nvkm_devinit *);void (*preinit)(struct nvkm_devinit *);
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c new file +51 -0
51 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/tu102.c +4 -0
@@ -24,6 +24,7 @@#include <subdev/bios.h> #include <subdev/bios/pll.h> #include <subdev/clk/pll.h> +#include <subdev/gsp.h> static int tu102_devinit_pll_set (struct nvkm_devinit *init,u32 type,u32 freq)
@@ -100,5 +101,8 @@ int tu102_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_devinit **pinit) { + if (nvkm_gsp_rm(device->gsp)) + return r535_devinit_new(&tu102_devinit, device, type, inst, pinit); + return nv50_devinit_new_(&tu102_devinit, device, type, inst, pinit); }
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 08/44] drm/nouveau/devinit/tu102-: prepare for GSP-RM
Quoted 38 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
- add R535 implementation of DEVINIT, we need some of this for boot
- add display disable fuse for ga100-Signed-off-by Ben Skeggs <[email protected]>--- .../drm/nouveau/nvkm/subdev/devinit/Kbuild | 2 + .../drm/nouveau/nvkm/subdev/devinit/ga100.c | 15 ++++++ .../drm/nouveau/nvkm/subdev/devinit/priv.h | 3 ++ .../drm/nouveau/nvkm/subdev/devinit/r535.c | 51 +++++++++++++++++++ .../drm/nouveau/nvkm/subdev/devinit/tu102.c | 4 ++ 5 files changed, 75 insertions(+)create mode 100644
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.cdrivers/gpu/drm/nouveau/nvkm/subdev/devinit/Kbuild +2
-0@@ -16,3 +16,5 @@ nvkm-y += nvkm/subdev/devinit/gm200.o nvkm-y += nvkm/subdev/devinit/gv100.o nvkm-y += nvkm/subdev/devinit/tu102.o nvkm-y += nvkm/subdev/devinit/ga100.o + +nvkm-y += nvkm/subdev/devinit/r535.odrivers/gpu/drm/nouveau/nvkm/subdev/devinit/ga100.c +1
-0@@ -24,6 +24,7 @@#include <subdev/bios.h> #include <subdev/bios/pll.h> #include <subdev/clk/pll.h> +#include <subdev/gsp.h> static int ga100_devinit_pll_set (struct nvkm_devinit *init,u32 type,u32 freq)
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/ga100.c ga100_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq) · line 70
Quoted 8 lines
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/ga100.c +5
-0@@ -62,8 +63,19 @@ ga100_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)return ret; } +static void +ga100_devinit_disable (struct nvkm_devinit *init) +{ +struct nvkm_device *device = init->subdev.device; +u32 r820c04 =nvkm_rd32 (device,0x820c04 );
I'd probably prefer to use NV_FUSE_STATUS_OPT_DISPLAY or a custom define. 'r820c04' could just be data, reg, val or similar.
Quoted 111 lines
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/ga100.c +9
-0+ +if (r820c04 &0x00000001 ) +nvkm_subdev_disable (device,NVKM_ENGINE_DISP ,0 ); +} +static const struct nvkm_devinit_func ga100_devinit = { + .disable = ga100_devinit_disable, .init = nv50_devinit_init, .post = tu102_devinit_post, .pll_set = ga100_devinit_pll_set,@@ -73,5 +85,8 @@ int ga100_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_devinit **pinit) { + if (nvkm_gsp_rm(device->gsp)) + return r535_devinit_new(&ga100_devinit, device, type, inst, pinit); + return nv50_devinit_new_(&ga100_devinit, device, type, inst, pinit); }drivers/gpu/drm/nouveau/nvkm/subdev/devinit/priv.h +3
-0@@ -4,6 +4,9 @@#define nvkm_devinit (p) container_of((p), struct nvkm_devinit, subdev)#include <subdev/devinit.h> +int r535_devinit_new (const struct nvkm_devinit_func *, +struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_devinit **); +struct nvkm_devinit_func {void *(*dtor)(struct nvkm_devinit *);void (*preinit)(struct nvkm_devinit *);drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c new file +50
-0@@ -0,0 +1,51 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "nv50.h" + +static void * +r535_devinit_dtor (struct nvkm_devinit *devinit) +{ +kfree (devinit->func); +return devinit; +} + +int +r535_devinit_new (const struct nvkm_devinit_func *hw, +struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_devinit **pdevinit) +{ +struct nvkm_devinit_func *rm; +int ret; + +if (!(rm =kzalloc (sizeof (*rm),GFP_KERNEL ))) +return -ENOMEM ; + + rm->dtor = r535_devinit_dtor; + rm->post = hw->post; + rm->disable = hw->disable; + + ret =nv50_devinit_new_ (rm, device, type, inst, pdevinit); +if (ret) +kfree (rm); + +return ret; +}drivers/gpu/drm/nouveau/nvkm/subdev/devinit/tu102.c +4
-0@@ -24,6 +24,7 @@#include <subdev/bios.h> #include <subdev/bios/pll.h> #include <subdev/clk/pll.h> +#include <subdev/gsp.h> static int tu102_devinit_pll_set (struct nvkm_devinit *init,u32 type,u32 freq)@@ -100,5 +101,8 @@ int tu102_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_devinit **pinit) { + if (nvkm_gsp_rm(device->gsp)) + return r535_devinit_new(&tu102_devinit, device, type, inst, pinit); + return nv50_devinit_new_(&tu102_devinit, device, type, inst, pinit); }
PATCH 9/44 drm/nouveau/fault/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable FAULT completely when GSP-RM detected
- SVM support will be disabled when running on RM because of this
--- drivers/gpu/drm/nouveau/nvkm/subdev/fault/tu102.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/fault/tu102.c +7 -1
@@ -22,6 +22,7 @@#include "priv.h" #include <core/memory.h> +#include <subdev/gsp.h> #include <subdev/mc.h> #include <subdev/mmu.h> #include <subdev/vfn.h>
@@ -175,7 +176,12 @@ int tu102_fault_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fault **pfault) { - int ret = nvkm_fault_new_(&tu102_fault, device, type, inst, pfault); + int ret; + +if (nvkm_gsp_rm (device->gsp)) +return -ENODEV ; + + ret =nvkm_fault_new_ (&tu102_fault, device, type, inst, pfault);if (ret)return ret;
Signature · 1 line
2.41.0
PATCH 10/44 drm/nouveau/fb/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- add (initial) R535 implementation of FB, need VRAM size etc for boot
- expose a way to "wrap" vram at a specific address/size as a standard nvkm_memory allocation, which will be used to write PTEs etc for RM- defined memory regions
--- .../gpu/drm/nouveau/include/nvkm/subdev/fb.h | 6 +-- drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/fb/ga100.c | 5 ++ .../gpu/drm/nouveau/nvkm/subdev/fb/ga102.c | 4 ++ drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h | 3 ++ drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c | 50 +++++++++++++++++++ drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.c | 46 +++++++++++++++-- .../gpu/drm/nouveau/nvkm/subdev/fb/tu102.c | 5 ++ 8 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h +3 -3
@@ -158,9 +158,9 @@ struct nvkm_ram {struct nvkm_ram_data target; }; -int -nvkm_ram_get (struct nvkm_device *,u8 heap,u8 type,u8 page,u64 size, -bool contig,bool back,struct nvkm_memory **); +int nvkm_ram_wrap (struct nvkm_device *,u64 addr,u64 size,struct nvkm_memory **); +int nvkm_ram_get (struct nvkm_device *,u8 heap,u8 type,u8 page,u64 size, +bool contig,bool back,struct nvkm_memory **);struct nvkm_ram_func {u64 upper;
drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild +2 -0
@@ -36,6 +36,8 @@ nvkm-y += nvkm/subdev/fb/tu102.o nvkm-y += nvkm/subdev/fb/ga100.o nvkm-y += nvkm/subdev/fb/ga102.o +nvkm-y += nvkm/subdev/fb/r535.o + nvkm-y += nvkm/subdev/fb/ram.o nvkm-y += nvkm/subdev/fb/ramnv04.o nvkm-y += nvkm/subdev/fb/ramnv10.o
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ga100.c +5 -0
@@ -22,6 +22,8 @@#include "gf100.h" #include "ram.h" +#include <subdev/gsp.h> +static const struct nvkm_fb_func ga100_fb = { .dtor = gf100_fb_dtor,
@@ -38,5 +40,8 @@ ga100_fb = {int ga100_fb_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_fb **pfb) { +if (nvkm_gsp_rm (device->gsp)) +return r535_fb_new (&ga100_fb, device, type, inst, pfb); +return gf100_fb_new_ (&ga100_fb, device, type, inst, pfb); }
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ga102.c +4 -0
@@ -22,6 +22,7 @@#include "gf100.h" #include "ram.h" +#include <subdev/gsp.h> #include <engine/nvdec.h> static u64
@@ -59,6 +60,9 @@ ga102_fb = {int ga102_fb_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_fb **pfb) { +if (nvkm_gsp_rm (device->gsp)) +return r535_fb_new (&ga102_fb, device, type, inst, pfb); +return gf100_fb_new_ (&ga102_fb, device, type, inst, pfb); }
drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h +3 -0
@@ -6,6 +6,9 @@#include <subdev/therm.h> struct nvkm_bios ; +int r535_fb_new (const struct nvkm_fb_func *, +struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_fb **); +struct nvkm_fb_func {void *(*dtor)(struct nvkm_fb *);u32 (*tags)(struct nvkm_fb *);
drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.c +41 -5
59 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/fb/tu102.c +5 -0
@@ -22,6 +22,8 @@#include "gf100.h" #include "ram.h" +#include <subdev/gsp.h> +bool tu102_fb_vpr_scrub_required (struct nvkm_fb *fb) {
@@ -46,6 +48,9 @@ tu102_fb = {int tu102_fb_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_fb **pfb) { +if (nvkm_gsp_rm (device->gsp)) +return r535_fb_new (&tu102_fb, device, type, inst, pfb); +return gf100_fb_new_ (&tu102_fb, device, type, inst, pfb); }
Signature · 1 line
2.41.0
PATCH 11/44 drm/nouveau/fuse/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable FUSE completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/gm107.c +5 -0
@@ -23,6 +23,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static u32 gm107_fuse_read (struct nvkm_fuse *fuse,u32 addr) {
@@ -39,5 +41,8 @@ int gm107_fuse_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fuse **pfuse) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_fuse_new_(&gm107_fuse, device, type, inst, pfuse); }
Signature · 1 line
2.41.0
PATCH 12/44 drm/nouveau/gpio/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable GPIO completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/gpio/ga102.c | 5 +++++ drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c | 5 +++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/ga102.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static void ga102_gpio_reset (struct nvkm_gpio *gpio,u8 match) {
@@ -115,5 +117,8 @@ int ga102_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gpio **pgpio) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_gpio_new_(&ga102_gpio, device, type, inst, pgpio); }
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c +5 -0
@@ -23,6 +23,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static void gk104_gpio_intr_stat (struct nvkm_gpio *gpio,u32 *hi,u32 *lo) {
@@ -71,5 +73,8 @@ int gk104_gpio_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gpio **pgpio) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_gpio_new_(&gk104_gpio, device, type, inst, pgpio); }
Signature · 1 line
2.41.0
PATCH 13/44 drm/nouveau/i2c/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable I2C completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm200.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm200.c +5 -0
@@ -24,6 +24,8 @@#include "priv.h" #include "pad.h" +#include <subdev/gsp.h> +static void gm200_aux_autodpcd (struct nvkm_i2c *i2c,int aux,bool enable) {
@@ -44,5 +46,8 @@ int gm200_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_i2c **pi2c) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_i2c_new_(&gm200_i2c, device, type, inst, pi2c); }
Signature · 1 line
2.41.0
PATCH 14/44 drm/nouveau/imem/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- move suspend/resume paths to HW-specific code
- allow (future) RM paths to be based on nv50_instmem
--- .../drm/nouveau/include/nvkm/subdev/instmem.h | 2 + .../drm/nouveau/nvkm/subdev/instmem/base.c | 40 ++++++----------- .../drm/nouveau/nvkm/subdev/instmem/gk20a.c | 2 + .../drm/nouveau/nvkm/subdev/instmem/nv04.c | 45 +++++++++++++++++++ .../drm/nouveau/nvkm/subdev/instmem/nv50.c | 27 +++++++++-- .../drm/nouveau/nvkm/subdev/instmem/priv.h | 10 +++++ 6 files changed, 96 insertions(+), 30 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/subdev/instmem.h +2 -0
@@ -8,6 +8,8 @@ struct nvkm_instmem {const struct nvkm_instmem_func *func;struct nvkm_subdev subdev; +bool suspend; +spinlock_t lock;struct list_head list;struct list_head boot;
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c +13 -27
@@ -28,7 +28,7 @@/****************************************************************************** * instmem object base implementation *****************************************************************************/ -static void +void nvkm_instobj_load (struct nvkm_instobj *iobj) {struct nvkm_memory *memory = &iobj->memory;
@@ -48,7 +48,7 @@ nvkm_instobj_load(struct nvkm_instobj *iobj) iobj->suspend =NULL ; } -static int +int nvkm_instobj_save (struct nvkm_instobj *iobj) {struct nvkm_memory *memory = &iobj->memory;
@@ -179,24 +179,14 @@ static int nvkm_instmem_fini(struct nvkm_subdev *subdev, bool suspend) {struct nvkm_instmem *imem =nvkm_instmem (subdev); -struct nvkm_instobj *iobj; +int ret;if (suspend) { -list_for_each_entry (iobj, &imem->list, head) { -if (iobj->preserve) { -int ret =nvkm_instobj_save (iobj); -if (ret) -return ret; - } - } - -nvkm_bar_bar2_fini (subdev->device); + ret = imem->func->suspend (imem); +if (ret) +return ret; -list_for_each_entry (iobj, &imem->boot, head) { -int ret =nvkm_instobj_save (iobj); -if (ret) -return ret; - } + imem->suspend = true; }if (imem->func->fini)
@@ -209,20 +199,16 @@ static int nvkm_instmem_init(struct nvkm_subdev *subdev) {struct nvkm_instmem *imem =nvkm_instmem (subdev); -struct nvkm_instobj *iobj; -list_for_each_entry (iobj, &imem->boot, head) { -if (iobj->suspend) -nvkm_instobj_load (iobj); - } +if (imem->suspend) { +if (imem->func->resume) + imem->func->resume (imem); -nvkm_bar_bar2_init (subdev->device); - -list_for_each_entry (iobj, &imem->list, head) { -if (iobj->suspend) -nvkm_instobj_load (iobj); + imem->suspend = false; +return 0 ; } +nvkm_bar_bar2_init (subdev->device);return 0 ; }
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c +2 -0
@@ -564,6 +564,8 @@ gk20a_instmem_dtor(struct nvkm_instmem *base)static const struct nvkm_instmem_func gk20a_instmem = { .dtor = gk20a_instmem_dtor, + .suspend = nv04_instmem_suspend, + .resume = nv04_instmem_resume, .memory_new = gk20a_instobj_new, .zero = false, };
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c +45 -0
63 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c +24 -3
@@ -27,6 +27,7 @@#include <core/memory.h> #include <subdev/bar.h> #include <subdev/fb.h> +#include <subdev/gsp.h> #include <subdev/mmu.h> struct nv50_instmem {
@@ -394,24 +395,44 @@ nv50_instmem_fini(struct nvkm_instmem *base)nv50_instmem (base)->addr = ~0ULL ; } +static void * +nv50_instmem_dtor (struct nvkm_instmem *base) +{ +return nv50_instmem (base); +} +static const struct nvkm_instmem_func nv50_instmem = { + .dtor = nv50_instmem_dtor, .fini = nv50_instmem_fini, + .suspend = nv04_instmem_suspend, + .resume = nv04_instmem_resume, .memory_new = nv50_instobj_new, .memory_wrap = nv50_instobj_wrap, .zero = false, };int -nv50_instmem_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, -struct nvkm_instmem **pimem) +nv50_instmem_new_ (const struct nvkm_instmem_func *func, +struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_instmem **pimem) {struct nv50_instmem *imem;if (!(imem =kzalloc (sizeof (*imem),GFP_KERNEL )))return -ENOMEM ; -nvkm_instmem_ctor (&nv50_instmem, device, type, inst, &imem->base); +nvkm_instmem_ctor (func, device, type, inst, &imem->base);INIT_LIST_HEAD (&imem->lru); *pimem = &imem->base;return 0 ; } + +int +nv50_instmem_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_instmem **pimem) +{ +if (nvkm_gsp_rm (device->gsp)) +return -ENODEV ; + +return nv50_instmem_new_ (&nv50_instmem, device, type, inst, pimem); +}
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/priv.h +10 -0
@@ -7,6 +7,8 @@struct nvkm_instmem_func {void *(*dtor)(struct nvkm_instmem *);int (*oneinit)(struct nvkm_instmem *); +int (*suspend)(struct nvkm_instmem *); +void (*resume)(struct nvkm_instmem *);void (*fini)(struct nvkm_instmem *);u32 (*rd32)(struct nvkm_instmem *,u32 addr);void (*wr32)(struct nvkm_instmem *,u32 addr,u32 data);
@@ -16,10 +18,16 @@ struct nvkm_instmem_func {bool zero; }; +int nv50_instmem_new_ (const struct nvkm_instmem_func *,struct nvkm_device *, +enum nvkm_subdev_type ,int ,struct nvkm_instmem **); +void nvkm_instmem_ctor (const struct nvkm_instmem_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_instmem *);void nvkm_instmem_boot (struct nvkm_instmem *); +int nv04_instmem_suspend (struct nvkm_instmem *); +void nv04_instmem_resume (struct nvkm_instmem *); +#include <core/memory.h> struct nvkm_instobj {
@@ -32,4 +40,6 @@ struct nvkm_instobj {void nvkm_instobj_ctor (const struct nvkm_memory_func *func,struct nvkm_instmem *,struct nvkm_instobj *);void nvkm_instobj_dtor (struct nvkm_instmem *,struct nvkm_instobj *); +int nvkm_instobj_save (struct nvkm_instobj *); +void nvkm_instobj_load (struct nvkm_instobj *);#endif
Signature · 1 line
2.41.0
PATCH 15/44 drm/nouveau/ltc/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable LTC completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/ltc/ga102.c | 5 +++++ drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gp102.c | 5 +++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/ga102.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static void ga102_ltc_zbc_clear_color (struct nvkm_ltc *ltc,int i,const u32 color[4 ]) {
@@ -53,5 +55,8 @@ int ga102_ltc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_ltc **pltc) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_ltc_new_(&ga102_ltc, device, type, inst, pltc); }
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gp102.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +void gp102_ltc_zbc_clear_stencil (struct nvkm_ltc *ltc,int i,const u32 stencil) {
@@ -49,5 +51,8 @@ int gp102_ltc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_ltc **pltc) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_ltc_new_(&gp102_ltc, device, type, inst, pltc); }
Signature · 1 line
2.41.0
PATCH 16/44 drm/nouveau/mc/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable MC completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/mc/ga100.c | 5 +++++ drivers/gpu/drm/nouveau/nvkm/subdev/mc/gp100.c | 5 +++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/mc/ga100.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static void ga100_mc_device_disable (struct nvkm_mc *mc,u32 mask) {
@@ -72,5 +74,8 @@ ga100_mc = {int ga100_mc_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_mc **pmc) { +if (nvkm_gsp_rm (device->gsp)) +return -ENODEV ; +return nvkm_mc_new_ (&ga100_mc, device, type, inst, pmc); }
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gp100.c +5 -0
@@ -23,6 +23,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +const struct nvkm_intr_data gp100_mc_intrs[] = { {NVKM_ENGINE_DISP ,0 ,0 ,0x04000000 , true },
@@ -98,5 +100,8 @@ gp100_mc = {int gp100_mc_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_mc **pmc) { +if (nvkm_gsp_rm (device->gsp)) +return -ENODEV ; +return nvkm_mc_new_ (&gp100_mc, device, type, inst, pmc); }
Signature · 1 line
2.41.0
PATCH 17/44 drm/nouveau/mmu/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
--- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c +4 -0
@@ -24,6 +24,7 @@#include "vmm.h" #include <core/option.h> +#include <subdev/gsp.h> #include <nvif/class.h>
@@ -54,5 +55,8 @@ int tu102_mmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_mmu **pmmu) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_mmu_new_(&tu102_mmu, device, type, inst, pmmu); }
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 17/44] drm/nouveau/mmu/tu102-: prepare for GSP-RM
Quoted 3 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
disable _what_?
The other commit messages at least briefly name the component. This one should as well.
Furthermore, I'd say that the wording should be something like "will be enabled again later, after XXX has been done".
P.
Quoted 29 lines
Signed-off-by Ben Skeggs <[email protected]>---
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c | 4 ++++1 file changed, 4 insertions(+)drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c +0
-0@@ -24,6 +24,7 @@ #include "vmm.h"
#include <core/option.h>
+#include <subdev/gsp.h>
#include <nvif/class.h>drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c +0
-0@@ -54,5 +55,8 @@ inttu102_mmu_new(struct
nvkm_device*device, enumnvkm_subdev_typetype, int inst,
structnvkm_mmu**pmmu)
{
+ if (nvkm_gsp_rm(device->gsp))
+ return-ENODEV;
+
returnnvkm_mmu_new_(&tu102_mmu, device, type, inst, pmmu); }
Re: [Nouveau] [PATCH 17/44] drm/nouveau/mmu/tu102-: prepare for GSP-RM
Quoted 11 lines · Philipp Stanner
Quoted 3 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
disable _what_?
The other commit messages at least briefly name the component. This one should as well.Furthermore, I'd say that the wording should be something like "will be enabled again later, after XXX has been done".
True. However, I think the clue is in the commit title: mmu/tu102
So, here is how I would rewrite this commit message:
Disable kernel-side MMU management when using the GSP firmware. This will be re-introduced as a call to the GSP firmware in a future commit.
The latter is partial speculation, but I hope this helps!
Cheers,
Martin
Quoted 33 lines
P.
Quoted 29 lines
Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c +4
-0@@ -24,6 +24,7 @@ #include "vmm.h" #include <core/option.h> +#include <subdev/gsp.h> #include <nvif/class.h>@@ -54,5 +55,8 @@ int tu102_mmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_mmu **pmmu) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_mmu_new_(&tu102_mmu, device, type, inst, pmmu);}
PATCH 18/44 drm/nouveau/pmu/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable PMU completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c +5 -0
@@ -23,6 +23,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static const struct nvkm_falcon_func gp102_pmu_flcn = { .disable = gm200_flcn_disable,
@@ -54,5 +56,8 @@ int gp102_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_pmu **ppmu) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_pmu_new_(gp102_pmu_fwif, device, type, inst, ppmu); }
Signature · 1 line
2.41.0
PATCH 19/44 drm/nouveau/privring/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable PRIVRING completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/privring/gm200.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/privring/gm200.c +5 -0
@@ -23,6 +23,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static const struct nvkm_subdev_func gm200_privring = { .intr = gk104_privring_intr,
@@ -32,5 +34,8 @@ int gm200_privring_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_subdev **pprivring) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_subdev_new_(&gm200_privring, device, type, inst, pprivring); }
Signature · 1 line
2.41.0
PATCH 20/44 drm/nouveau/therm/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable THERM completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/therm/gp100.c +5 -0
@@ -23,6 +23,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static int gp100_temp_get (struct nvkm_therm *therm) {
@@ -52,5 +54,8 @@ int gp100_therm_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_therm **ptherm) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_therm_new_(&gp100_therm, device, type, inst, ptherm); }
Signature · 1 line
2.41.0
PATCH 21/44 drm/nouveau/top/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- disable TOP completely when GSP-RM detected
--- drivers/gpu/drm/nouveau/nvkm/subdev/top/ga100.c | 5 +++++ drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c | 5 +++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/top/ga100.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static int ga100_top_parse (struct nvkm_top *top) {
@@ -104,5 +106,8 @@ int ga100_top_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_top **ptop) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_top_new_(&ga100_top, device, type, inst, ptop); }
drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c +5 -0
@@ -23,6 +23,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +static int gk104_top_parse (struct nvkm_top *top) {
@@ -115,5 +117,8 @@ int gk104_top_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_top **ptop) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_top_new_(&gk104_top, device, type, inst, ptop); }
Signature · 1 line
2.41.0
PATCH 22/44 drm/nouveau/vfn/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- add R535 implementation of VFN, minus interrupt table
--- .../gpu/drm/nouveau/nvkm/subdev/vfn/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/vfn/ga100.c | 5 ++ .../gpu/drm/nouveau/nvkm/subdev/vfn/priv.h | 7 ++- .../gpu/drm/nouveau/nvkm/subdev/vfn/r535.c | 50 +++++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/vfn/tu102.c | 5 ++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/vfn/r535.c
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/Kbuild +2 -0
@@ -4,3 +4,5 @@ nvkm-y += nvkm/subdev/vfn/uvfn.o nvkm-y += nvkm/subdev/vfn/gv100.o nvkm-y += nvkm/subdev/vfn/tu102.o nvkm-y += nvkm/subdev/vfn/ga100.o + +nvkm-y += nvkm/subdev/vfn/r535.o
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/ga100.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +#include <nvif/class.h> static const struct nvkm_intr_data
@@ -43,5 +45,8 @@ int ga100_vfn_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_vfn **pvfn) { + if (nvkm_gsp_rm(device->gsp)) + return r535_vfn_new(&ga100_vfn, device, type, inst, 0xb80000, pvfn); +return nvkm_vfn_new_ (&ga100_vfn, device, type, inst,0xb80000 , pvfn); }
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/priv.h +6 -1
@@ -5,16 +5,21 @@#include <subdev/vfn.h> struct nvkm_vfn_func { +void (*dtor)(struct nvkm_vfn *); +const struct nvkm_intr_func *intr;const struct nvkm_intr_data *intrs;struct {u32 addr;u32 size; -const struct nvkm_sclass base; +struct nvkm_sclass base; } user; }; +int r535_vfn_new (const struct nvkm_vfn_func *hw,struct nvkm_device *,enum nvkm_subdev_type ,int , +u32 addr,struct nvkm_vfn **); +int nvkm_vfn_new_ (const struct nvkm_vfn_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,u32 addr,struct nvkm_vfn **);
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/r535.c new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/tu102.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +#include <nvif/class.h> static void
@@ -104,5 +106,8 @@ int tu102_vfn_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_vfn **pvfn) { + if (nvkm_gsp_rm(device->gsp)) + return r535_vfn_new(&tu102_vfn, device, type, inst, 0xb80000, pvfn); +return nvkm_vfn_new_ (&tu102_vfn, device, type, inst,0xb80000 , pvfn); }
Signature · 1 line
2.41.0
PATCH 23/44 drm/nouveau/ce/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
--- drivers/gpu/drm/nouveau/nvkm/engine/ce/ga100.c | 4 ++++ drivers/gpu/drm/nouveau/nvkm/engine/ce/ga102.c | 5 +++++ drivers/gpu/drm/nouveau/nvkm/engine/ce/tu102.c | 5 +++++ 3 files changed, 14 insertions(+)
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga100.c +4 -0
@@ -21,6 +21,7 @@*/ #include "priv.h" +#include <subdev/gsp.h> #include <subdev/vfn.h> #include <nvif/class.h>
@@ -88,5 +89,8 @@ int ga100_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_engine_new_(&ga100_ce, device, type, inst, true, pengine); }
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga102.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +#include <nvif/class.h> static const struct nvkm_engine_func
@@ -41,5 +43,8 @@ int ga102_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_engine_new_(&ga102_ce, device, type, inst, true, pengine); }
drivers/gpu/drm/nouveau/nvkm/engine/ce/tu102.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +#include <nvif/class.h> static const struct nvkm_engine_func
@@ -37,5 +39,8 @@ int tu102_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_engine_new_(&tu102_ce, device, type, inst, true, pengine); }
Signature · 1 line
2.41.0
PATCH 24/44 drm/nouveau/disp/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
- pass "suspend" flag down to chipset-specific DISP code
--- drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c | 5 ++++- drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c | 4 ++++ drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h | 11 ++++++----- drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c | 4 ++++ 7 files changed, 21 insertions(+), 9 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c +4 -1
@@ -105,7 +105,7 @@ nvkm_disp_fini(struct nvkm_engine *engine, bool suspend)struct nvkm_outp *outp;if (disp->func->fini) - disp->func->fini (disp); + disp->func->fini (disp, suspend);list_for_each_entry (outp, &disp->outps, head) {if (outp->func->fini)
@@ -208,6 +208,9 @@ nvkm_disp_dtor(struct nvkm_engine *engine)nvkm_head_del (&head); } +if (disp->func->dtor) + disp->func->dtor (disp); +return data; }
drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c +4 -0
@@ -24,6 +24,7 @@#include "head.h" #include "ior.h" +#include <subdev/gsp.h> #include <subdev/timer.h> #include <nvif/class.h>
@@ -147,5 +148,8 @@ int ga102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_disp **pdisp) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_disp_new_(&ga102_disp, device, type, inst, pdisp); }
drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c +1 -1
@@ -1154,7 +1154,7 @@ gf119_disp_intr(struct nvkm_disp *disp) }void -gf119_disp_fini (struct nvkm_disp *disp) +gf119_disp_fini (struct nvkm_disp *disp,bool suspend) {struct nvkm_device *device = disp->engine.subdev.device;/* disable all interrupts */
drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c +1 -1
@@ -1115,7 +1115,7 @@ gv100_disp_intr(struct nvkm_disp *disp) }void -gv100_disp_fini (struct nvkm_disp *disp) +gv100_disp_fini (struct nvkm_disp *disp,bool suspend) {struct nvkm_device *device = disp->engine.subdev.device;nvkm_wr32 (device,0x611db0 ,0x00000000 );
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c +1 -1
@@ -1504,7 +1504,7 @@ nv50_disp_intr(struct nvkm_disp *disp) }void -nv50_disp_fini (struct nvkm_disp *disp) +nv50_disp_fini (struct nvkm_disp *disp,bool suspend) {struct nvkm_device *device = disp->engine.subdev.device;/* disable all interrupts */
drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h +6 -5
@@ -15,9 +15,10 @@ int nvkm_disp_new_(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkvoid nvkm_disp_vblank (struct nvkm_disp *,int head);struct nvkm_disp_func { +void (*dtor)(struct nvkm_disp *);int (*oneinit)(struct nvkm_disp *);int (*init)(struct nvkm_disp *); -void (*fini)(struct nvkm_disp *); +void (*fini)(struct nvkm_disp *,bool suspend);void (*intr)(struct nvkm_disp *);void (*intr_error)(struct nvkm_disp *,int chid);
@@ -32,7 +33,7 @@ struct nvkm_disp_func {u16 ramht_size; -const struct nvkm_sclass root; +struct nvkm_sclass root;struct nvkm_disp_user {struct nvkm_sclass base;
@@ -44,7 +45,7 @@ struct nvkm_disp_func {int nv50_disp_oneinit (struct nvkm_disp *);int nv50_disp_init (struct nvkm_disp *); -void nv50_disp_fini (struct nvkm_disp *); +void nv50_disp_fini (struct nvkm_disp *,bool suspend);void nv50_disp_intr (struct nvkm_disp *);extern const struct nvkm_enum nv50_disp_intr_error_type[];void nv50_disp_super (struct work_struct *);
@@ -56,12 +57,12 @@ void nv50_disp_super_2_2(struct nvkm_disp *, struct nvkm_head *);void nv50_disp_super_3_0 (struct nvkm_disp *,struct nvkm_head *);int gf119_disp_init (struct nvkm_disp *); -void gf119_disp_fini (struct nvkm_disp *); +void gf119_disp_fini (struct nvkm_disp *,bool suspend);void gf119_disp_intr (struct nvkm_disp *);void gf119_disp_super (struct work_struct *);void gf119_disp_intr_error (struct nvkm_disp *,int ); -void gv100_disp_fini (struct nvkm_disp *); +void gv100_disp_fini (struct nvkm_disp *,bool suspend);void gv100_disp_intr (struct nvkm_disp *);void gv100_disp_super (struct work_struct *);int gv100_disp_wndw_cnt (struct nvkm_disp *,unsigned long *);
drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c +4 -0
@@ -25,6 +25,7 @@#include "ior.h" #include <core/gpuobj.h> +#include <subdev/gsp.h> #include <subdev/timer.h> #include <nvif/class.h>
@@ -233,5 +234,8 @@ int tu102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_disp **pdisp) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_disp_new_(&tu102_disp, device, type, inst, pdisp); }
Signature · 1 line
2.41.0
PATCH 25/44 drm/nouveau/fifo/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
- add dtor() so GSP-RM paths can cleanup properly
- add alternate engine context mapping interface for RM engines
- add alternate chid interfaces to handle RM USERD oddities
--- .../drm/nouveau/include/nvkm/engine/fifo.h | 3 + .../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 9 +++ .../gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c | 3 + .../gpu/drm/nouveau/nvkm/engine/fifo/chan.c | 55 +++++++++++-------- .../gpu/drm/nouveau/nvkm/engine/fifo/chan.h | 3 + .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 4 ++ .../gpu/drm/nouveau/nvkm/engine/fifo/ga102.c | 5 ++ .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 + .../gpu/drm/nouveau/nvkm/engine/fifo/runl.h | 1 + .../gpu/drm/nouveau/nvkm/engine/fifo/tu102.c | 4 ++ 10 files changed, 67 insertions(+), 22 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h +3 -0
@@ -66,6 +66,9 @@ struct nvkm_fifo {struct {struct nvkm_memory *mem;struct nvkm_vma *bar1; + +struct mutex mutex; +struct list_head list; } userd;spinlock_t lock;
drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +9 -0
@@ -347,8 +347,14 @@ nvkm_fifo_dtor(struct nvkm_engine *engine)nvkm_chid_unref (&fifo->cgid);nvkm_chid_unref (&fifo->chid); +mutex_destroy (&fifo->userd.mutex); +nvkm_event_fini (&fifo->nonstall.event);mutex_destroy (&fifo->mutex); + +if (fifo->func->dtor) + fifo->func->dtor (fifo); +return fifo; }
@@ -383,5 +389,8 @@ nvkm_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device,spin_lock_init (&fifo->lock);mutex_init (&fifo->mutex); +INIT_LIST_HEAD (&fifo->userd.list); +mutex_init (&fifo->userd.mutex); +return nvkm_engine_ctor (&nvkm_fifo, device, type, inst, true, &fifo->engine); }
drivers/gpu/drm/nouveau/nvkm/engine/fifo/cgrp.c +3 -0
@@ -156,6 +156,9 @@ nvkm_cgrp_vctx_get(struct nvkm_cgrp *cgrp, struct nvkm_engn *engn, struct nvkm_catomic_inc (&vctx->vmm->engref[engn->engine->subdev.type]);/* Allocate the HW structures. */ +if (engn->func->ctor2) { + ret = engn->func->ctor2 (engn, vctx, chan); + }else if (engn->func->bind) { ret =nvkm_object_bind (vctx->ectx->object,NULL ,0 , &vctx->inst);if (ret ==0 && engn->func->ctor)
drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.c +33 -22
77 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/engine/fifo/chan.h +3 -0
@@ -17,6 +17,9 @@ struct nvkm_cctx { };struct nvkm_chan_func { +int (*id_get)(struct nvkm_chan *,struct nvkm_memory *userd,u64 ouserd); +void (*id_put)(struct nvkm_chan *); +const struct nvkm_chan_func_inst {u32 size;bool zero;
drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c +4 -0
@@ -27,6 +27,7 @@#include "runq.h" #include <core/gpuobj.h> +#include <subdev/gsp.h> #include <subdev/top.h> #include <subdev/vfn.h>
@@ -607,5 +608,8 @@ int ga100_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_fifo_new_(&ga100_fifo, device, type, inst, pfifo); }
drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c +5 -0
@@ -21,6 +21,8 @@*/ #include "priv.h" +#include <subdev/gsp.h> +#include <nvif/class.h> static const struct nvkm_fifo_func
@@ -41,5 +43,8 @@ int ga102_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_fifo_new_(&ga102_fifo, device, type, inst, pfifo); }
drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h +2 -0
@@ -13,6 +13,8 @@ struct nvkm_runq;struct nvkm_vctx ;struct nvkm_fifo_func { +void (*dtor)(struct nvkm_fifo *); +int (*chid_nr)(struct nvkm_fifo *);int (*chid_ctor)(struct nvkm_fifo *,int nr);int (*runq_nr)(struct nvkm_fifo *);
drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.h +1 -0
@@ -18,6 +18,7 @@ struct nvkm_engn {bool (*mmu_fault_triggered)(struct nvkm_engn *);int (*ctor)(struct nvkm_engn *,struct nvkm_vctx *);void (*bind)(struct nvkm_engn *,struct nvkm_cctx *,struct nvkm_chan *); +int (*ctor2)(struct nvkm_engn *,struct nvkm_vctx *,struct nvkm_chan *);int (*ramht_add)(struct nvkm_engn *,struct nvkm_object *,struct nvkm_chan *);void (*ramht_del)(struct nvkm_chan *,int hash); } *func;
drivers/gpu/drm/nouveau/nvkm/engine/fifo/tu102.c +4 -0
@@ -25,6 +25,7 @@#include "runl.h" #include <core/memory.h> +#include <subdev/gsp.h> #include <subdev/mc.h> #include <subdev/vfn.h>
@@ -282,5 +283,8 @@ int tu102_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_fifo_new_(&tu102_fifo, device, type, inst, pfifo); }
Signature · 1 line
2.41.0
PATCH 26/44 drm/nouveau/gr/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
- make init() optional
--- drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c | 6 +++++- drivers/gpu/drm/nouveau/nvkm/engine/gr/ga102.c | 4 ++++ drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c +5 -1
@@ -160,7 +160,11 @@ static int nvkm_gr_init(struct nvkm_engine *engine) {struct nvkm_gr *gr =nvkm_gr (engine); -return gr->func->init (gr); + +if (gr->func->init) +return gr->func->init (gr); + +return 0 ; } static int
drivers/gpu/drm/nouveau/nvkm/engine/gr/ga102.c +4 -0
@@ -23,6 +23,7 @@#include "ctxgf100.h" #include <core/firmware.h> +#include <subdev/gsp.h> #include <subdev/acr.h> #include <subdev/timer.h> #include <subdev/vfn.h>
@@ -350,5 +351,8 @@ ga102_gr_fwif[] = {int ga102_gr_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_gr **pgr) { +if (nvkm_gsp_rm (device->gsp)) +return -ENODEV ; +return gf100_gr_new_ (ga102_gr_fwif, device, type, inst, pgr); }
drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c +5 -0
@@ -22,6 +22,8 @@#include "gf100.h" #include "ctxgf100.h" +#include <subdev/gsp.h> +#include <nvif/class.h> void
@@ -216,5 +218,8 @@ tu102_gr_fwif[] = {int tu102_gr_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_gr **pgr) { +if (nvkm_gsp_rm (device->gsp)) +return -ENODEV ; +return gf100_gr_new_ (tu102_gr_fwif, device, type, inst, pgr); }
Signature · 1 line
2.41.0
PATCH 27/44 drm/nouveau/nvdec/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
- provide empty class list for non-GSP paths
- split tu102- from gm107, they will provide host classes later
- fixup HW engine instance masks
--- .../drm/nouveau/include/nvkm/engine/nvdec.h | 1 + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 20 +++++------ .../gpu/drm/nouveau/nvkm/engine/nvdec/Kbuild | 1 + .../gpu/drm/nouveau/nvkm/engine/nvdec/base.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/nvdec/ga102.c | 4 +++ .../gpu/drm/nouveau/nvkm/engine/nvdec/gm107.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/nvdec/priv.h | 2 ++ .../gpu/drm/nouveau/nvkm/engine/nvdec/tu102.c | 34 +++++++++++++++++++ 8 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvdec/tu102.c
drivers/gpu/drm/nouveau/include/nvkm/engine/nvdec.h +1 -0
@@ -12,5 +12,6 @@ struct nvkm_nvdec { };int gm107_nvdec_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_nvdec **); +int tu102_nvdec_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_nvdec **);int ga102_nvdec_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_nvdec **);#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +10 -10
@@ -2426,7 +2426,7 @@ nv162_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, - .nvdec = { 0x00000001, gm107_nvdec_new }, + .nvdec = { 0x00000001, tu102_nvdec_new }, .nvenc = { 0x00000001, gm107_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2461,7 +2461,7 @@ nv164_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, - .nvdec = { 0x00000003, gm107_nvdec_new }, + .nvdec = { 0x00000003, tu102_nvdec_new }, .nvenc = { 0x00000001, gm107_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2496,7 +2496,7 @@ nv166_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, - .nvdec = { 0x00000007, gm107_nvdec_new }, + .nvdec = { 0x00000007, tu102_nvdec_new }, .nvenc = { 0x00000001, gm107_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2531,7 +2531,7 @@ nv167_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, - .nvdec = { 0x00000001, gm107_nvdec_new }, + .nvdec = { 0x00000001, tu102_nvdec_new }, .nvenc = { 0x00000001, gm107_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2566,7 +2566,7 @@ nv168_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, - .nvdec = { 0x00000001, gm107_nvdec_new }, + .nvdec = { 0x00000001, tu102_nvdec_new }, .nvenc = { 0x00000001, gm107_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2620,7 +2620,7 @@ nv172_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new }, .gr = { 0x00000001, ga102_gr_new }, - .nvdec = { 0x00000001, ga102_nvdec_new }, + .nvdec = { 0x00000003, ga102_nvdec_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2650,7 +2650,7 @@ nv173_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new }, .gr = { 0x00000001, ga102_gr_new }, - .nvdec = { 0x00000001, ga102_nvdec_new }, + .nvdec = { 0x00000003, ga102_nvdec_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2680,7 +2680,7 @@ nv174_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new }, .gr = { 0x00000001, ga102_gr_new }, - .nvdec = { 0x00000001, ga102_nvdec_new }, + .nvdec = { 0x00000003, ga102_nvdec_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2710,7 +2710,7 @@ nv176_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new }, .gr = { 0x00000001, ga102_gr_new }, - .nvdec = { 0x00000001, ga102_nvdec_new }, + .nvdec = { 0x00000003, ga102_nvdec_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2740,7 +2740,7 @@ nv177_chipset = { .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new }, .gr = { 0x00000001, ga102_gr_new }, - .nvdec = { 0x00000001, ga102_nvdec_new }, + .nvdec = { 0x00000003, ga102_nvdec_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/Kbuild +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: MIT nvkm-y += nvkm/engine/nvdec/base.o nvkm-y += nvkm/engine/nvdec/gm107.o +nvkm-y += nvkm/engine/nvdec/tu102.o nvkm-y += nvkm/engine/nvdec/ga102.o
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/base.c +2 -1
@@ -33,6 +33,7 @@ nvkm_nvdec_dtor(struct nvkm_engine *engine)static const struct nvkm_engine_func nvkm_nvdec = { .dtor = nvkm_nvdec_dtor, + .sclass = { {} }, };int
@@ -58,4 +59,4 @@ nvkm_nvdec_new_(const struct nvkm_nvdec_fwif *fwif, struct nvkm_device *device,return nvkm_falcon_ctor (nvdec->func->flcn, &nvdec->engine.subdev, nvdec->engine.subdev.name, addr, &nvdec->falcon); -}; +}
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ga102.c +4 -0
@@ -21,6 +21,7 @@*/ #include "priv.h" +#include <subdev/gsp.h> #include <subdev/mc.h> #include <subdev/timer.h>
@@ -57,5 +58,8 @@ int ga102_nvdec_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_nvdec **pnvdec) { + if (nvkm_gsp_rm(device->gsp)) + return -ENODEV; + return nvkm_nvdec_new_(ga102_nvdec_fwif, device, type, inst, 0x848000, pnvdec); }
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/gm107.c +1 -1
@@ -44,7 +44,7 @@ gm107_nvdec_nofw(struct nvkm_nvdec *nvdec, int ver,return 0 ; } -static const struct nvkm_nvdec_fwif +const struct nvkm_nvdec_fwif gm107_nvdec_fwif[] = { {-1 , gm107_nvdec_nofw, &gm107_nvdec }, {}
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/priv.h +2 -0
@@ -14,6 +14,8 @@ struct nvkm_nvdec_fwif { const struct nvkm_nvdec_func *func; }; +extern const struct nvkm_nvdec_fwif gm107_nvdec_fwif[]; +int nvkm_nvdec_new_ (const struct nvkm_nvdec_fwif *fwif,struct nvkm_device *,enum nvkm_subdev_type ,int ,u32 addr,struct nvkm_nvdec **);#endif
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/tu102.c new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +#include <subdev/gsp.h> + +int +tu102_nvdec_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_nvdec **pnvdec) +{ +if (nvkm_gsp_rm (device->gsp)) +return -ENODEV ; + +return nvkm_nvdec_new_ (gm107_nvdec_fwif, device, type, inst,0 , pnvdec); +}
Signature · 1 line
2.41.0
PATCH 28/44 drm/nouveau/nvenc/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- (temporarily) disable if GSP-RM detected, will be added later
- provide empty class list for non-GSP paths
- split tu102 from gm107, it will provide host classes later
--- .../drm/nouveau/include/nvkm/engine/nvenc.h | 1 + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 10 +++--- .../gpu/drm/nouveau/nvkm/engine/nvenc/Kbuild | 1 + .../gpu/drm/nouveau/nvkm/engine/nvenc/base.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/nvenc/gm107.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/nvenc/priv.h | 2 ++ .../gpu/drm/nouveau/nvkm/engine/nvenc/tu102.c | 34 +++++++++++++++++++ 7 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/nvenc/tu102.c
drivers/gpu/drm/nouveau/include/nvkm/engine/nvenc.h +1 -0
@@ -12,4 +12,5 @@ struct nvkm_nvenc { };int gm107_nvenc_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_nvenc **); +int tu102_nvenc_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_nvenc **);#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +5 -5
@@ -2427,7 +2427,7 @@ nv162_chipset = { .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, .nvdec = { 0x00000001, tu102_nvdec_new }, - .nvenc = { 0x00000001, gm107_nvenc_new }, + .nvenc = { 0x00000001, tu102_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2462,7 +2462,7 @@ nv164_chipset = { .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, .nvdec = { 0x00000003, tu102_nvdec_new }, - .nvenc = { 0x00000001, gm107_nvenc_new }, + .nvenc = { 0x00000001, tu102_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2497,7 +2497,7 @@ nv166_chipset = { .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, .nvdec = { 0x00000007, tu102_nvdec_new }, - .nvenc = { 0x00000001, gm107_nvenc_new }, + .nvenc = { 0x00000001, tu102_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2532,7 +2532,7 @@ nv167_chipset = { .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, .nvdec = { 0x00000001, tu102_nvdec_new }, - .nvenc = { 0x00000001, gm107_nvenc_new }, + .nvenc = { 0x00000001, tu102_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
@@ -2567,7 +2567,7 @@ nv168_chipset = { .fifo = { 0x00000001, tu102_fifo_new }, .gr = { 0x00000001, tu102_gr_new }, .nvdec = { 0x00000001, tu102_nvdec_new }, - .nvenc = { 0x00000001, gm107_nvenc_new }, + .nvenc = { 0x00000001, tu102_nvenc_new }, .sec2 = { 0x00000001, tu102_sec2_new }, };
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/Kbuild +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: MIT nvkm-y += nvkm/engine/nvenc/base.o nvkm-y += nvkm/engine/nvenc/gm107.o +nvkm-y += nvkm/engine/nvenc/tu102.o
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/base.c +2 -1
@@ -34,6 +34,7 @@ nvkm_nvenc_dtor(struct nvkm_engine *engine)static const struct nvkm_engine_func nvkm_nvenc = { .dtor = nvkm_nvenc_dtor, + .sclass = { {} }, };int
@@ -59,4 +60,4 @@ nvkm_nvenc_new_(const struct nvkm_nvenc_fwif *fwif, struct nvkm_device *device,return nvkm_falcon_ctor (nvenc->func->flcn, &nvenc->engine.subdev, nvenc->engine.subdev.name,0 , &nvenc->falcon); -}; +}
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/gm107.c +1 -1
@@ -38,7 +38,7 @@ gm107_nvenc_nofw(struct nvkm_nvenc *nvenc, int ver,return 0 ; } -static const struct nvkm_nvenc_fwif +const struct nvkm_nvenc_fwif gm107_nvenc_fwif[] = { {-1 , gm107_nvenc_nofw, &gm107_nvenc }, {}
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/priv.h +2 -0
@@ -14,6 +14,8 @@ struct nvkm_nvenc_fwif { const struct nvkm_nvenc_func *func; }; +extern const struct nvkm_nvenc_fwif gm107_nvenc_fwif[]; +int nvkm_nvenc_new_ (const struct nvkm_nvenc_fwif *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_nvenc **pnvenc);#endif
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/tu102.c new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +#include <subdev/gsp.h> + +int +tu102_nvenc_new (struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_nvenc **pnvenc) +{ +if (nvkm_gsp_rm (device->gsp)) +return -ENODEV ; + +return nvkm_nvenc_new_ (gm107_nvenc_fwif, device, type, inst, pnvenc); +}
Signature · 1 line
2.41.0
PATCH 29/44 drm/nouveau/sec2/tu102-: prepare for GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- add (initial) R535 implementation of SEC2, needed for boot
--- .../gpu/drm/nouveau/nvkm/engine/sec2/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/engine/sec2/ga102.c | 8 ++- .../gpu/drm/nouveau/nvkm/engine/sec2/priv.h | 3 ++ .../gpu/drm/nouveau/nvkm/engine/sec2/r535.c | 54 +++++++++++++++++++ .../gpu/drm/nouveau/nvkm/engine/sec2/tu102.c | 8 ++- 5 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/sec2/r535.c
drivers/gpu/drm/nouveau/nvkm/engine/sec2/Kbuild +2 -0
@@ -4,3 +4,5 @@ nvkm-y += nvkm/engine/sec2/gp102.o nvkm-y += nvkm/engine/sec2/gp108.o nvkm-y += nvkm/engine/sec2/tu102.o nvkm-y += nvkm/engine/sec2/ga102.o + +nvkm-y += nvkm/engine/sec2/r535.o
drivers/gpu/drm/nouveau/nvkm/engine/sec2/ga102.c +7 -1
@@ -21,6 +21,7 @@*/ #include "priv.h" #include <subdev/acr.h> +#include <subdev/gsp.h> #include <subdev/vfn.h> #include <nvfw/flcn.h>
@@ -193,5 +194,10 @@ ga102_sec2_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,/* TOP info wasn't updated on Turing to reflect the PRI * address change for some reason. We override it here. */ -return nvkm_sec2_new_ (ga102_sec2_fwif, device, type, inst,0x840000 , psec2); +const u32 addr =0x840000 ; + +if (nvkm_gsp_rm (device->gsp)) +return r535_sec2_new (&ga102_sec2, device, type, inst, addr, psec2); + +return nvkm_sec2_new_ (ga102_sec2_fwif, device, type, inst, addr, psec2); }
drivers/gpu/drm/nouveau/nvkm/engine/sec2/priv.h +3 -0
@@ -4,6 +4,9 @@#include <engine/sec2.h> struct nvkm_acr_lsfw ; +int r535_sec2_new (const struct nvkm_sec2_func *, +struct nvkm_device *,enum nvkm_subdev_type ,int ,u32 addr,struct nvkm_sec2 **); +struct nvkm_sec2_func {const struct nvkm_falcon_func *flcn;u8 unit_unload;
drivers/gpu/drm/nouveau/nvkm/engine/sec2/r535.c new file +54 -0
54 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/engine/sec2/tu102.c +7 -1
@@ -21,6 +21,7 @@*/ #include "priv.h" #include <subdev/acr.h> +#include <subdev/gsp.h> #include <nvfw/sec2.h>
@@ -82,5 +83,10 @@ tu102_sec2_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,/* TOP info wasn't updated on Turing to reflect the PRI * address change for some reason. We override it here. */ -return nvkm_sec2_new_ (tu102_sec2_fwif, device, type, inst,0x840000 , psec2); +const u32 addr =0x840000 ; + +if (nvkm_gsp_rm (device->gsp)) +return r535_sec2_new (&tu102_sec2, device, type, inst, addr, psec2); + +return nvkm_sec2_new_ (tu102_sec2_fwif, device, type, inst, addr, psec2); }
Signature · 1 line
2.41.0
PATCH 30/44 drm/nouveau/kms/tu102-: disable vbios parsing when running on RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- on HW, parts of this will still be used to support LVDS
- LVDS appears to have dissapeared before Turing, so this won't be needed at all when running on RM
--- drivers/gpu/drm/nouveau/nouveau_bios.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bios.c +4 -1
@@ -27,6 +27,8 @@#include "dispnv04/hw.h" #include "nouveau_encoder.h" +#include <subdev/gsp.h> +#include <linux/io-mapping.h> #include <linux/firmware.h>
@@ -2087,7 +2089,8 @@ nouveau_bios_init(struct drm_device *dev)int ret;/* only relevant for PCI devices */ -if (!dev_is_pci (dev->dev)) +if (!dev_is_pci (dev->dev) || +nvkm_gsp_rm (nvxx_device (&drm->client.device)->gsp))return 0 ;if (!NVInitVBIOS (dev))
Signature · 1 line
2.41.0
PATCH 31/44 drm/nouveau/nvkm: support loading fws into sg_table
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- preparation for GSP-RM, which has massive FW images
- based on a patch by Dave Airlie
--- .../drm/nouveau/include/nvkm/core/firmware.h | 6 +- drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 74 ++++++++++++++++++- 2 files changed, 76 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/firmware.h +5 -1
@@ -10,6 +10,7 @@ struct nvkm_firmware {enum nvkm_firmware_type {NVKM_FIRMWARE_IMG_RAM ,NVKM_FIRMWARE_IMG_DMA , +NVKM_FIRMWARE_IMG_SGT , } type; } *func;const char *name;
@@ -21,7 +22,10 @@ struct nvkm_firmware {struct nvkm_firmware_mem {struct nvkm_memory memory; -struct scatterlist sgl; +union { +struct scatterlist sgl;/* DMA */ +struct sg_table sgt;/* SGT */ + }; } mem; };
drivers/gpu/drm/nouveau/nvkm/core/firmware.c +71 -3
111 lines not on this page · raw message
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 31/44] drm/nouveau/nvkm: support loading fws into sg_table
Quoted 4 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
- preparation for GSP-RM, which has massive FW images
- based on a patch by Dave Airlie
Probably more canonical to use one of the standard phrases such as Suggested-by
Quoted 168 lines
Signed-off-by Ben Skeggs <[email protected]>---
.../drm/nouveau/include/nvkm/core/firmware.h | 6 +- drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 74
++++++++++++++++++-2 files changed, 76 insertions(+), 4 deletions(-)drivers/gpu/drm/nouveau/include/nvkm/core/firmware.h +1
-0@@ -10,6 +10,7 @@ struct nvkm_firmware { enum nvkm_firmware_type { NVKM_FIRMWARE_IMG_RAM, NVKM_FIRMWARE_IMG_DMA, + NVKM_FIRMWARE_IMG_SGT, } type; } *func; const char *name;@@ -21,7 +22,10 @@ struct nvkm_firmware {
structnvkm_firmware_mem{
structnvkm_memorymemory;
- struct scatterlist sgl;
+ union {
+ struct scatterlist sgl; /* DMA */ + structsg_tablesgt; /* SGT */ + };
} mem;
};drivers/gpu/drm/nouveau/nvkm/core/firmware.c +0
-0@@ -113,6 +113,22 @@ nvkm_firmware_put(const struct firmware *fw)
#definenvkm_firmware_mem(p)container_of((p), struct nvkm_firmware, mem.memory)drivers/gpu/drm/nouveau/nvkm/core/firmware.c +16
-0+static struct scatterlist * +nvkm_firmware_mem_sgl (struct nvkm_memory *memory) +{ + struct nvkm_firmware *fw = nvkm_firmware_mem(memory); + + switch (fw->func->type) { + case NVKM_FIRMWARE_IMG_DMA: return &fw->mem.sgl; + case NVKM_FIRMWARE_IMG_SGT: return fw->mem.sgt.sgl; + default: + WARN_ON(1); + break; + } + + return NULL; +} +static int
nvkm_firmware_mem_map(structnvkm_memory*memory, u64 offset, structnvkm_vmm*vmm,
structnvkm_vma*vma, void *argv, u32 argc)drivers/gpu/drm/nouveau/nvkm/core/firmware.c +1
-1@@ -121,10 +137,10 @@ nvkm_firmware_mem_map(struct nvkm_memory *memory, u64 offset, struct nvkm_vmm *v struct nvkm_vmm_map map = { .memory = &fw->mem.memory, .offset = offset, - .sgl = &fw->mem.sgl, + .sgl = nvkm_firmware_mem_sgl(memory), };
- if (WARN_ON(fw->func->type != NVKM_FIRMWARE_IMG_DMA)) + if (!map.sgl)
return-ENOSYS;
returnnvkm_vmm_map(vmm, vma, argv, argc, &map);drivers/gpu/drm/nouveau/nvkm/core/firmware.c +0
-0@@ -133,12 +149,15 @@ nvkm_firmware_mem_map(struct nvkm_memory *memory, u64 offset, struct nvkm_vmm *vstatic u64
nvkm_firmware_mem_size(structnvkm_memory*memory)
{
- return sg_dma_len(&nvkm_firmware_mem(memory)->mem.sgl); + struct scatterlist *sgl =nvkm_firmware_mem_sgl(memory); +
+ return sgl ?sg_dma_len(sgl): 0;
}
static u64
nvkm_firmware_mem_addr(structnvkm_memory*memory)
{
+ BUG_ON(nvkm_firmware_mem(memory)->func->type !=NVKM_FIRMWARE_IMG_DMA);
return nvkm_firmware_mem(memory)->phys;
}drivers/gpu/drm/nouveau/nvkm/core/firmware.c +0
-0@@ -189,6 +208,12 @@ nvkm_firmware_dtor(struct nvkm_firmware *fw) nvkm_memory_unref(&memory);dma_free_coherent(fw->device->dev, sg_dma_len(&fw-
Quoted 1 line
mem.sgl),
fw->img,fw->phys);break;
+ caseNVKM_FIRMWARE_IMG_SGT:
+ nvkm_memory_unref(&memory);
+ dma_unmap_sgtable(fw->device->dev,&fw->mem.sgt,DMA_TO_DEVICE, 0);
+ sg_free_table(&fw->mem.sgt);
+ vfree(fw->img);
+ break;
default:
WARN_ON(1);
break;drivers/gpu/drm/nouveau/nvkm/core/firmware.c +18
-0@@ -226,6 +251,49 @@ nvkm_firmware_ctor(const struct nvkm_firmware_func *func, const char *name, sg_dma_len(&fw->mem.sgl) = len; } break; + case NVKM_FIRMWARE_IMG_SGT: + len = ALIGN(fw->len, PAGE_SIZE); + + fw->img = vmalloc(len); + if (fw->img) { + int pages = len >> PAGE_SHIFT; + int ret = 0; + + memcpy(fw->img, src, fw->len); + + ret = sg_alloc_table(&fw->mem.sgt, pages,GFP_KERNEL ); + if (ret == 0) { + struct scatterlist *sgl; + u8 *data = fw->img; + int i; + + for_each_sgtable_sg(&fw->mem.sgt, sgl, i) { + struct page *page =
vmalloc_to_page(data);drivers/gpu/drm/nouveau/nvkm/core/firmware.c +7
-0+ + if (!page) { + ret = -EFAULT; + break; + } + + sg_set_page(sgl, page,
PAGE_SIZE, 0);
+ data +=PAGE_SIZE; + }
+
+ if (ret == 0) {
+ ret = dma_map_sgtable(fw-Quoted 1 line
device->dev,&fw->mem.sgt,+
DMA_TO_DEVICE, 0);
+ }drivers/gpu/drm/nouveau/nvkm/core/firmware.c +11
-0+ + if (ret) + sg_free_table(&fw->mem.sgt); + } + + if (ret) { + vfree(fw->img); + fw->img = NULL; + } + } + break;default:
WARN_ON(1);
return-EINVAL;
PATCH 32/44 drm/nouveau/gsp/r535: add support for booting GSP-RM
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
This commit adds the initial code needed to boot the GSP-RM firmware provided by NVIDIA, bringing with it the beginnings of Ada support.
Until it's had more testing and time to bake, support is disabled by default (except on Ada). GSP-RM usage can be enabled by passing the "config=NvGspRm=1" module option.
--- drivers/gpu/drm/nouveau/include/nvif/cl0080.h | 1 + .../drm/nouveau/include/nvkm/core/device.h | 1 + .../drm/nouveau/include/nvkm/core/falcon.h | 4 + .../drm/nouveau/include/nvkm/engine/falcon.h | 2 + .../drm/nouveau/include/nvkm/subdev/bios.h | 1 + .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 171 +- .../nvidia/inc/ctrl/ctrl0073/ctrl0073system.h | 31 + .../nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h | 33 + .../common/shared/msgq/inc/msgq/msgq_priv.h | 46 + .../uproc/os/common/include/libos_init_args.h | 52 + .../nvalloc/common/inc/gsp/gsp_fw_sr_meta.h | 79 + .../nvalloc/common/inc/gsp/gsp_fw_wpr_meta.h | 149 ++ .../arch/nvalloc/common/inc/rmRiscvUcode.h | 82 + .../nvidia/arch/nvalloc/common/inc/rmgspseq.h | 100 ++ .../nvidia/generated/g_chipset_nvoc.h | 38 + .../535.54.03/nvidia/generated/g_os_nvoc.h | 44 + .../nvidia/generated/g_rpc-structures.h | 52 + .../nvidia/inc/kernel/gpu/gpu_acpi_data.h | 74 + .../nvidia/inc/kernel/gpu/gsp/gsp_fw_heap.h | 33 + .../nvidia/inc/kernel/gpu/gsp/gsp_init_args.h | 57 + .../inc/kernel/gpu/gsp/gsp_static_config.h | 74 + .../nvidia/kernel/inc/vgpu/rpc_global_enums.h | 262 +++ .../gpu/drm/nouveau/include/nvrm/nvtypes.h | 24 + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 66 + .../gpu/drm/nouveau/nvkm/engine/device/user.c | 1 + drivers/gpu/drm/nouveau/nvkm/falcon/Kbuild | 1 + drivers/gpu/drm/nouveau/nvkm/falcon/base.c | 9 + drivers/gpu/drm/nouveau/nvkm/falcon/ga102.c | 6 + drivers/gpu/drm/nouveau/nvkm/falcon/tu102.c | 28 + .../gpu/drm/nouveau/nvkm/subdev/bios/base.c | 8 + .../gpu/drm/nouveau/nvkm/subdev/gsp/Kbuild | 5 + .../gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c | 57 + .../gpu/drm/nouveau/nvkm/subdev/gsp/base.c | 1 + .../gpu/drm/nouveau/nvkm/subdev/gsp/fwsec.c | 359 ++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c | 22 + .../gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 138 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/priv.h | 42 + .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 1561 +++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c | 162 ++ .../gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c | 22 + 40 files changed, 3896 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073system.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/shared/msgq/inc/msgq/msgq_priv.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/uproc/os/common/include/libos_init_args.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/gsp/gsp_fw_sr_meta.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/gsp/gsp_fw_wpr_meta.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/rmRiscvUcode.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/rmgspseq.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_chipset_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_os_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_acpi_data.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_fw_heap.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_init_args.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_static_config.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_global_enums.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/nvtypes.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/falcon/tu102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/fwsec.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
drivers/gpu/drm/nouveau/include/nvif/cl0080.h +1 -0
@@ -35,6 +35,7 @@ struct nv_device_info_v0 {#define NV_DEVICE_INFO_V0_VOLTA 0x0b#define NV_DEVICE_INFO_V0_TURING 0x0c#define NV_DEVICE_INFO_V0_AMPERE 0x0d +#define NV_DEVICE_INFO_V0_ADA 0x0e__u8 family;__u8 pad06[2 ];__u64 ram_size;
drivers/gpu/drm/nouveau/include/nvkm/core/device.h +1 -0
@@ -46,6 +46,7 @@ struct nvkm_device {GV100 =0x140 ,TU100 =0x160 ,GA100 =0x170 , +AD100 =0x190 , } card_type;u32 chipset;u8 chiprev;
drivers/gpu/drm/nouveau/include/nvkm/core/falcon.h +4 -0
@@ -48,6 +48,7 @@ int nvkm_falcon_pio_rd(struct nvkm_falcon *, u8 port, enum nvkm_falcon_mem type, const u8 *img, u32 img_base, int len);int nvkm_falcon_dma_wr (struct nvkm_falcon *,const u8 *img,u64 dma_addr,u32 dma_base,enum nvkm_falcon_mem mem_type,u32 mem_base,int len,bool sec); +bool nvkm_falcon_riscv_active (struct nvkm_falcon *);int gm200_flcn_reset_wait_mem_scrubbing (struct nvkm_falcon *);int gm200_flcn_disable (struct nvkm_falcon *);
@@ -61,10 +62,13 @@ void gm200_flcn_tracepc(struct nvkm_falcon *);int gp102_flcn_reset_eng (struct nvkm_falcon *);extern const struct nvkm_falcon_func_pio gp102_flcn_emem_pio; +bool tu102_flcn_riscv_active (struct nvkm_falcon *); +int ga102_flcn_select (struct nvkm_falcon *);int ga102_flcn_reset_prep (struct nvkm_falcon *);int ga102_flcn_reset_wait_mem_scrubbing (struct nvkm_falcon *);extern const struct nvkm_falcon_func_dma ga102_flcn_dma; +bool ga102_flcn_riscv_active (struct nvkm_falcon *);void nvkm_falcon_v1_load_imem (struct nvkm_falcon *,void *,u32 ,u32 ,u16 ,u8 ,bool );
drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h +2 -0
@@ -87,6 +87,8 @@ struct nvkm_falcon_func {u32 stride; } cmdq, msgq; +bool (*riscv_active)(struct nvkm_falcon *); +struct {u32 *data;u32 size;
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios.h +1 -0
@@ -29,6 +29,7 @@ int nvbios_memcmp(struct nvkm_bios *, u32 addr, const char *, u32 len);u8 nvbios_rd08 (struct nvkm_bios *,u32 addr);u16 nvbios_rd16 (struct nvkm_bios *,u32 addr);u32 nvbios_rd32 (struct nvkm_bios *,u32 addr); +void *nvbios_pointer (struct nvkm_bios *,u32 addr);int nvkm_bios_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_bios **);#endif
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +170 -1
192 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073system.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl0073_ctrl0073system_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl0073_ctrl0073system_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2005-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV0073_CTRL_SYSTEM_ACPI_ID_MAP_MAX_DISPLAYS (16U) + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080gpu_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080gpu_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2006-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0 (0x00000000U) + +#define NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3 (0x00000003U) + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/shared/msgq/inc/msgq/msgq_priv.h new file +46 -0
46 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/uproc/os/common/include/libos_init_args.h new file +52 -0
52 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/gsp/gsp_fw_sr_meta.h new file +79 -0
79 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/gsp/gsp_fw_wpr_meta.h new file +149 -0
149 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/rmRiscvUcode.h new file +82 -0
82 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/arch/nvalloc/common/inc/rmgspseq.h new file +100 -0
100 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_chipset_nvoc.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef __src_nvidia_generated_g_chipset_nvoc_h__ +#define __src_nvidia_generated_g_chipset_nvoc_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 1993-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct +{ +NvU16 deviceID;// deviceID +NvU16 vendorID;// vendorID +NvU16 subdeviceID;// subsystem deviceID +NvU16 subvendorID;// subsystem vendorID +NvU8 revisionID;// revision ID +}BUSINFO ; + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_os_nvoc.h new file +44 -0
44 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h new file +52 -0
52 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_acpi_data.h new file +74 -0
74 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_fw_heap.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __src_nvidia_inc_kernel_gpu_gsp_gsp_fw_heap_h__ +#define __src_nvidia_inc_kernel_gpu_gsp_gsp_fw_heap_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define GSP_FW_HEAP_PARAM_SIZE_PER_GB_FB (96 << 10) // All architectures + +#define GSP_FW_HEAP_PARAM_CLIENT_ALLOC_SIZE ((48 << 10) * 2048) // Support 2048 channels + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_init_args.h new file +57 -0
57 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_static_config.h new file +74 -0
74 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_global_enums.h new file +262 -0
262 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/nvtypes.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: MIT */ +#ifndef __NVRM_NVTYPES_H__ +#define __NVRM_NVTYPES_H__ + +#define NV_ALIGN_BYTES (a) __attribute__ ((__aligned__(a))) +#define NV_DECLARE_ALIGNED (f,a) f __attribute__ ((__aligned__(a))) + +typedef u32 NvV32 ; + +typedef u8 NvU8 ; +typedef u16 NvU16 ; +typedef u32 NvU32 ; +typedef u64 NvU64 ; + +typedef void *NvP64 ; + +typedef NvU8 NvBool ; +typedef NvU32 NvHandle ; +typedef NvU64 NvLength ; + +typedef NvU64 RmPhysAddr ; + +typedef NvU32 NV_STATUS ; +#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +66 -0
84 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c +1 -0
@@ -147,6 +147,7 @@ nvkm_udevice_info(struct nvkm_udevice *udev, void *data, u32 size)case GV100 : args->v0.family =NV_DEVICE_INFO_V0_VOLTA ;break ;case TU100 : args->v0.family =NV_DEVICE_INFO_V0_TURING ;break ;case GA100 : args->v0.family =NV_DEVICE_INFO_V0_AMPERE ;break ; +case AD100 : args->v0.family =NV_DEVICE_INFO_V0_ADA ;break ;default : args->v0.family =0 ;break ;
drivers/gpu/drm/nouveau/nvkm/falcon/Kbuild +1 -0
@@ -8,5 +8,6 @@ nvkm-y += nvkm/falcon/v1.o nvkm-y += nvkm/falcon/gm200.o nvkm-y += nvkm/falcon/gp102.o +nvkm-y += nvkm/falcon/tu102.o nvkm-y += nvkm/falcon/ga100.o nvkm-y += nvkm/falcon/ga102.o
drivers/gpu/drm/nouveau/nvkm/falcon/base.c +9 -0
@@ -25,6 +25,15 @@#include <subdev/timer.h> #include <subdev/top.h> +bool +nvkm_falcon_riscv_active (struct nvkm_falcon *falcon) +{ +if (!falcon->func->riscv_active) +return false; + +return falcon->func->riscv_active (falcon); +} +static const struct nvkm_falcon_func_dma *nvkm_falcon_dma (struct nvkm_falcon *falcon,enum nvkm_falcon_mem *mem_type,u32 *mem_base) {
drivers/gpu/drm/nouveau/nvkm/falcon/ga102.c +6 -0
@@ -24,6 +24,12 @@#include <subdev/mc.h> #include <subdev/timer.h> +bool +ga102_flcn_riscv_active (struct nvkm_falcon *falcon) +{ +return (nvkm_falcon_rd32 (falcon, falcon->addr2 +0x388 ) &0x00000080 ) !=0 ; +} +static bool ga102_flcn_dma_done (struct nvkm_falcon *falcon) {
drivers/gpu/drm/nouveau/nvkm/falcon/tu102.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +bool +tu102_flcn_riscv_active (struct nvkm_falcon *falcon) +{ +return (nvkm_falcon_rd32 (falcon, falcon->addr2 +0x240 ) &0x00000001 ) !=0 ; +}
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +8 -0
@@ -46,6 +46,14 @@ nvbios_addr(struct nvkm_bios *bios, u32 *addr, u8 size)return true; } +void * +nvbios_pointer (struct nvkm_bios *bios,u32 addr) +{ +if (likely (nvbios_addr (bios, &addr,0 ))) +return &bios->data[addr]; +return NULL ; +} +u8 nvbios_rd08 (struct nvkm_bios *bios,u32 addr) {
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/Kbuild +5 -0
@@ -1,7 +1,12 @@ # SPDX-License-Identifier: MIT nvkm-y += nvkm/subdev/gsp/base.o +nvkm-y += nvkm/subdev/gsp/fwsec.o + nvkm-y += nvkm/subdev/gsp/gv100.o nvkm-y += nvkm/subdev/gsp/tu102.o nvkm-y += nvkm/subdev/gsp/tu116.o nvkm-y += nvkm/subdev/gsp/ga100.o nvkm-y += nvkm/subdev/gsp/ga102.o +nvkm-y += nvkm/subdev/gsp/ad102.o + +nvkm-y += nvkm/subdev/gsp/r535.o
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c new file +57 -0
57 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c +1 -0
@@ -90,6 +90,7 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,return PTR_ERR (fwif); gsp->func = fwif->func; + gsp->rm = gsp->func->rm;return nvkm_falcon_ctor (gsp->func->flcn, &gsp->subdev, gsp->subdev.name,0x110000 , &gsp->falcon);
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/fwsec.c new file +359 -0
359 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c +22 -0
@@ -21,8 +21,30 @@*/ #include "priv.h" +static const struct nvkm_gsp_func +ga100_gsp_r535_54_03 = { + .flcn = &tu102_gsp_flcn, + .fwsec = &tu102_gsp_fwsec, + + .sig_section =".fwsignature_ga100" , + + .wpr_heap.base_size =8 <<20 , + .wpr_heap.min_size =64 <<20 , + + .booter.ctor = tu102_gsp_booter_ctor, + + .dtor = r535_gsp_dtor, + .oneinit = tu102_gsp_oneinit, + .init = r535_gsp_init, + .fini = r535_gsp_fini, + .reset = tu102_gsp_reset, + + .rm = &r535_gsp_rm, +}; +static struct nvkm_gsp_fwif ga100_gsps[] = { + {0 , r535_gsp_load, &ga100_gsp_r535_54_03,"535.54.03" }, {-1 , gv100_gsp_nofw, &gv100_gsp }, {} };
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c +137 -1
156 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/priv.h +42 -0
65 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c new file +1561 -0
677 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c +162 -0
162 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu116.c +22 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.41.0
Part of the diff is not shown here. View the raw message.
PATCH 33/44 drm/nouveau/gsp/r535: add support for rm control
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
Adds the plumbing to start making RM control calls, and initialises objects to represent internal RM objects provided to us during init.
These will be used by subsequent patches.
--- .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 62 +++++++++++ .../nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h | 48 +++++++++ .../sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h | 31 ++++++ .../nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h | 40 +++++++ .../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h | 51 +++++++++ .../nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h | 25 +++++ .../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h | 41 +++++++ .../535.54.03/nvidia/generated/g_gpu_nvoc.h | 35 ++++++ .../nvidia/generated/g_rpc-structures.h | 11 ++ .../nvidia/inc/kernel/gpu/gpu_engine_type.h | 86 +++++++++++++++ .../inc/kernel/gpu/gsp/gsp_static_config.h | 100 +++++++++++++++++ .../nvidia/inc/kernel/gpu/nvbitmask.h | 33 ++++++ .../nvidia/kernel/inc/vgpu/rpc_headers.h | 44 ++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 101 ++++++++++++++++++ 14 files changed, 708 insertions(+) create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_gpu_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/nvbitmask.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +62 -0
@@ -132,10 +132,32 @@ struct nvkm_gsp {bool running; +/* Internal GSP-RM control handles. */ +struct { +struct nvkm_gsp_client { +struct nvkm_gsp_object { +struct nvkm_gsp_client *client; +struct nvkm_gsp_object *parent; +u32 handle; + } object; + +struct nvkm_gsp *gsp; + } client; + +struct nvkm_gsp_device { +struct nvkm_gsp_object object; +struct nvkm_gsp_object subdevice; + } device; + } internal; +const struct nvkm_gsp_rm {void *(*rpc_get)(struct nvkm_gsp *,u32 fn,u32 argc);void *(*rpc_push)(struct nvkm_gsp *,void *argv,bool wait,u32 repc);void (*rpc_done)(struct nvkm_gsp *gsp,void *repv); + +void *(*rm_ctrl_get)(struct nvkm_gsp_object *,u32 cmd,u32 argc); +void *(*rm_ctrl_push)(struct nvkm_gsp_object *,void *argv,u32 repc); +void (*rm_ctrl_done)(struct nvkm_gsp_object *,void *repv); } *rm; };
@@ -185,6 +207,46 @@ nvkm_gsp_rpc_done(struct nvkm_gsp *gsp, void *repv) gsp->rm->rpc_done (gsp, repv); } +static inline void * +nvkm_gsp_rm_ctrl_get (struct nvkm_gsp_object *object,u32 cmd,u32 argc) +{ +return object->client->gsp->rm->rm_ctrl_get (object, cmd, argc); +} + +static inline void * +nvkm_gsp_rm_ctrl_push (struct nvkm_gsp_object *object,void *argv,u32 repc) +{ +return object->client->gsp->rm->rm_ctrl_push (object, argv, repc); +} + +static inline void * +nvkm_gsp_rm_ctrl_rd (struct nvkm_gsp_object *object,u32 cmd,u32 repc) +{ +void *argv =nvkm_gsp_rm_ctrl_get (object, cmd, repc); + +if (IS_ERR (argv)) +return argv; + +return nvkm_gsp_rm_ctrl_push (object, argv, repc); +} + +static inline int +nvkm_gsp_rm_ctrl_wr (struct nvkm_gsp_object *object,void *argv) +{ +void *repv =nvkm_gsp_rm_ctrl_push (object, argv,0 ); + +if (IS_ERR (repv)) +return PTR_ERR (repv); + +return 0 ; +} + +static inline void +nvkm_gsp_rm_ctrl_done (struct nvkm_gsp_object *object,void *repv) +{ + object->client->gsp->rm->rm_ctrl_done (object, repv); +} +int gv100_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int tu102_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int tu116_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h new file +48 -0
48 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl0080_ctrl0080gr_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl0080_ctrl0080gr_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2004-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV0080_CTRL_GR_CAPS_TBL_SIZE 23 + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h new file +40 -0
@@ -0,0 +1,40 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080bios_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080bios_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2005-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NV2080_CTRL_BIOS_GET_SKU_INFO_PARAMS { +NvU32 BoardID; +char chipSKU[4 ]; +char chipSKUMod[2 ]; +char project[5 ]; +char projectSKU[5 ]; +char CDP[6 ]; +char projectSKUMod[2 ]; +NvU32 businessCycle; +}NV2080_CTRL_BIOS_GET_SKU_INFO_PARAMS ; + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h new file +51 -0
51 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h +25 -0
@@ -26,8 +26,33 @@* DEALINGS IN THE SOFTWARE. */ +#define NV2080_GPU_MAX_NAME_STRING_LENGTH (0x0000040U) +#define NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0 (0x00000000U)#define NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3 (0x00000003U) +typedef struct NV2080_CTRL_GPU_GET_FERMI_GPC_INFO_PARAMS { +NvU32 gpcMask; +}NV2080_CTRL_GPU_GET_FERMI_GPC_INFO_PARAMS ; + +typedef struct NV2080_CTRL_GPU_GET_FERMI_TPC_INFO_PARAMS { +NvU32 gpcId; +NvU32 tpcMask; +}NV2080_CTRL_GPU_GET_FERMI_TPC_INFO_PARAMS ; + +typedef struct NV2080_CTRL_GPU_GET_FERMI_ZCULL_INFO_PARAMS { +NvU32 gpcId; +NvU32 zcullMask; +}NV2080_CTRL_GPU_GET_FERMI_ZCULL_INFO_PARAMS ; + +#define NV2080_GPU_MAX_GID_LENGTH (0x000000100ULL) + +typedef struct NV2080_CTRL_GPU_GET_GID_INFO_PARAMS { +NvU32 index; +NvU32 flags; +NvU32 length; +NvU8 data[NV2080_GPU_MAX_GID_LENGTH ]; +}NV2080_CTRL_GPU_GET_GID_INFO_PARAMS ; +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h new file +41 -0
41 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_gpu_nvoc.h new file +35 -0
@@ -0,0 +1,35 @@ +#ifndef __src_nvidia_generated_g_gpu_nvoc_h__ +#define __src_nvidia_generated_g_gpu_nvoc_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2004-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef enum +{ +COMPUTE_BRANDING_TYPE_NONE , +COMPUTE_BRANDING_TYPE_TESLA , +}COMPUTE_BRANDING_TYPE ; + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h +11 -0
@@ -33,6 +33,17 @@ typedef struct rpc_unloading_guest_driver_v1F_07NvU32 newLevel; } rpc_unloading_guest_driver_v1F_07; +typedef struct rpc_gsp_rm_control_v03_00 +{ +NvHandle hClient; +NvHandle hObject; +NvU32 cmd; +NvU32 status; +NvU32 paramsSize; +NvU32 flags; +NvU8 params[]; +}rpc_gsp_rm_control_v03_00 ; + typedef struct rpc_run_cpu_sequencer_v17_00 { NvU32 bufferSizeDWord;
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.h new file +86 -0
86 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_static_config.h +100 -0
113 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/nvbitmask.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __src_nvidia_inc_kernel_gpu_nvbitmask_h__ +#define __src_nvidia_inc_kernel_gpu_nvbitmask_h__ +#include <nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.h> + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NVGPU_ENGINE_CAPS_MASK_BITS 32 +#define NVGPU_ENGINE_CAPS_MASK_ARRAY_MAX ((RM_ENGINE_TYPE_LAST-1)/NVGPU_ENGINE_CAPS_MASK_BITS + 1) + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h new file +44 -0
44 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +101 -0
123 lines not on this page · raw message
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 33/44] drm/nouveau/gsp/r535: add support for rm control
Quoted 112 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
Adds the plumbing to start making RM control calls, and initialises objects to represent internal RM objects provided to us during init.
These will be used by subsequent patches.
Signed-off-by Ben Skeggs <[email protected]>---
.../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 62 +++++++++++ .../nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h | 48 +++++++++.../sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h| 31 ++++++ .../nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h | 40 +++++++.../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h| 51 +++++++++ .../nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h | 25 +++++.../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h| 41 +++++++ .../535.54.03/nvidia/generated/g_gpu_nvoc.h | 35 ++++++ .../nvidia/generated/g_rpc-structures.h | 11 ++ .../nvidia/inc/kernel/gpu/gpu_engine_type.h | 86 +++++++++++++++ .../inc/kernel/gpu/gsp/gsp_static_config.h | 100
+++++++++++++++++
.../nvidia/inc/kernel/gpu/nvbitmask.h | 33 ++++++ .../nvidia/kernel/inc/vgpu/rpc_headers.h | 44 ++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 101
++++++++++++++++++14 files changed, 708 insertions(+)create mode 100644
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h
create mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h
create mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h
create mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h
create mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h
create mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_gpu_nvoc.h
create mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.h
create mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/nvbitmask.h
create mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +0
-0@@ -132,10 +132,32 @@ struct nvkm_gsp {
bool running;
+ /* Internal GSP-RM control handles. */
+ struct {
+ structnvkm_gsp_client{
+ structnvkm_gsp_object{
+ structnvkm_gsp_client*client; + structnvkm_gsp_object*parent; + u32 handle;
+ } object;drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +10
-0+ + struct nvkm_gsp *gsp; + } client; + + struct nvkm_gsp_device { + struct nvkm_gsp_object object; + struct nvkm_gsp_object subdevice; + } device; + } internal; +const struct
nvkm_gsp_rm{
void *(*rpc_get)(structnvkm_gsp*, u32 fn, u32 argc);
void *(*rpc_push)(structnvkm_gsp*, void *argv, bool wait, u32 repc);
void (*rpc_done)(structnvkm_gsp*gsp, void *repv); +
+ void *(*rm_ctrl_get)(structnvkm_gsp_object*, u32 cmd, u32 argc);
+ void *(*rm_ctrl_push)(structnvkm_gsp_object*, void *argv, u32 repc);
+ void (*rm_ctrl_done)(structnvkm_gsp_object*, void *repv);
} *rm;
};drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +0
-0@@ -185,6 +207,46 @@ nvkm_gsp_rpc_done(struct nvkm_gsp *gsp, void *repv) gsp->rm->rpc_done(gsp, repv); }drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +2
-0+static inline void * +nvkm_gsp_rm_ctrl_get(struct nvkm_gsp_object *object, u32 cmd, u32argc)
+{
+ returnobject->client->gsp->rm->rm_ctrl_get(object, cmd, argc);drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0+} + +static inline void * +nvkm_gsp_rm_ctrl_push(struct nvkm_gsp_object *object, void *argv,
Quoted 2 lines
u32 repc)
+{
What's repc? Repitition-count? See below:
Quoted 10 lines
+ return
object->client->gsp->rm->rm_ctrl_push(object, argv, repc);drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0+} + +static inline void * +nvkm_gsp_rm_ctrl_rd(struct nvkm_gsp_object *object, u32 cmd, u32repc)
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+{ + void *argv = nvkm_gsp_rm_ctrl_get(object, cmd, repc); +
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h nvkm_gsp_rpc_done(struct nvkm_gsp *gsp, void *repv) · line 236
Quoted 10 lines
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +10
-0+ if (IS_ERR(argv)) + return argv; + + return nvkm_gsp_rm_ctrl_push(object, argv, repc); +} + +static inline int +nvkm_gsp_rm_ctrl_wr (struct nvkm_gsp_object *object,void *argv) +{ + void *repv = nvkm_gsp_rm_ctrl_push(object, argv, 0);
Why 0? For a generic flags-field I think 0 is indeed intuitive, but this does not seem to be flags.
Maybe write a comment or make it:
u32 do_obvious_thing = 0;
void *repv = nvkm_gsp_rm_ctrl_push(object, argv, do_obvious_thing);
Quoted 1,053 lines
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +13
-0+ + if (IS_ERR(repv)) + return PTR_ERR(repv); + + return 0; +} + +static inline void +nvkm_gsp_rm_ctrl_done (struct nvkm_gsp_object *object,void *repv) +{ + object->client->gsp->rm->rm_ctrl_done(object, repv); +} +int
gv100_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
inttu102_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
inttu116_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h
new file mode 100644
index 000000000000..60ba4967dcd9
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0@@ -0,0 +1,48 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl0080_ctrl0080gpu_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl0080_ctrl0080gpu_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2004-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +21
-0+ +typedef struct NV0080_CTRL_GPU_GET_SRIOV_CAPS_PARAMS { + NvU32 totalVFs; + NvU32 firstVfOffset; + NvU32 vfFeatureMask; + NV_DECLARE_ALIGNED(NvU64 FirstVFBar0Address, 8); + NV_DECLARE_ALIGNED(NvU64 FirstVFBar1Address, 8); + NV_DECLARE_ALIGNED(NvU64 FirstVFBar2Address, 8); + NV_DECLARE_ALIGNED(NvU64 bar0Size, 8); + NV_DECLARE_ALIGNED(NvU64 bar1Size, 8); + NV_DECLARE_ALIGNED(NvU64 bar2Size, 8); + NvBool b64bitBar0; + NvBool b64bitBar1; + NvBool b64bitBar2; + NvBool bSriovEnabled; + NvBool bSriovHeavyEnabled; + NvBool bEmulateVFBar0TlbInvalidationRegister; + NvBool bClientRmAllocatedCtxBuffer; +}NV0080_CTRL_GPU_GET_SRIOV_CAPS_PARAMS ; + +#endif diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/in
c/ctrl/ctrl0080/ctrl0080gr.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h
new file mode 100644
index 000000000000..c08e2fcb4979
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0@@ -0,0 +1,31 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl0080_ctrl0080gr_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl0080_ctrl0080gr_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2004-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0+ +#define NV0080_CTRL_GR_CAPS_TBL_SIZE 23 + +#endif diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/in
c/ctrl/ctrl2080/ctrl2080bios.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h
new file mode 100644
index 000000000000..9c61a6f74aa4
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080bios.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0@@ -0,0 +1,40 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080bios_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080bios_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2005-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +13
-0+ +typedef struct NV2080_CTRL_BIOS_GET_SKU_INFO_PARAMS { + NvU32 BoardID; + char chipSKU[4]; + char chipSKUMod[2]; + char project[5]; + char projectSKU[5]; + char CDP[6]; + char projectSKUMod[2]; + NvU32 businessCycle; +}NV2080_CTRL_BIOS_GET_SKU_INFO_PARAMS ; + +#endif diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/in
c/ctrl/ctrl2080/ctrl2080fb.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h
new file mode 100644
index 000000000000..20a50a22e748
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0@@ -0,0 +1,51 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080fb_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080fb_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2006-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0+ +#define NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_MEM_TYPES 17U + +typedef NvBoolNV2080_CTRL_CMD_FB_GET_FB_REGION_SURFACE_MEM_TYPE_FLAG[NV2080_CTRL_CM
D_FB_GET_FB_REGION_INFO_MEM_TYPES];drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +6
-0+ +typedef struct NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO { + NV_DECLARE_ALIGNED(NvU64 base, 8); + NV_DECLARE_ALIGNED(NvU64 limit, 8); + NV_DECLARE_ALIGNED(NvU64 reserved, 8); + NvU32performance;
+ NvBool
supportCompressed;
+ NvBool
supportISO;
+ NvBool
bProtected;
+NV2080_CTRL_CMD_FB_GET_FB_REGION_SURFACE_MEM_TYPE_FLAGblackList;drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +7
-0+}NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO ; + +#define NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_MAX_ENTRIES 16U + +typedef struct NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMS { + NvU32 numFBRegions; +NV_DECLARE_ALIGNED(NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO fbRegion[NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_MAX_ENTRIES], 8);
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+} NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMS; + +#endif diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/in
c/ctrl/ctrl2080/ctrl2080gpu.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h
indexa9a287469305..49a1390743c4100644
---
a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +0
-0@@ -26,8 +26,33 @@* DEALINGS IN THE SOFTWARE. */
+#defineNV2080_GPU_MAX_NAME_STRING_LENGTH(0x0000040U)
+
#defineNV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_0(0x00000000U)
#defineNV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3(0x00000003U)drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +23
-0+typedef struct NV2080_CTRL_GPU_GET_FERMI_GPC_INFO_PARAMS { + NvU32 gpcMask; +}NV2080_CTRL_GPU_GET_FERMI_GPC_INFO_PARAMS ; + +typedef struct NV2080_CTRL_GPU_GET_FERMI_TPC_INFO_PARAMS { + NvU32 gpcId; + NvU32 tpcMask; +}NV2080_CTRL_GPU_GET_FERMI_TPC_INFO_PARAMS ; + +typedef struct NV2080_CTRL_GPU_GET_FERMI_ZCULL_INFO_PARAMS { + NvU32 gpcId; + NvU32 zcullMask; +}NV2080_CTRL_GPU_GET_FERMI_ZCULL_INFO_PARAMS ; + +#define NV2080_GPU_MAX_GID_LENGTH (0x000000100ULL) + +typedef struct NV2080_CTRL_GPU_GET_GID_INFO_PARAMS { + NvU32 index; + NvU32 flags; + NvU32 length; + NvU8 data[NV2080_GPU_MAX_GID_LENGTH]; +}NV2080_CTRL_GPU_GET_GID_INFO_PARAMS ; +#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h
new file mode 100644
index 000000000000..6f99038d6e16
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0@@ -0,0 +1,41 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080gr_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080gr_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2006-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +8
-0+ +typedef enum NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS { + NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_MAIN = 0, + NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_SPILL = 1, + NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_PAGEPOOL = 2, + NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_BETACB = 3, + NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_RTV = 4, + NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_CONTEXT_POOL =5,
+NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_CONTEXT_POOL_CONTROL= 6,
+NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_CONTEXT_POOL_CONTROL_CPU= 7,
+NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_END= 8,drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+} NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS; + +#endif diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_g
pu_nvoc.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_gpu_nvoc.h
new file mode 100644
index 000000000000..7194a8f02909
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_gpu_nvoc.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0@@ -0,0 +1,35 @@ +#ifndef __src_nvidia_generated_g_gpu_nvoc_h__ +#define __src_nvidia_generated_g_gpu_nvoc_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2004-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +8
-0+ +typedef enum +{ + COMPUTE_BRANDING_TYPE_NONE, + COMPUTE_BRANDING_TYPE_TESLA, +}COMPUTE_BRANDING_TYPE ; + +#endif diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_r
pc-structures.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h
indexac59ffa4330b..1ae0a97df392100644
---
a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +0
-0@@ -33,6 +33,17 @@ typedef struct rpc_unloading_guest_driver_v1F_07 NvU32 newLevel; } rpc_unloading_guest_driver_v1F_07;drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +11
-0+typedef struct rpc_gsp_rm_control_v03_00 +{ + NvHandle hClient; + NvHandle hObject; + NvU32 cmd; + NvU32 status; + NvU32 paramsSize; + NvU32 flags; + NvU8 params[]; +}rpc_gsp_rm_control_v03_00 ; +typedef struct
rpc_run_cpu_sequencer_v17_00
{
NvU32 bufferSizeDWord;
diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.h
new file mode 100644
index 000000000000..90cd9f6c4d9a
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0@@ -0,0 +1,86 @@ +#ifndef __src_nvidia_inc_kernel_gpu_gpu_engine_type_h__ +#define __src_nvidia_inc_kernel_gpu_gpu_engine_type_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +59
-0+ +typedef enum +{ + RM_ENGINE_TYPE_NULL = (0x00000000), + RM_ENGINE_TYPE_GR0 = (0x00000001), + RM_ENGINE_TYPE_GR1 = (0x00000002), + RM_ENGINE_TYPE_GR2 = (0x00000003), + RM_ENGINE_TYPE_GR3 = (0x00000004), + RM_ENGINE_TYPE_GR4 = (0x00000005), + RM_ENGINE_TYPE_GR5 = (0x00000006), + RM_ENGINE_TYPE_GR6 = (0x00000007), + RM_ENGINE_TYPE_GR7 = (0x00000008), + RM_ENGINE_TYPE_COPY0 = (0x00000009), + RM_ENGINE_TYPE_COPY1 = (0x0000000a), + RM_ENGINE_TYPE_COPY2 = (0x0000000b), + RM_ENGINE_TYPE_COPY3 = (0x0000000c), + RM_ENGINE_TYPE_COPY4 = (0x0000000d), + RM_ENGINE_TYPE_COPY5 = (0x0000000e), + RM_ENGINE_TYPE_COPY6 = (0x0000000f), + RM_ENGINE_TYPE_COPY7 = (0x00000010), + RM_ENGINE_TYPE_COPY8 = (0x00000011), + RM_ENGINE_TYPE_COPY9 = (0x00000012), + RM_ENGINE_TYPE_NVDEC0 = (0x0000001d), + RM_ENGINE_TYPE_NVDEC1 = (0x0000001e), + RM_ENGINE_TYPE_NVDEC2 = (0x0000001f), + RM_ENGINE_TYPE_NVDEC3 = (0x00000020), + RM_ENGINE_TYPE_NVDEC4 = (0x00000021), + RM_ENGINE_TYPE_NVDEC5 = (0x00000022), + RM_ENGINE_TYPE_NVDEC6 = (0x00000023), + RM_ENGINE_TYPE_NVDEC7 = (0x00000024), + RM_ENGINE_TYPE_NVENC0 = (0x00000025), + RM_ENGINE_TYPE_NVENC1 = (0x00000026), + RM_ENGINE_TYPE_NVENC2 = (0x00000027), + RM_ENGINE_TYPE_VP = (0x00000028), + RM_ENGINE_TYPE_ME = (0x00000029), + RM_ENGINE_TYPE_PPP = (0x0000002a), + RM_ENGINE_TYPE_MPEG = (0x0000002b), + RM_ENGINE_TYPE_SW = (0x0000002c), + RM_ENGINE_TYPE_TSEC = (0x0000002d), + RM_ENGINE_TYPE_VIC = (0x0000002e), + RM_ENGINE_TYPE_MP = (0x0000002f), + RM_ENGINE_TYPE_SEC2 = (0x00000030), + RM_ENGINE_TYPE_HOST = (0x00000031), + RM_ENGINE_TYPE_DPU = (0x00000032), + RM_ENGINE_TYPE_PMU = (0x00000033), + RM_ENGINE_TYPE_FBFLCN = (0x00000034), + RM_ENGINE_TYPE_NVJPEG0 = (0x00000035), + RM_ENGINE_TYPE_NVJPEG1 = (0x00000036), + RM_ENGINE_TYPE_NVJPEG2 = (0x00000037), + RM_ENGINE_TYPE_NVJPEG3 = (0x00000038), + RM_ENGINE_TYPE_NVJPEG4 = (0x00000039), + RM_ENGINE_TYPE_NVJPEG5 = (0x0000003a), + RM_ENGINE_TYPE_NVJPEG6 = (0x0000003b), + RM_ENGINE_TYPE_NVJPEG7 = (0x0000003c), + RM_ENGINE_TYPE_OFA = (0x0000003d), + RM_ENGINE_TYPE_LAST = (0x0000003e), +}RM_ENGINE_TYPE ; + +#endif diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gp
u/gsp/gsp_static_config.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_static_config.h
indexba8cd897ebcc..3f99cab47a13100644
---
a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_static_config.h
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/gsp/gsp_static_config.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +1
-0@@ -1,7 +1,16 @@ #ifndef __src_nvidia_inc_kernel_gpu_gsp_gsp_static_config_h__ #define __src_nvidia_inc_kernel_gpu_gsp_gsp_static_config_h__ +#include<
nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gpu.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0080/ctrl0080gr.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080bios.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fb.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gr.h> #include <nvrm/535.54.03/nvidia/generated/g_chipset_nvoc.h> +#include <nvrm/535.54.03/nvidia/generated/g_gpu_nvoc.h> #include <nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_acpi_data.h>drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +2
-0+#include <nvrm/535.54.03/nvidia/inc/kernel/gpu/nvbitmask.h> +#include <nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h>
/* Excerpt of RM headers from
https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +0
-0@@ -40,6 +49,97 @@ typedef struct GSP_VF_INFO NvBool b64bitBar2; } GSP_VF_INFO;drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +19
-0+typedef struct GspSMInfo_t +{ + NvU32 version; + NvU32 regBankCount; + NvU32 regBankRegCount; + NvU32 maxWarpsPerSM; + NvU32 maxThreadsPerWarp; + NvU32 geomGsObufEntries; + NvU32 geomXbufEntries; + NvU32 maxSPPerSM; + NvU32 rtCoreCount; +}GspSMInfo ; + +typedef struct GspStaticConfigInfo_t +{ + NvU8 grCapsBits[NV0080_CTRL_GR_CAPS_TBL_SIZE]; + NV2080_CTRL_GPU_GET_GID_INFO_PARAMS gidInfo; + NV2080_CTRL_GPU_GET_FERMI_GPC_INFO_PARAMS gpcInfo; + NV2080_CTRL_GPU_GET_FERMI_TPC_INFO_PARAMStpcInfo[MAX_GPC_COUNT];
+NV2080_CTRL_GPU_GET_FERMI_ZCULL_INFO_PARAMSzcullInfo[MAX_GPC_COUNT];
+NV2080_CTRL_BIOS_GET_SKU_INFO_PARAMSSKUInfo;
+NV2080_CTRL_CMD_FB_GET_FB_REGION_INFO_PARAMSfbRegionInfoParams; +COMPUTE_BRANDING_TYPEcomputeBranding;drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +18
-0+ + NV0080_CTRL_GPU_GET_SRIOV_CAPS_PARAMS sriovCaps; + NvU32 sriovMaxGfid; + + NvU32 engineCaps[NVGPU_ENGINE_CAPS_MASK_ARRAY_MAX]; + + GspSMInfo SM_info; + + NvBool poisonFuseEnabled; + + NvU64 fb_length; + NvU32 fbio_mask; + NvU32 fb_bus_width; + NvU32 fb_ram_type; + NvU32 fbp_mask; + NvU32 l2_cache_size; + + NvU32gfxpBufferSize[NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_CONTE
XT_POOL];
+ NvU32 gfxpBufferAlignment[NV2080_CTRL_CMD_GR_CTXSW_PREEMPTION_BIND_BUFFERS_CONTEXT_POOL];drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +32
-0+ + NvU8 gpuNameString[NV2080_GPU_MAX_NAME_STRING_LENGTH]; + NvU8 gpuShortNameString[NV2080_GPU_MAX_NAME_STRING_LENGTH]; + NvU16 gpuNameString_Unicode[NV2080_GPU_MAX_NAME_STRING_LENGTH]; + NvBool bGpuInternalSku; + NvBool bIsQuadroGeneric; + NvBool bIsQuadroAd; + NvBool bIsNvidiaNvs; + NvBool bIsVgx; + NvBool bGeforceSmb; + NvBool bIsTitan; + NvBool bIsTesla; + NvBool bIsMobile; + NvBool bIsGc6Rtd3Allowed; + NvBool bIsGcOffRtd3Allowed; + NvBool bIsGcoffLegacyAllowed; + + NvU64 bar1PdeBase; + NvU64 bar2PdeBase; + + NvBool bVbiosValid; + NvU32 vbiosSubVendor; + NvU32 vbiosSubDevice; + + NvBool bPageRetirementSupported; + + NvBool bSplitVasBetweenServerClientRm; + + NvBool bClRootportNeedsNosnoopWAR; + + VIRTUAL_DISPLAY_GET_NUM_HEADS_PARAMS displaylessMaxHeads; + VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMSdisplaylessMaxResolution;
+ NvU64 displaylessMaxPixels;drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +16
-0+ + // Client handle for internal RMAPI control. + NvHandle hInternalClient; + + // Device handle for internal RMAPI control. + NvHandle hInternalDevice; + + // Subdevice handle for internal RMAPI control. + NvHandle hInternalSubdevice; + + NvBool bSelfHostedMode; + NvBool bAtsSupported; + + NvBool bIsGpuUefi; +} GspStaticConfigInfo; +typedef struct GspSystemInfo
{
NvU64 gpuPhysAddr;
diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/nvbitmask.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/nvbitmask.h
new file mode 100644
index 000000000000..16168294e524
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/nvbitmask.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +5
-0@@ -0,0 +1,33 @@ +#ifndef __src_nvidia_inc_kernel_gpu_nvbitmask_h__ +#define __src_nvidia_inc_kernel_gpu_nvbitmask_h__ +#include <nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.h> + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +#define NVGPU_ENGINE_CAPS_MASK_BITS 32 +#define NVGPU_ENGINE_CAPS_MASK_ARRAY_MAX ((RM_ENGINE_TYPE_LAST-1)/NVGPU_ENGINE_CAPS_MASK_BITS + 1)
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +2
-0+ +#endif diff --git a/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vg
pu/rpc_headers.hb/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h
new file mode 100644
index 000000000000..b48b26049b9d
---/dev/null
+++
b/drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +4
-0@@ -0,0 +1,44 @@ +#ifndef __src_nvidia_kernel_inc_vgpu_rpc_headers_h__ +#define __src_nvidia_kernel_inc_vgpu_rpc_headers_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +3
-0+ +/* +* SPDX-FileCopyrightText: Copyright (c) 2017-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * 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.
+ */drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +17
-0+ +#define MAX_GPC_COUNT 32 + +typedef struct VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMS +{ + NvU32 headIndex; + NvU32 maxHResolution; + NvU32 maxVResolution; +}VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMS ; + +typedef struct VIRTUAL_DISPLAY_GET_NUM_HEADS_PARAMS +{ + NvU32 numHeads; + NvU32 maxNumHeads; +}VIRTUAL_DISPLAY_GET_NUM_HEADS_PARAMS ; + +#endif drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +0
-0@@ -354,6 +354,61 @@ r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *argv, bool wait, u32 repc) return repv; }drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +2
-0+static void +r535_gsp_rpc_rm_ctrl_done(struct nvkm_gsp_object *object, void*repv)
+{
+ rpc_gsp_rm_control_v03_00 *rpc =container_of(repv, typeof(*rpc), params);drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +6
-0+ + nvkm_gsp_rpc_done(object->client->gsp, rpc); +} + +static void * +r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void*argv, u32 repc)
+{
+ rpc_gsp_rm_control_v03_00 *rpc =container_of(argv, typeof(*rpc), params);
+ structnvkm_gsp*gsp =object->client->gsp; + void *ret;drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +7
-0+ + rpc = nvkm_gsp_rpc_push(gsp, rpc, true, repc); + if (IS_ERR_OR_NULL(rpc)) + return rpc; + + if (rpc->status) { + nvkm_error(&gsp->subdev, "cli:0x%08x obj:0x%08x ctrlcmd:0x%08x failed: 0x%08x\n",
+object->client->object.handle, object-Quoted 1 line
handle,
rpc->cmd,rpc->status);+ ret =
ERR_PTR(-EINVAL);
+ } else {
+ ret = repc ?rpc->params: NULL;
+ }drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +9
-0+ + if (IS_ERR_OR_NULL(ret)) + nvkm_gsp_rpc_done(gsp, rpc); + + return ret; +} + +static void * +r535_gsp_rpc_rm_ctrl_get(struct nvkm_gsp_object *object, u32 cmd,u32 argc)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +6
-0+{ + struct nvkm_gsp_client *client = object->client; + struct nvkm_gsp *gsp = client->gsp; + rpc_gsp_rm_control_v03_00 *rpc; + + nvkm_debug(&gsp->subdev, "cli:0x%08x obj:0x%08x ctrlcmd:0x%08x argc:%d\n",
+client->object.handle,object->handle, cmd, argc); +
+ rpc =nvkm_gsp_rpc_get(gsp, NV_VGPU_MSG_FUNCTION_GSP_RM_CONTROL, sizeof(*rpc) + argc); + if (IS_ERR(rpc))
+ return rpc;drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +9
-0+ + rpc->hClient = client->object.handle; + rpc->hObject = object->handle; + rpc->cmd = cmd; + rpc->status = 0; + rpc->paramsSize = argc; + return rpc->params; +} +static void
r535_gsp_rpc_done(structnvkm_gsp*gsp, void *repv) {drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +4
-0@@ -450,8 +505,50 @@ r535_gsp_rm = { .rpc_get = r535_gsp_rpc_get, .rpc_push = r535_gsp_rpc_push, .rpc_done = r535_gsp_rpc_done, + + .rm_ctrl_get = r535_gsp_rpc_rm_ctrl_get, + .rm_ctrl_push = r535_gsp_rpc_rm_ctrl_push, + .rm_ctrl_done = r535_gsp_rpc_rm_ctrl_done, };drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +6
-0+static int +r535_gsp_rpc_get_gsp_static_info (struct nvkm_gsp *gsp) +{ + GspStaticConfigInfo *rpc; + + rpc = nvkm_gsp_rpc_rd(gsp,
NV_VGPU_MSG_FUNCTION_GET_GSP_STATIC_INFO,sizeof(*rpc)); + if (IS_ERR(rpc))
+ returnPTR_ERR(rpc);drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +8
-0+ + gsp->internal.client.object.client = &gsp->internal.client; + gsp->internal.client.object.parent = NULL; + gsp->internal.client.object.handle = rpc->hInternalClient; + gsp->internal.client.gsp = gsp; + + gsp->internal.device.object.client = &gsp->internal.client; + gsp->internal.device.object.parent = &gsp-Quoted 1 line
internal.client.object;
+ gsp->internal.device.object.handle =
rpc->hInternalDevice; +
+ gsp->internal.device.subdevice.client = &gsp-Quoted 1 line
internal.client;
+ gsp->internal.device.subdevice.parent = &gsp-
Quoted 1 line
internal.device.object;
+ gsp->internal.device.subdevice.handle = rpc-
Quoted 1 line
hInternalSubdevice;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +17
-0+ + nvkm_gsp_rpc_done(gsp, rpc); + return 0; +} + +static int +r535_gsp_postinit (struct nvkm_gsp *gsp) +{ + int ret; + + ret = r535_gsp_rpc_get_gsp_static_info(gsp); + if (WARN_ON(ret)) + return ret; + + return ret; +} +static int
r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, bool suspend)
{drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +1
-0@@ -1302,8 +1399,12 @@ r535_gsp_init(struct nvkm_gsp *gsp) nvkm_gsp_mem_dtor(gsp, &gsp->sr.meta); nvkm_gsp_radix3_dtor(gsp, &gsp->sr.radix3); nvkm_gsp_sg_free(gsp->subdev.device, &gsp->sr.sgt); + return ret; }
+ if (ret == 0)
+ ret =r535_gsp_postinit(gsp);
+
return ret;
}
PATCH 34/44 drm/nouveau/gsp/r535: add support for rm alloc
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
Adds the plumbing to be able to allocate and free RM objects, and implements RM client/device/subdevice allocation with it.
These will be used by subsequent patches.
--- .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 131 +++++++++++++ .../common/sdk/nvidia/inc/class/cl0000.h | 38 ++++ .../common/sdk/nvidia/inc/class/cl0080.h | 43 ++++ .../common/sdk/nvidia/inc/class/cl2080.h | 35 ++++ .../common/sdk/nvidia/inc/nvlimits.h | 31 +++ .../nvidia/generated/g_rpc-structures.h | 19 ++ .../nvidia/generated/g_sdk-structures.h | 37 ++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 184 ++++++++++++++++++ 8 files changed, 518 insertions(+) create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0000.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0080.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_sdk-structures.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +131 -0
@@ -158,7 +158,24 @@ struct nvkm_gsp {void *(*rm_ctrl_get)(struct nvkm_gsp_object *,u32 cmd,u32 argc);void *(*rm_ctrl_push)(struct nvkm_gsp_object *,void *argv,u32 repc);void (*rm_ctrl_done)(struct nvkm_gsp_object *,void *repv); + +void *(*rm_alloc_get)(struct nvkm_gsp_object *,u32 oclass,u32 argc); +void *(*rm_alloc_push)(struct nvkm_gsp_object *,void *argv,u32 repc); +void (*rm_alloc_done)(struct nvkm_gsp_object *,void *repv); + +int (*rm_free)(struct nvkm_gsp_object *); + +int (*client_ctor)(struct nvkm_gsp *,struct nvkm_gsp_client *); +void (*client_dtor)(struct nvkm_gsp_client *); + +int (*device_ctor)(struct nvkm_gsp_client *,struct nvkm_gsp_device *); +void (*device_dtor)(struct nvkm_gsp_device *); } *rm; + +struct { + struct mutex mutex;; +struct idr idr; + } client_id; }; static inline bool
@@ -247,6 +264,120 @@ nvkm_gsp_rm_ctrl_done(struct nvkm_gsp_object *object, void *repv) object->client->gsp->rm->rm_ctrl_done (object, repv); } +static inline void * +nvkm_gsp_rm_alloc_get (struct nvkm_gsp_object *parent,u32 handle,u32 oclass,u32 argc, +struct nvkm_gsp_object *object) +{ +struct nvkm_gsp_client *client = parent->client; +struct nvkm_gsp *gsp = client->gsp; +void *argv; + + object->client = parent->client; + object->parent = parent; + object->handle = handle; + + argv = gsp->rm->rm_alloc_get (object, oclass, argc); +if (IS_ERR_OR_NULL (argv)) { + object->client =NULL ; +return argv; + } + +return argv; +} + +static inline void * +nvkm_gsp_rm_alloc_push (struct nvkm_gsp_object *object,void *argv,u32 repc) +{ +void *repv = object->client->gsp->rm->rm_alloc_push (object, argv, repc); + +if (IS_ERR (repv)) + object->client =NULL ; + +return repv; +} + +static inline int +nvkm_gsp_rm_alloc_wr (struct nvkm_gsp_object *object,void *argv) +{ +void *repv =nvkm_gsp_rm_alloc_push (object, argv,0 ); + +if (IS_ERR (repv)) +return PTR_ERR (repv); + +return 0 ; +} + +static inline void +nvkm_gsp_rm_alloc_done (struct nvkm_gsp_object *object,void *repv) +{ + object->client->gsp->rm->rm_alloc_done (object, repv); +} + +static inline int +nvkm_gsp_rm_alloc (struct nvkm_gsp_object *parent,u32 handle,u32 oclass,u32 argc, +struct nvkm_gsp_object *object) +{ +void *argv =nvkm_gsp_rm_alloc_get (parent, handle, oclass, argc, object); + +if (IS_ERR_OR_NULL (argv)) +return argv ?PTR_ERR (argv) : -EIO ; + +return nvkm_gsp_rm_alloc_wr (object, argv); +} + +static inline int +nvkm_gsp_rm_free (struct nvkm_gsp_object *object) +{ +if (object->client) +return object->client->gsp->rm->rm_free (object); + +return 0 ; +} + +static inline int +nvkm_gsp_client_ctor (struct nvkm_gsp *gsp,struct nvkm_gsp_client *client) +{ +if (WARN_ON (!gsp->rm)) +return -ENOSYS ; + +return gsp->rm->client_ctor (gsp, client); +} + +static inline void +nvkm_gsp_client_dtor (struct nvkm_gsp_client *client) +{ +if (client->gsp) + client->gsp->rm->client_dtor (client); +} + +static inline int +nvkm_gsp_device_ctor (struct nvkm_gsp_client *client,struct nvkm_gsp_device *device) +{ +return client->gsp->rm->device_ctor (client, device); +} + +static inline void +nvkm_gsp_device_dtor (struct nvkm_gsp_device *device) +{ +if (device->object.client) + device->object.client->gsp->rm->device_dtor (device); +} + +static inline int +nvkm_gsp_client_device_ctor (struct nvkm_gsp *gsp, +struct nvkm_gsp_client *client,struct nvkm_gsp_device *device) +{ +int ret =nvkm_gsp_client_ctor (gsp, client); + +if (ret ==0 ) { + ret =nvkm_gsp_device_ctor (client, device); +if (ret) +nvkm_gsp_client_dtor (client); + } + +return ret; +} +int gv100_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int tu102_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int tu116_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0000.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl0000_h__ +#define __src_common_sdk_nvidia_inc_class_cl0000_h__ +#include <nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h> + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2001-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV01_ROOT (0x0U)/* finn: Evaluated from "NV0000_ALLOC_PARAMETERS_MESSAGE_ID" */ + +typedef struct NV0000_ALLOC_PARAMETERS { +NvHandle hClient;/* CORERM-2934: hClient must remain the first member until all allocations use these params */ +NvU32 processID; +char processName[NV_PROC_NAME_MAX_LENGTH ]; +}NV0000_ALLOC_PARAMETERS ; + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0080.h new file +43 -0
43 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080.h new file +35 -0
@@ -0,0 +1,35 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl2080_h__ +#define __src_common_sdk_nvidia_inc_class_cl2080_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2002-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV20_SUBDEVICE_0 (0x2080U)/* finn: Evaluated from "NV2080_ALLOC_PARAMETERS_MESSAGE_ID" */ + +typedef struct NV2080_ALLOC_PARAMETERS { +NvU32 subDeviceId; +}NV2080_ALLOC_PARAMETERS ; + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef __src_common_sdk_nvidia_inc_nvlimits_h__ +#define __src_common_sdk_nvidia_inc_nvlimits_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2017 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV_PROC_NAME_MAX_LENGTH 100U + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h +19 -0
@@ -1,5 +1,6 @@#ifndef __src_nvidia_generated_g_rpc_structures_h__#define __src_nvidia_generated_g_rpc_structures_h__ +#include <nvrm/535.54.03/nvidia/generated/g_sdk-structures.h> /* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
@@ -26,6 +27,11 @@* DEALINGS IN THE SOFTWARE. */ +typedef struct rpc_free_v03_00 +{ +NVOS00_PARAMETERS_v03_00 params; +}rpc_free_v03_00 ; + typedef struct rpc_unloading_guest_driver_v1F_07 { NvBool bInPMTransition;
@@ -33,6 +39,19 @@ typedef struct rpc_unloading_guest_driver_v1F_07NvU32 newLevel; } rpc_unloading_guest_driver_v1F_07; +typedef struct rpc_gsp_rm_alloc_v03_00 +{ +NvHandle hClient; +NvHandle hParent; +NvHandle hObject; +NvU32 hClass; +NvU32 status; +NvU32 paramsSize; +NvU32 flags; +NvU8 reserved[4 ]; +NvU8 params[]; +}rpc_gsp_rm_alloc_v03_00 ; + typedef struct rpc_gsp_rm_control_v03_00 { NvHandle hClient;
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_sdk-structures.h new file +37 -0
@@ -0,0 +1,37 @@ +#ifndef __src_nvidia_generated_g_sdk_structures_h__ +#define __src_nvidia_generated_g_sdk_structures_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2008-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NVOS00_PARAMETERS_v03_00 +{ +NvHandle hRoot; +NvHandle hObjectParent; +NvHandle hObjectOld; +NvV32 status; +}NVOS00_PARAMETERS_v03_00 ; + +#endif
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +184 -0
214 lines not on this page · raw message
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 34/44] drm/nouveau/gsp/r535: add support for rm alloc
Quoted 62 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
Adds the plumbing to be able to allocate and free RM objects, and implements RM client/device/subdevice allocation with it.
These will be used by subsequent patches.
Signed-off-by Ben Skeggs <[email protected]>--- .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 131 +++++++++++++ .../common/sdk/nvidia/inc/class/cl0000.h | 38 ++++ .../common/sdk/nvidia/inc/class/cl0080.h | 43 ++++ .../common/sdk/nvidia/inc/class/cl2080.h | 35 ++++ .../common/sdk/nvidia/inc/nvlimits.h | 31 +++ .../nvidia/generated/g_rpc-structures.h | 19 ++ .../nvidia/generated/g_sdk-structures.h | 37 ++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 184 ++++++++++++++++++ 8 files changed, 518 insertions(+)create mode 100644
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0000.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0080.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_sdk-structures.hdrivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +22
-0@@ -158,7 +158,24 @@ struct nvkm_gsp {void *(*rm_ctrl_get)(struct nvkm_gsp_object *,u32 cmd,u32 argc);void *(*rm_ctrl_push)(struct nvkm_gsp_object *,void *argv,u32 repc);void (*rm_ctrl_done)(struct nvkm_gsp_object *,void *repv); + +void *(*rm_alloc_get)(struct nvkm_gsp_object *,u32 oclass,u32 argc); +void *(*rm_alloc_push)(struct nvkm_gsp_object *,void *argv,u32 repc); +void (*rm_alloc_done)(struct nvkm_gsp_object *,void *repv); + +int (*rm_free)(struct nvkm_gsp_object *); + +int (*client_ctor)(struct nvkm_gsp *,struct nvkm_gsp_client *); +void (*client_dtor)(struct nvkm_gsp_client *); + +int (*device_ctor)(struct nvkm_gsp_client *,struct nvkm_gsp_device *); +void (*device_dtor)(struct nvkm_gsp_device *); } *rm; + +struct { + struct mutex mutex;; +struct idr idr; + } client_id; }; static inline bool@@ -247,6 +264,120 @@ nvkm_gsp_rm_ctrl_done(struct nvkm_gsp_object *object, void *repv) object->client->gsp->rm->rm_ctrl_done (object, repv); } +static inline void * +nvkm_gsp_rm_alloc_get (struct nvkm_gsp_object *parent,u32 handle,u32 oclass,u32 argc, +struct nvkm_gsp_object *object) +{ +struct nvkm_gsp_client *client = parent->client;
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h nvkm_gsp_rm_ctrl_done(struct nvkm_gsp_object *object, void *repv) · line 281
Quoted 10 lines
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +10
-0+struct nvkm_gsp *gsp = client->gsp; +void *argv; + + object->client = parent->client; + object->parent = parent; + object->handle = handle; + + argv = gsp->rm->rm_alloc_get (object, oclass, argc); +if (IS_ERR_OR_NULL (argv)) { + object->client =NULL ;
Why do we need to set ->client to NULL here? What about ->parent and ->handle?
Quoted 390 lines
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +99
-0+return argv; + } + +return argv; +} + +static inline void * +nvkm_gsp_rm_alloc_push (struct nvkm_gsp_object *object,void *argv,u32 repc) +{ +void *repv = object->client->gsp->rm->rm_alloc_push (object, argv, repc); + +if (IS_ERR (repv)) + object->client =NULL ; + +return repv; +} + +static inline int +nvkm_gsp_rm_alloc_wr (struct nvkm_gsp_object *object,void *argv) +{ +void *repv =nvkm_gsp_rm_alloc_push (object, argv,0 ); + +if (IS_ERR (repv)) +return PTR_ERR (repv); + +return 0 ; +} + +static inline void +nvkm_gsp_rm_alloc_done (struct nvkm_gsp_object *object,void *repv) +{ + object->client->gsp->rm->rm_alloc_done (object, repv); +} + +static inline int +nvkm_gsp_rm_alloc (struct nvkm_gsp_object *parent,u32 handle,u32 oclass,u32 argc, +struct nvkm_gsp_object *object) +{ +void *argv =nvkm_gsp_rm_alloc_get (parent, handle, oclass, argc, object); + +if (IS_ERR_OR_NULL (argv)) +return argv ?PTR_ERR (argv) : -EIO ; + +return nvkm_gsp_rm_alloc_wr (object, argv); +} + +static inline int +nvkm_gsp_rm_free (struct nvkm_gsp_object *object) +{ +if (object->client) +return object->client->gsp->rm->rm_free (object); + +return 0 ; +} + +static inline int +nvkm_gsp_client_ctor (struct nvkm_gsp *gsp,struct nvkm_gsp_client *client) +{ +if (WARN_ON (!gsp->rm)) +return -ENOSYS ; + +return gsp->rm->client_ctor (gsp, client); +} + +static inline void +nvkm_gsp_client_dtor (struct nvkm_gsp_client *client) +{ +if (client->gsp) + client->gsp->rm->client_dtor (client); +} + +static inline int +nvkm_gsp_device_ctor (struct nvkm_gsp_client *client,struct nvkm_gsp_device *device) +{ +return client->gsp->rm->device_ctor (client, device); +} + +static inline void +nvkm_gsp_device_dtor (struct nvkm_gsp_device *device) +{ +if (device->object.client) + device->object.client->gsp->rm->device_dtor (device); +} + +static inline int +nvkm_gsp_client_device_ctor (struct nvkm_gsp *gsp, +struct nvkm_gsp_client *client,struct nvkm_gsp_device *device) +{ +int ret =nvkm_gsp_client_ctor (gsp, client); + +if (ret ==0 ) { + ret =nvkm_gsp_device_ctor (client, device); +if (ret) +nvkm_gsp_client_dtor (client); + } + +return ret; +} +int gv100_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int tu102_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int tu116_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0000.h new file +38
-0@@ -0,0 +1,38 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl0000_h__ +#define __src_common_sdk_nvidia_inc_class_cl0000_h__ +#include <nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h> + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2001-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV01_ROOT (0x0U)/* finn: Evaluated from "NV0000_ALLOC_PARAMETERS_MESSAGE_ID" */ + +typedef struct NV0000_ALLOC_PARAMETERS { +NvHandle hClient;/* CORERM-2934: hClient must remain the first member until all allocations use these params */ +NvU32 processID; +char processName[NV_PROC_NAME_MAX_LENGTH ]; +}NV0000_ALLOC_PARAMETERS ; + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0080.h new file +43
-0@@ -0,0 +1,43 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl0080_h__ +#define __src_common_sdk_nvidia_inc_class_cl0080_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2001-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV01_DEVICE_0 (0x80U)/* finn: Evaluated from "NV0080_ALLOC_PARAMETERS_MESSAGE_ID" */ + +typedef struct NV0080_ALLOC_PARAMETERS { +NvU32 deviceId; +NvHandle hClientShare; +NvHandle hTargetClient; +NvHandle hTargetDevice; +NvV32 flags; + NV_DECLARE_ALIGNED(NvU64 vaSpaceSize, 8); + NV_DECLARE_ALIGNED(NvU64 vaStartInternal, 8); + NV_DECLARE_ALIGNED(NvU64 vaLimitInternal, 8); +NvV32 vaMode; +}NV0080_ALLOC_PARAMETERS ; + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080.h new file +35
-0@@ -0,0 +1,35 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl2080_h__ +#define __src_common_sdk_nvidia_inc_class_cl2080_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2002-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV20_SUBDEVICE_0 (0x2080U)/* finn: Evaluated from "NV2080_ALLOC_PARAMETERS_MESSAGE_ID" */ + +typedef struct NV2080_ALLOC_PARAMETERS { +NvU32 subDeviceId; +}NV2080_ALLOC_PARAMETERS ; + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h new file +31
-0@@ -0,0 +1,31 @@ +#ifndef __src_common_sdk_nvidia_inc_nvlimits_h__ +#define __src_common_sdk_nvidia_inc_nvlimits_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2017 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV_PROC_NAME_MAX_LENGTH 100U + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h +19
-0@@ -1,5 +1,6 @@#ifndef __src_nvidia_generated_g_rpc_structures_h__#define __src_nvidia_generated_g_rpc_structures_h__ +#include <nvrm/535.54.03/nvidia/generated/g_sdk-structures.h> /* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ @@ -26,6 +27,11 @@* DEALINGS IN THE SOFTWARE. */ +typedef struct rpc_free_v03_00 +{ +NVOS00_PARAMETERS_v03_00 params; +}rpc_free_v03_00 ; + typedef struct rpc_unloading_guest_driver_v1F_07 { NvBool bInPMTransition;@@ -33,6 +39,19 @@ typedef struct rpc_unloading_guest_driver_v1F_07NvU32 newLevel; } rpc_unloading_guest_driver_v1F_07; +typedef struct rpc_gsp_rm_alloc_v03_00 +{ +NvHandle hClient; +NvHandle hParent; +NvHandle hObject; +NvU32 hClass; +NvU32 status; +NvU32 paramsSize; +NvU32 flags; +NvU8 reserved[4 ]; +NvU8 params[]; +}rpc_gsp_rm_alloc_v03_00 ; + typedef struct rpc_gsp_rm_control_v03_00 { NvHandle hClient;drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_sdk-structures.h new file +37
-0@@ -0,0 +1,37 @@ +#ifndef __src_nvidia_generated_g_sdk_structures_h__ +#define __src_nvidia_generated_g_sdk_structures_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2008-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NVOS00_PARAMETERS_v03_00 +{ +NvHandle hRoot; +NvHandle hObjectParent; +NvHandle hObjectOld; +NvV32 status; +}NVOS00_PARAMETERS_v03_00 ; + +#endif drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +16
-0@@ -28,6 +28,9 @@#include <nvfw/fw.h> #include <nvrm/nvtypes.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0000.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0080.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080.h> #include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080gpu.h> #include <nvrm/535.54.03/common/shared/msgq/inc/msgq/msgq_priv.h> #include <nvrm/535.54.03/common/uproc/os/common/include/libos_init_args.h> @@ -354,6 +357,169 @@ r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *argv, bool wait, u32 repc)return repv; } +static void +r535_gsp_device_dtor (struct nvkm_gsp_device *device) +{ +nvkm_gsp_rm_free (&device->subdevice); +nvkm_gsp_rm_free (&device->object); +} + +static int +r535_gsp_subdevice_ctor (struct nvkm_gsp_device *device) +{ +NV2080_ALLOC_PARAMETERS *args; + + return nvkm_gsp_rm_alloc(&device->object, 0x5d1d0000, NV20_SUBDEVICE_0, sizeof(*args),
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *argv, bool wait, u32 repc) · line 382
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +10
-0+ &device->subdevice); +} + +static int +r535_gsp_device_ctor (struct nvkm_gsp_client *client,struct nvkm_gsp_device *device) +{ +NV0080_ALLOC_PARAMETERS *args; +int ret; + + args = nvkm_gsp_rm_alloc_get(&client->object, 0xde1d0000, NV01_DEVICE_0, sizeof(*args),
What is this handle (0xde1d0000)?
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *argv, bool wait, u32 repc) · line 387
Quoted 5 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +5
-0+ &device->object); +if (IS_ERR (args)) +return PTR_ERR (args); + + args->hClientShare = client->object.handle;
Is the handle used for anything else than this?
Quoted 12 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +12
-0+ + ret =nvkm_gsp_rm_alloc_wr (&device->object, args); +if (ret) +return ret; + + ret =r535_gsp_subdevice_ctor (device); +if (ret) +nvkm_gsp_rm_free (&device->object); + +return ret; +} +
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *argv, bool wait, u32 repc) · line 409
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +10
-0+static void +r535_gsp_client_dtor (struct nvkm_gsp_client *client) +{ +struct nvkm_gsp *gsp = client->gsp; + +nvkm_gsp_rm_free (&client->object); + +mutex_lock (&gsp->client_id.mutex); +idr_remove (&gsp->client_id.idr, client->object.handle &0xffff ); +mutex_unlock (&gsp->client_id.mutex);
Should use xarray instead, this also gets us rid of the dedicated mutex.
Quoted 17 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +17
-0+ + client->gsp =NULL ; +} + +static int +r535_gsp_client_ctor (struct nvkm_gsp *gsp,struct nvkm_gsp_client *client) +{ +NV0000_ALLOC_PARAMETERS *args; +int ret; + +mutex_lock (&gsp->client_id.mutex); + ret =idr_alloc (&gsp->client_id.idr, client,0 ,0xffff +1 ,GFP_KERNEL ); +mutex_unlock (&gsp->client_id.mutex); +if (ret <0 ) +return ret; + + client->gsp = gsp;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c r535_gsp_rpc_send(struct nvkm_gsp *gsp, void *argv, bool wait, u32 repc) · line 436
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +10
-0+ client->object.client = client; + + args =nvkm_gsp_rm_alloc_get (&client->object,0xc1d00000 | ret,NV01_ROOT ,sizeof (*args), + &client->object); +if (IS_ERR (args)) { +r535_gsp_client_dtor (client); +return ret; + } + + args->hClient = client->object.handle;
Same as above, used anywhere else?
Quoted 128 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +104
-0+ args->processID = ~0 ; + + ret =nvkm_gsp_rm_alloc_wr (&client->object, args); +if (ret) { +r535_gsp_client_dtor (client); +return ret; + } + +return 0 ; +} + +static int +r535_gsp_rpc_rm_free (struct nvkm_gsp_object *object) +{ +struct nvkm_gsp_client *client = object->client; +struct nvkm_gsp *gsp = client->gsp; +rpc_free_v03_00 *rpc; + +nvkm_debug (&gsp->subdev,"cli:0x%08x obj:0x%08x free\n" , + client->object.handle, object->handle); + + rpc =nvkm_gsp_rpc_get (gsp,NV_VGPU_MSG_FUNCTION_FREE ,sizeof (*rpc)); +if (WARN_ON (IS_ERR_OR_NULL (rpc))) +return -EIO ; + + rpc->params.hRoot = client->object.handle; + rpc->params.hObjectParent =0 ; + rpc->params.hObjectOld = object->handle; +return nvkm_gsp_rpc_wr (gsp, rpc, true); +} + +static void +r535_gsp_rpc_rm_alloc_done (struct nvkm_gsp_object *object,void *repv) +{ +rpc_gsp_rm_alloc_v03_00 *rpc =container_of (repv,typeof (*rpc), params); + +nvkm_gsp_rpc_done (object->client->gsp, rpc); +} + +static void * +r535_gsp_rpc_rm_alloc_push (struct nvkm_gsp_object *object,void *argv,u32 repc) +{ +rpc_gsp_rm_alloc_v03_00 *rpc =container_of (argv,typeof (*rpc), params); +struct nvkm_gsp *gsp = object->client->gsp; +void *ret; + + rpc =nvkm_gsp_rpc_push (gsp, rpc, true,sizeof (*rpc) + repc); +if (IS_ERR_OR_NULL (rpc)) +return rpc; + +if (rpc->status) { +nvkm_error (&gsp->subdev,"RM_ALLOC: 0x%x\n" , rpc->status); + ret =ERR_PTR (-EINVAL ); + }else { + ret = repc ? rpc->params :NULL ; + } + +if (IS_ERR_OR_NULL (ret)) +nvkm_gsp_rpc_done (gsp, rpc); + +return ret; +} + +static void * +r535_gsp_rpc_rm_alloc_get (struct nvkm_gsp_object *object,u32 oclass,u32 argc) +{ +struct nvkm_gsp_client *client = object->client; +struct nvkm_gsp *gsp = client->gsp; +rpc_gsp_rm_alloc_v03_00 *rpc; + +nvkm_debug (&gsp->subdev,"cli:0x%08x obj:0x%08x new obj:0x%08x cls:0x%08x argc:%d\n" , + client->object.handle, object->parent->handle, object->handle, oclass, argc); + + rpc =nvkm_gsp_rpc_get (gsp,NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC ,sizeof (*rpc) + argc); +if (IS_ERR (rpc)) +return rpc; + + rpc->hClient = client->object.handle; + rpc->hParent = object->parent->handle; + rpc->hObject = object->handle; + rpc->hClass = oclass; + rpc->status =0 ; + rpc->paramsSize = argc; +return rpc->params; +} +static void r535_gsp_rpc_rm_ctrl_done (struct nvkm_gsp_object *object,void *repv) {@@ -509,6 +675,18 @@ r535_gsp_rm = { .rm_ctrl_get = r535_gsp_rpc_rm_ctrl_get, .rm_ctrl_push = r535_gsp_rpc_rm_ctrl_push, .rm_ctrl_done = r535_gsp_rpc_rm_ctrl_done, + + .rm_alloc_get = r535_gsp_rpc_rm_alloc_get, + .rm_alloc_push = r535_gsp_rpc_rm_alloc_push, + .rm_alloc_done = r535_gsp_rpc_rm_alloc_done, + + .rm_free = r535_gsp_rpc_rm_free, + + .client_ctor = r535_gsp_client_ctor, + .client_dtor = r535_gsp_client_dtor, + + .device_ctor = r535_gsp_device_ctor, + .device_dtor = r535_gsp_device_dtor, }; static int@@ -1473,6 +1651,9 @@ r535_gsp_dtor_fws(struct nvkm_gsp *gsp)void r535_gsp_dtor (struct nvkm_gsp *gsp) { +idr_destroy (&gsp->client_id.idr); +mutex_destroy (&gsp->client_id.mutex); +nvkm_gsp_radix3_dtor (gsp, &gsp->radix3);nvkm_gsp_mem_dtor (gsp, &gsp->sig);nvkm_firmware_dtor (&gsp->fw);@@ -1601,6 +1782,9 @@ r535_gsp_oneinit(struct nvkm_gsp *gsp)nvkm_falcon_wr32 (&gsp->falcon,0x040 ,lower_32_bits (gsp->libos.addr));nvkm_falcon_wr32 (&gsp->falcon,0x044 ,upper_32_bits (gsp->libos.addr)); + +mutex_init (&gsp->client_id.mutex); +idr_init (&gsp->client_id.idr);return 0 ; }
PATCH 35/44 drm/nouveau/gsp/r535: add interrupt handling
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
Fetches the interrupt table from RM, and hooks up the GSP interrupt handler to message queue processing to catch async messages.
--- .../drm/nouveau/include/nvkm/core/falcon.h | 3 + .../drm/nouveau/include/nvkm/engine/falcon.h | 2 + .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 12 ++ .../inc/ctrl/ctrl2080/ctrl2080internal.h | 62 ++++++++++ .../nvidia/inc/kernel/gpu/intr/engine_idx.h | 31 +++++ .../gpu/drm/nouveau/nvkm/engine/device/base.c | 5 + drivers/gpu/drm/nouveau/nvkm/falcon/base.c | 7 ++ drivers/gpu/drm/nouveau/nvkm/falcon/ga100.c | 6 + .../gpu/drm/nouveau/nvkm/subdev/gsp/base.c | 30 +++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c | 19 ++- .../gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 2 + .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 112 ++++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c | 1 + 13 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080internal.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/intr/engine_idx.h
drivers/gpu/drm/nouveau/include/nvkm/core/falcon.h +3 -0
@@ -49,6 +49,7 @@ int nvkm_falcon_pio_rd(struct nvkm_falcon *, u8 port, enum nvkm_falcon_mem type,int nvkm_falcon_dma_wr (struct nvkm_falcon *,const u8 *img,u64 dma_addr,u32 dma_base,enum nvkm_falcon_mem mem_type,u32 mem_base,int len,bool sec);bool nvkm_falcon_riscv_active (struct nvkm_falcon *); +void nvkm_falcon_intr_retrigger (struct nvkm_falcon *);int gm200_flcn_reset_wait_mem_scrubbing (struct nvkm_falcon *);int gm200_flcn_disable (struct nvkm_falcon *);
@@ -64,6 +65,8 @@ extern const struct nvkm_falcon_func_pio gp102_flcn_emem_pio;bool tu102_flcn_riscv_active (struct nvkm_falcon *); +void ga100_flcn_intr_retrigger (struct nvkm_falcon *); +int ga102_flcn_select (struct nvkm_falcon *);int ga102_flcn_reset_prep (struct nvkm_falcon *);int ga102_flcn_reset_wait_mem_scrubbing (struct nvkm_falcon *);
drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h +2 -0
@@ -62,6 +62,7 @@ struct nvkm_falcon_func {int (*enable)(struct nvkm_falcon *);int (*select)(struct nvkm_falcon *);u32 addr2; +u32 riscv_irqmask;bool reset_pmc;int (*reset_eng)(struct nvkm_falcon *);int (*reset_prep)(struct nvkm_falcon *);
@@ -88,6 +89,7 @@ struct nvkm_falcon_func { } cmdq, msgq;bool (*riscv_active)(struct nvkm_falcon *); +void (*intr_retrigger)(struct nvkm_falcon *);struct {u32 *data;
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +12 -0
@@ -128,6 +128,7 @@ struct nvkm_gsp {void *priv; } ntfy[16 ];int ntfy_nr; +struct work_struct work; } msgq;bool running;
@@ -150,6 +151,14 @@ struct nvkm_gsp { } device; } internal; +struct { +enum nvkm_subdev_type type; +int inst; +u32 stall; +u32 nonstall; + } intr[32 ]; +int intr_nr; + const struct nvkm_gsp_rm { void *(*rpc_get)(struct nvkm_gsp *, u32 fn, u32 argc); void *(*rpc_push)(struct nvkm_gsp *, void *argv, bool wait, u32 repc);
@@ -378,6 +387,9 @@ nvkm_gsp_client_device_ctor(struct nvkm_gsp *gsp,return ret; } +int nvkm_gsp_intr_stall (struct nvkm_gsp *,enum nvkm_subdev_type ,int ); +int nvkm_gsp_intr_nonstall (struct nvkm_gsp *,enum nvkm_subdev_type ,int ); +int gv100_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int tu102_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);int tu116_gsp_new (struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_gsp **);
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080internal.h new file +62 -0
62 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/intr/engine_idx.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef __src_nvidia_inc_kernel_gpu_intr_engine_idx_h__ +#define __src_nvidia_inc_kernel_gpu_intr_engine_idx_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define MC_ENGINE_IDX_GSP 49 + +#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +5 -0
@@ -2753,6 +2753,7 @@ nv192_chipset = { .gsp = { 0x00000001, ad102_gsp_new }, .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, + .vfn = { 0x00000001, ga100_vfn_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2765,6 +2766,7 @@ nv193_chipset = { .gsp = { 0x00000001, ad102_gsp_new }, .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, + .vfn = { 0x00000001, ga100_vfn_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2777,6 +2779,7 @@ nv194_chipset = { .gsp = { 0x00000001, ad102_gsp_new }, .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, + .vfn = { 0x00000001, ga100_vfn_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2789,6 +2792,7 @@ nv196_chipset = { .gsp = { 0x00000001, ad102_gsp_new }, .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, + .vfn = { 0x00000001, ga100_vfn_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2801,6 +2805,7 @@ nv197_chipset = { .gsp = { 0x00000001, ad102_gsp_new }, .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, + .vfn = { 0x00000001, ga100_vfn_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
drivers/gpu/drm/nouveau/nvkm/falcon/base.c +7 -0
@@ -25,6 +25,13 @@#include <subdev/timer.h> #include <subdev/top.h> +void +nvkm_falcon_intr_retrigger (struct nvkm_falcon *falcon) +{ +if (falcon->func->intr_retrigger) + falcon->func->intr_retrigger (falcon); +} +bool nvkm_falcon_riscv_active (struct nvkm_falcon *falcon) {
drivers/gpu/drm/nouveau/nvkm/falcon/ga100.c +6 -0
@@ -21,6 +21,12 @@*/ #include "priv.h" +void +ga100_flcn_intr_retrigger (struct nvkm_falcon *falcon) +{ +nvkm_falcon_wr32 (falcon,0x3e8 ,0x00000001 ); +} +int ga100_flcn_fw_signature (struct nvkm_falcon_fw *fw,u32 *src_base_src) {
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c +30 -0
@@ -21,6 +21,36 @@*/ #include "priv.h" +int +nvkm_gsp_intr_nonstall (struct nvkm_gsp *gsp,enum nvkm_subdev_type type,int inst) +{ +for (int i =0 ; i < gsp->intr_nr; i++) { +if (gsp->intr[i].type == type && gsp->intr[i].inst == inst) { +if (gsp->intr[i].nonstall != ~0 ) +return gsp->intr[i].nonstall; + +return -EINVAL ; + } + } + +return -ENOENT ; +} + +int +nvkm_gsp_intr_stall (struct nvkm_gsp *gsp,enum nvkm_subdev_type type,int inst) +{ +for (int i =0 ; i < gsp->intr_nr; i++) { +if (gsp->intr[i].type == type && gsp->intr[i].inst == inst) { +if (gsp->intr[i].stall != ~0 ) +return gsp->intr[i].stall; + +return -EINVAL ; + } + } + +return -ENOENT ; +} +static int nvkm_gsp_fini (struct nvkm_subdev *subdev,bool suspend) {
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c +18 -1
@@ -21,9 +21,26 @@*/ #include "priv.h" +static const struct nvkm_falcon_func +ga100_gsp_flcn = { + .disable = gm200_flcn_disable, + .enable = gm200_flcn_enable, + .addr2 =0x1000 , + .riscv_irqmask =0x2b4 , + .reset_eng = gp102_flcn_reset_eng, + .reset_wait_mem_scrubbing = gm200_flcn_reset_wait_mem_scrubbing, + .bind_inst = gm200_flcn_bind_inst, + .bind_stat = gm200_flcn_bind_stat, + .bind_intr = true, + .imem_pio = &gm200_flcn_imem_pio, + .dmem_pio = &gm200_flcn_dmem_pio, + .riscv_active = tu102_flcn_riscv_active, + .intr_retrigger = ga100_flcn_intr_retrigger, +}; +static const struct nvkm_gsp_func ga100_gsp_r535_54_03 = { - .flcn = &tu102_gsp_flcn, + .flcn = &ga100_gsp_flcn, .fwsec = &tu102_gsp_fwsec, .sig_section =".fwsignature_ga100" ,
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c +2 -0
@@ -139,12 +139,14 @@ ga102_gsp_flcn = { .enable = gm200_flcn_enable, .select = ga102_flcn_select, .addr2 = 0x1000, + .riscv_irqmask = 0x528, .reset_eng = gp102_flcn_reset_eng, .reset_prep = ga102_flcn_reset_prep, .reset_wait_mem_scrubbing = ga102_flcn_reset_wait_mem_scrubbing, .imem_dma = &ga102_flcn_dma, .dmem_dma = &ga102_flcn_dma, .riscv_active = ga102_flcn_riscv_active, + .intr_retrigger = ga100_flcn_intr_retrigger, }; static const struct nvkm_gsp_func
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +112 -0
148 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c +1 -0
@@ -151,6 +151,7 @@ tu102_gsp_flcn = { .disable = gm200_flcn_disable, .enable = gm200_flcn_enable, .addr2 = 0x1000, + .riscv_irqmask = 0x2b4, .reset_eng = gp102_flcn_reset_eng, .reset_wait_mem_scrubbing = gm200_flcn_reset_wait_mem_scrubbing, .bind_inst = gm200_flcn_bind_inst,
Signature · 1 line
2.41.0
PATCH 36/44 drm/nouveau/mmu/r535: initial support
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- Valid VRAM regions are read from GSP-RM, and used to construct our MM
- BAR1/BAR2 VMMs modified to be shared with RM
- Client VMMs have RM VASPACE objects created for them
- Adds FBSR to backup system objects in VRAM across suspend
--- .../gpu/drm/nouveau/include/nvkm/subdev/bar.h | 4 + .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 12 + .../drm/nouveau/include/nvkm/subdev/instmem.h | 5 + .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h | 11 + .../common/sdk/nvidia/inc/class/cl84a0.h | 33 ++ .../common/sdk/nvidia/inc/class/cl90f1.h | 31 ++ .../inc/ctrl/ctrl2080/ctrl2080internal.h | 22 ++ .../common/sdk/nvidia/inc/ctrl/ctrl90f1.h | 95 +++++ .../535.54.03/common/sdk/nvidia/inc/nvos.h | 94 +++++ .../535.54.03/nvidia/generated/g_fbsr_nvoc.h | 31 ++ .../nvidia/generated/g_rpc-structures.h | 20 ++ .../nvidia/generated/g_sdk-structures.h | 8 + .../nvidia/kernel/inc/vgpu/rpc_headers.h | 7 + .../nvidia/kernel/inc/vgpu/sdk-structures.h | 40 +++ .../gpu/drm/nouveau/nvkm/engine/device/base.c | 20 ++ .../gpu/drm/nouveau/nvkm/subdev/bar/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/bar/priv.h | 3 + .../gpu/drm/nouveau/nvkm/subdev/bar/r535.c | 186 ++++++++++ .../gpu/drm/nouveau/nvkm/subdev/bar/tu102.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c | 37 ++ .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 47 +++ .../drm/nouveau/nvkm/subdev/instmem/Kbuild | 2 + .../drm/nouveau/nvkm/subdev/instmem/nv50.c | 2 +- .../drm/nouveau/nvkm/subdev/instmem/priv.h | 3 + .../drm/nouveau/nvkm/subdev/instmem/r535.c | 333 ++++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c | 4 + .../gpu/drm/nouveau/nvkm/subdev/mmu/priv.h | 6 + .../gpu/drm/nouveau/nvkm/subdev/mmu/r535.c | 123 +++++++ .../gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c | 2 +- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c | 6 + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 7 + .../drm/nouveau/nvkm/subdev/mmu/vmmtu102.c | 5 +- 33 files changed, 1201 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl84a0.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl90f1.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl90f1.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvos.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_fbsr_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/sdk-structures.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/r535.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/bar.h +4 -0
@@ -11,6 +11,10 @@ struct nvkm_bar {spinlock_t lock;bool bar2; +void __iomem *flushBAR2PhysMode; +struct nvkm_memory *flushFBZero; +void __iomem *flushBAR2; +/* whether the BAR supports to be ioremapped WC or should be uncached */ bool iomap_uncached; };
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +12 -0
@@ -65,6 +65,13 @@ struct nvkm_gsp { } heap;u64 addr;u64 size; + +struct { +u64 addr; +u64 size; + } region[16 ]; +int region_nr; +u32 rsvd_size; } fb;struct {
@@ -159,6 +166,11 @@ struct nvkm_gsp { } intr[32 ];int intr_nr; +struct { +u64 rm_bar1_pdb; +u64 rm_bar2_pdb; + } bar; + const struct nvkm_gsp_rm { void *(*rpc_get)(struct nvkm_gsp *, u32 fn, u32 argc); void *(*rpc_push)(struct nvkm_gsp *, void *argv, bool wait, u32 repc);
drivers/gpu/drm/nouveau/include/nvkm/subdev/instmem.h +5 -0
@@ -24,6 +24,11 @@ struct nvkm_instmem {struct nvkm_ramht *ramht;struct nvkm_memory *ramro;struct nvkm_memory *ramfc; + +struct { +struct sg_table fbsr; +bool fbsr_valid; + } rm; };u32 nvkm_instmem_rd32 (struct nvkm_instmem *,u32 addr);
drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h +11 -0
@@ -2,6 +2,7 @@ #ifndef __NVKM_MMU_H__ #define __NVKM_MMU_H__ #include <core/subdev.h> +#include <subdev/gsp.h> struct nvkm_vma { struct list_head head;
@@ -63,6 +64,16 @@ struct nvkm_vmm {void *nullp;bool replay; + +struct { +u64 bar2_pdb; + +struct nvkm_gsp_client client; +struct nvkm_gsp_device device; +struct nvkm_gsp_object object; + +struct nvkm_vma *rsvd; + } rm; }; int nvkm_vmm_new(struct nvkm_device *, u64 addr, u64 size, void *argv, u32 argc,
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl84a0.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl84a0_h__ +#define __src_common_sdk_nvidia_inc_class_cl84a0_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2001-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV01_MEMORY_LIST_SYSTEM (0x00000081) + +#define NV01_MEMORY_LIST_FBMEM (0x00000082) + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl90f1.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl90f1_h__ +#define __src_common_sdk_nvidia_inc_class_cl90f1_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2011 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define FERMI_VASPACE_A (0x000090f1) + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080internal.h +22 -0
@@ -59,4 +59,26 @@ typedef struct NV2080_CTRL_INTERNAL_INTR_GET_KERNEL_TABLE_PARAMS {NV2080_INTR_CATEGORY_SUBTREE_MAP subtreeMap[NV2080_INTR_CATEGORY_ENUM_COUNT ]; } NV2080_CTRL_INTERNAL_INTR_GET_KERNEL_TABLE_PARAMS; +#define NV2080_CTRL_CMD_INTERNAL_FBSR_INIT (0x20800ac2)/* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_INTERNAL_INTERFACE_ID << 8) | NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS_MESSAGE_ID" */ + +typedef struct NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS { +NvU32 fbsrType; +NvU32 numRegions; +NvHandle hClient; +NvHandle hSysMem; + NV_DECLARE_ALIGNED(NvU64 gspFbAllocsSysOffset, 8); +NvBool bEnteringGcoffState; +}NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS ; + +#define NV2080_CTRL_CMD_INTERNAL_FBSR_SEND_REGION_INFO (0x20800ac3)/* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_INTERNAL_INTERFACE_ID << 8) | NV2080_CTRL_INTERNAL_FBSR_SEND_REGION_INFO_PARAMS_MESSAGE_ID" */ + +typedef struct NV2080_CTRL_INTERNAL_FBSR_SEND_REGION_INFO_PARAMS { +NvU32 fbsrType; +NvHandle hClient; +NvHandle hVidMem; + NV_DECLARE_ALIGNED(NvU64 vidOffset, 8); + NV_DECLARE_ALIGNED(NvU64 sysOffset, 8); + NV_DECLARE_ALIGNED(NvU64 size, 8); +}NV2080_CTRL_INTERNAL_FBSR_SEND_REGION_INFO_PARAMS ; +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl90f1.h new file +95 -0
95 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvos.h new file +94 -0
94 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_fbsr_nvoc.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef __src_nvidia_generated_g_fbsr_nvoc_h__ +#define __src_nvidia_generated_g_fbsr_nvoc_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2009-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define FBSR_TYPE_DMA 4 // Copy using DMA. Fastest. + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h +20 -0
@@ -1,6 +1,7 @@#ifndef __src_nvidia_generated_g_rpc_structures_h__#define __src_nvidia_generated_g_rpc_structures_h__#include <nvrm/535.54.03/nvidia/generated/g_sdk-structures.h> +#include <nvrm/535.54.03/nvidia/kernel/inc/vgpu/sdk-structures.h> /* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
@@ -27,6 +28,20 @@* DEALINGS IN THE SOFTWARE. */ +typedef struct rpc_alloc_memory_v13_01 +{ +NvHandle hClient; +NvHandle hDevice; +NvHandle hMemory; +NvU32 hClass; +NvU32 flags; +NvU32 pteAdjust; +NvU32 format; + NvU64 length NV_ALIGN_BYTES(8); +NvU32 pageCount; +struct pte_desc pteDesc; +}rpc_alloc_memory_v13_01 ; + typedef struct rpc_free_v03_00 { NVOS00_PARAMETERS_v03_00 params;
@@ -39,6 +54,11 @@ typedef struct rpc_unloading_guest_driver_v1F_07NvU32 newLevel; } rpc_unloading_guest_driver_v1F_07; +typedef struct rpc_update_bar_pde_v15_00 +{ +UpdateBarPde_v15_00 info; +}rpc_update_bar_pde_v15_00 ; + typedef struct rpc_gsp_rm_alloc_v03_00 { NvHandle hClient;
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_sdk-structures.h +8 -0
@@ -1,5 +1,6 @@#ifndef __src_nvidia_generated_g_sdk_structures_h__#define __src_nvidia_generated_g_sdk_structures_h__ +#include <nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h> /* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */
@@ -34,4 +35,11 @@ typedef struct NVOS00_PARAMETERS_v03_00NvV32 status; } NVOS00_PARAMETERS_v03_00; +typedef struct UpdateBarPde_v15_00 +{ +NV_RPC_UPDATE_PDE_BAR_TYPE barType; + NvU64 entryValue NV_ALIGN_BYTES(8); + NvU64 entryLevelShift NV_ALIGN_BYTES(8); +}UpdateBarPde_v15_00 ; +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h +7 -0
@@ -28,6 +28,13 @@#define MAX_GPC_COUNT 32 +typedef enum +{ +NV_RPC_UPDATE_PDE_BAR_1 , +NV_RPC_UPDATE_PDE_BAR_2 , +NV_RPC_UPDATE_PDE_BAR_INVALID , +}NV_RPC_UPDATE_PDE_BAR_TYPE ; + typedef struct VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMS { NvU32 headIndex;
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/sdk-structures.h new file +40 -0
@@ -0,0 +1,40 @@ +#ifndef __src_nvidia_kernel_inc_vgpu_sdk_structures_h__ +#define __src_nvidia_kernel_inc_vgpu_sdk_structures_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +struct pte_desc +{ +NvU32 idr:2 ; +NvU32 reserved1:14 ; +NvU32 length:16 ; +union { +NvU64 pte;// PTE when IDR==0; PDE when IDR > 0 +NvU64 pde;// PTE when IDR==0; PDE when IDR > 0 + } pte_pde[] NV_ALIGN_BYTES(8); // PTE when IDR==0; PDE when IDR > 0 +}; + +#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +20 -0
@@ -2747,10 +2747,14 @@ nv177_chipset = {static const struct nvkm_device_chip nv192_chipset = { .name ="AD102" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },
@@ -2760,10 +2764,14 @@ nv192_chipset = {static const struct nvkm_device_chip nv193_chipset = { .name ="AD103" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },
@@ -2773,10 +2781,14 @@ nv193_chipset = {static const struct nvkm_device_chip nv194_chipset = { .name ="AD104" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },
@@ -2786,10 +2798,14 @@ nv194_chipset = {static const struct nvkm_device_chip nv196_chipset = { .name ="AD106" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },
@@ -2799,10 +2815,14 @@ nv196_chipset = {static const struct nvkm_device_chip nv197_chipset = { .name ="AD107" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },
drivers/gpu/drm/nouveau/nvkm/subdev/bar/Kbuild +2 -0
@@ -7,3 +7,5 @@ nvkm-y += nvkm/subdev/bar/gk20a.o nvkm-y += nvkm/subdev/bar/gm107.o nvkm-y += nvkm/subdev/bar/gm20b.o nvkm-y += nvkm/subdev/bar/tu102.o + +nvkm-y += nvkm/subdev/bar/r535.o
drivers/gpu/drm/nouveau/nvkm/subdev/bar/priv.h +3 -0
@@ -4,6 +4,9 @@#define nvkm_bar (p) container_of((p), struct nvkm_bar, subdev)#include <subdev/bar.h> +int r535_bar_new_ (const struct nvkm_bar_func *, +struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_bar **); +void nvkm_bar_ctor (const struct nvkm_bar_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_bar *);
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c new file +186 -0
186 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/bar/tu102.c +1 -1
@@ -97,7 +97,7 @@ tu102_bar_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_bar **pbar) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_bar_new_ (&tu102_bar, device, type, inst, pbar);return gf100_bar_new_ (&tu102_bar, device, type, inst, pbar); }
drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c +37 -0
@@ -20,6 +20,42 @@* OTHER DEALINGS IN THE SOFTWARE. */ #include "priv.h" +#include "ram.h" + +#include <subdev/gsp.h> + +static const struct nvkm_ram_func +r535_fb_ram = { +}; + +static int +r535_fb_ram_new (struct nvkm_fb *fb,struct nvkm_ram **pram) +{ +struct nvkm_gsp *gsp = fb->subdev.device->gsp; +struct nvkm_ram *ram; +int ret; + +if (!(ram = *pram =kzalloc (sizeof (*ram),GFP_KERNEL ))) +return -ENOMEM ; + + ram->func = &r535_fb_ram; + ram->fb = fb; + ram->type =NVKM_RAM_TYPE_UNKNOWN ;/*TODO: pull this from GSP. */ + ram->size = gsp->fb.size; + ram->stolen = false; +mutex_init (&ram->mutex); + +for (int i =0 ; i < gsp->fb.region_nr; i++) { + ret =nvkm_mm_init (&ram->vram,NVKM_RAM_MM_NORMAL , + gsp->fb.region[i].addr >>NVKM_RAM_MM_SHIFT , + gsp->fb.region[i].size >>NVKM_RAM_MM_SHIFT , +1 ); +if (ret) +return ret; + } + +return 0 ; +}static void *r535_fb_dtor (struct nvkm_fb *fb)
@@ -41,6 +77,7 @@ r535_fb_new(const struct nvkm_fb_func *hw, rm->dtor = r535_fb_dtor; rm->sysmem.flush_page_init = hw->sysmem.flush_page_init; rm->vidmem.size = hw->vidmem.size; + rm->ram_new = r535_fb_ram_new; ret =nvkm_fb_new_ (rm, device, type, inst, pfb);if (ret)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +47 -0
71 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/Kbuild +2 -0
@@ -4,3 +4,5 @@ nvkm-y += nvkm/subdev/instmem/nv04.o nvkm-y += nvkm/subdev/instmem/nv40.o nvkm-y += nvkm/subdev/instmem/nv50.o nvkm-y += nvkm/subdev/instmem/gk20a.o + +nvkm-y += nvkm/subdev/instmem/r535.o
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c +1 -1
@@ -432,7 +432,7 @@ nv50_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int ins struct nvkm_instmem **pimem) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_instmem_new (&nv50_instmem, device, type, inst, pimem);return nv50_instmem_new_ (&nv50_instmem, device, type, inst, pimem); }
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/priv.h +3 -0
@@ -28,6 +28,9 @@ void nvkm_instmem_boot(struct nvkm_instmem *);int nv04_instmem_suspend (struct nvkm_instmem *);void nv04_instmem_resume (struct nvkm_instmem *); +int r535_instmem_new (const struct nvkm_instmem_func *, +struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_instmem **); +#include <core/memory.h> struct nvkm_instobj {
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c new file +333 -0
333 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild +2 -0
@@ -16,6 +16,8 @@ nvkm-y += nvkm/subdev/mmu/gp10b.o nvkm-y += nvkm/subdev/mmu/gv100.o nvkm-y += nvkm/subdev/mmu/tu102.o +nvkm-y += nvkm/subdev/mmu/r535.o + nvkm-y += nvkm/subdev/mmu/mem.o nvkm-y += nvkm/subdev/mmu/memnv04.o nvkm-y += nvkm/subdev/mmu/memnv50.o
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c +4 -0
@@ -403,6 +403,10 @@ nvkm_mmu_dtor(struct nvkm_subdev *subdev)nvkm_mmu_ptc_fini (mmu);mutex_destroy (&mmu->mutex); + +if (mmu->func->dtor) + mmu->func->dtor (mmu); +return mmu; }
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/priv.h +6 -0
@@ -4,12 +4,16 @@#define nvkm_mmu (p) container_of((p), struct nvkm_mmu, subdev)#include <subdev/mmu.h> +int r535_mmu_new (const struct nvkm_mmu_func *hw,struct nvkm_device *,enum nvkm_subdev_type ,int , +struct nvkm_mmu **); +void nvkm_mmu_ctor (const struct nvkm_mmu_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_mmu *);int nvkm_mmu_new_ (const struct nvkm_mmu_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_mmu **);struct nvkm_mmu_func { +void (*dtor)(struct nvkm_mmu *);void (*init)(struct nvkm_mmu *);u8 dma_bits;
@@ -37,6 +41,8 @@ struct nvkm_mmu_func {const u8 *(*kind)(struct nvkm_mmu *,int *count,u8 *invalid);bool kind_sys; + +int (*promote_vmm)(struct nvkm_vmm *); };extern const struct nvkm_mmu_func nv04_mmu;
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/r535.c new file +123 -0
123 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c +1 -1
@@ -56,7 +56,7 @@ tu102_mmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_mmu **pmmu) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_mmu_new (&tu102_mmu, device, type, inst, pmmu);return nvkm_mmu_new_ (&tu102_mmu, device, type, inst, pmmu); }
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +6 -0
@@ -572,6 +572,12 @@ nvkm_uvmm_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, } uvmm->vmm->managed.raw = raw; +if (mmu->func->promote_vmm) { + ret = mmu->func->promote_vmm (uvmm->vmm); +if (ret) +return ret; + } + page = uvmm->vmm->func->page; args->v0.page_nr =0 ;while (page && (page++)->shift)
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +7 -0
@@ -1030,6 +1030,13 @@ nvkm_vmm_dtor(struct nvkm_vmm *vmm)struct nvkm_vma *vma;struct rb_node *node; +if (vmm->rm.client.gsp) { +nvkm_gsp_rm_free (&vmm->rm.object); +nvkm_gsp_device_dtor (&vmm->rm.device); +nvkm_gsp_client_dtor (&vmm->rm.client); +nvkm_vmm_put (vmm, &vmm->rm.rsvd); + } +if (0 )nvkm_vmm_dump (vmm);
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmtu102.c +4 -1
@@ -35,7 +35,10 @@ tu102_vmm_flush(struct nvkm_vmm *vmm, int depth)mutex_lock (&vmm->mmu->mutex); -nvkm_wr32 (device,0xb830a0 , vmm->pd->pt[0 ]->addr >>8 ); +if (!vmm->rm.bar2_pdb) +nvkm_wr32 (device,0xb830a0 , vmm->pd->pt[0 ]->addr >>8 ); +else +nvkm_wr32 (device,0xb830a0 , vmm->rm.bar2_pdb >>8 );nvkm_wr32 (device,0xb830a4 ,0x00000000 );nvkm_wr32 (device,0xb830b0 ,0x80000000 | type);
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 36/44] drm/nouveau/mmu/r535: initial support
Quoted 58 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
- Valid VRAM regions are read from GSP-RM, and used to construct our MM
- BAR1/BAR2 VMMs modified to be shared with RM
- Client VMMs have RM VASPACE objects created for them
- Adds FBSR to backup system objects in VRAM across suspendSigned-off-by Ben Skeggs <[email protected]>--- .../gpu/drm/nouveau/include/nvkm/subdev/bar.h | 4 + .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 12 + .../drm/nouveau/include/nvkm/subdev/instmem.h | 5 + .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h | 11 + .../common/sdk/nvidia/inc/class/cl84a0.h | 33 ++ .../common/sdk/nvidia/inc/class/cl90f1.h | 31 ++ .../inc/ctrl/ctrl2080/ctrl2080internal.h | 22 ++ .../common/sdk/nvidia/inc/ctrl/ctrl90f1.h | 95 +++++ .../535.54.03/common/sdk/nvidia/inc/nvos.h | 94 +++++ .../535.54.03/nvidia/generated/g_fbsr_nvoc.h | 31 ++ .../nvidia/generated/g_rpc-structures.h | 20 ++ .../nvidia/generated/g_sdk-structures.h | 8 + .../nvidia/kernel/inc/vgpu/rpc_headers.h | 7 + .../nvidia/kernel/inc/vgpu/sdk-structures.h | 40 +++ .../gpu/drm/nouveau/nvkm/engine/device/base.c | 20 ++ .../gpu/drm/nouveau/nvkm/subdev/bar/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/bar/priv.h | 3 + .../gpu/drm/nouveau/nvkm/subdev/bar/r535.c | 186 ++++++++++ .../gpu/drm/nouveau/nvkm/subdev/bar/tu102.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c | 37 ++ .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 47 +++ .../drm/nouveau/nvkm/subdev/instmem/Kbuild | 2 + .../drm/nouveau/nvkm/subdev/instmem/nv50.c | 2 +- .../drm/nouveau/nvkm/subdev/instmem/priv.h | 3 + .../drm/nouveau/nvkm/subdev/instmem/r535.c | 333 ++++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c | 4 + .../gpu/drm/nouveau/nvkm/subdev/mmu/priv.h | 6 + .../gpu/drm/nouveau/nvkm/subdev/mmu/r535.c | 123 +++++++ .../gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c | 2 +- .../gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c | 6 + drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 7 + .../drm/nouveau/nvkm/subdev/mmu/vmmtu102.c | 5 +- 33 files changed, 1201 insertions(+), 4 deletions(-)create mode 100644
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl84a0.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl90f1.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl90f1.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvos.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_fbsr_nvoc.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/sdk-structures.hcreate mode 100644drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c
create mode 100644drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c
create mode 100644drivers/gpu/drm/nouveau/nvkm/subdev/mmu/r535.cdrivers/gpu/drm/nouveau/include/nvkm/subdev/bar.h +0
-0
drivers/gpu/drm/nouveau/include/nvkm/subdev/bar.h struct nvkm_bar { · line 16
Quoted 6 lines
drivers/gpu/drm/nouveau/include/nvkm/subdev/bar.h +3
-0@@ -11,6 +11,10 @@ struct nvkm_bar {spinlock_t lock;bool bar2; +void __iomem *flushBAR2PhysMode; +struct nvkm_memory *flushFBZero; +void __iomem *flushBAR2;
Why use camel case for those?
Quoted 9 lines
drivers/gpu/drm/nouveau/include/nvkm/subdev/bar.h +1
-0+/* whether the BAR supports to be ioremapped WC or should be uncached */ bool iomap_uncached; };drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +0
-0
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h struct nvkm_gsp { · line 72
Quoted 8 lines
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +5
-0@@ -65,6 +65,13 @@ struct nvkm_gsp { } heap;u64 addr;u64 size; + +struct { +u64 addr; +u64 size; + } region[16 ];
Number of regions specified somewhere?
Quoted 682 lines
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +7
-0+int region_nr; +u32 rsvd_size; } fb;struct {@@ -159,6 +166,11 @@ struct nvkm_gsp { } intr[32 ];int intr_nr; +struct { +u64 rm_bar1_pdb; +u64 rm_bar2_pdb; + } bar; + const struct nvkm_gsp_rm { void *(*rpc_get)(struct nvkm_gsp *, u32 fn, u32 argc); void *(*rpc_push)(struct nvkm_gsp *, void *argv, bool wait, u32 repc);drivers/gpu/drm/nouveau/include/nvkm/subdev/instmem.h +5
-0@@ -24,6 +24,11 @@ struct nvkm_instmem {struct nvkm_ramht *ramht;struct nvkm_memory *ramro;struct nvkm_memory *ramfc; + +struct { +struct sg_table fbsr; +bool fbsr_valid; + } rm; };u32 nvkm_instmem_rd32 (struct nvkm_instmem *,u32 addr);drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h +11
-0@@ -2,6 +2,7 @@ #ifndef __NVKM_MMU_H__ #define __NVKM_MMU_H__ #include <core/subdev.h> +#include <subdev/gsp.h> struct nvkm_vma { struct list_head head;@@ -63,6 +64,16 @@ struct nvkm_vmm {void *nullp;bool replay; + +struct { +u64 bar2_pdb; + +struct nvkm_gsp_client client; +struct nvkm_gsp_device device; +struct nvkm_gsp_object object; + +struct nvkm_vma *rsvd; + } rm; }; int nvkm_vmm_new(struct nvkm_device *, u64 addr, u64 size, void *argv, u32 argc,drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl84a0.h new file +33
-0@@ -0,0 +1,33 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl84a0_h__ +#define __src_common_sdk_nvidia_inc_class_cl84a0_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2001-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV01_MEMORY_LIST_SYSTEM (0x00000081) + +#define NV01_MEMORY_LIST_FBMEM (0x00000082) + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl90f1.h new file +31
-0@@ -0,0 +1,31 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl90f1_h__ +#define __src_common_sdk_nvidia_inc_class_cl90f1_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2011 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define FERMI_VASPACE_A (0x000090f1) + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080internal.h +22
-0@@ -59,4 +59,26 @@ typedef struct NV2080_CTRL_INTERNAL_INTR_GET_KERNEL_TABLE_PARAMS {NV2080_INTR_CATEGORY_SUBTREE_MAP subtreeMap[NV2080_INTR_CATEGORY_ENUM_COUNT ]; } NV2080_CTRL_INTERNAL_INTR_GET_KERNEL_TABLE_PARAMS; +#define NV2080_CTRL_CMD_INTERNAL_FBSR_INIT (0x20800ac2)/* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_INTERNAL_INTERFACE_ID << 8) | NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS_MESSAGE_ID" */ + +typedef struct NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS { +NvU32 fbsrType; +NvU32 numRegions; +NvHandle hClient; +NvHandle hSysMem; + NV_DECLARE_ALIGNED(NvU64 gspFbAllocsSysOffset, 8); +NvBool bEnteringGcoffState; +}NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS ; + +#define NV2080_CTRL_CMD_INTERNAL_FBSR_SEND_REGION_INFO (0x20800ac3)/* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_INTERNAL_INTERFACE_ID << 8) | NV2080_CTRL_INTERNAL_FBSR_SEND_REGION_INFO_PARAMS_MESSAGE_ID" */ + +typedef struct NV2080_CTRL_INTERNAL_FBSR_SEND_REGION_INFO_PARAMS { +NvU32 fbsrType; +NvHandle hClient; +NvHandle hVidMem; + NV_DECLARE_ALIGNED(NvU64 vidOffset, 8); + NV_DECLARE_ALIGNED(NvU64 sysOffset, 8); + NV_DECLARE_ALIGNED(NvU64 size, 8); +}NV2080_CTRL_INTERNAL_FBSR_SEND_REGION_INFO_PARAMS ; +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl90f1.h new file +95
-0@@ -0,0 +1,95 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl90f1_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl90f1_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2014-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define GMMU_FMT_MAX_LEVELS 6U + +#define NV90F1_CTRL_CMD_VASPACE_COPY_SERVER_RESERVED_PDES (0x90f10106U)/* finn: Evaluated from "(FINN_FERMI_VASPACE_A_VASPACE_INTERFACE_ID << 8) | NV90F1_CTRL_VASPACE_COPY_SERVER_RESERVED_PDES_PARAMS_MESSAGE_ID" */ + +typedef struct NV90F1_CTRL_VASPACE_COPY_SERVER_RESERVED_PDES_PARAMS { +/*! +* [in] GPU sub-device handle - this API only supports unicast. +* Pass 0 to use subDeviceId instead. +*/ +NvHandle hSubDevice; + +/*! +* [in] GPU sub-device ID. Ignored if hSubDevice is non-zero. +*/ +NvU32 subDeviceId; + +/*! +* [in] Page size (VA coverage) of the level to reserve. +* This need not be a leaf (page table) page size - it can be +* the coverage of an arbitrary level (including root page directory). +*/ + NV_DECLARE_ALIGNED(NvU64 pageSize, 8); + +/*! +* [in] First GPU virtual address of the range to reserve. +* This must be aligned to pageSize. +*/ + NV_DECLARE_ALIGNED(NvU64 virtAddrLo, 8); + +/*! +* [in] Last GPU virtual address of the range to reserve. +* This (+1) must be aligned to pageSize. +*/ + NV_DECLARE_ALIGNED(NvU64 virtAddrHi, 8); + +/*! +* [in] Number of PDE levels to copy. +*/ +NvU32 numLevelsToCopy; + +/*! +* [in] Per-level information. +*/ +struct { +/*! +* Physical address of this page level instance. +*/ + NV_DECLARE_ALIGNED(NvU64 physAddress, 8); + +/*! +* Size in bytes allocated for this level instance. +*/ + NV_DECLARE_ALIGNED(NvU64 size, 8); + +/*! +* Aperture in which this page level instance resides. +*/ +NvU32 aperture; + +/*! +* Page shift corresponding to the level +*/ +NvU8 pageShift; + } levels[GMMU_FMT_MAX_LEVELS ]; +}NV90F1_CTRL_VASPACE_COPY_SERVER_RESERVED_PDES_PARAMS ; + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvos.h new file +94
-0@@ -0,0 +1,94 @@ +#ifndef __src_common_sdk_nvidia_inc_nvos_h__ +#define __src_common_sdk_nvidia_inc_nvos_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NVOS02_FLAGS_PHYSICALITY 7:4 +#define NVOS02_FLAGS_PHYSICALITY_CONTIGUOUS (0x00000000) +#define NVOS02_FLAGS_PHYSICALITY_NONCONTIGUOUS (0x00000001) +#define NVOS02_FLAGS_LOCATION 11:8 +#define NVOS02_FLAGS_LOCATION_PCI (0x00000000) +#define NVOS02_FLAGS_LOCATION_AGP (0x00000001) +#define NVOS02_FLAGS_LOCATION_VIDMEM (0x00000002) +#define NVOS02_FLAGS_COHERENCY 15:12 +#define NVOS02_FLAGS_COHERENCY_UNCACHED (0x00000000) +#define NVOS02_FLAGS_COHERENCY_CACHED (0x00000001) +#define NVOS02_FLAGS_COHERENCY_WRITE_COMBINE (0x00000002) +#define NVOS02_FLAGS_COHERENCY_WRITE_THROUGH (0x00000003) +#define NVOS02_FLAGS_COHERENCY_WRITE_PROTECT (0x00000004) +#define NVOS02_FLAGS_COHERENCY_WRITE_BACK (0x00000005) +#define NVOS02_FLAGS_ALLOC 17:16 +#define NVOS02_FLAGS_ALLOC_NONE (0x00000001) +#define NVOS02_FLAGS_GPU_CACHEABLE 18:18 +#define NVOS02_FLAGS_GPU_CACHEABLE_NO (0x00000000) +#define NVOS02_FLAGS_GPU_CACHEABLE_YES (0x00000001) + +#define NVOS02_FLAGS_KERNEL_MAPPING 19:19 +#define NVOS02_FLAGS_KERNEL_MAPPING_NO_MAP (0x00000000) +#define NVOS02_FLAGS_KERNEL_MAPPING_MAP (0x00000001) +#define NVOS02_FLAGS_ALLOC_NISO_DISPLAY 20:20 +#define NVOS02_FLAGS_ALLOC_NISO_DISPLAY_NO (0x00000000) +#define NVOS02_FLAGS_ALLOC_NISO_DISPLAY_YES (0x00000001) + +#define NVOS02_FLAGS_ALLOC_USER_READ_ONLY 21:21 +#define NVOS02_FLAGS_ALLOC_USER_READ_ONLY_NO (0x00000000) +#define NVOS02_FLAGS_ALLOC_USER_READ_ONLY_YES (0x00000001) + +#define NVOS02_FLAGS_ALLOC_DEVICE_READ_ONLY 22:22 +#define NVOS02_FLAGS_ALLOC_DEVICE_READ_ONLY_NO (0x00000000) +#define NVOS02_FLAGS_ALLOC_DEVICE_READ_ONLY_YES (0x00000001) + +#define NVOS02_FLAGS_PEER_MAP_OVERRIDE 23:23 +#define NVOS02_FLAGS_PEER_MAP_OVERRIDE_DEFAULT (0x00000000) +#define NVOS02_FLAGS_PEER_MAP_OVERRIDE_REQUIRED (0x00000001) + +#define NVOS02_FLAGS_ALLOC_TYPE_SYNCPOINT 24:24 +#define NVOS02_FLAGS_ALLOC_TYPE_SYNCPOINT_APERTURE (0x00000001) + +#define NVOS02_FLAGS_MEMORY_PROTECTION 26:25 +#define NVOS02_FLAGS_MEMORY_PROTECTION_DEFAULT (0x00000000) +#define NVOS02_FLAGS_MEMORY_PROTECTION_PROTECTED (0x00000001) +#define NVOS02_FLAGS_MEMORY_PROTECTION_UNPROTECTED (0x00000002) + +#define NVOS02_FLAGS_MAPPING 31:30 +#define NVOS02_FLAGS_MAPPING_DEFAULT (0x00000000) +#define NVOS02_FLAGS_MAPPING_NO_MAP (0x00000001) +#define NVOS02_FLAGS_MAPPING_NEVER_MAP (0x00000002) + +typedef struct +{ +NvU32 index; +NvV32 flags; + NvU64 vaSize NV_ALIGN_BYTES(8); + NvU64 vaStartInternal NV_ALIGN_BYTES(8); + NvU64 vaLimitInternal NV_ALIGN_BYTES(8); +NvU32 bigPageSize; + NvU64 vaBase NV_ALIGN_BYTES(8); +}NV_VASPACE_ALLOCATION_PARAMETERS ; + +#define NV_VASPACE_ALLOCATION_INDEX_GPU_NEW 0x00 //<! Create new VASpace, by default + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_fbsr_nvoc.h new file +31
-0@@ -0,0 +1,31 @@ +#ifndef __src_nvidia_generated_g_fbsr_nvoc_h__ +#define __src_nvidia_generated_g_fbsr_nvoc_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2009-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define FBSR_TYPE_DMA 4 // Copy using DMA. Fastest. + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h +20
-0@@ -1,6 +1,7 @@#ifndef __src_nvidia_generated_g_rpc_structures_h__#define __src_nvidia_generated_g_rpc_structures_h__#include <nvrm/535.54.03/nvidia/generated/g_sdk-structures.h> +#include <nvrm/535.54.03/nvidia/kernel/inc/vgpu/sdk-structures.h> /* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ @@ -27,6 +28,20 @@* DEALINGS IN THE SOFTWARE. */ +typedef struct rpc_alloc_memory_v13_01 +{ +NvHandle hClient; +NvHandle hDevice; +NvHandle hMemory; +NvU32 hClass; +NvU32 flags; +NvU32 pteAdjust; +NvU32 format; + NvU64 length NV_ALIGN_BYTES(8); +NvU32 pageCount; +struct pte_desc pteDesc; +}rpc_alloc_memory_v13_01 ; + typedef struct rpc_free_v03_00 { NVOS00_PARAMETERS_v03_00 params;@@ -39,6 +54,11 @@ typedef struct rpc_unloading_guest_driver_v1F_07NvU32 newLevel; } rpc_unloading_guest_driver_v1F_07; +typedef struct rpc_update_bar_pde_v15_00 +{ +UpdateBarPde_v15_00 info; +}rpc_update_bar_pde_v15_00 ; + typedef struct rpc_gsp_rm_alloc_v03_00 { NvHandle hClient;drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_sdk-structures.h +8
-0@@ -1,5 +1,6 @@#ifndef __src_nvidia_generated_g_sdk_structures_h__#define __src_nvidia_generated_g_sdk_structures_h__ +#include <nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h> /* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ @@ -34,4 +35,11 @@ typedef struct NVOS00_PARAMETERS_v03_00NvV32 status; } NVOS00_PARAMETERS_v03_00; +typedef struct UpdateBarPde_v15_00 +{ +NV_RPC_UPDATE_PDE_BAR_TYPE barType; + NvU64 entryValue NV_ALIGN_BYTES(8); + NvU64 entryLevelShift NV_ALIGN_BYTES(8); +}UpdateBarPde_v15_00 ; +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h +7
-0@@ -28,6 +28,13 @@#define MAX_GPC_COUNT 32 +typedef enum +{ +NV_RPC_UPDATE_PDE_BAR_1 , +NV_RPC_UPDATE_PDE_BAR_2 , +NV_RPC_UPDATE_PDE_BAR_INVALID , +}NV_RPC_UPDATE_PDE_BAR_TYPE ; + typedef struct VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMS { NvU32 headIndex;drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/kernel/inc/vgpu/sdk-structures.h new file +40
-0@@ -0,0 +1,40 @@ +#ifndef __src_nvidia_kernel_inc_vgpu_sdk_structures_h__ +#define __src_nvidia_kernel_inc_vgpu_sdk_structures_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +struct pte_desc +{ +NvU32 idr:2 ; +NvU32 reserved1:14 ; +NvU32 length:16 ; +union { +NvU64 pte;// PTE when IDR==0; PDE when IDR > 0 +NvU64 pde;// PTE when IDR==0; PDE when IDR > 0 + } pte_pde[] NV_ALIGN_BYTES(8); // PTE when IDR==0; PDE when IDR > 0 +}; + +#endif drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +20
-0@@ -2747,10 +2747,14 @@ nv177_chipset = {static const struct nvkm_device_chip nv192_chipset = { .name ="AD102" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },@@ -2760,10 +2764,14 @@ nv192_chipset = {static const struct nvkm_device_chip nv193_chipset = { .name ="AD103" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },@@ -2773,10 +2781,14 @@ nv193_chipset = {static const struct nvkm_device_chip nv194_chipset = { .name ="AD104" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },@@ -2786,10 +2798,14 @@ nv194_chipset = {static const struct nvkm_device_chip nv196_chipset = { .name ="AD106" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },@@ -2799,10 +2815,14 @@ nv196_chipset = {static const struct nvkm_device_chip nv197_chipset = { .name ="AD107" , + .bar = {0x00000001 , tu102_bar_new }, .bios = {0x00000001 , nvkm_bios_new }, .devinit = {0x00000001 , ga100_devinit_new }, + .fault = {0x00000001 , tu102_fault_new }, .fb = {0x00000001 , ga102_fb_new }, .gsp = {0x00000001 , ad102_gsp_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mmu = {0x00000001 , tu102_mmu_new }, .pci = {0x00000001 , gp100_pci_new }, .timer = {0x00000001 , gk20a_timer_new }, .vfn = {0x00000001 , ga100_vfn_new },drivers/gpu/drm/nouveau/nvkm/subdev/bar/Kbuild +2
-0@@ -7,3 +7,5 @@ nvkm-y += nvkm/subdev/bar/gk20a.o nvkm-y += nvkm/subdev/bar/gm107.o nvkm-y += nvkm/subdev/bar/gm20b.o nvkm-y += nvkm/subdev/bar/tu102.o + +nvkm-y += nvkm/subdev/bar/r535.odrivers/gpu/drm/nouveau/nvkm/subdev/bar/priv.h +3
-0@@ -4,6 +4,9 @@#define nvkm_bar (p) container_of((p), struct nvkm_bar, subdev)#include <subdev/bar.h> +int r535_bar_new_ (const struct nvkm_bar_func *, +struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_bar **); +void nvkm_bar_ctor (const struct nvkm_bar_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_bar *);drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c new file +34
-0@@ -0,0 +1,186 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "gf100.h" + +#include <core/mm.h> +#include <subdev/fb.h> +#include <subdev/gsp.h> +#include <subdev/instmem.h> +#include <subdev/mmu/vmm.h> + +#include <nvrm/nvtypes.h> +#include <nvrm/535.54.03/nvidia/generated/g_rpc-structures.h> +#include <nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_global_enums.h> +#include <nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_headers.h> +
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c line 44
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c new file +10
-0+static void +r535_bar_flush (struct nvkm_bar *bar) +{ +ioread32_native (bar->flushBAR2); +} + +static void +r535_bar_bar2_wait (struct nvkm_bar *base) +{ +}
TODO?
Quoted 54 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c new file +54
-0+ +static int +r535_bar_bar2_update_pde (struct nvkm_gsp *gsp,u64 addr) +{ +rpc_update_bar_pde_v15_00 *rpc; + + rpc =nvkm_gsp_rpc_get (gsp,NV_VGPU_MSG_FUNCTION_UPDATE_BAR_PDE ,sizeof (*rpc)); +if (WARN_ON (IS_ERR_OR_NULL (rpc))) +return -EIO ; + + rpc->info.barType =NV_RPC_UPDATE_PDE_BAR_2 ; + rpc->info.entryValue = addr ? ((addr >>4 ) |2 ) :0 ;/* PD3 entry format! */ + rpc->info.entryLevelShift =47 ;//XXX: probably fetch this from mmu! + +return nvkm_gsp_rpc_wr (gsp, rpc, true); +} + +static void +r535_bar_bar2_fini (struct nvkm_bar *bar) +{ +struct nvkm_gsp *gsp = bar->subdev.device->gsp; + + bar->flushBAR2 = bar->flushBAR2PhysMode; +nvkm_done (bar->flushFBZero); + +WARN_ON (r535_bar_bar2_update_pde (gsp,0 )); +} + +static void +r535_bar_bar2_init (struct nvkm_bar *bar) +{ +struct nvkm_device *device = bar->subdev.device; +struct nvkm_vmm *vmm =gf100_bar (bar)->bar[0 ].vmm; +struct nvkm_gsp *gsp = device->gsp; + +WARN_ON (r535_bar_bar2_update_pde (gsp, vmm->pd->pde[0 ]->pt[0 ]->addr)); + vmm->rm.bar2_pdb = gsp->bar.rm_bar2_pdb; + +if (!bar->flushFBZero) { +struct nvkm_memory *fbZero; +int ret; + + ret =nvkm_ram_wrap (device,0 ,0x1000 , &fbZero); +if (ret ==0 ) { + ret =nvkm_memory_kmap (fbZero, &bar->flushFBZero); +nvkm_memory_unref (&fbZero); + } +WARN_ON (ret); + } + + bar->bar2 = true; + bar->flushBAR2 =nvkm_kmap (bar->flushFBZero); +WARN_ON (!bar->flushBAR2); +}
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c line 108
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c new file +10
-0+ +static void +r535_bar_bar1_wait (struct nvkm_bar *base) +{ +} + +static void +r535_bar_bar1_fini (struct nvkm_bar *base) +{ +}
Same as above, but now it seems that we just need this, such that the corresponding function pointer is not NULL...
Maybe we should check the function pointer instead, like we seem to do everywhere else.
Quoted 58 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c new file +58
-0+ +static void +r535_bar_bar1_init (struct nvkm_bar *bar) +{ +struct nvkm_device *device = bar->subdev.device; +struct nvkm_gsp *gsp = device->gsp; +struct nvkm_vmm *vmm =gf100_bar (bar)->bar[1 ].vmm; +struct nvkm_memory *pd3; +int ret; + + ret =nvkm_ram_wrap (device, gsp->bar.rm_bar1_pdb,0x1000 , &pd3); +if (WARN_ON (ret)) +return ; + +nvkm_memory_unref (&vmm->pd->pt[0 ]->memory); + + ret =nvkm_memory_kmap (pd3, &vmm->pd->pt[0 ]->memory); +nvkm_memory_unref (&pd3); +if (WARN_ON (ret)) +return ; + + vmm->pd->pt[0 ]->addr =nvkm_memory_addr (vmm->pd->pt[0 ]->memory); +} + +static void * +r535_bar_dtor (struct nvkm_bar *bar) +{ +void *data =gf100_bar_dtor (bar); + +nvkm_memory_unref (&bar->flushFBZero); + +if (bar->flushBAR2PhysMode) +iounmap (bar->flushBAR2PhysMode); + +kfree (bar->func); +return data; +} + +int +r535_bar_new_ (const struct nvkm_bar_func *hw,struct nvkm_device *device, +enum nvkm_subdev_type type,int inst,struct nvkm_bar **pbar) +{ +struct nvkm_bar_func *rm; +struct nvkm_bar *bar; +int ret; + +if (!(rm =kzalloc (sizeof (*rm),GFP_KERNEL ))) +return -ENOMEM ; + + rm->dtor = r535_bar_dtor; + rm->oneinit = hw->oneinit; + rm->bar1.init = r535_bar_bar1_init; + rm->bar1.fini = r535_bar_bar1_fini; + rm->bar1.wait = r535_bar_bar1_wait; + rm->bar1.vmm = hw->bar1.vmm; + rm->bar2.init = r535_bar_bar2_init; + rm->bar2.fini = r535_bar_bar2_fini; + rm->bar2.wait = r535_bar_bar2_wait;
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c line 176
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c new file +10
-0+ rm->bar2.vmm = hw->bar2.vmm; + rm->flush = r535_bar_flush; + + ret =gf100_bar_new_ (rm, device, type, inst, &bar); + *pbar = bar; +if (ret) { +if (!bar) +kfree (rm); +return ret; + }
I can't really see how this can fail with bar not being NULL. Also what happens if bar != NULL, but the function fails anyway? Do upper layers decide whether to call dtor() based on whether *pbar is NULL or not? Is the caller really supposed to check both ret and *pbar?
Looking at NVKM_LAYOUT_ONCE() and nvkm_subdev_del() it seems like exactly that is the case...
Quoted 422 lines
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c new file +10
-0+ + bar->flushBAR2PhysMode =ioremap (device->func->resource_addr (device,3 ),PAGE_SIZE ); +if (!bar->flushBAR2PhysMode) +return -ENOMEM ; + + bar->flushBAR2 = bar->flushBAR2PhysMode; + +gf100_bar (*pbar)->bar2_halve = true; +return 0 ; +}drivers/gpu/drm/nouveau/nvkm/subdev/bar/tu102.c +1
-1@@ -97,7 +97,7 @@ tu102_bar_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_bar **pbar) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_bar_new_ (&tu102_bar, device, type, inst, pbar);return gf100_bar_new_ (&tu102_bar, device, type, inst, pbar); }drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c +37
-0@@ -20,6 +20,42 @@* OTHER DEALINGS IN THE SOFTWARE. */ #include "priv.h" +#include "ram.h" + +#include <subdev/gsp.h> + +static const struct nvkm_ram_func +r535_fb_ram = { +}; + +static int +r535_fb_ram_new (struct nvkm_fb *fb,struct nvkm_ram **pram) +{ +struct nvkm_gsp *gsp = fb->subdev.device->gsp; +struct nvkm_ram *ram; +int ret; + +if (!(ram = *pram =kzalloc (sizeof (*ram),GFP_KERNEL ))) +return -ENOMEM ; + + ram->func = &r535_fb_ram; + ram->fb = fb; + ram->type =NVKM_RAM_TYPE_UNKNOWN ;/*TODO: pull this from GSP. */ + ram->size = gsp->fb.size; + ram->stolen = false; +mutex_init (&ram->mutex); + +for (int i =0 ; i < gsp->fb.region_nr; i++) { + ret =nvkm_mm_init (&ram->vram,NVKM_RAM_MM_NORMAL , + gsp->fb.region[i].addr >>NVKM_RAM_MM_SHIFT , + gsp->fb.region[i].size >>NVKM_RAM_MM_SHIFT , +1 ); +if (ret) +return ret; + } + +return 0 ; +}static void *r535_fb_dtor (struct nvkm_fb *fb)@@ -41,6 +77,7 @@ r535_fb_new(const struct nvkm_fb_func *hw, rm->dtor = r535_fb_dtor; rm->sysmem.flush_page_init = hw->sysmem.flush_page_init; rm->vidmem.size = hw->vidmem.size; + rm->ram_new = r535_fb_ram_new; ret =nvkm_fb_new_ (rm, device, type, inst, pfb);if (ret)drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +47
-0@@ -787,6 +787,7 @@ static int r535_gsp_rpc_get_gsp_static_info(struct nvkm_gsp *gsp) {GspStaticConfigInfo *rpc; +int last_usable =-1 ; rpc =nvkm_gsp_rpc_rd (gsp,NV_VGPU_MSG_FUNCTION_GET_GSP_STATIC_INFO ,sizeof (*rpc));if (IS_ERR (rpc))@@ -805,6 +806,38 @@ r535_gsp_rpc_get_gsp_static_info(struct nvkm_gsp *gsp) gsp->internal.device.subdevice.parent = &gsp->internal.device.object; gsp->internal.device.subdevice.handle = rpc->hInternalSubdevice; + gsp->bar.rm_bar1_pdb = rpc->bar1PdeBase; + gsp->bar.rm_bar2_pdb = rpc->bar2PdeBase; + +for (int i =0 ; i < rpc->fbRegionInfoParams.numFBRegions; i++) { +NV2080_CTRL_CMD_FB_GET_FB_REGION_FB_REGION_INFO *reg = + &rpc->fbRegionInfoParams.fbRegion[i]; + +nvkm_debug (&gsp->subdev,"fb region %d: " +"%016llx-%016llx rsvd:%016llx perf:%08x comp:%d iso:%d prot:%d\n" , i, + reg->base, reg->limit, reg->reserved, reg->performance, + reg->supportCompressed, reg->supportISO, reg->bProtected); + +if (!reg->reserved && !reg->bProtected) { +if (reg->supportCompressed && reg->supportISO && + !WARN_ON_ONCE (gsp->fb.region_nr >=ARRAY_SIZE (gsp->fb.region))) { +const u64 size = (reg->limit +1 ) - reg->base; + + gsp->fb.region[gsp->fb.region_nr].addr = reg->base; + gsp->fb.region[gsp->fb.region_nr].size = size; + gsp->fb.region_nr++; + } + + last_usable = i; + } + } + +if (last_usable >=0 ) { +u32 rsvd_base = rpc->fbRegionInfoParams.fbRegion[last_usable].limit +1 ; + + gsp->fb.rsvd_size = gsp->fb.heap.addr - rsvd_base; + } +nvkm_gsp_rpc_done (gsp, rpc);return 0 ; }@@ -1106,6 +1139,18 @@ r535_gsp_msg_os_error_log(void *priv, u32 fn, void *repv, u32 repc)return 0 ; } +static int +r535_gsp_msg_mmu_fault_queued (void *priv,u32 fn,void *repv,u32 repc) +{ +struct nvkm_gsp *gsp = priv; +struct nvkm_subdev *subdev = &gsp->subdev; + +WARN_ON (repc !=0 ); + +nvkm_error (subdev,"mmu fault queued\n" ); +return 0 ; +} +static int r535_gsp_msg_run_cpu_sequencer (void *priv,u32 fn,void *repv,u32 repc) {@@ -1827,6 +1872,8 @@ r535_gsp_oneinit(struct nvkm_gsp *gsp)r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER , r535_gsp_msg_run_cpu_sequencer, gsp); +r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED , + r535_gsp_msg_mmu_fault_queued, gsp);r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_OS_ERROR_LOG , r535_gsp_msg_os_error_log, gsp); ret =r535_gsp_rm_boot_ctor (gsp);drivers/gpu/drm/nouveau/nvkm/subdev/instmem/Kbuild +2
-0@@ -4,3 +4,5 @@ nvkm-y += nvkm/subdev/instmem/nv04.o nvkm-y += nvkm/subdev/instmem/nv40.o nvkm-y += nvkm/subdev/instmem/nv50.o nvkm-y += nvkm/subdev/instmem/gk20a.o + +nvkm-y += nvkm/subdev/instmem/r535.odrivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c +1
-1@@ -432,7 +432,7 @@ nv50_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int ins struct nvkm_instmem **pimem) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_instmem_new (&nv50_instmem, device, type, inst, pimem);return nv50_instmem_new_ (&nv50_instmem, device, type, inst, pimem); }drivers/gpu/drm/nouveau/nvkm/subdev/instmem/priv.h +3
-0@@ -28,6 +28,9 @@ void nvkm_instmem_boot(struct nvkm_instmem *);int nv04_instmem_suspend (struct nvkm_instmem *);void nv04_instmem_resume (struct nvkm_instmem *); +int r535_instmem_new (const struct nvkm_instmem_func *, +struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_instmem **); +#include <core/memory.h> struct nvkm_instobj {drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c new file +222
-0@@ -0,0 +1,333 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" + +#include <subdev/gsp.h> + +#include <nvhw/drf.h> + +#include <nvrm/nvtypes.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/class/cl84a0.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080internal.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/nvos.h> +#include <nvrm/535.54.03/nvidia/generated/g_fbsr_nvoc.h> +#include <nvrm/535.54.03/nvidia/generated/g_rpc-structures.h> +#include <nvrm/535.54.03/nvidia/kernel/inc/vgpu/rpc_global_enums.h> + +struct fbsr_item { +const char *type; +u64 addr; +u64 size; + +struct list_head head; +}; + +struct fbsr { +struct list_head items; + +u64 size; +int regions; + +struct nvkm_gsp_client client; +struct nvkm_gsp_device device; + +u64 hmemory; +u64 sys_offset; +}; + +static int +fbsr_memlist (struct nvkm_gsp_device *device,u32 handle,enum nvkm_memory_target aper, +u64 phys,u64 size,struct sg_table *sgt,struct nvkm_gsp_object *object) +{ +struct nvkm_gsp_client *client = device->object.client; +struct nvkm_gsp *gsp = client->gsp; +const u32 pages = size /GSP_PAGE_SIZE ; +rpc_alloc_memory_v13_01 *rpc; +int ret; + + rpc =nvkm_gsp_rpc_get (gsp,NV_VGPU_MSG_FUNCTION_ALLOC_MEMORY , +sizeof (*rpc) + pages *sizeof (rpc->pteDesc.pte_pde[0 ])); +if (IS_ERR (rpc)) +return PTR_ERR (rpc); + + rpc->hClient = client->object.handle; + rpc->hDevice = device->object.handle; + rpc->hMemory = handle; +if (aper ==NVKM_MEM_TARGET_HOST ) { + rpc->hClass =NV01_MEMORY_LIST_SYSTEM ; + rpc->flags =NVDEF (NVOS02 ,FLAGS ,PHYSICALITY ,NONCONTIGUOUS ) | +NVDEF (NVOS02 ,FLAGS ,LOCATION ,PCI ) | +NVDEF (NVOS02 ,FLAGS ,MAPPING ,NO_MAP ); + }else { + rpc->hClass =NV01_MEMORY_LIST_FBMEM ; + rpc->flags =NVDEF (NVOS02 ,FLAGS ,PHYSICALITY ,CONTIGUOUS ) | +NVDEF (NVOS02 ,FLAGS ,LOCATION ,VIDMEM ) | +NVDEF (NVOS02 ,FLAGS ,MAPPING ,NO_MAP ); + rpc->format =6 ;/* NV_MMU_PTE_KIND_GENERIC_MEMORY */ + } + rpc->pteAdjust =0 ; + rpc->length = size; + rpc->pageCount = pages; + rpc->pteDesc.idr =0 ; + rpc->pteDesc.reserved1 =0 ; + rpc->pteDesc.length = pages; + +if (sgt) { +struct scatterlist *sgl; +int pte =0 , idx; + +for_each_sgtable_dma_sg (sgt, sgl, idx) { +for (int i =0 ; i <sg_dma_len (sgl) /GSP_PAGE_SIZE ; i++) + rpc->pteDesc.pte_pde[pte++].pte = (sg_dma_address (sgl) >>12 ) + i; + + } + }else { +for (int i =0 ; i < pages; i++) + rpc->pteDesc.pte_pde[i].pte = (phys >>12 ) + i; + } + + ret =nvkm_gsp_rpc_wr (gsp, rpc, true); +if (ret) +return ret; + + object->client = device->object.client; + object->parent = &device->object; + object->handle = handle; +return 0 ; +} + +static int +fbsr_send (struct fbsr *fbsr,struct fbsr_item *item) +{ +NV2080_CTRL_INTERNAL_FBSR_SEND_REGION_INFO_PARAMS *ctrl; +struct nvkm_gsp *gsp = fbsr->client.gsp; +struct nvkm_gsp_object memlist; +int ret; + + ret =fbsr_memlist (&fbsr->device, fbsr->hmemory,NVKM_MEM_TARGET_VRAM , + item->addr, item->size,NULL , &memlist); +if (ret) +return ret; + + ctrl =nvkm_gsp_rm_ctrl_get (&gsp->internal.device.subdevice, +NV2080_CTRL_CMD_INTERNAL_FBSR_SEND_REGION_INFO , +sizeof (*ctrl)); +if (IS_ERR (ctrl)) { + ret =PTR_ERR (ctrl); + goto done; + } + + ctrl->fbsrType =FBSR_TYPE_DMA ; + ctrl->hClient = fbsr->client.object.handle; + ctrl->hVidMem = fbsr->hmemory++; + ctrl->vidOffset =0 ; + ctrl->sysOffset = fbsr->sys_offset; + ctrl->size = item->size; + + ret =nvkm_gsp_rm_ctrl_wr (&gsp->internal.device.subdevice, ctrl); +done: +nvkm_gsp_rm_free (&memlist); +if (ret) +return ret; + + fbsr->sys_offset += item->size; +return 0 ; +} + +static int +fbsr_init (struct fbsr *fbsr,struct sg_table *sgt,u64 items_size) +{ +NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS *ctrl; +struct nvkm_gsp *gsp = fbsr->client.gsp; +struct nvkm_gsp_object memlist; +int ret; + + ret =fbsr_memlist (&fbsr->device, fbsr->hmemory,NVKM_MEM_TARGET_HOST , +0 , fbsr->size, sgt, &memlist); +if (ret) +return ret; + + ctrl =nvkm_gsp_rm_ctrl_get (&gsp->internal.device.subdevice, +NV2080_CTRL_CMD_INTERNAL_FBSR_INIT ,sizeof (*ctrl)); +if (IS_ERR (ctrl)) +return PTR_ERR (ctrl); + + ctrl->fbsrType =FBSR_TYPE_DMA ; + ctrl->numRegions = fbsr->regions; + ctrl->hClient = fbsr->client.object.handle; + ctrl->hSysMem = fbsr->hmemory++; + ctrl->gspFbAllocsSysOffset = items_size; + + ret =nvkm_gsp_rm_ctrl_wr (&gsp->internal.device.subdevice, ctrl); +if (ret) +return ret; + +nvkm_gsp_rm_free (&memlist); +return 0 ; +} + +static bool +fbsr_vram (struct fbsr *fbsr,const char *type,u64 addr,u64 size) +{ +struct fbsr_item *item; + +if (!(item =kzalloc (sizeof (*item),GFP_KERNEL ))) +return false; + + item->type = type; + item->addr = addr; + item->size = size; +list_add_tail (&item->head, &fbsr->items); +return true; +} + +static bool +fbsr_inst (struct fbsr *fbsr,const char *type,struct nvkm_memory *memory) +{ +return fbsr_vram (fbsr, type,nvkm_memory_addr (memory),nvkm_memory_size (memory)); +} + +static void +r535_instmem_resume (struct nvkm_instmem *imem) +{ +/* RM has restored VRAM contents already, so just need to free the sysmem buffer. */ +if (imem->rm.fbsr_valid) { +nvkm_gsp_sg_free (imem->subdev.device, &imem->rm.fbsr); + imem->rm.fbsr_valid = false; + } +} + +static int +r535_instmem_suspend (struct nvkm_instmem *imem) +{ +struct nvkm_subdev *subdev = &imem->subdev;
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c line 232
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c new file +10
-0+struct nvkm_device *device = subdev->device; +struct nvkm_gsp *gsp = device->gsp; +struct nvkm_instobj *iobj; +struct fbsr fbsr = {}; +struct fbsr_item *item, *temp; +u64 items_size; +int ret; + +INIT_LIST_HEAD (&fbsr.items); + fbsr.hmemory =0xcaf00003 ;
Where does this come from?
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c line 238
Quoted 6 lines
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c new file +6
-0+ +/* Create a list of all regions we need RM to save during suspend. */ +list_for_each_entry (iobj, &imem->list, head) { +if (iobj->preserve) { +if (!fbsr_inst (&fbsr,"inst" , &iobj->memory)) +return -ENOMEM ;
Free already allocated items?
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c line 244
Quoted 6 lines
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c new file +6
-0+ } + } + +list_for_each_entry (iobj, &imem->boot, head) { +if (!fbsr_inst (&fbsr,"boot" , &iobj->memory)) +return -ENOMEM ;
Same here...
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c line 248
Quoted 4 lines
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c new file +4
-0+ } + +if (!fbsr_vram (&fbsr,"gsp-non-wpr" , gsp->fb.heap.addr, gsp->fb.heap.size)) +return -ENOMEM ;
and here.
Quoted 336 lines
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/r535.c new file +85
-0+ +/* Determine memory requirements. */ +list_for_each_entry (item, &fbsr.items, head) { +nvkm_debug (subdev,"fbsr: %016llx %016llx %s\n" , + item->addr, item->size, item->type); + fbsr.size += item->size; + fbsr.regions++; + } + + items_size = fbsr.size; +nvkm_debug (subdev,"fbsr: %d regions (0x%llx bytes)\n" , fbsr.regions, items_size); + + fbsr.size += gsp->fb.rsvd_size; + fbsr.size += gsp->fb.bios.vga_workspace.size; +nvkm_debug (subdev,"fbsr: size: 0x%llx bytes\n" , fbsr.size); + + ret =nvkm_gsp_sg (gsp->subdev.device, fbsr.size, &imem->rm.fbsr); +if (ret) + goto done; + +/* Tell RM about the sysmem which will hold VRAM contents across suspend. */ + ret =nvkm_gsp_client_device_ctor (gsp, &fbsr.client, &fbsr.device); +if (ret) + goto done_sgt; + + ret =fbsr_init (&fbsr, &imem->rm.fbsr, items_size); +if (WARN_ON (ret)) + goto done_sgt; + +/* Send VRAM regions that need saving. */ +list_for_each_entry (item, &fbsr.items, head) { + ret =fbsr_send (&fbsr, item); +if (WARN_ON (ret)) + goto done_sgt; + } + + imem->rm.fbsr_valid = true; + +/* Cleanup everything except the sysmem backup, which will be removed after resume. */ +done_sgt: +if (ret)/* ... unless we failed already. */ +nvkm_gsp_sg_free (device, &imem->rm.fbsr); +done: +list_for_each_entry_safe (item, temp, &fbsr.items, head) { +list_del (&item->head); +kfree (item); + } + +nvkm_gsp_device_dtor (&fbsr.device); +nvkm_gsp_client_dtor (&fbsr.client); +return ret; +} + +static void * +r535_instmem_dtor (struct nvkm_instmem *imem) +{ +kfree (imem->func); +return imem; +} + +int +r535_instmem_new (const struct nvkm_instmem_func *hw, +struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_instmem **pinstmem) +{ +struct nvkm_instmem_func *rm; +int ret; + +if (!(rm =kzalloc (sizeof (*rm),GFP_KERNEL ))) +return -ENOMEM ; + + rm->dtor = r535_instmem_dtor; + rm->fini = hw->fini; + rm->suspend = r535_instmem_suspend; + rm->resume = r535_instmem_resume; + rm->memory_new = hw->memory_new; + rm->memory_wrap = hw->memory_wrap; + rm->zero = false; + + ret =nv50_instmem_new_ (rm, device, type, inst, pinstmem); +if (ret) +kfree (rm); + +return ret; +}drivers/gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild +2
-0@@ -16,6 +16,8 @@ nvkm-y += nvkm/subdev/mmu/gp10b.o nvkm-y += nvkm/subdev/mmu/gv100.o nvkm-y += nvkm/subdev/mmu/tu102.o +nvkm-y += nvkm/subdev/mmu/r535.o + nvkm-y += nvkm/subdev/mmu/mem.o nvkm-y += nvkm/subdev/mmu/memnv04.o nvkm-y += nvkm/subdev/mmu/memnv50.odrivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c +4
-0@@ -403,6 +403,10 @@ nvkm_mmu_dtor(struct nvkm_subdev *subdev)nvkm_mmu_ptc_fini (mmu);mutex_destroy (&mmu->mutex); + +if (mmu->func->dtor) + mmu->func->dtor (mmu); +return mmu; }drivers/gpu/drm/nouveau/nvkm/subdev/mmu/priv.h +6
-0@@ -4,12 +4,16 @@#define nvkm_mmu (p) container_of((p), struct nvkm_mmu, subdev)#include <subdev/mmu.h> +int r535_mmu_new (const struct nvkm_mmu_func *hw,struct nvkm_device *,enum nvkm_subdev_type ,int , +struct nvkm_mmu **); +void nvkm_mmu_ctor (const struct nvkm_mmu_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_mmu *);int nvkm_mmu_new_ (const struct nvkm_mmu_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_mmu **);struct nvkm_mmu_func { +void (*dtor)(struct nvkm_mmu *);void (*init)(struct nvkm_mmu *);u8 dma_bits;@@ -37,6 +41,8 @@ struct nvkm_mmu_func {const u8 *(*kind)(struct nvkm_mmu *,int *count,u8 *invalid);bool kind_sys; + +int (*promote_vmm)(struct nvkm_vmm *); };extern const struct nvkm_mmu_func nv04_mmu;drivers/gpu/drm/nouveau/nvkm/subdev/mmu/r535.c new file +123
-0@@ -0,0 +1,123 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "vmm.h" + +#include <nvrm/nvtypes.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/class/cl90f1.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl90f1.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/nvos.h> + +static int +r535_mmu_promote_vmm (struct nvkm_vmm *vmm) +{ +NV_VASPACE_ALLOCATION_PARAMETERS *args; +int ret; + + ret =nvkm_gsp_client_device_ctor (vmm->mmu->subdev.device->gsp, + &vmm->rm.client, &vmm->rm.device); +if (ret) +return ret; + + args =nvkm_gsp_rm_alloc_get (&vmm->rm.device.object,0x90f10000 ,FERMI_VASPACE_A , +sizeof (*args), &vmm->rm.object); +if (IS_ERR (args)) +return PTR_ERR (args); + + args->index =NV_VASPACE_ALLOCATION_INDEX_GPU_NEW ; + + ret =nvkm_gsp_rm_alloc_wr (&vmm->rm.object, args); +if (ret) +return ret; + + { +NV90F1_CTRL_VASPACE_COPY_SERVER_RESERVED_PDES_PARAMS *ctrl; + +mutex_lock (&vmm->mutex.vmm); + ret =nvkm_vmm_get_locked (vmm, true, false, false,0x1d ,32 ,0x20000000 , + &vmm->rm.rsvd); +mutex_unlock (&vmm->mutex.vmm); +if (ret) +return ret; + + ctrl =nvkm_gsp_rm_ctrl_get (&vmm->rm.object, +NV90F1_CTRL_CMD_VASPACE_COPY_SERVER_RESERVED_PDES , +sizeof (*ctrl)); +if (IS_ERR (ctrl)) +return PTR_ERR (ctrl); + + ctrl->pageSize =0x20000000 ; + ctrl->virtAddrLo = vmm->rm.rsvd->addr; + ctrl->virtAddrHi = vmm->rm.rsvd->addr + vmm->rm.rsvd->size -1 ; + ctrl->numLevelsToCopy = vmm->pd->pde[0 ]->pde[0 ] ?3 :2 ; + ctrl->levels[0 ].physAddress = vmm->pd->pt[0 ]->addr; + ctrl->levels[0 ].size =0x20 ; + ctrl->levels[0 ].aperture =1 ; + ctrl->levels[0 ].pageShift =0x2f ; + ctrl->levels[1 ].physAddress = vmm->pd->pde[0 ]->pt[0 ]->addr; + ctrl->levels[1 ].size =0x1000 ; + ctrl->levels[1 ].aperture =1 ; + ctrl->levels[1 ].pageShift =0x26 ; +if (vmm->pd->pde[0 ]->pde[0 ]) { + ctrl->levels[2 ].physAddress = vmm->pd->pde[0 ]->pde[0 ]->pt[0 ]->addr; + ctrl->levels[2 ].size =0x1000 ; + ctrl->levels[2 ].aperture =1 ; + ctrl->levels[2 ].pageShift =0x1d ; + } + + ret =nvkm_gsp_rm_ctrl_wr (&vmm->rm.object, ctrl); + } + +return ret; +} + +static void +r535_mmu_dtor (struct nvkm_mmu *mmu) +{ +kfree (mmu->func); +} + +int +r535_mmu_new (const struct nvkm_mmu_func *hw, +struct nvkm_device *device,enum nvkm_subdev_type type,int inst, +struct nvkm_mmu **pmmu) +{ +struct nvkm_mmu_func *rm; +int ret; + +if (!(rm =kzalloc (sizeof (*rm),GFP_KERNEL ))) +return -ENOMEM ; + + rm->dtor = r535_mmu_dtor; + rm->dma_bits = hw->dma_bits; + rm->mmu = hw->mmu; + rm->mem = hw->mem; + rm->vmm = hw->vmm; + rm->kind = hw->kind; + rm->kind_sys = hw->kind_sys; + rm->promote_vmm = r535_mmu_promote_vmm; + + ret =nvkm_mmu_new_ (rm, device, type, inst, pmmu); +if (ret) +kfree (rm); + +return ret; +}drivers/gpu/drm/nouveau/nvkm/subdev/mmu/tu102.c +1
-1@@ -56,7 +56,7 @@ tu102_mmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_mmu **pmmu) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_mmu_new (&tu102_mmu, device, type, inst, pmmu);return nvkm_mmu_new_ (&tu102_mmu, device, type, inst, pmmu); }drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c +6
-0@@ -572,6 +572,12 @@ nvkm_uvmm_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, } uvmm->vmm->managed.raw = raw; +if (mmu->func->promote_vmm) { + ret = mmu->func->promote_vmm (uvmm->vmm); +if (ret) +return ret; + } + page = uvmm->vmm->func->page; args->v0.page_nr =0 ;while (page && (page++)->shift)drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c +7
-0@@ -1030,6 +1030,13 @@ nvkm_vmm_dtor(struct nvkm_vmm *vmm)struct nvkm_vma *vma;struct rb_node *node; +if (vmm->rm.client.gsp) { +nvkm_gsp_rm_free (&vmm->rm.object); +nvkm_gsp_device_dtor (&vmm->rm.device); +nvkm_gsp_client_dtor (&vmm->rm.client); +nvkm_vmm_put (vmm, &vmm->rm.rsvd); + } +if (0 )nvkm_vmm_dump (vmm);drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmtu102.c +4
-1@@ -35,7 +35,10 @@ tu102_vmm_flush(struct nvkm_vmm *vmm, int depth)mutex_lock (&vmm->mmu->mutex); -nvkm_wr32 (device,0xb830a0 , vmm->pd->pt[0 ]->addr >>8 ); +if (!vmm->rm.bar2_pdb) +nvkm_wr32 (device,0xb830a0 , vmm->pd->pt[0 ]->addr >>8 ); +else +nvkm_wr32 (device,0xb830a0 , vmm->rm.bar2_pdb >>8 );nvkm_wr32 (device,0xb830a4 ,0x00000000 );nvkm_wr32 (device,0xb830b0 ,0x80000000 | type);
PATCH 37/44 drm/nouveau/disp/r535: initial support
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
Adds support for modesetting on RM.
--- drivers/gpu/drm/nouveau/dispnv50/core.c | 1 + drivers/gpu/drm/nouveau/dispnv50/disp.c | 141 ++ drivers/gpu/drm/nouveau/include/nvif/class.h | 2 + .../drm/nouveau/include/nvkm/engine/disp.h | 19 + .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 35 + .../common/sdk/nvidia/inc/class/cl0005.h | 38 + .../nvidia/inc/class/cl2080_notification.h | 42 + .../nvidia/inc/ctrl/ctrl0073/ctrl0073common.h | 39 + .../nvidia/inc/ctrl/ctrl0073/ctrl0073dfp.h | 166 ++ .../sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073dp.h | 335 ++++ .../inc/ctrl/ctrl0073/ctrl0073specific.h | 216 +++ .../nvidia/inc/ctrl/ctrl0073/ctrl0073system.h | 34 + .../nvidia/inc/ctrl/ctrl2080/ctrl2080event.h | 41 + .../inc/ctrl/ctrl2080/ctrl2080internal.h | 43 + .../535.54.03/common/sdk/nvidia/inc/nvos.h | 27 + .../535.54.03/nvidia/generated/g_allclasses.h | 33 + .../nvidia/generated/g_mem_desc_nvoc.h | 32 + .../nvidia/generated/g_rpc-structures.h | 13 + .../nvidia/inc/kernel/gpu/intr/engine_idx.h | 2 + .../nvidia/inc/kernel/os/nv_memory_type.h | 31 + drivers/gpu/drm/nouveau/nvif/disp.c | 1 + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 10 + .../gpu/drm/nouveau/nvkm/engine/disp/Kbuild | 3 + .../gpu/drm/nouveau/nvkm/engine/disp/ad102.c | 52 + .../gpu/drm/nouveau/nvkm/engine/disp/base.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/disp/chan.h | 4 + .../gpu/drm/nouveau/nvkm/engine/disp/ga102.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/disp/gv100.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/disp/ior.h | 2 + .../gpu/drm/nouveau/nvkm/engine/disp/outp.c | 3 +- .../gpu/drm/nouveau/nvkm/engine/disp/priv.h | 3 + .../gpu/drm/nouveau/nvkm/engine/disp/r535.c | 1671 +++++++++++++++++ .../gpu/drm/nouveau/nvkm/engine/disp/tu102.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/disp/uconn.c | 31 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 129 ++ 35 files changed, 3202 insertions(+), 8 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0005.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080_notification.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073common.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073dfp.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073dp.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073specific.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080event.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_allclasses.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_mem_desc_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/os/nv_memory_type.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/ad102.c create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c
drivers/gpu/drm/nouveau/dispnv50/core.c +1 -0
@@ -42,6 +42,7 @@ nv50_core_new(struct nouveau_drm *drm, struct nv50_core **pcore)int version;int (*new)(struct nouveau_drm *,s32 ,struct nv50_core **); } cores[] = { + { AD102_DISP_CORE_CHANNEL_DMA, 0, corec57d_new }, { GA102_DISP_CORE_CHANNEL_DMA, 0, corec57d_new }, { TU102_DISP_CORE_CHANNEL_DMA, 0, corec57d_new }, { GV100_DISP_CORE_CHANNEL_DMA, 0, corec37d_new },
drivers/gpu/drm/nouveau/dispnv50/disp.c +141 -0
153 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvif/class.h +2 -0
@@ -104,6 +104,7 @@#define GV100_DISP /* if0010.h */ 0x0000c370#define TU102_DISP /* if0010.h */ 0x0000c570#define GA102_DISP /* if0010.h */ 0x0000c670 +#define AD102_DISP /* if0010.h */ 0x0000c770#define GV100_DISP_CAPS 0x0000c373
@@ -154,6 +155,7 @@#define GV100_DISP_CORE_CHANNEL_DMA /* if0014.h */ 0x0000c37d#define TU102_DISP_CORE_CHANNEL_DMA /* if0014.h */ 0x0000c57d#define GA102_DISP_CORE_CHANNEL_DMA /* if0014.h */ 0x0000c67d +#define AD102_DISP_CORE_CHANNEL_DMA /* if0014.h */ 0x0000c77d#define NV50_DISP_OVERLAY_CHANNEL_DMA /* if0014.h */ 0x0000507e#define G82_DISP_OVERLAY_CHANNEL_DMA /* if0014.h */ 0x0000827e
drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h +19 -0
@@ -5,11 +5,29 @@#include <core/engine.h> #include <core/object.h> #include <core/event.h> +#include <subdev/gsp.h> struct nvkm_disp {const struct nvkm_disp_func *func;struct nvkm_engine engine; +struct { +struct nvkm_gsp_client client; +struct nvkm_gsp_device device; + +struct nvkm_gsp_object objcom; +struct nvkm_gsp_object object; + +#define NVKM_DPYID_PLUG BIT(0) +#define NVKM_DPYID_UNPLUG BIT(1) +#define NVKM_DPYID_IRQ BIT(2) +struct nvkm_event event; +struct nvkm_gsp_event hpd; +struct nvkm_gsp_event irq; + +u32 assigned_sors; + } rm; +struct list_head heads;struct list_head iors;struct list_head outps;
@@ -69,4 +87,5 @@ int gp102_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, structint gv100_disp_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_disp **);int tu102_disp_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_disp **);int ga102_disp_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_disp **); +int ad102_disp_new (struct nvkm_device *,enum nvkm_subdev_type ,int inst,struct nvkm_disp **);#endif
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +35 -0
@@ -23,6 +23,9 @@ void nvkm_gsp_sg_free(struct nvkm_device *, struct sg_table *);typedef int (*nvkm_gsp_msg_ntfy_func )(void *priv,u32 fn,void *repv,u32 repc); +struct nvkm_gsp_event ; +typedef void (*nvkm_gsp_event_func )(struct nvkm_gsp_event *,void *repv,u32 repc); +struct nvkm_gsp {const struct nvkm_gsp_func *func;struct nvkm_subdev subdev;
@@ -150,6 +153,8 @@ struct nvkm_gsp { } object;struct nvkm_gsp *gsp; + +struct list_head events; } client;struct nvkm_gsp_device {
@@ -191,6 +196,10 @@ struct nvkm_gsp {int (*device_ctor)(struct nvkm_gsp_client *,struct nvkm_gsp_device *);void (*device_dtor)(struct nvkm_gsp_device *); + +int (*event_ctor)(struct nvkm_gsp_device *,u32 handle,u32 id, +nvkm_gsp_event_func ,struct nvkm_gsp_event *); +void (*event_dtor)(struct nvkm_gsp_event *); } *rm;struct {
@@ -399,6 +408,32 @@ nvkm_gsp_client_device_ctor(struct nvkm_gsp *gsp,return ret; } +struct nvkm_gsp_event { +struct nvkm_gsp_device *device; +u32 id; +nvkm_gsp_event_func func; + +struct nvkm_gsp_object object; + +struct list_head head; +}; + +static inline int +nvkm_gsp_device_event_ctor (struct nvkm_gsp_device *device,u32 handle,u32 id, +nvkm_gsp_event_func func,struct nvkm_gsp_event *event) +{ +return device->object.client->gsp->rm->event_ctor (device, handle, id, func, event); +} + +static inline void +nvkm_gsp_event_dtor (struct nvkm_gsp_event *event) +{ +struct nvkm_gsp_device *device = event->device; + +if (device) + device->object.client->gsp->rm->event_dtor (event); +} +int nvkm_gsp_intr_stall (struct nvkm_gsp *,enum nvkm_subdev_type ,int );int nvkm_gsp_intr_nonstall (struct nvkm_gsp *,enum nvkm_subdev_type ,int );
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl0005.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef __src_common_sdk_nvidia_inc_class_cl0005_h__ +#define __src_common_sdk_nvidia_inc_class_cl0005_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2001-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NV0005_ALLOC_PARAMETERS { +NvHandle hParentClient; +NvHandle hSrcResource; + +NvV32 hClass; +NvV32 notifyIndex; + NV_DECLARE_ALIGNED(NvP64 data, 8); +}NV0005_ALLOC_PARAMETERS ; + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080_notification.h new file +42 -0
42 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073common.h new file +39 -0
@@ -0,0 +1,39 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl0073_ctrl0073common_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl0073_ctrl0073common_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NV0073_CTRL_CMD_DSC_CAP_PARAMS { +NvBool bDscSupported; +NvU32 encoderColorFormatMask; +NvU32 lineBufferSizeKB; +NvU32 rateBufferSizeKB; +NvU32 bitsPerPixelPrecision; +NvU32 maxNumHztSlices; +NvU32 lineBufferBitDepth; +}NV0073_CTRL_CMD_DSC_CAP_PARAMS ; + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073dfp.h new file +166 -0
166 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073dp.h new file +335 -0
335 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073specific.h new file +216 -0
216 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl0073/ctrl0073system.h +34 -0
@@ -26,6 +26,40 @@* DEALINGS IN THE SOFTWARE. */ +#define NV0073_CTRL_CMD_SYSTEM_GET_NUM_HEADS (0x730102U)/* finn: Evaluated from "(FINN_NV04_DISPLAY_COMMON_SYSTEM_INTERFACE_ID << 8) | NV0073_CTRL_SYSTEM_GET_NUM_HEADS_PARAMS_MESSAGE_ID" */ + +typedef struct NV0073_CTRL_SYSTEM_GET_NUM_HEADS_PARAMS { +NvU32 subDeviceInstance; +NvU32 flags; +NvU32 numHeads; +}NV0073_CTRL_SYSTEM_GET_NUM_HEADS_PARAMS ; + +#define NV0073_CTRL_CMD_SYSTEM_GET_SUPPORTED (0x730120U)/* finn: Evaluated from "(FINN_NV04_DISPLAY_COMMON_SYSTEM_INTERFACE_ID << 8) | NV0073_CTRL_SYSTEM_GET_SUPPORTED_PARAMS_MESSAGE_ID" */ + +typedef struct NV0073_CTRL_SYSTEM_GET_SUPPORTED_PARAMS { +NvU32 subDeviceInstance; +NvU32 displayMask; +NvU32 displayMaskDDC; +}NV0073_CTRL_SYSTEM_GET_SUPPORTED_PARAMS ; + +#define NV0073_CTRL_CMD_SYSTEM_GET_CONNECT_STATE (0x730122U)/* finn: Evaluated from "(FINN_NV04_DISPLAY_COMMON_SYSTEM_INTERFACE_ID << 8) | NV0073_CTRL_SYSTEM_GET_CONNECT_STATE_PARAMS_MESSAGE_ID" */ + +typedef struct NV0073_CTRL_SYSTEM_GET_CONNECT_STATE_PARAMS { +NvU32 subDeviceInstance; +NvU32 flags; +NvU32 displayMask; +NvU32 retryTimeMs; +}NV0073_CTRL_SYSTEM_GET_CONNECT_STATE_PARAMS ; + +#define NV0073_CTRL_CMD_SYSTEM_GET_ACTIVE (0x730126U)/* finn: Evaluated from "(FINN_NV04_DISPLAY_COMMON_SYSTEM_INTERFACE_ID << 8) | NV0073_CTRL_SYSTEM_GET_ACTIVE_PARAMS_MESSAGE_ID" */ + +typedef struct NV0073_CTRL_SYSTEM_GET_ACTIVE_PARAMS { +NvU32 subDeviceInstance; +NvU32 head; +NvU32 flags; +NvU32 displayId; +}NV0073_CTRL_SYSTEM_GET_ACTIVE_PARAMS ; +#define NV0073_CTRL_SYSTEM_ACPI_ID_MAP_MAX_DISPLAYS (16U)#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080event.h new file +41 -0
41 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080internal.h +43 -0
53 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvos.h +27 -0
@@ -78,6 +78,33 @@#define NVOS02_FLAGS_MAPPING_NO_MAP (0x00000001)#define NVOS02_FLAGS_MAPPING_NEVER_MAP (0x00000002) +#define NV01_EVENT_CLIENT_RM (0x04000000) + +typedef struct +{ +NvV32 channelInstance;// One of the n channel instances of a given channel type. +// Note that core channel has only one instance +// while all others have two (one per head). +NvHandle hObjectBuffer;// ctx dma handle for DMA push buffer +NvHandle hObjectNotify;// ctx dma handle for an area (of type NvNotification defined in sdk/nvidia/inc/nvtypes.h) where RM can write errors/notifications +NvU32 offset;// Initial offset for put/get, usually zero. + NvP64 pControl NV_ALIGN_BYTES(8); // pControl gives virt addr of UDISP GET/PUT regs + +NvU32 flags; +#define NV50VAIO_CHANNELDMA_ALLOCATION_FLAGS_CONNECT_PB_AT_GRAB 1:1 +#define NV50VAIO_CHANNELDMA_ALLOCATION_FLAGS_CONNECT_PB_AT_GRAB_YES 0x00000000 +#define NV50VAIO_CHANNELDMA_ALLOCATION_FLAGS_CONNECT_PB_AT_GRAB_NO 0x00000001 + +}NV50VAIO_CHANNELDMA_ALLOCATION_PARAMETERS ; + +typedef struct +{ +NvV32 channelInstance;// One of the n channel instances of a given channel type. +// All PIO channels have two instances (one per head). +NvHandle hObjectNotify;// ctx dma handle for an area (of type NvNotification defined in sdk/nvidia/inc/nvtypes.h) where RM can write errors. + NvP64 pControl NV_ALIGN_BYTES(8); // pControl gives virt addr of control region for PIO channel +}NV50VAIO_CHANNELPIO_ALLOCATION_PARAMETERS ; + typedef struct { NvU32 index;
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_allclasses.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __src_nvidia_generated_g_allclasses_h__ +#define __src_nvidia_generated_g_allclasses_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2021-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV01_EVENT_KERNEL_CALLBACK_EX (0x0000007e) + +#define NV04_DISPLAY_COMMON (0x00000073) + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_mem_desc_nvoc.h new file +32 -0
@@ -0,0 +1,32 @@ +#ifndef __src_nvidia_generated_g_mem_desc_nvoc_h__ +#define __src_nvidia_generated_g_mem_desc_nvoc_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define ADDR_SYSMEM 1 // System memory (PCI) +#define ADDR_FBMEM 2 // Frame buffer memory space + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h +13 -0
@@ -91,6 +91,19 @@ typedef struct rpc_run_cpu_sequencer_v17_00NvU32 commandBuffer[]; } rpc_run_cpu_sequencer_v17_00; +typedef struct rpc_post_event_v17_00 +{ +NvHandle hClient; +NvHandle hEvent; +NvU32 notifyIndex; +NvU32 data; +NvU16 info16; +NvU32 status; +NvU32 eventDataSize; +NvBool bNotifyList; +NvU8 eventData[]; +}rpc_post_event_v17_00 ; + typedef struct rpc_os_error_log_v17_00 { NvU32 exceptType;
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/intr/engine_idx.h +2 -0
@@ -26,6 +26,8 @@* DEALINGS IN THE SOFTWARE. */ +#define MC_ENGINE_IDX_DISP 2 +#define MC_ENGINE_IDX_GSP 49#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/os/nv_memory_type.h new file +31 -0
@@ -0,0 +1,31 @@ +#ifndef __src_nvidia_inc_kernel_os_nv_memory_type_h__ +#define __src_nvidia_inc_kernel_os_nv_memory_type_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2020 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV_MEMORY_WRITECOMBINED 2 + +#endif
drivers/gpu/drm/nouveau/nvif/disp.c +1 -0
@@ -36,6 +36,7 @@ int nvif_disp_ctor(struct nvif_device *device, const char *name, s32 oclass, struct nvif_disp *disp) { static const struct nvif_mclass disps[] = { + { AD102_DISP, 0 }, { GA102_DISP, 0 }, { TU102_DISP, 0 }, { GV100_DISP, 0 },
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +10 -0
@@ -2758,6 +2758,8 @@ nv192_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .disp = { 0x00000001, ad102_disp_new }, + .dma = { 0x00000001, gv100_dma_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2775,6 +2777,8 @@ nv193_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .disp = { 0x00000001, ad102_disp_new }, + .dma = { 0x00000001, gv100_dma_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2792,6 +2796,8 @@ nv194_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .disp = { 0x00000001, ad102_disp_new }, + .dma = { 0x00000001, gv100_dma_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2809,6 +2815,8 @@ nv196_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .disp = { 0x00000001, ad102_disp_new }, + .dma = { 0x00000001, gv100_dma_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2826,6 +2834,8 @@ nv197_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .disp = { 0x00000001, ad102_disp_new }, + .dma = { 0x00000001, gv100_dma_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +3 -0
@@ -27,6 +27,9 @@ nvkm-y += nvkm/engine/disp/gp102.o nvkm-y += nvkm/engine/disp/gv100.o nvkm-y += nvkm/engine/disp/tu102.o nvkm-y += nvkm/engine/disp/ga102.o +nvkm-y += nvkm/engine/disp/ad102.o + +nvkm-y += nvkm/engine/disp/r535.o nvkm-y += nvkm/engine/disp/udisp.o nvkm-y += nvkm/engine/disp/uconn.o
drivers/gpu/drm/nouveau/nvkm/engine/disp/ad102.c new file +52 -0
52 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c +2 -1
@@ -137,7 +137,8 @@ nvkm_disp_init(struct nvkm_engine *engine)* each output resource to 'fully enabled'. */ list_for_each_entry (ior, &disp->iors, head) { - ior->func->power (ior, true, true, true, true, true); +if (ior->func->power) + ior->func->power (ior, true, true, true, true, true); }return 0 ;
drivers/gpu/drm/nouveau/nvkm/engine/disp/chan.h +4 -0
@@ -22,6 +22,10 @@ struct nvkm_disp_chan {u64 push;u32 suspend_put; + +struct { +struct nvkm_gsp_object object; + } rm; };int nvkm_disp_core_new (const struct nvkm_oclass *,void *,u32 ,struct nvkm_object **);
drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c +1 -1
@@ -149,7 +149,7 @@ ga102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_disp **pdisp) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_disp_new (&ga102_disp, device, type, inst, pdisp);return nvkm_disp_new_ (&ga102_disp, device, type, inst, pdisp); }
drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c +2 -2
@@ -96,7 +96,7 @@ gv100_sor_dp = { .watermark = gv100_sor_dp_watermark, }; -static void +void gv100_sor_hdmi_infoframe_vsi (struct nvkm_ior *ior,int head,void *data,u32 size) {struct nvkm_device *device = ior->disp->engine.subdev.device;
@@ -120,7 +120,7 @@ gv100_sor_hdmi_infoframe_vsi(struct nvkm_ior *ior, int head, void *data, u32 siznvkm_mask (device,0x6f0100 + hoff,0x00000001 ,0x00000001 ); } -static void +void gv100_sor_hdmi_infoframe_avi (struct nvkm_ior *ior,int head,void *data,u32 size) {struct nvkm_device *device = ior->disp->engine.subdev.device;
drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +2 -0
@@ -187,6 +187,8 @@ int gp100_sor_new(struct nvkm_disp *, int);int gv100_sor_cnt (struct nvkm_disp *,unsigned long *);void gv100_sor_state (struct nvkm_ior *,struct nvkm_ior_state *);extern const struct nvkm_ior_func_hdmi gv100_sor_hdmi; +void gv100_sor_hdmi_infoframe_avi (struct nvkm_ior *,int ,void *,u32 ); +void gv100_sor_hdmi_infoframe_vsi (struct nvkm_ior *,int ,void *,u32 );void gv100_sor_dp_audio (struct nvkm_ior *,int ,bool );void gv100_sor_dp_audio_sym (struct nvkm_ior *,int ,u16 ,u32 );void gv100_sor_dp_watermark (struct nvkm_ior *,int ,u8 );
drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c +2 -1
@@ -386,7 +386,8 @@ nvkm_outp_new_(const struct nvkm_outp_func *func, struct nvkm_disp *disp, outp->disp = disp; outp->index = index; outp->info = *dcbE; - outp->i2c =nvkm_i2c_bus_find (i2c, dcbE->i2c_index); +if (!disp->rm.client.gsp) + outp->i2c =nvkm_i2c_bus_find (i2c, dcbE->i2c_index); OUTP_DBG(outp, "type %02x loc %d or %d link %d con %x " "edid %x bus %d head %x",
drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h +3 -0
@@ -8,6 +8,9 @@ struct nvkm_head;struct nvkm_outp ;struct dcb_output ; +int r535_disp_new (const struct nvkm_disp_func *,struct nvkm_device *,enum nvkm_subdev_type ,int , +struct nvkm_disp **); +int nvkm_disp_ctor (const struct nvkm_disp_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_disp *); int nvkm_disp_new_(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c new file +1671 -0
1,430 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/nouveau/nvkm/engine/disp/uconn.c +29 -2
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +129 -0
129 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.41.0
Part of the diff is not shown here. View the raw message.
PATCH 38/44 drm/nouveau/fifo/r535: initial support
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
- Adds support for allocating CHANNEL_GPFIFO classes from RM.
--- .../drm/nouveau/include/nvkm/engine/fifo.h | 13 + .../sdk/nvidia/inc/alloc/alloc_channel.h | 161 ++++++ .../nvidia/inc/class/cl2080_notification.h | 20 + .../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.h | 35 ++ .../nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.h | 52 ++ .../nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.h | 42 ++ .../common/sdk/nvidia/inc/nvlimits.h | 2 + .../nvidia/generated/g_kernel_channel_nvoc.h | 62 +++ .../nvidia/generated/g_kernel_fifo_nvoc.h | 119 ++++ .../nvidia/generated/g_rpc-structures.h | 9 + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 5 + drivers/gpu/drm/nouveau/nvkm/engine/falcon.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/fifo/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/fifo/ga102.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 + .../gpu/drm/nouveau/nvkm/engine/fifo/r535.c | 519 ++++++++++++++++++ .../gpu/drm/nouveau/nvkm/engine/fifo/tu102.c | 2 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 30 + 19 files changed, 1079 insertions(+), 6 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/alloc/alloc_channel.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_channel_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_fifo_nvoc.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c
drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h +13 -0
@@ -4,6 +4,7 @@#include <core/engine.h> #include <core/object.h> #include <core/event.h> +#include <subdev/gsp.h> struct nvkm_fault_data ;#define NVKM_FIFO_ENGN_NR 16
@@ -35,6 +36,14 @@ struct nvkm_chan {atomic_t blocked;atomic_t errored; +struct { +struct nvkm_gsp_object object; +struct { +dma_addr_t addr; +void *ptr; + } mthdbuf; + } rm; +struct list_head cctxs;struct list_head head; };
@@ -71,6 +80,10 @@ struct nvkm_fifo {struct list_head list; } userd; +struct { +u32 mthdbuf_size; + } rm; +spinlock_t lock;struct mutex mutex; };
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/alloc/alloc_channel.h new file +161 -0
161 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080_notification.h +20 -0
@@ -30,6 +30,26 @@#define NV2080_NOTIFIERS_DP_IRQ (7) +#define NV2080_ENGINE_TYPE_GRAPHICS (0x00000001) +#define NV2080_ENGINE_TYPE_GR0 NV2080_ENGINE_TYPE_GRAPHICS + +#define NV2080_ENGINE_TYPE_COPY0 (0x00000009) + +#define NV2080_ENGINE_TYPE_BSP (0x00000013) +#define NV2080_ENGINE_TYPE_NVDEC0 NV2080_ENGINE_TYPE_BSP + +#define NV2080_ENGINE_TYPE_MSENC (0x0000001b) +#define NV2080_ENGINE_TYPE_NVENC0 NV2080_ENGINE_TYPE_MSENC/* Mutually exclusive alias */ + +#define NV2080_ENGINE_TYPE_SW (0x00000022) + +#define NV2080_ENGINE_TYPE_SEC2 (0x00000026) + +#define NV2080_ENGINE_TYPE_NVJPG (0x0000002b) +#define NV2080_ENGINE_TYPE_NVJPEG0 NV2080_ENGINE_TYPE_NVJPG + +#define NV2080_ENGINE_TYPE_OFA (0x00000033) + typedef struct { NvU32 plugDisplayMask; NvU32 unplugDisplayMask;
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.h new file +35 -0
@@ -0,0 +1,35 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080ce_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080ce_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2014-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS { +NvU32 size; +}NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS ; + +#define NV2080_CTRL_CMD_CE_GET_FAULT_METHOD_BUFFER_SIZE (0x20802a08)/* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_CE_INTERFACE_ID << 8) | NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS_MESSAGE_ID" */ + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.h new file +52 -0
52 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.h new file +42 -0
42 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h +2 -0
@@ -26,6 +26,8 @@* DEALINGS IN THE SOFTWARE. */ +#define NV_MAX_SUBDEVICES 8 +#define NV_PROC_NAME_MAX_LENGTH 100U#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_channel_nvoc.h new file +62 -0
62 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_fifo_nvoc.h new file +119 -0
119 lines not on this page · raw message
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h +9 -0
@@ -104,6 +104,15 @@ typedef struct rpc_post_event_v17_00NvU8 eventData[]; } rpc_post_event_v17_00; +typedef struct rpc_rc_triggered_v17_02 +{ +NvU32 nv2080EngineType; +NvU32 chid; +NvU32 exceptType; +NvU32 scope; +NvU16 partitionAttributionId; +}rpc_rc_triggered_v17_02 ; + typedef struct rpc_os_error_log_v17_00 { NvU32 exceptType;
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +5 -0
@@ -2760,6 +2760,7 @@ nv192_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2779,6 +2780,7 @@ nv193_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2798,6 +2800,7 @@ nv194_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2817,6 +2820,7 @@ nv196_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
@@ -2836,6 +2840,7 @@ nv197_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };
drivers/gpu/drm/nouveau/nvkm/engine/falcon.c +2 -2
@@ -318,14 +318,14 @@ nvkm_falcon_init(struct nvkm_engine *engine) }static void * -nvkm_falcon_dtor (struct nvkm_engine *engine) +nvkm_falcon_dtor_engine (struct nvkm_engine *engine) {return nvkm_falcon (engine); }static const struct nvkm_engine_func nvkm_falcon = { - .dtor = nvkm_falcon_dtor, + .dtor = nvkm_falcon_dtor_engine, .oneinit = nvkm_falcon_oneinit, .init = nvkm_falcon_init, .fini = nvkm_falcon_fini,
drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild +2 -0
@@ -26,5 +26,7 @@ nvkm-y += nvkm/engine/fifo/tu102.o nvkm-y += nvkm/engine/fifo/ga100.o nvkm-y += nvkm/engine/fifo/ga102.o +nvkm-y += nvkm/engine/fifo/r535.o + nvkm-y += nvkm/engine/fifo/ucgrp.o nvkm-y += nvkm/engine/fifo/uchan.o
drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c +1 -1
@@ -609,7 +609,7 @@ ga100_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_fifo_new (&ga100_fifo, device, type, inst, pfifo);return nvkm_fifo_new_ (&ga100_fifo, device, type, inst, pfifo); }
drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c +2 -2
@@ -36,7 +36,7 @@ ga102_fifo = { .engn = &ga100_engn, .engn_ce = &ga100_engn_ce, .cgrp = {{ 0, 0, KEPLER_CHANNEL_GROUP_A }, &ga100_cgrp, .force = true }, - .chan = {{ 0, 0, AMPERE_CHANNEL_GPFIFO_B }, &ga100_chan }, + .chan = {{ 0, 0, AMPERE_CHANNEL_GPFIFO_A }, &ga100_chan }, }; int
@@ -44,7 +44,7 @@ ga102_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_fifo_new (&ga102_fifo, device, type, inst, pfifo);return nvkm_fifo_new_ (&ga102_fifo, device, type, inst, pfifo); }
drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h +2 -0
@@ -60,6 +60,8 @@ struct nvkm_fifo_func { } chan; }; +int r535_fifo_new (const struct nvkm_fifo_func *,struct nvkm_device *,enum nvkm_subdev_type ,int , +struct nvkm_fifo **);int nvkm_fifo_new_ (const struct nvkm_fifo_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_fifo **);
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +519 -0
519 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/engine/fifo/tu102.c +1 -1
@@ -284,7 +284,7 @@ tu102_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_fifo_new (&tu102_fifo, device, type, inst, pfifo);return nvkm_fifo_new_ (&tu102_fifo, device, type, inst, pfifo); }
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +30 -0
@@ -24,6 +24,7 @@#include <core/pci.h> #include <subdev/timer.h> #include <subdev/vfn.h> +#include <engine/fifo/chan.h> #include <engine/sec2.h> #include <nvfw/fw.h>
@@ -1226,6 +1227,33 @@ r535_gsp_msg_os_error_log(void *priv, u32 fn, void *repv, u32 repc)return 0 ; } +static int +r535_gsp_msg_rc_triggered (void *priv,u32 fn,void *repv,u32 repc) +{ +rpc_rc_triggered_v17_02 *msg = repv; +struct nvkm_gsp *gsp = priv; +struct nvkm_subdev *subdev = &gsp->subdev; +struct nvkm_chan *chan; +unsigned long flags; + +if (WARN_ON (repc <sizeof (*msg))) +return -EINVAL ; + +nvkm_error (subdev,"rc engn:%08x chid:%d type:%d scope:%d part:%d\n" , + msg->nv2080EngineType, msg->chid, msg->exceptType, msg->scope, + msg->partitionAttributionId); + + chan =nvkm_chan_get_chid (&subdev->device->fifo->engine, msg->chid /8 , &flags); +if (!chan) { +nvkm_error (subdev,"rc chid:%d not found!\n" , msg->chid); +return 0 ; + } + +nvkm_chan_error (chan, false); +nvkm_chan_put (&chan, flags); +return 0 ; +} +static int r535_gsp_msg_mmu_fault_queued (void *priv,u32 fn,void *repv,u32 repc) {
@@ -2001,6 +2029,8 @@ r535_gsp_oneinit(struct nvkm_gsp *gsp)r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER , r535_gsp_msg_run_cpu_sequencer, gsp);r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_POST_EVENT , r535_gsp_msg_post_event, gsp); +r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_RC_TRIGGERED , + r535_gsp_msg_rc_triggered, gsp);r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED , r535_gsp_msg_mmu_fault_queued, gsp);r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_OS_ERROR_LOG , r535_gsp_msg_os_error_log, gsp);
Signature · 1 line
2.41.0
Re: [Nouveau] [PATCH 38/44] drm/nouveau/fifo/r535: initial support
Quoted 823 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
- Adds support for allocating
CHANNEL_GPFIFOclasses from RM.Signed-off-by Ben Skeggs <[email protected]>--- .../drm/nouveau/include/nvkm/engine/fifo.h | 13 + .../sdk/nvidia/inc/alloc/alloc_channel.h | 161 ++++++ .../nvidia/inc/class/cl2080_notification.h | 20 + .../sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.h | 35 ++ .../nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.h | 52 ++ .../nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.h | 42 ++ .../common/sdk/nvidia/inc/nvlimits.h | 2 + .../nvidia/generated/g_kernel_channel_nvoc.h | 62 +++ .../nvidia/generated/g_kernel_fifo_nvoc.h | 119 ++++ .../nvidia/generated/g_rpc-structures.h | 9 + .../gpu/drm/nouveau/nvkm/engine/device/base.c | 5 + drivers/gpu/drm/nouveau/nvkm/engine/falcon.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/fifo/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/fifo/ga102.c | 4 +- .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 + .../gpu/drm/nouveau/nvkm/engine/fifo/r535.c | 519 ++++++++++++++++++ .../gpu/drm/nouveau/nvkm/engine/fifo/tu102.c | 2 +- .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 30 + 19 files changed, 1079 insertions(+), 6 deletions(-)create mode 100644
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/alloc/alloc_channel.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_channel_nvoc.hcreate mode 100644drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_fifo_nvoc.hcreate mode 100644drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.cdrivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h +13
-0@@ -4,6 +4,7 @@#include <core/engine.h> #include <core/object.h> #include <core/event.h> +#include <subdev/gsp.h> struct nvkm_fault_data ;#define NVKM_FIFO_ENGN_NR 16@@ -35,6 +36,14 @@ struct nvkm_chan {atomic_t blocked;atomic_t errored; +struct { +struct nvkm_gsp_object object; +struct { +dma_addr_t addr; +void *ptr; + } mthdbuf; + } rm; +struct list_head cctxs;struct list_head head; };@@ -71,6 +80,10 @@ struct nvkm_fifo {struct list_head list; } userd; +struct { +u32 mthdbuf_size; + } rm; +spinlock_t lock;struct mutex mutex; };drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/alloc/alloc_channel.h new file +161
-0@@ -0,0 +1,161 @@ +#ifndef __src_common_sdk_nvidia_inc_alloc_alloc_channel_h__ +#define __src_common_sdk_nvidia_inc_alloc_alloc_channel_h__ +#include <nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h> + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NV_MEMORY_DESC_PARAMS { + NV_DECLARE_ALIGNED(NvU64 base, 8); + NV_DECLARE_ALIGNED(NvU64 size, 8); +NvU32 addressSpace; +NvU32 cacheAttrib; +}NV_MEMORY_DESC_PARAMS ; + +#define NVOS04_FLAGS_CHANNEL_TYPE 1:0 +#define NVOS04_FLAGS_CHANNEL_TYPE_PHYSICAL 0x00000000 +#define NVOS04_FLAGS_CHANNEL_TYPE_VIRTUAL 0x00000001 // OBSOLETE +#define NVOS04_FLAGS_CHANNEL_TYPE_PHYSICAL_FOR_VIRTUAL 0x00000002 // OBSOLETE + +#define NVOS04_FLAGS_VPR 2:2 +#define NVOS04_FLAGS_VPR_FALSE 0x00000000 +#define NVOS04_FLAGS_VPR_TRUE 0x00000001 + +#define NVOS04_FLAGS_CC_SECURE 2:2 +#define NVOS04_FLAGS_CC_SECURE_FALSE 0x00000000 +#define NVOS04_FLAGS_CC_SECURE_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_SKIP_MAP_REFCOUNTING 3:3 +#define NVOS04_FLAGS_CHANNEL_SKIP_MAP_REFCOUNTING_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_SKIP_MAP_REFCOUNTING_TRUE 0x00000001 + +#define NVOS04_FLAGS_GROUP_CHANNEL_RUNQUEUE 4:4 +#define NVOS04_FLAGS_GROUP_CHANNEL_RUNQUEUE_DEFAULT 0x00000000 +#define NVOS04_FLAGS_GROUP_CHANNEL_RUNQUEUE_ONE 0x00000001 + +#define NVOS04_FLAGS_PRIVILEGED_CHANNEL 5:5 +#define NVOS04_FLAGS_PRIVILEGED_CHANNEL_FALSE 0x00000000 +#define NVOS04_FLAGS_PRIVILEGED_CHANNEL_TRUE 0x00000001 + +#define NVOS04_FLAGS_DELAY_CHANNEL_SCHEDULING 6:6 +#define NVOS04_FLAGS_DELAY_CHANNEL_SCHEDULING_FALSE 0x00000000 +#define NVOS04_FLAGS_DELAY_CHANNEL_SCHEDULING_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_DENY_PHYSICAL_MODE_CE 7:7 +#define NVOS04_FLAGS_CHANNEL_DENY_PHYSICAL_MODE_CE_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_DENY_PHYSICAL_MODE_CE_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_USERD_INDEX_VALUE 10:8 + +#define NVOS04_FLAGS_CHANNEL_USERD_INDEX_FIXED 11:11 +#define NVOS04_FLAGS_CHANNEL_USERD_INDEX_FIXED_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_USERD_INDEX_FIXED_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_USERD_INDEX_PAGE_VALUE 20:12 + +#define NVOS04_FLAGS_CHANNEL_USERD_INDEX_PAGE_FIXED 21:21 +#define NVOS04_FLAGS_CHANNEL_USERD_INDEX_PAGE_FIXED_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_USERD_INDEX_PAGE_FIXED_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_DENY_AUTH_LEVEL_PRIV 22:22 +#define NVOS04_FLAGS_CHANNEL_DENY_AUTH_LEVEL_PRIV_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_DENY_AUTH_LEVEL_PRIV_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_SKIP_SCRUBBER 23:23 +#define NVOS04_FLAGS_CHANNEL_SKIP_SCRUBBER_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_SKIP_SCRUBBER_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_CLIENT_MAP_FIFO 24:24 +#define NVOS04_FLAGS_CHANNEL_CLIENT_MAP_FIFO_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_CLIENT_MAP_FIFO_TRUE 0x00000001 + +#define NVOS04_FLAGS_SET_EVICT_LAST_CE_PREFETCH_CHANNEL 25:25 +#define NVOS04_FLAGS_SET_EVICT_LAST_CE_PREFETCH_CHANNEL_FALSE 0x00000000 +#define NVOS04_FLAGS_SET_EVICT_LAST_CE_PREFETCH_CHANNEL_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_VGPU_PLUGIN_CONTEXT 26:26 +#define NVOS04_FLAGS_CHANNEL_VGPU_PLUGIN_CONTEXT_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_VGPU_PLUGIN_CONTEXT_TRUE 0x00000001 + +#define NVOS04_FLAGS_CHANNEL_PBDMA_ACQUIRE_TIMEOUT 27:27 +#define NVOS04_FLAGS_CHANNEL_PBDMA_ACQUIRE_TIMEOUT_FALSE 0x00000000 +#define NVOS04_FLAGS_CHANNEL_PBDMA_ACQUIRE_TIMEOUT_TRUE 0x00000001 + +#define NVOS04_FLAGS_GROUP_CHANNEL_THREAD 29:28 +#define NVOS04_FLAGS_GROUP_CHANNEL_THREAD_DEFAULT 0x00000000 +#define NVOS04_FLAGS_GROUP_CHANNEL_THREAD_ONE 0x00000001 +#define NVOS04_FLAGS_GROUP_CHANNEL_THREAD_TWO 0x00000002 + +#define NVOS04_FLAGS_MAP_CHANNEL 30:30 +#define NVOS04_FLAGS_MAP_CHANNEL_FALSE 0x00000000 +#define NVOS04_FLAGS_MAP_CHANNEL_TRUE 0x00000001 + +#define NVOS04_FLAGS_SKIP_CTXBUFFER_ALLOC 31:31 +#define NVOS04_FLAGS_SKIP_CTXBUFFER_ALLOC_FALSE 0x00000000 +#define NVOS04_FLAGS_SKIP_CTXBUFFER_ALLOC_TRUE 0x00000001 + +typedef struct NV_CHANNEL_ALLOC_PARAMS { + +NvHandle hObjectError;// error context DMA +NvHandle hObjectBuffer;// no longer used + NV_DECLARE_ALIGNED(NvU64 gpFifoOffset, 8); // offset to beginning of GP FIFO +NvU32 gpFifoEntries;// number of GP FIFO entries + +NvU32 flags; + + +NvHandle hContextShare;// context share handle +NvHandle hVASpace;// VASpace for the channel + +// handle to UserD memory object for channel, ignored if hUserdMemory[0]=0 +NvHandle hUserdMemory[NV_MAX_SUBDEVICES ]; + +// offset to beginning of UserD within hUserdMemory[x] + NV_DECLARE_ALIGNED(NvU64 userdOffset[NV_MAX_SUBDEVICES], 8); + +// engine type(NV2080_ENGINE_TYPE_*) with which this channel is associated +NvU32 engineType; +// Channel identifier that is unique for the duration of a RM session +NvU32 cid; +// One-hot encoded bitmask to match SET_SUBDEVICE_MASK methods +NvU32 subDeviceId; +NvHandle hObjectEccError;// ECC error context DMA + + NV_DECLARE_ALIGNED(NV_MEMORY_DESC_PARAMS instanceMem, 8); + NV_DECLARE_ALIGNED(NV_MEMORY_DESC_PARAMS userdMem, 8); + NV_DECLARE_ALIGNED(NV_MEMORY_DESC_PARAMS ramfcMem, 8); + NV_DECLARE_ALIGNED(NV_MEMORY_DESC_PARAMS mthdbufMem, 8); + +NvHandle hPhysChannelGroup;// reserved +NvU32 internalFlags;// reserved + NV_DECLARE_ALIGNED(NV_MEMORY_DESC_PARAMS errorNotifierMem, 8); // reserved + NV_DECLARE_ALIGNED(NV_MEMORY_DESC_PARAMS eccErrorNotifierMem, 8); // reserved +NvU32 ProcessID;// reserved +NvU32 SubProcessID;// reserved +}NV_CHANNEL_ALLOC_PARAMS ; + +typedef NV_CHANNEL_ALLOC_PARAMS NV_CHANNELGPFIFO_ALLOCATION_PARAMETERS ; + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080_notification.h +20
-0@@ -30,6 +30,26 @@#define NV2080_NOTIFIERS_DP_IRQ (7) +#define NV2080_ENGINE_TYPE_GRAPHICS (0x00000001) +#define NV2080_ENGINE_TYPE_GR0 NV2080_ENGINE_TYPE_GRAPHICS + +#define NV2080_ENGINE_TYPE_COPY0 (0x00000009) + +#define NV2080_ENGINE_TYPE_BSP (0x00000013) +#define NV2080_ENGINE_TYPE_NVDEC0 NV2080_ENGINE_TYPE_BSP + +#define NV2080_ENGINE_TYPE_MSENC (0x0000001b) +#define NV2080_ENGINE_TYPE_NVENC0 NV2080_ENGINE_TYPE_MSENC/* Mutually exclusive alias */ + +#define NV2080_ENGINE_TYPE_SW (0x00000022) + +#define NV2080_ENGINE_TYPE_SEC2 (0x00000026) + +#define NV2080_ENGINE_TYPE_NVJPG (0x0000002b) +#define NV2080_ENGINE_TYPE_NVJPEG0 NV2080_ENGINE_TYPE_NVJPG + +#define NV2080_ENGINE_TYPE_OFA (0x00000033) + typedef struct { NvU32 plugDisplayMask; NvU32 unplugDisplayMask;drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.h new file +35
-0@@ -0,0 +1,35 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080ce_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080ce_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2014-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS { +NvU32 size; +}NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS ; + +#define NV2080_CTRL_CMD_CE_GET_FAULT_METHOD_BUFFER_SIZE (0x20802a08)/* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_CE_INTERFACE_ID << 8) | NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS_MESSAGE_ID" */ + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.h new file +52
-0@@ -0,0 +1,52 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080fifo_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrl2080_ctrl2080fifo_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2006-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NV2080_CTRL_CMD_FIFO_GET_DEVICE_INFO_TABLE (0x20801112)/* finn: Evaluated from "(FINN_NV20_SUBDEVICE_0_FIFO_INTERFACE_ID << 8) | NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_PARAMS_MESSAGE_ID" */ + +#define NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_MAX_ENTRIES 32 +#define NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_ENGINE_DATA_TYPES 16 +#define NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_ENGINE_MAX_PBDMA 2 +#define NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_ENGINE_MAX_NAME_LEN 16 + +typedef struct NV2080_CTRL_FIFO_DEVICE_ENTRY { +NvU32 engineData[NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_ENGINE_DATA_TYPES ]; +NvU32 pbdmaIds[NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_ENGINE_MAX_PBDMA ]; +NvU32 pbdmaFaultIds[NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_ENGINE_MAX_PBDMA ]; +NvU32 numPbdmas; +char engineName[NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_ENGINE_MAX_NAME_LEN ]; +}NV2080_CTRL_FIFO_DEVICE_ENTRY ; + +typedef struct NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_PARAMS { +NvU32 baseIndex; +NvU32 numEntries; +NvBool bMore; +// C form: NV2080_CTRL_FIFO_DEVICE_ENTRY entries[NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_MAX_ENTRIES]; +NV2080_CTRL_FIFO_DEVICE_ENTRY entries[NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_MAX_ENTRIES ]; +}NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_PARAMS ; + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.h new file +42
-0@@ -0,0 +1,42 @@ +#ifndef __src_common_sdk_nvidia_inc_ctrl_ctrla06f_ctrla06fgpfifo_h__ +#define __src_common_sdk_nvidia_inc_ctrl_ctrla06f_ctrla06fgpfifo_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2007-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +#define NVA06F_CTRL_CMD_GPFIFO_SCHEDULE (0xa06f0103)/* finn: Evaluated from "(FINN_KEPLER_CHANNEL_GPFIFO_A_GPFIFO_INTERFACE_ID << 8) | NVA06F_CTRL_GPFIFO_SCHEDULE_PARAMS_MESSAGE_ID" */ + +typedef struct NVA06F_CTRL_GPFIFO_SCHEDULE_PARAMS { +NvBool bEnable; +NvBool bSkipSubmit; +}NVA06F_CTRL_GPFIFO_SCHEDULE_PARAMS ; + +#define NVA06F_CTRL_CMD_BIND (0xa06f0104)/* finn: Evaluated from "(FINN_KEPLER_CHANNEL_GPFIFO_A_GPFIFO_INTERFACE_ID << 8) | NVA06F_CTRL_BIND_PARAMS_MESSAGE_ID" */ + +typedef struct NVA06F_CTRL_BIND_PARAMS { +NvU32 engineType; +}NVA06F_CTRL_BIND_PARAMS ; + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/nvlimits.h +2
-0@@ -26,6 +26,8 @@* DEALINGS IN THE SOFTWARE. */ +#define NV_MAX_SUBDEVICES 8 +#define NV_PROC_NAME_MAX_LENGTH 100U#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_channel_nvoc.h new file +62
-0@@ -0,0 +1,62 @@ +#ifndef __src_nvidia_generated_g_kernel_channel_nvoc_h__ +#define __src_nvidia_generated_g_kernel_channel_nvoc_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2020-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef enum { +/*! +* Initial state as passed in NV_CHANNEL_ALLOC_PARAMS by +* kernel CPU-RM clients. +*/ +ERROR_NOTIFIER_TYPE_UNKNOWN =0 , +/*! @brief Error notifier is explicitly not set. +* +* The corresponding hErrorContext or hEccErrorContext must be +* NV01_NULL_OBJECT. +*/ +ERROR_NOTIFIER_TYPE_NONE , +/*! @brief Error notifier is a ContextDma */ +ERROR_NOTIFIER_TYPE_CTXDMA , +/*! @brief Error notifier is a NvNotification array in sysmem/vidmem */ +ERROR_NOTIFIER_TYPE_MEMORY +}ErrorNotifierType ; + +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_PRIVILEGE 1:0 +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_PRIVILEGE_USER 0x0 +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_PRIVILEGE_ADMIN 0x1 +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_PRIVILEGE_KERNEL 0x2 +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ERROR_NOTIFIER_TYPE 3:2 +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ERROR_NOTIFIER_TYPE_UNKNOWN ERROR_NOTIFIER_TYPE_UNKNOWN +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ERROR_NOTIFIER_TYPE_NONE ERROR_NOTIFIER_TYPE_NONE +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ERROR_NOTIFIER_TYPE_CTXDMA ERROR_NOTIFIER_TYPE_CTXDMA +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ERROR_NOTIFIER_TYPE_MEMORY ERROR_NOTIFIER_TYPE_MEMORY +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ECC_ERROR_NOTIFIER_TYPE 5:4 +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ECC_ERROR_NOTIFIER_TYPE_UNKNOWN ERROR_NOTIFIER_TYPE_UNKNOWN +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ECC_ERROR_NOTIFIER_TYPE_NONE ERROR_NOTIFIER_TYPE_NONE +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ECC_ERROR_NOTIFIER_TYPE_CTXDMA ERROR_NOTIFIER_TYPE_CTXDMA +#define NV_KERNELCHANNEL_ALLOC_INTERNALFLAGS_ECC_ERROR_NOTIFIER_TYPE_MEMORY ERROR_NOTIFIER_TYPE_MEMORY + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_kernel_fifo_nvoc.h new file +119
-0@@ -0,0 +1,119 @@ +#ifndef __src_nvidia_generated_g_kernel_fifo_nvoc_h__ +#define __src_nvidia_generated_g_kernel_fifo_nvoc_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef enum +{ +/* ************************************************************************* +* Bug 3820969 +* THINK BEFORE CHANGING ENUM ORDER HERE. +* VGPU-guest uses this same ordering. Because this enum is not versioned, +* changing the order here WILL BREAK old-guest-on-newer-host compatibility. +* ************************************************************************/ + +// *ENG_XYZ, e.g.: ENG_GR, ENG_CE etc., +ENGINE_INFO_TYPE_ENG_DESC =0 , + +// HW engine ID +ENGINE_INFO_TYPE_FIFO_TAG , + +// RM_ENGINE_TYPE_* +ENGINE_INFO_TYPE_RM_ENGINE_TYPE , + +// +// runlist id (meaning varies by GPU) +// Valid only for Esched-driven engines +// +ENGINE_INFO_TYPE_RUNLIST , + +// NV_PFIFO_INTR_MMU_FAULT_ENG_ID_* +ENGINE_INFO_TYPE_MMU_FAULT_ID , + +// ROBUST_CHANNEL_* +ENGINE_INFO_TYPE_RC_MASK , + +// Reset Bit Position. On Ampere, only valid if not _INVALID +ENGINE_INFO_TYPE_RESET , + +// Interrupt Bit Position +ENGINE_INFO_TYPE_INTR , + +// log2(MC_ENGINE_*) +ENGINE_INFO_TYPE_MC , + +// The DEV_TYPE_ENUM for this engine +ENGINE_INFO_TYPE_DEV_TYPE_ENUM , + +// The particular instance of this engine type +ENGINE_INFO_TYPE_INSTANCE_ID , + +// +// The base address for this engine's NV_RUNLIST. Valid only on Ampere+ +// Valid only for Esched-driven engines +// +ENGINE_INFO_TYPE_RUNLIST_PRI_BASE , + +// +// If this entry is a host-driven engine. +// Update _isEngineInfoTypeValidForOnlyHostDriven when adding any new entry. +// +ENGINE_INFO_TYPE_IS_HOST_DRIVEN_ENGINE , + +// +// The index into the per-engine NV_RUNLIST registers. Valid only on Ampere+ +// Valid only for Esched-driven engines +// +ENGINE_INFO_TYPE_RUNLIST_ENGINE_ID , + +// +// The base address for this engine's NV_CHRAM registers. Valid only on +// Ampere+ +// +// Valid only for Esched-driven engines +// +ENGINE_INFO_TYPE_CHRAM_PRI_BASE , + +// This entry added to copy data at RMCTRL_EXPORT() call for Kernel RM +ENGINE_INFO_TYPE_KERNEL_RM_MAX , +// Used for iterating the engine info table by the index passed. +ENGINE_INFO_TYPE_INVALID =ENGINE_INFO_TYPE_KERNEL_RM_MAX , + +// Size of FIFO_ENGINE_LIST.engineData +ENGINE_INFO_TYPE_ENGINE_DATA_ARRAY_SIZE =ENGINE_INFO_TYPE_INVALID , + +// Input-only parameter for kfifoEngineInfoXlate. +ENGINE_INFO_TYPE_PBDMA_ID + +/* ************************************************************************* +* Bug 3820969 +* THINK BEFORE CHANGING ENUM ORDER HERE. +* VGPU-guest uses this same ordering. Because this enum is not versioned, +* changing the order here WILL BREAK old-guest-on-newer-host compatibility. +* ************************************************************************/ +}ENGINE_INFO_TYPE ; + +#endif drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/generated/g_rpc-structures.h +9
-0@@ -104,6 +104,15 @@ typedef struct rpc_post_event_v17_00NvU8 eventData[]; } rpc_post_event_v17_00; +typedef struct rpc_rc_triggered_v17_02 +{ +NvU32 nv2080EngineType; +NvU32 chid; +NvU32 exceptType; +NvU32 scope; +NvU16 partitionAttributionId; +}rpc_rc_triggered_v17_02 ; + typedef struct rpc_os_error_log_v17_00 { NvU32 exceptType;drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +5
-0@@ -2760,6 +2760,7 @@ nv192_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };@@ -2779,6 +2780,7 @@ nv193_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };@@ -2798,6 +2800,7 @@ nv194_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };@@ -2817,6 +2820,7 @@ nv196_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };@@ -2836,6 +2840,7 @@ nv197_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, + .fifo = { 0x00000001, ga102_fifo_new }, .sec2 = { 0x00000001, ga102_sec2_new }, };drivers/gpu/drm/nouveau/nvkm/engine/falcon.c +2
-2@@ -318,14 +318,14 @@ nvkm_falcon_init(struct nvkm_engine *engine) }static void * -nvkm_falcon_dtor (struct nvkm_engine *engine) +nvkm_falcon_dtor_engine (struct nvkm_engine *engine) {return nvkm_falcon (engine); }static const struct nvkm_engine_func nvkm_falcon = { - .dtor = nvkm_falcon_dtor, + .dtor = nvkm_falcon_dtor_engine, .oneinit = nvkm_falcon_oneinit, .init = nvkm_falcon_init, .fini = nvkm_falcon_fini,drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild +2
-0@@ -26,5 +26,7 @@ nvkm-y += nvkm/engine/fifo/tu102.o nvkm-y += nvkm/engine/fifo/ga100.o nvkm-y += nvkm/engine/fifo/ga102.o +nvkm-y += nvkm/engine/fifo/r535.o + nvkm-y += nvkm/engine/fifo/ucgrp.o nvkm-y += nvkm/engine/fifo/uchan.odrivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c +1
-1@@ -609,7 +609,7 @@ ga100_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_fifo_new (&ga100_fifo, device, type, inst, pfifo);return nvkm_fifo_new_ (&ga100_fifo, device, type, inst, pfifo); }drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c +2
-2@@ -36,7 +36,7 @@ ga102_fifo = { .engn = &ga100_engn, .engn_ce = &ga100_engn_ce, .cgrp = {{ 0, 0, KEPLER_CHANNEL_GROUP_A }, &ga100_cgrp, .force = true }, - .chan = {{ 0, 0, AMPERE_CHANNEL_GPFIFO_B }, &ga100_chan }, + .chan = {{ 0, 0, AMPERE_CHANNEL_GPFIFO_A }, &ga100_chan }, }; int@@ -44,7 +44,7 @@ ga102_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_fifo_new (&ga102_fifo, device, type, inst, pfifo);return nvkm_fifo_new_ (&ga102_fifo, device, type, inst, pfifo); }drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h +2
-0@@ -60,6 +60,8 @@ struct nvkm_fifo_func { } chan; }; +int r535_fifo_new (const struct nvkm_fifo_func *,struct nvkm_device *,enum nvkm_subdev_type ,int , +struct nvkm_fifo **);int nvkm_fifo_new_ (const struct nvkm_fifo_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,struct nvkm_fifo **);drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +49
-0@@ -0,0 +1,519 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "priv.h" +#include "cgrp.h" +#include "chan.h" +#include "chid.h" +#include "runl.h" + +#include <core/gpuobj.h> +#include <subdev/gsp.h> +#include <subdev/mmu.h> +#include <subdev/vfn.h> + +#include <nvhw/drf.h> + +#include <nvrm/nvtypes.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/alloc/alloc_channel.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/class/cl2080_notification.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080ce.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrl2080/ctrl2080fifo.h> +#include <nvrm/535.54.03/common/sdk/nvidia/inc/ctrl/ctrla06f/ctrla06fgpfifo.h> +#include <nvrm/535.54.03/nvidia/generated/g_kernel_channel_nvoc.h> +#include <nvrm/535.54.03/nvidia/generated/g_kernel_fifo_nvoc.h> +#include <nvrm/535.54.03/nvidia/inc/kernel/gpu/gpu_engine_type.h> + +static u32 +r535_chan_doorbell_handle (struct nvkm_chan *chan) +{ +return (chan->cgrp->runl->id <<16 ) | chan->id; +}
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c line 59
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +10
-0+ +static void +r535_chan_stop (struct nvkm_chan *chan) +{ +} + +static void +r535_chan_start (struct nvkm_chan *chan) +{ +}
Maybe check function pointers instead of creating all those empty functions here and below.
Quoted 99 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +99
-0+ +static void +r535_chan_ramfc_clear (struct nvkm_chan *chan) +{ +struct nvkm_fifo *fifo = chan->cgrp->runl->fifo; + +nvkm_gsp_rm_free (&chan->rm.object); + +dma_free_coherent (fifo->engine.subdev.device->dev, fifo->rm.mthdbuf_size, + chan->rm.mthdbuf.ptr, chan->rm.mthdbuf.addr); +} + +#define CHID_PER_USERD 8 + +static int +r535_chan_ramfc_write (struct nvkm_chan *chan,u64 offset,u64 length,u32 devm,bool priv) +{ +struct nvkm_fifo *fifo = chan->cgrp->runl->fifo; +struct nvkm_engn *engn; +NV_CHANNELGPFIFO_ALLOCATION_PARAMETERS *args; +const int userd_p = chan->id /CHID_PER_USERD ; +const int userd_i = chan->id %CHID_PER_USERD ; +u32 eT = ~0 ; +int ret; + + nvkm_runl_foreach_engn(engn, chan->cgrp->runl) { + eT = engn->id; +break ; + } + +if (WARN_ON (eT == ~0 )) +return -EINVAL ; + + chan->rm.mthdbuf.ptr =dma_alloc_coherent (fifo->engine.subdev.device->dev, + fifo->rm.mthdbuf_size, + &chan->rm.mthdbuf.addr,GFP_KERNEL ); +if (!chan->rm.mthdbuf.ptr) +return -ENOMEM ; + + args =nvkm_gsp_rm_alloc_get (&chan->vmm->rm.device.object,0xf1f00000 | chan->id, + fifo->func->chan.user.oclass,sizeof (*args), + &chan->rm.object); +if (WARN_ON (IS_ERR (args))) +return PTR_ERR (args); + + args->gpFifoOffset = offset; + args->gpFifoEntries = length /8 ; + + args->flags =NVDEF (NVOS04 ,FLAGS ,CHANNEL_TYPE ,PHYSICAL ); + args->flags |=NVDEF (NVOS04 ,FLAGS ,VPR , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_SKIP_MAP_REFCOUNTING , FALSE); + args->flags |=NVVAL (NVOS04 ,FLAGS ,GROUP_CHANNEL_RUNQUEUE , chan->runq); +if (!priv) + args->flags |=NVDEF (NVOS04 ,FLAGS ,PRIVILEGED_CHANNEL , FALSE); +else + args->flags |=NVDEF (NVOS04 ,FLAGS ,PRIVILEGED_CHANNEL , TRUE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,DELAY_CHANNEL_SCHEDULING , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_DENY_PHYSICAL_MODE_CE , FALSE); + + args->flags |=NVVAL (NVOS04 ,FLAGS ,CHANNEL_USERD_INDEX_VALUE , userd_i); + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_USERD_INDEX_FIXED , FALSE); + args->flags |=NVVAL (NVOS04 ,FLAGS ,CHANNEL_USERD_INDEX_PAGE_VALUE , userd_p); + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_USERD_INDEX_PAGE_FIXED , TRUE); + + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_DENY_AUTH_LEVEL_PRIV , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_SKIP_SCRUBBER , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_CLIENT_MAP_FIFO , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,SET_EVICT_LAST_CE_PREFETCH_CHANNEL , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_VGPU_PLUGIN_CONTEXT , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,CHANNEL_PBDMA_ACQUIRE_TIMEOUT , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,GROUP_CHANNEL_THREAD ,DEFAULT ); + args->flags |=NVDEF (NVOS04 ,FLAGS ,MAP_CHANNEL , FALSE); + args->flags |=NVDEF (NVOS04 ,FLAGS ,SKIP_CTXBUFFER_ALLOC , FALSE); + + args->hVASpace = chan->vmm->rm.object.handle; + args->engineType = eT; + + args->instanceMem.base = chan->inst->addr; + args->instanceMem.size = chan->inst->size; + args->instanceMem.addressSpace =2 ; + args->instanceMem.cacheAttrib =1 ; + + args->userdMem.base =nvkm_memory_addr (chan->userd.mem) + chan->userd.base; + args->userdMem.size = fifo->func->chan.func->userd->size; + args->userdMem.addressSpace =2 ; + args->userdMem.cacheAttrib =1 ; + + args->ramfcMem.base = chan->inst->addr +0 ; + args->ramfcMem.size =0x200 ; + args->ramfcMem.addressSpace =2 ; + args->ramfcMem.cacheAttrib =1 ; + + args->mthdbufMem.base = chan->rm.mthdbuf.addr; + args->mthdbufMem.size = fifo->rm.mthdbuf_size; + args->mthdbufMem.addressSpace =1 ; + args->mthdbufMem.cacheAttrib =0 ; + +if (!priv) + args->internalFlags =NVDEF (NV_KERNELCHANNEL ,ALLOC_INTERNALFLAGS ,PRIVILEGE ,USER );
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c line 168
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +10
-0+else + args->internalFlags =NVDEF (NV_KERNELCHANNEL ,ALLOC_INTERNALFLAGS ,PRIVILEGE ,ADMIN ); + args->internalFlags |=NVDEF (NV_KERNELCHANNEL ,ALLOC_INTERNALFLAGS ,ERROR_NOTIFIER_TYPE ,NONE ); + args->internalFlags |=NVDEF (NV_KERNELCHANNEL ,ALLOC_INTERNALFLAGS ,ECC_ERROR_NOTIFIER_TYPE ,NONE ); + + ret =nvkm_gsp_rm_alloc_wr (&chan->rm.object, args); +if (ret) +return ret; + +if (1 ) {
Leftover from some experiments? Which ones? Or do we need actual conditions here for some cases?
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c line 171
Quoted 3 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +3
-0+NVA06F_CTRL_GPFIFO_SCHEDULE_PARAMS *ctrl; + +if (1 ) {
Same here.
Quoted 107 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +107
-0+NVA06F_CTRL_BIND_PARAMS *ctrl; + + ctrl =nvkm_gsp_rm_ctrl_get (&chan->rm.object, +NVA06F_CTRL_CMD_BIND ,sizeof (*ctrl)); +if (WARN_ON (IS_ERR (ctrl))) +return PTR_ERR (ctrl); + + ctrl->engineType = eT; + + ret =nvkm_gsp_rm_ctrl_wr (&chan->rm.object, ctrl); +if (ret) +return ret; + } + + ctrl =nvkm_gsp_rm_ctrl_get (&chan->rm.object, +NVA06F_CTRL_CMD_GPFIFO_SCHEDULE ,sizeof (*ctrl)); +if (WARN_ON (IS_ERR (ctrl))) +return PTR_ERR (ctrl); + + ctrl->bEnable =1 ; + ret =nvkm_gsp_rm_ctrl_wr (&chan->rm.object, ctrl); + } + +return ret; +} + +static const struct nvkm_chan_func_ramfc +r535_chan_ramfc = { + .write = r535_chan_ramfc_write, + .clear = r535_chan_ramfc_clear, + .devm =0xfff , + .priv = true, +}; + +struct r535_chan_userd { +struct nvkm_memory *mem; +struct nvkm_memory *map; +int chid; +u32 used; + +struct list_head head; +} *userd; + +static void +r535_chan_id_put (struct nvkm_chan *chan) +{ +struct nvkm_runl *runl = chan->cgrp->runl; +struct nvkm_fifo *fifo = runl->fifo; +struct r535_chan_userd *userd; + +mutex_lock (&fifo->userd.mutex); +list_for_each_entry (userd, &fifo->userd.list, head) { +if (userd->map == chan->userd.mem) { +u32 chid = chan->userd.base / chan->func->userd->size; + + userd->used &= ~BIT (chid); +if (!userd->used) { +nvkm_memory_unref (&userd->map); +nvkm_memory_unref (&userd->mem); +nvkm_chid_put (runl->chid, userd->chid, &chan->cgrp->lock); +list_del (&userd->head); + } + +break ; + } + } +mutex_unlock (&fifo->userd.mutex); + +} + +static int +r535_chan_id_get_locked (struct nvkm_chan *chan,struct nvkm_memory *muserd,u64 ouserd) +{ +const u32 userd_size =CHID_PER_USERD * chan->func->userd->size; +struct nvkm_runl *runl = chan->cgrp->runl; +struct nvkm_fifo *fifo = runl->fifo; +struct r535_chan_userd *userd; +u32 chid; +int ret; + +if (ouserd + chan->func->userd->size >= userd_size || + (ouserd & (chan->func->userd->size -1 ))) { +RUNL_DEBUG (runl,"ouserd %llx" , ouserd); +return -EINVAL ; + } + + chid = ouserd / chan->func->userd->size; + +list_for_each_entry (userd, &fifo->userd.list, head) { +if (userd->mem == muserd) { +if (userd->used &BIT (chid)) +return -EBUSY ; +break ; + } + } + +if (&userd->head == &fifo->userd.list) { +if (nvkm_memory_size (muserd) < userd_size) { +RUNL_DEBUG (runl,"userd too small" ); +return -EINVAL ; + } + + userd =kzalloc (sizeof (*userd),GFP_KERNEL ); +if (!userd) +return -ENOMEM ; + + userd->chid =nvkm_chid_get (runl->chid, chan);
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c line 288
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +10
-0+if (userd->chid <0 ) { + ret = userd->chid; +kfree (userd); +return ret; + } + + userd->mem =nvkm_memory_ref (muserd); + + ret =nvkm_memory_kmap (userd->mem, &userd->map); +if (ret) {
Don't we need to nvkm_memory_unref(userd->mem) here?
Quoted 145 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +145
-0+nvkm_chid_put (runl->chid, userd->chid, &chan->cgrp->lock); +kfree (userd); +return ret; + } + + +list_add (&userd->head, &fifo->userd.list); + } + + userd->used |=BIT (chid); + + chan->userd.mem =nvkm_memory_ref (userd->map); + chan->userd.base = ouserd; + +return (userd->chid *CHID_PER_USERD ) + chid; +} + +static int +r535_chan_id_get (struct nvkm_chan *chan,struct nvkm_memory *muserd,u64 ouserd) +{ +struct nvkm_fifo *fifo = chan->cgrp->runl->fifo; +int ret; + +mutex_lock (&fifo->userd.mutex); + ret =r535_chan_id_get_locked (chan, muserd, ouserd); +mutex_unlock (&fifo->userd.mutex); +return ret; +} + +static const struct nvkm_chan_func +r535_chan = { + .id_get = r535_chan_id_get, + .id_put = r535_chan_id_put, + .inst = &gf100_chan_inst, + .userd = &gv100_chan_userd, + .ramfc = &r535_chan_ramfc, + .start = r535_chan_start, + .stop = r535_chan_stop, + .doorbell_handle = r535_chan_doorbell_handle, +}; + +static const struct nvkm_cgrp_func +r535_cgrp = { +}; + +static void +r535_runl_allow (struct nvkm_runl *runl,u32 engm) +{ +} + +static void +r535_runl_block (struct nvkm_runl *runl,u32 engm) +{ +} + +static const struct nvkm_runl_func +r535_runl = { + .block = r535_runl_block, + .allow = r535_runl_allow, +}; + +static int +r535_fifo_2080_type (enum nvkm_subdev_type type,int inst) +{ +switch (type) { +case NVKM_ENGINE_GR :return NV2080_ENGINE_TYPE_GR0 ; +case NVKM_ENGINE_CE :return NV2080_ENGINE_TYPE_COPY0 + inst; +case NVKM_ENGINE_SEC2 :return NV2080_ENGINE_TYPE_SEC2 ; +case NVKM_ENGINE_NVDEC :return NV2080_ENGINE_TYPE_NVDEC0 + inst; +case NVKM_ENGINE_NVENC :return NV2080_ENGINE_TYPE_NVENC0 + inst; +case NVKM_ENGINE_NVJPG :return NV2080_ENGINE_TYPE_NVJPEG0 + inst; +case NVKM_ENGINE_OFA :return NV2080_ENGINE_TYPE_OFA ; +case NVKM_ENGINE_SW :return NV2080_ENGINE_TYPE_SW ; +default : +break ; + } + +WARN_ON (1 ); +return -EINVAL ; +} + +static int +r535_fifo_engn_type (RM_ENGINE_TYPE rm,enum nvkm_subdev_type *ptype) +{ +switch (rm) { +case RM_ENGINE_TYPE_GR0 : + *ptype =NVKM_ENGINE_GR ; +return 0 ; + case RM_ENGINE_TYPE_COPY0...RM_ENGINE_TYPE_COPY9: + *ptype =NVKM_ENGINE_CE ; +return rm -RM_ENGINE_TYPE_COPY0 ; + case RM_ENGINE_TYPE_NVDEC0...RM_ENGINE_TYPE_NVDEC7: + *ptype =NVKM_ENGINE_NVDEC ; +return rm -RM_ENGINE_TYPE_NVDEC0 ; + case RM_ENGINE_TYPE_NVENC0...RM_ENGINE_TYPE_NVENC2: + *ptype =NVKM_ENGINE_NVENC ; +return rm -RM_ENGINE_TYPE_NVENC0 ; +case RM_ENGINE_TYPE_SW : + *ptype =NVKM_ENGINE_SW ; +return 0 ; +case RM_ENGINE_TYPE_SEC2 : + *ptype =NVKM_ENGINE_SEC2 ; +return 0 ; + case RM_ENGINE_TYPE_NVJPEG0...RM_ENGINE_TYPE_NVJPEG7: + *ptype =NVKM_ENGINE_NVJPG ; +return rm -RM_ENGINE_TYPE_NVJPEG0 ; +case RM_ENGINE_TYPE_OFA : + *ptype =NVKM_ENGINE_OFA ; +return 0 ; +default : +return -EINVAL ; + } +} + +static int +r535_fifo_runl_ctor (struct nvkm_fifo *fifo) +{ +struct nvkm_subdev *subdev = &fifo->engine.subdev; +struct nvkm_gsp *gsp = subdev->device->gsp; +struct nvkm_runl *runl; +struct nvkm_engn *engn; +u32 cgids =2048 ; +u32 chids =2048 /CHID_PER_USERD ; +int ret; +NV2080_CTRL_FIFO_GET_DEVICE_INFO_TABLE_PARAMS *ctrl; + +if ((ret =nvkm_chid_new (&nvkm_chan_event, subdev, cgids,0 , cgids, &fifo->cgid)) || + (ret =nvkm_chid_new (&nvkm_chan_event, subdev, chids,0 , chids, &fifo->chid))) +return ret; + + ctrl =nvkm_gsp_rm_ctrl_rd (&gsp->internal.device.subdevice, +NV2080_CTRL_CMD_FIFO_GET_DEVICE_INFO_TABLE ,sizeof (*ctrl)); +if (WARN_ON (IS_ERR (ctrl))) +return PTR_ERR (ctrl); + +for (int i =0 ; i < ctrl->numEntries; i++) { +const u32 addr = ctrl->entries[i].engineData[ENGINE_INFO_TYPE_RUNLIST_PRI_BASE ]; +const u32 id = ctrl->entries[i].engineData[ENGINE_INFO_TYPE_RUNLIST ]; + + runl =nvkm_runl_get (fifo, id, addr); +if (!runl) { + runl =nvkm_runl_new (fifo, id, addr,0 ); +if (WARN_ON (IS_ERR (runl))) +continue ; + }
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c line 443
Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +10
-0+ } + +for (int i =0 ; i < ctrl->numEntries; i++) { +const u32 addr = ctrl->entries[i].engineData[ENGINE_INFO_TYPE_RUNLIST_PRI_BASE ]; +const u32 rmid = ctrl->entries[i].engineData[ENGINE_INFO_TYPE_RM_ENGINE_TYPE ]; +const u32 id = ctrl->entries[i].engineData[ENGINE_INFO_TYPE_RUNLIST ]; +enum nvkm_subdev_type type; +int inst, nv2080; + + runl =nvkm_runl_get (fifo, id, addr);
We should fix how get() and put() suffixes are used, it makes it hard to understand the code and spot memory leaks.
Quoted 144 lines
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c new file +76
-0+if (!runl) +continue ; + + inst =r535_fifo_engn_type (rmid, &type); +if (inst <0 ) { +nvkm_warn (subdev,"RM_ENGINE_TYPE 0x%x\n" , rmid); +nvkm_runl_del (runl); +continue ; + } + + nv2080 =r535_fifo_2080_type (type, inst); +if (nv2080 <0 ) { +nvkm_runl_del (runl); +continue ; + } + +switch (type) { +case NVKM_ENGINE_SW : +continue ; +default : + engn =NULL ; +break ; + } + +if (!engn) { +nvkm_runl_del (runl); +continue ; + } + } + +nvkm_gsp_rm_ctrl_done (&gsp->internal.device.subdevice, ctrl); + + { +NV2080_CTRL_CE_GET_FAULT_METHOD_BUFFER_SIZE_PARAMS *ctrl; + + ctrl =nvkm_gsp_rm_ctrl_rd (&gsp->internal.device.subdevice, +NV2080_CTRL_CMD_CE_GET_FAULT_METHOD_BUFFER_SIZE , +sizeof (*ctrl)); +if (IS_ERR (ctrl)) +return PTR_ERR (ctrl); + + fifo->rm.mthdbuf_size = ctrl->size; + +nvkm_gsp_rm_ctrl_done (&gsp->internal.device.subdevice, ctrl); + } + +return 0 ; +} + +static void +r535_fifo_dtor (struct nvkm_fifo *fifo) +{ +kfree (fifo->func); +} + +int +r535_fifo_new (const struct nvkm_fifo_func *hw,struct nvkm_device *device, +enum nvkm_subdev_type type,int inst,struct nvkm_fifo **pfifo) +{ +struct nvkm_fifo_func *rm; + +if (!(rm =kzalloc (sizeof (*rm),GFP_KERNEL ))) +return -ENOMEM ; + + rm->dtor = r535_fifo_dtor; + rm->runl_ctor = r535_fifo_runl_ctor; + rm->runl = &r535_runl; + rm->cgrp = hw->cgrp; + rm->cgrp.func = &r535_cgrp; + rm->chan = hw->chan; + rm->chan.func = &r535_chan; + rm->nonstall = &ga100_fifo_nonstall; + rm->nonstall_ctor = ga100_fifo_nonstall_ctor; + +return nvkm_fifo_new_ (rm, device, type, inst, pfifo); +}drivers/gpu/drm/nouveau/nvkm/engine/fifo/tu102.c +1
-1@@ -284,7 +284,7 @@ tu102_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_fifo_new (&tu102_fifo, device, type, inst, pfifo);return nvkm_fifo_new_ (&tu102_fifo, device, type, inst, pfifo); }drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +30
-0@@ -24,6 +24,7 @@#include <core/pci.h> #include <subdev/timer.h> #include <subdev/vfn.h> +#include <engine/fifo/chan.h> #include <engine/sec2.h> #include <nvfw/fw.h> @@ -1226,6 +1227,33 @@ r535_gsp_msg_os_error_log(void *priv, u32 fn, void *repv, u32 repc)return 0 ; } +static int +r535_gsp_msg_rc_triggered (void *priv,u32 fn,void *repv,u32 repc) +{ +rpc_rc_triggered_v17_02 *msg = repv; +struct nvkm_gsp *gsp = priv; +struct nvkm_subdev *subdev = &gsp->subdev; +struct nvkm_chan *chan; +unsigned long flags; + +if (WARN_ON (repc <sizeof (*msg))) +return -EINVAL ; + +nvkm_error (subdev,"rc engn:%08x chid:%d type:%d scope:%d part:%d\n" , + msg->nv2080EngineType, msg->chid, msg->exceptType, msg->scope, + msg->partitionAttributionId); + + chan =nvkm_chan_get_chid (&subdev->device->fifo->engine, msg->chid /8 , &flags); +if (!chan) { +nvkm_error (subdev,"rc chid:%d not found!\n" , msg->chid); +return 0 ; + } + +nvkm_chan_error (chan, false); +nvkm_chan_put (&chan, flags); +return 0 ; +} +static int r535_gsp_msg_mmu_fault_queued (void *priv,u32 fn,void *repv,u32 repc) {@@ -2001,6 +2029,8 @@ r535_gsp_oneinit(struct nvkm_gsp *gsp)r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_GSP_RUN_CPU_SEQUENCER , r535_gsp_msg_run_cpu_sequencer, gsp);r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_POST_EVENT , r535_gsp_msg_post_event, gsp); +r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_RC_TRIGGERED , + r535_gsp_msg_rc_triggered, gsp);r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_MMU_FAULT_QUEUED , r535_gsp_msg_mmu_fault_queued, gsp);r535_gsp_msg_ntfy_add (gsp,NV_VGPU_MSG_EVENT_OS_ERROR_LOG , r535_gsp_msg_os_error_log, gsp);
PATCH 39/44 drm/nouveau/ce/r535: initial support
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
Adds support for allocating DMA_COPY classes from RM.
--- .../drm/nouveau/include/nvkm/engine/fifo.h | 2 + .../common/sdk/nvidia/inc/class/clc0b5sw.h | 34 ++++++ .../nvidia/inc/kernel/gpu/intr/engine_idx.h | 4 + drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild | 2 + .../gpu/drm/nouveau/nvkm/engine/ce/ga100.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/ce/ga102.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h | 3 + drivers/gpu/drm/nouveau/nvkm/engine/ce/r535.c | 108 ++++++++++++++++++ .../gpu/drm/nouveau/nvkm/engine/ce/tu102.c | 2 +- .../gpu/drm/nouveau/nvkm/engine/device/base.c | 5 + .../gpu/drm/nouveau/nvkm/engine/fifo/r535.c | 19 +++ .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c | 9 ++ .../gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 4 + 13 files changed, 193 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/clc0b5sw.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/engine/ce/r535.c
drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h +2 -0
@@ -52,6 +52,8 @@ struct nvkm_chan *nvkm_chan_get_chid(struct nvkm_engine *, int id, unsigned longstruct nvkm_chan *nvkm_chan_get_inst (struct nvkm_engine *,u64 inst,unsigned long *irqflags);void nvkm_chan_put (struct nvkm_chan **,unsigned long irqflags); +struct nvkm_chan *nvkm_uchan_chan (struct nvkm_object *); +struct nvkm_fifo {const struct nvkm_fifo_func *func;struct nvkm_engine engine;
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/common/sdk/nvidia/inc/class/clc0b5sw.h new file +34 -0
@@ -0,0 +1,34 @@ +#ifndef __src_common_sdk_nvidia_inc_class_clc0b5sw_h__ +#define __src_common_sdk_nvidia_inc_class_clc0b5sw_h__ + +/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */ + +/* +* SPDX-FileCopyrightText: Copyright (c) 2014-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* SPDX-License-Identifier: MIT +* +* 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. +*/ + +typedef struct NVC0B5_ALLOCATION_PARAMETERS { +NvU32 version; +NvU32 engineType; +}NVC0B5_ALLOCATION_PARAMETERS ; + +#endif
drivers/gpu/drm/nouveau/include/nvrm/535.54.03/nvidia/inc/kernel/gpu/intr/engine_idx.h +4 -0
@@ -28,6 +28,10 @@#define MC_ENGINE_IDX_DISP 2 +#define MC_ENGINE_IDX_CE0 15 + +#define MC_ENGINE_IDX_CE9 24 +#define MC_ENGINE_IDX_GSP 49#endif
drivers/gpu/drm/nouveau/nvkm/engine/ce/Kbuild +2 -0
@@ -10,3 +10,5 @@ nvkm-y += nvkm/engine/ce/gv100.o nvkm-y += nvkm/engine/ce/tu102.o nvkm-y += nvkm/engine/ce/ga100.o nvkm-y += nvkm/engine/ce/ga102.o + +nvkm-y += nvkm/engine/ce/r535.o
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga100.c +1 -1
@@ -90,7 +90,7 @@ ga100_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_ce_new (&ga100_ce, device, type, inst, pengine);return nvkm_engine_new_ (&ga100_ce, device, type, inst, true, pengine); }
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga102.c +1 -1
@@ -44,7 +44,7 @@ ga102_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_ce_new (&ga102_ce, device, type, inst, pengine);return nvkm_engine_new_ (&ga102_ce, device, type, inst, true, pengine); }
drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h +3 -0
@@ -3,6 +3,9 @@#define __NVKM_CE_PRIV_H__#include <engine/ce.h> +int r535_ce_new (const struct nvkm_engine_func *,struct nvkm_device *, +enum nvkm_subdev_type ,int ,struct nvkm_engine **); +void gt215_ce_intr (struct nvkm_falcon *,struct nvkm_chan *);void gk104_ce_intr (struct nvkm_engine *);void gp100_ce_intr (struct nvkm_engine *);
drivers/gpu/drm/nouveau/nvkm/engine/ce/r535.c new file +108 -0
108 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/engine/ce/tu102.c +1 -1
@@ -40,7 +40,7 @@ tu102_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine) {if (nvkm_gsp_rm (device->gsp)) -return -ENODEV ; +return r535_ce_new (&tu102_ce, device, type, inst, pengine);return nvkm_engine_new_ (&tu102_ce, device, type, inst, true, pengine); }
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +5 -0
@@ -2758,6 +2758,7 @@ nv192_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .ce = { 0x0000001f, ga102_ce_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new },
@@ -2778,6 +2779,7 @@ nv193_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .ce = { 0x0000001f, ga102_ce_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new },
@@ -2798,6 +2800,7 @@ nv194_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .ce = { 0x0000001f, ga102_ce_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new },
@@ -2818,6 +2821,7 @@ nv196_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .ce = { 0x0000001f, ga102_ce_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new },
@@ -2838,6 +2842,7 @@ nv197_chipset = { .pci = { 0x00000001, gp100_pci_new }, .timer = { 0x00000001, gk20a_timer_new }, .vfn = { 0x00000001, ga100_vfn_new }, + .ce = { 0x0000001f, ga102_ce_new }, .disp = { 0x00000001, ad102_disp_new }, .dma = { 0x00000001, gv100_dma_new }, .fifo = { 0x00000001, ga102_fifo_new },
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c +19 -0
@@ -331,6 +331,22 @@ static const struct nvkm_cgrp_func r535_cgrp = { }; +static int +r535_engn_nonstall (struct nvkm_engn *engn) +{ +struct nvkm_subdev *subdev = &engn->engine->subdev; +int ret; + + ret =nvkm_gsp_intr_nonstall (subdev->device->gsp, subdev->type, subdev->inst); +WARN_ON (ret <0 ); +return ret; +} + +static const struct nvkm_engn_func +r535_ce = { + .nonstall = r535_engn_nonstall, +}; +static void r535_runl_allow (struct nvkm_runl *runl,u32 engm) {
@@ -458,6 +474,9 @@ r535_fifo_runl_ctor(struct nvkm_fifo *fifo) }switch (type) { +case NVKM_ENGINE_CE : + engn =nvkm_runl_add (runl, nv2080, &r535_ce, type, inst); +break ;case NVKM_ENGINE_SW :continue ;default :
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +9 -0
@@ -317,6 +317,15 @@ nvkm_uchan = { .uevent = nvkm_uchan_uevent, }; +struct nvkm_chan * +nvkm_uchan_chan (struct nvkm_object *object) +{ +if (WARN_ON (object->func != &nvkm_uchan)) +return NULL ; + +return nvkm_uchan (object)->chan; +} +int nvkm_uchan_new (struct nvkm_fifo *fifo,struct nvkm_cgrp *cgrp,const struct nvkm_oclass *oclass,void *argv,u32 argc,struct nvkm_object **pobject)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +4 -0
@@ -851,6 +851,10 @@ r535_gsp_intr_get_table(struct nvkm_gsp *gsp) type =NVKM_ENGINE_DISP ; inst =0 ;break ; + case MC_ENGINE_IDX_CE0 ... MC_ENGINE_IDX_CE9: + type =NVKM_ENGINE_CE ; + inst = ctrl->table[i].engineIdx -MC_ENGINE_IDX_CE0 ; +break ;default :continue ; }
Signature · 1 line
2.41.0