platform/kernel/linux-starfive.git
7 years agolib/Kconfig: make PRIME_NUMBERS not user selectable.
Dave Airlie [Fri, 24 Feb 2017 02:11:21 +0000 (12:11 +1000)]
lib/Kconfig: make PRIME_NUMBERS not user selectable.

Linus doesn't like it user selectable, so kill it until
someone needs it for something else.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm/tinydrm: helpers: Properly fix backlight dependency
Noralf Trønnes [Thu, 23 Feb 2017 13:29:57 +0000 (14:29 +0100)]
drm/tinydrm: helpers: Properly fix backlight dependency

BACKLIGHT_CLASS_DEVICE was selected in the last version of the
tinydrm patchset to fix the backlight dependency, but the
ifdef CONFIG_BACKLIGHT_CLASS_DEVICE was forgotten. Fix that.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm/tinydrm: mipi-dbi: Fix field width specifier warning
Noralf Trønnes [Thu, 23 Feb 2017 13:29:56 +0000 (14:29 +0100)]
drm/tinydrm: mipi-dbi: Fix field width specifier warning

This warning is seen on 64-bit builds in functions:
   'mipi_dbi_typec1_command':
   'mipi_dbi_typec3_command_read':
   'mipi_dbi_typec3_command':

>> drivers/gpu/drm/tinydrm/mipi-dbi.c:65:20: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]
      DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, len, data); \
                       ^
   include/drm/drmP.h:228:40: note: in definition of macro 'DRM_DEBUG_DRIVER'
     drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
                                           ^~~
>> drivers/gpu/drm/tinydrm/mipi-dbi.c:671:2: note: in expansion of macro 'MIPI_DBI_DEBUG_COMMAND'
     MIPI_DBI_DEBUG_COMMAND(cmd, parameters, num);
     ^~~~~~~~~~~~~~~~~~~~~~

Fix by casting 'len' to int in the macro MIPI_DBI_DEBUG_COMMAND().
There is no chance of overflow.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized
Noralf Trønnes [Thu, 23 Feb 2017 13:29:55 +0000 (14:29 +0100)]
drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized

Fix this warning:
drivers/gpu/drm/tinydrm/mipi-dbi.c: In function ‘mipi_dbi_debugfs_command_write’:
drivers/gpu/drm/tinydrm/mipi-dbi.c:905:8: warning: ‘cmd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = mipi_dbi_command_buf(mipi, cmd, parameters, i);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cmd can't be used uninitialized, but to satisfy the compiler,
initialize it to zero.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoMerge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 23 Feb 2017 22:35:23 +0000 (08:35 +1000)]
Merge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux into drm-next

Some ttm/amd fixes.

* 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux:
  drm/amd/powerplay: fix PSI feature on Polars12.
  drm/amdgpu: refuse to reserve io mem for split VRAM buffers
  drm/ttm: fix use-after-free races in vm fault handling
  drm/amd/amdgpu: post card if there is real hw resetting performed

7 years agoMerge tag 'drm/panel/for-4.11-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Thu, 23 Feb 2017 22:29:03 +0000 (08:29 +1000)]
Merge tag 'drm/panel/for-4.11-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/panel: Changes for v4.11-rc1

This set contains a couple of cleanups as well as support for a few more
simple panels.

* tag 'drm/panel/for-4.11-rc1' of git://anongit.freedesktop.org/tegra/linux:
  drm/panel: simple: Specify bus width and flags for EDT displays
  drm/panel: simple: Add Netron DY E231732
  of: Add vendor prefix for Netron DY
  drm/panel: simple: Add support for Tianma TM070JDHG30
  of: Add vendor prefix for Tianma Micro-electronics
  drm/panel: simple: Add support BOE NV101WXMN51
  dt-bindings: display: Add BOE NV101WXMN51 panel binding
  drm/panel: Constify device node argument to of_drm_find_panel()

7 years agoMerge tag 'drm/tegra/for-4.11-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Thu, 23 Feb 2017 22:26:48 +0000 (08:26 +1000)]
Merge tag 'drm/tegra/for-4.11-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v4.11-rc1

Just a single change that hooks up the Tegra DRM parent device to the
correct device tree node.

* tag 'drm/tegra/for-4.11-rc1' of git://anongit.freedesktop.org/tegra/linux:
  gpu: host1x: Set OF node for new host1x devices

7 years agodrm/sti: fix build warnings in sti_drv.c and sti_vtg.c files
Vincent Abriou [Mon, 20 Feb 2017 11:55:10 +0000 (12:55 +0100)]
drm/sti: fix build warnings in sti_drv.c and sti_vtg.c files

Fix compilation warning introduced by:
commit 0c7ff84f7f9d ("drm/sti: remove deprecated legacy vtg slave")
commit 5e60f595d6ca ("drm/sti: use atomic_helper for commit")

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoMerge tag 'imx-drm-fixes-2017-02-17' of https://git.pengutronix.de/git/pza/linux...
Dave Airlie [Thu, 23 Feb 2017 02:10:42 +0000 (12:10 +1000)]
Merge tag 'imx-drm-fixes-2017-02-17' of https://git.pengutronix.de/git/pza/linux into drm-next

imx-drm: TVE regulator, fb size limit, and ipu-v3 module fixes

- Fix i.MX5 TV encoder probing in case no dac-supply regulator
  is set in the device tree.
- Remove 64 pixel min_width/height limit, which unnecessarily
  prohibits creation of small frame buffers.
- Add missing ipu_csi_set_downsize export, for media drivers
  built as modules.
- Stop modifying pdev->dev.of_node for IPU client devices that
  do not have an OF modalias to fix module autoloading.

* tag 'imx-drm-fixes-2017-02-17' of https://git.pengutronix.de/git/pza/linux:
  gpu: ipu-v3: Stop overwriting pdev->dev.of_node of child devices
  gpu: ipu-v3: export ipu_csi_set_downsize
  drm/imx: lift 64x64 pixel minimum framebuffer size requirement
  drm/imx: imx-tve: Do not set the regulator voltage

7 years agoMerge tag 'v4.10-rc8' into drm-next
Dave Airlie [Thu, 23 Feb 2017 02:10:12 +0000 (12:10 +1000)]
Merge tag 'v4.10-rc8' into drm-next

Linux 4.10-rc8

Backmerge Linus rc8 to fix some conflicts, but also
to avoid pulling it in via a fixes pull from someone.

7 years agoMerge tag 'drm-tinydrm-2017-02-18' of https://github.com/notro/linux into drm-next
Dave Airlie [Thu, 23 Feb 2017 01:05:54 +0000 (11:05 +1000)]
Merge tag 'drm-tinydrm-2017-02-18' of https://github.com/notro/linux into drm-next

Add tinydrm

* tag 'drm-tinydrm-2017-02-18' of https://github.com/notro/linux:
  drm/tinydrm: Add support for Multi-Inno MI0283QT display
  dt-bindings: Add Multi-Inno MI0283QT binding
  dt-bindings: display/panel: Add common rotation property
  of: Add vendor prefix for Multi-Inno
  drm/tinydrm: Add MIPI DBI support
  drm/tinydrm: Add helper functions
  drm: Add DRM support for tiny LCD displays

7 years agodrm/amd/powerplay: fix PSI feature on Polars12.
Rex Zhu [Wed, 15 Feb 2017 07:48:40 +0000 (15:48 +0800)]
drm/amd/powerplay: fix PSI feature on Polars12.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: refuse to reserve io mem for split VRAM buffers
Nicolai Hähnle [Thu, 16 Feb 2017 22:49:12 +0000 (23:49 +0100)]
drm/amdgpu: refuse to reserve io mem for split VRAM buffers

When the fast blit path fails while attempting to move a buffer from RAM
to VRAM, we fall back to a CPU-based memcpy that cannot handle split VRAM
buffers. Instead of crashing, simply fail the buffer move.

Ideally, we would teach TTM about split buffers so that the fallback still
works in this case, but that is quite involved. So for now, apply the
simplest possible fix.

Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: fix use-after-free races in vm fault handling
Nicolai Hähnle [Sat, 18 Feb 2017 21:59:56 +0000 (22:59 +0100)]
drm/ttm: fix use-after-free races in vm fault handling

The vm fault handler relies on the fact that the VMA owns a reference
to the BO. However, once mmap_sem is released, other tasks are free to
destroy the VMA, which can lead to the BO being freed. Fix two code
paths where that can happen, both related to vm fault retries.

Found via a lock debugging warning which flagged &bo->wu_mutex as
locked while being destroyed.

Fixes: cbe12e74ee4e ("drm/ttm: Allow vm fault retries")
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/tinydrm: Add support for Multi-Inno MI0283QT display
Noralf Trønnes [Sun, 22 Jan 2017 14:23:48 +0000 (15:23 +0100)]
drm/tinydrm: Add support for Multi-Inno MI0283QT display

Add driver to support the Multi-Inno MI0283QT display panel.
It has an ILI9341 MIPI DBI compatible display controller.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Thierry Reding <treding@nvidia.com>
7 years agodt-bindings: Add Multi-Inno MI0283QT binding
Noralf Trønnes [Sun, 22 Jan 2017 14:02:26 +0000 (15:02 +0100)]
dt-bindings: Add Multi-Inno MI0283QT binding

Add device-tree binding documentation for the MI0283QT display panel.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Rob Herring <robh@kernel.org>
7 years agodt-bindings: display/panel: Add common rotation property
Noralf Trønnes [Tue, 31 Jan 2017 15:05:57 +0000 (16:05 +0100)]
dt-bindings: display/panel: Add common rotation property

Display panels can be oriented many ways, especially in the embedded
world. The rotation property is a way to describe this orientation.
The counter clockwise direction is chosen because that's what fbdev
and drm use.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Rob Herring <robh@kernel.org>
7 years agoof: Add vendor prefix for Multi-Inno
Noralf Trønnes [Sun, 22 Jan 2017 13:58:49 +0000 (14:58 +0100)]
of: Add vendor prefix for Multi-Inno

Multi-Inno Technology Co.,Ltd is a Hong Kong based company offering
LCD, LCD module products and complete panel solutions.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Rob Herring <robh@kernel.org>
7 years agodrm/tinydrm: Add MIPI DBI support
Noralf Trønnes [Sat, 21 Jan 2017 23:30:47 +0000 (00:30 +0100)]
drm/tinydrm: Add MIPI DBI support

Add support for MIPI DBI compatible controllers.
Interface type C option 1 and 3 are supported (SPI).

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Thierry Reding <treding@nvidia.com>
7 years agodrm/tinydrm: Add helper functions
Noralf Trønnes [Sat, 21 Jan 2017 23:19:51 +0000 (00:19 +0100)]
drm/tinydrm: Add helper functions

Add common functionality needed by many tinydrm drivers.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thierry Reding <treding@nvidia.com>
7 years agodrm: Add DRM support for tiny LCD displays
Noralf Trønnes [Sat, 21 Jan 2017 23:15:00 +0000 (00:15 +0100)]
drm: Add DRM support for tiny LCD displays

tinydrm provides helpers for very simple displays that can use
CMA backed framebuffers and need flushing on changes.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thierry Reding <treding@nvidia.com>
7 years agodrm/amd/amdgpu: post card if there is real hw resetting performed
Jim Qu [Fri, 10 Feb 2017 07:59:59 +0000 (15:59 +0800)]
drm/amd/amdgpu: post card if there is real hw resetting performed

Check whether we need to post rather than whether the asic is
posted.  There are some cases (e.g., GPU reset or resume from
hibernate) where we need to force post even if the asic has
been posted.

Signed-off-by: Jim Qu <Jim.Qu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoMerge tag 'drm-intel-next-fixes-2017-02-17' of git://anongit.freedesktop.org/git...
Dave Airlie [Fri, 17 Feb 2017 20:35:25 +0000 (06:35 +1000)]
Merge tag 'drm-intel-next-fixes-2017-02-17' of git://anongit.freedesktop.org/git/drm-intel into drm-next

i915 and GVT fixes for v4.11 merge window

* tag 'drm-intel-next-fixes-2017-02-17' of git://anongit.freedesktop.org/git/drm-intel: (32 commits)
  drm/i915: Fix not finding the VBT when it overlaps with OPREGION_ASLE_EXT
  drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()
  drm/i915/gvt: Disable access to stolen memory as a guest
  drm/i915: Avoid spurious WARNs about the wrong pipe in the PPS code
  drm/i915: Check for timeout completion when waiting for the rq to submitted
  drm/i915: A hotfix for making aliasing PPGTT work for GVT-g
  drm/i915: Restore context and pd for ringbuffer submission after reset
  drm/i915: Let execlist_update_context() cover !FULL_PPGTT mode.
  drm/i915/lspcon: Fix resume time initialization due to unasserted HPD
  drm/i915/gen9+: Enable hotplug detection early
  drm/i915: Reject set-tiling-ioctl with stride==0 and a tiling mode
  drm/i915: Recreate internal objects with single page segments if dmar fails
  drm/i915/gvt: return error code if dma map iova failed
  drm/i915/gvt: optimize the inhibit context mmio load
  drm/i915/gvt: add sprite plane flip done support.
  drm/i915/gvt: add missing display part reset for vGPU reset
  drm/i915/gvt: Fix shadow context descriptor
  drm/i915/gvt: Fix alignment for GTT allocation
  drm/i915/gvt: fix crash at function release_shadow_wa_ctx
  drm/i915/gvt: enable IOMMU for gvt
  ...

7 years agoMerge branch 'linux-4.11' of git://github.com/skeggsb/linux into drm-next
Dave Airlie [Fri, 17 Feb 2017 07:43:07 +0000 (17:43 +1000)]
Merge branch 'linux-4.11' of git://github.com/skeggsb/linux into drm-next

- Rework of the secure boot code, in preparation for GP10x secure boot.
- Improvements to channel recovery
- Initial power budget code
- Some preparation for an upcoming MMU rework (probably 4.12)
- Misc other fixes.

* 'linux-4.11' of git://github.com/skeggsb/linux: (88 commits)
  drm/nouveau/tmr: provide backtrace when a timeout is hit
  drm/nouveau/pci/g92: Fix rearm
  drm/nouveau/drm/therm/fan: add a fallback if no fan control is specified in the vbios
  drm/nouveau/hwmon: expose power_max and power_crit
  drm/nouveau/iccsense: Parse max and crit power level
  drm/nouveau/bios/power_budget: Add basic power budget parsing
  drm/nouveau/fifo/gk104-: preempt recovery
  drm/nouveau/fifo/gk104-: trigger mmu fault before attempting engine recovery
  drm/nouveau/fifo/gk104-: ACK SCHED_ERROR before attempting CTXSW_TIMEOUT recovery
  drm/nouveau/fifo/gk104-: directly use new recovery code for ctxsw timeout
  drm/nouveau/fifo/gk104-: directly use new recovery code for mmu faults
  drm/nouveau/fifo/gk104-: reset all engines a killed channel is still active on
  drm/nouveau/fifo/gk104-: refactor recovery code
  drm/nouveau/fifo/gk104-: better detection of chid when parsing engine status
  drm/nouveau/fifo/gk104-: separate out engine status parsing
  drm/nouveau/fifo: add an api for initiating channel recovery
  drm/nouveau/top: add function to translate subdev index to mmu fault id
  drm/nouveau/gr/gf100-: implement chsw_load() method
  drm/nouveau/gr: implement chsw_load() method
  drm/nouveau/core: add engine method to assist in determining chsw direction
  ...

7 years agodrm/nouveau/tmr: provide backtrace when a timeout is hit
Ben Skeggs [Fri, 17 Feb 2017 05:08:10 +0000 (15:08 +1000)]
drm/nouveau/tmr: provide backtrace when a timeout is hit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pci/g92: Fix rearm
Karol Herbst [Sat, 11 Feb 2017 11:58:17 +0000 (12:58 +0100)]
drm/nouveau/pci/g92: Fix rearm

704a6c008b7942bb7f30bb43d2a6bcad7f543662 broke pci msi rearm for g92 GPUs.

g92 needs the nv46_pci_msi_rearm, where g94+ gpus used nv40_pci_msi_rearm.

Reported-by: Andrew Randrianasulu <randrianasulu@gmail.com>
Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org
7 years agodrm/nouveau/drm/therm/fan: add a fallback if no fan control is specified in the vbios
Martin Peres [Thu, 29 Sep 2016 00:41:35 +0000 (03:41 +0300)]
drm/nouveau/drm/therm/fan: add a fallback if no fan control is specified in the vbios

This seems to be absolutely necessary for a lot of NV40.

Reported-by: gsgf on IRC/freenode
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/hwmon: expose power_max and power_crit
Karol Herbst [Mon, 23 Jan 2017 22:10:13 +0000 (23:10 +0100)]
drm/nouveau/hwmon: expose power_max and power_crit

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/iccsense: Parse max and crit power level
Karol Herbst [Mon, 23 Jan 2017 22:10:12 +0000 (23:10 +0100)]
drm/nouveau/iccsense: Parse max and crit power level

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/bios/power_budget: Add basic power budget parsing
Karol Herbst [Mon, 23 Jan 2017 22:10:11 +0000 (23:10 +0100)]
drm/nouveau/bios/power_budget: Add basic power budget parsing

v2: Set entry to 0xff if not found
    Add cap entry for ver 0x30 tables
    Rework to fix memory leak
v3: More error checks
    Simplify check for invalid entries
v4: disable for ver 0x10 for now
    move assignments after the second last return

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: preempt recovery
Ben Skeggs [Wed, 18 Jan 2017 08:40:48 +0000 (18:40 +1000)]
drm/nouveau/fifo/gk104-: preempt recovery

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: trigger mmu fault before attempting engine recovery
Ben Skeggs [Wed, 18 Jan 2017 05:37:24 +0000 (15:37 +1000)]
drm/nouveau/fifo/gk104-: trigger mmu fault before attempting engine recovery

Greatly improves the chances of recovering the GPU from a CTXSW_TIMEOUT.

Tested with piglit's arb_shader_image_load_store-atomicity, which causes
GR to hang in such a way that recovery failed (CTXSW_TIMEOUT continually
re-triggers).

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: ACK SCHED_ERROR before attempting CTXSW_TIMEOUT recovery
Ben Skeggs [Wed, 18 Jan 2017 06:05:15 +0000 (16:05 +1000)]
drm/nouveau/fifo/gk104-: ACK SCHED_ERROR before attempting CTXSW_TIMEOUT recovery

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: directly use new recovery code for ctxsw timeout
Ben Skeggs [Wed, 18 Jan 2017 06:03:44 +0000 (16:03 +1000)]
drm/nouveau/fifo/gk104-: directly use new recovery code for ctxsw timeout

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: directly use new recovery code for mmu faults
Ben Skeggs [Wed, 18 Jan 2017 06:01:11 +0000 (16:01 +1000)]
drm/nouveau/fifo/gk104-: directly use new recovery code for mmu faults

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: reset all engines a killed channel is still active on
Ben Skeggs [Wed, 18 Jan 2017 05:35:16 +0000 (15:35 +1000)]
drm/nouveau/fifo/gk104-: reset all engines a killed channel is still active on

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: refactor recovery code
Ben Skeggs [Wed, 18 Jan 2017 05:22:43 +0000 (15:22 +1000)]
drm/nouveau/fifo/gk104-: refactor recovery code

This will serve as a basis for implementing some improvements to how
we recover the GPU from channel errors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: better detection of chid when parsing engine status
Ben Skeggs [Mon, 16 Jan 2017 00:36:00 +0000 (10:36 +1000)]
drm/nouveau/fifo/gk104-: better detection of chid when parsing engine status

The previous commit simply changes the interface, but should result in
the same behaviour as previously.  This commit has been split out from
it as it can result in a different channel being selected.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gk104-: separate out engine status parsing
Ben Skeggs [Mon, 16 Jan 2017 00:14:36 +0000 (10:14 +1000)]
drm/nouveau/fifo/gk104-: separate out engine status parsing

We'll be wanting to reuse this logic in more places.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo: add an api for initiating channel recovery
Ben Skeggs [Thu, 26 Jan 2017 02:10:24 +0000 (12:10 +1000)]
drm/nouveau/fifo: add an api for initiating channel recovery

This will be used by callers outside of fifo interrupt handlers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/top: add function to translate subdev index to mmu fault id
Ben Skeggs [Wed, 18 Jan 2017 04:57:01 +0000 (14:57 +1000)]
drm/nouveau/top: add function to translate subdev index to mmu fault id

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/gf100-: implement chsw_load() method
Ben Skeggs [Mon, 16 Jan 2017 00:28:54 +0000 (10:28 +1000)]
drm/nouveau/gr/gf100-: implement chsw_load() method

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr: implement chsw_load() method
Ben Skeggs [Mon, 16 Jan 2017 00:25:10 +0000 (10:25 +1000)]
drm/nouveau/gr: implement chsw_load() method

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: add engine method to assist in determining chsw direction
Ben Skeggs [Mon, 16 Jan 2017 00:22:59 +0000 (10:22 +1000)]
drm/nouveau/core: add engine method to assist in determining chsw direction

FIFO gives us load/save/switch status, and we need to be able to determine
which direction a "switch" is failing during channel recovery.

In order to do this, we apparently need to query the engine itself.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: check for dead channel before trying to idle
Ben Skeggs [Tue, 24 Jan 2017 06:56:52 +0000 (16:56 +1000)]
drm/nouveau: check for dead channel before trying to idle

This prevents *very* long waits while attempting to destroy channels
after a fault has occurred.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: request notifications for channels that have been killed
Ben Skeggs [Sat, 5 Nov 2016 03:31:25 +0000 (13:31 +1000)]
drm/nouveau: request notifications for channels that have been killed

These will be used to improve error recovery behaviour.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/gf100-: provide notification to user if channel is killed
Ben Skeggs [Sat, 5 Nov 2016 03:05:14 +0000 (13:05 +1000)]
drm/nouveau/fifo/gf100-: provide notification to user if channel is killed

There are instances (such as non-recoverable GPU page faults) where
NVKM decides that a channel's context is no longer viable, and will
be removed from the runlist.

This commit notifies the owner of the channel when this happens, so
it has the opportunity to take some kind of recovery action instead
of hanging.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo/g84-: rename non-stall interrupt event
Ben Skeggs [Tue, 24 Jan 2017 06:08:14 +0000 (16:08 +1000)]
drm/nouveau/fifo/g84-: rename non-stall interrupt event

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fifo: tidy up channel creation event code
Ben Skeggs [Sat, 5 Nov 2016 03:12:57 +0000 (13:12 +1000)]
drm/nouveau/fifo: tidy up channel creation event code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: increase maximum number of notifies that a client can request
Ben Skeggs [Sat, 5 Nov 2016 04:14:20 +0000 (14:14 +1000)]
drm/nouveau/core: increase maximum number of notifies that a client can request

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/drm/nouveau/led: prevent a possible use-after-free
Martin Peres [Wed, 18 Jan 2017 21:49:21 +0000 (23:49 +0200)]
drm/nouveau/drm/nouveau/led: prevent a possible use-after-free

If the led class registration fails, we free drm->led but do not reset
it to NULL, which means that the suspend/resume/fini function will act
as if everything went well in init() and will likely crash the kernel.

This patch adds the missing drm->led = NULL.

Reported-by: Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pci/g92: Enable changing pcie link speeds
Karol Herbst [Sat, 19 Nov 2016 23:43:15 +0000 (00:43 +0100)]
drm/nouveau/pci/g92: Enable changing pcie link speeds

Tested on a G92, seems to work. Confirmed by 8 mmiotraces.

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pci: Rename g94 to g92
Karol Herbst [Sat, 19 Nov 2016 23:43:14 +0000 (00:43 +0100)]
drm/nouveau/pci: Rename g94 to g92

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/devinit/nv50: return error code if pll calculation fails
Ben Skeggs [Mon, 16 Jan 2017 03:44:11 +0000 (13:44 +1000)]
drm/nouveau/devinit/nv50: return error code if pll calculation fails

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: fix bug id typo in comment
Ilia Mirkin [Thu, 5 Jan 2017 06:13:15 +0000 (01:13 -0500)]
drm/nouveau: fix bug id typo in comment

The issue was recorded in fd.o bug 27501, not 25701.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: size is u64 everywhere
Ben Skeggs [Mon, 23 May 2016 02:34:49 +0000 (12:34 +1000)]
drm/nouveau: size is u64 everywhere

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agogpu: ipu-v3: Stop overwriting pdev->dev.of_node of child devices
Philipp Zabel [Thu, 16 Feb 2017 13:46:31 +0000 (14:46 +0100)]
gpu: ipu-v3: Stop overwriting pdev->dev.of_node of child devices

Setting dev->of_node changes the modalias and breaks module autoloading.
Since there is an of_node field in the platform data passed to child
devices, we don't even need this anymore.

Suggested-by: Russell King <linux@armlinux.org.uk>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
7 years agogpu: ipu-v3: export ipu_csi_set_downsize
Philipp Zabel [Thu, 16 Feb 2017 11:36:21 +0000 (12:36 +0100)]
gpu: ipu-v3: export ipu_csi_set_downsize

This function will be used by the media drivers and needs to be exported
to allow them to be built as modules.

Reported-by: Russell King <linux@armlinux.org.uk>
Fixes: 867341b95891 ("gpu: ipu-v3: add ipu_csi_set_downsize")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
7 years agodrm/imx: lift 64x64 pixel minimum framebuffer size requirement
Philipp Zabel [Fri, 27 Jan 2017 10:57:19 +0000 (11:57 +0100)]
drm/imx: lift 64x64 pixel minimum framebuffer size requirement

There is no reason to limit framebuffer size to 64x64 pixels at a
minimum on creation. The actual scanout limitations (width >= 13 for the
base plane and height >= 2) are checked in atomic_check.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
7 years agodrm/imx: imx-tve: Do not set the regulator voltage
Fabio Estevam [Wed, 8 Feb 2017 12:47:49 +0000 (10:47 -0200)]
drm/imx: imx-tve: Do not set the regulator voltage

Commit deb65870b5d9d ("drm/imx: imx-tve: check the value returned by
regulator_set_voltage()") exposes the following probe issue:

63ff0000.tve supply dac not found, using dummy regulator
imx-drm display-subsystem: failed to bind 63ff0000.tve (ops imx_tve_ops): -22

When the 'dac-supply' is not passed in the device tree a dummy regulator is
used and setting its voltage is not allowed.

To fix this issue, do not set the dac-supply voltage inside the driver
and let its voltage be specified in the device tree.

Print a warning if the the 'dac-supply' voltage has a value different
from 2.75V.

Fixes: deb65870b5d9d ("drm/imx: imx-tve: check the value returned by regulator_set_voltage()")
Cc: <stable@vger.kernel.org> # 4.8+
Suggested-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
7 years agodrm/nouveau: s/mem/reg/ for struct ttm_mem_reg variables
Ben Skeggs [Tue, 17 May 2016 01:13:37 +0000 (11:13 +1000)]
drm/nouveau: s/mem/reg/ for struct ttm_mem_reg variables

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: allocate device object for every client
Ben Skeggs [Wed, 18 May 2016 03:57:42 +0000 (13:57 +1000)]
drm/nouveau: allocate device object for every client

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: create userspace clients as subclients
Ben Skeggs [Mon, 23 May 2016 01:25:17 +0000 (11:25 +1000)]
drm/nouveau: create userspace clients as subclients

This will allow the DRM to share memory objects between clients later
down the track.

For the moment, the only immediate benefit is less logic required to
handle suspend/resume.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: tidy up the client init/fini interfaces
Ben Skeggs [Wed, 18 May 2016 03:36:34 +0000 (13:36 +1000)]
drm/nouveau: tidy up the client init/fini interfaces

These were a little insane.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: pass nvif_client to nouveau_gem_new() instead of drm_device
Ben Skeggs [Tue, 24 May 2016 07:29:55 +0000 (17:29 +1000)]
drm/nouveau: pass nvif_client to nouveau_gem_new() instead of drm_device

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau: pass nvif_client to nouveau_bo_new() instead of drm_device
Ben Skeggs [Tue, 24 May 2016 07:26:48 +0000 (17:26 +1000)]
drm/nouveau: pass nvif_client to nouveau_bo_new() instead of drm_device

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/memory: distinguish between coherent/non-coherent targets
Ben Skeggs [Tue, 10 May 2016 02:42:26 +0000 (12:42 +1000)]
drm/nouveau/core/memory: distinguish between coherent/non-coherent targets

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/mm: replace region list with next pointer
Ben Skeggs [Sat, 3 Oct 2015 07:34:25 +0000 (17:34 +1000)]
drm/nouveau/core/mm: replace region list with next pointer

We never have any need for a double-linked list here, and as there's
generally a large number of these objects, replace it with a single-
linked list in order to save some memory.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: allow creation of subclients
Ben Skeggs [Sun, 22 May 2016 10:35:16 +0000 (20:35 +1000)]
drm/nouveau/core/client: allow creation of subclients

We want a supervisor client of NVKM (such as the DRM) to be able to
allow sharing of resources (such as memory objects) between clients.

To allow this, the supervisor creates all its clients as children of
itself, and will use an upcoming ioctl to permit sharing.

Currently it's not possible for indirect clients to use subclients.
Supporting this will require an additional field in the main ioctl.
This isn't important currently, but will need to be fixed for virt.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: pass notification callback to nvkm_client_new
Ben Skeggs [Wed, 25 May 2016 07:08:21 +0000 (17:08 +1000)]
drm/nouveau/core/client: pass notification callback to nvkm_client_new

Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: destroy client objects over nvif
Ben Skeggs [Wed, 25 May 2016 07:02:11 +0000 (17:02 +1000)]
drm/nouveau/core/client: destroy client objects over nvif

Preparation for supporting subclients, and also good for consistency.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: use standard object dtor/init/fini paths
Ben Skeggs [Sun, 22 May 2016 22:42:54 +0000 (08:42 +1000)]
drm/nouveau/core/client: use standard object dtor/init/fini paths

Preparation for supporting subclients, and also good for consistency.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: modify prefix on nvif structures, for consistency
Ben Skeggs [Wed, 25 May 2016 22:43:00 +0000 (08:43 +1000)]
drm/nouveau/core/client: modify prefix on nvif structures, for consistency

Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/object: pass more args in oclass
Ben Skeggs [Wed, 25 May 2016 07:47:18 +0000 (17:47 +1000)]
drm/nouveau/core/object: pass more args in oclass

The fields were already in struct nvkm_oclass for some reason (probably
as an accidental left-over).

Preparation for supporting subclients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/object: pass client directly to ioctl handlers
Ben Skeggs [Wed, 25 May 2016 07:33:36 +0000 (17:33 +1000)]
drm/nouveau/core/object: pass client directly to ioctl handlers

nvkm_object::client refers to the client that created the object, which,
is currently always the same as the ioctl caller.

Upcoming patches introduce the concept of subclients, where a parent is
able to access the object trees of its children, making the above no
longer true.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/dma: lookup objects with nvkm_object_search()
Ben Skeggs [Tue, 17 May 2016 09:40:29 +0000 (19:40 +1000)]
drm/nouveau/dma: lookup objects with nvkm_object_search()

Custom code is no longer needed here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/client: lookup client objects with nvkm_object_search()
Ben Skeggs [Thu, 22 Dec 2016 05:23:04 +0000 (15:23 +1000)]
drm/nouveau/core/client: lookup client objects with nvkm_object_search()

Custom code is no longer needed here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core/object: support lookup of specific object types
Ben Skeggs [Thu, 22 Dec 2016 05:22:25 +0000 (15:22 +1000)]
drm/nouveau/core/object: support lookup of specific object types

It turns out we have a nice and convenient way of looking up a specific
object type already, by using the func pointer as a key.

This will be used to remove the separate object trees for each type we
need to be able to search for.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/dma: use rb_entry()
Geliang Tang [Tue, 20 Dec 2016 14:02:11 +0000 (22:02 +0800)]
drm/nouveau/dma: use rb_entry()

To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agoreplace BUG_ON(1) with BUG()
Ben Skeggs [Thu, 3 Mar 2016 02:56:33 +0000 (12:56 +1000)]
replace BUG_ON(1) with BUG()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/nv50-mcp89: add defines for gr classes
Ben Skeggs [Wed, 21 Dec 2016 02:46:50 +0000 (12:46 +1000)]
drm/nouveau/gr/nv50-mcp89: add defines for gr classes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/gf100-: fix ccache error logging
Ben Skeggs [Thu, 22 Dec 2016 00:07:49 +0000 (10:07 +1000)]
drm/nouveau/gr/gf100-: fix ccache error logging

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/disp/g94: remove unused sor implementation
Ben Skeggs [Thu, 22 Dec 2016 00:07:27 +0000 (10:07 +1000)]
drm/nouveau/disp/g94: remove unused sor implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb/ram/gk104: remove unused best_clk variable
Ben Skeggs [Thu, 22 Dec 2016 00:06:54 +0000 (10:06 +1000)]
drm/nouveau/fb/ram/gk104: remove unused best_clk variable

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: clear halt interrupt after ACR is run
Alexandre Courbot [Wed, 14 Dec 2016 08:02:52 +0000 (17:02 +0900)]
drm/nouveau/secboot: clear halt interrupt after ACR is run

The halt interrupt must be cleared after ACR is run, otherwise the LS
PMU firmware will not be able to run.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add lazy-bootstrap flag
Alexandre Courbot [Wed, 14 Dec 2016 08:02:50 +0000 (17:02 +0900)]
drm/nouveau/secboot: add lazy-bootstrap flag

When the PMU firmware is present, the falcons it manages need to have
the lazy-bootstrap flag of their WPR header set so the ACR does not boot
them. Add support for this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: fix WPR descriptor generation
Alexandre Courbot [Wed, 14 Dec 2016 08:02:49 +0000 (17:02 +0900)]
drm/nouveau/secboot: fix WPR descriptor generation

Generate the WPR descriptor closer to what RM does. In particular, set
the expected masks, and only set the ucode members on Tegra.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: set default error value in error register
Alexandre Courbot [Wed, 14 Dec 2016 08:02:48 +0000 (17:02 +0900)]
drm/nouveau/secboot: set default error value in error register

Set a default error value in the mailbox 0 register so we can catch
cases where the secure boot binary fails early without being able to
report anything.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add missing fields to BL structure
Alexandre Courbot [Wed, 14 Dec 2016 08:02:47 +0000 (17:02 +0900)]
drm/nouveau/secboot: add missing fields to BL structure

Since DMEM was initialized to zero, these fields went unnoticed. Add
them for safety.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: safer zeroing of BL descriptors
Alexandre Courbot [Wed, 14 Dec 2016 08:02:46 +0000 (17:02 +0900)]
drm/nouveau/secboot: safer zeroing of BL descriptors

Perform the zeroing of BL descriptors in the caller function instead of
trusting each generator will do it. This could avoid a few pulled hairs.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: abstract LS firmware loading functions
Alexandre Courbot [Wed, 14 Dec 2016 08:02:45 +0000 (17:02 +0900)]
drm/nouveau/secboot: abstract LS firmware loading functions

The WPR and LSB headers, used to generate the LS blob, may have a
different layout and sizes depending on the driver version they come
from. Abstract them and confine their use to driver-specific code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove ls_ucode_mgr
Alexandre Courbot [Wed, 14 Dec 2016 08:02:44 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove ls_ucode_mgr

This was used only locally to one function and can be replaced by ad-hoc
variables.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove unneeded ls_ucode_img member
Alexandre Courbot [Wed, 14 Dec 2016 08:02:43 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove unneeded ls_ucode_img member

ucode_header is not used anywhere, so just get rid of it.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: disable falcon interrupts when running blob
Alexandre Courbot [Wed, 14 Dec 2016 08:02:42 +0000 (17:02 +0900)]
drm/nouveau/secboot: disable falcon interrupts when running blob

Make sure we are not disturbed by spurious interrupts, as we poll the
halt bit anyway.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: split reset function
Alexandre Courbot [Wed, 14 Dec 2016 08:02:41 +0000 (17:02 +0900)]
drm/nouveau/secboot: split reset function

Split the reset function into more meaningful and reusable ones.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add LS flags to LS func structure
Alexandre Courbot [Wed, 14 Dec 2016 08:02:40 +0000 (17:02 +0900)]
drm/nouveau/secboot: add LS flags to LS func structure

Add a flag that can be set when declaring how a LS firmware should be
loaded. This allows us to remove falcon-specific code in the loader.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: reorganize into more files
Alexandre Courbot [Wed, 14 Dec 2016 08:02:39 +0000 (17:02 +0900)]
drm/nouveau/secboot: reorganize into more files

Split the act of building the ACR blob from firmware files from the rest
of the (chip-dependent) secure boot logic. ACR logic is moved into
acr_rxxx.c files, where rxxx corresponds to the compatible release of
the NVIDIA driver. At the moment r352 and r361 are supported since
firmwares have been released for these versions. Some abstractions are
added on top of r352 so r361 can easily be implemented on top of it by
just overriding a few hooks.

This split makes it possible and easy to reuse the same ACR version on
different chips. It also hopefully makes the code much more readable as
the different secure boot logics are separated. As more chips and
firmware versions will be supported, this is a necessity to not get lost
in code that is already quite complex.

This is a big commit, but it essentially moves things around (and split
the nvkm_secboot structure into two, nvkm_secboot and nvkm_acr). Code
semantics should not be affected.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: generate HS BL descriptor in hook
Alexandre Courbot [Wed, 14 Dec 2016 08:02:38 +0000 (17:02 +0900)]
drm/nouveau/secboot: generate HS BL descriptor in hook

Use the HS hook to completely generate the HS BL descriptor, similarly
to what is done in the LS hook, instead of (arbitrarily) using the
acr_v1 format as an intermediate.

This allows us to make the bootloader descriptor structures private to
each implementation, resulting in a cleaner an more consistent design.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add low-secure firmware hooks
Alexandre Courbot [Wed, 14 Dec 2016 08:02:37 +0000 (17:02 +0900)]
drm/nouveau/secboot: add low-secure firmware hooks

Secure firmwares provided by NVIDIA will follow the same overall
principle, but may slightly differ in format, or not use the same
bootloader descriptor even on the same chip. In order to handle
this as gracefully as possible, turn the LS firmware functions into
hooks that can be overloaded as needed.

The current hooks cover the external firmware loading as well as the
bootloader descriptor generation.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove fixup_hs_desc hook
Alexandre Courbot [Wed, 14 Dec 2016 08:02:36 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove fixup_hs_desc hook

This hook can be removed if the function writing the HS
descriptor is aware of WPR settings. Let's do that as it allows us to
make the ACR descriptor structure private and save some code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>