platform/kernel/linux-starfive.git
20 months agodrm/i915: Replace intel_bios_is_lane_reversal_needed() with intel_bios_encoder_lane_r...
Ville Syrjälä [Wed, 8 Feb 2023 01:55:02 +0000 (03:55 +0200)]
drm/i915: Replace intel_bios_is_lane_reversal_needed() with intel_bios_encoder_lane_reversal()

The sole user of intel_bios_is_lane_reversal_needed() has
the devdata already located, so pass it in directly instead
of digging it again from vbt.ports[].

And rename the function to follow the common pattern for
these things.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208015508.24824-5-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915: Replace intel_bios_is_lspcon_present() with intel_bios_encoder_is_lspcon()
Ville Syrjälä [Wed, 8 Feb 2023 01:55:01 +0000 (03:55 +0200)]
drm/i915: Replace intel_bios_is_lspcon_present() with intel_bios_encoder_is_lspcon()

We always have encoder->devdata available on the platforms
that can have LSPCON. So let's start looking there instead
of digging it out from vbt.ports[].

And let's rename the function to fit the common pattern
for these things.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208015508.24824-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915: Move variables to loop context
Ville Syrjälä [Wed, 8 Feb 2023 01:55:00 +0000 (03:55 +0200)]
drm/i915: Move variables to loop context

Lot of the loops over VBT child devices have variables
declared outside the loop but only used inside the loop.
Move the variables to a tighter scope.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208015508.24824-3-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915: Pass the whole encoder to hotplug_enables()
Ville Syrjälä [Wed, 8 Feb 2023 01:54:59 +0000 (03:54 +0200)]
drm/i915: Pass the whole encoder to hotplug_enables()

bxt_hotplug_enables() needs to dig out not only the
hpd_pin but also the VBT child device info, so let's just
pass in the whole encoder to avoid having to look things
up multiple times.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208015508.24824-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915/dp: Increase slice_height for DP
Suraj Kandpal [Tue, 14 Feb 2023 05:20:17 +0000 (10:50 +0530)]
drm/i915/dp: Increase slice_height for DP

According VDSC spec 1.2a Section 3.8 Options for Slice
implies that 108 lines is an optimal slice height, but any
size can be used as long as vertical active
integer multiple and maximum vertical slice count requirements are met.

Bspec: 49259

--v3
-remove previous fallback code and return slice_height as 2 [Jani]

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Swati Sharma <swati2.sharma@intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230214052017.3312044-1-suraj.kandpal@intel.com
20 months agodrm/i915: Prefix hex numbers with 0x
Ville Syrjälä [Mon, 30 Jan 2023 18:17:01 +0000 (20:17 +0200)]
drm/i915: Prefix hex numbers with 0x

It's hard to figure out whether the number is hex
or decimal if doesn't have the 0x to indicate hex.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130181701.29977-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915: Include stepping information in device info dump
Ville Syrjälä [Mon, 30 Jan 2023 18:17:00 +0000 (20:17 +0200)]
drm/i915: Include stepping information in device info dump

Dump the stepping information alongside all the other device
info. Might avoid some guesswork when reading logs.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130181701.29977-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915/display: Pass drm_i915_private as param to i915 funcs
Nirmoy Das [Wed, 25 Jan 2023 09:56:03 +0000 (10:56 +0100)]
drm/i915/display: Pass drm_i915_private as param to i915 funcs

For i915 functions pass struct drm_i915_private directly instead of
struct drm_device.

v2: Use to_i915(dev) directly without alias(Andrzej).

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125095603.17845-1-nirmoy.das@intel.com
20 months agodrm/i915: Replace wm.max_levels with wm.num_levels and use it everywhere
Ville Syrjälä [Thu, 9 Feb 2023 22:25:04 +0000 (00:25 +0200)]
drm/i915: Replace wm.max_levels with wm.num_levels and use it everywhere

Replaces wm.max_level with wm.num_levels, since that generally
results in nicer looking code (for-loops can be in standard
form etc.).

Also get rid of the two different wrappers we have for this
(ilk_wm_max_level() and intel_wm_num_levels()). They don't
really do anything for us other than potentially slow things
down if the compiler actually emits the function calls every
time (num_planes*num_wm_levels*higher_level_wm_function_calls
could be a big number). The watermark code already shows up
far too prominently in cpu profiles. Though I must admit that
I didn't look at the generated code this time.

v2: Fix the ilk_wm_merge() off-by-one (Jani)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230209222504.31478-1-ville.syrjala@linux.intel.com
20 months agodrm/i915: Populate wm.max_level for everyone
Ville Syrjälä [Thu, 9 Feb 2023 00:32:50 +0000 (02:32 +0200)]
drm/i915: Populate wm.max_level for everyone

Switch ilk+ and skl+ platforms to also setting up
wm.max_level and remove a bunch of if ladders as a result.

There will be a tiny change in the debugfs on CHV machines
that have DVFS disabled in the BIOS. Presviously debugfs
would show the latency for the DVFS level as well, but
that will no longer be the case. Which is arguably better
as that number is absolutely meaningless when DVFS can't
be enabled anyway.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230209003251.32021-1-ville.syrjala@linux.intel.com
20 months agodrm/i915/mtl: Initialize empty clockgating hooks for MTL
Radhakrishna Sripada [Wed, 11 Jan 2023 23:55:24 +0000 (15:55 -0800)]
drm/i915/mtl: Initialize empty clockgating hooks for MTL

Clock gating hooks to be initialized for MTL are yet to be implemented.
Use a nop till we identify relevant WA's here.

Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230111235531.3353815-3-radhakrishna.sripada@intel.com
20 months agodrm/i915/dg2: Drop one PCI ID
Matt Roper [Wed, 8 Feb 2023 20:09:05 +0000 (12:09 -0800)]
drm/i915/dg2: Drop one PCI ID

The bspec was recently updated to remove PCI ID 0x5698; this ID is
actually reserved for future use and should not be treated as DG2-G11.

Bspec: 44477
Fixes: 8618b8489ba6 ("drm/i915: DG2 and ATS-M device ID updates")
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208200905.680865-1-matthew.d.roper@intel.com
20 months agoRevert "drm/i915/hwmon: Enable PL1 power limit"
Ashutosh Dixit [Wed, 8 Feb 2023 19:03:12 +0000 (11:03 -0800)]
Revert "drm/i915/hwmon: Enable PL1 power limit"

This reverts commit 0349c41b05968befaffa5fbb7e73d0ee6004f610.

0349c41b0596 ("drm/i915/hwmon: Enable PL1 power limit") is incorrect and
caused a major regression on ATSM. The change enabled the PL1 power limit
but FW sets the default value of the PL1 limit to 0 which implies HW now
works at minimum power and therefore the lowest effective frequency. This
means all workloads now run slower resulting in even GuC FW load operations
timing out, rendering ATSM unusable.

A different solution to the original issue of the PL1 limit being disabled
on ATSM is needed but till that is developed, revert 0349c41b0596.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8062
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208190312.1611335-1-ashutosh.dixit@intel.com
20 months agodrm/i915/bios: set default backlight controller index
Jani Nikula [Tue, 7 Feb 2023 11:16:26 +0000 (13:16 +0200)]
drm/i915/bios: set default backlight controller index

With backlight controller set to -1 in intel_panel_init_alloc() to
distinguish uninitialized values, and controller later being set only if
it's present in VBT, we can end up with -1 for the controller:

    [drm:intel_bios_init_panel [i915]] VBT backlight PWM modulation
    frequency 200 Hz, active high, min brightness 0, level 255,
    controller 4294967295

There's no harm if it happens on platforms that ignore controller due to
only one backlight controller being present, like on VLV above, but play
it safe.

Fixes: bf38bba3e7d6 ("drm/i915: Try to use the correct power sequencer intiially on bxt/glk")
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230207111626.1839645-1-jani.nikula@intel.com
20 months agodrm/i915/uncore: cast iomem to avoid sparse warning
Jani Nikula [Tue, 7 Feb 2023 12:40:24 +0000 (14:40 +0200)]
drm/i915/uncore: cast iomem to avoid sparse warning

drmm_add_action_or_reset() is unaware of __iomem and the pointer needs
to be a plain void *. Cast __iomem away and back while the pointer goes
through drmm.

drivers/gpu/drm/i915/intel_uncore.c:2463:17: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/i915/intel_uncore.c:2463:17:    expected void volatile [noderef] __iomem *addr
drivers/gpu/drm/i915/intel_uncore.c:2463:17:    got void *regs
drivers/gpu/drm/i915/intel_uncore.c:2494:16: warning: incorrect type in argument 3 (different address spaces)
drivers/gpu/drm/i915/intel_uncore.c:2494:16:    expected void *data
drivers/gpu/drm/i915/intel_uncore.c:2494:16:    got void [noderef] __iomem *regs

Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230207124026.2105442-2-jani.nikula@intel.com
20 months agodrm/i915/dmc: drop "ucode" from function names
Jani Nikula [Tue, 7 Feb 2023 11:06:19 +0000 (13:06 +0200)]
drm/i915/dmc: drop "ucode" from function names

The ucode part in the init, fini, suspend and resume function names is
just unnecessary. Drop it.

Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230207110619.1821992-1-jani.nikula@intel.com
20 months agodrm/i915: Pick the backlight controller based on VBT on ICP+
Ville Syrjälä [Tue, 7 Feb 2023 06:43:37 +0000 (08:43 +0200)]
drm/i915: Pick the backlight controller based on VBT on ICP+

Use the second backlight controller on ICP+ if the VBT asks
us to do so.

On pre-MTP we also check the chicken bit to make sure the
pins have been correctly muxed by the firmware.

Cc: stable@vger.kernel.org
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8016
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230207064337.18697-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915: Populate encoder->devdata for DSI on icl+
Ville Syrjälä [Tue, 7 Feb 2023 06:43:36 +0000 (08:43 +0200)]
drm/i915: Populate encoder->devdata for DSI on icl+

We now have some eDP+DSI dual panel systems floating around
where the DSI panel is the secondary LFP and thus needs to
consult "panel type 2" in VBT in order to locate all the
other panel type dependant stuff correctly.

To that end we need to pass in the devdata to
intel_bios_init_panel_late(), otherwise it'll just assume
we want the primary panel type. So let's try to just populate
the vbt.ports[] stuff and encoder->devdata for icl+ DSI
panels as well.

We can't do this on older platforms as there we risk a DSI
port aliasing with a HDMI/DP port, which is a totally legal
thing as the DSI ports live in their own little parallel
universe.

Cc: stable@vger.kernel.org
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8016
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230207064337.18697-3-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915: Fix VBT DSI DVO port handling
Ville Syrjälä [Tue, 7 Feb 2023 06:43:35 +0000 (08:43 +0200)]
drm/i915: Fix VBT DSI DVO port handling

Turns out modern (icl+) VBTs still declare their DSI ports
as MIPI-A and MIPI-C despite the PHYs now being A and B.
Remap appropriately to allow the panels declared as MIPI-C
to work.

Cc: stable@vger.kernel.org
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8016
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230207064337.18697-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
20 months agodrm/i915: Fix memory leaks in scatterlist
Matt Atwood [Wed, 1 Feb 2023 23:28:01 +0000 (15:28 -0800)]
drm/i915: Fix memory leaks in scatterlist

This patch fixes memory leaks on error escapes in i915_scatterlist.c

Fixes: c3bfba9a2225 ("drm/i915: Check for integer truncation on scatterlist creation")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Matt Atwood <matthew.s.atwood@intel.com>
Reviewed-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230201232801.123684-1-matthew.s.atwood@intel.com
20 months agodrm/i915: Add another EHL pci id
Jonathan Gray [Mon, 6 Feb 2023 04:37:27 +0000 (15:37 +1100)]
drm/i915: Add another EHL pci id

described as "32 Execution Unit (EU) Super SKU" in:
Intel Atom x6000E Series, and Intel Pentium and Celeron N and
J Series Processors for IoT Applications
Datasheet, Volume 1
Document Number: 636112-1.6

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230206043727.46069-1-jsg@jsg.id.au
20 months agodrm/i915/hwmon: Enable PL1 power limit
Ashutosh Dixit [Fri, 3 Feb 2023 15:53:09 +0000 (07:53 -0800)]
drm/i915/hwmon: Enable PL1 power limit

Previous documentation suggested that PL1 power limit is always
enabled. However we now find this not to be the case on some
platforms (such as ATSM). Therefore enable PL1 power limit during hwmon
initialization.

Bspec: 51864

v2: Add Bspec reference (Gwan-gyeong)
v3: Add Fixes tag

Fixes: 99f55efb79114 ("drm/i915/hwmon: Power PL1 limit and TDP setting")
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230203155309.1042297-1-ashutosh.dixit@intel.com
21 months agodrm/i915/dsb: Introduce intel_dsb_finish()
Ville Syrjälä [Wed, 18 Jan 2023 16:30:31 +0000 (18:30 +0200)]
drm/i915/dsb: Introduce intel_dsb_finish()

Introduce a function to emits whatever commands we need
at the end of the DSB command buffer. For the moment we
only do the tail cacheline alignment there, but eventually
we might want to eg. emit an interrupt.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230118163040.29808-5-ville.syrjala@linux.intel.com
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
21 months agodrm/i915/dsb: Split intel_dsb_wait() from intel_dsb_commit()
Ville Syrjälä [Wed, 18 Jan 2023 16:30:30 +0000 (18:30 +0200)]
drm/i915/dsb: Split intel_dsb_wait() from intel_dsb_commit()

Starting the DSB execution vs. waiting for it stop are two
totally different things. Split intel_dsb_wait() from
intel_dsb_commit() so that we can eventually allow the DSB
to execute asynchronously.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230118163040.29808-4-ville.syrjala@linux.intel.com
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
21 months agodrm/i915/dsb: Pimp debug/error prints
Ville Syrjälä [Wed, 18 Jan 2023 16:30:29 +0000 (18:30 +0200)]
drm/i915/dsb: Pimp debug/error prints

Print the crtc/DSB id information to make it clear which DSB engine
we're talking about.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230118163040.29808-3-ville.syrjala@linux.intel.com
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
21 months agodrm/i915/fbdev: Implement fb_dirty for intel custom fb helper
Jouni Högander [Mon, 23 Jan 2023 07:44:37 +0000 (09:44 +0200)]
drm/i915/fbdev: Implement fb_dirty for intel custom fb helper

After disconnecting damage worker from update logic it's left to fbdev
emulation implementation to have fb_dirty function. Currently intel
fbdev doesn't have it. This is causing problems to features (PSR, FBC,
DRRS) relying on dirty callback.

Implement simple fb_dirty callback to deliver notifications about updates
in fb console.

v4: Add proper Fixes tag and modify commit message
v3: Check damage clip
v2: Improved commit message and added Fixes tag

Fixes: f231af498c29 ("drm/fb-helper: Disconnect damage worker from update logic")
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230123074437.475103-1-jouni.hogander@intel.com
21 months agodrm/i915/dmc: check incoming dmc id validity
Jani Nikula [Thu, 2 Feb 2023 12:04:52 +0000 (14:04 +0200)]
drm/i915/dmc: check incoming dmc id validity

Add validity checks for the dmc ids computed from pipe parameters in
intel_dmc_enable_pipe() and intel_dmc_disable_pipe(). It's slightly
difficult for humans and static analyzers alike to ensure the resulting
dmc ids are within bounds. Just check them and reject invalid ones.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/6a349c3a2b2def5fc31a48c9844ebd72ee55a22b.1675339447.git.jani.nikula@intel.com
21 months agodrm/i915/dmc: add is_valid_dmc_id() and use it
Jani Nikula [Thu, 2 Feb 2023 12:04:51 +0000 (14:04 +0200)]
drm/i915/dmc: add is_valid_dmc_id() and use it

Add a name to the dmc id validity check.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/311213ce328575a95d793a219d4dac7d947086cc.1675339447.git.jani.nikula@intel.com
21 months agodrm/i915/dmc: remove unnecessary dmc_id validity check
Jani Nikula [Thu, 2 Feb 2023 12:04:50 +0000 (14:04 +0200)]
drm/i915/dmc: remove unnecessary dmc_id validity check

The dmc_id comes from for_each_dmc_id() in parse_dmc_fw() ->
parse_dmc_fw_header() -> dmc_mmio_addr_sanity_check(). It's valid by
definition.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b4e1c862687f79861a5fa4bfa6797ecda2136fab.1675339447.git.jani.nikula@intel.com
21 months agodrm/i915/dmc: add for_each_dmc_id() and use it
Jani Nikula [Thu, 2 Feb 2023 12:04:49 +0000 (14:04 +0200)]
drm/i915/dmc: add for_each_dmc_id() and use it

The loop is duplicated many times, with slightly different ways. Unify.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8dcaa716093e6fbe75bb69ee7ac715a3f007a523.1675339447.git.jani.nikula@intel.com
21 months agodrm/i915/dmc: add proper name to dmc id enum and use it
Jani Nikula [Thu, 2 Feb 2023 12:04:48 +0000 (14:04 +0200)]
drm/i915/dmc: add proper name to dmc id enum and use it

Clarify DMC ID usage by adding enum intel_dmc_id name to the enum, and
use dmc_id as the variable name for it throughout.

Convert a switch-case to if-ladder to avoid warnings about not handling
DMC_FW_MAX enumeration constant in the switch-case.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/6912ccb411bb957c68c108b774745dbc7e0cbdc2.1675339447.git.jani.nikula@intel.com
21 months agodrm/i915: Expose SAGV state via debugfs
Ville Syrjälä [Tue, 31 Jan 2023 00:21:27 +0000 (02:21 +0200)]
drm/i915: Expose SAGV state via debugfs

Since SAGV is controlled via unidirectional pcode commands
we have no way to query the current state. So instead let's
expose the last programmed state via debugfs. This way we
can at least know whether SAGV should be enabled or not
(which can be important to know when dealing with underruns/etc.).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230131002127.29305-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915: Keep sagv status updated on icl+
Ville Syrjälä [Tue, 31 Jan 2023 00:21:26 +0000 (02:21 +0200)]
drm/i915: Keep sagv status updated on icl+

On icl+ SAGV is controlled by masking of the QGV points.
Reduce the QGV point mask to the same kind of enabled vs.
disable information that we had on previous platforms.
Will be useful in answering the question whether SAGV is
actually enabled or not.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230131002127.29305-3-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
21 months agodrm/i915: Introduce HAS_SAGV()
Ville Syrjälä [Tue, 31 Jan 2023 00:21:25 +0000 (02:21 +0200)]
drm/i915: Introduce HAS_SAGV()

Introuce a HAS_SAGV() macro to answer the question whether
the platform in general supports SAGV. intel_has_sagv() will
keep on giving us the more specific answer whether the current
device supports SAGV or not.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230131002127.29305-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915: Don't do the WM0->WM1 copy w/a if WM1 is already enabled
Ville Syrjälä [Tue, 31 Jan 2023 00:21:24 +0000 (02:21 +0200)]
drm/i915: Don't do the WM0->WM1 copy w/a if WM1 is already enabled

Due to a workaround we have to make sure the WM1 watermarks block/lines
values are sensible even when WM1 is disabled. To that end we copy those
values from WM0.

However since we now keep each wm level enabled on a per-plane basis
it doesn't seem necessary to do that copy when we already have an
enabled WM1 on the current plane. That is, we might be in a situation
where another plane can only do WM0 (and thus needs the copy) but
the current plane's WM1 is still perfectly valid (ie. fits into the
current DDB allocation).

Skipping the copy could avoid reprogramming the plane's registers
needlessly in some cases.

Fixes: a301cb0fca2d ("drm/i915: Keep plane watermarks enabled more aggressively")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230131002127.29305-1-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
21 months agodrm/i915/lvds: s/pipe_config/crtc_state/
Ville Syrjälä [Mon, 30 Jan 2023 18:05:40 +0000 (20:05 +0200)]
drm/i915/lvds: s/pipe_config/crtc_state/

Call the crtc state 'crtc_state' rather than 'pipe_config',
as is the modern style.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-9-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915/lvds: s/intel_encoder/encoder/ etc.
Ville Syrjälä [Mon, 30 Jan 2023 18:05:39 +0000 (20:05 +0200)]
drm/i915/lvds: s/intel_encoder/encoder/ etc.

Get rid of some of the annoying aliasing drm_ vs.
intel_ encoder/connector variables. Just prefer the
intel_ types.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-8-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915/lvds: s/dev_priv/i915/
Ville Syrjälä [Mon, 30 Jan 2023 18:05:38 +0000 (20:05 +0200)]
drm/i915/lvds: s/dev_priv/i915/

Do the customary s/dev_priv/i915/ rename and aliasing
'dev' pointer removal. Though various register definitions
still depend on the magic 'dev_priv' variable so not
a 100% conversion.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-7-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915/lvds: Fix whitespace
Ville Syrjälä [Mon, 30 Jan 2023 18:05:37 +0000 (20:05 +0200)]
drm/i915/lvds: Fix whitespace

Replace some stray spaces with tabs.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-6-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915/lvds: Extract intel_lvds_regs.h
Ville Syrjälä [Tue, 31 Jan 2023 09:00:52 +0000 (11:00 +0200)]
drm/i915/lvds: Extract intel_lvds_regs.h

Extract the integrated LVDS port register definitions
into their own header file.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-5-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915/lvds: Use REG_BIT() & co.
Ville Syrjälä [Mon, 30 Jan 2023 18:05:35 +0000 (20:05 +0200)]
drm/i915/lvds: Use REG_BIT() & co.

Use REG_BIT() & co. for the LVDS port register.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915/lvds: Use intel_de_rmw()
Ville Syrjälä [Mon, 30 Jan 2023 18:05:34 +0000 (20:05 +0200)]
drm/i915/lvds: Use intel_de_rmw()

Replace the hand rolled rmw stuff with intel_de_rmw().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-3-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915/lvds: Split long lines
Ville Syrjälä [Mon, 30 Jan 2023 18:05:33 +0000 (20:05 +0200)]
drm/i915/lvds: Split long lines

Split some overly long lines.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
21 months agodrm/i915: Implement workaround for CDCLK PLL disable/enable
Stanislav Lisovskiy [Mon, 30 Jan 2023 13:58:36 +0000 (15:58 +0200)]
drm/i915: Implement workaround for CDCLK PLL disable/enable

It was reported that we might get a hung and loss of register access in
some cases when CDCLK PLL is disabled and then enabled, while squashing
is enabled.
As a workaround it was proposed by HW team that SW should disable squashing
when CDCLK PLL is being reenabled.

v2: - Added WA number comment(Rodrigo Vivi)

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130135836.12738-1-stanislav.lisovskiy@intel.com
21 months agodrm/i915/hdmi: Go for scrambling only if platform supports TMDS clock > 340MHz
Ankit Nautiyal [Thu, 22 Dec 2022 04:08:51 +0000 (09:38 +0530)]
drm/i915/hdmi: Go for scrambling only if platform supports TMDS clock > 340MHz

There are cases, where devices have an HDMI1.4 retimer, and TMDS clock rate
is capped to 340MHz via VBT. In such cases scrambling might be supported
by the platform and an HDMI2.0 sink for lower TMDS rates, but not
supported by the retimer, causing blankouts.

So avoid enabling scrambling, if the TMDS clock is capped to <= 340MHz.

v2: Added comment, documenting the rationale to check for TMDS clock,
before going for scrambling. (Arun)

v3: Fixed the function name to check if source supports scrambling. (Jani)

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221222040851.3029514-1-ankit.k.nautiyal@intel.com
21 months agodrm/i915/dg1: Drop final use of IS_DG1_GRAPHICS_STEP
Matt Roper [Fri, 27 Jan 2023 22:43:13 +0000 (14:43 -0800)]
drm/i915/dg1: Drop final use of IS_DG1_GRAPHICS_STEP

All production DG1 hardware has graphics stepping B0; there is no such
thing as C0.  As such, we can simplify

        IS_DG1_GRAPHICS_STEP(uncore->i915, STEP_A0, STEP_C0)

to just match DG1 in general.

Bspec: 44463
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230127224313.4042331-4-matthew.d.roper@intel.com
21 months agodrm/i915/dg1: Drop support for pre-production steppings
Matt Roper [Fri, 27 Jan 2023 22:43:12 +0000 (14:43 -0800)]
drm/i915/dg1: Drop support for pre-production steppings

Several post-DG1 platforms have been brought up now, so we're well past
the point where we usually drop the workarounds that are only applicable
to internal/pre-production hardware.

Production DG1 hardware always has a B0 stepping for both display and
GT.

Bspec: 44463
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230127224313.4042331-3-matthew.d.roper@intel.com
21 months agodrm/i915/tgl: Drop support for pre-production steppings
Matt Roper [Fri, 27 Jan 2023 22:43:11 +0000 (14:43 -0800)]
drm/i915/tgl: Drop support for pre-production steppings

Several post-TGL platforms have been brought up now, so we're well past
the point where we usually drop the workarounds that are only applicable
to internal/pre-production hardware.

Production TGL hardware always has display stepping C0 or later and GT
stepping B0 or later (this is true for both the original TGL and the U/Y
subplatform).

Bspec 44455
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230127224313.4042331-2-matthew.d.roper@intel.com
21 months agodrm/i915: implement async_flip mode per plane tracking
Andrzej Hajda [Fri, 27 Jan 2023 15:30:02 +0000 (16:30 +0100)]
drm/i915: implement async_flip mode per plane tracking

Current implementation of async flip w/a relies on assumption that
previous atomic commit contains valid information if async_flip is still
enabled on the plane. It is incorrect. If previous commit did not modify
the plane its state->uapi.async_flip can be false. As a result DMAR/PIPE
errors can be observed:
i915 0000:00:02.0: [drm] *ERROR* Fault errors on pipe A: 0x00000080
i915 0000:00:02.0: [drm] *ERROR* Fault errors on pipe A: 0x00000080
DMAR: DRHD: handling fault status reg 2
DMAR: [DMA Read NO_PASID] Request device [00:02.0] fault addr 0x0 [fault reason 0x06] PTE Read access is not set

v2: update async_flip_planes in more reliable places (Ville)
v3: reset async_flip_planes and do_async_flip in more scenarios (Ville)
v4: move all resets to plane loops (Ville)

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230127153003.2225111-1-andrzej.hajda@intel.com
21 months agodrm/i915/psr: Split sel fetch plane configuration into arm and noarm
Jouni Högander [Mon, 30 Jan 2023 08:06:51 +0000 (10:06 +0200)]
drm/i915/psr: Split sel fetch plane configuration into arm and noarm

SEL_FETCH_CTL registers are armed immediately when plane is disabled.
SEL_FETCH_* instances of plane configuration are used when doing
selective update and normal plane register instances for full updates.
Currently all SEL_FETCH_* registers are written as a part of noarm
plane configuration. If noarm and arm plane configuration are not
happening within same vblank we may end up having plane as a part of
selective update before it's PLANE_SURF register is written.

Fix this by splitting plane selective fetch configuration into arm and
noarm versions and call them accordingly. Write SEL_FETCH_CTL in arm
version.

v3:
 - add arm suffix into intel_psr2_disable_plane_sel_fetch
v2:
 - drop color_plane parameter from arm part
 - dev_priv -> i915 in arm part

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Vinod Govindapillai <vinod.govindapillai@intel.com>
Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130080651.3796929-1-jouni.hogander@intel.com
21 months agodrm/i915/display/dsi: use intel_de_rmw if possible
Andrzej Hajda [Mon, 19 Dec 2022 13:08:44 +0000 (14:08 +0100)]
drm/i915/display/dsi: use intel_de_rmw if possible

The helper makes the code more compact and readable.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221219130844.2914001-1-andrzej.hajda@intel.com
21 months agodrm/i915/display/vlv: use intel_de_rmw if possible
Andrzej Hajda [Mon, 19 Dec 2022 09:24:28 +0000 (10:24 +0100)]
drm/i915/display/vlv: use intel_de_rmw if possible

The helper makes the code more compact and readable.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221219092428.2515430-2-andrzej.hajda@intel.com
21 months agodrm/i915/display/vlv: fix pixel overlap register update
Andrzej Hajda [Mon, 19 Dec 2022 09:24:27 +0000 (10:24 +0100)]
drm/i915/display/vlv: fix pixel overlap register update

To update properly bits in the register the mask should be used
to clear old value and then the result should be or-ed with new
value, for such updates there is separate helper intel_de_rmw.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221219092428.2515430-1-andrzej.hajda@intel.com
21 months agodrm/i915/display/fdi: use intel_de_rmw if possible
Andrzej Hajda [Thu, 15 Dec 2022 12:56:10 +0000 (13:56 +0100)]
drm/i915/display/fdi: use intel_de_rmw if possible

The helper makes the code more compact and readable.

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221215125610.1161729-1-andrzej.hajda@intel.com
21 months agodrm/i915/adlp: Fix typo for reference clock
Chaitanya Kumar Borah [Thu, 12 Jan 2023 09:41:31 +0000 (15:11 +0530)]
drm/i915/adlp: Fix typo for reference clock

Fix typo for reference clock from 24400 to 24000.

Bspec: 55409
Fixes: 626426ff9ce4 ("drm/i915/adl_p: Add cdclk support for ADL-P")
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230112094131.550252-1-chaitanya.kumar.borah@intel.com
21 months agodrm/i915/pxp: Pxp hw init should be in resume_complete
Alan Previn [Wed, 25 Jan 2023 08:26:37 +0000 (00:26 -0800)]
drm/i915/pxp: Pxp hw init should be in resume_complete

During suspend flow, i915 currently achors' on the pm_suspend_prepare
callback as the location where we quiesce the entire GPU and perform
all necessary cleanup in order to go into suspend. PXP is also called
during this time to perform the arbitration session teardown (with
the assurance no additional GEM IOCTLs will come after that could
restart the session).

However, if other devices or drivers fail their suspend_prepare, the
system will not go into suspend and i915 will be expected to resume
operation. In this case, we need to re-initialize the PXP hardware
and this really should be done within the pm_resume_complete callback
which is the correct opposing function in the resume sequence to
match pm_suspend_prepare of the suspend sequence.

Because this callback is the last thing at the end of resuming
we expect little to no impact to the rest of the i915 resume sequence
with this change.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125082637.118970-7-alan.previn.teres.alexis@intel.com
21 months agodrm/i915/pxp: Trigger the global teardown for before suspending
Alan Previn [Wed, 25 Jan 2023 08:26:36 +0000 (00:26 -0800)]
drm/i915/pxp: Trigger the global teardown for before suspending

A driver bug was recently discovered where the security firmware was
receiving internal HW signals indicating that session key expirations
had occurred. Architecturally, the firmware was expecting a response
from the GuC to acknowledge the event with the firmware side.
However the OS was in a suspended state and GuC had been reset.

Internal specifications actually required the driver to ensure
that all active sessions be properly cleaned up in such cases where
the system is suspended and the GuC potentially unable to respond.

This patch adds the global teardown code in i915's suspend_prepare
code path.

v2 : Split __pxp_global_teardown_locked helper into two variants
     for teardown-with-restart vs teardown-for-suspend/shutdown.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: Juston Li <justonli@chromium.org>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125082637.118970-6-alan.previn.teres.alexis@intel.com
21 months agodrm/i915/pxp: Invalidate all PXP fw sessions during teardown
Alan Previn [Wed, 25 Jan 2023 08:26:35 +0000 (00:26 -0800)]
drm/i915/pxp: Invalidate all PXP fw sessions during teardown

A gap was recently discovered where if an application did not
invalidate all of the stream keys (intentionally or not), and the
driver did a full PXP global teardown on the GT subsystem, we
find that future session creation would fail on the security
firmware's side of the equation. i915 is the entity that needs
ensure the sessions' state across both iGT and security firmware
are at a known clean point when performing a full global teardown.

Architecturally speaking, i915 should inspect all active sessions
and submit the invalidate-stream-key PXP command to the security
firmware for each of them. However, for the upstream i915 driver
we only support the arbitration session that can be created
so that will be the only session we will cleanup.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: Juston Li <justonli@chromium.org>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125082637.118970-5-alan.previn.teres.alexis@intel.com
21 months agomei: clean pending read with vtag on bus
Alexander Usyskin [Wed, 25 Jan 2023 08:26:34 +0000 (00:26 -0800)]
mei: clean pending read with vtag on bus

Client on bus have only one vtag map slot and should disregard the vtag
value when cleaning pending read flag.
Fixes read flow control message unexpectedly generated when
clent on bus send messages with different vtags.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Reviewed-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125082637.118970-4-alan.previn.teres.alexis@intel.com
21 months agodrm/i915/pxp: add device link between i915 and mei_pxp
Alexander Usyskin [Wed, 25 Jan 2023 08:26:33 +0000 (00:26 -0800)]
drm/i915/pxp: add device link between i915 and mei_pxp

Add device link with i915 as consumer and mei_pxp as supplier
to ensure proper ordering of power flows.

V2: condition on absence of heci_pxp to filter out DG

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125082637.118970-3-alan.previn.teres.alexis@intel.com
21 months agomei: mei-me: resume device in prepare
Alexander Usyskin [Wed, 25 Jan 2023 08:26:32 +0000 (00:26 -0800)]
mei: mei-me: resume device in prepare

Asynchronous runtime resume is not possible while the system
is suspending.
The power management subsystem resumes the device only in the
suspend phase, not in the prepare phase.
Force resume device in prepare to allow drivers on mei bus
to communicate in their prepare callbacks.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Reviewed-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125082637.118970-2-alan.previn.teres.alexis@intel.com
21 months agodrm/i915: Convert PALETTE() to _PICK_EVEN_2RANGES()
Lucas De Marchi [Fri, 20 Jan 2023 19:34:57 +0000 (11:34 -0800)]
drm/i915: Convert PALETTE() to _PICK_EVEN_2RANGES()

PALETTE() can use _PICK_EVEN_2RANGES instead of _PICK, which
reduces the size and is safer.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa<anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120193457.3295977-9-lucas.demarchi@intel.com
21 months agodrm/i915: Convert MBUS_ABOX_CTL() to _PICK_EVEN_2RANGES()
Lucas De Marchi [Fri, 20 Jan 2023 19:34:56 +0000 (11:34 -0800)]
drm/i915: Convert MBUS_ABOX_CTL() to _PICK_EVEN_2RANGES()

MBUS_ABOX_CTL() can use _PICK_EVEN_2RANGES instead of _PICK, which
reduces the size and is safer.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120193457.3295977-8-lucas.demarchi@intel.com
21 months agodrm/i915: Convert _FIA() to _PICK_EVEN_2RANGES()
Lucas De Marchi [Fri, 20 Jan 2023 19:34:55 +0000 (11:34 -0800)]
drm/i915: Convert _FIA() to _PICK_EVEN_2RANGES()

_FIA() can use _PICK_EVEN_2RANGES instead of _PICK, which reduces the
size and is safer.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120193457.3295977-7-lucas.demarchi@intel.com
21 months agodrm/i915: Convert PIPE3/PORT3 to _PICK_EVEN_2RANGES()
Lucas De Marchi [Fri, 20 Jan 2023 19:34:54 +0000 (11:34 -0800)]
drm/i915: Convert PIPE3/PORT3 to _PICK_EVEN_2RANGES()

Like done for when __var_args__ were used, but size-wise it's also
benefitial to avoid _PICK() used for 3 ports/pipes:

$ size build64/drivers/gpu/drm/i915/i915.o{.old,.new}
   text    data     bss     dec     hex filename
4026288  185703    6984 4218975  40605f build64/drivers/gpu/drm/i915/i915.o.old
4025496  185703    6984 4218183  405d47 build64/drivers/gpu/drm/i915/i915.o.new

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120193457.3295977-6-lucas.demarchi@intel.com
21 months agodrm/i915: Replace _MMIO_PHY3() with _PICK_EVEN_2RANGES()
Lucas De Marchi [Fri, 20 Jan 2023 19:34:53 +0000 (11:34 -0800)]
drm/i915: Replace _MMIO_PHY3() with _PICK_EVEN_2RANGES()

As done previously for pll, also convert users of _PHY3() to
_PICK_EVEN_2RANGES(). Size comparison of i915.o:

$ size build64/drivers/gpu/drm/i915/i915.o{.old,.new}
   text    data     bss     dec     hex filename
4026997  185703    6984 4219684  406324 build64/drivers/gpu/drm/i915/i915.o.old
4026288  185703    6984 4218975  40605f build64/drivers/gpu/drm/i915/i915.o.new

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120193457.3295977-5-lucas.demarchi@intel.com
21 months agodrm/i915: Convert pll macros to _PICK_EVEN_2RANGES
Lucas De Marchi [Fri, 20 Jan 2023 19:34:52 +0000 (11:34 -0800)]
drm/i915: Convert pll macros to _PICK_EVEN_2RANGES

Avoid the array lookup, converting the PLL macros after ICL to
_PICK_EVEN_RANGES. This provides the following reduction in code size:

$ size build64/drivers/gpu/drm/i915/i915.o{.old,.new}
   text    data     bss     dec     hex filename
4027456  185703    6984 4220143  4064ef build64/drivers/gpu/drm/i915/i915.o.old
4026997  185703    6984 4219684  406324 build64/drivers/gpu/drm/i915/i915.o.new

At the same time it's safer, avoiding out-of-bounds array access.  This
allows to remove _MMIO_PLL3() that is now unused.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120193457.3295977-4-lucas.demarchi@intel.com
21 months agodrm/i915: Fix coding style on DPLL*_ENABLE defines
Lucas De Marchi [Fri, 20 Jan 2023 19:34:51 +0000 (11:34 -0800)]
drm/i915: Fix coding style on DPLL*_ENABLE defines

Abide by the rules in the top of the header: 2 spaces for bitfield,
prefix offsets with underscore and prefer the use of REG_BIT().

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120193457.3295977-3-lucas.demarchi@intel.com
21 months agodrm/i915: Add _PICK_EVEN_2RANGES()
Lucas De Marchi [Wed, 25 Jan 2023 18:24:03 +0000 (10:24 -0800)]
drm/i915: Add _PICK_EVEN_2RANGES()

It's a constant pattern in the driver to need to use 2 ranges of MMIOs
based on port, phy, pll, etc. When that happens, instead of using
_PICK_EVEN(), _PICK() needs to be used.  Using _PICK() is discouraged
due to some reasons like:

1) It increases the code size since the array is declared
   in each call site
2) Developers need to be careful not to incur an
   out-of-bounds array access
3) Developers need to be careful that the indexes match the
   table. For that it may be that the table needs to contain
   holes, making (1) even worse.

Add a variant of _PICK_EVEN() that works with 2 ranges and selects which
one to use depending on the index value.

v2: Fix the address expansion in the example (Anusha)
v3: Also rename macro to _PICK_EVEN_2RANGES() in the documentation
    and reword it to clarify what ranges are chosen based on the index
    (Jani)

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125182403.7526-1-lucas.demarchi@intel.com
21 months agodrm/i915/mtl: Apply Wa_14013475917 for all MTL steppings
Jouni Högander [Tue, 24 Jan 2023 10:26:36 +0000 (12:26 +0200)]
drm/i915/mtl: Apply Wa_14013475917 for all MTL steppings

Wa_14013475917 has to be applied for all MTL steppings.

Bspec: 66624

Cc: Mika Kahola <mika.kahola@intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124102636.2567292-3-jouni.hogander@intel.com
21 months agodrm/i915/psr: Implement Wa_14014971492
Jouni Högander [Tue, 24 Jan 2023 10:26:35 +0000 (12:26 +0200)]
drm/i915/psr: Implement Wa_14014971492

Implement Wa_14014971492 and apply it for affected platforms.

Bspec: 52890, 54369, 55378, 66624

v2: Adjust platforms where applied

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124102636.2567292-2-jouni.hogander@intel.com
21 months agodrm/i915/panel: move panel fixed EDID to struct intel_panel
Jani Nikula [Wed, 25 Jan 2023 11:10:52 +0000 (13:10 +0200)]
drm/i915/panel: move panel fixed EDID to struct intel_panel

It's a bit confusing to have two cached EDIDs in struct intel_connector
with slightly different purposes. Make the distinction a bit clearer by
moving the EDID cached for eDP and LVDS panels at connector init time to
struct intel_panel, and name it fixed_edid. That's what it is, a fixed
EDID for the panels.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/328350ef918638928a8286cdbab3107c8258332d.1674643465.git.jani.nikula@intel.com
21 months agodrm/i915/opregion: convert intel_opregion_get_edid() to struct drm_edid
Jani Nikula [Wed, 25 Jan 2023 11:10:51 +0000 (13:10 +0200)]
drm/i915/opregion: convert intel_opregion_get_edid() to struct drm_edid

Simplify validation and use by converting to drm_edid.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/6abb01f1e97d54a3c11bec24377f035df412b492.1674643465.git.jani.nikula@intel.com
21 months agodrm/i915/bios: convert intel_bios_init_panel() to drm_edid
Jani Nikula [Wed, 25 Jan 2023 11:10:50 +0000 (13:10 +0200)]
drm/i915/bios: convert intel_bios_init_panel() to drm_edid

Try to use struct drm_edid where possible, even if having to fall back
to looking into struct edid down low via drm_edid_raw().

v2: Rebase

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/897807d62f74f690a173ecd405e25c6ccdd63b98.1674643465.git.jani.nikula@intel.com
21 months agodrm/i915/edid: convert DP, HDMI and LVDS to drm_edid
Jani Nikula [Wed, 25 Jan 2023 11:10:49 +0000 (13:10 +0200)]
drm/i915/edid: convert DP, HDMI and LVDS to drm_edid

Convert all the connectors that use cached connector edid and
detect_edid to drm_edid.

Since drm_get_edid() calls drm_connector_update_edid_property() while
drm_edid_read*() do not, we need to call drm_edid_connector_update()
separately, in part due to the EDID caching behaviour in HDMI and
DP. Especially DP depends on the details parsed from EDID. (The big
behavioural change conflating EDID reading with parsing and property
update was done in commit 5186421cbfe2 ("drm: Introduce epoch counter to
drm_connector"))

v6: Rebase on drm_edid_connector_add_modes()

v5: Fix potential uninitialized var use (kernel test robot <lkp@intel.com>)

v4: Call drm_edid_connector_update() after reading HDMI/DP EDID

v3: Don't leak vga switcheroo EDID in LVDS init (Ville)

v2: Don't leak opregion fallback EDID (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/eabb4de932841b38b34cc2818ea9fbf7c10224fd.1674643465.git.jani.nikula@intel.com
21 months agodrm/i915/params: use generics for parameter debugfs file creation
Jani Nikula [Wed, 18 Jan 2023 15:18:00 +0000 (17:18 +0200)]
drm/i915/params: use generics for parameter debugfs file creation

Replace the __builtin_strcmp() if ladder with generics.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230118151800.3669913-4-jani.nikula@intel.com
21 months agodrm/i915/params: use generics for parameter free
Jani Nikula [Wed, 18 Jan 2023 15:17:59 +0000 (17:17 +0200)]
drm/i915/params: use generics for parameter free

Replace the __builtin_strcmp() if ladder with generics.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230118151800.3669913-3-jani.nikula@intel.com
21 months agodrm/i915/params: use generics for parameter dup
Jani Nikula [Wed, 18 Jan 2023 15:17:58 +0000 (17:17 +0200)]
drm/i915/params: use generics for parameter dup

Replace the __builtin_strcmp() if ladder with generics.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230118151800.3669913-2-jani.nikula@intel.com
21 months agodrm/i915/params: use generics for parameter printing
Jani Nikula [Wed, 18 Jan 2023 15:17:57 +0000 (17:17 +0200)]
drm/i915/params: use generics for parameter printing

Replace the __builtin_strcmp() if ladder with generics.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230118151800.3669913-1-jani.nikula@intel.com
21 months agodrm/i915/display: add intel_display_limits.h for key enums
Jani Nikula [Mon, 16 Jan 2023 16:46:44 +0000 (18:46 +0200)]
drm/i915/display: add intel_display_limits.h for key enums

Move a handful of key enums to a new file intel_display_limits.h. These
are the enum types, and the MAX/NUM enumerations within them, that are
used in other headers. Otherwise, there's no common theme between them.

Replace intel_display.h include with intel_display_limit.h where
relevant, and add the intel_display.h include directly in the .c files
where needed.

Since intel_display.h is used almost everywhere in display/, include it
from intel_display_types.h to avoid massive changes across the
board. There are very few files that would need intel_display_types.h
but not intel_display.h so this is neglible, and further cleanup between
these headers can be left for the future.

Overall this change drops the direct and indirect dependencies on
intel_display.h from about 300 to about 100 compilation units, because
we can drop the include from i915_drv.h.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230116164644.1752009-1-jani.nikula@intel.com
21 months agodrm/i915/gmch: move VGA set state to GMCH code
Jani Nikula [Tue, 17 Jan 2023 12:33:09 +0000 (14:33 +0200)]
drm/i915/gmch: move VGA set state to GMCH code

This is the only user for the GMCH bridge device in display. Move it to
GMCH code.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/9bd50fe508246a547cf6e7abfe44ed686a4b3e3a.1673958757.git.jani.nikula@intel.com
21 months agodrm/i915/gmch: mass rename dev_priv to i915
Jani Nikula [Tue, 17 Jan 2023 12:33:08 +0000 (14:33 +0200)]
drm/i915/gmch: mass rename dev_priv to i915

Prefer the contemporary naming.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/3e4aaadeb4a027165f5724027963aa5e8d747190.1673958757.git.jani.nikula@intel.com
21 months agodrm/i915/gmch: split out soc/intel_gmch
Jani Nikula [Tue, 17 Jan 2023 12:33:07 +0000 (14:33 +0200)]
drm/i915/gmch: split out soc/intel_gmch

The GMCH related code is a bit too low level and out of place for the
high level i915_driver.c file. Split out to a separate file under
soc/. Rename the functions accordingly.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/980a5e08b397bc0dbccf93cd84798772233ce75c.1673958757.git.jani.nikula@intel.com
21 months agodrm/i915: add gmch substruct to struct drm_i915_private
Jani Nikula [Tue, 17 Jan 2023 12:33:06 +0000 (14:33 +0200)]
drm/i915: add gmch substruct to struct drm_i915_private

Group the GMCH related members together.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c10c8f16cb5d12041e009f788bd9810225d6962d.1673958757.git.jani.nikula@intel.com
21 months agodrm/i915/audio: Clean up the PCH type checks
Ville Syrjälä [Tue, 24 Jan 2023 14:46:28 +0000 (16:46 +0200)]
drm/i915/audio: Clean up the PCH type checks

Use explicit PCH type checks to make it more clear
which platforms use which codepaths.

Also reorder the branches in ibx_audio_regs_init()
a bit to be more in chronological order.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-14-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: s/ilk/ibx/
Ville Syrjälä [Tue, 24 Jan 2023 14:46:27 +0000 (16:46 +0200)]
drm/i915/audio: s/ilk/ibx/

Rename the ilk stuff to ibx, as the audio logic lives
in the PCH. The only exception are VLV/CHV but their audio
hardware was stolen from ibx so the name still fits.

Also most of the register defines also use the IBX namespace.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-13-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: Include ELD in the state dump
Ville Syrjälä [Tue, 24 Jan 2023 14:46:26 +0000 (16:46 +0200)]
drm/i915/audio: Include ELD in the state dump

Include the ELD has a hex blob in the crtc state dump.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-12-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: Hook up ELD into the state checker
Ville Syrjälä [Tue, 24 Jan 2023 14:46:25 +0000 (16:46 +0200)]
drm/i915/audio: Hook up ELD into the state checker

Have the state checker validate the ELD. For now we'll
just dump it out as a hex buffer on a mismatch, maybe
someone will get inspired to decode it properly at some
point...

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-11-ville.syrjala@linux.intel.com
21 months agodrm/i915/sdvo: Do ELD hardware readout
Ville Syrjälä [Tue, 24 Jan 2023 14:46:24 +0000 (16:46 +0200)]
drm/i915/sdvo: Do ELD hardware readout

Read out the ELD from the hw so the state checker can verify it.

v2: Check the "ELD valid" bit separately
v3: Fix ELD tx rate handling during readout

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com> #v1
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-10-ville.syrjala@linux.intel.com
21 months agodrm/i915/sdvo: Only use "presence detect" for has_audio readout
Ville Syrjälä [Tue, 24 Jan 2023 14:46:23 +0000 (16:46 +0200)]
drm/i915/sdvo: Only use "presence detect" for has_audio readout

Align the SDVO audio code with the native HDMI/DP audio and
use just the "presence detect" bit for the has_audio readout.
The "ELD valid" bit will be used for ELD readout soon.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-9-ville.syrjala@linux.intel.com
21 months agodrm/i915/sdvo: Precompute the ELD
Ville Syrjälä [Tue, 24 Jan 2023 14:46:22 +0000 (16:46 +0200)]
drm/i915/sdvo: Precompute the ELD

Use the precomputed crtc_state->eld for audio setup on SDVO
just like we do with native HDMI.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-8-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: Hardware ELD readout
Ville Syrjälä [Tue, 24 Jan 2023 14:46:21 +0000 (16:46 +0200)]
drm/i915/audio: Hardware ELD readout

Read out the ELD from the hardware buffer, or from our stashed
copy for the audio component, so that we can hook up the state
checker to validate it.

v2: Deal with the platforms using acomp

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com> #v1
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-7-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: Don't enable audio with bogus ELD
Ville Syrjälä [Tue, 24 Jan 2023 14:46:20 +0000 (16:46 +0200)]
drm/i915/audio: Don't enable audio with bogus ELD

Currently we just print a debug message if the ELD is bogus.
Maybe we should just not enable audio at all in that case?

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-6-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: Precompute the ELD
Ville Syrjälä [Tue, 24 Jan 2023 14:46:19 +0000 (16:46 +0200)]
drm/i915/audio: Precompute the ELD

Stash the ELD into the crtc_state and precompute it. This gets
rid of the ugly ELD mutation during intel_audio_codec_enable(),
and opens the door for the state checker.

v2: Make another copy for the acomp hooks (Chaitanya)
    Split out the bogus ELD handling change (Jani)

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com> #v1
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-5-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: Introduce a struct for the acomp audio state
Ville Syrjälä [Tue, 24 Jan 2023 14:46:18 +0000 (16:46 +0200)]
drm/i915/audio: Introduce a struct for the acomp audio state

Currently we're spreading the stashed state for use of the
audio component hooks all over the place. Start collecting
it up into a single spot.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-4-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: Don't program the hardware ELD buffer on hsw+
Ville Syrjälä [Tue, 24 Jan 2023 14:46:17 +0000 (16:46 +0200)]
drm/i915/audio: Don't program the hardware ELD buffer on hsw+

Since we use the audio component to transfer the ELD to the audio
driver on hsw+ platforms there is no point in even programming
the hardware ELD buffer. Stop doing so.

The one slight caveat here is that this is not strictly legal
according to the HDA spec. PD=1;ELD=0 is only documented as
an intermediate state during modeset. But if there is no hardware
that depends on that then I guess we're fine. Or we could
perhaps set ELD=1 without actually programming the buffer?

Note that the bspec sequence of PD=0;ELD=0 -> PD=1;ELD=0 ->
PD=1;ELD=1 is also not strictly correct according to the HDA
spec, as the only documented transition from PD=0;ELD=0 is
straight to PD=1;ELD=1.

Additionally on hsw/bdw the hardware buffer is tied in with the
dedicated display HDA controller's power state, so currently
we mostly fail at proramming the buffer anyway. When the HDA
side is not sufficiently powered up the ELD address bits get
stuck and the ELD data register accesses go nowhere.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
References: https://lore.kernel.org/intel-gfx/20221012104936.30911-1-ville.syrjala@linux.intel.com/
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-3-ville.syrjala@linux.intel.com
21 months agodrm/i915/audio: Don't program the hardware ELD buffer on ilk+
Ville Syrjälä [Tue, 24 Jan 2023 14:46:16 +0000 (16:46 +0200)]
drm/i915/audio: Don't program the hardware ELD buffer on ilk+

Since we use the audio component to transfer the ELD to the audio
driver on ilk+ platforms there is no point in even programming
the hardware ELD buffer. Stop doing so.

The one slight caveat here is that this is not strictly legal
according to the HDA spec. PD=1;ELD=0 is only documented as
an intermediate state during modeset. But if there is no hardware
that depends on that then I guess we're fine. Or we could
perhaps set ELD=1 without actually programming the buffer?

Note that the bspec sequence of PD=0;ELD=0 -> PD=1;ELD=0 ->
PD=1;ELD=1 is also not strictly correct according to the HDA
spec, as the only documented transition from PD=0;ELD=0 is
straight to PD=1;ELD=1. But that is not even possible on
these platforms as the bits live in different registers.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124144628.4649-2-ville.syrjala@linux.intel.com
21 months agoMerge drm/drm-next into drm-intel-next
Jani Nikula [Wed, 25 Jan 2023 09:41:16 +0000 (11:41 +0200)]
Merge drm/drm-next into drm-intel-next

Backmerge to get the EDID handling changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
21 months agoMerge tag 'drm-misc-next-2023-01-24' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Wed, 25 Jan 2023 02:14:07 +0000 (12:14 +1000)]
Merge tag 'drm-misc-next-2023-01-24' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v6.3:

UAPI Changes:

Cross-subsystem Changes:

Core Changes:

 * EDID: Improved mode parsing and refactoring

 * fbdev: Cleanups

 * format-helper: Add conversion from XRGB8888 to XBGR8888 and ABGR8888

Driver Changes:

 * accel/ivpu: Add driver for Intel VPU accelerator

 * bridge: Support i.MX93 LDB plus DT bindings

 * exynos: Fixes

 * panel: vtdr6130: Fixes; Support AUO A030JTN01 plus DT bindings

 * simpledrm: Support system-memory framebuffers plus DT bindings

 * ssd130x: Fix sparse warning

Signed-off-by: Dave Airlie <airlied@redhat.com>
# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmPQN9YACgkQaA3BHVML
# eiNmmQf/bTV3oaMo55i3tYxhMCWYDtPVk+GGglDAykW7Lid8pvy6mJqJoW6uvgQF
# c6CcoY+6yG2WvnVLhXyhPaACiG5weQSdu3S/DdZ2nuJCb50YCwWNNKcu3qYnLVlz
# 2NQ/s0HN+Xvvy76GJFNarKlxSNADPWCNJ8wExAdBkWr7q8NiDfsWuMGrQRQORrm3
# zEkSJPKtWNHa+vmsQOO9yebD0LFx97CoU40FrVXZTtF0FugGIXjiknQwekzuFxdY
# fGBiFKsI+Y3s51gAppbmRRJ0jGLj3KDF5S+5GM8FNbgJQF67Wxttl/YtY6lJGcsa
# l0vpRoCe1ilhNVvoikzAu7UewkPKKA==
# =GLLt
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 25 Jan 2023 05:56:06 AEST
# gpg:                using RSA key 7217FBAC8CE9CF6344A168E5680DC11D530B7A23
# gpg: Can't check signature: No public key
From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/Y9A5ceDknyQixM3R@linux-uq9g
21 months agoMerge tag 'amd-drm-next-6.3-2023-01-20' of https://gitlab.freedesktop.org/agd5f/linux...
Dave Airlie [Wed, 25 Jan 2023 02:07:53 +0000 (12:07 +1000)]
Merge tag 'amd-drm-next-6.3-2023-01-20' of https://gitlab.freedesktop.org/agd5f/linux into drm-next

amd-drm-next-6.3-2023-01-20:

amdgpu:
- Secure display fixes
- Fix scaling
- Misc code cleanups
- Display BW alloc logic updates
- DCN 3.2 fixes
- Fix power reporting on certain firmwares for CZN/RN
- SR-IOV fixes
- Link training cleanup and code rework
- HDCP fixes
- Reserved VMID fix
- Documentation updates
- Colorspace fixes
- RAS updates
- GC11.0 fixes
- VCN instance harvesting fixes
- DCN 3.1.4/5 workarounds for S/G displays
- Add PCIe info to the INFO IOCTL

amdkfd:
- XNACK fix

UAPI:
- Add PCIe gen/lanes info to the amdgpu INFO IOCTL
  Nesa ultimately plans to use this to make decisions about buffer placement optimizations
  Mesa MR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20790

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230120234523.7610-1-alexander.deucher@amd.com