Noralf Trønnes [Thu, 23 Jan 2025 16:34:25 +0000 (17:34 +0100)]
MAINTAINERS: Remove Noralf Trønnes as driver maintainer
Remove myself as maintainer for gud, mi0283qt, panel-mipi-dbi and repaper.
My fatigue illness has finally closed the door on doing development of
even moderate complexity so it's sad to let this go.
Olivier Moysan [Wed, 8 Jan 2025 17:03:56 +0000 (18:03 +0100)]
drm: bridge: adv7511: remove s32 format from i2s capabilities
The ADV7511 chip allows 24 bits samples max in I2S mode, excepted for
direct AES3 mode (SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE format).
However the HDMI codec exposes S32_LE format as supported.
Adapt ADV7511 HDMI I2S format list to expose formats actually supported.
Olivier Moysan [Wed, 8 Jan 2025 17:03:55 +0000 (18:03 +0100)]
ASoC: hdmi-codec: allow to refine formats actually supported
Currently the hdmi-codec driver registers all the formats that are
allowed on the I2S bus. Add i2s_formats field to codec data, to allow
the hdmi codec client to refine the list of the audio I2S formats
actually supported.
Olivier Moysan [Wed, 8 Jan 2025 17:03:54 +0000 (18:03 +0100)]
drm: bridge: adv7511: fill stream capabilities
Set no_i2s_capture and no_spdif_capture flags in hdmi_codec_pdata structure
to report that the ADV7511 HDMI bridge does not support i2s or spdif audio
capture.
Zhi Wang [Fri, 24 Jan 2025 18:29:57 +0000 (10:29 -0800)]
drm/nouveau: support handling the return of large GSP message
The max GSP message element size is 16 pages (including the headers). To
send a message larger than 16 pages, nvkm should split it into multiple
and send them accordingly. The first element has the expected function
number, while the rest are sent with function number as
NV_VGPU_MSG_FUNCTION_CONTINUATION_RECORD. GSP consumes the elements from
the cmdq and always writes the result back to the msgq. The result is also
formed as split elements.
However, nvkm is able to split the large GSP message and send them, but
totally not aware of handling the return of the large GSP message, which
are the split elements in the msgq. Thus, it keeps dumping the unknown RPC
messages from msgq, which is actually CONTINUATION_RECORD message,
discard them unexpectedly. Thus, the caller will not be able to consume
the result from GSP.
Introduce the handling of the return of large GSP message on the msgq path.
Slightly re-factor the low-level part of msg receiving routines. Merge the
split elements back into a large element before handling it to the upper
level. Thus, the upper-level of GSP RPC APIs don't need to be heavily
changed.
Zhi Wang [Fri, 24 Jan 2025 18:29:56 +0000 (10:29 -0800)]
drm/nouveau: factor out r535_gsp_msgq_recv_one_elem()
Prepare for supporting receive the large GSP RPC message.
Factor out r535_gsp_msgq_recv_one_elem(). Fold its params into a data
structure of params. Move the allocation of the GSP RPC message to its
caller. Refine the variable names in the re-factor.
Zhi Wang [Fri, 24 Jan 2025 18:29:55 +0000 (10:29 -0800)]
drm/nouveau: factor out r535_gsp_msgq_peek()
To receive a GSP message queue element from the GSP status queue, the
driver needs to make sure there are available elements in the queue.
The previous r535_gsp_msgq_wait() consists of three functions, which is
a little too complicated for a single function:
- wait for an available element.
- peek the message element header in the queue.
- recevice the element from the queue.
Factor out r535_gsp_msgq_peek() and divide the functions in
r535_gsp_msgq_wait() into three functions.
Wayne Lin [Mon, 13 Jan 2025 09:11:00 +0000 (17:11 +0800)]
drm/dp_mst: Add helper to get port number at specific LCT from RAD
Add a helper drm_dp_mst_get_ufp_num_at_lct_from_rad() to extract the up
facing port number at specific link count from the RAD. Use the added
helper in drm_dp_mst_rad_to_str() & drm_dp_get_mst_branch_device() to
unify the implementation.
V2:
- Adjust the code format (Lyude)
V3:
- Adjust parameter "rad" of drm_dp_mst_get_ufp_num_at_lct_from_rad() to
be constant (Kernel test robot)
Cc: Imre Deak <imre.deak@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Harry Wentland <hwentlan@amd.com> Cc: Lyude Paul <lyude@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
[fixed commit message typo] Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250113091100.3314533-3-Wayne.Lin@amd.com
Wayne Lin [Mon, 13 Jan 2025 09:10:59 +0000 (17:10 +0800)]
drm/dp_mst: Fix drm RAD print
[Why]
The RAD of sideband message printed today is incorrect.
For RAD stored within MST branch
- If MST branch LCT is 1, it's RAD array is untouched and remained as 0.
- If MST branch LCT is larger than 1, use nibble to store the up facing
port number in cascaded sequence as illustrated below:
In drm_dp_mst_rad_to_str(), it wrongly to use BIT_MASK(4) to fetch the port
number of one nibble.
[How]
Adjust the code by:
- RAD array items are valuable only for LCT >= 1.
- Use 0xF as the mask to replace BIT_MASK(4)
V2:
- Document how RAD is constructed (Imre)
V3:
- Adjust the comment for rad[] so kdoc formats it properly (Lyude)
Fixes: 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests") Cc: Imre Deak <imre.deak@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Harry Wentland <hwentlan@amd.com> Cc: Lyude Paul <lyude@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250113091100.3314533-2-Wayne.Lin@amd.com
Eric R. Smith [Thu, 19 Dec 2024 17:49:28 +0000 (13:49 -0400)]
drm: add modifiers for MediaTek tiled formats
MediaTek (MTK) uses some unique tiled memory formats
for video decoding. Add these to the uapi drm_fourcc.h
so that we can use them in Mesa, GStreamer, and other
tools/libraries.
v2:
- Classify the modifier bits into categories and provide
room for expansion (Daniel S.)
Krzysztof Kozlowski [Tue, 14 Jan 2025 14:58:40 +0000 (15:58 +0100)]
drm/omap/dss: Use syscon_regmap_lookup_by_phandle_args
Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
syscon_regmap_lookup_by_phandle() combined with getting the syscon
argument. Except simpler code this annotates within one line that given
phandle has arguments, so grepping for code would be easier.
There is also no real benefit in printing errors on missing syscon
argument, because this is done just too late: runtime check on
static/build-time data. Dtschema and Devicetree bindings offer the
static/build-time check for this already.
The drm_atomic_helper_check() calls drm_atomic_helper_check_modeset()
insternally. Document that corresponding restrictions also apply to the
drivers that call the former function (as it's easy to miss the
documentation for the latter function).
Jesse Van Gavere [Mon, 6 Jan 2025 12:10:54 +0000 (13:10 +0100)]
drm/bridge: adv7511: Switch to atomic operations
Use the atomic version of enable/disable.
To support bridges where bus format negotiation is needed such as TIDSS we
need to implement atomic_get_input_bus_fmts, prepare the driver for this by
switching the existing operations to it's atomic variants.
Thomas Zimmermann [Fri, 17 Jan 2025 10:29:10 +0000 (11:29 +0100)]
drm/ast: Hide Gens 1 to 3 TX detection in branch
Gen7 only supports ASTDP. Gens 4 to 6 support various TX chips,
except ASTDP. These boards detect the TX chips by reading the SoC
scratch register as VGACRD1.
Gens 1 to 3 only support SIL164. These boards read the DVO bit from
VGACRA3. Hence move this test behind a branch, so that it does not
run on later generations.
Thomas Zimmermann [Fri, 17 Jan 2025 10:29:09 +0000 (11:29 +0100)]
drm/ast: Initialize ASTDP in ast_post_gpu()
Remove the call to ast_dp_launch() from ast_detect_tx_chip() and
perform it unconditionally in ast_post_gpu().
Also add error handling: the detection code apparently used
ast_dp_launch() to test for a working ASTDP, falling back to VGA on
errors. As the VBIOS reports ASTDP, silently ignoring errors is
questionable behavior. With the refactoring, failing to initialize
the ASTDP will also fail probing the driver.
Thomas Zimmermann [Fri, 17 Jan 2025 10:29:08 +0000 (11:29 +0100)]
drm/ast: Refactor ast_post_gpu() by Gen
Reorganize ast_post_gpu() so that it first branches by Gen and then
by config mode and TX chip. This will later make it possible to split
up the function by Gen.
The helper ast_init_3rdtx() only handles Gen4 and Gen5, so leave it
out from the other Gens.
Thomas Zimmermann [Fri, 17 Jan 2025 10:29:07 +0000 (11:29 +0100)]
drm/ast: Detect DRAM before TX-chip
Move DRAM detection before TX-chip detection. Both steps are independent
from each other. Detection of the TX-chip is now next to posting those
chips, which can be done in a single step.
Thomas Zimmermann [Fri, 17 Jan 2025 10:29:06 +0000 (11:29 +0100)]
drm/ast: Detect wide-screen support before creating modeset pipeline
Wide-screen support is relevant for mode validation. Do not detect it
before setting up the mode-setting pipeline. Gets the function call out
of the way of other initialization code.
Louis Chauvet [Fri, 17 Jan 2025 09:04:29 +0000 (10:04 +0100)]
drm/vkms: Switch to dynamic allocation for CRTC
A specific allocation for the CRTC is not strictly necessary at this
point, but in order to implement dynamic configuration of VKMS (configFS),
it will be easier to have one allocation per CRTC.
Louis Chauvet [Fri, 17 Jan 2025 09:04:28 +0000 (10:04 +0100)]
drm/vkms: Switch to dynamic allocation for encoder
A specific allocation for the encoder is not strictly necessary at this
point, but in order to implement dynamic configuration of VKMS (configFS),
it will be easier to have one allocation per encoder.
Louis Chauvet [Fri, 17 Jan 2025 09:04:27 +0000 (10:04 +0100)]
drm/vkms: Switch to dynamic allocation for connector
A specific allocation for the connector is not strictly necessary
at this point, but in order to implement dynamic configuration of
VKMS (configFS), it will be easier to have one allocation per
connector.
Louis Chauvet [Thu, 16 Jan 2025 17:47:20 +0000 (18:47 +0100)]
drm/vkms: Switch to managed for writeback connector
The current VKMS driver uses non-managed function to create
writeback connectors. It is not an issue yet, but in order
to support multiple devices easily, convert this code to
use drm and device managed helpers.
Louis Chauvet [Thu, 16 Jan 2025 17:47:18 +0000 (18:47 +0100)]
drm: writeback: Add missing cleanup in case of initialization failure
The current implementation of drm_writeback_connector initialization does
not properly clean up all resources in case of failure (allocated
properties and possible_encoders). Add this cleaning in case of failure.
Louis Chauvet [Thu, 16 Jan 2025 17:47:17 +0000 (18:47 +0100)]
drm: writeback: Create an helper for drm_writeback_connector initialization
As the old drm and the new drmm variants of drm_writeback_connector
requires almost the same initialization, create an internal helper to do
most of the initialization work.
Currently there is no cleanup function for writeback connectors. To allows
implementation of drmm variant of writeback connector, create a cleanup
function that can be used to properly remove all the writeback-specific
properties and allocations.
This also introduce an helper to cleanup only the drm_writeback_connector
properties, so it can be used during initialization to cleanup in case of
failure.
Louis Chauvet [Thu, 16 Jan 2025 17:47:16 +0000 (18:47 +0100)]
drm/vkms: Switch to managed for crtc
The current VKMS driver uses managed function to create crtc, but
don't use it to properly clean the crtc workqueue. It is not an
issue yet, but in order to support multiple devices easily,
convert this code to use drm and device managed helpers.
Add drmm_alloc_ordered_workqueue(), a helper that provides managed ordered
workqueue cleanup. The workqueue will be destroyed with the final
reference of the DRM device.
Louis Chauvet [Thu, 16 Jan 2025 17:47:14 +0000 (18:47 +0100)]
drm/vkms: Switch to managed for encoder
The current VKMS driver uses non-managed function to create encoders. It
is not an issue yet, but in order to support multiple devices easily,
convert this code to use drm and device managed helpers.
Louis Chauvet [Thu, 16 Jan 2025 17:47:13 +0000 (18:47 +0100)]
drm/vkms: Switch to managed for connector
The current VKMS driver uses non-managed function to create connectors. It
is not an issue yet, but in order to support multiple devices easily,
convert this code to use drm and device managed helpers.
Tvrtko Ursulin [Mon, 13 Jan 2025 10:33:41 +0000 (10:33 +0000)]
drm/imagination: Use the drm_sched_job_has_dependency helper
Instead of manually peeking into the DRM scheduler implementation details
lets use the previously added helper.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Cc: Christian König <christian.koenig@amd.com> Cc: Danilo Krummrich <dakr@redhat.com> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Philipp Stanner <pstanner@redhat.com> Cc: Frank Binns <frank.binns@imgtec.com> Cc: Matt Coster <matt.coster@imgtec.com> Reviewed-by: Matt Coster <matt.coster@imgtec.com> Signed-off-by: Philipp Stanner <phasta@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20250113103341.43914-2-tvrtko.ursulin@igalia.com
Maíra Canal [Fri, 20 Dec 2024 13:37:09 +0000 (10:37 -0300)]
drm/vc4: Remove BOs seqnos
`bo->seqno`, `bo->write_seqno`, and `exec->bin_dep_seqno` are leftovers
from a time when VC4 didn't support DMA Reservation Objects. Before DMA
Resv was introduced, tracking the correspondence between BOs and jobs
through the job's seqno made sense.
However, this is no longer needed, as VC4 now supports DMA Reservation
Objects and attaches the "job done" fence to the BOs. Therefore, remove
the BOs seqnos in favor of using DMA Resv Objects.
Maíra Canal [Fri, 20 Dec 2024 13:37:08 +0000 (10:37 -0300)]
drm/vc4: Use DMA Resv to implement VC4 wait BO IOCTL
Since the BOs used by VC4 have DMA Reservation Objects attached to
them, waiting for seqnos to check BO availability is unnecessary.
Instead, `drm_gem_dma_resv_wait()` can be used.
Maíra Canal [Fri, 20 Dec 2024 13:37:07 +0000 (10:37 -0300)]
drm/vc4: Use DRM Execution Contexts
VC4 has internal copies of `drm_gem_lock_reservations()` and
`drm_gem_unlock_reservations()` within the driver. Ideally, these
hard-coded functions should be replaced with the generic functions
provided by DRM common code. However, instead of using the DRM GEM
functions to (un)lock reservations, transition to the new DRM Execution
Contexts API.
Vivek Kasireddy [Tue, 14 Jan 2025 07:57:59 +0000 (23:57 -0800)]
drm/virtio: Don't return error if virtio-gpu PCI dev is not found
While fixing a shared VGA resource ownership issue, commit 5dd8b536bbda
("drm/virtio: Lock the VGA resources during initialization") wrongly
assumed that there is always a PCI device associated with virtio-gpu
and it would return error if this device is not found during init.
This is incorrect, as virtio-gpu can be operated in MMIO mode (M68K)
where a PCI device would probably not be created for it. Therefore,
fix this issue by not erroring out if the associated PCI device is
not found during initialization.
Youssef Samir [Fri, 13 Dec 2024 18:51:10 +0000 (11:51 -0700)]
accel/qaic: Change aic100_image_table definition
aic100_image_table is currently defined as a "const char *" array,
this can potentially lead to the accidental modification of the
pointers inside. Also, checkpatch.pl gives a warning about it.
Change the type to a "const char * const" array to make the pointers
immutable, preventing accidental modification of the images' paths.
Signed-off-by: Youssef Samir <quic_yabdulra@quicinc.com> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241213185110.2469159-1-quic_jhugo@quicinc.com
Tvrtko Ursulin [Tue, 14 Jan 2025 10:59:42 +0000 (10:59 +0000)]
drm/sched: Remove weak paused submission checks
There is no need to check the boolean in the work item's prologues since
the boolean can be set at any later time anyway.
The helper which pauses submission sets it and synchronously cancels the
work and helpers which queue the work check for the flag so all should be
good.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Cc: Christian König <christian.koenig@amd.com> Cc: Danilo Krummrich <dakr@redhat.com> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Philipp Stanner <pstanner@redhat.com> Signed-off-by: Philipp Stanner <phasta@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20250114105942.64832-1-tvrtko.ursulin@igalia.com
John Keeping [Wed, 15 Jan 2025 11:01:38 +0000 (11:01 +0000)]
drm/ssd130x: ensure ssd132x pitch is correct
The bounding rectangle is adjusted to ensure it aligns to
SSD132X_SEGMENT_WIDTH, which may adjust the pitch. Calculate the pitch
after aligning the left and right edge.
John Keeping [Wed, 15 Jan 2025 11:01:37 +0000 (11:01 +0000)]
drm/ssd130x: fix ssd132x encoding
The ssd132x buffer is encoded one pixel per nibble, with two pixels in
each byte. When encoding an 8-bit greyscale input, take the top 4-bits
as the value and ensure the two pixels are distinct and do not overwrite
each other.
Maíra Canal [Mon, 13 Jan 2025 15:47:41 +0000 (12:47 -0300)]
drm/v3d: Remove `v3d->cpu_job`
CPU jobs, like Cache Clean jobs, execute synchronously once the DRM
scheduler starts running them. Consequently, a global `v3d->cpu_job`
variable is unnecessary, as everything is managed within the
`v3d_cpu_job_run()` function.
This commit removes the `v3d->cpu_job` pointer, as it is not needed.
Simona Vetter [Wed, 8 Jan 2025 17:24:16 +0000 (18:24 +0100)]
drm/atomic: clarify the rules around drm_atomic_state->allow_modeset
msm is automagically upgrading normal commits to full modesets, and
that's a big no-no:
- for one this results in full on->off->on transitions on all these
crtc, at least if you're using the usual helpers. Which seems to be
the case, and is breaking uapi
- further even if the ctm change itself would not result in flicker,
this can hide modesets for other reasons. Which again breaks the
uapi
v2: I forgot the case of adding unrelated crtc state. Add that case
and link to the existing kerneldoc explainers. This has come up in an
irc discussion with Manasi and Ville about intel's bigjoiner mode.
Also cc everyone involved in the msm irc discussion, more people
joined after I sent out v1.
v3: Wording polish from Pekka and Thomas
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@gmail.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Pekka Paalanen <pekka.paalanen@collabora.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Simon Ser <contact@emersion.fr> Cc: Manasi Navare <navaremanasi@google.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Simona Vetter <simona.vetter@intel.com> Signed-off-by: Simona Vetter <simona.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20250108172417.160831-1-simona.vetter@ffwll.ch
Lin.Cao [Thu, 26 Dec 2024 07:01:15 +0000 (12:31 +0530)]
drm/buddy: fix issue that force_merge cannot free all roots
If buddy manager have more than one roots and each root have sub-block
need to be free. When drm_buddy_fini called, the first loop of
force_merge will merge and free all of the sub block of first root,
which offset is 0x0 and size is biggest(more than have of the mm size).
In subsequent force_merge rounds, if we use 0 as start and use remaining
mm size as end, the block of other roots will be skipped in
__force_merge function. It will cause the other roots can not be freed.
Solution: use roots' offset as the start could fix this issue.
The mailbox payload pointer is void __iomem *. Casting it to u32 * is
incorrect and causes sparse warning.
cast removes address space '__iomem' of expression
Fixes: b87f920b9344 ("accel/amdxdna: Support hardware mailbox") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202501130921.ktqwsMLH-lkp@intel.com/ Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250113182617.1256094-1-lizhi.hou@amd.com
We've been unable to locate a datasheet for this panel and our partner
has not been responsive, but all Starry eDP datasheets that we can
find agree on the same timing (delay_100_500_e200) so it should be
safe to use that here instead of the super conservative timings. We'll
still go a little extra conservative and allow `hpd_absent` of 200
instead of 100 because that won't add any real-world delay in most
cases.
We'll associate the string from the EDID ("116KHD024006") with this
panel. Given that the ID is the suspicious value of 0x0004 it seems
likely that Starry doesn't always update their IDs but the string will
still work to differentiate if we ever need to in the future.
Thomas Hellström [Tue, 17 Dec 2024 14:58:46 +0000 (15:58 +0100)]
drm/ttm/pool: Restructure the pool allocation code
Simplify the pool allocation code somewhat by merging loop arguments
used by multiple functions together in a struct and simplifying the
loop. Also add documentation.
This hopefully makes the behaviour of the allocation loop
simplier to understand, but above all paves the way for upcoming
restore-while-allocating functionality.
There are no functional changes, but the "allow_pools" bool
introduced to keep current functionality could be removed as a
follow up, which would enable using write-back cached pools when
allocating memory for other caching modes, rather than to resort
to allocating from the system directly.
v15:
- Introduce this patch to simplify the upcoming patch that introduces
restore while allocating.
Boris Brezillon [Tue, 17 Dec 2024 09:24:57 +0000 (10:24 +0100)]
drm/panthor: Fix a race between the reset and suspend path
If a reset is scheduled when the suspend happens, we drop the
reset-pending info on the floor assuming the resume will fix things,
but the resume logic might try a fast reset. If we're lucky, the
fast reset fails and we fallback to a slow reset, but if the FW was
corrupted in a way that makes it partially functional (it boots but
doesn't quite do what it's expected to do), we won't notice immediately
that things are not working correctly, leading to a new reset further
down the road.
Randy Dunlap [Sat, 11 Jan 2025 06:28:32 +0000 (22:28 -0800)]
drm/panthor: fix all mmu kernel-doc comments
Use the correct format for all kernel-doc comments.
Use structname.membername for named structs.
Don't precede function names in kernel-doc with '@' sign.
Use the correct function parameter names in kernel-doc comments.
This fixes around 80 kernel-doc warnings.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Boris Brezillon <boris.brezillon@collabora.com> Cc: Steven Price <steven.price@arm.com> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@gmail.com> Cc: Simona Vetter <simona@ffwll.ch> Reviewed-by: Steven Price <steven.price@arm.com> Signed-off-by: Steven Price <steven.price@arm.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250111062832.910495-1-rdunlap@infradead.org
The code that changes hdmi->ref_clk was accidentally copied from
downstream code that sets a different clock. We don't actually
want to set any clock here at all.
Setting this clock incorrectly leads to incorrect timings for
DDC, CEC, and HDCP signal generation.
No Fixes listed, as the theoretical timing error in DDC appears to
still be within tolerances and harmless - and HDCP and CEC are not
yet supported.
Lizhi Hou [Thu, 9 Jan 2025 19:48:11 +0000 (11:48 -0800)]
accel/amdxdna: Return error when setting clock failed for npu1
Due to miss returning error when setting clock, the smatch static
checker reports warning:
drivers/accel/amdxdna/aie2_smu.c:68 npu1_set_dpm()
error: uninitialized symbol 'freq'.
Fixes: f4d7b8a6bc8c ("accel/amdxdna: Enhance power management settings") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/dri-devel/202267d0-882e-4593-b58d-be9274592f9b@stanley.mountain/ Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250109194811.499505-1-lizhi.hou@amd.com
Tvrtko Ursulin [Fri, 15 Nov 2024 10:21:51 +0000 (10:21 +0000)]
dma-fence: Add a single fence fast path for fence merging
Testing some workloads in two different scenarios, such as games running
under Gamescope on a Steam Deck, or vkcube under a Plasma desktop, shows
that in a significant portion of calls the dma_fence_unwrap_merge helper
is called with just a single unsignalled fence.
Therefore it is worthile to add a fast path for that case and so bypass
the memory allocation and insertion sort attempts.
Tested scenarios:
1) Hogwarts Legacy under Gamescope
~1500 calls per second to __dma_fence_unwrap_merge.
Percentages per number of fences buckets, before and after checking for
signalled status, sorting and flattening:
N Before After
0 0.85%
1 69.80% -> The new fast path.
2-9 29.36% 9% (Ie. 91% of this bucket flattened to 1 fence)
10-19
20-40
50+
2) Cyberpunk 2077 under Gamescope
~2400 calls per second.
N Before After
0 0.71%
1 52.53% -> The new fast path.
2-9 44.38% 50.60% (Ie. half resolved to a single fence)
10-19 2.34%
20-40 0.06%
50+
3) vkcube under Plasma
90 calls per second.
N Before After
0
1
2-9 100% 0% (Ie. all resolved to a single fence)
10-19
20-40
50+
In the case of vkcube all invocations in the 2-9 bucket were actually
just two input fences.
v2:
* Correct local variable name and hold on to unsignaled reference. (Chistian)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Cc: Christian König <christian.koenig@amd.com> Cc: Friedrich Vock <friedrich.vock@gmx.de> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241115102153.1980-4-tursulin@igalia.com
Dmitry Osipenko [Mon, 2 Dec 2024 05:39:55 +0000 (08:39 +0300)]
drm/virtio: Factor out common dmabuf unmapping code
Move out dmabuf detachment and unmapping into separate function. This
removes duplicated code and there is no need to check the GEM's kref now,
since both bo->attached and bo->sgt are unset under held reservation lock.
Dmitry Osipenko [Fri, 29 Nov 2024 15:53:57 +0000 (18:53 +0300)]
drm/virtio: Set missing bo->attached flag
VirtIO-GPU driver now supports detachment of shmem BOs from host, but
doing it only for imported dma-bufs. Mark all shmem BOs as attached, not
just dma-bufs. This is a minor correction since detachment of a non-dmabuf
BOs not supported today.
Vivek Kasireddy [Wed, 11 Dec 2024 06:43:43 +0000 (22:43 -0800)]
drm/virtio: Lock the VGA resources during initialization
If another driver for a VGA compatible GPU (that is passthrough'd)
locks the VGA resources (by calling vga_get()), then virtio_gpu
driver would encounter the following errors and fail to load during
probe and initialization:
Invalid read at addr 0x7200005014, size 1, region '(null)', reason: rejected
Invalid write at addr 0x7200005014, size 1, region '(null)', reason: rejected
virtio_gpu virtio0: virtio: device uses modern interface but does not have VIRTIO_F_VERSION_1
virtio_gpu virtio0: probe with driver virtio_gpu failed with error -22
This issue is only seen if virtio-gpu and the other GPU are on
different PCI buses, which can happen if the user includes an
additional PCIe port and associates the VGA compatible GPU with
it while launching Qemu:
qemu-system-x86_64...
-device virtio-vga,max_outputs=1,xres=1920,yres=1080,blob=true
-device pcie-root-port,id=pcie.1,bus=pcie.0,addr=1c.0,slot=1,chassis=1,multifunction=on
-device vfio-pci,host=03:00.0,bus=pcie.1,addr=00.0 ...
In the above example, the device 03:00.0 is an Intel DG2 card and
this issue is seen when both i915 driver and virtio_gpu driver are
loading (or initializing) concurrently or when i915 is loaded first.
Note that during initalization, i915 driver does the following in
intel_vga_reset_io_mem():
vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
outb(inb(VGA_MIS_R), VGA_MIS_W);
vga_put(pdev, VGA_RSRC_LEGACY_IO);
Although, virtio-gpu might own the VGA resources initially, the
above call (in i915) to vga_get_uninterruptible() would result in
these resources being taken away, which means that virtio-gpu would
not be able to decode VGA anymore. This happens in __vga_tryget()
when it calls
pci_set_vga_state(conflict->pdev, false, pci_bits, flags);
where
pci_bits = PCI_COMMAND_MEMORY | PCI_COMMAND_IO
flags = PCI_VGA_STATE_CHANGE_DECODES | PCI_VGA_STATE_CHANGE_BRIDGE
Therefore, to solve this issue, virtio-gpu driver needs to call
vga_get() whenever it needs to reclaim and access VGA resources,
which is during initial probe and setup. After that, a call to
vga_put() would release the lock to allow other VGA compatible
devices to access these shared VGA resources.
Vivek Kasireddy [Thu, 12 Dec 2024 05:54:21 +0000 (21:54 -0800)]
drm/virtio: Fix UAF in virtgpu_dma_buf_free_obj()
Fix the following issues identified by Smatch static checker:
- The call to dma_buf_put(attach->dmabuf) after dma_buf_detach()
leads to a UAF bug as dma_buf_detach() frees the attach object.
Fix this by extracting the dmabuf object from attach and using
that in the call to dma_buf_put().
- The resv object is extracted from attach before checking to see
if attach is valid (that is !NULL) or not. Although, attach would
very likely be valid, fix this by making sure that the resv object
is used only after ensuring that attach is valid.
Fixes: 2885e575abc7 ("drm/virtio: Add helpers to initialize and free the imported object") Fixes: ca77f27a2665 ("drm/virtio: Import prime buffers from other devices as guest blobs") Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com> Cc: Gurchetan Singh <gurchetansingh@chromium.org> Cc: Chia-I Wu <olvaffe@gmail.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241212055421.775759-1-vivek.kasireddy@intel.com Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
[dmitry.osipenko@collabora.com: Edited commit title]
Karol Wachowski [Tue, 7 Jan 2025 17:32:35 +0000 (18:32 +0100)]
accel/ivpu: Add handling of VPU_JSM_STATUS_MVNCI_CONTEXT_VIOLATION_HW
Mark as invalid context of a job that returned HW context violation
error and queue work that aborts jobs from faulty context.
Add engine reset to the context abort thread handler to not only abort
currently executing jobs but also to ensure NPU invalid state recovery.
Karol Wachowski [Tue, 7 Jan 2025 17:32:34 +0000 (18:32 +0100)]
accel/ivpu: Fix locking order in ivpu_job_submit
Fix deadlock in job submission and abort handling.
When a thread aborts currently executing jobs due to a fault,
it first locks the global lock protecting submitted_jobs (#1).
After the last job is destroyed, it proceeds to release the related context
and locks file_priv (#2). Meanwhile, in the job submission thread,
the file_priv lock (#2) is taken first, and then the submitted_jobs
lock (#1) is obtained when a job is added to the submitted jobs list.
CPU0 CPU1
---- ----
(for example due to a fault) (jobs submissions keep coming)
Karol Wachowski [Tue, 7 Jan 2025 17:32:33 +0000 (18:32 +0100)]
accel/ivpu: Fix locking order in ivpu_cmdq_destroy_ioctl
Fix deadlock caused by inversed locking order in ivpu_job_submit()
and ivpu_cmdq_destroy_ioctl(). Both functions operate locking
file_priv->lock and submitted_jobs_lock.
Unlock file_priv->lock in ivpu_cmdq_destroy_ioctl() before calling
ivpu_cmdq_abort_all_jobs() function which locks submitted_jobs_lock.
That way locking order is maintained:
1) global submitted_jobs_lock first
2) per context file_priv->lock second
Karol Wachowski [Tue, 7 Jan 2025 17:32:32 +0000 (18:32 +0100)]
accel/ivpu: Set command queue management capability based on HWS
Control explicit command queue management capability bit based on
scheduling mode. Capability will be available only when hardware
scheduling mode is set.
There is no point of allowing user space to create and destroy command
queues with OS schedling mode because FW does not support all required
functionalities for correct command queue management with OS scheduling.
Return -ENODEV from command queue create/destroy/submit IOCTLs.
Karol Wachowski [Tue, 7 Jan 2025 17:32:31 +0000 (18:32 +0100)]
accel/ivpu: Fix missing MMU events from reserved SSID
Generate recovery when fault from reserved context is detected.
Add Abort (A) bit to reserved (1) SSID to ensure NPU also receives a fault.
There is no way to create a file_priv with reserved SSID
but it is still possible to receive MMU faults from that SSID
as it is a default NPU HW setting. Such situation will occur if
FW freed context related resources but still performed access to DRAM.