Skip to content

Commit b05d4cb

Browse files
committed
Merge: RHEL 10.1: DRM Main Backport (v6.15)
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/834 ## Overview The DRM backport's goal is to backport all the changes in the DRM subsystem to the kernel target version, with the biggest value being that we get the upstream hardware enablement (and bug fixes) into RHEL. The first step of the DRM backport is identifying dependencies of the DRM backport outside of `drivers/gpu`. Done in https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/825 for kernel 6.15. This MR is the second step: Backporting the changes in the DRM subsystem. Since 6.15 will be released pretty late, 6.13 and 6.14 are handled in a different MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/615 ## Dependencies: This MR depends on the DRM Dependencies Backport for 6.15 as well as on the Dependencies and Main Backports for 6.13 and 6.14: - 6.13 and 6.14 Dependencies Backport: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/627 - 6.13 and 6.14 Dependencies Backport: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/628 - 6.13 and 6.14 Dependencies Backport: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/606 - 6.13 and 6.14 Main Backport: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/615 - 6.15 Dependencies Backport: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/825 ## Omitted fixes: These fixes are omitted as they'll be backported by the DRM stable backport: Omitted-fix: 9d80698 \ Omitted-fix: 5cc3325 \ Omitted-fix: 70e5043 \ Omitted-fix: d6fb4f0 \ Omitted-fix: 8e8d76f \ Omitted-fix: 7e0351a \ Omitted-fix: d6fb4f0 \ Omitted-fix: 9c7632f \ Omitted-fix: d30f610 \ Omitted-fix: d26625d \ Omitted-fix: e22d7ac \ Omitted-fix: 791d760 \ Omitted-fix: 10646dd \ Omitted-fix: 4557cc8 \ Omitted-fix: a47e36d \ Omitted-fix: a738fa9 \ Omitted-fix: d51adf0 \ Omitted-fix: 6acbf71 \ Omitted-fix: 988b1d2 \ Omitted-fix: 69a58ef \ Omitted-fix: c1f4534 \ Omitted-fix: 5cccf10 \ Omitted-fix: 6bf4d56 \ Omitted-fix: 3393c90 \ Omitted-fix: 57145af \ Omitted-fix: 8cf8cde \ Omitted-fix: a55737d \ Omitted-fix: 99579c5 \ Omitted-fix: fb721b2 \ Omitted-fix: 9205999 \ Omitted-fix: 73eab78 \ Omitted-fix: afcad92 \ Omitted-fix: 2d5cff2 \ Omitted-fix: 34659c1 \ Omitted-fix: 6d33df6 These non-blocking fixes will be backported as well: Omitted-fix: c67c0fe \ Omitted-fix: 25b2f46 \ Omitted-fix: 1450e45 \ Omitted-fix: 50af973 \ Omitted-fix: c8c70ff \ Omitted-fix: 5307dce \ Omitted-fix: f6bfc9a ## Other: JIRA: https://issues.redhat.com/browse/RHEL-88418 Signed-off-by: José Expósito <jexposit@redhat.com> Depends: !627 Depends: !628 Depends: !606 Depends: !615 Depends: !825 [jwilson: added explicit Depends lines for dependency MRs] Signed-off-by: Jarod Wilson <jarod@redhat.com> Approved-by: Robert Foss <rfoss@kernel.org> Approved-by: Karol Herbst <kherbst@redhat.com> Approved-by: Eric Chanudet <echanude@redhat.com> Approved-by: Jan Stancek <jstancek@redhat.com> Approved-by: David Airlie <airlied@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents 36e9c0b + 047193a commit b05d4cb

File tree

1,445 files changed

+136371
-38553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,445 files changed

+136371
-38553
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NAME = Baby Opossum Posse
88
# DRM backport version
99
#
1010
RHEL_DRM_VERSION = 6
11-
RHEL_DRM_PATCHLEVEL = 14
11+
RHEL_DRM_PATCHLEVEL = 15
1212
RHEL_DRM_SUBLEVEL =
1313

1414
# *DOCUMENTATION*

drivers/accel/ivpu/ivpu_debugfs.c

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include <linux/debugfs.h>
7+
#include <linux/fault-inject.h>
78

89
#include <drm/drm_debugfs.h>
910
#include <drm/drm_file.h>
@@ -331,7 +332,7 @@ ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t si
331332
return -EINVAL;
332333

333334
ret = ivpu_rpm_get(vdev);
334-
if (ret)
335+
if (ret < 0)
335336
return ret;
336337

337338
ivpu_pm_trigger_recovery(vdev, "debugfs");
@@ -382,7 +383,7 @@ static int dct_active_set(void *data, u64 active_percent)
382383
return -EINVAL;
383384

384385
ret = ivpu_rpm_get(vdev);
385-
if (ret)
386+
if (ret < 0)
386387
return ret;
387388

388389
if (active_percent)
@@ -397,6 +398,88 @@ static int dct_active_set(void *data, u64 active_percent)
397398

398399
DEFINE_DEBUGFS_ATTRIBUTE(ivpu_dct_fops, dct_active_get, dct_active_set, "%llu\n");
399400

401+
static int priority_bands_show(struct seq_file *s, void *v)
402+
{
403+
struct ivpu_device *vdev = s->private;
404+
struct ivpu_hw_info *hw = vdev->hw;
405+
406+
for (int band = VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE;
407+
band < VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT; band++) {
408+
switch (band) {
409+
case VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE:
410+
seq_puts(s, "Idle: ");
411+
break;
412+
413+
case VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL:
414+
seq_puts(s, "Normal: ");
415+
break;
416+
417+
case VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS:
418+
seq_puts(s, "Focus: ");
419+
break;
420+
421+
case VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME:
422+
seq_puts(s, "Realtime: ");
423+
break;
424+
}
425+
426+
seq_printf(s, "grace_period %9u process_grace_period %9u process_quantum %9u\n",
427+
hw->hws.grace_period[band], hw->hws.process_grace_period[band],
428+
hw->hws.process_quantum[band]);
429+
}
430+
431+
return 0;
432+
}
433+
434+
static int priority_bands_fops_open(struct inode *inode, struct file *file)
435+
{
436+
return single_open(file, priority_bands_show, inode->i_private);
437+
}
438+
439+
static ssize_t
440+
priority_bands_fops_write(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
441+
{
442+
struct seq_file *s = file->private_data;
443+
struct ivpu_device *vdev = s->private;
444+
char buf[64];
445+
u32 grace_period;
446+
u32 process_grace_period;
447+
u32 process_quantum;
448+
u32 band;
449+
int ret;
450+
451+
if (size >= sizeof(buf))
452+
return -EINVAL;
453+
454+
ret = simple_write_to_buffer(buf, sizeof(buf) - 1, pos, user_buf, size);
455+
if (ret < 0)
456+
return ret;
457+
458+
buf[ret] = '\0';
459+
ret = sscanf(buf, "%u %u %u %u", &band, &grace_period, &process_grace_period,
460+
&process_quantum);
461+
if (ret != 4)
462+
return -EINVAL;
463+
464+
if (band >= VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT)
465+
return -EINVAL;
466+
467+
vdev->hw->hws.grace_period[band] = grace_period;
468+
vdev->hw->hws.process_grace_period[band] = process_grace_period;
469+
vdev->hw->hws.process_quantum[band] = process_quantum;
470+
471+
return size;
472+
}
473+
474+
static const struct file_operations ivpu_hws_priority_bands_fops = {
475+
.owner = THIS_MODULE,
476+
.open = priority_bands_fops_open,
477+
.write = priority_bands_fops_write,
478+
.read = seq_read,
479+
.llseek = seq_lseek,
480+
.release = single_release,
481+
};
482+
400483
void ivpu_debugfs_init(struct ivpu_device *vdev)
401484
{
402485
struct dentry *debugfs_root = vdev->drm.debugfs_root;
@@ -419,6 +502,8 @@ void ivpu_debugfs_init(struct ivpu_device *vdev)
419502
&fw_trace_hw_comp_mask_fops);
420503
debugfs_create_file("fw_trace_level", 0200, debugfs_root, vdev,
421504
&fw_trace_level_fops);
505+
debugfs_create_file("hws_priority_bands", 0200, debugfs_root, vdev,
506+
&ivpu_hws_priority_bands_fops);
422507

423508
debugfs_create_file("reset_engine", 0200, debugfs_root, vdev,
424509
&ivpu_reset_engine_fops);
@@ -430,4 +515,8 @@ void ivpu_debugfs_init(struct ivpu_device *vdev)
430515
debugfs_root, vdev, &fw_profiling_freq_fops);
431516
debugfs_create_file("dct", 0644, debugfs_root, vdev, &ivpu_dct_fops);
432517
}
518+
519+
#ifdef CONFIG_FAULT_INJECTION
520+
fault_create_debugfs_attr("fail_hw", debugfs_root, &ivpu_hw_failure);
521+
#endif
433522
}

drivers/accel/ivpu/ivpu_drv.c

Lines changed: 28 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
3-
* Copyright (C) 2020-2024 Intel Corporation
3+
* Copyright (C) 2020-2025 Intel Corporation
44
*/
55

66
#include <linux/firmware.h>
77
#include <linux/module.h>
88
#include <linux/pci.h>
99
#include <linux/pm_runtime.h>
10+
#include <linux/workqueue.h>
1011
#include <generated/utsrelease.h>
1112

1213
#include <drm/drm_accel.h>
@@ -36,8 +37,6 @@
3637
#define DRIVER_VERSION_STR "1.0.0 " UTS_RELEASE
3738
#endif
3839

39-
static struct lock_class_key submitted_jobs_xa_lock_class_key;
40-
4140
int ivpu_dbg_mask;
4241
module_param_named(dbg_mask, ivpu_dbg_mask, int, 0644);
4342
MODULE_PARM_DESC(dbg_mask, "Driver debug mask. See IVPU_DBG_* macros.");
@@ -128,20 +127,18 @@ void ivpu_file_priv_put(struct ivpu_file_priv **link)
128127
kref_put(&file_priv->ref, file_priv_release);
129128
}
130129

131-
static int ivpu_get_capabilities(struct ivpu_device *vdev, struct drm_ivpu_param *args)
130+
bool ivpu_is_capable(struct ivpu_device *vdev, u32 capability)
132131
{
133-
switch (args->index) {
132+
switch (capability) {
134133
case DRM_IVPU_CAP_METRIC_STREAMER:
135-
args->value = 1;
136-
break;
134+
return true;
137135
case DRM_IVPU_CAP_DMA_MEMORY_RANGE:
138-
args->value = 1;
139-
break;
136+
return true;
137+
case DRM_IVPU_CAP_MANAGE_CMDQ:
138+
return vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW;
140139
default:
141-
return -EINVAL;
140+
return false;
142141
}
143-
144-
return 0;
145142
}
146143

147144
static int ivpu_get_param_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
@@ -167,7 +164,7 @@ static int ivpu_get_param_ioctl(struct drm_device *dev, void *data, struct drm_f
167164
args->value = vdev->platform;
168165
break;
169166
case DRM_IVPU_PARAM_CORE_CLOCK_RATE:
170-
args->value = ivpu_hw_ratio_to_freq(vdev, vdev->hw->pll.max_ratio);
167+
args->value = ivpu_hw_dpu_max_freq_get(vdev);
171168
break;
172169
case DRM_IVPU_PARAM_NUM_CONTEXTS:
173170
args->value = ivpu_get_context_count(vdev);
@@ -201,7 +198,7 @@ static int ivpu_get_param_ioctl(struct drm_device *dev, void *data, struct drm_f
201198
args->value = vdev->hw->sku;
202199
break;
203200
case DRM_IVPU_PARAM_CAPABILITIES:
204-
ret = ivpu_get_capabilities(vdev, args);
201+
args->value = ivpu_is_capable(vdev, args->index);
205202
break;
206203
default:
207204
ret = -EINVAL;
@@ -310,6 +307,9 @@ static const struct drm_ioctl_desc ivpu_drm_ioctls[] = {
310307
DRM_IOCTL_DEF_DRV(IVPU_METRIC_STREAMER_GET_DATA, ivpu_ms_get_data_ioctl, 0),
311308
DRM_IOCTL_DEF_DRV(IVPU_METRIC_STREAMER_STOP, ivpu_ms_stop_ioctl, 0),
312309
DRM_IOCTL_DEF_DRV(IVPU_METRIC_STREAMER_GET_INFO, ivpu_ms_get_info_ioctl, 0),
310+
DRM_IOCTL_DEF_DRV(IVPU_CMDQ_CREATE, ivpu_cmdq_create_ioctl, 0),
311+
DRM_IOCTL_DEF_DRV(IVPU_CMDQ_DESTROY, ivpu_cmdq_destroy_ioctl, 0),
312+
DRM_IOCTL_DEF_DRV(IVPU_CMDQ_SUBMIT, ivpu_cmdq_submit_ioctl, 0),
313313
};
314314

315315
static int ivpu_wait_for_ready(struct ivpu_device *vdev)
@@ -421,6 +421,9 @@ void ivpu_prepare_for_reset(struct ivpu_device *vdev)
421421
{
422422
ivpu_hw_irq_disable(vdev);
423423
disable_irq(vdev->irq);
424+
flush_work(&vdev->irq_ipc_work);
425+
flush_work(&vdev->irq_dct_work);
426+
flush_work(&vdev->context_abort_work);
424427
ivpu_ipc_disable(vdev);
425428
ivpu_mmu_disable(vdev);
426429
}
@@ -453,7 +456,7 @@ static const struct drm_driver driver = {
453456
.postclose = ivpu_postclose,
454457

455458
.gem_create_object = ivpu_gem_create_object,
456-
.gem_prime_import_sg_table = drm_gem_shmem_prime_import_sg_table,
459+
.gem_prime_import = ivpu_gem_prime_import,
457460

458461
.ioctls = ivpu_drm_ioctls,
459462
.num_ioctls = ARRAY_SIZE(ivpu_drm_ioctls),
@@ -465,54 +468,6 @@ static const struct drm_driver driver = {
465468
.major = 1,
466469
};
467470

468-
static void ivpu_context_abort_invalid(struct ivpu_device *vdev)
469-
{
470-
struct ivpu_file_priv *file_priv;
471-
unsigned long ctx_id;
472-
473-
mutex_lock(&vdev->context_list_lock);
474-
475-
xa_for_each(&vdev->context_xa, ctx_id, file_priv) {
476-
if (!file_priv->has_mmu_faults || file_priv->aborted)
477-
continue;
478-
479-
mutex_lock(&file_priv->lock);
480-
ivpu_context_abort_locked(file_priv);
481-
file_priv->aborted = true;
482-
mutex_unlock(&file_priv->lock);
483-
}
484-
485-
mutex_unlock(&vdev->context_list_lock);
486-
}
487-
488-
static irqreturn_t ivpu_irq_thread_handler(int irq, void *arg)
489-
{
490-
struct ivpu_device *vdev = arg;
491-
u8 irq_src;
492-
493-
if (kfifo_is_empty(&vdev->hw->irq.fifo))
494-
return IRQ_NONE;
495-
496-
while (kfifo_get(&vdev->hw->irq.fifo, &irq_src)) {
497-
switch (irq_src) {
498-
case IVPU_HW_IRQ_SRC_IPC:
499-
ivpu_ipc_irq_thread_handler(vdev);
500-
break;
501-
case IVPU_HW_IRQ_SRC_MMU_EVTQ:
502-
ivpu_context_abort_invalid(vdev);
503-
break;
504-
case IVPU_HW_IRQ_SRC_DCT:
505-
ivpu_pm_dct_irq_thread_handler(vdev);
506-
break;
507-
default:
508-
ivpu_err_ratelimited(vdev, "Unknown IRQ source: %u\n", irq_src);
509-
break;
510-
}
511-
}
512-
513-
return IRQ_HANDLED;
514-
}
515-
516471
static int ivpu_irq_init(struct ivpu_device *vdev)
517472
{
518473
struct pci_dev *pdev = to_pci_dev(vdev->drm.dev);
@@ -524,12 +479,16 @@ static int ivpu_irq_init(struct ivpu_device *vdev)
524479
return ret;
525480
}
526481

482+
INIT_WORK(&vdev->irq_ipc_work, ivpu_ipc_irq_work_fn);
483+
INIT_WORK(&vdev->irq_dct_work, ivpu_pm_irq_dct_work_fn);
484+
INIT_WORK(&vdev->context_abort_work, ivpu_context_abort_work_fn);
485+
527486
ivpu_irq_handlers_init(vdev);
528487

529488
vdev->irq = pci_irq_vector(pdev, 0);
530489

531-
ret = devm_request_threaded_irq(vdev->drm.dev, vdev->irq, ivpu_hw_irq_handler,
532-
ivpu_irq_thread_handler, IRQF_NO_AUTOEN, DRIVER_NAME, vdev);
490+
ret = devm_request_irq(vdev->drm.dev, vdev->irq, ivpu_hw_irq_handler,
491+
IRQF_NO_AUTOEN, DRIVER_NAME, vdev);
533492
if (ret)
534493
ivpu_err(vdev, "Failed to request an IRQ %d\n", ret);
535494

@@ -617,7 +576,6 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
617576
xa_init_flags(&vdev->context_xa, XA_FLAGS_ALLOC | XA_FLAGS_LOCK_IRQ);
618577
xa_init_flags(&vdev->submitted_jobs_xa, XA_FLAGS_ALLOC1);
619578
xa_init_flags(&vdev->db_xa, XA_FLAGS_ALLOC1);
620-
lockdep_set_class(&vdev->submitted_jobs_xa.xa_lock, &submitted_jobs_xa_lock_class_key);
621579
INIT_LIST_HEAD(&vdev->bo_list);
622580

623581
vdev->db_limit.min = IVPU_MIN_DB;
@@ -627,6 +585,10 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
627585
if (ret)
628586
goto err_xa_destroy;
629587

588+
ret = drmm_mutex_init(&vdev->drm, &vdev->submitted_jobs_lock);
589+
if (ret)
590+
goto err_xa_destroy;
591+
630592
ret = drmm_mutex_init(&vdev->drm, &vdev->bo_list_lock);
631593
if (ret)
632594
goto err_xa_destroy;

drivers/accel/ivpu/ivpu_drv.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#define IVPU_PLATFORM_SILICON 0
5959
#define IVPU_PLATFORM_SIMICS 2
6060
#define IVPU_PLATFORM_FPGA 3
61+
#define IVPU_PLATFORM_HSLE 4
6162
#define IVPU_PLATFORM_INVALID 8
6263

6364
#define IVPU_SCHED_MODE_AUTO -1
@@ -110,6 +111,7 @@ struct ivpu_wa_table {
110111
bool disable_clock_relinquish;
111112
bool disable_d0i3_msg;
112113
bool wp0_during_power_up;
114+
bool disable_d0i2;
113115
};
114116

115117
struct ivpu_hw_info;
@@ -142,9 +144,14 @@ struct ivpu_device {
142144
struct xa_limit db_limit;
143145
u32 db_next;
144146

147+
struct work_struct irq_ipc_work;
148+
struct work_struct irq_dct_work;
149+
struct work_struct context_abort_work;
150+
145151
struct mutex bo_list_lock; /* Protects bo_list */
146152
struct list_head bo_list;
147153

154+
struct mutex submitted_jobs_lock; /* Protects submitted_jobs */
148155
struct xarray submitted_jobs_xa;
149156
struct ivpu_ipc_consumer job_done_consumer;
150157

@@ -200,6 +207,9 @@ extern bool ivpu_force_snoop;
200207
#define IVPU_TEST_MODE_MIP_DISABLE BIT(6)
201208
#define IVPU_TEST_MODE_DISABLE_TIMEOUTS BIT(8)
202209
#define IVPU_TEST_MODE_TURBO BIT(9)
210+
#define IVPU_TEST_MODE_CLK_RELINQ_DISABLE BIT(10)
211+
#define IVPU_TEST_MODE_CLK_RELINQ_ENABLE BIT(11)
212+
#define IVPU_TEST_MODE_D0I2_DISABLE BIT(12)
203213
extern int ivpu_test_mode;
204214

205215
struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv);
@@ -208,6 +218,7 @@ void ivpu_file_priv_put(struct ivpu_file_priv **link);
208218
int ivpu_boot(struct ivpu_device *vdev);
209219
int ivpu_shutdown(struct ivpu_device *vdev);
210220
void ivpu_prepare_for_reset(struct ivpu_device *vdev);
221+
bool ivpu_is_capable(struct ivpu_device *vdev, u32 capability);
211222

212223
static inline u8 ivpu_revision(struct ivpu_device *vdev)
213224
{
@@ -282,7 +293,8 @@ static inline bool ivpu_is_simics(struct ivpu_device *vdev)
282293

283294
static inline bool ivpu_is_fpga(struct ivpu_device *vdev)
284295
{
285-
return ivpu_get_platform(vdev) == IVPU_PLATFORM_FPGA;
296+
return ivpu_get_platform(vdev) == IVPU_PLATFORM_FPGA ||
297+
ivpu_get_platform(vdev) == IVPU_PLATFORM_HSLE;
286298
}
287299

288300
static inline bool ivpu_is_force_snoop_enabled(struct ivpu_device *vdev)

0 commit comments

Comments
 (0)