Matthew Brost [Tue, 18 Jun 2024 00:38:59 +0000 (17:38 -0700)]
drm/xe: Simplify locking in new_vma
Rather than acquiring and dropping the VM / BO dma-resv around
xe_vma_create and do the same thing upon adding preempt fences or an
error, hold these locks through the entire new_vma() function.
Matthew Brost [Fri, 14 Jun 2024 06:13:43 +0000 (23:13 -0700)]
drm/xe: Invert runnable_state / pending enable check and assert
Rather than checking for pending enable and asserting runnable_state ==
1 in sched done handler, invert these. This is more robust code taking
action based on the G2H message and asserting KMD tracking state is
correct.
Michal Wajdeczko [Wed, 19 Jun 2024 21:45:55 +0000 (23:45 +0200)]
drm/xe/vf: Don't use register based TLB invalidation if VF
VF drivers can only use GuC-based TLB invalidation, as they don't
have access to the related registers. However, VFs shouldn't need
any explicit TLB invalidation before enabling CTB communication,
as there will be an implicit GGTT TLB invalidation issued by the
GuC itself as part of MMIO-based action handling.
Michal Wajdeczko [Wed, 19 Jun 2024 21:45:51 +0000 (23:45 +0200)]
drm/xe/vf: Don't apply tile workarounds if VF
The VF drivers can't apply any workarounds as they don't have
access to related registers. Since xe_wa_apply_tile_workarounds()
function is not using RTP yet, we have to add early return.
Michal Wajdeczko [Wed, 19 Jun 2024 21:45:50 +0000 (23:45 +0200)]
drm/xe/vf: Don't run any save-restore RTP actions if VF
There are no RTP save-restore actions applicable for VFs on
current platforms. If any future platform will require some,
we will need to update the RTP framework to support VF_READY
or VF_ONLY actions. In the meantime, just skip all actions if
we are running as VF driver.
Michal Wajdeczko [Thu, 20 Jun 2024 10:01:47 +0000 (12:01 +0200)]
drm/xe/vf: Disable features that do not apply to VFs
We already maintain several flags that control the availability
of features on a given device. Disable features, like PCODE or
GuC PC or GSC, that do not apply to a VF device.
Ashutosh Dixit [Wed, 19 Jun 2024 22:56:17 +0000 (15:56 -0700)]
drm/xe/oa: Remove WARN_ON's for unsupported configurations
The OA ioctl's already have drm_dbg's which are sufficient to tell the user
that OA is not supported on unsupported configurations (execlist mode and
platform gen < 12). Having additional WARN_ON's for these during driver
probe create unnecessary noise. Just remove these WARN_ON's.
drm/xe/oa: Call xe_oa_emit_oa_config() with new config when updating config
When UMD ask config to be updated, xe_oa_config_locked() was calling
xe_oa_emit_oa_config() that would use stream->oa_config but that is
only changed to the next oa_config after xe_oa_emit_oa_config() finish.
So it was setting the same config for all DRM_XE_PERF_IOCTL_CONFIG
calls.
Michal Wajdeczko [Wed, 19 Jun 2024 16:34:13 +0000 (18:34 +0200)]
drm/xe/guc: Move ARAT interrupts enabling to the upload step
Even though ARAT interrupts are enabled by default, we still want
to keep the code that enables them. But instead doing that in the
CTB enabling step, move this code to the upload step, where we
already setup few other registers related to GuC.
But dma heaps are casting both fd_flags and heap_flags into
unsigned long. This patch makes dma heaps - cma heap and
system heap have consistent types with UAPI.
Michal Wajdeczko [Tue, 18 Jun 2024 10:49:47 +0000 (12:49 +0200)]
drm/xe: Use ttm_uncached for BO with NEEDS_UC flag
We should honor requested uncached mode also at the TTM layer.
Otherwise, we risk losing updates to the memory based interrupts
source or status vectors, as those require uncached memory.
drm/panfrost: Add support for Mali on the MT8188 SoC
MediaTek MT8188 has a Mali-G57 MC3 (Valhall-JM): add a new
compatible and platform data using the same supplies and the
same power domain lists as MT8183 (one regulator, three power
domains).
Marc Gonzalez [Tue, 18 Jun 2024 16:19:59 +0000 (18:19 +0200)]
drm: bridge: simple-bridge: use devm_drm_bridge_add in probe
simple_bridge_probe() calls drm_bridge_add()
Thus, drm_bridge_remove() must be called in the remove() callback.
If we call devm_drm_bridge_add() instead, then drm_bridge_remove()
will be called automatically at device release, and the remove()
callback is no longer required.
We want to notice possible issues faced with PSR2 Region Early Transport as
early as possible -> let's revert patch disabling Region Early Transport by
default. Also eDP 1.5 Panel Replay requires Early Transport.
Jouni Högander [Tue, 18 Jun 2024 05:30:22 +0000 (08:30 +0300)]
drm/i915/psr: Disable PSR2 SU Region ET if enable_psr module parameter is set
Currently PSR2 SU Region Early Transport is enabled by default on Lunarlake
if panel supports it despite enable_psr module parameter value. This patch
makes it possible for user to limit used PSR mode and prevent SU Region
Early Transport by setting enable_psr as 2. With default (-1) PSR2 SU
Region Early Transport is allowed.
Jouni Högander [Tue, 18 Jun 2024 05:30:21 +0000 (08:30 +0300)]
drm/i915/psr: Disable Panel Replay if PSR mode is set via module parameter
If user is specifically limiting PSR mode to PSR1 or PSR2: disable Panel
Replay. With default value -1 all modes are allowed including Panel
Replay. Disabling PSR using value 0 disables Panel Replay as well.
Also own compute config helper is added for Panel Replay. This makes sense
because number of Panel Replay specific checks are increasing.
Ashutosh Dixit [Tue, 18 Jun 2024 01:46:09 +0000 (18:46 -0700)]
drm/xe/oa: Enable Xe2+ overrun mode
Enable Xe2+ overrun mode. For Xe2+, when overrun mode is enabled, there are
no partial reports at the end of buffer, making the OA buffer effectively a
non-power-of-2 size circular buffer whose size, circ_size, is a multiple of
the report size.
v2: Fix implementation of xe_oa_circ_diff/xe_oa_circ_incr (Umesh)
Ashutosh Dixit [Tue, 18 Jun 2024 01:46:08 +0000 (18:46 -0700)]
drm/xe/oa: Changes to OA_TAKEN
Rename OA_TAKEN to xe_oa_circ_diff, since xe_oa_circ_diff better describes
what the macro actually does. Also convert to function and add xe_oa_stream
arg. These will be used in the following patch.
Ashutosh Dixit [Tue, 18 Jun 2024 01:46:06 +0000 (18:46 -0700)]
drm/xe/oa: Add MMIO trigger support
Add MMIO trigger support and allow-list required registers for MMIO trigger
use case. Registers are whitelisted for the lifetime of the driver but MMIO
trigger is enabled only for the duration of the stream.
Ashutosh Dixit [Tue, 18 Jun 2024 01:46:05 +0000 (18:46 -0700)]
drm/xe/oa/uapi: OA buffer mmap
Allow the OA buffer to be mmap'd to userspace. This is needed for the MMIO
trigger use case. Even otherwise, with whitelisted OA head/tail ptr
registers, userspace can receive/interpret OA data from the mmap'd buffer
without issuing read()'s on the OA stream fd.
v2: Remove unmap_mapping_range from xe_oa_release (Thomas H)
Use vm_flags_mod (Umesh)
Ashutosh Dixit [Tue, 18 Jun 2024 01:46:04 +0000 (18:46 -0700)]
drm/xe/oa/uapi: Query OA unit properties
Implement query for properties of OA units present on a device.
v2: Clean up reserved/pad fields (Umesh)
Follow the same scheme as other query structs
v3: Skip reporting reserved engines attached to OA units
v4: Expose oa_buf_size via DRM_XE_PERF_IOCTL_INFO (Umesh)
v5: Don't expose capabilities as OR of properties (Umesh)
v6: Add extensions to query output structs: drm_xe_oa_unit,
drm_xe_query_oa_units and drm_xe_oa_stream_info
v7: Change oa_units[] array to __u64 type
Ashutosh Dixit [Tue, 18 Jun 2024 01:46:02 +0000 (18:46 -0700)]
drm/xe/oa: Add OAR support
Add OAR support to allow userspace to execute MI_REPORT_PERF_COUNT on
render engines. Configuration batches are used to program the OAR unit, as
well as modifying the render engine context image of a specified exec queue
(to have correct register values when that context switches in).
v2: Rename/refactor xe_oa_modify_self (Umesh)
v3: Move IS_MI_LRI_CMD() into xe_oa.c (Michal)
Ashutosh Dixit [Tue, 18 Jun 2024 01:46:01 +0000 (18:46 -0700)]
drm/xe/oa/uapi: Read file_operation
Implement the OA stream read file_operation. Both blocking and non-blocking
reads are supported. As part of read system call, the read copies OA perf
data from the OA buffer to the user buffer, after appending packet headers
for status and data packets.
v2: Drop OA report headers, implement DRM_XE_PERF_IOCTL_STATUS (Umesh)
v3: Introduce 'struct drm_xe_oa_stream_status'
v4: Define oa_status register bitfields (Umesh)
v5: Add extensions to 'struct drm_xe_oa_stream_status'
v6: Minor cleanup, eliminate report32 variable
v7: Use -EIO to signal to userspace to read OASTATUS using
DRM_XE_PERF_IOCTL_STATUS, change previous sites returning -EIO to
return -EINVAL
Make drm_xe_oa_stream_status bits contiguous (Jose, Umesh)
rmw oa_status bits (Umesh)
Ashutosh Dixit [Tue, 18 Jun 2024 01:46:00 +0000 (18:46 -0700)]
drm/xe/oa/uapi: Expose OA stream fd
The OA stream open perf op returns an fd with its own file_operations for
the newly initialized OA stream. These file_operations allow userspace to
enable or disable the stream, as well as apply a different metric
configuration for the OA stream. Userspace can also poll for data
availability. OA stream initialization is completed in this commit by
enabling the OA stream. When sampling is enabled this starts a hrtimer
which periodically checks for data availablility.
v2: Use stream properties for stream reconfiguration with
DRM_XE_PERF_IOCTL_CONFIG
v3: Hold runtime_pm reference across oa buffer alloc/free
v4: Fix 32 bit build
Ashutosh Dixit [Tue, 18 Jun 2024 01:45:59 +0000 (18:45 -0700)]
drm/xe/oa: OA stream initialization (OAG)
Implement majority of OA stream initialization (as part of OA stream open)
ioctl). OAG buffer is allocated for receiving perf counter samples from
HW. OAG unit is initialized and the selected OA metric configuration is
programmed into OAG unit HW using a command/batch buffer.
Ashutosh Dixit [Tue, 18 Jun 2024 01:45:58 +0000 (18:45 -0700)]
drm/xe/oa/uapi: Define and parse OA stream properties
Properties for OA streams are specified by user space, when the stream is
opened, as a chain of drm_xe_ext_set_property struct's. Parse and validate
these stream properties.
v2: Remove struct drm_xe_oa_open_param (Harish Chegondi)
Drop DRM_XE_OA_PROPERTY_POLL_OA_PERIOD_US (Umesh)
Eliminate comparison with xe_oa_max_sample_rate (Umesh)
Drop 'struct drm_xe_oa_record_header' (Umesh)
v3: s/DRM_XE_OA_PROPERTY_OA_EXPONENT/ \
DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT/ (Jose)
v4: Fix 32 bit build
v5: Add non-static function kernel doc (Michal)
Ashutosh Dixit [Tue, 18 Jun 2024 01:45:57 +0000 (18:45 -0700)]
drm/xe/oa/uapi: Add/remove OA config perf ops
Introduce add/remove config perf ops for OA. OA configurations consist of a
set of event/counter select register address/value pairs. The add_config
perf op validates and stores such configurations and also exposes them in
the metrics sysfs. These configurations will be programmed to OA unit HW
when an OA stream using a configuration is opened. The OA stream can also
switch to other stored configurations.
v2: Start config id's from 1 and other minor review comments (Umesh)
v3: Add 32 bit build
v4: Add kernel doc for non-static functions (Michal)
Ashutosh Dixit [Tue, 18 Jun 2024 01:45:56 +0000 (18:45 -0700)]
drm/xe/oa/uapi: Initialize OA units
Initialize OA unit data struct's for each gt during device probe. Also
assign OA units for hardware engines.
v2: Remove XE_OA_UNIT_OAG/XE_OA_UNIT_OAM_SAMEDIA_0 enum (Umesh)
Change mtl_oa_base to 0x13000 (Umesh)
v3: Switch to drmm_ functions and other cleanups (Michal)
Ashutosh Dixit [Tue, 18 Jun 2024 01:45:55 +0000 (18:45 -0700)]
drm/xe/oa/uapi: Add OA data formats
Add and initialize supported OA data formats for various platforms
(including Xe2). User can request OA data in any supported format.
Bspec: 52198, 60942, 61101
v2: Start 'xe_oa_format_name' enum from 0 (Umesh)
Fix error rewind with OA (Umesh)
v3: Use graphics versions rather than absolute platform names
v4: Add missing kernel doc for struct memebers and enum and other minor
changes (Michal)
Ashutosh Dixit [Tue, 18 Jun 2024 01:45:54 +0000 (18:45 -0700)]
drm/xe/perf/uapi: Add perf_stream_paranoid sysctl
Normally only superuser/root can access perf counter data. However,
superuser can set perf_stream_paranoid sysctl to 0 to allow non-privileged
users to also access perf data. perf_stream_paranoid is introduced at the
perf layer to allow different perf stream types to share this access
mechanism.
v2: Add kernel doc for non-static functions (Michal)
Ashutosh Dixit [Tue, 18 Jun 2024 01:45:53 +0000 (18:45 -0700)]
drm/xe/perf/uapi: "Perf" layer to support multiple perf counter stream types
In Xe, the plan is to support multiple types of perf counter streams (OA is
only one type of these streams). Rather than introduce NxM ioctls for
these (N perf streams with M ioctl's per perf stream), we decide to
multiplex these (N different stream types and the M ops for each of these
stream types) through a single PERF ioctl. This multiplexing is the purpose
of the PERF layer.
In addition to PERF DRM ioctl's, another set of ioctl's on the PERF fd are
defined. These are expected to be common to different PERF stream types and
therefore defined at the PERF layer itself.
v2: Add param_size to 'struct drm_xe_perf_param' (Umesh)
v3: Rename 'enum drm_xe_perf_ops' to
'enum drm_xe_perf_ioctls' (Guy Zadicario)
Add DRM_ prefix to ioctl names to indicate uapi names
v4: Add 'enum drm_xe_perf_op' previously missed out (Guy Zadicario)
v5: Squash the ops and PERF layer patches into a single patch (Umesh)
Remove param_size from struct 'drm_xe_perf_param' (Umesh)
v6: Add DRM_XE_PERF_IOCTL_STATUS
v7: Add DRM_XE_PERF_IOCTL_INFO
v8: Fix Copyright years, fix DRM_XE_PERF_TYPE_MAX, move '#include
"xe_perf.h"' to xe_perf.c, add kernel doc (Michal)
Lucas De Marchi [Tue, 18 Jun 2024 05:00:44 +0000 (22:00 -0700)]
drm/xe/xe2: Add proper check for media in Wa_14020756599
A temporary fixup was made in commit 24d0d98af1c3 ("drm/xe/xe2lpm: Fixup
Wa_14020756599") due to limitations in the RTP infra. Now that RTP has
support for OR condition that change can be removed. RTP now also
supports checking any GT, so use that instead of the more specific
xe_rtp_match_when_media2000() used in that commit.
Lucas De Marchi [Tue, 18 Jun 2024 05:00:43 +0000 (22:00 -0700)]
drm/xe/rtp: Add match on any GT
One surprising factor of GRAPHICS_VERSION()/MEDIA_VERSION() matching for
people adding new WAs is that it implicitly checks that the
graphics/media IP under check is of that specific type and not that the
device contains a media/graphics IP of that version. Add a new
*_ANY_GT() variant that can be used in that case.
Lucas De Marchi [Tue, 18 Jun 2024 05:00:42 +0000 (22:00 -0700)]
drm/xe/rtp: Allow to OR rules
Some workarounds started to depend on different set of conditions where
the action should be applied if any of them match. See e.g.
commit 24d0d98af1c3 ("drm/xe/xe2lpm: Fixup Wa_14020756599"). Add
XE_RTP_MATCH_OR that allows to implement a logical OR for the rules.
Normal precedence applies:
r1, r2, OR, r3
means
(r1 AND r2) OR r3
The check is shortcut as soon as a set of conditions match.
v2: Do not match on empty number of rules-other-than-OR evaluated
Lucas De Marchi [Tue, 18 Jun 2024 05:00:41 +0000 (22:00 -0700)]
drm/xe/rtp: Expand max rules/actions per entry
Having at most 4 rules per entry is already reaching the maximum.
Expand it to 6 to allow for more room. With the addition of OR
condition for rules, this will very soon not be sufficient.
Jocelyn Falempe [Thu, 13 Jun 2024 15:40:16 +0000 (17:40 +0200)]
drm/panic: depends on !VT_CONSOLE
The race condition between fbcon and drm_panic can only occurs if
VT_CONSOLE is set. So update drm_panic dependency accordingly.
This will make it easier for Linux distributions to enable drm_panic
by disabling VT_CONSOLE, and keeping fbcon terminal.
The only drawback is that fbcon won't display the boot kmsg, so it
should rely on userspace to do that.
At least plymouth already handle this case with
https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/224
Michal Wajdeczko [Mon, 17 Jun 2024 15:47:36 +0000 (17:47 +0200)]
drm/xe/vf: Don't touch GuC irq registers if using memory irqs
On platforms where VFs are using memory based interrupts, we
missed invalid access to no longer existing interrupt registers,
as we keep them marked with XE_REG_OPTION_VF. To fix that just
either setup memirq vectors in GuC or enable legacy interrupts.
Add this as a value for enum_drm_connector_tv_mode, represented
by the string "Mono", to generate video with no colour encoding
or bursts. Define it to have no pedestal (since only NTSC-M calls
for a pedestal).
Change default mode creation to acommodate the new tv_mode value
which comprises both 525-line and 625-line formats.
Michal Wajdeczko [Mon, 17 Jun 2024 12:26:13 +0000 (14:26 +0200)]
drm/xe: Allow const pointer when checking SR-IOV mode
It seems that more and more parts of the driver code rely on
having only a const pointer to the xe_device. Allow to check
SR-IOV mode in that code as well.
drm/i915/display: update handling of FBC when VT-d active workaround
Move the handling of the disabling FBC when VT-d is active wa
as part of the intel_fbc_check_plane(). As the hw is still there,
intel_fbc_sanitize should be able to handle the state properly.
v2: update the patch description (Jani Nikula)
v3: fix the return value in wa handling (Jani Nikula)
Jani Nikula [Fri, 14 Jun 2024 09:22:37 +0000 (12:22 +0300)]
drm/i915: use i9xx_fsb_freq() for GT clock frequency
Reuse i9xx_fsb_freq() for GT clock frequency initialization instead of
depending on rawclk_freq.
Note: If the init order was changed, we could use i915->fsb_freq
directly. However, GT clock initialization is done in
i915_driver_mmio_probe(), but intel_dram_detect() later in
i915_driver_hw_probe(), with a dependency on intel_pcode_init().
Jani Nikula [Fri, 14 Jun 2024 09:22:35 +0000 (12:22 +0300)]
drm/i915: convert fsb_freq and mem_freq to kHz
We'll want to use fsb frequency for deriving GT clock and rawclk
frequencies in the future. Increase the accuracy by converting to
kHz. Do the same for mem freq to be aligned.
Round the frequencies ending in 666 to 667.
v2: Also handle mem_freq in gen5_rps_init() (Ville)
Sean Anderson [Fri, 3 May 2024 19:29:13 +0000 (15:29 -0400)]
drm: zynqmp_kms: Fix AUX bus not getting unregistered
drm_encoder_cleanup is responsible for calling drm_bridge_detach for
each bridge attached to the encoder. zynqmp_dp_bridge_detach is in turn
responsible for unregistering the AUX bus. However, we never ended up
calling drm_encoder_cleanup in the remove or error paths, so the AUX bus
would stick around after the rest of the driver had been removed.
I don't really understand why drm_mode_config_cleanup doesn't call
drm_encoder_cleanup for us. It will call destroy (which for
simple_encoder is drm_encoder_cleanup) on encoders in the mode_config's
encoder_list.
Should drm_encoder_cleanup get called before or after
drm_atomic_helper_shutdown?
drm: xlnx: zynqmp_dpsub: Enable plane in atomic update
Unconditionally enable the DPSUB layer in the corresponding atomic plane
update callback. Setting the new display mode may require disabling and
re-enabling the CRTC. This effectively resets DPSUB to the default state
with all layers disabled. The original implementation of the plane atomic
update enables the corresponding DPSUB layer only if the framebuffer
format has changed. This would leave the layer disabled after switching to
a different display mode with the same framebuffer format.
Michal Wajdeczko [Thu, 13 Jun 2024 15:34:24 +0000 (17:34 +0200)]
drm/xe/uc: Fix and start using xe_uc_fw_sanitize()
Helper xe_uc_fw_sanitize() was defined but never used. First fix
it by properly exiting also from the LOAD_FAIL state, then use it
in GuC and HuC sanitize code.
Michal Wajdeczko [Fri, 14 Jun 2024 10:14:15 +0000 (12:14 +0200)]
drm/xe: Use fixed CCS mode when running in SR-IOV mode
We don't support changing CCS mode when running in SR-IOV mode yet.
When running as a PF driver just apply default ccs_mode=1 that VF
drivers will assume as already applied and fixed.
Dmitry Baryshkov [Thu, 13 Jun 2024 16:33:57 +0000 (19:33 +0300)]
drm/ci: mark kms_addfb_basic@addfb25-bad-modifier as passing on msm
The commit b228501ff183 ("drm/msm: merge dpu format database to MDP
formats") made get_format take modifiers into account. This makes
kms_addfb_basic@addfb25-bad-modifier pass on MDP4 and MDP5 platforms.
Ville Syrjälä [Fri, 17 May 2024 14:53:53 +0000 (17:53 +0300)]
drm/i915: Use intel_dp_has_dsc() during .compute_config()
Reuse intel_dp_has_dsc() during .compute_config() instead of
repeating some of the checks again by hand. We'll be adding
more checks to intel_dp_has_dsc() and this will make sure
we cover both .mode_valid() and .compute_config() with them.
Ville Syrjälä [Fri, 17 May 2024 14:53:51 +0000 (17:53 +0300)]
drm/i915: Extract intel_dp_has_dsc()
Extract a helper to check whether the source+sink combo
supports DSC. That basic check is needed both during mode
validation and compute config. We'll also need to add extra
checks to both places, so having a single place for it is nicer.
Dmitry Baryshkov [Fri, 14 Jun 2024 00:02:21 +0000 (03:02 +0300)]
dt-bindings: display: panel-edp-legacy: drop several eDP panels
The panel-edp-legacy.yaml includes legacy bindings for several eDP
panels which were never used in DT files present in Linux tree and most
likely have never been used with the upstream kernel. Drop compatibles
for these panels in favour of using a generic "edp-panel" device on the
AUX bus.
Dmitry Baryshkov [Fri, 14 Jun 2024 00:02:22 +0000 (03:02 +0300)]
drm/panel-edp: drop several legacy panels
The panel-edp driver supports legacy compatible strings for several eDP
panels which were never used in DT files present in Linux tree and most
likely have never been used with the upstream kernel. Drop compatibles
for these panels in favour of using a generic "edp-panel" device on the
AUX bus.
Dmitry Baryshkov [Fri, 14 Jun 2024 00:02:20 +0000 (03:02 +0300)]
drm/panel-edp: add fat warning against adding new panel compatibles
Add a fat warning against adding new panel compatibles to the panel-edp
driver. All new users of the eDP panels are supposed to use the generic
"edp-panel" compatible device on the AUX bus. The remaining compatibles
are either used by the existing DT or were used previously and are
retained for backwards compatibility.