Commit Graph

5317 Commits

Author SHA1 Message Date
Ben Skeggs
ea13e5abf8 drm/nouveau: signal pending fences when channel has been killed
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-29 15:49:47 +10:00
Ben Skeggs
0181f4bfbd drm/nouveau: reject attempts to submit to dead channels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-29 15:49:47 +10:00
Ben Skeggs
4c9ee1bfca drm/nouveau: zero vma pointer even if we only unreference it rather than free
I'm not sure this affects anything, but best be safe.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-29 15:49:46 +10:00
Takashi Iwai
742db30c4e drm/nouveau: Add HD-audio component notifier support
This patch adds the support for the notification of HD-audio hotplug
via the already existing drm_audio_component framework.  This allows
us more reliable hotplug notification and ELD transfer without
accessing HD-audio bus; it's more efficient, and more importantly, it
works without waking up the runtime PM.

The implementation is rather simplistic: nouveau driver provides the
get_eld ops for HD-audio, and it notifies the audio hotplug via
pin_eld_notify callback upon each nv50_audio_enable() and _disable()
call.  As the HD-audio pin assignment seems corresponding to the CRTC,
the crtc->index number is passed directly as the zero-based port
number.

The bind and unbind callbacks handle the device-link so that it
assures the PM call order.

Link: https://lore.kernel.org/r/20190722143815.7339-3-tiwai@suse.de
Reviewed-by: Lyude Paul <lyude@redhat.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-29 15:49:46 +10:00
Chen Zhou
ee8642162a drm/nouveau: fix build error without CONFIG_IOMMU_API
If CONFIG_IOMMU_API is n, build fails:

vers/gpu/drm/nouveau/nvkm/subdev/ltc/gp10b.c:37:9: error: implicit declaration of function dev_iommu_fwspec_get; did you mean iommu_fwspec_free? [-Werror=implicit-function-declaration]
  spec = dev_iommu_fwspec_get(device->dev);
         ^~~~~~~~~~~~~~~~~~~~
         iommu_fwspec_free
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gp10b.c:37:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  spec = dev_iommu_fwspec_get(device->dev);
       ^
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gp10b.c:39:17: error: struct iommu_fwspec has no member named ids
   u32 sid = spec->ids[0] & 0xffff;

Seletc IOMMU_API under config DRM_NOUVEAU to fix this.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-23 08:56:51 +10:00
YueHaibing
67d52f0f13 drm/nouveau/kms/nv04: remove set but not used variable 'width'
drivers/gpu/drm/nouveau/dispnv04/arb.c: In function nv04_calc_arb:
drivers/gpu/drm/nouveau/dispnv04/arb.c:56:21: warning:
 variable width set but not used [-Wunused-but-set-variable]

'width' is never used, 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-23 08:56:51 +10:00
YueHaibing
39496368ba drm/nouveau/kms/nv50: remove set but not unused variable 'nv_connector'
drivers/gpu/drm/nouveau/dispnv50/disp.c: In function nv50_pior_enable:
drivers/gpu/drm/nouveau/dispnv50/disp.c:1672:28: warning:
 variable nv_connector set but not used [-Wunused-but-set-variable]

commit ac2d9275f3 ("drm/nouveau/kms/nv50-: Store the
bpc we're using in nv50_head_atom") left behind this.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-23 08:56:51 +10:00
Ben Skeggs
35e4909b6a drm/nouveau/mmu: fix comptag memory leak
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-23 08:56:51 +10:00
Thierry Reding
90e2e96ea3 drm/nouveau/gr/gp10b: Use gp100_grctx and gp100_gr_zbc
gp10b doesn't have all the registers that gp102_gr_zbc wants to access,
which causes IBUS MMIO faults to occur. Avoid this by using the gp100
variants of grctx and gr_zbc.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-23 08:56:51 +10:00
Thierry Reding
89b34254bb drm/nouveau/pmu/gm20b,gp10b: Fix Falcon bootstrapping
The low-level Falcon bootstrapping callbacks are expected to return 0 on
success or a negative error code on failure. However, the implementation
on Tegra returns the ID or mask of the Falcons that were bootstrapped on
success, thus breaking the calling code, which treats this as failure.

Fix this by making sure we only return 0 or a negative error code, just
like the code for discrete GPUs does.

Fixes: 86ce2a7153 ("drm/nouveau/flcn/cmdq: move command generation to subdevs")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-23 08:56:51 +10:00
Ben Skeggs
afa3b96b05 drm/nouveau/gr/tu10x: initial support
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:30 +10:00
Ben Skeggs
3fa8fe1572 drm/nouveau/acr/tu10x: initial support
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:30 +10:00
Ben Skeggs
edec7149cb drm/nouveau/core: remove previous versioned fw loader
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:30 +10:00
Ben Skeggs
9d350c5e51 drm/nouveau/secboot: remove
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:30 +10:00
Ben Skeggs
22dcda45a3 drm/nouveau/acr: implement new subdev to replace "secure boot"
ACR is responsible for managing the firmware for LS (Low Secure) falcons,
this was previously handled in the driver by SECBOOT.

This rewrite started from some test code that attempted to replicate the
procedure RM uses in order to debug early Turing ACR firmwares that were
provided by NVIDIA for development.

Compared with SECBOOT, the code is structured into more individual steps,
with the aim of making the process easier to follow/debug, whilst making
it possible to support newer firmware versions that may have a different
binary format or API interface.

The HS (High Secure) binary(s) are now booted earlier in device init, to
match the behaviour of RM, whereas SECBOOT would delay this until we try
to boot the first LS falcon.

There's also additional debugging features available, with the intention
of making it easier to solve issues during FW/HW bring-up in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
ebe52a58ac drm/nouveau/fb/gp102-: unlock VPR as part of FB init
We perform memory allocations long before we hit the code in SECBOOT that
would unlock the VPR, which could potentially result in memory allocation
within the locked region.

Run the scrubber binary right after VRAM init to ensure we don't.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
ff213b6348 drm/nouveau/core/memory: add macros to read/write blocks from objects
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
7a4dde711b drm/nouveau/secboot: move code to boot LS falcons to subdevs
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
91a4e83a2d drm/nouveau/flcn/msgq: rename msgq-related nvkm_msgqueue_queue to nvkm_falcon_msgq
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
e1cc579898 drm/nouveau/flcn/msgq: pass explicit message queue pointer to recv()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
d114a1393f drm/nouveau/flcn/msgq: move handling of init message to subdevs
When the PMU/SEC2 LS FWs have booted, they'll send a message to the host
with various information, including the configuration of message/command
queues that are available.

Move the handling for this to the relevant subdevs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
2d063981d7 drm/nouveau/flcn/msgq: drop nvkm_msgqueue argument to functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
77b1ab61fd drm/nouveau/flcn/msgq: switch to falcon queue printk macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
e9602a1bd7 drm/nouveau/flcn/msgq: simplify msg_queue_pop() error handling
We always want at least requested size, make anything less a more direct
error condition.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
f09a3ee36b drm/nouveau/flcn/msgq: remove error handling for msg_queue_open(), it can't fail
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
86ce2a7153 drm/nouveau/flcn/cmdq: move command generation to subdevs
This moves the code to generate commands for the ACR unit of the PMU/SEC2 LS
firmwares to those subdevs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
25fd061cc7 drm/nouveau/flcn/cmdq: rename cmdq-related nvkm_msqqueue_queue to nvkm_falcon_cmdq
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
149745252c drm/nouveau/flcn/cmdq: implement a more explicit send() interface
Takes the command queue pointer directly instead of requiring a function to
lookup based on an queue type, as well as an explicit timeout value.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
2b287aebb4 drm/nouveau/flcn/cmdq: drop nvkm_msgqueue argument to functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:29 +10:00
Ben Skeggs
baafecbf9a drm/nouveau/flcn/cmdq: switch to falcon queue printk macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
c2c9b24318 drm/nouveau/flcn/cmdq: cmd_queue_close always commits, simplify it
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
2baaffff97 drm/nouveau/flcn/cmdq: cmd_queue_push can't fail, remove error handling for it
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
2e8a65973b drm/nouveau/flcn/cmdq: split the condition for queue readiness vs pmu acr readiness
This is to allow for proper separation of the LS interface code from the
queue handling code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
a15d8f580c drm/nouveau/flcn/qmgr: rename remaining nvkm_msgqueue bits to nvkm_falcon_qmgr
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
8e90a98dfb drm/nouveau/flcn/qmgr: support syncronous command submission from common code
Functions implementing FW commands had to implement this themselves, let's
move that to common code and plumb the return code from callbacks through.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
c80157a25e drm/nouveau/flcn/qmgr: allow arbtrary priv + return code for callbacks
Code to interface with LS firmwares is being moved to the subdevs where it
belongs, rather than living in the common falcon code.

Arbitrary private data passed to callbacks is to allow for something other
than struct nvkm_msgqueue to be passed into the callback (like the pointer
to the subdev itself, for example), and the return code will be used where
we'd like to detect failure from synchronous messages.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
0ae59432ba drm/nouveau/flcn/qmgr: move sequence tracking from nvkm_msgqueue to nvkm_falcon_qmgr
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
22431189d6 drm/nouveau/flcn/msgq: explicitly create message queue from subdevs
Code to interface with LS firmwares is being moved to the subdevs where it
belongs, rather than living in the common falcon code.

This is an incremental step towards that goal.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
acc466ab46 drm/nouveau/flcn/cmdq: explicitly create command queue(s) from subdevs
Code to interface with LS firmwares is being moved to the subdevs where it
belongs, rather than living in the common falcon code.

This is an incremental step towards that goal.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
8763955ba7 drm/nouveau/flcn/qmgr: explicitly create queue manager from subdevs
Code to interface with LS firmwares is being moved to the subdevs where it
belongs, rather than living in the common falcon code.

This is an incremental step towards that goal.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
7e1659cc3b drm/nouveau/flcn: split msgqueue into multiple pieces
To make things clearer while modifying the interfaces, split msgqueue into
Queue Manager, Command Queue, and Message Queue.

There should be no code changes here, these will be done incrementally.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
3d0482ec28 drm/nouveau/flcn: add printk macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
af696a61a2 drm/nouveau/flcn: reset sec2/gsp falcons harder
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
b826f48a1c drm/nouveau/flcn: specify queue register offsets from subdev
Also fixes the values for Turing, even though we don't use it yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
e938c4e723 drm/nouveau/flcn: specify debug/production register offset from subdev
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:28 +10:00
Ben Skeggs
bc3cfd18ac drm/nouveau/flcn: specify EMEM address from subdev
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
ca3190e3c7 drm/nouveau/flcn: move bind_context WAR out of common code
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
fb0a5bbe31 drm/nouveau/flcn: specify FBIF offset from subdev
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
10e43bfd2f drm/nouveau/nvenc: add a stub implementation for the GPUs where it should be supported
Mostly so we don't lose info hidden in falcon.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00
Ben Skeggs
a5482b9ff1 drm/nouveau/nvdec/gm107-: add missing engine instances
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2020-01-15 10:50:27 +10:00