Commit Graph

5264 Commits

Author SHA1 Message Date
Ben Skeggs
c9af47bcbd drm/nouveau/sec2: move interrupt handler to hw-specific module
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
555a0002d3 drm/nouveau/sec2: use falcon funcs
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
edd757d178 drm/nouveau/sec2: initialise SW state for falcon from constructor
This will allow us to register the falcon with ACR, and further customise
its behaviour by providing the nvkm_falcon_func structure directly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
7adc40c593 drm/nouveau/sec2: select implementation based on available firmware
This will allow for further customisation of the subdev depending on what
firmware is available.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
e14e5e6c33 drm/nouveau/sec2/gp108: split from gp102 implementation
ACR LS FW loading is moving out of SECBOOT and into their specific subdevs,
and the available GP108/GV100 FWs differ from the other GP10x boards.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
4f556362a3 drm/nouveau/gr/gf100-: initialise SW state for falcon from constructor
This will allow us to register the falcon with ACR, and further customise
its behaviour by providing the nvkm_falcon_func structure directly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
ef16dc278e drm/nouveau/gr/gf100-: select implementation based on available FW
This will allow for further customisation of the subdev depending on what
firmware is available.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
a096ff1981 drm/nouveau/gr/gp108: split from gp107
ACR LS FW loading is moving out of SECBOOT and into their specific subdevs,
and the available GP107/GP108 FWs have interface differences.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
00e1b5dcf7 drm/nouveau/gr/gf100-: move fecs/gpccs ucode into their substructures
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
0033f15b44 drm/nouveau/gr/gf100-: drop fuc_ prefix on sw init
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
a2bfb50e72 drm/nouveau/gr/gk20a,gm200-: use nvkm_firmware_load_blob for sw init
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
6f0add0ad6 drm/nouveau/gr/gf100-: use nvkm_blob structure for fecs/gpccs fw
It serves the exact same purpose.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
2952a2b42e drm/nouveau/pmu: initialise SW state for falcon from constructor
This will allow us to register the falcon with ACR, and further customise
its behaviour by providing the nvkm_falcon_func structure directly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
989863d7cb drm/nouveau/pmu: select implementation based on available firmware
This will allow for further customisation of the subdev depending on what
firmware is available.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
e905736c6d drm/nouveau/pmu/gp10b: split from gm20b implementation
ACR LS FW loading is moving out of SECBOOT and into their specific subdevs,
and the available GM20B/GP10B FWs have interface differences.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
334815ef31 drm/nouveau/gsp: initialise SW state for falcon from constructor
This will allow us to register the falcon with ACR, and further customise
its behaviour by providing the nvkm_falcon_func structure directly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
78b10b7403 drm/nouveau/gsp: select implementation based on available firmware
This will allow for further customisation of the subdev depending on what
firmware is available.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
c63fe2e704 drm/nouveau/acr: add loaders for currently available LS firmware images
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
67e7c6cf8f drm/nouveau/acr: add stub implementation for all GPUs currently supported by SECBOOT
PMU, SEC2 and GR will be modified to register their falcons with ACR before
the main commit switching everything over.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
31bef57f6c drm/nouveau/core: define ACR subdev
This will replace the current SECBOOT subdev for handling firmware on
secure falcons.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
f25709f9ae drm/nouveau/core: add representation of generic binary objects
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
47c8f8e1a2 drm/nouveau/core: add a macro to better handle multiple firmware versions
Will be used in upcoming commits to allow subdevs to better customise
themselves based on which (if any) firmware is available.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
5ff41544fc drm/nouveau/core: output fw size in debug messages
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
a128bbfacc drm/nouveau/flcn: export existing funcs
These will be used in upcoming commits which will provide more customisation.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
de04819213 drm/nouveau/flcn: fetch PRI address from TOP if not provided by constructor
Shortcut to avoid each subdev having to do this itself.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:26 +10:00
Ben Skeggs
5a4b98cde4 drm/nouveau/flcn: move fetching of configuration until first use
We want to be able to register falcons with ACR during the constructor for
the subdev it belongs to, however, we may not have access to the falcon's
registers prior to DEVINIT.

Delay touching registers until the first time the falcon is acquired.

This may temporarily break secboot on non-production boards due to not
being able to determine whether the falcon is in debug or production mode,
the new ACR subdev will not have this issue, and it's not a use-case that's
terribly important for bisectability.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
Ben Skeggs
633cc9beeb drm/nouveau/fault/gv100-: fix memory leak on module unload
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
Ben Skeggs
409d659fe1 drm/nouveau/disp/dp: fix typo when determining failsafe link configuration
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
YueHaibing
2e4534a227 drm/nouveau/drm/ttm: Remove set but not used variable 'mem'
drivers/gpu/drm/nouveau/nouveau_ttm.c: In function nouveau_vram_manager_new:
drivers/gpu/drm/nouveau/nouveau_ttm.c:66:22: warning: variable mem set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/nouveau/nouveau_ttm.c: In function nouveau_gart_manager_new:
drivers/gpu/drm/nouveau/nouveau_ttm.c:106:22: warning: variable mem set but not used [-Wunused-but-set-variable]

They are not used any more, so remove it.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
YueHaibing
1eb013473b drm/nouveau: Fix copy-paste error in nouveau_fence_wait_uevent_handler
Like other cases, it should use rcu protected 'chan' rather
than 'fence->channel' in nouveau_fence_wait_uevent_handler.

Fixes: 0ec5f02f0e ("drm/nouveau: prevent stale fence->channel pointers, and protect with rcu")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
Ben Skeggs
3c47e381d6 drm/nouveau/gr/gv100-: modify gr init to match newer version of RM
Will be used as a basis for implementing changes needed for Turing.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
Ben Skeggs
7adc77aa0e drm/nouveau/gr/gk20a,gm200-: add terminators to method lists read from fw
Method init is typically ordered by class in the FW image as ThreeD,
TwoD, Compute.

Due to a bug in parsing the FW into our internal format, we've been
accidentally sending Twod + Compute methods to the ThreeD class, as
well as Compute methods to the TwoD class - oops.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
Ben Skeggs
fef1c0ef70 drm/nouveau/gr/gf100-: remove dtor
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
Ben Skeggs
0514a6b7d9 drm/nouveau/fault/tu102: define nvkm_fault_func.pin
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
Ben Skeggs
4886c740c9 drm/nouveau/core: fix missing newline in fw loader error message
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:25 +10:00
Dan Carpenter
3613a9bea9 drm/nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new()
We accidentally set "psb" which is a no-op instead of "*psb" so it
generates a static checker warning.  We should probably set it before
the first error return so that it's always initialized.

Fixes: 923f1bd27b ("drm/nouveau/secboot/gm20b: add secure boot support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
James Jones
176ada03e3 drm/nouveau/mmu: Add correct turing page kinds
Turing introduced a new simplified page kind
scheme, reducing the number of possible page
kinds from 256 to 16.  It also is the first
NVIDIA GPU in which the highest possible page
kind value is not reserved as an "invalid" page
kind.

To address this, the invalid page kind is made
an explicit property of the MMU HAL, and a new
table of page kinds is added to the tu102 MMU
HAL.

One hardware change not addressed here is that
0x00 is technically no longer a supported page
kind, and pitch surfaces are instead intended to
share the block-linear generic page kind 0x06.
However, because that will be a rather invasive
change to nouveau and 0x00 still works fine in
practice on Turing hardware, addressing this new
behavior is deferred.

Signed-off-by: James Jones <jajones@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
James Jones
72ecb0a6ce drm/nouveau: Fix ttm move init with multiple GPUs
The pointer used to walk the table of move ops
and pick the right one for the current GPU was
declared static, meaning its state was carried
over between invocations of the function, and also
made the function non-rentrant and thread-unsafe.
Since the table is ordered such that newer GPU
methods are listed first, the result of this was
that initializing newer GPUs after older GPUs
would result in no suitable ttm move acceleration
operations being found, and ttm would fall back
to CPU blits on the older GPUs.

This change declares the walking pointer
separately from the table and makes it non-static
to fix the logic.

Signed-off-by: James Jones <jajones@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
Wambui Karuga
b4229fc67d drm/nouveau: use NULL for pointer assignment.
Replace the use of 0 in the pointer assignment with NULL to address the
following sparse warning:
drivers/gpu/drm/nouveau/nouveau_hwmon.c:744:29: warning: Using plain integer as NULL pointer

Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
Wambui Karuga
cd04e4ffd5 drm/nouveau/kms/nv04: remove set but unused variable.
The local variable `pclks` is defined and set but not used and can
therefore be removed.
Issue found by coccinelle.

Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
Wambui Karuga
2cf3c8bc47 drm/nouveau/fb/gf100-: declare constants as unsigned long long.
Explicitly declare constants as unsigned long long to address the
following sparse warnings:
warning: constant is so big it is long

v2: convert to unsigned long long for compatibility with 32-bit
architectures.

Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Suggested by: lia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
YueHaibing
2574c809d7 drm/nouveau/kms/nv04-nv4x: Use match_string() helper to simplify the code
match_string() returns the array index of a matching string.
Use it instead of the open-coded implementation.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
Thierry Reding
d7ca5ddf58 drm/nouveau/ce/gp10b: Use correct copy engine
gp10b uses the new engine enumeration mechanism introduced in the Pascal
architecture. As a result, the copy engine, which used to be at index 2
for prior Tegra GPU instantiations, has now moved to index 0. Fix up the
index and also use the gp100 variant of the copy engine class because on
gp10b the PASCAL_DMA_COPY_B class is not supported.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
Thierry Reding
0d0d498265 drm/nouveau/ltc/gp10b: Add custom L2 cache implementation
There are extra registers that need to be programmed to make the level 2
cache work on GP10B, such as the stream ID register that is used when an
SMMU is used to translate memory addresses.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
Thierry Reding
6992ceb8c0 drm/nouveau/secboot/gm20b,gp10b: Read WPR configuration from GPU registers
The GPUs found on Tegra SoCs have registers that can be used to read the
WPR configuration. Use these registers instead of reaching into the
memory controller's register space to read the same information.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
Thierry Reding
fc12262b96 drm/nouveau/tegra: Set clock rate if not set
If the GPU clock has not had a rate set, initialize it to the maximum
clock rate to make sure it does run.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:59 +10:00
Thierry Reding
b0b651aedb drm/nouveau/tegra: Avoid pulsing reset twice
When the GPU powergate is controlled by a generic power domain provider,
the reset will automatically be asserted and deasserted as part of the
power-ungating procedure.

On some Jetson TX2 boards, doing an additional assert and deassert of
the GPU outside of the power-ungate procedure can cause the GPU to go
into a bad state where the memory interface can no longer access system
memory.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:58 +10:00
Thierry Reding
f1331ea8ee drm/nouveau: Do not try to disable PCI device on Tegra
When Nouveau is instantiated on top of a platform device, the dev->pdev
field will be NULL and calling pci_disable_device() will crash. Move the
PCI disabling code to the PCI specific driver removal code.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:58 +10:00
Thierry Reding
0ac7facb70 drm/nouveau/fault: Add support for GP10B
There is no BAR2 on GP10B and there is no need to map through BAR2
because all memory is shared between the GPU and the CPU. Add a custom
implementation of the fault sub-device that uses nvkm_memory_addr()
instead of nvkm_memory_bar2() to return the address of a pinned fault
buffer.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:58 +10:00
Colin Ian King
f42e4b337b drm/nouveau/nouveau: fix incorrect sizeof on args.src an args.dst
The sizeof is currently on args.src and args.dst and should be on
*args.src and *args.dst. Fortunately these sizes just so happen
to be the same size so it worked, however, this should be fixed
and it also cleans up static analysis warnings

Addresses-Coverity: ("sizeof not portable")
Fixes: f268307ec7 ("nouveau: simplify nouveau_dmem_migrate_vma")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:49:58 +10:00