linux-2.6-microblaze.git
3 years agodrm/amd/pm: apply no power source workaround if dc reported by gpio
Evan Quan [Fri, 4 Sep 2020 06:55:43 +0000 (14:55 +0800)]
drm/amd/pm: apply no power source workaround if dc reported by gpio

If dc reported by gpio is supported, the power source switching will
be performed by pmfw automatically. Thus the power source setting
workaround for Navi1x will be not needed.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: process pending AC/DC switch interrupt
Evan Quan [Fri, 4 Sep 2020 06:41:07 +0000 (14:41 +0800)]
drm/amd/pm: process pending AC/DC switch interrupt

Process any pending interrupt that occured before driver register
for interrupt from GPIO/SMU.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: add Raven2 watermark WmType setting
Evan Quan [Thu, 3 Sep 2020 07:42:59 +0000 (15:42 +0800)]
drm/amd/pm: add Raven2 watermark WmType setting

Which tells it's a normal pstate change or memory retraining.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Tested-by: Changfeng Zhu <Changfeng.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: add Renoir watermark WmType setting
Evan Quan [Thu, 3 Sep 2020 07:13:09 +0000 (15:13 +0800)]
drm/amd/pm: add Renoir watermark WmType setting

Which tells it's a normal pstate change or memory retraining.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Tested-by: Changfeng Zhu <Changfeng.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: drop unnecessary wrappers around watermark setting
Evan Quan [Thu, 3 Sep 2020 07:02:37 +0000 (15:02 +0800)]
drm/amd/pm: drop unnecessary wrappers around watermark setting

The convertion to "struct dm_pp_clock_range_for_mcif_wm_set_soc15"
is totally unnecessary and can be dropped.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Tested-by: Changfeng Zhu <Changfeng.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: drop dead code
Evan Quan [Thu, 3 Sep 2020 06:41:47 +0000 (14:41 +0800)]
drm/amd/pm: drop dead code

Raven never goes to swsmu path. So "adev->smu.ppt_funcs" will be
always false.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Tested-by: Changfeng Zhu <Changfeng.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: minor cleanups
Evan Quan [Mon, 24 Aug 2020 07:25:28 +0000 (15:25 +0800)]
drm/amd/pm: minor cleanups

Drop unneeded "ret".

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: drop unnecessary table existence and dpm enablement check
Evan Quan [Mon, 24 Aug 2020 07:21:30 +0000 (15:21 +0800)]
drm/amd/pm: drop unnecessary table existence and dpm enablement check

Either this was already performed in parent API. Or the table is
confirmed to exist.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: drop unnecessary smu_baco->mutex lock protections(V2)
Evan Quan [Mon, 24 Aug 2020 07:18:00 +0000 (15:18 +0800)]
drm/amd/pm: drop unnecessary smu_baco->mutex lock protections(V2)

As these operations are performed in hardware setup and there
is actually no race conditions during this period considering:
1. the hardware setup is serial and cannot be in parallel
2. all other operations can be performed only after hardware
   setup complete.

V2: rich the commit log description

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: drop unnecessary feature->mutex lock protections(V2)
Evan Quan [Mon, 24 Aug 2020 07:11:47 +0000 (15:11 +0800)]
drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)

As these operations are performed in hardware setup and there
is actually no race conditions during this period considering:
1. the hardware setup is serial and cannot be in parallel
2. all other operations can be performed only after hardware
   setup complete.

V2: rich the commit log description

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Nirmoy Das <nirmoy.das@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: make namings and comments more readable
Evan Quan [Wed, 26 Aug 2020 10:37:00 +0000 (18:37 +0800)]
drm/amd/pm: make namings and comments more readable

And to fit more accurately what the cod does.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: correct the requirement for umc cdr workaround
Evan Quan [Wed, 26 Aug 2020 10:27:09 +0000 (18:27 +0800)]
drm/amd/pm: correct the requirement for umc cdr workaround

The workaround can be applied only with UCLK DPM enabled.
And expand the workaround to more Navi10 SKUs and also
Navi14.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: apply the CDR workarounds only with some specific UMC firmwares(V2)
Evan Quan [Wed, 26 Aug 2020 10:19:28 +0000 (18:19 +0800)]
drm/amd/pm: apply the CDR workarounds only with some specific UMC firmwares(V2)

And different workaround will be applied based on hybrid cdr bit.

V2: add pmfw version guard to make sure the new workaround applied only
    with pmfw >= 42.53.0

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: implement a new umc cdr workaround
Evan Quan [Wed, 26 Aug 2020 09:58:29 +0000 (17:58 +0800)]
drm/amd/pm: implement a new umc cdr workaround

By uploading dummy pstate tables.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: allocate a new buffer for pstate dummy reading
Evan Quan [Wed, 26 Aug 2020 08:10:29 +0000 (16:10 +0800)]
drm/amd/pm: allocate a new buffer for pstate dummy reading

This dummy reading buffer will be used for the new Navi1x
UMC CDR workaround.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: revise the umc hybrid cdr workaround
Evan Quan [Wed, 26 Aug 2020 08:50:30 +0000 (16:50 +0800)]
drm/amd/pm: revise the umc hybrid cdr workaround

Drop the unused message(SMU_MSG_DAL_DISABLE_DUMMY_PSTATE_CHANGE).
And do not apply this workaround when the max uclk frequency
is greater than 750Mhz.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: put Navi1X umc cdr workaround in post_smu_init
Evan Quan [Tue, 1 Sep 2020 03:33:53 +0000 (11:33 +0800)]
drm/amd/pm: put Navi1X umc cdr workaround in post_smu_init

That's where the uclk dpm get enabled and then the
uclk cdr workaround can be applied.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: postpone SOCCLK/UCLK enablement after DAL initialization(V2)
Evan Quan [Tue, 1 Sep 2020 03:02:31 +0000 (11:02 +0800)]
drm/amd/pm: postpone SOCCLK/UCLK enablement after DAL initialization(V2)

This is needed for Navi1X only. And it may help for display missing
or hang issue seen on some high resolution monitors.

V2: no UCLK DPM enablement for Navi10 A0 secure SKU

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/pm: wrapper for postponing some setup job after DAL initializatioa(V2)
Evan Quan [Tue, 1 Sep 2020 02:23:34 +0000 (10:23 +0800)]
drm/amd/pm: wrapper for postponing some setup job after DAL initializatioa(V2)

So that ASIC specific actions can be added.

V2: better namings

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/i915: Update DRIVER_DATE to 20200917
Rodrigo Vivi [Thu, 17 Sep 2020 20:43:57 +0000 (16:43 -0400)]
drm/i915: Update DRIVER_DATE to 20200917

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
3 years agodrm/ttm: drop evicted from ttm_bo.
Dave Airlie [Thu, 17 Sep 2020 06:13:03 +0000 (16:13 +1000)]
drm/ttm: drop evicted from ttm_bo.

This was unused.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917064132.148521-3-airlied@gmail.com
3 years agodrm/ttm: drop special pipeline accel cleanup function.
Dave Airlie [Thu, 17 Sep 2020 06:36:14 +0000 (16:36 +1000)]
drm/ttm: drop special pipeline accel cleanup function.

The two accel cleanup paths were mostly the same once refactored.

Just pass a bool to say if the evictions are to be pipelined.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917064132.148521-2-airlied@gmail.com
3 years agodrm/ttm: make common function for wait/free node path.
Dave Airlie [Thu, 17 Sep 2020 04:13:06 +0000 (14:13 +1000)]
drm/ttm: make common function for wait/free node path.

The pipeline and accel cleansups has similiar paths here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-8-airlied@gmail.com
3 years agodrm/ttm: move ghost object creation to a common function
Dave Airlie [Thu, 17 Sep 2020 04:08:29 +0000 (14:08 +1000)]
drm/ttm: move ghost object creation to a common function

Both accel cleanup and pipeline move had the same code, make
a single function for it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-7-airlied@gmail.com
3 years agodrm/ttm: add a simple assign mem to bo wrapper
Dave Airlie [Thu, 17 Sep 2020 04:03:46 +0000 (14:03 +1000)]
drm/ttm: add a simple assign mem to bo wrapper

This pattern is called in a few places, just clean it up.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-6-airlied@gmail.com
3 years agodrm/ttm/drivers: call the bind function directly.
Dave Airlie [Thu, 17 Sep 2020 03:48:59 +0000 (13:48 +1000)]
drm/ttm/drivers: call the bind function directly.

Now the bind functions have all the protection explicitly the
drivers can just call them directly, and the api can be unexported

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-5-airlied@gmail.com
3 years agodrm/ttm: move unbind into the tt destroy.
Dave Airlie [Thu, 17 Sep 2020 03:24:50 +0000 (13:24 +1000)]
drm/ttm: move unbind into the tt destroy.

This moves unbind into the driver side on destroy paths.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-4-airlied@gmail.com
3 years agodrm/ttm: flip tt destroy ordering.
Dave Airlie [Thu, 17 Sep 2020 03:20:48 +0000 (13:20 +1000)]
drm/ttm: flip tt destroy ordering.

Call the driver first and have it call the common code cleanup.

This is useful later to fix unbind.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-3-airlied@gmail.com
3 years agodrm/ttm: protect against reentrant bind in the drivers
Dave Airlie [Thu, 17 Sep 2020 02:54:24 +0000 (12:54 +1000)]
drm/ttm: protect against reentrant bind in the drivers

This moves the generic tracking into the drivers and protects
against reentrancy in the drivers. It fixes up radeon and agp
to be able to query the bound status as that is required.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-2-airlied@gmail.com
3 years agodrm/i915/tgl, rkl: Make Wa_1606700617/22010271021 permanent
Swathi Dhanavanthri [Fri, 11 Sep 2020 22:11:58 +0000 (15:11 -0700)]
drm/i915/tgl, rkl: Make Wa_1606700617/22010271021 permanent

This workaround applies to all TGL and RKL steppings.

Signed-off-by: Swathi Dhanavanthri <swathi.dhanavanthri@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200911221158.4700-1-swathi.dhanavanthri@intel.com
3 years agodrm/i915: Nuke force_min_cdclk_changed
Ville Syrjälä [Tue, 14 Jul 2020 15:26:26 +0000 (18:26 +0300)]
drm/i915: Nuke force_min_cdclk_changed

Since we now have proper old and new cdclk state we no longer
need to keep this flag to indicate that the force min cdclk has
changed. Instead just check if the old vs. new value are different.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200714152626.380-4-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
3 years agodrm/i915: Remove the old global state stuff
Ville Syrjälä [Wed, 2 Sep 2020 12:21:41 +0000 (15:21 +0300)]
drm/i915: Remove the old global state stuff

With the dbuf code mostly converted over to the new global state
handling we can remove the leftovers of the old global state
stuff.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200902122141.15181-1-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
3 years agodrm/i915: Do YCbCr 444->420 conversion via DP protocol converters
Ville Syrjälä [Fri, 4 Sep 2020 11:53:54 +0000 (14:53 +0300)]
drm/i915: Do YCbCr 444->420 conversion via DP protocol converters

For platforms that can't do native 4:2:0 outout we may still be
able to do it by getting the DP->HDMI protocol converter to
perform the 4:4:4->4:2:0 downsamling for us. In this case we
have to configure our hardware to output YCbCr 4:4:4, which we've
already hooked up so all we need to do is flip the switch.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-19-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/dp: Add helpers for DFP YCbCr 4:2:0 handling
Ville Syrjälä [Fri, 4 Sep 2020 11:53:53 +0000 (14:53 +0300)]
drm/dp: Add helpers for DFP YCbCr 4:2:0 handling

Add helpers to determine whether the DFP supports
YCbCr 4:2:0 passthrough or YCbCr 4:4:4->4:2:0 conversion.

v2: Add kdocs (Lyude)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-18-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/i915: DP->HDMI TMDS clock limits vs. deep color
Ville Syrjälä [Fri, 4 Sep 2020 11:53:52 +0000 (14:53 +0300)]
drm/i915: DP->HDMI TMDS clock limits vs. deep color

Account for the TMDS clock limits declared by the DFP
when determining what color depth we're going to use.

v2: Drop the reference to DP++ dongle since it's not handled here

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-17-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/i915: Extract intel_hdmi_has_audio()
Ville Syrjälä [Fri, 4 Sep 2020 11:53:51 +0000 (14:53 +0300)]
drm/i915: Extract intel_hdmi_has_audio()

Pull the "do we want to enable audio?" computation into a small helper
to make intel_hdmi_compute_config() less messy. Will make it easier to
add more checks for this later (eg. we should actually be checking
at the hblank is long enough for audio transmission).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-16-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/i915: Handle downstream facing ports w/o EDID
Ville Syrjälä [Fri, 4 Sep 2020 11:53:50 +0000 (14:53 +0300)]
drm/i915: Handle downstream facing ports w/o EDID

Use drm_dp_downstream_mode() to get a suitable mode for downstream
facing ports which don't have an EDID.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-15-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/dp: Add drm_dp_downstream_mode()
Ville Syrjälä [Fri, 4 Sep 2020 11:53:49 +0000 (14:53 +0300)]
drm/dp: Add drm_dp_downstream_mode()

The downstream facing port caps in the DPCD can give us a hint
as to what kind of display mode the sink can use if it doesn't
have an EDID. Use that information to pick a suitable mode.

v2: Use Returns: for kdoc (Lyude)
    Add kdocs for drm_display_mode_from_cea_vic() (Lyude)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-14-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/i915: Configure DP 1.3+ protocol converted HDMI mode
Ville Syrjälä [Fri, 4 Sep 2020 11:53:48 +0000 (14:53 +0300)]
drm/i915: Configure DP 1.3+ protocol converted HDMI mode

DP 1.3 adds some extra control knobs for DP->HDMI protocol conversion.
Let's use that to configure the "HDMI mode" (ie. infoframes vs. not)
based on the capabilities of the sink.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-13-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/i915: Deal with TMDS DFP clock limits
Ville Syrjälä [Fri, 4 Sep 2020 11:53:47 +0000 (14:53 +0300)]
drm/i915: Deal with TMDS DFP clock limits

Use the new helpers to extract the TMDS clock limits from
the downstream facing port and check them in .mode_valid().

TODO: we should check these in .compute_config() too to eg.
determine if we can do deep color on the HDMI side or not

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-12-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/dp: Add drm_dp_downstream_{min,max}_tmds_clock()
Ville Syrjälä [Fri, 4 Sep 2020 11:53:46 +0000 (14:53 +0300)]
drm/dp: Add drm_dp_downstream_{min,max}_tmds_clock()

Add helpers to get the TMDS clock limits for HDMI/DVI downstream
facing ports.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-11-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/i915: Reworkd DP DFP clock handling
Ville Syrjälä [Fri, 4 Sep 2020 11:53:45 +0000 (14:53 +0300)]
drm/i915: Reworkd DP DFP clock handling

Move the downstream facing port dotclock check into a new function
(intel_dp_mode_valid_downstream()) so that we have a nice future
place where we can collect other related checks.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-10-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/dp: Redo drm_dp_downstream_max_clock() as drm_dp_downstream_max_dotclock()
Ville Syrjälä [Fri, 4 Sep 2020 11:53:44 +0000 (14:53 +0300)]
drm/dp: Redo drm_dp_downstream_max_clock() as drm_dp_downstream_max_dotclock()

We want to differentiate between the DFP dotclock and TMDS clock
limits. Let's convert the current thing to just give us the
dotclock limit.

v2: Use Returns: for kdoc (Lyude)
    Fix up nouveau code too

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-9-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/ttm: remove superflous extern attribute from funcs
Christian König [Wed, 16 Sep 2020 13:31:28 +0000 (15:31 +0200)]
drm/ttm: remove superflous extern attribute from funcs

Extern is the default attribute for functions anyway.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/390972/
3 years agodrm/dp: Pimp drm_dp_downstream_max_bpc()
Ville Syrjälä [Fri, 4 Sep 2020 11:53:43 +0000 (14:53 +0300)]
drm/dp: Pimp drm_dp_downstream_max_bpc()

Deal with more cases in drm_dp_downstream_max_bpc():
- DPCD 1.0 -> assume 8bpc for non-DP
- DPCD 1.1+ DP (or DP++ with DP sink) -> allow anything
- DPCD 1.1+ TMDS -> check the caps, assume 8bpc if the value is crap
- anything else -> assume 8bpc

v2: Use Returns: for kdoc (Lyude)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-8-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/dp: Add helpers to identify downstream facing port types
Ville Syrjälä [Fri, 4 Sep 2020 11:53:42 +0000 (14:53 +0300)]
drm/dp: Add helpers to identify downstream facing port types

Add a few helpers to let us better identify which kind of DFP
we're dealing with.

v2: Use Returns: for kdoc (Lyude)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-7-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/i915: Reworkd DFP max bpc handling
Ville Syrjälä [Fri, 4 Sep 2020 11:53:41 +0000 (14:53 +0300)]
drm/i915: Reworkd DFP max bpc handling

Stash the downstream facing port max bpc away during
intel_dp_set_edid(). We'll soon need the EDID in there so
we can't figure this out so easily during .compute_config() anymore.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-6-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/dp: Define more downstream facing port caps
Ville Syrjälä [Fri, 4 Sep 2020 11:53:40 +0000 (14:53 +0300)]
drm/dp: Define more downstream facing port caps

Our definitions for the DPCD DFP capabilities are lacking.
Add the missing bits.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-5-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/dp: Define protocol converter DPCD registers
Ville Syrjälä [Fri, 4 Sep 2020 11:53:39 +0000 (14:53 +0300)]
drm/dp: Define protocol converter DPCD registers

DP 1.3 and 1.4 introduced some new registers for DP->HDMI protocol
converters. Define those.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-4-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/i915/lspcon: Do not send infoframes to non-HDMI sinks
Ville Syrjälä [Fri, 4 Sep 2020 11:53:38 +0000 (14:53 +0300)]
drm/i915/lspcon: Do not send infoframes to non-HDMI sinks

Non-HDMI sinks shouldn't be sent infoframes. Check for that when
using LSPCON.

FIXME: How do we turn off infoframes once enabled? Do we even
       have to?

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-3-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodrm/dp: Dump downstream facing port caps
Ville Syrjälä [Fri, 4 Sep 2020 11:53:37 +0000 (14:53 +0300)]
drm/dp: Dump downstream facing port caps

It helps when the logs have a dump of the DFP capabilities.

v2: Move the dumping to the new helper

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904115354.25336-2-ville.syrjala@linux.intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
3 years agodma-resv: lockdep-prime address_space->i_mmap_rwsem for dma-resv
Daniel Vetter [Tue, 28 Jul 2020 13:58:39 +0000 (15:58 +0200)]
dma-resv: lockdep-prime address_space->i_mmap_rwsem for dma-resv

GPU drivers need this in their shrinkers, to be able to throw out
mmap'ed buffers. Note that we also need dma_resv_lock in shrinkers,
but that loop is resolved by trylocking in shrinkers.

So full hierarchy is now (ignore some of the other branches we already
have primed):

mmap_read_lock -> dma_resv -> shrinkers -> i_mmap_lock_write

I hope that's not inconsistent with anything mm or fs does, adding
relevant people.

Reviewed-by: Thomas Hellström <thomas.hellstrom@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: Dave Chinner <david@fromorbit.com>
Cc: Qian Cai <cai@lca.pw>
Cc: linux-xfs@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Cc: Thomas Hellström (Intel) <thomas_os@shipmail.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: linux-mm@kvack.org
Cc: linux-rdma@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200728135839.1035515-1-daniel.vetter@ffwll.ch
3 years agodrm: fix spelling error in comments
Wang Qing [Thu, 17 Sep 2020 02:04:32 +0000 (10:04 +0800)]
drm: fix spelling error in comments

Change the comment typo: "manger" -> "manager".

Signed-off-by: Wang Qing <wangqing@vivo.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1600308275-32094-1-git-send-email-wangqing@vivo.com
3 years agoMAINTAINERS: make linux-aspeed list remarks consistent
Lukas Bulwahn [Sat, 12 Sep 2020 18:33:34 +0000 (20:33 +0200)]
MAINTAINERS: make linux-aspeed list remarks consistent

Commit f15a3ea80391 ("MAINTAINERS: Add ASPEED BMC GFX DRM driver entry")
does not mention that linux-aspeed@lists.ozlabs.org is moderated for
non-subscribers, but the other three entries for
linux-aspeed@lists.ozlabs.org do.

By 'majority vote' among entries, let us assume it was just missed here and
adjust it to be consistent with others.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200912183334.22683-1-lukas.bulwahn@gmail.com
3 years agodrm/tegra: output: rgb: Wrap directly-connected panel into DRM bridge
Dmitry Osipenko [Thu, 13 Aug 2020 22:06:56 +0000 (01:06 +0300)]
drm/tegra: output: rgb: Wrap directly-connected panel into DRM bridge

Currently Tegra DRM driver manually manages display panel, but this
management could be moved out into DRM core if we'll wrap panel into
DRM bridge. This patch wraps RGB panel into a DRM bridge and removes
manual handling of the panel from the RGB output code.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
3 years agodrm/tegra: output: rgb: Support LVDS encoder bridge
Dmitry Osipenko [Thu, 13 Aug 2020 22:06:55 +0000 (01:06 +0300)]
drm/tegra: output: rgb: Support LVDS encoder bridge

Newer Tegra device-trees will specify a video output graph, which involves
LVDS encoder bridge. This patch adds support for the LVDS encoder bridge
to the RGB output, allowing us to model the display hardware properly.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
3 years agodrm/tegra: output: Support DRM bridges
Dmitry Osipenko [Thu, 13 Aug 2020 22:06:54 +0000 (01:06 +0300)]
drm/tegra: output: Support DRM bridges

Newer Tegra device-trees will specify a video output graph which involves
a bridge. This patch adds initial support for the DRM bridges to the Tegra
DRM output.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
3 years agodrm/tegra: output: Don't leak OF node on error
Dmitry Osipenko [Thu, 13 Aug 2020 22:06:53 +0000 (01:06 +0300)]
drm/tegra: output: Don't leak OF node on error

The OF node should be put before returning error in tegra_output_probe(),
otherwise node's refcount will be leaked.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
3 years agodrm/tegra: Properly reference count the DDC I2C adapter
Thierry Reding [Wed, 8 Apr 2020 18:01:00 +0000 (20:01 +0200)]
drm/tegra: Properly reference count the DDC I2C adapter

Use the of_get_i2c_adapter_by_node(), which is similar to the existing
call to of_find_i2c_adapter_by_node() except that it also takes a
reference to the owner module of the I2C adapter. In order to properly
balance this out, call i2c_put_adapter() to release the reference to the
I2C adapter and its owner module.

For the special case where the DDC comes from the DPAUX, care must be
taken to perform the same steps (i.e. get_device() and module_get()) so
that the reference counts are all balanced.

Signed-off-by: Thierry Reding <treding@nvidia.com>
3 years agodrm/ttm: some cleanups
Christian König [Tue, 15 Sep 2020 14:29:26 +0000 (16:29 +0200)]
drm/ttm: some cleanups

Unexport ttm_check_under_lowerlimit.
Make ttm_bo_acc_size static and unexport it.
Remove ttm_get_kernel_zone_memory_size.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/390515/
3 years agoMerge branch 'for-5.10-drm-sg-fix' of https://github.com/mszyprow/linux into drm...
Dave Airlie [Thu, 17 Sep 2020 04:18:51 +0000 (14:18 +1000)]
Merge branch 'for-5.10-drm-sg-fix' of https://github.com/mszyprow/linux into drm-next

Please pull a set of fixes for various DRM drivers that finally resolve
incorrect usage of the scatterlists (struct sg_table nents and orig_nents
entries), what causes issues when IOMMU is used.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200910080505.24456-1-m.szyprowski@samsung.com
3 years agodrm/i915/selftests: Push the fake iommu device from the stack to data
Chris Wilson [Wed, 16 Sep 2020 10:50:22 +0000 (11:50 +0100)]
drm/i915/selftests: Push the fake iommu device from the stack to data

Since we store a pointer to the fake iommu device that is allocated on
the stack, as soon as we leave the function it goes out of scope and any
future dereference is undefined behaviour. Just in case we may need to
look at the fake iommu device after initialiation, move the allocation
from the stack into the data.

Fixes: 01b9d4e21148 ("iommu/vt-d: Use dev_iommu_priv_get/set()")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200916105022.28316-2-chris@chris-wilson.co.uk
3 years agodrm/i915: Initialise outparam for error return from wait_for_register
Chris Wilson [Wed, 16 Sep 2020 10:50:21 +0000 (11:50 +0100)]
drm/i915: Initialise outparam for error return from wait_for_register

Just in case the caller passes in 0 for both slow&fast timeouts, make
sure we initialise the stack value returned. Add an assert so that we
don't make the mistake of passing 0 timeouts for the wait.

drivers/gpu/drm/i915/intel_uncore.c:2011 __intel_wait_for_register_fw() error: uninitialized symbol 'reg_value'.

References: 3f649ab728cd ("treewide: Remove uninitialized_var() usage")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200916105022.28316-1-chris@chris-wilson.co.uk
3 years agophy: cadence-torrent: Set Torrent PHY attributes
Swapnil Jakhade [Fri, 11 Sep 2020 06:18:34 +0000 (08:18 +0200)]
phy: cadence-torrent: Set Torrent PHY attributes

Set Torrent PHY attributes bus_width, max_link_rate and mode
for DisplayPort.

Signed-off-by: Swapnil Jakhade <sjakhade@cadence.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Link: https://lore.kernel.org/r/1599805114-22063-3-git-send-email-sjakhade@cadence.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
3 years agophy: Add new PHY attribute max_link_rate
Swapnil Jakhade [Fri, 11 Sep 2020 06:18:33 +0000 (08:18 +0200)]
phy: Add new PHY attribute max_link_rate

Add new PHY attribute max_link_rate to struct phy_attrs. This indicates
maximum link rate supported by PHY (in Mbps).

Signed-off-by: Yuti Amonkar <yamonkar@cadence.com>
Signed-off-by: Swapnil Jakhade <sjakhade@cadence.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Link: https://lore.kernel.org/r/1599805114-22063-2-git-send-email-sjakhade@cadence.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
3 years agoMerge branch 'virtio-shm' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
Maxime Ripard [Wed, 16 Sep 2020 08:56:29 +0000 (10:56 +0200)]
Merge branch 'virtio-shm' of git://git./linux/kernel/git/mszeredi/fuse into drm-misc-next

Topic pull request for core virtio changes that will be required by the DRM
driver.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
From: Gurchetan Singh <gurchetansingh@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/CAAfnVBn2BzXWFY3hhjDxd5q0P2_JWn-HdkVxgS94x9keAUZiow@mail.gmail.com
3 years agodrm/ast: Enable CRTC before planes
Thomas Zimmermann [Mon, 14 Sep 2020 07:22:36 +0000 (09:22 +0200)]
drm/ast: Enable CRTC before planes

An active cursor plane requires a valid display mode. Change the
commit_tail callback, so that it sets up the CRTC's mode before
updating planes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200914072236.19398-5-tzimmermann@suse.de
3 years agodrm/ast: Program display mode in CRTC's atomic_enable()
Thomas Zimmermann [Mon, 14 Sep 2020 07:22:35 +0000 (09:22 +0200)]
drm/ast: Program display mode in CRTC's atomic_enable()

This change simplifies ast's modesetting code. The display mode
is now programmed from within the CRTC's atomic_enable(), which
only runs if we actually want to program the mode.

Corresponding code in atomic_flush() is being removed. Also removed
is atomic_begin(), which serves no purpose at all.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200914072236.19398-4-tzimmermann@suse.de
3 years agodrm/ast: Disable planes while switching display modes
Thomas Zimmermann [Mon, 14 Sep 2020 07:22:34 +0000 (09:22 +0200)]
drm/ast: Disable planes while switching display modes

The ast HW cursor requires the primary plane and CRTC to display at
a valid mode and format. This is not the case while switching
display modes, which can lead to the screen turing permanently dark.

As a workaround, the ast driver now disables active planes while the
mode or format switch takes place. It also synchronizes with the vertical
refresh to give CRTC and planes some time to catch up on each other.
The active planes planes (primary or cursor) will be re-enabled by
each plane's atomic_update() function.

v3:
* move the logic into the CRTC's atomic_disable function
v2:
* move the logic into the commit-tail function

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200914072236.19398-3-tzimmermann@suse.de
3 years agodrm/ast: Set format registers in primary plane's update
Thomas Zimmermann [Mon, 14 Sep 2020 07:22:33 +0000 (09:22 +0200)]
drm/ast: Set format registers in primary plane's update

The atomic modesetting code tried to distinguish format changes from
full modesetting operations. But the implementation was buggy and the
format registers were often updated even for simple pageflips.

Fix this problem by handling format changes in the primary plane's
update function.

v3:
* program format in primary plane's update function

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200914072236.19398-2-tzimmermann@suse.de
3 years agoMAINTAINERS: Add Thomas as reviewer for ast, mgag200 and udl
Thomas Zimmermann [Tue, 15 Sep 2020 07:17:08 +0000 (09:17 +0200)]
MAINTAINERS: Add Thomas as reviewer for ast, mgag200 and udl

I'm adding myself as reviewer for ast, mgag200 and udl. I've already
been keeping these drivers in shape for a while.

While at it I'm also setting the list and tree for ast and mgag200,
and update each driver's status to Supported. Working on these drivers
is part of my job.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915071708.4743-1-tzimmermann@suse.de
3 years agodrm: mxsfb: check framebuffer pitch
Stefan Agner [Tue, 8 Sep 2020 14:16:54 +0000 (16:16 +0200)]
drm: mxsfb: check framebuffer pitch

The lcdif IP does not support a framebuffer pitch (stride) other than
framebuffer width. Check for equality and reject the framebuffer
otherwise.

This prevents a distorted picture when using 640x800 and running the
Mesa graphics stack. Mesa tries to use a cache aligned stride, which
leads at that particular resolution to width != stride. Currently
Mesa has no fallback behavior, but rejecting this configuration allows
userspace to handle the issue correctly.

Fixes: 45d59d704080 ("drm: Add new driver for MXSFB controller")
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200908141654.266836-1-stefan@agner.ch
3 years agodrm/vc4: Handing the return value of drm_universal_plane_init
Tian Tao [Fri, 11 Sep 2020 08:09:37 +0000 (16:09 +0800)]
drm/vc4: Handing the return value of drm_universal_plane_init

Handing the return value of drm_universal_plane_init to fix the following
W=1 kernel build warning(s):
vc4_plane.c: In function ‘vc4_plane_init’:
vc4_plane.c:1340:6: warning: variable ‘ret’ set but not
used [-Wunused-but-set-variable]

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1599811777-34093-1-git-send-email-tiantao6@hisilicon.com
3 years agodrm/ttm: move populated state into page flags
Dave Airlie [Tue, 15 Sep 2020 01:47:19 +0000 (11:47 +1000)]
drm/ttm: move populated state into page flags

Just use the top bit of page flags to store the populated state.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-8-airlied@gmail.com
3 years agodrm/ttm: split bound/populated flags.
Dave Airlie [Tue, 15 Sep 2020 01:42:30 +0000 (11:42 +1000)]
drm/ttm: split bound/populated flags.

Move bound up into the bo object, and keep populated with the tt
object.

The ghost object handling needs to follow the flags at the bo
level now instead of it being part of the ttm tt object.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-7-airlied@gmail.com
3 years agodrm/ttm: move ttm binding/unbinding out of ttm_tt paths.
Dave Airlie [Tue, 15 Sep 2020 01:34:51 +0000 (11:34 +1000)]
drm/ttm: move ttm binding/unbinding out of ttm_tt paths.

Move these up to the bo level, moving ttm_tt to just being
backing store. Next step is to move the bound flag out.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-6-airlied@gmail.com
3 years agodrm/ttm: split populate out from binding.
Dave Airlie [Tue, 15 Sep 2020 01:16:53 +0000 (11:16 +1000)]
drm/ttm: split populate out from binding.

Drivers have to call populate themselves now before binding.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-5-airlied@gmail.com
3 years agodrm/ttm: tt destroy move null check to outer function.
Dave Airlie [Tue, 15 Sep 2020 01:04:08 +0000 (11:04 +1000)]
drm/ttm: tt destroy move null check to outer function.

This just makes things easier later.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-4-airlied@gmail.com
3 years agodrm/ttm: wrap tt destroy. (v2)
Dave Airlie [Tue, 15 Sep 2020 01:02:12 +0000 (11:02 +1000)]
drm/ttm: wrap tt destroy. (v2)

All places this was called was using bo->ttm either direct
or indirectly.

v2: move to ttm_bo

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-3-airlied@gmail.com
3 years agodrm/ttm/tt: add wrappers to set tt state.
Dave Airlie [Tue, 15 Sep 2020 00:21:15 +0000 (10:21 +1000)]
drm/ttm/tt: add wrappers to set tt state.

This adds 2 getters and 4 setters, however unbound and populated
are currently the same thing, this will change, it also drops
a BUG_ON that seems not that useful.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-2-airlied@gmail.com
3 years agodrm/i915/pll: Centralize PLL_ENABLE register lookup
Anusha Srivatsa [Fri, 28 Aug 2020 21:10:56 +0000 (14:10 -0700)]
drm/i915/pll: Centralize PLL_ENABLE register lookup

We currenty check for platform at multiple parts in the driver
to grab the correct PLL. Let us begin to centralize it through a
helper function.

v2: s/intel_get_pll_enable_reg()/intel_combo_pll_enable_reg() (Ville)

v3: Clean up combo_pll_disable() (Rodrigo)

v4: s/dev_priv/i915 (Jani)
Move static and return type to the same line( Ville, Jani)

Suggested-by: Matt Roper <matthew.d.roper@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200914175703.15024-1-anusha.srivatsa@intel.com
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
3 years agodrm/amdgpu/dc: Require primary plane to be enabled whenever the CRTC is
Michel Dänzer [Fri, 4 Sep 2020 10:43:04 +0000 (12:43 +0200)]
drm/amdgpu/dc: Require primary plane to be enabled whenever the CRTC is

Don't check drm_crtc_state::active for this either, per its
documentation in include/drm/drm_crtc.h:

 * Hence drivers must not consult @active in their various
 * &drm_mode_config_funcs.atomic_check callback to reject an atomic
 * commit.

atomic_remove_fb disables the CRTC as needed for disabling the primary
plane.

This prevents at least the following problems if the primary plane gets
disabled (e.g. due to destroying the FB assigned to the primary plane,
as happens e.g. with mutter in Wayland mode):

* The legacy cursor ioctl returned EINVAL for a non-0 cursor FB ID
  (which enables the cursor plane).
* If the cursor plane was enabled, changing the legacy DPMS property
  value from off to on returned EINVAL.

v2:
* Minor changes to code comment and commit log, per review feedback.

GitLab: https://gitlab.gnome.org/GNOME/mutter/-/issues/1108
GitLab: https://gitlab.gnome.org/GNOME/mutter/-/issues/1165
GitLab: https://gitlab.gnome.org/GNOME/mutter/-/issues/1344
Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amdgpu/gmc9: remove mmhub client duplicated case
Alex Deucher [Mon, 14 Sep 2020 15:36:21 +0000 (11:36 -0400)]
drm/amdgpu/gmc9: remove mmhub client duplicated case

Copy paste typo.

Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amdgpu: Fail to load on RAVEN if SME is active
Alex Deucher [Sun, 6 Sep 2020 16:05:12 +0000 (12:05 -0400)]
drm/amdgpu: Fail to load on RAVEN if SME is active

Due to hardware bugs, scatter/gather display on raven requires
a 1:1 IOMMU mapping, however, SME (System Memory Encryption)
requires an indirect IOMMU mapping because the encryption bit
is beyond the DMA mask of the chip.  As such, the two are
incompatible.

Acked-by: Joerg Roedel <jroedel@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Create trigger_hotplug entry
YueHaibing [Thu, 10 Sep 2020 03:13:52 +0000 (11:13 +0800)]
drm/amd/display: Create trigger_hotplug entry

Add trigger_hotplug debugfs entry.

Fixes: 6f77b2ac6280 ("drm/amd/display: Add connector HPD trigger debugfs entry")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Fix possible memleak in dp_trigger_hotplug()
YueHaibing [Thu, 10 Sep 2020 03:26:36 +0000 (11:26 +0800)]
drm/amd/display: Fix possible memleak in dp_trigger_hotplug()

If parse_write_buffer_into_params() fails, we should free
wr_buf before return.

Fixes: 6f77b2ac6280 ("drm/amd/display: Add connector HPD trigger debugfs entry")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: optimize code runtime a bit
Bernard Zhao [Thu, 10 Sep 2020 02:05:04 +0000 (19:05 -0700)]
drm/amd/display: optimize code runtime a bit

In fnction is_cr_done & is_ch_eq_done, when done = false
happened once, no need to circle left ln_count.
This change is to make the code run a bit fast.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c
Zheng Bin [Wed, 9 Sep 2020 13:07:20 +0000 (21:07 +0800)]
drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1003:4-9: WARNING: Comparison to bool
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1083:5-11: WARNING: Comparison to bool

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/amdgpu: fix comparison pointer to bool warning in amdgpu_atpx_handler.c
Zheng Bin [Wed, 9 Sep 2020 13:07:19 +0000 (21:07 +0800)]
drm/amd/amdgpu: fix comparison pointer to bool warning in amdgpu_atpx_handler.c

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c:619:15-49: WARNING: Comparison to bool
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c:629:15-49: WARNING: Comparison to bool

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c
Zheng Bin [Wed, 9 Sep 2020 13:07:18 +0000 (21:07 +0800)]
drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:1243:14-25: WARNING: Comparison to bool

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/amdgpu: fix comparison pointer to bool warning in si.c
Zheng Bin [Wed, 9 Sep 2020 13:07:17 +0000 (21:07 +0800)]
drm/amd/amdgpu: fix comparison pointer to bool warning in si.c

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/si.c:1342:5-10: WARNING: Comparison to bool

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c
Zheng Bin [Wed, 9 Sep 2020 13:07:16 +0000 (21:07 +0800)]
drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:562:5-11: WARNING: Comparison to bool

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c
Zheng Bin [Wed, 9 Sep 2020 13:07:15 +0000 (21:07 +0800)]
drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:619:5-11: WARNING: Comparison to bool

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c
Zheng Bin [Wed, 9 Sep 2020 13:07:14 +0000 (21:07 +0800)]
drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3563:5-31: WARNING: Comparison to bool

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c
Zheng Bin [Wed, 9 Sep 2020 13:07:13 +0000 (21:07 +0800)]
drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:2805:5-11: WARNING: Comparison to bool

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/radeon: Add sclk frequency as hwmon sensor
Sandeep Raghuraman [Wed, 9 Sep 2020 11:04:33 +0000 (16:34 +0530)]
drm/radeon: Add sclk frequency as hwmon sensor

This patch adds support for reporting sclk values for Radeon GPUs, where supported.

Signed-off-by: Sandeep Raghuraman <sandy.8925@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/scheduler: fix sched_fence.c kernel-doc warnings
Tian Tao [Wed, 9 Sep 2020 07:57:05 +0000 (15:57 +0800)]
drm/scheduler: fix sched_fence.c kernel-doc warnings

Fix kernel-doc warnings.
drivers/gpu/drm/scheduler/sched_fence.c:110: warning: Function parameter or
member 'f' not described in 'drm_sched_fence_release_scheduled'
drivers/gpu/drm/scheduler/sched_fence.c:110: warning: Excess function
parameter 'fence' description in 'drm_sched_fence_release_scheduled'

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm: amd/display: fix spelling of "function"
Randy Dunlap [Tue, 8 Sep 2020 23:56:09 +0000 (16:56 -0700)]
drm: amd/display: fix spelling of "function"

Fix spellos of "function" in drivers/gpu/drm/amd/display/.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amd/display: Remove duplicate include
Chen Zhou [Tue, 8 Sep 2020 13:35:52 +0000 (21:35 +0800)]
drm/amd/display: Remove duplicate include

Remove duplicate header which is included twice.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 years agodrm/amdgpu: stop resetting xgmi perfmons on disable
Jonathan Kim [Tue, 4 Aug 2020 20:26:20 +0000 (16:26 -0400)]
drm/amdgpu: stop resetting xgmi perfmons on disable

Disabling perf events does not specify reset in ABI so stop doing it in
hardware.

Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>