* [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1
@ 2024-09-30 19:52 Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 01/31] accel/ivpu: Update VPU FW API headers Jacek Lawrynowicz
` (31 more replies)
0 siblings, 32 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz
Most notable changes are coredump and tracing support.
The rest are stability fixes, some refactoring and typos.
Changes in v2:
- Fix typos in FW API headers
- Split fw refactor commit into 2 commits and improved commit messages
- Fixed commit messages for state dump and power island commits
- Added limit and NULL termination for FW version string
- Documented sched_mode sysfs file
Andrzej Kacprowski (4):
accel/ivpu: Update VPU FW API headers
accel/ivpu: Allow reading dvfs_mode debugfs file
accel/ivpu: Add test_mode bit to force turbo
accel/ivpu: Fix reset_engine debugfs file logic
Jacek Lawrynowicz (11):
accel/ivpu: Rename ivpu_log_level to fw_log_level
accel/ivpu: Refactor functions in ivpu_fw_log.c
accel/ivpu: Fix fw log printing
accel/ivpu: Limit FW version string length
accel/ivpu: Stop using hardcoded DRIVER_DATE
accel/ivpu: Add auto selection logic for job scheduler
accel/ivpu: Remove invalid warnings
accel/ivpu: Increase MS info buffer size
accel/ivpu: Fix ivpu_jsm_dyndbg_control()
accel/ivpu: Remove HWS_EXTRA_EVENTS from test modes
accel/ivpu: Fix typos in ivpu_pm.c
Jakub Pawlak (1):
accel/ivpu: Add tracing for IPC/PM/JOB
Karol Wachowski (12):
accel/ivpu: Add coredump support
accel/ivpu: Set 500 ns delay between power island TRICKLE and ENABLE
accel/ivpu: Turn on autosuspend on Simics
accel/ivpu: Add FW version debugfs entry
accel/ivpu: Remove 1-tile power up Simics workaround
accel/ivpu: Add one jiffy to bo_wait_ioctl timeout value
accel/ivpu: Print JSM message result in case of error
accel/ivpu: Remove skip of clock own resource ack on Simics
accel/ivpu: Prevent recovery invocation during probe and resume
accel/ivpu: Refactor failure diagnostics during boot
accel/ivpu: Do not fail on cmdq if failed to allocate preemption
buffers
accel/ivpu: Use whole user and shave ranges for preemption buffers
Tomasz Rusinowicz (3):
accel/ivpu: Reset fw log on cold boot
accel/ivpu: Add FW state dump on TDR
accel/ivpu: Make DB_ID and JOB_ID allocations incremental
drivers/accel/ivpu/Kconfig | 1 +
drivers/accel/ivpu/Makefile | 6 +-
drivers/accel/ivpu/ivpu_coredump.c | 39 ++++
drivers/accel/ivpu/ivpu_coredump.h | 25 ++
drivers/accel/ivpu/ivpu_debugfs.c | 86 +++----
drivers/accel/ivpu/ivpu_drv.c | 52 +++--
drivers/accel/ivpu/ivpu_drv.h | 13 +-
drivers/accel/ivpu/ivpu_fw.c | 26 ++-
drivers/accel/ivpu/ivpu_fw.h | 9 +-
drivers/accel/ivpu/ivpu_fw_log.c | 113 +++++----
drivers/accel/ivpu/ivpu_fw_log.h | 17 +-
drivers/accel/ivpu/ivpu_gem.c | 3 +
drivers/accel/ivpu/ivpu_hw.c | 5 +-
drivers/accel/ivpu/ivpu_hw.h | 1 -
drivers/accel/ivpu/ivpu_hw_btrs.c | 9 -
drivers/accel/ivpu/ivpu_hw_ip.c | 8 +-
drivers/accel/ivpu/ivpu_ipc.c | 45 ++--
drivers/accel/ivpu/ivpu_ipc.h | 9 +-
drivers/accel/ivpu/ivpu_job.c | 102 +++++----
drivers/accel/ivpu/ivpu_jsm_msg.c | 34 +--
drivers/accel/ivpu/ivpu_jsm_msg.h | 2 +
drivers/accel/ivpu/ivpu_ms.c | 2 +-
drivers/accel/ivpu/ivpu_pm.c | 24 +-
drivers/accel/ivpu/ivpu_sysfs.c | 24 ++
drivers/accel/ivpu/ivpu_trace.h | 73 ++++++
drivers/accel/ivpu/ivpu_trace_points.c | 9 +
drivers/accel/ivpu/vpu_boot_api.h | 45 ++--
drivers/accel/ivpu/vpu_jsm_api.h | 303 +++++++++++++++++++++----
include/uapi/drm/ivpu_accel.h | 3 -
29 files changed, 797 insertions(+), 291 deletions(-)
create mode 100644 drivers/accel/ivpu/ivpu_coredump.c
create mode 100644 drivers/accel/ivpu/ivpu_coredump.h
create mode 100644 drivers/accel/ivpu/ivpu_trace.h
create mode 100644 drivers/accel/ivpu/ivpu_trace_points.c
--
2.45.1
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH v2 01/31] accel/ivpu: Update VPU FW API headers
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
@ 2024-09-30 19:52 ` Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 02/31] accel/ivpu: Rename ivpu_log_level to fw_log_level Jacek Lawrynowicz
` (30 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel
Cc: oded.gabbay, quic_jhugo, Andrzej Kacprowski, Tomasz Rusinowicz,
Jacek Lawrynowicz
From: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
This commit bumps:
- Boot API from 3.24.0 to 3.26.3
- JSM API from 3.16.0 to 3.25.0
Signed-off-by: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Co-developed-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_job.c | 2 +-
drivers/accel/ivpu/ivpu_jsm_msg.c | 3 +-
drivers/accel/ivpu/vpu_boot_api.h | 45 +++--
drivers/accel/ivpu/vpu_jsm_api.h | 303 +++++++++++++++++++++++++-----
4 files changed, 293 insertions(+), 60 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index be2e2bf0f43f0..b00634af8bc34 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -354,7 +354,7 @@ static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job)
return -EBUSY;
}
- entry = &cmdq->jobq->job[tail];
+ entry = &cmdq->jobq->slot[tail].job;
entry->batch_buf_addr = job->cmd_buf_vpu_addr;
entry->job_id = job->job_id;
entry->flags = 0;
diff --git a/drivers/accel/ivpu/ivpu_jsm_msg.c b/drivers/accel/ivpu/ivpu_jsm_msg.c
index 46ef16c3c0691..b06da8f50fd39 100644
--- a/drivers/accel/ivpu/ivpu_jsm_msg.c
+++ b/drivers/accel/ivpu/ivpu_jsm_msg.c
@@ -48,9 +48,10 @@ const char *ivpu_jsm_msg_type_to_str(enum vpu_ipc_msg_type type)
IVPU_CASE_TO_STR(VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE);
IVPU_CASE_TO_STR(VPU_JSM_MSG_STATE_DUMP);
IVPU_CASE_TO_STR(VPU_JSM_MSG_STATE_DUMP_RSP);
- IVPU_CASE_TO_STR(VPU_JSM_MSG_BLOB_DEINIT);
+ IVPU_CASE_TO_STR(VPU_JSM_MSG_BLOB_DEINIT_DEPRECATED);
IVPU_CASE_TO_STR(VPU_JSM_MSG_DYNDBG_CONTROL);
IVPU_CASE_TO_STR(VPU_JSM_MSG_JOB_DONE);
+ IVPU_CASE_TO_STR(VPU_JSM_MSG_NATIVE_FENCE_SIGNALLED);
IVPU_CASE_TO_STR(VPU_JSM_MSG_ENGINE_RESET_DONE);
IVPU_CASE_TO_STR(VPU_JSM_MSG_ENGINE_PREEMPT_DONE);
IVPU_CASE_TO_STR(VPU_JSM_MSG_REGISTER_DB_DONE);
diff --git a/drivers/accel/ivpu/vpu_boot_api.h b/drivers/accel/ivpu/vpu_boot_api.h
index 82954b91b7481..908e68ea1c39c 100644
--- a/drivers/accel/ivpu/vpu_boot_api.h
+++ b/drivers/accel/ivpu/vpu_boot_api.h
@@ -1,14 +1,13 @@
/* SPDX-License-Identifier: MIT */
/*
- * Copyright (c) 2020-2023, Intel Corporation.
+ * Copyright (c) 2020-2024, Intel Corporation.
*/
#ifndef VPU_BOOT_API_H
#define VPU_BOOT_API_H
/*
- * =========== FW API version information beginning ================
- * The bellow values will be used to construct the version info this way:
+ * The below values will be used to construct the version info this way:
* fw_bin_header->api_version[VPU_BOOT_API_VER_ID] = (VPU_BOOT_API_VER_MAJOR << 16) |
* VPU_BOOT_API_VER_MINOR;
* VPU_BOOT_API_VER_PATCH will be ignored. KMD and compatibility is not affected if this changes
@@ -27,19 +26,18 @@
* Minor version changes when API backward compatibility is preserved.
* Resets to 0 if Major version is incremented.
*/
-#define VPU_BOOT_API_VER_MINOR 24
+#define VPU_BOOT_API_VER_MINOR 26
/*
* API header changed (field names, documentation, formatting) but API itself has not been changed
*/
-#define VPU_BOOT_API_VER_PATCH 0
+#define VPU_BOOT_API_VER_PATCH 3
/*
* Index in the API version table
* Must be unique for each API
*/
#define VPU_BOOT_API_VER_INDEX 0
-/* ------------ FW API version information end ---------------------*/
#pragma pack(push, 4)
@@ -164,8 +162,6 @@ enum vpu_trace_destination {
/* VPU 30xx HW component IDs are sequential, so define first and last IDs. */
#define VPU_TRACE_PROC_BIT_30XX_FIRST VPU_TRACE_PROC_BIT_LRT
#define VPU_TRACE_PROC_BIT_30XX_LAST VPU_TRACE_PROC_BIT_SHV_15
-#define VPU_TRACE_PROC_BIT_KMB_FIRST VPU_TRACE_PROC_BIT_30XX_FIRST
-#define VPU_TRACE_PROC_BIT_KMB_LAST VPU_TRACE_PROC_BIT_30XX_LAST
struct vpu_boot_l2_cache_config {
u8 use;
@@ -199,6 +195,17 @@ struct vpu_warm_boot_section {
*/
#define POWER_PROFILE_SURVIVABILITY 0x1
+/**
+ * Enum for dvfs_mode boot param.
+ */
+enum vpu_governor {
+ VPU_GOV_DEFAULT = 0, /* Default Governor for the system */
+ VPU_GOV_MAX_PERFORMANCE = 1, /* Maximum performance governor */
+ VPU_GOV_ON_DEMAND = 2, /* On Demand frequency control governor */
+ VPU_GOV_POWER_SAVE = 3, /* Power save governor */
+ VPU_GOV_ON_DEMAND_PRIORITY_AWARE = 4 /* On Demand priority based governor */
+};
+
struct vpu_boot_params {
u32 magic;
u32 vpu_id;
@@ -301,7 +308,14 @@ struct vpu_boot_params {
u32 temp_sensor_period_ms;
/** PLL ratio for efficient clock frequency */
u32 pn_freq_pll_ratio;
- /** DVFS Mode: Default: 0, Max Performance: 1, On Demand: 2, Power Save: 3 */
+ /**
+ * DVFS Mode:
+ * 0 - Default, DVFS mode selected by the firmware
+ * 1 - Max Performance
+ * 2 - On Demand
+ * 3 - Power Save
+ * 4 - On Demand Priority Aware
+ */
u32 dvfs_mode;
/**
* Depending on DVFS Mode:
@@ -332,8 +346,8 @@ struct vpu_boot_params {
u64 d0i3_entry_vpu_ts;
/*
* The system time of the host operating system in microseconds.
- * E.g the number of microseconds since 1st of January 1970, or whatever date the
- * host operating system uses to maintain system time.
+ * E.g the number of microseconds since 1st of January 1970, or whatever
+ * date the host operating system uses to maintain system time.
* This value will be used to track system time on the VPU.
* The KMD is required to update this value on every VPU reset.
*/
@@ -382,10 +396,7 @@ struct vpu_boot_params {
u32 pad6[734];
};
-/*
- * Magic numbers set between host and vpu to detect corruptio of tracing init
- */
-
+/* Magic numbers set between host and vpu to detect corruption of tracing init */
#define VPU_TRACING_BUFFER_CANARY (0xCAFECAFE)
/* Tracing buffer message format definitions */
@@ -405,7 +416,9 @@ struct vpu_tracing_buffer_header {
u32 host_canary_start;
/* offset from start of buffer for trace entries */
u32 read_index;
- u32 pad_to_cache_line_size_0[14];
+ /* keeps track of wrapping on the reader side */
+ u32 read_wrap_count;
+ u32 pad_to_cache_line_size_0[13];
/* End of first cache line */
/**
diff --git a/drivers/accel/ivpu/vpu_jsm_api.h b/drivers/accel/ivpu/vpu_jsm_api.h
index 33f462b1a25d8..7215c144158cb 100644
--- a/drivers/accel/ivpu/vpu_jsm_api.h
+++ b/drivers/accel/ivpu/vpu_jsm_api.h
@@ -22,7 +22,7 @@
/*
* Minor version changes when API backward compatibility is preserved.
*/
-#define VPU_JSM_API_VER_MINOR 16
+#define VPU_JSM_API_VER_MINOR 25
/*
* API header changed (field names, documentation, formatting) but API itself has not been changed
@@ -36,7 +36,7 @@
/*
* Number of Priority Bands for Hardware Scheduling
- * Bands: RealTime, Focus, Normal, Idle
+ * Bands: Idle(0), Normal(1), Focus(2), RealTime(3)
*/
#define VPU_HWS_NUM_PRIORITY_BANDS 4
@@ -74,6 +74,7 @@
#define VPU_JSM_STATUS_MVNCI_INTERNAL_ERROR 0xCU
/* Job status returned when the job was preempted mid-inference */
#define VPU_JSM_STATUS_PREEMPTED_MID_INFERENCE 0xDU
+#define VPU_JSM_STATUS_MVNCI_CONTEXT_VIOLATION_HW 0xEU
/*
* Host <-> VPU IPC channels.
@@ -86,18 +87,58 @@
/*
* Job flags bit masks.
*/
-#define VPU_JOB_FLAGS_NULL_SUBMISSION_MASK 0x00000001
-#define VPU_JOB_FLAGS_PRIVATE_DATA_MASK 0xFF000000
+enum {
+ /*
+ * Null submission mask.
+ * When set, batch buffer's commands are not processed but returned as
+ * successful immediately, except fences and timestamps.
+ * When cleared, batch buffer's commands are processed normally.
+ * Used for testing and profiling purposes.
+ */
+ VPU_JOB_FLAGS_NULL_SUBMISSION_MASK = (1 << 0U),
+ /*
+ * Inline command mask.
+ * When set, the object in job queue is an inline command (see struct vpu_inline_cmd below).
+ * When cleared, the object in job queue is a job (see struct vpu_job_queue_entry below).
+ */
+ VPU_JOB_FLAGS_INLINE_CMD_MASK = (1 << 1U),
+ /*
+ * VPU private data mask.
+ * Reserved for the VPU to store private data about the job (or inline command)
+ * while being processed.
+ */
+ VPU_JOB_FLAGS_PRIVATE_DATA_MASK = 0xFFFF0000U
+};
/*
- * Sizes of the reserved areas in jobs, in bytes.
+ * Job queue flags bit masks.
*/
-#define VPU_JOB_RESERVED_BYTES 8
+enum {
+ /*
+ * No job done notification mask.
+ * When set, indicates that no job done notification should be sent for any
+ * job from this queue. When cleared, indicates that job done notification
+ * should be sent for every job completed from this queue.
+ */
+ VPU_JOB_QUEUE_FLAGS_NO_JOB_DONE_MASK = (1 << 0U),
+ /*
+ * Native fence usage mask.
+ * When set, indicates that job queue uses native fences (as inline commands
+ * in job queue). Such queues may also use legacy fences (as commands in batch buffers).
+ * When cleared, indicates the job queue only uses legacy fences.
+ * NOTE: For queues using native fences, VPU expects that all jobs in the queue
+ * are immediately followed by an inline command object. This object is expected
+ * to be a fence signal command in most cases, but can also be a NOP in case the host
+ * does not need per-job fence signalling. Other inline commands objects can be
+ * inserted between "job and inline command" pairs.
+ */
+ VPU_JOB_QUEUE_FLAGS_USE_NATIVE_FENCE_MASK = (1 << 1U),
-/*
- * Sizes of the reserved areas in job queues, in bytes.
- */
-#define VPU_JOB_QUEUE_RESERVED_BYTES 52
+ /*
+ * Enable turbo mode for testing NPU performance; not recommended for regular usage.
+ */
+ VPU_JOB_QUEUE_FLAGS_TURBO_MODE = (1 << 2U)
+};
/*
* Max length (including trailing NULL char) of trace entity name (e.g., the
@@ -140,24 +181,113 @@
*/
#define VPU_HWS_INVALID_CMDQ_HANDLE 0ULL
+/*
+ * Inline commands types.
+ */
+/*
+ * NOP.
+ * VPU does nothing other than consuming the inline command object.
+ */
+#define VPU_INLINE_CMD_TYPE_NOP 0x0
+/*
+ * Fence wait.
+ * VPU waits for the fence current value to reach monitored value.
+ * Fence wait operations are executed upon job dispatching. While waiting for
+ * the fence to be satisfied, VPU blocks fetching of the next objects in the queue.
+ * Jobs present in the queue prior to the fence wait object may be processed
+ * concurrently.
+ */
+#define VPU_INLINE_CMD_TYPE_FENCE_WAIT 0x1
+/*
+ * Fence signal.
+ * VPU sets the fence current value to the provided value. If new current value
+ * is equal to or higher than monitored value, VPU sends fence signalled notification
+ * to the host. Fence signal operations are executed upon completion of all the jobs
+ * present in the queue prior to them, and in-order relative to each other in the queue.
+ * But jobs in-between them may be processed concurrently and may complete out-of-order.
+ */
+#define VPU_INLINE_CMD_TYPE_FENCE_SIGNAL 0x2
+
+/*
+ * Job scheduling priority bands for both hardware scheduling and OS scheduling.
+ */
+enum vpu_job_scheduling_priority_band {
+ VPU_JOB_SCHEDULING_PRIORITY_BAND_IDLE = 0,
+ VPU_JOB_SCHEDULING_PRIORITY_BAND_NORMAL = 1,
+ VPU_JOB_SCHEDULING_PRIORITY_BAND_FOCUS = 2,
+ VPU_JOB_SCHEDULING_PRIORITY_BAND_REALTIME = 3,
+ VPU_JOB_SCHEDULING_PRIORITY_BAND_COUNT = 4,
+};
+
/*
* Job format.
+ * Jobs defines the actual workloads to be executed by a given engine.
*/
struct vpu_job_queue_entry {
- u64 batch_buf_addr; /**< Address of VPU commands batch buffer */
- u32 job_id; /**< Job ID */
- u32 flags; /**< Flags bit field, see VPU_JOB_FLAGS_* above */
- u64 root_page_table_addr; /**< Address of root page table to use for this job */
- u64 root_page_table_update_counter; /**< Page tables update events counter */
- u64 primary_preempt_buf_addr;
+ /**< Address of VPU commands batch buffer */
+ u64 batch_buf_addr;
+ /**< Job ID */
+ u32 job_id;
+ /**< Flags bit field, see VPU_JOB_FLAGS_* above */
+ u32 flags;
+ /**
+ * Doorbell ring timestamp taken by KMD from SoC's global system clock, in
+ * microseconds. NPU can convert this value to its own fixed clock's timebase,
+ * to match other profiling timestamps.
+ */
+ u64 doorbell_timestamp;
+ /**< Extra id for job tracking, used only in the firmware perf traces */
+ u64 host_tracking_id;
/**< Address of the primary preemption buffer to use for this job */
- u32 primary_preempt_buf_size;
+ u64 primary_preempt_buf_addr;
/**< Size of the primary preemption buffer to use for this job */
- u32 secondary_preempt_buf_size;
+ u32 primary_preempt_buf_size;
/**< Size of secondary preemption buffer to use for this job */
- u64 secondary_preempt_buf_addr;
+ u32 secondary_preempt_buf_size;
/**< Address of secondary preemption buffer to use for this job */
- u8 reserved_0[VPU_JOB_RESERVED_BYTES];
+ u64 secondary_preempt_buf_addr;
+ u64 reserved_0;
+};
+
+/*
+ * Inline command format.
+ * Inline commands are the commands executed at scheduler level (typically,
+ * synchronization directives). Inline command and job objects must be of
+ * the same size and have flags field at same offset.
+ */
+struct vpu_inline_cmd {
+ u64 reserved_0;
+ /* Inline command type, see VPU_INLINE_CMD_TYPE_* defines. */
+ u32 type;
+ /* Flags bit field, see VPU_JOB_FLAGS_* above. */
+ u32 flags;
+ /* Inline command payload. Depends on inline command type. */
+ union {
+ /* Fence (wait and signal) commands' payload. */
+ struct {
+ /* Fence object handle. */
+ u64 fence_handle;
+ /* User VA of the current fence value. */
+ u64 current_value_va;
+ /* User VA of the monitored fence value (read-only). */
+ u64 monitored_value_va;
+ /* Value to wait for or write in fence location. */
+ u64 value;
+ /* User VA of the log buffer in which to add log entry on completion. */
+ u64 log_buffer_va;
+ } fence;
+ /* Other commands do not have a payload. */
+ /* Payload definition for future inline commands can be inserted here. */
+ u64 reserved_1[6];
+ } payload;
+};
+
+/*
+ * Job queue slots can be populated either with job objects or inline command objects.
+ */
+union vpu_jobq_slot {
+ struct vpu_job_queue_entry job;
+ struct vpu_inline_cmd inline_cmd;
};
/*
@@ -167,7 +297,21 @@ struct vpu_job_queue_header {
u32 engine_idx;
u32 head;
u32 tail;
- u8 reserved_0[VPU_JOB_QUEUE_RESERVED_BYTES];
+ u32 flags;
+ /* Set to 1 to indicate priority_band field is valid */
+ u32 priority_band_valid;
+ /*
+ * Priority for the work of this job queue, valid only if the HWS is NOT used
+ * and the `priority_band_valid` is set to 1. It is applied only during
+ * the VPU_JSM_MSG_REGISTER_DB message processing.
+ * The device firmware might use the `priority_band` to optimize the power
+ * management logic, but it will not affect the order of jobs.
+ * Available priority bands: @see enum vpu_job_scheduling_priority_band
+ */
+ u32 priority_band;
+ /* Inside realtime band assigns a further priority, limited to 0..31 range */
+ u32 realtime_priority_level;
+ u32 reserved_0[9];
};
/*
@@ -175,7 +319,7 @@ struct vpu_job_queue_header {
*/
struct vpu_job_queue {
struct vpu_job_queue_header header;
- struct vpu_job_queue_entry job[];
+ union vpu_jobq_slot slot[];
};
/**
@@ -197,9 +341,7 @@ enum vpu_trace_entity_type {
struct vpu_hws_log_buffer_header {
/* Written by VPU after adding a log entry. Initialised by host to 0. */
u32 first_free_entry_index;
- /* Incremented by VPU every time the VPU overwrites the 0th entry;
- * initialised by host to 0.
- */
+ /* Incremented by VPU every time the VPU writes the 0th entry; initialised by host to 0. */
u32 wraparound_count;
/*
* This is the number of buffers that can be stored in the log buffer provided by the host.
@@ -230,14 +372,80 @@ struct vpu_hws_log_buffer_entry {
u64 operation_data[2];
};
+/* Native fence log buffer types. */
+enum vpu_hws_native_fence_log_type {
+ VPU_HWS_NATIVE_FENCE_LOG_TYPE_WAITS = 1,
+ VPU_HWS_NATIVE_FENCE_LOG_TYPE_SIGNALS = 2
+};
+
+/* HWS native fence log buffer header. */
+struct vpu_hws_native_fence_log_header {
+ union {
+ struct {
+ /* Index of the first free entry in buffer. */
+ u32 first_free_entry_idx;
+ /* Incremented each time NPU wraps around the buffer to write next entry. */
+ u32 wraparound_count;
+ };
+ /* Field allowing atomic update of both fields above. */
+ u64 atomic_wraparound_and_entry_idx;
+ };
+ /* Log buffer type, see enum vpu_hws_native_fence_log_type. */
+ u64 type;
+ /* Allocated number of entries in the log buffer. */
+ u64 entry_nb;
+ u64 reserved[2];
+};
+
+/* Native fence log operation types. */
+enum vpu_hws_native_fence_log_op {
+ VPU_HWS_NATIVE_FENCE_LOG_OP_SIGNAL_EXECUTED = 0,
+ VPU_HWS_NATIVE_FENCE_LOG_OP_WAIT_UNBLOCKED = 1
+};
+
+/* HWS native fence log entry. */
+struct vpu_hws_native_fence_log_entry {
+ /* Newly signaled/unblocked fence value. */
+ u64 fence_value;
+ /* Native fence object handle to which this operation belongs. */
+ u64 fence_handle;
+ /* Operation type, see enum vpu_hws_native_fence_log_op. */
+ u64 op_type;
+ u64 reserved_0;
+ /*
+ * VPU_HWS_NATIVE_FENCE_LOG_OP_WAIT_UNBLOCKED only: Timestamp at which fence
+ * wait was started (in NPU SysTime).
+ */
+ u64 fence_wait_start_ts;
+ u64 reserved_1;
+ /* Timestamp at which fence operation was completed (in NPU SysTime). */
+ u64 fence_end_ts;
+};
+
+/* Native fence log buffer. */
+struct vpu_hws_native_fence_log_buffer {
+ struct vpu_hws_native_fence_log_header header;
+ struct vpu_hws_native_fence_log_entry entry[];
+};
+
/*
* Host <-> VPU IPC messages types.
*/
enum vpu_ipc_msg_type {
VPU_JSM_MSG_UNKNOWN = 0xFFFFFFFF,
+
/* IPC Host -> Device, Async commands */
VPU_JSM_MSG_ASYNC_CMD = 0x1100,
VPU_JSM_MSG_ENGINE_RESET = VPU_JSM_MSG_ASYNC_CMD,
+ /**
+ * Preempt engine. The NPU stops (preempts) all the jobs currently
+ * executing on the target engine making the engine become idle and ready to
+ * execute new jobs.
+ * NOTE: The NPU does not remove unstarted jobs (if any) from job queues of
+ * the target engine, but it stops processing them (until the queue doorbell
+ * is rung again); the host is responsible to reset the job queue, either
+ * after preemption or when resubmitting jobs to the queue.
+ */
VPU_JSM_MSG_ENGINE_PREEMPT = 0x1101,
VPU_JSM_MSG_REGISTER_DB = 0x1102,
VPU_JSM_MSG_UNREGISTER_DB = 0x1103,
@@ -323,9 +531,10 @@ enum vpu_ipc_msg_type {
* NOTE: Please introduce new ASYNC commands before this one. *
*/
VPU_JSM_MSG_STATE_DUMP = 0x11FF,
+
/* IPC Host -> Device, General commands */
VPU_JSM_MSG_GENERAL_CMD = 0x1200,
- VPU_JSM_MSG_BLOB_DEINIT = VPU_JSM_MSG_GENERAL_CMD,
+ VPU_JSM_MSG_BLOB_DEINIT_DEPRECATED = VPU_JSM_MSG_GENERAL_CMD,
/**
* Control dyndbg behavior by executing a dyndbg command; equivalent to
* Linux command: `echo '<dyndbg_cmd>' > <debugfs>/dynamic_debug/control`.
@@ -335,8 +544,12 @@ enum vpu_ipc_msg_type {
* Perform the save procedure for the D0i3 entry
*/
VPU_JSM_MSG_PWR_D0I3_ENTER = 0x1202,
+
/* IPC Device -> Host, Job completion */
VPU_JSM_MSG_JOB_DONE = 0x2100,
+ /* IPC Device -> Host, Fence signalled */
+ VPU_JSM_MSG_NATIVE_FENCE_SIGNALLED = 0x2101,
+
/* IPC Device -> Host, Async command completion */
VPU_JSM_MSG_ASYNC_CMD_DONE = 0x2200,
VPU_JSM_MSG_ENGINE_RESET_DONE = VPU_JSM_MSG_ASYNC_CMD_DONE,
@@ -422,6 +635,7 @@ enum vpu_ipc_msg_type {
* NOTE: Please introduce new ASYNC responses before this one. *
*/
VPU_JSM_MSG_STATE_DUMP_RSP = 0x22FF,
+
/* IPC Device -> Host, General command completion */
VPU_JSM_MSG_GENERAL_CMD_DONE = 0x2300,
VPU_JSM_MSG_BLOB_DEINIT_DONE = VPU_JSM_MSG_GENERAL_CMD_DONE,
@@ -600,11 +814,6 @@ struct vpu_jsm_metric_streamer_update {
u64 next_buffer_size;
};
-struct vpu_ipc_msg_payload_blob_deinit {
- /* 64-bit unique ID for the blob to be de-initialized. */
- u64 blob_id;
-};
-
struct vpu_ipc_msg_payload_job_done {
/* Engine to which the job was submitted. */
u32 engine_idx;
@@ -622,6 +831,21 @@ struct vpu_ipc_msg_payload_job_done {
u64 cmdq_id;
};
+/*
+ * Notification message upon native fence signalling.
+ * @see VPU_JSM_MSG_NATIVE_FENCE_SIGNALLED
+ */
+struct vpu_ipc_msg_payload_native_fence_signalled {
+ /* Engine ID. */
+ u32 engine_idx;
+ /* Host SSID. */
+ u32 host_ssid;
+ /* CMDQ ID */
+ u64 cmdq_id;
+ /* Fence object handle. */
+ u64 fence_handle;
+};
+
struct vpu_jsm_engine_reset_context {
/* Host SSID */
u32 host_ssid;
@@ -700,11 +924,6 @@ struct vpu_ipc_msg_payload_get_power_level_count_done {
u8 power_limit[16];
};
-struct vpu_ipc_msg_payload_blob_deinit_done {
- /* 64-bit unique ID for the blob de-initialized. */
- u64 blob_id;
-};
-
/* HWS priority band setup request / response */
struct vpu_ipc_msg_payload_hws_priority_band_setup {
/*
@@ -794,7 +1013,10 @@ struct vpu_ipc_msg_payload_hws_set_context_sched_properties {
u32 reserved_0;
/* Command queue id */
u64 cmdq_id;
- /* Priority band to assign to work of this context */
+ /*
+ * Priority band to assign to work of this context.
+ * Available priority bands: @see enum vpu_job_scheduling_priority_band
+ */
u32 priority_band;
/* Inside realtime band assigns a further priority */
u32 realtime_priority_level;
@@ -869,9 +1091,7 @@ struct vpu_ipc_msg_payload_hws_set_scheduling_log {
*/
u64 notify_index;
/*
- * Enable extra events to be output to log for debug of scheduling algorithm.
- * Interpreted by VPU as a boolean to enable or disable, expected values are
- * 0 and 1.
+ * Field is now deprecated, will be removed when KMD is updated to support removal
*/
u32 enable_extra_events;
/* Zero Padding */
@@ -1243,10 +1463,10 @@ union vpu_ipc_msg_payload {
struct vpu_jsm_metric_streamer_start metric_streamer_start;
struct vpu_jsm_metric_streamer_stop metric_streamer_stop;
struct vpu_jsm_metric_streamer_update metric_streamer_update;
- struct vpu_ipc_msg_payload_blob_deinit blob_deinit;
struct vpu_ipc_msg_payload_ssid_release ssid_release;
struct vpu_jsm_hws_register_db hws_register_db;
struct vpu_ipc_msg_payload_job_done job_done;
+ struct vpu_ipc_msg_payload_native_fence_signalled native_fence_signalled;
struct vpu_ipc_msg_payload_engine_reset_done engine_reset_done;
struct vpu_ipc_msg_payload_engine_preempt_done engine_preempt_done;
struct vpu_ipc_msg_payload_register_db_done register_db_done;
@@ -1254,7 +1474,6 @@ union vpu_ipc_msg_payload {
struct vpu_ipc_msg_payload_query_engine_hb_done query_engine_hb_done;
struct vpu_ipc_msg_payload_get_power_level_count_done get_power_level_count_done;
struct vpu_jsm_metric_streamer_done metric_streamer_done;
- struct vpu_ipc_msg_payload_blob_deinit_done blob_deinit_done;
struct vpu_ipc_msg_payload_trace_config trace_config;
struct vpu_ipc_msg_payload_trace_capability_rsp trace_capability;
struct vpu_ipc_msg_payload_trace_get_name trace_get_name;
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 02/31] accel/ivpu: Rename ivpu_log_level to fw_log_level
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 01/31] accel/ivpu: Update VPU FW API headers Jacek Lawrynowicz
@ 2024-09-30 19:52 ` Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 03/31] accel/ivpu: Reset fw log on cold boot Jacek Lawrynowicz
` (29 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Maciej Falkowski
Rename module param ivpu_log_level to fw_log_level, so it is clear
what log level is actually changed.
Reviewed-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_fw.c | 4 ++--
drivers/accel/ivpu/ivpu_fw_log.c | 12 ++++++------
drivers/accel/ivpu/ivpu_fw_log.h | 6 +++---
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c
index de3d661163756..7beb95e8ef718 100644
--- a/drivers/accel/ivpu/ivpu_fw.c
+++ b/drivers/accel/ivpu/ivpu_fw.c
@@ -204,7 +204,7 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
fw->cold_boot_entry_point = fw_hdr->entry_point;
fw->entry_point = fw->cold_boot_entry_point;
- fw->trace_level = min_t(u32, ivpu_log_level, IVPU_FW_LOG_FATAL);
+ fw->trace_level = min_t(u32, ivpu_fw_log_level, IVPU_FW_LOG_FATAL);
fw->trace_destination_mask = VPU_TRACE_DESTINATION_VERBOSE_TRACING;
fw->trace_hw_component_mask = -1;
@@ -307,7 +307,7 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev)
goto err_free_fw_mem;
}
- if (ivpu_log_level <= IVPU_FW_LOG_INFO)
+ if (ivpu_fw_log_level <= IVPU_FW_LOG_INFO)
log_verb_size = IVPU_FW_VERBOSE_BUFFER_LARGE_SIZE;
else
log_verb_size = IVPU_FW_VERBOSE_BUFFER_SMALL_SIZE;
diff --git a/drivers/accel/ivpu/ivpu_fw_log.c b/drivers/accel/ivpu/ivpu_fw_log.c
index ef0adb5e0fbeb..2f2d3242f21be 100644
--- a/drivers/accel/ivpu/ivpu_fw_log.c
+++ b/drivers/accel/ivpu/ivpu_fw_log.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * Copyright (C) 2020-2023 Intel Corporation
+ * Copyright (C) 2020-2024 Intel Corporation
*/
#include <linux/ctype.h>
@@ -15,12 +15,12 @@
#include "ivpu_fw_log.h"
#include "ivpu_gem.h"
-#define IVPU_FW_LOG_LINE_LENGTH 256
+#define IVPU_FW_LOG_LINE_LENGTH 256
-unsigned int ivpu_log_level = IVPU_FW_LOG_ERROR;
-module_param(ivpu_log_level, uint, 0444);
-MODULE_PARM_DESC(ivpu_log_level,
- "NPU firmware default trace level: debug=" __stringify(IVPU_FW_LOG_DEBUG)
+unsigned int ivpu_fw_log_level = IVPU_FW_LOG_ERROR;
+module_param_named(fw_log_level, ivpu_fw_log_level, uint, 0444);
+MODULE_PARM_DESC(fw_log_level,
+ "NPU firmware default log level: debug=" __stringify(IVPU_FW_LOG_DEBUG)
" info=" __stringify(IVPU_FW_LOG_INFO)
" warn=" __stringify(IVPU_FW_LOG_WARN)
" error=" __stringify(IVPU_FW_LOG_ERROR)
diff --git a/drivers/accel/ivpu/ivpu_fw_log.h b/drivers/accel/ivpu/ivpu_fw_log.h
index 0b2573f6f3151..ccef4298e45b5 100644
--- a/drivers/accel/ivpu/ivpu_fw_log.h
+++ b/drivers/accel/ivpu/ivpu_fw_log.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
- * Copyright (C) 2020-2023 Intel Corporation
+ * Copyright (C) 2020-2024 Intel Corporation
*/
#ifndef __IVPU_FW_LOG_H__
@@ -19,12 +19,12 @@
#define IVPU_FW_LOG_ERROR 4
#define IVPU_FW_LOG_FATAL 5
-extern unsigned int ivpu_log_level;
-
#define IVPU_FW_VERBOSE_BUFFER_SMALL_SIZE SZ_1M
#define IVPU_FW_VERBOSE_BUFFER_LARGE_SIZE SZ_8M
#define IVPU_FW_CRITICAL_BUFFER_SIZE SZ_512K
+extern unsigned int ivpu_fw_log_level;
+
void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_printer *p);
void ivpu_fw_log_clear(struct ivpu_device *vdev);
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 03/31] accel/ivpu: Reset fw log on cold boot
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 01/31] accel/ivpu: Update VPU FW API headers Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 02/31] accel/ivpu: Rename ivpu_log_level to fw_log_level Jacek Lawrynowicz
@ 2024-09-30 19:52 ` Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 04/31] accel/ivpu: Refactor functions in ivpu_fw_log.c Jacek Lawrynowicz
` (28 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Tomasz Rusinowicz, Jacek Lawrynowicz
From: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Add ivpu_fw_log_reset() that resets the read_index of all FW logs
on cold boot so logs are properly read.
Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_fw_log.c | 14 ++++++++++++++
drivers/accel/ivpu/ivpu_fw_log.h | 1 +
drivers/accel/ivpu/ivpu_pm.c | 1 +
3 files changed, 16 insertions(+)
diff --git a/drivers/accel/ivpu/ivpu_fw_log.c b/drivers/accel/ivpu/ivpu_fw_log.c
index 2f2d3242f21be..817210e35f70e 100644
--- a/drivers/accel/ivpu/ivpu_fw_log.c
+++ b/drivers/accel/ivpu/ivpu_fw_log.c
@@ -140,3 +140,17 @@ void ivpu_fw_log_clear(struct ivpu_device *vdev)
while (fw_log_ptr(vdev, vdev->fw->mem_log_verb, &next, &log_header) == 0)
log_header->read_index = log_header->write_index;
}
+
+void ivpu_fw_log_reset(struct ivpu_device *vdev)
+{
+ struct vpu_tracing_buffer_header *log_header;
+ u32 next;
+
+ next = 0;
+ while (fw_log_ptr(vdev, vdev->fw->mem_log_crit, &next, &log_header) == 0)
+ log_header->read_index = 0;
+
+ next = 0;
+ while (fw_log_ptr(vdev, vdev->fw->mem_log_verb, &next, &log_header) == 0)
+ log_header->read_index = 0;
+}
diff --git a/drivers/accel/ivpu/ivpu_fw_log.h b/drivers/accel/ivpu/ivpu_fw_log.h
index ccef4298e45b5..a033ce2d642f6 100644
--- a/drivers/accel/ivpu/ivpu_fw_log.h
+++ b/drivers/accel/ivpu/ivpu_fw_log.h
@@ -27,6 +27,7 @@ extern unsigned int ivpu_fw_log_level;
void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_printer *p);
void ivpu_fw_log_clear(struct ivpu_device *vdev);
+void ivpu_fw_log_reset(struct ivpu_device *vdev);
static inline void ivpu_fw_log_dump(struct ivpu_device *vdev)
{
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index 59d3170f5e354..3c36b55c01d51 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -37,6 +37,7 @@ static void ivpu_pm_prepare_cold_boot(struct ivpu_device *vdev)
ivpu_cmdq_reset_all_contexts(vdev);
ivpu_ipc_reset(vdev);
+ ivpu_fw_log_reset(vdev);
ivpu_fw_load(vdev);
fw->entry_point = fw->cold_boot_entry_point;
}
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 04/31] accel/ivpu: Refactor functions in ivpu_fw_log.c
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (2 preceding siblings ...)
2024-09-30 19:52 ` [PATCH v2 03/31] accel/ivpu: Reset fw log on cold boot Jacek Lawrynowicz
@ 2024-09-30 19:52 ` Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 05/31] accel/ivpu: Fix fw log printing Jacek Lawrynowicz
` (27 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Tomasz Rusinowicz
Make function names more consistent and (arguably) readable in
fw log code. Add fw_log_print_all_in_bo() that remove duplicated code in
ivpu_fw_log_print().
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
---
drivers/accel/ivpu/ivpu_debugfs.c | 2 +-
drivers/accel/ivpu/ivpu_fw_log.c | 62 ++++++++++++++++---------------
drivers/accel/ivpu/ivpu_fw_log.h | 2 +-
3 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_debugfs.c b/drivers/accel/ivpu/ivpu_debugfs.c
index 6f86f8df30db0..cd3ac08f0409a 100644
--- a/drivers/accel/ivpu/ivpu_debugfs.c
+++ b/drivers/accel/ivpu/ivpu_debugfs.c
@@ -192,7 +192,7 @@ fw_log_fops_write(struct file *file, const char __user *user_buf, size_t size, l
if (!size)
return -EINVAL;
- ivpu_fw_log_clear(vdev);
+ ivpu_fw_log_mark_read(vdev);
return size;
}
diff --git a/drivers/accel/ivpu/ivpu_fw_log.c b/drivers/accel/ivpu/ivpu_fw_log.c
index 817210e35f70e..343ebfd30d280 100644
--- a/drivers/accel/ivpu/ivpu_fw_log.c
+++ b/drivers/accel/ivpu/ivpu_fw_log.c
@@ -26,8 +26,8 @@ MODULE_PARM_DESC(fw_log_level,
" error=" __stringify(IVPU_FW_LOG_ERROR)
" fatal=" __stringify(IVPU_FW_LOG_FATAL));
-static int fw_log_ptr(struct ivpu_device *vdev, struct ivpu_bo *bo, u32 *offset,
- struct vpu_tracing_buffer_header **log_header)
+static int fw_log_from_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, u32 *offset,
+ struct vpu_tracing_buffer_header **out_log)
{
struct vpu_tracing_buffer_header *log;
@@ -48,7 +48,7 @@ static int fw_log_ptr(struct ivpu_device *vdev, struct ivpu_bo *bo, u32 *offset,
return -EINVAL;
}
- *log_header = log;
+ *out_log = log;
*offset += log->size;
ivpu_dbg(vdev, FW_BOOT,
@@ -59,7 +59,7 @@ static int fw_log_ptr(struct ivpu_device *vdev, struct ivpu_bo *bo, u32 *offset,
return 0;
}
-static void buffer_print(char *buffer, u32 size, struct drm_printer *p)
+static void fw_log_print_lines(char *buffer, u32 size, struct drm_printer *p)
{
char line[IVPU_FW_LOG_LINE_LENGTH];
u32 index = 0;
@@ -90,11 +90,11 @@ static void buffer_print(char *buffer, u32 size, struct drm_printer *p)
drm_printf(p, "%s\n", line);
}
-static void fw_log_print_buffer(struct ivpu_device *vdev, struct vpu_tracing_buffer_header *log,
- const char *prefix, bool only_new_msgs, struct drm_printer *p)
+static void fw_log_print_buffer(struct vpu_tracing_buffer_header *log, const char *prefix,
+ bool only_new_msgs, struct drm_printer *p)
{
- char *log_buffer = (void *)log + log->header_size;
- u32 log_size = log->size - log->header_size;
+ char *log_data = (void *)log + log->header_size;
+ u32 data_size = log->size - log->header_size;
u32 log_start = log->read_index;
u32 log_end = log->write_index;
@@ -106,51 +106,55 @@ static void fw_log_print_buffer(struct ivpu_device *vdev, struct vpu_tracing_buf
drm_printf(p, "==== %s \"%s\" log start ====\n", prefix, log->name);
if (log->write_index > log->read_index) {
- buffer_print(log_buffer + log_start, log_end - log_start, p);
+ fw_log_print_lines(log_data + log_start, log_end - log_start, p);
} else {
- buffer_print(log_buffer + log_end, log_size - log_end, p);
- buffer_print(log_buffer, log_end, p);
+ fw_log_print_lines(log_data + log_end, data_size - log_end, p);
+ fw_log_print_lines(log_data, log_end, p);
}
drm_printf(p, "\x1b[0m");
drm_printf(p, "==== %s \"%s\" log end ====\n", prefix, log->name);
}
-void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_printer *p)
+static void
+fw_log_print_all_in_bo(struct ivpu_device *vdev, const char *name,
+ struct ivpu_bo *bo, bool only_new_msgs, struct drm_printer *p)
{
- struct vpu_tracing_buffer_header *log_header;
+ struct vpu_tracing_buffer_header *log;
u32 next = 0;
- while (fw_log_ptr(vdev, vdev->fw->mem_log_crit, &next, &log_header) == 0)
- fw_log_print_buffer(vdev, log_header, "NPU critical", only_new_msgs, p);
+ while (fw_log_from_bo(vdev, bo, &next, &log) == 0)
+ fw_log_print_buffer(log, name, only_new_msgs, p);
+}
- next = 0;
- while (fw_log_ptr(vdev, vdev->fw->mem_log_verb, &next, &log_header) == 0)
- fw_log_print_buffer(vdev, log_header, "NPU verbose", only_new_msgs, p);
+void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_printer *p)
+{
+ fw_log_print_all_in_bo(vdev, "NPU critical", vdev->fw->mem_log_crit, only_new_msgs, p);
+ fw_log_print_all_in_bo(vdev, "NPU verbose", vdev->fw->mem_log_verb, only_new_msgs, p);
}
-void ivpu_fw_log_clear(struct ivpu_device *vdev)
+void ivpu_fw_log_mark_read(struct ivpu_device *vdev)
{
- struct vpu_tracing_buffer_header *log_header;
+ struct vpu_tracing_buffer_header *log;
u32 next = 0;
- while (fw_log_ptr(vdev, vdev->fw->mem_log_crit, &next, &log_header) == 0)
- log_header->read_index = log_header->write_index;
+ while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &log) == 0)
+ log->read_index = log->write_index;
next = 0;
- while (fw_log_ptr(vdev, vdev->fw->mem_log_verb, &next, &log_header) == 0)
- log_header->read_index = log_header->write_index;
+ while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &log) == 0)
+ log->read_index = log->write_index;
}
void ivpu_fw_log_reset(struct ivpu_device *vdev)
{
- struct vpu_tracing_buffer_header *log_header;
+ struct vpu_tracing_buffer_header *log;
u32 next;
next = 0;
- while (fw_log_ptr(vdev, vdev->fw->mem_log_crit, &next, &log_header) == 0)
- log_header->read_index = 0;
+ while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &log) == 0)
+ log->read_index = 0;
next = 0;
- while (fw_log_ptr(vdev, vdev->fw->mem_log_verb, &next, &log_header) == 0)
- log_header->read_index = 0;
+ while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &log) == 0)
+ log->read_index = 0;
}
diff --git a/drivers/accel/ivpu/ivpu_fw_log.h b/drivers/accel/ivpu/ivpu_fw_log.h
index a033ce2d642f6..41c85b74cc7fd 100644
--- a/drivers/accel/ivpu/ivpu_fw_log.h
+++ b/drivers/accel/ivpu/ivpu_fw_log.h
@@ -26,7 +26,7 @@
extern unsigned int ivpu_fw_log_level;
void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_printer *p);
-void ivpu_fw_log_clear(struct ivpu_device *vdev);
+void ivpu_fw_log_mark_read(struct ivpu_device *vdev);
void ivpu_fw_log_reset(struct ivpu_device *vdev);
static inline void ivpu_fw_log_dump(struct ivpu_device *vdev)
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 05/31] accel/ivpu: Fix fw log printing
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (3 preceding siblings ...)
2024-09-30 19:52 ` [PATCH v2 04/31] accel/ivpu: Refactor functions in ivpu_fw_log.c Jacek Lawrynowicz
@ 2024-09-30 19:52 ` Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 06/31] accel/ivpu: Limit FW version string length Jacek Lawrynowicz
` (26 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz
- Fix empty log detection that couldn't work without read_wrap_count
- Start printing wrapped log from correct position (log_start)
- Properly handle logs that are wrapped multiple times in reference
to reader position
- Don't add a newline when log buffer is wrapped
- Always add a newline after printing a log buffer in case log does
not end with one
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_fw_log.c | 49 +++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 17 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_fw_log.c b/drivers/accel/ivpu/ivpu_fw_log.c
index 343ebfd30d280..337c906b02107 100644
--- a/drivers/accel/ivpu/ivpu_fw_log.c
+++ b/drivers/accel/ivpu/ivpu_fw_log.c
@@ -87,7 +87,7 @@ static void fw_log_print_lines(char *buffer, u32 size, struct drm_printer *p)
}
line[index] = 0;
if (index != 0)
- drm_printf(p, "%s\n", line);
+ drm_printf(p, "%s", line);
}
static void fw_log_print_buffer(struct vpu_tracing_buffer_header *log, const char *prefix,
@@ -95,23 +95,29 @@ static void fw_log_print_buffer(struct vpu_tracing_buffer_header *log, const cha
{
char *log_data = (void *)log + log->header_size;
u32 data_size = log->size - log->header_size;
- u32 log_start = log->read_index;
- u32 log_end = log->write_index;
+ u32 log_start = only_new_msgs ? READ_ONCE(log->read_index) : 0;
+ u32 log_end = READ_ONCE(log->write_index);
- if (!(log->write_index || log->wrap_count) ||
- (log->write_index == log->read_index && only_new_msgs)) {
- drm_printf(p, "==== %s \"%s\" log empty ====\n", prefix, log->name);
- return;
+ if (log->wrap_count == log->read_wrap_count) {
+ if (log_end <= log_start) {
+ drm_printf(p, "==== %s \"%s\" log empty ====\n", prefix, log->name);
+ return;
+ }
+ } else if (log->wrap_count == log->read_wrap_count + 1) {
+ if (log_end > log_start)
+ log_start = log_end;
+ } else {
+ log_start = log_end;
}
drm_printf(p, "==== %s \"%s\" log start ====\n", prefix, log->name);
- if (log->write_index > log->read_index) {
+ if (log_end > log_start) {
fw_log_print_lines(log_data + log_start, log_end - log_start, p);
} else {
- fw_log_print_lines(log_data + log_end, data_size - log_end, p);
+ fw_log_print_lines(log_data + log_start, data_size - log_start, p);
fw_log_print_lines(log_data, log_end, p);
}
- drm_printf(p, "\x1b[0m");
+ drm_printf(p, "\n\x1b[0m"); /* add new line and clear formatting */
drm_printf(p, "==== %s \"%s\" log end ====\n", prefix, log->name);
}
@@ -135,14 +141,19 @@ void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_
void ivpu_fw_log_mark_read(struct ivpu_device *vdev)
{
struct vpu_tracing_buffer_header *log;
- u32 next = 0;
+ u32 next;
- while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &log) == 0)
- log->read_index = log->write_index;
+ next = 0;
+ while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &log) == 0) {
+ log->read_index = READ_ONCE(log->write_index);
+ log->read_wrap_count = READ_ONCE(log->wrap_count);
+ }
next = 0;
- while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &log) == 0)
- log->read_index = log->write_index;
+ while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &log) == 0) {
+ log->read_index = READ_ONCE(log->write_index);
+ log->read_wrap_count = READ_ONCE(log->wrap_count);
+ }
}
void ivpu_fw_log_reset(struct ivpu_device *vdev)
@@ -151,10 +162,14 @@ void ivpu_fw_log_reset(struct ivpu_device *vdev)
u32 next;
next = 0;
- while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &log) == 0)
+ while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &log) == 0) {
log->read_index = 0;
+ log->read_wrap_count = 0;
+ }
next = 0;
- while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &log) == 0)
+ while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &log) == 0) {
log->read_index = 0;
+ log->read_wrap_count = 0;
+ }
}
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 06/31] accel/ivpu: Limit FW version string length
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (4 preceding siblings ...)
2024-09-30 19:52 ` [PATCH v2 05/31] accel/ivpu: Fix fw log printing Jacek Lawrynowicz
@ 2024-09-30 19:52 ` Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 07/31] accel/ivpu: Add coredump support Jacek Lawrynowicz
` (25 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz
Limit FW version string, when parsing FW binary, to 256 bytes and
always add NULL-terminate it.
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_fw.c | 7 ++++---
drivers/accel/ivpu/ivpu_fw.h | 6 +++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c
index 7beb95e8ef718..b91449aa8a7c6 100644
--- a/drivers/accel/ivpu/ivpu_fw.c
+++ b/drivers/accel/ivpu/ivpu_fw.c
@@ -25,7 +25,6 @@
#define FW_SHAVE_NN_MAX_SIZE SZ_2M
#define FW_RUNTIME_MIN_ADDR (FW_GLOBAL_MEM_START)
#define FW_RUNTIME_MAX_ADDR (FW_GLOBAL_MEM_END - FW_SHARED_MEM_SIZE)
-#define FW_VERSION_HEADER_SIZE SZ_4K
#define FW_FILE_IMAGE_OFFSET (VPU_FW_HEADER_SIZE + FW_VERSION_HEADER_SIZE)
#define WATCHDOG_MSS_REDIRECT 32
@@ -187,8 +186,10 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
ivpu_dbg(vdev, FW_BOOT, "Header version: 0x%x, format 0x%x\n",
fw_hdr->header_version, fw_hdr->image_format);
- ivpu_info(vdev, "Firmware: %s, version: %s", fw->name,
- (const char *)fw_hdr + VPU_FW_HEADER_SIZE);
+ if (!scnprintf(fw->version, sizeof(fw->version), "%s", fw->file->data + VPU_FW_HEADER_SIZE))
+ ivpu_warn(vdev, "Missing firmware version\n");
+
+ ivpu_info(vdev, "Firmware: %s, version: %s\n", fw->name, fw->version);
if (IVPU_FW_CHECK_API_COMPAT(vdev, fw_hdr, BOOT, 3))
return -EINVAL;
diff --git a/drivers/accel/ivpu/ivpu_fw.h b/drivers/accel/ivpu/ivpu_fw.h
index 40d9d17be3f52..5e8eb608b70f1 100644
--- a/drivers/accel/ivpu/ivpu_fw.h
+++ b/drivers/accel/ivpu/ivpu_fw.h
@@ -1,11 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
- * Copyright (C) 2020-2023 Intel Corporation
+ * Copyright (C) 2020-2024 Intel Corporation
*/
#ifndef __IVPU_FW_H__
#define __IVPU_FW_H__
+#define FW_VERSION_HEADER_SIZE SZ_4K
+#define FW_VERSION_STR_SIZE SZ_256
+
struct ivpu_device;
struct ivpu_bo;
struct vpu_boot_params;
@@ -13,6 +16,7 @@ struct vpu_boot_params;
struct ivpu_fw_info {
const struct firmware *file;
const char *name;
+ char version[FW_VERSION_STR_SIZE];
struct ivpu_bo *mem;
struct ivpu_bo *mem_shave_nn;
struct ivpu_bo *mem_log_crit;
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 07/31] accel/ivpu: Add coredump support
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (5 preceding siblings ...)
2024-09-30 19:52 ` [PATCH v2 06/31] accel/ivpu: Limit FW version string length Jacek Lawrynowicz
@ 2024-09-30 19:52 ` Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 08/31] accel/ivpu: Add FW state dump on TDR Jacek Lawrynowicz
` (24 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Use coredump (if available) to collect FW logs in case of a FW crash.
This makes dmesg more readable and allows to collect more log data.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/Kconfig | 1 +
drivers/accel/ivpu/Makefile | 1 +
drivers/accel/ivpu/ivpu_coredump.c | 39 ++++++++++++++++++++++++++++++
drivers/accel/ivpu/ivpu_coredump.h | 25 +++++++++++++++++++
drivers/accel/ivpu/ivpu_drv.c | 5 ++--
drivers/accel/ivpu/ivpu_fw_log.h | 8 ------
drivers/accel/ivpu/ivpu_pm.c | 9 ++++---
7 files changed, 74 insertions(+), 14 deletions(-)
create mode 100644 drivers/accel/ivpu/ivpu_coredump.c
create mode 100644 drivers/accel/ivpu/ivpu_coredump.h
diff --git a/drivers/accel/ivpu/Kconfig b/drivers/accel/ivpu/Kconfig
index 682c532452863..e4d418b44626e 100644
--- a/drivers/accel/ivpu/Kconfig
+++ b/drivers/accel/ivpu/Kconfig
@@ -8,6 +8,7 @@ config DRM_ACCEL_IVPU
select FW_LOADER
select DRM_GEM_SHMEM_HELPER
select GENERIC_ALLOCATOR
+ select WANT_DEV_COREDUMP
help
Choose this option if you have a system with an 14th generation
Intel CPU (Meteor Lake) or newer. Intel NPU (formerly called Intel VPU)
diff --git a/drivers/accel/ivpu/Makefile b/drivers/accel/ivpu/Makefile
index ebd682a42eb12..232ea6d28c6e2 100644
--- a/drivers/accel/ivpu/Makefile
+++ b/drivers/accel/ivpu/Makefile
@@ -19,5 +19,6 @@ intel_vpu-y := \
ivpu_sysfs.o
intel_vpu-$(CONFIG_DEBUG_FS) += ivpu_debugfs.o
+intel_vpu-$(CONFIG_DEV_COREDUMP) += ivpu_coredump.o
obj-$(CONFIG_DRM_ACCEL_IVPU) += intel_vpu.o
diff --git a/drivers/accel/ivpu/ivpu_coredump.c b/drivers/accel/ivpu/ivpu_coredump.c
new file mode 100644
index 0000000000000..16ad0c30818cc
--- /dev/null
+++ b/drivers/accel/ivpu/ivpu_coredump.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2020-2024 Intel Corporation
+ */
+
+#include <linux/devcoredump.h>
+#include <linux/firmware.h>
+
+#include "ivpu_coredump.h"
+#include "ivpu_fw.h"
+#include "ivpu_gem.h"
+#include "vpu_boot_api.h"
+
+#define CRASH_DUMP_HEADER "Intel NPU crash dump"
+#define CRASH_DUMP_HEADERS_SIZE SZ_4K
+
+void ivpu_dev_coredump(struct ivpu_device *vdev)
+{
+ struct drm_print_iterator pi = {};
+ struct drm_printer p;
+ size_t coredump_size;
+ char *coredump;
+
+ coredump_size = CRASH_DUMP_HEADERS_SIZE + FW_VERSION_HEADER_SIZE +
+ ivpu_bo_size(vdev->fw->mem_log_crit) + ivpu_bo_size(vdev->fw->mem_log_verb);
+ coredump = vmalloc(coredump_size);
+ if (!coredump)
+ return;
+
+ pi.data = coredump;
+ pi.remain = coredump_size;
+ p = drm_coredump_printer(&pi);
+
+ drm_printf(&p, "%s\n", CRASH_DUMP_HEADER);
+ drm_printf(&p, "FW version: %s\n", vdev->fw->version);
+ ivpu_fw_log_print(vdev, false, &p);
+
+ dev_coredumpv(vdev->drm.dev, coredump, pi.offset, GFP_KERNEL);
+}
diff --git a/drivers/accel/ivpu/ivpu_coredump.h b/drivers/accel/ivpu/ivpu_coredump.h
new file mode 100644
index 0000000000000..8efb09d024411
--- /dev/null
+++ b/drivers/accel/ivpu/ivpu_coredump.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020-2024 Intel Corporation
+ */
+
+#ifndef __IVPU_COREDUMP_H__
+#define __IVPU_COREDUMP_H__
+
+#include <drm/drm_print.h>
+
+#include "ivpu_drv.h"
+#include "ivpu_fw_log.h"
+
+#ifdef CONFIG_DEV_COREDUMP
+void ivpu_dev_coredump(struct ivpu_device *vdev);
+#else
+static inline void ivpu_dev_coredump(struct ivpu_device *vdev)
+{
+ struct drm_printer p = drm_info_printer(vdev->drm.dev);
+
+ ivpu_fw_log_print(vdev, false, &p);
+}
+#endif
+
+#endif /* __IVPU_COREDUMP_H__ */
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index c91400ecf9265..38b4158f52784 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -14,7 +14,7 @@
#include <drm/drm_ioctl.h>
#include <drm/drm_prime.h>
-#include "vpu_boot_api.h"
+#include "ivpu_coredump.h"
#include "ivpu_debugfs.h"
#include "ivpu_drv.h"
#include "ivpu_fw.h"
@@ -29,6 +29,7 @@
#include "ivpu_ms.h"
#include "ivpu_pm.h"
#include "ivpu_sysfs.h"
+#include "vpu_boot_api.h"
#ifndef DRIVER_VERSION_STR
#define DRIVER_VERSION_STR __stringify(DRM_IVPU_DRIVER_MAJOR) "." \
@@ -382,7 +383,7 @@ int ivpu_boot(struct ivpu_device *vdev)
ivpu_err(vdev, "Failed to boot the firmware: %d\n", ret);
ivpu_hw_diagnose_failure(vdev);
ivpu_mmu_evtq_dump(vdev);
- ivpu_fw_log_dump(vdev);
+ ivpu_dev_coredump(vdev);
return ret;
}
diff --git a/drivers/accel/ivpu/ivpu_fw_log.h b/drivers/accel/ivpu/ivpu_fw_log.h
index 41c85b74cc7fd..8bb528a73cb7e 100644
--- a/drivers/accel/ivpu/ivpu_fw_log.h
+++ b/drivers/accel/ivpu/ivpu_fw_log.h
@@ -8,8 +8,6 @@
#include <linux/types.h>
-#include <drm/drm_print.h>
-
#include "ivpu_drv.h"
#define IVPU_FW_LOG_DEFAULT 0
@@ -29,11 +27,5 @@ void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_
void ivpu_fw_log_mark_read(struct ivpu_device *vdev);
void ivpu_fw_log_reset(struct ivpu_device *vdev);
-static inline void ivpu_fw_log_dump(struct ivpu_device *vdev)
-{
- struct drm_printer p = drm_info_printer(vdev->drm.dev);
-
- ivpu_fw_log_print(vdev, false, &p);
-}
#endif /* __IVPU_FW_LOG_H__ */
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index 3c36b55c01d51..bf77395ffcb7c 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -9,17 +9,18 @@
#include <linux/pm_runtime.h>
#include <linux/reboot.h>
-#include "vpu_boot_api.h"
+#include "ivpu_coredump.h"
#include "ivpu_drv.h"
-#include "ivpu_hw.h"
#include "ivpu_fw.h"
#include "ivpu_fw_log.h"
+#include "ivpu_hw.h"
#include "ivpu_ipc.h"
#include "ivpu_job.h"
#include "ivpu_jsm_msg.h"
#include "ivpu_mmu.h"
#include "ivpu_ms.h"
#include "ivpu_pm.h"
+#include "vpu_boot_api.h"
static bool ivpu_disable_recovery;
module_param_named_unsafe(disable_recovery, ivpu_disable_recovery, bool, 0644);
@@ -124,7 +125,7 @@ static void ivpu_pm_recovery_work(struct work_struct *work)
if (ret)
ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
- ivpu_fw_log_dump(vdev);
+ ivpu_dev_coredump(vdev);
atomic_inc(&vdev->pm->reset_counter);
atomic_set(&vdev->pm->reset_pending, 1);
@@ -263,7 +264,7 @@ int ivpu_pm_runtime_suspend_cb(struct device *dev)
if (!is_idle || ret_d0i3) {
ivpu_err(vdev, "Forcing cold boot due to previous errors\n");
atomic_inc(&vdev->pm->reset_counter);
- ivpu_fw_log_dump(vdev);
+ ivpu_dev_coredump(vdev);
ivpu_pm_prepare_cold_boot(vdev);
} else {
ivpu_pm_prepare_warm_boot(vdev);
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 08/31] accel/ivpu: Add FW state dump on TDR
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (6 preceding siblings ...)
2024-09-30 19:52 ` [PATCH v2 07/31] accel/ivpu: Add coredump support Jacek Lawrynowicz
@ 2024-09-30 19:52 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 09/31] accel/ivpu: Set 500 ns delay between power island TRICKLE and ENABLE Jacek Lawrynowicz
` (23 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:52 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Tomasz Rusinowicz, Jacek Lawrynowicz
From: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Send JSM state dump message at the beginning of TDR handler. This allows
FW to collect debug info in the FW log before the state of the NPU is
lost allowing to analyze the cause of a TDR.
Wait a predefined timeout (10 ms) so the FW has a chance to write debug
logs. We cannot wait for JSM response at this point because IRQs are
already disabled before TDR handler is invoked.
Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.h | 1 +
drivers/accel/ivpu/ivpu_hw.c | 3 +++
drivers/accel/ivpu/ivpu_ipc.c | 26 ++++++++++++++++++++++++++
drivers/accel/ivpu/ivpu_ipc.h | 2 ++
drivers/accel/ivpu/ivpu_jsm_msg.c | 8 ++++++++
drivers/accel/ivpu/ivpu_jsm_msg.h | 2 ++
drivers/accel/ivpu/ivpu_pm.c | 1 +
7 files changed, 43 insertions(+)
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 63f13b697eed7..2b30cc2e9272e 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -152,6 +152,7 @@ struct ivpu_device {
int tdr;
int autosuspend;
int d0i3_entry_msg;
+ int state_dump_msg;
} timeout;
};
diff --git a/drivers/accel/ivpu/ivpu_hw.c b/drivers/accel/ivpu/ivpu_hw.c
index 27f0fe4d54e00..85219e9596215 100644
--- a/drivers/accel/ivpu/ivpu_hw.c
+++ b/drivers/accel/ivpu/ivpu_hw.c
@@ -89,12 +89,14 @@ static void timeouts_init(struct ivpu_device *vdev)
vdev->timeout.tdr = 2000000;
vdev->timeout.autosuspend = -1;
vdev->timeout.d0i3_entry_msg = 500;
+ vdev->timeout.state_dump_msg = 10;
} else if (ivpu_is_simics(vdev)) {
vdev->timeout.boot = 50;
vdev->timeout.jsm = 500;
vdev->timeout.tdr = 10000;
vdev->timeout.autosuspend = -1;
vdev->timeout.d0i3_entry_msg = 100;
+ vdev->timeout.state_dump_msg = 10;
} else {
vdev->timeout.boot = 1000;
vdev->timeout.jsm = 500;
@@ -104,6 +106,7 @@ static void timeouts_init(struct ivpu_device *vdev)
else
vdev->timeout.autosuspend = 100;
vdev->timeout.d0i3_entry_msg = 5;
+ vdev->timeout.state_dump_msg = 10;
}
}
diff --git a/drivers/accel/ivpu/ivpu_ipc.c b/drivers/accel/ivpu/ivpu_ipc.c
index 78b32a8232419..83b4ba4f3e20a 100644
--- a/drivers/accel/ivpu/ivpu_ipc.c
+++ b/drivers/accel/ivpu/ivpu_ipc.c
@@ -364,6 +364,32 @@ int ivpu_ipc_send_receive(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
return ret;
}
+int ivpu_ipc_send_and_wait(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
+ u32 channel, unsigned long timeout_ms)
+{
+ struct ivpu_ipc_consumer cons;
+ int ret;
+
+ ret = ivpu_rpm_get(vdev);
+ if (ret < 0)
+ return ret;
+
+ ivpu_ipc_consumer_add(vdev, &cons, channel, NULL);
+
+ ret = ivpu_ipc_send(vdev, &cons, req);
+ if (ret) {
+ ivpu_warn_ratelimited(vdev, "IPC send failed: %d\n", ret);
+ goto consumer_del;
+ }
+
+ msleep(timeout_ms);
+
+consumer_del:
+ ivpu_ipc_consumer_del(vdev, &cons);
+ ivpu_rpm_put(vdev);
+ return ret;
+}
+
static bool
ivpu_ipc_match_consumer(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
struct ivpu_ipc_hdr *ipc_hdr, struct vpu_jsm_msg *jsm_msg)
diff --git a/drivers/accel/ivpu/ivpu_ipc.h b/drivers/accel/ivpu/ivpu_ipc.h
index 4fe38141045ea..6bbe6e32c8749 100644
--- a/drivers/accel/ivpu/ivpu_ipc.h
+++ b/drivers/accel/ivpu/ivpu_ipc.h
@@ -108,5 +108,7 @@ int ivpu_ipc_send_receive_active(struct ivpu_device *vdev, struct vpu_jsm_msg *r
int ivpu_ipc_send_receive(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
enum vpu_ipc_msg_type expected_resp, struct vpu_jsm_msg *resp,
u32 channel, unsigned long timeout_ms);
+int ivpu_ipc_send_and_wait(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
+ u32 channel, unsigned long timeout_ms);
#endif /* __IVPU_IPC_H__ */
diff --git a/drivers/accel/ivpu/ivpu_jsm_msg.c b/drivers/accel/ivpu/ivpu_jsm_msg.c
index b06da8f50fd39..cd33964d292bc 100644
--- a/drivers/accel/ivpu/ivpu_jsm_msg.c
+++ b/drivers/accel/ivpu/ivpu_jsm_msg.c
@@ -559,3 +559,11 @@ int ivpu_jsm_dct_disable(struct ivpu_device *vdev)
&resp, VPU_IPC_CHAN_ASYNC_CMD,
vdev->timeout.jsm);
}
+
+int ivpu_jsm_state_dump(struct ivpu_device *vdev)
+{
+ struct vpu_jsm_msg req = { .type = VPU_JSM_MSG_STATE_DUMP };
+
+ return ivpu_ipc_send_and_wait(vdev, &req, VPU_IPC_CHAN_ASYNC_CMD,
+ vdev->timeout.state_dump_msg);
+}
diff --git a/drivers/accel/ivpu/ivpu_jsm_msg.h b/drivers/accel/ivpu/ivpu_jsm_msg.h
index e4e42c0ff6e65..9e84d3526a146 100644
--- a/drivers/accel/ivpu/ivpu_jsm_msg.h
+++ b/drivers/accel/ivpu/ivpu_jsm_msg.h
@@ -43,4 +43,6 @@ int ivpu_jsm_metric_streamer_info(struct ivpu_device *vdev, u64 metric_group_mas
u64 buffer_size, u32 *sample_size, u64 *info_size);
int ivpu_jsm_dct_enable(struct ivpu_device *vdev, u32 active_us, u32 inactive_us);
int ivpu_jsm_dct_disable(struct ivpu_device *vdev);
+int ivpu_jsm_state_dump(struct ivpu_device *vdev);
+
#endif
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index bf77395ffcb7c..b5a69941e6e0a 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -125,6 +125,7 @@ static void ivpu_pm_recovery_work(struct work_struct *work)
if (ret)
ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
+ ivpu_jsm_state_dump(vdev);
ivpu_dev_coredump(vdev);
atomic_inc(&vdev->pm->reset_counter);
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 09/31] accel/ivpu: Set 500 ns delay between power island TRICKLE and ENABLE
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (7 preceding siblings ...)
2024-09-30 19:52 ` [PATCH v2 08/31] accel/ivpu: Add FW state dump on TDR Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 10/31] accel/ivpu: Turn on autosuspend on Simics Jacek Lawrynowicz
` (22 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Follow HW documentation recommendation of 500 ns delay between setting
AON_PWR_ISLAND_TRICKLE_EN and AON_PWR_ISLAND_EN registers during power
island enabling. Previously this was only done correctly for VPU 4+.
VPU 3.7 had the delay added after power island disable where it is not
needed.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_hw_ip.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
index dfd2f4a5b5268..cfcbb99168e65 100644
--- a/drivers/accel/ivpu/ivpu_hw_ip.c
+++ b/drivers/accel/ivpu/ivpu_hw_ip.c
@@ -311,9 +311,6 @@ static void pwr_island_trickle_drive_40xx(struct ivpu_device *vdev, bool enable)
val = REG_CLR_FLD(VPU_40XX_HOST_SS_AON_PWR_ISLAND_TRICKLE_EN0, CSS_CPU, val);
REGV_WR32(VPU_40XX_HOST_SS_AON_PWR_ISLAND_TRICKLE_EN0, val);
-
- if (enable)
- ndelay(500);
}
static void pwr_island_drive_37xx(struct ivpu_device *vdev, bool enable)
@@ -326,9 +323,6 @@ static void pwr_island_drive_37xx(struct ivpu_device *vdev, bool enable)
val = REG_CLR_FLD(VPU_40XX_HOST_SS_AON_PWR_ISLAND_EN0, CSS_CPU, val);
REGV_WR32(VPU_40XX_HOST_SS_AON_PWR_ISLAND_EN0, val);
-
- if (!enable)
- ndelay(500);
}
static void pwr_island_drive_40xx(struct ivpu_device *vdev, bool enable)
@@ -347,9 +341,11 @@ static void pwr_island_enable(struct ivpu_device *vdev)
{
if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX) {
pwr_island_trickle_drive_37xx(vdev, true);
+ ndelay(500);
pwr_island_drive_37xx(vdev, true);
} else {
pwr_island_trickle_drive_40xx(vdev, true);
+ ndelay(500);
pwr_island_drive_40xx(vdev, true);
}
}
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 10/31] accel/ivpu: Turn on autosuspend on Simics
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (8 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 09/31] accel/ivpu: Set 500 ns delay between power island TRICKLE and ENABLE Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 11/31] accel/ivpu: Add FW version debugfs entry Jacek Lawrynowicz
` (21 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
With recent Simics update DVFS flows using cdyn were fixed
and it is possible to enable D0i3/D3 entry flows on autosuspend.
Set autosuspend timeout to 100 ms by default on Simics.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_hw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/ivpu/ivpu_hw.c b/drivers/accel/ivpu/ivpu_hw.c
index 85219e9596215..1c259d7178151 100644
--- a/drivers/accel/ivpu/ivpu_hw.c
+++ b/drivers/accel/ivpu/ivpu_hw.c
@@ -94,7 +94,7 @@ static void timeouts_init(struct ivpu_device *vdev)
vdev->timeout.boot = 50;
vdev->timeout.jsm = 500;
vdev->timeout.tdr = 10000;
- vdev->timeout.autosuspend = -1;
+ vdev->timeout.autosuspend = 100;
vdev->timeout.d0i3_entry_msg = 100;
vdev->timeout.state_dump_msg = 10;
} else {
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 11/31] accel/ivpu: Add FW version debugfs entry
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (9 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 10/31] accel/ivpu: Turn on autosuspend on Simics Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 12/31] accel/ivpu: Stop using hardcoded DRIVER_DATE Jacek Lawrynowicz
` (20 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Add debugfs that prints current firmware version string on read.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_debugfs.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/accel/ivpu/ivpu_debugfs.c b/drivers/accel/ivpu/ivpu_debugfs.c
index cd3ac08f0409a..55dc2d883b444 100644
--- a/drivers/accel/ivpu/ivpu_debugfs.c
+++ b/drivers/accel/ivpu/ivpu_debugfs.c
@@ -45,6 +45,14 @@ static int fw_name_show(struct seq_file *s, void *v)
return 0;
}
+static int fw_version_show(struct seq_file *s, void *v)
+{
+ struct ivpu_device *vdev = seq_to_ivpu(s);
+
+ seq_printf(s, "%s\n", vdev->fw->version);
+ return 0;
+}
+
static int fw_trace_capability_show(struct seq_file *s, void *v)
{
struct ivpu_device *vdev = seq_to_ivpu(s);
@@ -111,6 +119,7 @@ static int reset_pending_show(struct seq_file *s, void *v)
static const struct drm_debugfs_info vdev_debugfs_list[] = {
{"bo_list", bo_list_show, 0},
{"fw_name", fw_name_show, 0},
+ {"fw_version", fw_version_show, 0},
{"fw_trace_capability", fw_trace_capability_show, 0},
{"fw_trace_config", fw_trace_config_show, 0},
{"last_bootmode", last_bootmode_show, 0},
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 12/31] accel/ivpu: Stop using hardcoded DRIVER_DATE
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (10 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 11/31] accel/ivpu: Add FW version debugfs entry Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 13/31] accel/ivpu: Remove 1-tile power up Simics workaround Jacek Lawrynowicz
` (19 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Karol Wachowski
Hardcoded driver date is useless, so use kernel version as a driver date
to make identifying .ko file easier. Also allow to pass DRIVER_DATE
on build time to allow versioning the driver in case it is built out
of the tree.
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.c | 15 +++++++++++----
drivers/accel/ivpu/ivpu_drv.h | 1 -
include/uapi/drm/ivpu_accel.h | 3 ---
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index 38b4158f52784..9fd371af5814c 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>
+#include <generated/utsrelease.h>
#include <drm/drm_accel.h>
#include <drm/drm_file.h>
@@ -32,8 +33,7 @@
#include "vpu_boot_api.h"
#ifndef DRIVER_VERSION_STR
-#define DRIVER_VERSION_STR __stringify(DRM_IVPU_DRIVER_MAJOR) "." \
- __stringify(DRM_IVPU_DRIVER_MINOR) "."
+#define DRIVER_VERSION_STR "1.0.0 " UTS_RELEASE
#endif
static struct lock_class_key submitted_jobs_xa_lock_class_key;
@@ -447,9 +447,16 @@ static const struct drm_driver driver = {
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
+
+#ifdef DRIVER_DATE
.date = DRIVER_DATE,
- .major = DRM_IVPU_DRIVER_MAJOR,
- .minor = DRM_IVPU_DRIVER_MINOR,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
+#else
+ .date = UTS_RELEASE,
+ .major = 1,
+#endif
};
static void ivpu_context_abort_invalid(struct ivpu_device *vdev)
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 2b30cc2e9272e..471478281021d 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -21,7 +21,6 @@
#define DRIVER_NAME "intel_vpu"
#define DRIVER_DESC "Driver for Intel NPU (Neural Processing Unit)"
-#define DRIVER_DATE "20230117"
#define PCI_DEVICE_ID_MTL 0x7d1d
#define PCI_DEVICE_ID_ARL 0xad1d
diff --git a/include/uapi/drm/ivpu_accel.h b/include/uapi/drm/ivpu_accel.h
index 084fb529e1e96..234664d352507 100644
--- a/include/uapi/drm/ivpu_accel.h
+++ b/include/uapi/drm/ivpu_accel.h
@@ -12,9 +12,6 @@
extern "C" {
#endif
-#define DRM_IVPU_DRIVER_MAJOR 1
-#define DRM_IVPU_DRIVER_MINOR 0
-
#define DRM_IVPU_GET_PARAM 0x00
#define DRM_IVPU_SET_PARAM 0x01
#define DRM_IVPU_BO_CREATE 0x02
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 13/31] accel/ivpu: Remove 1-tile power up Simics workaround
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (11 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 12/31] accel/ivpu: Stop using hardcoded DRIVER_DATE Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 14/31] accel/ivpu: Allow reading dvfs_mode debugfs file Jacek Lawrynowicz
` (18 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Previously Simics was not providing workpoint for configurations
with 0 tiles enabled, that had to be worked around in the KMD.
This got fixed in Simics and workaround is no longer needed.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_hw_btrs.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_hw_btrs.c b/drivers/accel/ivpu/ivpu_hw_btrs.c
index 745e5248803da..cad2ce7f2e244 100644
--- a/drivers/accel/ivpu/ivpu_hw_btrs.c
+++ b/drivers/accel/ivpu/ivpu_hw_btrs.c
@@ -315,10 +315,6 @@ static void prepare_wp_request(struct ivpu_device *vdev, struct wp_request *wp,
wp->cdyn = enable ? PLL_CDYN_DEFAULT : 0;
wp->epp = enable ? PLL_EPP_DEFAULT : 0;
}
-
- /* Simics cannot start without at least one tile */
- if (enable && ivpu_is_simics(vdev))
- wp->cfg = 1;
}
static int wait_for_pll_lock(struct ivpu_device *vdev, bool enable)
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 14/31] accel/ivpu: Allow reading dvfs_mode debugfs file
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (12 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 13/31] accel/ivpu: Remove 1-tile power up Simics workaround Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 15/31] accel/ivpu: Add one jiffy to bo_wait_ioctl timeout value Jacek Lawrynowicz
` (17 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Andrzej Kacprowski, Jacek Lawrynowicz
From: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Make the dvfs_mode read-write to allow checking current mode.
Simplify the dvfs_mode implementation with the DEFINE_DEBUGFS_ATTRIBUTE.
Signed-off-by: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_debugfs.c | 33 +++++++++++--------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_debugfs.c b/drivers/accel/ivpu/ivpu_debugfs.c
index 55dc2d883b444..f873119e56fe2 100644
--- a/drivers/accel/ivpu/ivpu_debugfs.c
+++ b/drivers/accel/ivpu/ivpu_debugfs.c
@@ -127,32 +127,23 @@ static const struct drm_debugfs_info vdev_debugfs_list[] = {
{"reset_pending", reset_pending_show, 0},
};
-static ssize_t
-dvfs_mode_fops_write(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
+static int dvfs_mode_get(void *data, u64 *dvfs_mode)
{
- struct ivpu_device *vdev = file->private_data;
- struct ivpu_fw_info *fw = vdev->fw;
- u32 dvfs_mode;
- int ret;
+ struct ivpu_device *vdev = (struct ivpu_device *)data;
- ret = kstrtou32_from_user(user_buf, size, 0, &dvfs_mode);
- if (ret < 0)
- return ret;
-
- fw->dvfs_mode = dvfs_mode;
+ *dvfs_mode = vdev->fw->dvfs_mode;
+ return 0;
+}
- ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
- if (ret)
- return ret;
+static int dvfs_mode_set(void *data, u64 dvfs_mode)
+{
+ struct ivpu_device *vdev = (struct ivpu_device *)data;
- return size;
+ vdev->fw->dvfs_mode = (u32)dvfs_mode;
+ return pci_try_reset_function(to_pci_dev(vdev->drm.dev));
}
-static const struct file_operations dvfs_mode_fops = {
- .owner = THIS_MODULE,
- .open = simple_open,
- .write = dvfs_mode_fops_write,
-};
+DEFINE_DEBUGFS_ATTRIBUTE(dvfs_mode_fops, dvfs_mode_get, dvfs_mode_set, "%llu\n");
static ssize_t
fw_dyndbg_fops_write(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
@@ -432,7 +423,7 @@ void ivpu_debugfs_init(struct ivpu_device *vdev)
debugfs_create_file("force_recovery", 0200, debugfs_root, vdev,
&ivpu_force_recovery_fops);
- debugfs_create_file("dvfs_mode", 0200, debugfs_root, vdev,
+ debugfs_create_file("dvfs_mode", 0644, debugfs_root, vdev,
&dvfs_mode_fops);
debugfs_create_file("fw_dyndbg", 0200, debugfs_root, vdev,
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 15/31] accel/ivpu: Add one jiffy to bo_wait_ioctl timeout value
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (13 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 14/31] accel/ivpu: Allow reading dvfs_mode debugfs file Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 16/31] accel/ivpu: Add auto selection logic for job scheduler Jacek Lawrynowicz
` (16 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Add one jiffy to ensure wait function never times out before
intended timeout value, which could happen if absolute timeout value
is less than (1s / CONFIG_HZ) in the future.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_gem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index 1b409dbd332d8..d8e97a760fbc0 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -384,6 +384,9 @@ int ivpu_bo_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file
timeout = drm_timeout_abs_to_jiffies(args->timeout_ns);
+ /* Add 1 jiffy to ensure the wait function never times out before intended timeout_ns */
+ timeout += 1;
+
obj = drm_gem_object_lookup(file, args->handle);
if (!obj)
return -EINVAL;
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 16/31] accel/ivpu: Add auto selection logic for job scheduler
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (14 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 15/31] accel/ivpu: Add one jiffy to bo_wait_ioctl timeout value Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 17/31] accel/ivpu: Print JSM message result in case of error Jacek Lawrynowicz
` (15 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Karol Wachowski
Add ivpu_fw_sched_mode_select() function that can select scheduling mode
based on HW and FW versions. This prepares for a switch to HWS on
selected platforms.
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.c | 6 +++---
drivers/accel/ivpu/ivpu_drv.h | 2 ++
drivers/accel/ivpu/ivpu_fw.c | 15 +++++++++++++--
drivers/accel/ivpu/ivpu_fw.h | 3 +++
drivers/accel/ivpu/ivpu_hw.h | 1 -
drivers/accel/ivpu/ivpu_hw_btrs.c | 2 --
drivers/accel/ivpu/ivpu_job.c | 14 +++++++-------
drivers/accel/ivpu/ivpu_sysfs.c | 24 ++++++++++++++++++++++++
8 files changed, 52 insertions(+), 15 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index 9fd371af5814c..fcf26e6d4e9c2 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -54,9 +54,9 @@ u8 ivpu_pll_max_ratio = U8_MAX;
module_param_named(pll_max_ratio, ivpu_pll_max_ratio, byte, 0644);
MODULE_PARM_DESC(pll_max_ratio, "Maximum PLL ratio used to set NPU frequency");
-int ivpu_sched_mode;
+int ivpu_sched_mode = IVPU_SCHED_MODE_AUTO;
module_param_named(sched_mode, ivpu_sched_mode, int, 0444);
-MODULE_PARM_DESC(sched_mode, "Scheduler mode: 0 - Default scheduler, 1 - Force HW scheduler");
+MODULE_PARM_DESC(sched_mode, "Scheduler mode: -1 - Use default scheduler, 0 - Use OS scheduler, 1 - Use HW scheduler");
bool ivpu_disable_mmu_cont_pages;
module_param_named(disable_mmu_cont_pages, ivpu_disable_mmu_cont_pages, bool, 0444);
@@ -347,7 +347,7 @@ static int ivpu_hw_sched_init(struct ivpu_device *vdev)
{
int ret = 0;
- if (vdev->hw->sched_mode == VPU_SCHEDULING_MODE_HW) {
+ if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW) {
ret = ivpu_jsm_hws_setup_priority_bands(vdev);
if (ret) {
ivpu_err(vdev, "Failed to enable hw scheduler: %d", ret);
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 471478281021d..c4bd8757f8ded 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -56,6 +56,8 @@
#define IVPU_PLATFORM_FPGA 3
#define IVPU_PLATFORM_INVALID 8
+#define IVPU_SCHED_MODE_AUTO -1
+
#define IVPU_DBG_REG BIT(0)
#define IVPU_DBG_IRQ BIT(1)
#define IVPU_DBG_MMU BIT(2)
diff --git a/drivers/accel/ivpu/ivpu_fw.c b/drivers/accel/ivpu/ivpu_fw.c
index b91449aa8a7c6..23baab68fc364 100644
--- a/drivers/accel/ivpu/ivpu_fw.c
+++ b/drivers/accel/ivpu/ivpu_fw.c
@@ -130,6 +130,15 @@ static bool is_within_range(u64 addr, size_t size, u64 range_start, size_t range
return true;
}
+static u32
+ivpu_fw_sched_mode_select(struct ivpu_device *vdev, const struct vpu_firmware_header *fw_hdr)
+{
+ if (ivpu_sched_mode != IVPU_SCHED_MODE_AUTO)
+ return ivpu_sched_mode;
+
+ return VPU_SCHEDULING_MODE_OS;
+}
+
static int ivpu_fw_parse(struct ivpu_device *vdev)
{
struct ivpu_fw_info *fw = vdev->fw;
@@ -211,8 +220,10 @@ static int ivpu_fw_parse(struct ivpu_device *vdev)
fw->dvfs_mode = 0;
+ fw->sched_mode = ivpu_fw_sched_mode_select(vdev, fw_hdr);
fw->primary_preempt_buf_size = fw_hdr->preemption_buffer_1_size;
fw->secondary_preempt_buf_size = fw_hdr->preemption_buffer_2_size;
+ ivpu_info(vdev, "Scheduler mode: %s\n", fw->sched_mode ? "HW" : "OS");
if (fw_hdr->ro_section_start_address && !is_within_range(fw_hdr->ro_section_start_address,
fw_hdr->ro_section_size,
@@ -601,8 +612,8 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params
boot_params->punit_telemetry_sram_base = ivpu_hw_telemetry_offset_get(vdev);
boot_params->punit_telemetry_sram_size = ivpu_hw_telemetry_size_get(vdev);
boot_params->vpu_telemetry_enable = ivpu_hw_telemetry_enable_get(vdev);
- boot_params->vpu_scheduling_mode = vdev->hw->sched_mode;
- if (vdev->hw->sched_mode == VPU_SCHEDULING_MODE_HW)
+ boot_params->vpu_scheduling_mode = vdev->fw->sched_mode;
+ if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
boot_params->vpu_focus_present_timer_ms = IVPU_FOCUS_PRESENT_TIMER_MS;
boot_params->dvfs_mode = vdev->fw->dvfs_mode;
if (!IVPU_WA(disable_d0i3_msg))
diff --git a/drivers/accel/ivpu/ivpu_fw.h b/drivers/accel/ivpu/ivpu_fw.h
index 5e8eb608b70f1..1d0b2bd9d65cf 100644
--- a/drivers/accel/ivpu/ivpu_fw.h
+++ b/drivers/accel/ivpu/ivpu_fw.h
@@ -6,6 +6,8 @@
#ifndef __IVPU_FW_H__
#define __IVPU_FW_H__
+#include "vpu_jsm_api.h"
+
#define FW_VERSION_HEADER_SIZE SZ_4K
#define FW_VERSION_STR_SIZE SZ_256
@@ -36,6 +38,7 @@ struct ivpu_fw_info {
u32 secondary_preempt_buf_size;
u64 read_only_addr;
u32 read_only_size;
+ u32 sched_mode;
};
int ivpu_fw_init(struct ivpu_device *vdev);
diff --git a/drivers/accel/ivpu/ivpu_hw.h b/drivers/accel/ivpu/ivpu_hw.h
index 1c0c98e3afb88..dc5518248c405 100644
--- a/drivers/accel/ivpu/ivpu_hw.h
+++ b/drivers/accel/ivpu/ivpu_hw.h
@@ -46,7 +46,6 @@ struct ivpu_hw_info {
u32 profiling_freq;
} pll;
u32 tile_fuse;
- u32 sched_mode;
u32 sku;
u16 config;
int dma_bits;
diff --git a/drivers/accel/ivpu/ivpu_hw_btrs.c b/drivers/accel/ivpu/ivpu_hw_btrs.c
index cad2ce7f2e244..7dc8e333dcec2 100644
--- a/drivers/accel/ivpu/ivpu_hw_btrs.c
+++ b/drivers/accel/ivpu/ivpu_hw_btrs.c
@@ -163,7 +163,6 @@ static int info_init_mtl(struct ivpu_device *vdev)
hw->tile_fuse = BTRS_MTL_TILE_FUSE_ENABLE_BOTH;
hw->sku = BTRS_MTL_TILE_SKU_BOTH;
hw->config = BTRS_MTL_WP_CONFIG_2_TILE_4_3_RATIO;
- hw->sched_mode = ivpu_sched_mode;
return 0;
}
@@ -178,7 +177,6 @@ static int info_init_lnl(struct ivpu_device *vdev)
if (ret)
return ret;
- hw->sched_mode = ivpu_sched_mode;
hw->tile_fuse = tile_fuse_config;
hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index b00634af8bc34..b1abdca5891cd 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -37,7 +37,7 @@ static int ivpu_preemption_buffers_create(struct ivpu_device *vdev,
u64 secondary_size = ALIGN(vdev->fw->secondary_preempt_buf_size, PAGE_SIZE);
struct ivpu_addr_range range;
- if (vdev->hw->sched_mode != VPU_SCHEDULING_MODE_HW)
+ if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
return 0;
range.start = vdev->hw->ranges.user.end - (primary_size * IVPU_NUM_CMDQS_PER_CTX);
@@ -68,7 +68,7 @@ static int ivpu_preemption_buffers_create(struct ivpu_device *vdev,
static void ivpu_preemption_buffers_free(struct ivpu_device *vdev,
struct ivpu_file_priv *file_priv, struct ivpu_cmdq *cmdq)
{
- if (vdev->hw->sched_mode != VPU_SCHEDULING_MODE_HW)
+ if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
return;
drm_WARN_ON(&vdev->drm, !cmdq->primary_preempt_buf);
@@ -149,7 +149,7 @@ static int ivpu_register_db(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *
struct ivpu_device *vdev = file_priv->vdev;
int ret;
- if (vdev->hw->sched_mode == VPU_SCHEDULING_MODE_HW)
+ if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW)
ret = ivpu_jsm_hws_register_db(vdev, file_priv->ctx.id, cmdq->db_id, cmdq->db_id,
cmdq->mem->vpu_addr, ivpu_bo_size(cmdq->mem));
else
@@ -184,7 +184,7 @@ ivpu_cmdq_init(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *cmdq, u16 eng
jobq_header->tail = 0;
wmb(); /* Flush WC buffer for jobq->header */
- if (vdev->hw->sched_mode == VPU_SCHEDULING_MODE_HW) {
+ if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW) {
ret = ivpu_hws_cmdq_init(file_priv, cmdq, engine, priority);
if (ret)
return ret;
@@ -211,7 +211,7 @@ static int ivpu_cmdq_fini(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *cm
cmdq->db_registered = false;
- if (vdev->hw->sched_mode == VPU_SCHEDULING_MODE_HW) {
+ if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW) {
ret = ivpu_jsm_hws_destroy_cmdq(vdev, file_priv->ctx.id, cmdq->db_id);
if (!ret)
ivpu_dbg(vdev, JOB, "Command queue %d destroyed\n", cmdq->db_id);
@@ -335,7 +335,7 @@ void ivpu_context_abort_locked(struct ivpu_file_priv *file_priv)
ivpu_cmdq_fini_all(file_priv);
- if (vdev->hw->sched_mode == VPU_SCHEDULING_MODE_OS)
+ if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_OS)
ivpu_jsm_context_release(vdev, file_priv->ctx.id);
}
@@ -361,7 +361,7 @@ static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job)
if (unlikely(ivpu_test_mode & IVPU_TEST_MODE_NULL_SUBMISSION))
entry->flags = VPU_JOB_FLAGS_NULL_SUBMISSION_MASK;
- if (vdev->hw->sched_mode == VPU_SCHEDULING_MODE_HW &&
+ if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW &&
(unlikely(!(ivpu_test_mode & IVPU_TEST_MODE_PREEMPTION_DISABLE)))) {
entry->primary_preempt_buf_addr = cmdq->primary_preempt_buf->vpu_addr;
entry->primary_preempt_buf_size = ivpu_bo_size(cmdq->primary_preempt_buf);
diff --git a/drivers/accel/ivpu/ivpu_sysfs.c b/drivers/accel/ivpu/ivpu_sysfs.c
index 913669f1786e8..1916651cc14c4 100644
--- a/drivers/accel/ivpu/ivpu_sysfs.c
+++ b/drivers/accel/ivpu/ivpu_sysfs.c
@@ -6,6 +6,8 @@
#include <linux/device.h>
#include <linux/err.h>
+#include "ivpu_drv.h"
+#include "ivpu_fw.h"
#include "ivpu_hw.h"
#include "ivpu_sysfs.h"
@@ -39,8 +41,30 @@ npu_busy_time_us_show(struct device *dev, struct device_attribute *attr, char *b
static DEVICE_ATTR_RO(npu_busy_time_us);
+/**
+ * DOC: sched_mode
+ *
+ * The sched_mode is used to report current NPU scheduling mode.
+ *
+ * It returns following strings:
+ * - "HW" - Hardware Scheduler mode
+ * - "OS" - Operating System Scheduler mode
+ *
+ */
+static ssize_t
+sched_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct drm_device *drm = dev_get_drvdata(dev);
+ struct ivpu_device *vdev = to_ivpu_device(drm);
+
+ return sysfs_emit(buf, "%s\n", vdev->fw->sched_mode ? "HW" : "HW");
+}
+
+static DEVICE_ATTR_RO(sched_mode);
+
static struct attribute *ivpu_dev_attrs[] = {
&dev_attr_npu_busy_time_us.attr,
+ &dev_attr_sched_mode.attr,
NULL,
};
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 17/31] accel/ivpu: Print JSM message result in case of error
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (15 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 16/31] accel/ivpu: Add auto selection logic for job scheduler Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 18/31] accel/ivpu: Make DB_ID and JOB_ID allocations incremental Jacek Lawrynowicz
` (14 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Change debug message to error level in case of receiving
non-successful result of JSM message.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_ipc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/ivpu/ivpu_ipc.c b/drivers/accel/ivpu/ivpu_ipc.c
index 83b4ba4f3e20a..e7bccc20e4e4e 100644
--- a/drivers/accel/ivpu/ivpu_ipc.c
+++ b/drivers/accel/ivpu/ivpu_ipc.c
@@ -278,7 +278,7 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
u32 size = min_t(int, rx_msg->ipc_hdr->data_size, sizeof(*jsm_msg));
if (rx_msg->jsm_msg->result != VPU_JSM_STATUS_SUCCESS) {
- ivpu_dbg(vdev, IPC, "IPC resp result error: %d\n", rx_msg->jsm_msg->result);
+ ivpu_err(vdev, "IPC resp result error: %d\n", rx_msg->jsm_msg->result);
ret = -EBADMSG;
}
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 18/31] accel/ivpu: Make DB_ID and JOB_ID allocations incremental
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (16 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 17/31] accel/ivpu: Print JSM message result in case of error Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 19/31] accel/ivpu: Add test_mode bit to force turbo Jacek Lawrynowicz
` (13 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Tomasz Rusinowicz, Jacek Lawrynowicz
From: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Save last used ID and use it to limit the possible values
for the ID. This should decrease the rate at which the IDs
are reused, which will make debugging easier.
Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.c | 9 +++++++++
drivers/accel/ivpu/ivpu_drv.h | 7 +++++++
drivers/accel/ivpu/ivpu_job.c | 37 +++++++++++++++++++++++++----------
3 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index fcf26e6d4e9c2..ffb8309a4f657 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -260,6 +260,11 @@ static int ivpu_open(struct drm_device *dev, struct drm_file *file)
if (ret)
goto err_xa_erase;
+ file_priv->default_job_limit.min = FIELD_PREP(IVPU_JOB_ID_CONTEXT_MASK,
+ (file_priv->ctx.id - 1));
+ file_priv->default_job_limit.max = file_priv->default_job_limit.min | IVPU_JOB_ID_JOB_MASK;
+ file_priv->job_limit = file_priv->default_job_limit;
+
mutex_unlock(&vdev->context_list_lock);
drm_dev_exit(idx);
@@ -614,6 +619,10 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
lockdep_set_class(&vdev->submitted_jobs_xa.xa_lock, &submitted_jobs_xa_lock_class_key);
INIT_LIST_HEAD(&vdev->bo_list);
+ vdev->default_db_limit.min = IVPU_MIN_DB;
+ vdev->default_db_limit.max = IVPU_MAX_DB;
+ vdev->db_limit = vdev->default_db_limit;
+
ret = drmm_mutex_init(&vdev->drm, &vdev->context_list_lock);
if (ret)
goto err_xa_destroy;
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index c4bd8757f8ded..9acef14deab57 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -45,6 +45,9 @@
#define IVPU_MIN_DB 1
#define IVPU_MAX_DB 255
+#define IVPU_JOB_ID_JOB_MASK GENMASK(7, 0)
+#define IVPU_JOB_ID_CONTEXT_MASK GENMASK(31, 8)
+
#define IVPU_NUM_ENGINES 2
#define IVPU_NUM_PRIORITIES 4
#define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_ENGINES * IVPU_NUM_PRIORITIES)
@@ -135,6 +138,8 @@ struct ivpu_device {
struct xa_limit context_xa_limit;
struct xarray db_xa;
+ struct xa_limit db_limit;
+ struct xa_limit default_db_limit;
struct mutex bo_list_lock; /* Protects bo_list */
struct list_head bo_list;
@@ -170,6 +175,8 @@ struct ivpu_file_priv {
struct mutex ms_lock; /* Protects ms_instance_list, ms_info_bo */
struct list_head ms_instance_list;
struct ivpu_bo *ms_info_bo;
+ struct xa_limit job_limit;
+ struct xa_limit default_job_limit;
bool has_mmu_faults;
bool bound;
bool aborted;
diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index b1abdca5891cd..8798fb2046abc 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -21,8 +21,6 @@
#include "vpu_boot_api.h"
#define CMD_BUF_IDX 0
-#define JOB_ID_JOB_MASK GENMASK(7, 0)
-#define JOB_ID_CONTEXT_MASK GENMASK(31, 8)
#define JOB_MAX_BUFFER_COUNT 65535
static void ivpu_cmdq_ring_db(struct ivpu_device *vdev, struct ivpu_cmdq *cmdq)
@@ -77,9 +75,28 @@ static void ivpu_preemption_buffers_free(struct ivpu_device *vdev,
ivpu_bo_free(cmdq->secondary_preempt_buf);
}
+static int ivpu_id_alloc(struct xarray *xa, u32 *id, void *entry, struct xa_limit *limit,
+ const struct xa_limit default_limit)
+{
+ int ret;
+
+ ret = __xa_alloc(xa, id, entry, *limit, GFP_KERNEL);
+ if (ret) {
+ limit->min = default_limit.min;
+ ret = __xa_alloc(xa, id, entry, *limit, GFP_KERNEL);
+ if (ret)
+ return ret;
+ }
+
+ limit->min = *id + 1;
+ if (limit->min > limit->max)
+ limit->min = default_limit.min;
+
+ return ret;
+}
+
static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv)
{
- struct xa_limit db_xa_limit = {.max = IVPU_MAX_DB, .min = IVPU_MIN_DB};
struct ivpu_device *vdev = file_priv->vdev;
struct ivpu_cmdq *cmdq;
int ret;
@@ -88,7 +105,10 @@ static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv)
if (!cmdq)
return NULL;
- ret = xa_alloc(&vdev->db_xa, &cmdq->db_id, NULL, db_xa_limit, GFP_KERNEL);
+ xa_lock(&vdev->db_xa); /* lock here to protect db_limit */
+ ret = ivpu_id_alloc(&vdev->db_xa, &cmdq->db_id, NULL, &vdev->db_limit,
+ vdev->default_db_limit);
+ xa_unlock(&vdev->db_xa);
if (ret) {
ivpu_err(vdev, "Failed to allocate doorbell id: %d\n", ret);
goto err_free_cmdq;
@@ -519,7 +539,6 @@ static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
{
struct ivpu_file_priv *file_priv = job->file_priv;
struct ivpu_device *vdev = job->vdev;
- struct xa_limit job_id_range;
struct ivpu_cmdq *cmdq;
bool is_first_job;
int ret;
@@ -530,7 +549,7 @@ static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
mutex_lock(&file_priv->lock);
- cmdq = ivpu_cmdq_acquire(job->file_priv, job->engine_idx, priority);
+ cmdq = ivpu_cmdq_acquire(file_priv, job->engine_idx, priority);
if (!cmdq) {
ivpu_warn_ratelimited(vdev, "Failed to get job queue, ctx %d engine %d prio %d\n",
file_priv->ctx.id, job->engine_idx, priority);
@@ -538,12 +557,10 @@ static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
goto err_unlock_file_priv;
}
- job_id_range.min = FIELD_PREP(JOB_ID_CONTEXT_MASK, (file_priv->ctx.id - 1));
- job_id_range.max = job_id_range.min | JOB_ID_JOB_MASK;
-
xa_lock(&vdev->submitted_jobs_xa);
is_first_job = xa_empty(&vdev->submitted_jobs_xa);
- ret = __xa_alloc(&vdev->submitted_jobs_xa, &job->job_id, job, job_id_range, GFP_KERNEL);
+ ret = ivpu_id_alloc(&vdev->submitted_jobs_xa, &job->job_id, job, &file_priv->job_limit,
+ file_priv->default_job_limit);
if (ret) {
ivpu_dbg(vdev, JOB, "Too many active jobs in ctx %d\n",
file_priv->ctx.id);
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 19/31] accel/ivpu: Add test_mode bit to force turbo
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (17 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 18/31] accel/ivpu: Make DB_ID and JOB_ID allocations incremental Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 20/31] accel/ivpu: Remove skip of clock own resource ack on Simics Jacek Lawrynowicz
` (12 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Andrzej Kacprowski, Jacek Lawrynowicz
From: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Add new test_mode BIT(9) that forces firmware to
enable turbo burst mode.
Signed-off-by: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.h | 1 +
drivers/accel/ivpu/ivpu_job.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 9acef14deab57..151ab9f2ddc9b 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -197,6 +197,7 @@ extern bool ivpu_force_snoop;
#define IVPU_TEST_MODE_PREEMPTION_DISABLE BIT(6)
#define IVPU_TEST_MODE_HWS_EXTRA_EVENTS BIT(7)
#define IVPU_TEST_MODE_DISABLE_TIMEOUTS BIT(8)
+#define IVPU_TEST_MODE_TURBO BIT(9)
extern int ivpu_test_mode;
struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv);
diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index 8798fb2046abc..dc5cf7ded9439 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -202,6 +202,11 @@ ivpu_cmdq_init(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *cmdq, u16 eng
jobq_header->engine_idx = engine;
jobq_header->head = 0;
jobq_header->tail = 0;
+ if (ivpu_test_mode & IVPU_TEST_MODE_TURBO) {
+ ivpu_dbg(vdev, JOB, "Turbo mode enabled");
+ jobq_header->flags = VPU_JOB_QUEUE_FLAGS_TURBO_MODE;
+ }
+
wmb(); /* Flush WC buffer for jobq->header */
if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW) {
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 20/31] accel/ivpu: Remove skip of clock own resource ack on Simics
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (18 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 19/31] accel/ivpu: Add test_mode bit to force turbo Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 21/31] accel/ivpu: Fix reset_engine debugfs file logic Jacek Lawrynowicz
` (11 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
With recent Simics model update CLOCK_RESOURCE_OWN_ACK signal
was implemented as part of VPU STATUS register and workaround
is no longer needed.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_hw_btrs.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_hw_btrs.c b/drivers/accel/ivpu/ivpu_hw_btrs.c
index 7dc8e333dcec2..6d5f1cc711435 100644
--- a/drivers/accel/ivpu/ivpu_hw_btrs.c
+++ b/drivers/accel/ivpu/ivpu_hw_btrs.c
@@ -459,9 +459,6 @@ int ivpu_hw_btrs_wait_for_clock_res_own_ack(struct ivpu_device *vdev)
if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL)
return 0;
- if (ivpu_is_simics(vdev))
- return 0;
-
return REGB_POLL_FLD(VPU_HW_BTRS_LNL_VPU_STATUS, CLOCK_RESOURCE_OWN_ACK, 1, TIMEOUT_US);
}
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 21/31] accel/ivpu: Fix reset_engine debugfs file logic
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (19 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 20/31] accel/ivpu: Remove skip of clock own resource ack on Simics Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 22/31] accel/ivpu: Prevent recovery invocation during probe and resume Jacek Lawrynowicz
` (10 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Andrzej Kacprowski, Jacek Lawrynowicz
From: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
The current reset_engine implementation unconditionally resets
all engines. Improve implementation to reset only the engine
requested by the user space to allow more granular testing.
Also use DEFINE_DEBUGFS_ATTRIBUTE() to simplify implementation.
Same changes applied to resume_engine debugfs file for consistency.
Signed-off-by: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_debugfs.c | 42 ++++++-------------------------
1 file changed, 8 insertions(+), 34 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_debugfs.c b/drivers/accel/ivpu/ivpu_debugfs.c
index f873119e56fe2..8958145c49adb 100644
--- a/drivers/accel/ivpu/ivpu_debugfs.c
+++ b/drivers/accel/ivpu/ivpu_debugfs.c
@@ -337,49 +337,23 @@ static const struct file_operations ivpu_force_recovery_fops = {
.write = ivpu_force_recovery_fn,
};
-static ssize_t
-ivpu_reset_engine_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
+static int ivpu_reset_engine_fn(void *data, u64 val)
{
- struct ivpu_device *vdev = file->private_data;
-
- if (!size)
- return -EINVAL;
-
- if (ivpu_jsm_reset_engine(vdev, DRM_IVPU_ENGINE_COMPUTE))
- return -ENODEV;
- if (ivpu_jsm_reset_engine(vdev, DRM_IVPU_ENGINE_COPY))
- return -ENODEV;
+ struct ivpu_device *vdev = (struct ivpu_device *)data;
- return size;
+ return ivpu_jsm_reset_engine(vdev, (u32)val);
}
-static const struct file_operations ivpu_reset_engine_fops = {
- .owner = THIS_MODULE,
- .open = simple_open,
- .write = ivpu_reset_engine_fn,
-};
+DEFINE_DEBUGFS_ATTRIBUTE(ivpu_reset_engine_fops, NULL, ivpu_reset_engine_fn, "0x%02llx\n");
-static ssize_t
-ivpu_resume_engine_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
+static int ivpu_resume_engine_fn(void *data, u64 val)
{
- struct ivpu_device *vdev = file->private_data;
-
- if (!size)
- return -EINVAL;
-
- if (ivpu_jsm_hws_resume_engine(vdev, DRM_IVPU_ENGINE_COMPUTE))
- return -ENODEV;
- if (ivpu_jsm_hws_resume_engine(vdev, DRM_IVPU_ENGINE_COPY))
- return -ENODEV;
+ struct ivpu_device *vdev = (struct ivpu_device *)data;
- return size;
+ return ivpu_jsm_hws_resume_engine(vdev, (u32)val);
}
-static const struct file_operations ivpu_resume_engine_fops = {
- .owner = THIS_MODULE,
- .open = simple_open,
- .write = ivpu_resume_engine_fn,
-};
+DEFINE_DEBUGFS_ATTRIBUTE(ivpu_resume_engine_fops, NULL, ivpu_resume_engine_fn, "0x%02llx\n");
static int dct_active_get(void *data, u64 *active_percent)
{
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 22/31] accel/ivpu: Prevent recovery invocation during probe and resume
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (20 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 21/31] accel/ivpu: Fix reset_engine debugfs file logic Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 23/31] accel/ivpu: Refactor failure diagnostics during boot Jacek Lawrynowicz
` (9 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Refactor IPC send and receive functions to allow correct
handling of operations that should not trigger a recovery process.
Expose ivpu_send_receive_internal(), which is now utilized by the D0i3
entry, DCT initialization, and HWS initialization functions.
These functions have been modified to return error codes gracefully,
rather than initiating recovery.
The updated functions are invoked within ivpu_probe() and ivpu_resume(),
ensuring that any errors encountered during these stages result in a proper
teardown or shutdown sequence. The previous approach of triggering recovery
within these functions could lead to a race condition, potentially causing
undefined behavior and kernel crashes due to null pointer dereferences.
Fixes: 45e45362e095 ("accel/ivpu: Introduce ivpu_ipc_send_receive_active()")
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_ipc.c | 35 +++++++++++--------------------
drivers/accel/ivpu/ivpu_ipc.h | 7 +++----
drivers/accel/ivpu/ivpu_jsm_msg.c | 19 +++++++----------
3 files changed, 23 insertions(+), 38 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_ipc.c b/drivers/accel/ivpu/ivpu_ipc.c
index e7bccc20e4e4e..a4ebb761354c3 100644
--- a/drivers/accel/ivpu/ivpu_ipc.c
+++ b/drivers/accel/ivpu/ivpu_ipc.c
@@ -291,15 +291,16 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
return ret;
}
-static int
+int
ivpu_ipc_send_receive_internal(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
enum vpu_ipc_msg_type expected_resp_type,
- struct vpu_jsm_msg *resp, u32 channel,
- unsigned long timeout_ms)
+ struct vpu_jsm_msg *resp, u32 channel, unsigned long timeout_ms)
{
struct ivpu_ipc_consumer cons;
int ret;
+ drm_WARN_ON(&vdev->drm, pm_runtime_status_suspended(vdev->drm.dev));
+
ivpu_ipc_consumer_add(vdev, &cons, channel, NULL);
ret = ivpu_ipc_send(vdev, &cons, req);
@@ -325,19 +326,21 @@ ivpu_ipc_send_receive_internal(struct ivpu_device *vdev, struct vpu_jsm_msg *req
return ret;
}
-int ivpu_ipc_send_receive_active(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
- enum vpu_ipc_msg_type expected_resp, struct vpu_jsm_msg *resp,
- u32 channel, unsigned long timeout_ms)
+int ivpu_ipc_send_receive(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
+ enum vpu_ipc_msg_type expected_resp, struct vpu_jsm_msg *resp,
+ u32 channel, unsigned long timeout_ms)
{
struct vpu_jsm_msg hb_req = { .type = VPU_JSM_MSG_QUERY_ENGINE_HB };
struct vpu_jsm_msg hb_resp;
int ret, hb_ret;
- drm_WARN_ON(&vdev->drm, pm_runtime_status_suspended(vdev->drm.dev));
+ ret = ivpu_rpm_get(vdev);
+ if (ret < 0)
+ return ret;
ret = ivpu_ipc_send_receive_internal(vdev, req, expected_resp, resp, channel, timeout_ms);
if (ret != -ETIMEDOUT)
- return ret;
+ goto rpm_put;
hb_ret = ivpu_ipc_send_receive_internal(vdev, &hb_req, VPU_JSM_MSG_QUERY_ENGINE_HB_DONE,
&hb_resp, VPU_IPC_CHAN_ASYNC_CMD,
@@ -345,21 +348,7 @@ int ivpu_ipc_send_receive_active(struct ivpu_device *vdev, struct vpu_jsm_msg *r
if (hb_ret == -ETIMEDOUT)
ivpu_pm_trigger_recovery(vdev, "IPC timeout");
- return ret;
-}
-
-int ivpu_ipc_send_receive(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
- enum vpu_ipc_msg_type expected_resp, struct vpu_jsm_msg *resp,
- u32 channel, unsigned long timeout_ms)
-{
- int ret;
-
- ret = ivpu_rpm_get(vdev);
- if (ret < 0)
- return ret;
-
- ret = ivpu_ipc_send_receive_active(vdev, req, expected_resp, resp, channel, timeout_ms);
-
+rpm_put:
ivpu_rpm_put(vdev);
return ret;
}
diff --git a/drivers/accel/ivpu/ivpu_ipc.h b/drivers/accel/ivpu/ivpu_ipc.h
index 6bbe6e32c8749..b4dfb504679ba 100644
--- a/drivers/accel/ivpu/ivpu_ipc.h
+++ b/drivers/accel/ivpu/ivpu_ipc.h
@@ -101,10 +101,9 @@ int ivpu_ipc_send(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
struct ivpu_ipc_hdr *ipc_buf, struct vpu_jsm_msg *jsm_msg,
unsigned long timeout_ms);
-
-int ivpu_ipc_send_receive_active(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
- enum vpu_ipc_msg_type expected_resp, struct vpu_jsm_msg *resp,
- u32 channel, unsigned long timeout_ms);
+int ivpu_ipc_send_receive_internal(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
+ enum vpu_ipc_msg_type expected_resp_type,
+ struct vpu_jsm_msg *resp, u32 channel, unsigned long timeout_ms);
int ivpu_ipc_send_receive(struct ivpu_device *vdev, struct vpu_jsm_msg *req,
enum vpu_ipc_msg_type expected_resp, struct vpu_jsm_msg *resp,
u32 channel, unsigned long timeout_ms);
diff --git a/drivers/accel/ivpu/ivpu_jsm_msg.c b/drivers/accel/ivpu/ivpu_jsm_msg.c
index cd33964d292bc..ae91ad24d10d8 100644
--- a/drivers/accel/ivpu/ivpu_jsm_msg.c
+++ b/drivers/accel/ivpu/ivpu_jsm_msg.c
@@ -271,9 +271,8 @@ int ivpu_jsm_pwr_d0i3_enter(struct ivpu_device *vdev)
req.payload.pwr_d0i3_enter.send_response = 1;
- ret = ivpu_ipc_send_receive_active(vdev, &req, VPU_JSM_MSG_PWR_D0I3_ENTER_DONE,
- &resp, VPU_IPC_CHAN_GEN_CMD,
- vdev->timeout.d0i3_entry_msg);
+ ret = ivpu_ipc_send_receive_internal(vdev, &req, VPU_JSM_MSG_PWR_D0I3_ENTER_DONE, &resp,
+ VPU_IPC_CHAN_GEN_CMD, vdev->timeout.d0i3_entry_msg);
if (ret)
return ret;
@@ -431,8 +430,8 @@ int ivpu_jsm_hws_setup_priority_bands(struct ivpu_device *vdev)
req.payload.hws_priority_band_setup.normal_band_percentage = 10;
- ret = ivpu_ipc_send_receive_active(vdev, &req, VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP_RSP,
- &resp, VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
+ ret = ivpu_ipc_send_receive_internal(vdev, &req, VPU_JSM_MSG_SET_PRIORITY_BAND_SETUP_RSP,
+ &resp, VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
if (ret)
ivpu_warn_ratelimited(vdev, "Failed to set priority bands: %d\n", ret);
@@ -545,9 +544,8 @@ int ivpu_jsm_dct_enable(struct ivpu_device *vdev, u32 active_us, u32 inactive_us
req.payload.pwr_dct_control.dct_active_us = active_us;
req.payload.pwr_dct_control.dct_inactive_us = inactive_us;
- return ivpu_ipc_send_receive_active(vdev, &req, VPU_JSM_MSG_DCT_ENABLE_DONE,
- &resp, VPU_IPC_CHAN_ASYNC_CMD,
- vdev->timeout.jsm);
+ return ivpu_ipc_send_receive_internal(vdev, &req, VPU_JSM_MSG_DCT_ENABLE_DONE, &resp,
+ VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
}
int ivpu_jsm_dct_disable(struct ivpu_device *vdev)
@@ -555,9 +553,8 @@ int ivpu_jsm_dct_disable(struct ivpu_device *vdev)
struct vpu_jsm_msg req = { .type = VPU_JSM_MSG_DCT_DISABLE };
struct vpu_jsm_msg resp;
- return ivpu_ipc_send_receive_active(vdev, &req, VPU_JSM_MSG_DCT_DISABLE_DONE,
- &resp, VPU_IPC_CHAN_ASYNC_CMD,
- vdev->timeout.jsm);
+ return ivpu_ipc_send_receive_internal(vdev, &req, VPU_JSM_MSG_DCT_DISABLE_DONE, &resp,
+ VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
}
int ivpu_jsm_state_dump(struct ivpu_device *vdev)
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 23/31] accel/ivpu: Refactor failure diagnostics during boot
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (21 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 22/31] accel/ivpu: Prevent recovery invocation during probe and resume Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 24/31] accel/ivpu: Remove invalid warnings Jacek Lawrynowicz
` (8 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Move diagnostic functions to common error handling within ivpu_boot()
function to ensure diagnostics are gathered even in cases where NPU
fails after successful boot (DCT and HWS init failures).
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index ffb8309a4f657..14c2412c6f8e6 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -386,10 +386,7 @@ int ivpu_boot(struct ivpu_device *vdev)
ret = ivpu_wait_for_ready(vdev);
if (ret) {
ivpu_err(vdev, "Failed to boot the firmware: %d\n", ret);
- ivpu_hw_diagnose_failure(vdev);
- ivpu_mmu_evtq_dump(vdev);
- ivpu_dev_coredump(vdev);
- return ret;
+ goto err_diagnose_failure;
}
ivpu_hw_irq_clear(vdev);
@@ -400,12 +397,20 @@ int ivpu_boot(struct ivpu_device *vdev)
if (ivpu_fw_is_cold_boot(vdev)) {
ret = ivpu_pm_dct_init(vdev);
if (ret)
- return ret;
+ goto err_diagnose_failure;
- return ivpu_hw_sched_init(vdev);
+ ret = ivpu_hw_sched_init(vdev);
+ if (ret)
+ goto err_diagnose_failure;
}
return 0;
+
+err_diagnose_failure:
+ ivpu_hw_diagnose_failure(vdev);
+ ivpu_mmu_evtq_dump(vdev);
+ ivpu_dev_coredump(vdev);
+ return ret;
}
void ivpu_prepare_for_reset(struct ivpu_device *vdev)
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 24/31] accel/ivpu: Remove invalid warnings
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (22 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 23/31] accel/ivpu: Refactor failure diagnostics during boot Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 25/31] accel/ivpu: Do not fail on cmdq if failed to allocate preemption buffers Jacek Lawrynowicz
` (7 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Karol Wachowski
Warn in ivpu_file_priv_put() checks a pointer that is previously
accessed. Warn in ivpu_ipc_fini() can be triggered even in valid cases
where IPC is disabled upon closing the device.
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.c | 2 --
drivers/accel/ivpu/ivpu_ipc.c | 1 -
2 files changed, 3 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c
index 14c2412c6f8e6..dc983140128b4 100644
--- a/drivers/accel/ivpu/ivpu_drv.c
+++ b/drivers/accel/ivpu/ivpu_drv.c
@@ -117,8 +117,6 @@ void ivpu_file_priv_put(struct ivpu_file_priv **link)
struct ivpu_file_priv *file_priv = *link;
struct ivpu_device *vdev = file_priv->vdev;
- drm_WARN_ON(&vdev->drm, !file_priv);
-
ivpu_dbg(vdev, KREF, "file_priv put: ctx %u refcount %u\n",
file_priv->ctx.id, kref_read(&file_priv->ref));
diff --git a/drivers/accel/ivpu/ivpu_ipc.c b/drivers/accel/ivpu/ivpu_ipc.c
index a4ebb761354c3..c8ae69a529c0d 100644
--- a/drivers/accel/ivpu/ivpu_ipc.c
+++ b/drivers/accel/ivpu/ivpu_ipc.c
@@ -533,7 +533,6 @@ void ivpu_ipc_fini(struct ivpu_device *vdev)
{
struct ivpu_ipc_info *ipc = vdev->ipc;
- drm_WARN_ON(&vdev->drm, ipc->on);
drm_WARN_ON(&vdev->drm, !list_empty(&ipc->cons_list));
drm_WARN_ON(&vdev->drm, !list_empty(&ipc->cb_msg_list));
drm_WARN_ON(&vdev->drm, atomic_read(&ipc->rx_msg_count) > 0);
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 25/31] accel/ivpu: Do not fail on cmdq if failed to allocate preemption buffers
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (23 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 24/31] accel/ivpu: Remove invalid warnings Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 26/31] accel/ivpu: Use whole user and shave ranges for " Jacek Lawrynowicz
` (6 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Allow to proceed with job command queue creation even if preemption
buffers failed to be allocated, print warning that preemption on such
command queue will be disabled.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_job.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index dc5cf7ded9439..48272bc853e0c 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -60,6 +60,7 @@ static int ivpu_preemption_buffers_create(struct ivpu_device *vdev,
err_free_primary:
ivpu_bo_free(cmdq->primary_preempt_buf);
+ cmdq->primary_preempt_buf = NULL;
return -ENOMEM;
}
@@ -69,10 +70,10 @@ static void ivpu_preemption_buffers_free(struct ivpu_device *vdev,
if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
return;
- drm_WARN_ON(&vdev->drm, !cmdq->primary_preempt_buf);
- drm_WARN_ON(&vdev->drm, !cmdq->secondary_preempt_buf);
- ivpu_bo_free(cmdq->primary_preempt_buf);
- ivpu_bo_free(cmdq->secondary_preempt_buf);
+ if (cmdq->primary_preempt_buf)
+ ivpu_bo_free(cmdq->primary_preempt_buf);
+ if (cmdq->secondary_preempt_buf)
+ ivpu_bo_free(cmdq->secondary_preempt_buf);
}
static int ivpu_id_alloc(struct xarray *xa, u32 *id, void *entry, struct xa_limit *limit,
@@ -120,12 +121,10 @@ static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv)
ret = ivpu_preemption_buffers_create(vdev, file_priv, cmdq);
if (ret)
- goto err_free_cmdq_mem;
+ ivpu_warn(vdev, "Failed to allocate preemption buffers, preemption limited\n");
return cmdq;
-err_free_cmdq_mem:
- ivpu_bo_free(cmdq->mem);
err_erase_xa:
xa_erase(&vdev->db_xa, cmdq->db_id);
err_free_cmdq:
@@ -388,10 +387,16 @@ static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job)
if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW &&
(unlikely(!(ivpu_test_mode & IVPU_TEST_MODE_PREEMPTION_DISABLE)))) {
- entry->primary_preempt_buf_addr = cmdq->primary_preempt_buf->vpu_addr;
- entry->primary_preempt_buf_size = ivpu_bo_size(cmdq->primary_preempt_buf);
- entry->secondary_preempt_buf_addr = cmdq->secondary_preempt_buf->vpu_addr;
- entry->secondary_preempt_buf_size = ivpu_bo_size(cmdq->secondary_preempt_buf);
+ if (cmdq->primary_preempt_buf) {
+ entry->primary_preempt_buf_addr = cmdq->primary_preempt_buf->vpu_addr;
+ entry->primary_preempt_buf_size = ivpu_bo_size(cmdq->primary_preempt_buf);
+ }
+
+ if (cmdq->secondary_preempt_buf) {
+ entry->secondary_preempt_buf_addr = cmdq->secondary_preempt_buf->vpu_addr;
+ entry->secondary_preempt_buf_size =
+ ivpu_bo_size(cmdq->secondary_preempt_buf);
+ }
}
wmb(); /* Ensure that tail is updated after filling entry */
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 26/31] accel/ivpu: Use whole user and shave ranges for preemption buffers
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (24 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 25/31] accel/ivpu: Do not fail on cmdq if failed to allocate preemption buffers Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 27/31] accel/ivpu: Increase MS info buffer size Jacek Lawrynowicz
` (5 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Karol Wachowski, Jacek Lawrynowicz
From: Karol Wachowski <karol.wachowski@intel.com>
Do not restrict range for preemption buffers allocation just to the end
of user and shave ranges, use them whole instead to avoid situation
where end of range might be already allocated causing preemption buffers
allocation to fail.
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_job.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index 48272bc853e0c..cd41b87715056 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -33,24 +33,19 @@ static int ivpu_preemption_buffers_create(struct ivpu_device *vdev,
{
u64 primary_size = ALIGN(vdev->fw->primary_preempt_buf_size, PAGE_SIZE);
u64 secondary_size = ALIGN(vdev->fw->secondary_preempt_buf_size, PAGE_SIZE);
- struct ivpu_addr_range range;
if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
return 0;
- range.start = vdev->hw->ranges.user.end - (primary_size * IVPU_NUM_CMDQS_PER_CTX);
- range.end = vdev->hw->ranges.user.end;
- cmdq->primary_preempt_buf = ivpu_bo_create(vdev, &file_priv->ctx, &range, primary_size,
- DRM_IVPU_BO_WC);
+ cmdq->primary_preempt_buf = ivpu_bo_create(vdev, &file_priv->ctx, &vdev->hw->ranges.user,
+ primary_size, DRM_IVPU_BO_WC);
if (!cmdq->primary_preempt_buf) {
ivpu_err(vdev, "Failed to create primary preemption buffer\n");
return -ENOMEM;
}
- range.start = vdev->hw->ranges.shave.end - (secondary_size * IVPU_NUM_CMDQS_PER_CTX);
- range.end = vdev->hw->ranges.shave.end;
- cmdq->secondary_preempt_buf = ivpu_bo_create(vdev, &file_priv->ctx, &range, secondary_size,
- DRM_IVPU_BO_WC);
+ cmdq->secondary_preempt_buf = ivpu_bo_create(vdev, &file_priv->ctx, &vdev->hw->ranges.shave,
+ secondary_size, DRM_IVPU_BO_WC);
if (!cmdq->secondary_preempt_buf) {
ivpu_err(vdev, "Failed to create secondary preemption buffer\n");
goto err_free_primary;
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 27/31] accel/ivpu: Increase MS info buffer size
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (25 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 26/31] accel/ivpu: Use whole user and shave ranges for " Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 28/31] accel/ivpu: Fix ivpu_jsm_dyndbg_control() Jacek Lawrynowicz
` (4 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Karol Wachowski
Increase MS info BO to 64KB to allow collecting more metrics.
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_ms.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/ivpu/ivpu_ms.c b/drivers/accel/ivpu/ivpu_ms.c
index 2f9d37f5c208a..ffe7b10f8a767 100644
--- a/drivers/accel/ivpu/ivpu_ms.c
+++ b/drivers/accel/ivpu/ivpu_ms.c
@@ -11,7 +11,7 @@
#include "ivpu_ms.h"
#include "ivpu_pm.h"
-#define MS_INFO_BUFFER_SIZE SZ_16K
+#define MS_INFO_BUFFER_SIZE SZ_64K
#define MS_NUM_BUFFERS 2
#define MS_READ_PERIOD_MULTIPLIER 2
#define MS_MIN_SAMPLE_PERIOD_NS 1000000
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 28/31] accel/ivpu: Fix ivpu_jsm_dyndbg_control()
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (26 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 27/31] accel/ivpu: Increase MS info buffer size Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 29/31] accel/ivpu: Remove HWS_EXTRA_EVENTS from test modes Jacek Lawrynowicz
` (3 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Karol Wachowski
Use correct channel for dyndbg JSM message.
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_jsm_msg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/ivpu/ivpu_jsm_msg.c b/drivers/accel/ivpu/ivpu_jsm_msg.c
index ae91ad24d10d8..494ebc2475b19 100644
--- a/drivers/accel/ivpu/ivpu_jsm_msg.c
+++ b/drivers/accel/ivpu/ivpu_jsm_msg.c
@@ -197,7 +197,7 @@ int ivpu_jsm_dyndbg_control(struct ivpu_device *vdev, char *command, size_t size
strscpy(req.payload.dyndbg_control.dyndbg_cmd, command, VPU_DYNDBG_CMD_MAX_LEN);
ret = ivpu_ipc_send_receive(vdev, &req, VPU_JSM_MSG_DYNDBG_CONTROL_RSP, &resp,
- VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
+ VPU_IPC_CHAN_GEN_CMD, vdev->timeout.jsm);
if (ret)
ivpu_warn_ratelimited(vdev, "Failed to send command \"%s\": ret %d\n",
command, ret);
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 29/31] accel/ivpu: Remove HWS_EXTRA_EVENTS from test modes
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (27 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 28/31] accel/ivpu: Fix ivpu_jsm_dyndbg_control() Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 30/31] accel/ivpu: Add tracing for IPC/PM/JOB Jacek Lawrynowicz
` (2 subsequent siblings)
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Karol Wachowski
IVPU_TEST_MODE_HWS_EXTRA_EVENTS was never used and can be safely removed
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_drv.h | 1 -
drivers/accel/ivpu/ivpu_jsm_msg.c | 2 --
2 files changed, 3 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 151ab9f2ddc9b..5b43f91f20155 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -195,7 +195,6 @@ extern bool ivpu_force_snoop;
#define IVPU_TEST_MODE_D0I3_MSG_DISABLE BIT(4)
#define IVPU_TEST_MODE_D0I3_MSG_ENABLE BIT(5)
#define IVPU_TEST_MODE_PREEMPTION_DISABLE BIT(6)
-#define IVPU_TEST_MODE_HWS_EXTRA_EVENTS BIT(7)
#define IVPU_TEST_MODE_DISABLE_TIMEOUTS BIT(8)
#define IVPU_TEST_MODE_TURBO BIT(9)
extern int ivpu_test_mode;
diff --git a/drivers/accel/ivpu/ivpu_jsm_msg.c b/drivers/accel/ivpu/ivpu_jsm_msg.c
index 494ebc2475b19..8f5d904ca1ed4 100644
--- a/drivers/accel/ivpu/ivpu_jsm_msg.c
+++ b/drivers/accel/ivpu/ivpu_jsm_msg.c
@@ -394,8 +394,6 @@ int ivpu_jsm_hws_set_scheduling_log(struct ivpu_device *vdev, u32 engine_idx, u3
req.payload.hws_set_scheduling_log.host_ssid = host_ssid;
req.payload.hws_set_scheduling_log.vpu_log_buffer_va = vpu_log_buffer_va;
req.payload.hws_set_scheduling_log.notify_index = 0;
- req.payload.hws_set_scheduling_log.enable_extra_events =
- ivpu_test_mode & IVPU_TEST_MODE_HWS_EXTRA_EVENTS;
ret = ivpu_ipc_send_receive(vdev, &req, VPU_JSM_MSG_HWS_SET_SCHEDULING_LOG_RSP, &resp,
VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm);
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 30/31] accel/ivpu: Add tracing for IPC/PM/JOB
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (28 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 29/31] accel/ivpu: Remove HWS_EXTRA_EVENTS from test modes Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 31/31] accel/ivpu: Fix typos in ivpu_pm.c Jacek Lawrynowicz
2024-10-02 13:26 ` [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jakub Pawlak, Jacek Lawrynowicz
From: Jakub Pawlak <jakub.pawlak@intel.com>
Add multiple trace points in couple of key places to enable tracing
with ftrace.
Signed-off-by: Jakub Pawlak <jakub.pawlak@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/Makefile | 5 +-
drivers/accel/ivpu/ivpu_ipc.c | 3 ++
drivers/accel/ivpu/ivpu_job.c | 4 ++
drivers/accel/ivpu/ivpu_pm.c | 9 ++++
drivers/accel/ivpu/ivpu_trace.h | 73 ++++++++++++++++++++++++++
drivers/accel/ivpu/ivpu_trace_points.c | 9 ++++
6 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 drivers/accel/ivpu/ivpu_trace.h
create mode 100644 drivers/accel/ivpu/ivpu_trace_points.c
diff --git a/drivers/accel/ivpu/Makefile b/drivers/accel/ivpu/Makefile
index 232ea6d28c6e2..e73937c86d9ad 100644
--- a/drivers/accel/ivpu/Makefile
+++ b/drivers/accel/ivpu/Makefile
@@ -16,9 +16,12 @@ intel_vpu-y := \
ivpu_mmu_context.o \
ivpu_ms.o \
ivpu_pm.o \
- ivpu_sysfs.o
+ ivpu_sysfs.o \
+ ivpu_trace_points.o
intel_vpu-$(CONFIG_DEBUG_FS) += ivpu_debugfs.o
intel_vpu-$(CONFIG_DEV_COREDUMP) += ivpu_coredump.o
obj-$(CONFIG_DRM_ACCEL_IVPU) += intel_vpu.o
+
+CFLAGS_ivpu_trace_points.o = -I$(src)
diff --git a/drivers/accel/ivpu/ivpu_ipc.c b/drivers/accel/ivpu/ivpu_ipc.c
index c8ae69a529c0d..01ebf88fe6ef0 100644
--- a/drivers/accel/ivpu/ivpu_ipc.c
+++ b/drivers/accel/ivpu/ivpu_ipc.c
@@ -15,6 +15,7 @@
#include "ivpu_ipc.h"
#include "ivpu_jsm_msg.h"
#include "ivpu_pm.h"
+#include "ivpu_trace.h"
#define IPC_MAX_RX_MSG 128
@@ -227,6 +228,7 @@ int ivpu_ipc_send(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, stru
goto unlock;
ivpu_ipc_tx(vdev, cons->tx_vpu_addr);
+ trace_jsm("[tx]", req);
unlock:
mutex_unlock(&ipc->lock);
@@ -284,6 +286,7 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
if (jsm_msg)
memcpy(jsm_msg, rx_msg->jsm_msg, size);
+ trace_jsm("[rx]", rx_msg->jsm_msg);
}
ivpu_ipc_rx_msg_del(vdev, rx_msg);
diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index cd41b87715056..98e0b7b614071 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -18,6 +18,7 @@
#include "ivpu_job.h"
#include "ivpu_jsm_msg.h"
#include "ivpu_pm.h"
+#include "ivpu_trace.h"
#include "vpu_boot_api.h"
#define CMD_BUF_IDX 0
@@ -482,6 +483,7 @@ ivpu_job_create(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count)
job->file_priv = ivpu_file_priv_get(file_priv);
+ trace_job("create", job);
ivpu_dbg(vdev, JOB, "Job created: ctx %2d engine %d", file_priv->ctx.id, job->engine_idx);
return job;
@@ -521,6 +523,7 @@ static int ivpu_job_signal_and_destroy(struct ivpu_device *vdev, u32 job_id, u32
job->bos[CMD_BUF_IDX]->job_status = job_status;
dma_fence_signal(job->done_fence);
+ trace_job("done", job);
ivpu_dbg(vdev, JOB, "Job complete: id %3u ctx %2d engine %d status 0x%x\n",
job->job_id, job->file_priv->ctx.id, job->engine_idx, job_status);
@@ -588,6 +591,7 @@ static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
vdev->busy_start_ts = ktime_get();
}
+ trace_job("submit", job);
ivpu_dbg(vdev, JOB, "Job submitted: id %3u ctx %2d engine %d prio %d addr 0x%llx next %d\n",
job->job_id, file_priv->ctx.id, job->engine_idx, priority,
job->cmd_buf_vpu_addr, cmdq->jobq->header.tail);
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index b5a69941e6e0a..6d180c81e6df9 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -20,6 +20,7 @@
#include "ivpu_mmu.h"
#include "ivpu_ms.h"
#include "ivpu_pm.h"
+#include "ivpu_trace.h"
#include "vpu_boot_api.h"
static bool ivpu_disable_recovery;
@@ -198,6 +199,7 @@ int ivpu_pm_suspend_cb(struct device *dev)
struct ivpu_device *vdev = to_ivpu_device(drm);
unsigned long timeout;
+ trace_pm("suspend");
ivpu_dbg(vdev, PM, "Suspend..\n");
timeout = jiffies + msecs_to_jiffies(vdev->timeout.tdr);
@@ -215,6 +217,7 @@ int ivpu_pm_suspend_cb(struct device *dev)
ivpu_pm_prepare_warm_boot(vdev);
ivpu_dbg(vdev, PM, "Suspend done.\n");
+ trace_pm("suspend done");
return 0;
}
@@ -225,6 +228,7 @@ int ivpu_pm_resume_cb(struct device *dev)
struct ivpu_device *vdev = to_ivpu_device(drm);
int ret;
+ trace_pm("resume");
ivpu_dbg(vdev, PM, "Resume..\n");
ret = ivpu_resume(vdev);
@@ -232,6 +236,7 @@ int ivpu_pm_resume_cb(struct device *dev)
ivpu_err(vdev, "Failed to resume: %d\n", ret);
ivpu_dbg(vdev, PM, "Resume done.\n");
+ trace_pm("resume done");
return ret;
}
@@ -246,6 +251,7 @@ int ivpu_pm_runtime_suspend_cb(struct device *dev)
drm_WARN_ON(&vdev->drm, !xa_empty(&vdev->submitted_jobs_xa));
drm_WARN_ON(&vdev->drm, work_pending(&vdev->pm->recovery_work));
+ trace_pm("runtime suspend");
ivpu_dbg(vdev, PM, "Runtime suspend..\n");
ivpu_mmu_disable(vdev);
@@ -272,6 +278,7 @@ int ivpu_pm_runtime_suspend_cb(struct device *dev)
}
ivpu_dbg(vdev, PM, "Runtime suspend done.\n");
+ trace_pm("runtime suspend done");
return 0;
}
@@ -282,6 +289,7 @@ int ivpu_pm_runtime_resume_cb(struct device *dev)
struct ivpu_device *vdev = to_ivpu_device(drm);
int ret;
+ trace_pm("runtime resume");
ivpu_dbg(vdev, PM, "Runtime resume..\n");
ret = ivpu_resume(vdev);
@@ -289,6 +297,7 @@ int ivpu_pm_runtime_resume_cb(struct device *dev)
ivpu_err(vdev, "Failed to set RESUME state: %d\n", ret);
ivpu_dbg(vdev, PM, "Runtime resume done.\n");
+ trace_pm("runtime resume done");
return ret;
}
diff --git a/drivers/accel/ivpu/ivpu_trace.h b/drivers/accel/ivpu/ivpu_trace.h
new file mode 100644
index 0000000000000..eb792038e7010
--- /dev/null
+++ b/drivers/accel/ivpu/ivpu_trace.h
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2020-2024 Intel Corporation
+ */
+
+#if !defined(__IVPU_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
+#define __IVPU_TRACE_H__
+
+#include <linux/tracepoint.h>
+#include "ivpu_drv.h"
+#include "ivpu_job.h"
+#include "vpu_jsm_api.h"
+#include "ivpu_jsm_msg.h"
+#include "ivpu_ipc.h"
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM vpu
+#define TRACE_INCLUDE_FILE ivpu_trace
+
+TRACE_EVENT(pm,
+ TP_PROTO(const char *event),
+ TP_ARGS(event),
+ TP_STRUCT__entry(__field(const char *, event)),
+ TP_fast_assign(__entry->event = event;),
+ TP_printk("%s", __entry->event)
+);
+
+TRACE_EVENT(job,
+ TP_PROTO(const char *event, struct ivpu_job *job),
+ TP_ARGS(event, job),
+ TP_STRUCT__entry(__field(const char *, event)
+ __field(u32, ctx_id)
+ __field(u32, engine_id)
+ __field(u32, job_id)
+ ),
+ TP_fast_assign(__entry->event = event;
+ __entry->ctx_id = job->file_priv->ctx.id;
+ __entry->engine_id = job->engine_idx;
+ __entry->job_id = job->job_id;),
+ TP_printk("%s context:%d engine:%d job:%d",
+ __entry->event,
+ __entry->ctx_id,
+ __entry->engine_id,
+ __entry->job_id)
+);
+
+TRACE_EVENT(jsm,
+ TP_PROTO(const char *event, struct vpu_jsm_msg *msg),
+ TP_ARGS(event, msg),
+ TP_STRUCT__entry(__field(const char *, event)
+ __field(const char *, type)
+ __field(enum vpu_ipc_msg_status, status)
+ __field(u32, request_id)
+ __field(u32, result)
+ ),
+ TP_fast_assign(__entry->event = event;
+ __entry->type = ivpu_jsm_msg_type_to_str(msg->type);
+ __entry->status = msg->status;
+ __entry->request_id = msg->request_id;
+ __entry->result = msg->result;),
+ TP_printk("%s type:%s, status:%#x, id:%#x, result:%#x",
+ __entry->event,
+ __entry->type,
+ __entry->status,
+ __entry->request_id,
+ __entry->result)
+);
+
+#endif /* __IVPU_TRACE_H__ */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#include <trace/define_trace.h>
diff --git a/drivers/accel/ivpu/ivpu_trace_points.c b/drivers/accel/ivpu/ivpu_trace_points.c
new file mode 100644
index 0000000000000..f8fb99de0de32
--- /dev/null
+++ b/drivers/accel/ivpu/ivpu_trace_points.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2020-2024 Intel Corporation
+ */
+
+#ifndef __CHECKER__
+#define CREATE_TRACE_POINTS
+#include "ivpu_trace.h"
+#endif
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH v2 31/31] accel/ivpu: Fix typos in ivpu_pm.c
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (29 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 30/31] accel/ivpu: Add tracing for IPC/PM/JOB Jacek Lawrynowicz
@ 2024-09-30 19:53 ` Jacek Lawrynowicz
2024-10-02 13:26 ` [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
31 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-09-30 19:53 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Karol Wachowski
Replace "Filed" with an actual word.
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
drivers/accel/ivpu/ivpu_pm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index 6d180c81e6df9..e567df79a6129 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -423,7 +423,7 @@ int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent)
ret = ivpu_jsm_dct_enable(vdev, active_us, inactive_us);
if (ret) {
- ivpu_err_ratelimited(vdev, "Filed to enable DCT: %d\n", ret);
+ ivpu_err_ratelimited(vdev, "Failed to enable DCT: %d\n", ret);
return ret;
}
@@ -440,7 +440,7 @@ int ivpu_pm_dct_disable(struct ivpu_device *vdev)
ret = ivpu_jsm_dct_disable(vdev);
if (ret) {
- ivpu_err_ratelimited(vdev, "Filed to disable DCT: %d\n", ret);
+ ivpu_err_ratelimited(vdev, "Failed to disable DCT: %d\n", ret);
return ret;
}
--
2.45.1
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
` (30 preceding siblings ...)
2024-09-30 19:53 ` [PATCH v2 31/31] accel/ivpu: Fix typos in ivpu_pm.c Jacek Lawrynowicz
@ 2024-10-02 13:26 ` Jacek Lawrynowicz
2024-10-02 14:51 ` Thomas Zimmermann
31 siblings, 1 reply; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-10-02 13:26 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo
Applied to drm-misc-fixes
On 9/30/2024 9:52 PM, Jacek Lawrynowicz wrote:
> Most notable changes are coredump and tracing support.
> The rest are stability fixes, some refactoring and typos.
>
> Changes in v2:
> - Fix typos in FW API headers
> - Split fw refactor commit into 2 commits and improved commit messages
> - Fixed commit messages for state dump and power island commits
> - Added limit and NULL termination for FW version string
> - Documented sched_mode sysfs file
>
>
> Andrzej Kacprowski (4):
> accel/ivpu: Update VPU FW API headers
> accel/ivpu: Allow reading dvfs_mode debugfs file
> accel/ivpu: Add test_mode bit to force turbo
> accel/ivpu: Fix reset_engine debugfs file logic
>
> Jacek Lawrynowicz (11):
> accel/ivpu: Rename ivpu_log_level to fw_log_level
> accel/ivpu: Refactor functions in ivpu_fw_log.c
> accel/ivpu: Fix fw log printing
> accel/ivpu: Limit FW version string length
> accel/ivpu: Stop using hardcoded DRIVER_DATE
> accel/ivpu: Add auto selection logic for job scheduler
> accel/ivpu: Remove invalid warnings
> accel/ivpu: Increase MS info buffer size
> accel/ivpu: Fix ivpu_jsm_dyndbg_control()
> accel/ivpu: Remove HWS_EXTRA_EVENTS from test modes
> accel/ivpu: Fix typos in ivpu_pm.c
>
> Jakub Pawlak (1):
> accel/ivpu: Add tracing for IPC/PM/JOB
>
> Karol Wachowski (12):
> accel/ivpu: Add coredump support
> accel/ivpu: Set 500 ns delay between power island TRICKLE and ENABLE
> accel/ivpu: Turn on autosuspend on Simics
> accel/ivpu: Add FW version debugfs entry
> accel/ivpu: Remove 1-tile power up Simics workaround
> accel/ivpu: Add one jiffy to bo_wait_ioctl timeout value
> accel/ivpu: Print JSM message result in case of error
> accel/ivpu: Remove skip of clock own resource ack on Simics
> accel/ivpu: Prevent recovery invocation during probe and resume
> accel/ivpu: Refactor failure diagnostics during boot
> accel/ivpu: Do not fail on cmdq if failed to allocate preemption
> buffers
> accel/ivpu: Use whole user and shave ranges for preemption buffers
>
> Tomasz Rusinowicz (3):
> accel/ivpu: Reset fw log on cold boot
> accel/ivpu: Add FW state dump on TDR
> accel/ivpu: Make DB_ID and JOB_ID allocations incremental
>
> drivers/accel/ivpu/Kconfig | 1 +
> drivers/accel/ivpu/Makefile | 6 +-
> drivers/accel/ivpu/ivpu_coredump.c | 39 ++++
> drivers/accel/ivpu/ivpu_coredump.h | 25 ++
> drivers/accel/ivpu/ivpu_debugfs.c | 86 +++----
> drivers/accel/ivpu/ivpu_drv.c | 52 +++--
> drivers/accel/ivpu/ivpu_drv.h | 13 +-
> drivers/accel/ivpu/ivpu_fw.c | 26 ++-
> drivers/accel/ivpu/ivpu_fw.h | 9 +-
> drivers/accel/ivpu/ivpu_fw_log.c | 113 +++++----
> drivers/accel/ivpu/ivpu_fw_log.h | 17 +-
> drivers/accel/ivpu/ivpu_gem.c | 3 +
> drivers/accel/ivpu/ivpu_hw.c | 5 +-
> drivers/accel/ivpu/ivpu_hw.h | 1 -
> drivers/accel/ivpu/ivpu_hw_btrs.c | 9 -
> drivers/accel/ivpu/ivpu_hw_ip.c | 8 +-
> drivers/accel/ivpu/ivpu_ipc.c | 45 ++--
> drivers/accel/ivpu/ivpu_ipc.h | 9 +-
> drivers/accel/ivpu/ivpu_job.c | 102 +++++----
> drivers/accel/ivpu/ivpu_jsm_msg.c | 34 +--
> drivers/accel/ivpu/ivpu_jsm_msg.h | 2 +
> drivers/accel/ivpu/ivpu_ms.c | 2 +-
> drivers/accel/ivpu/ivpu_pm.c | 24 +-
> drivers/accel/ivpu/ivpu_sysfs.c | 24 ++
> drivers/accel/ivpu/ivpu_trace.h | 73 ++++++
> drivers/accel/ivpu/ivpu_trace_points.c | 9 +
> drivers/accel/ivpu/vpu_boot_api.h | 45 ++--
> drivers/accel/ivpu/vpu_jsm_api.h | 303 +++++++++++++++++++++----
> include/uapi/drm/ivpu_accel.h | 3 -
> 29 files changed, 797 insertions(+), 291 deletions(-)
> create mode 100644 drivers/accel/ivpu/ivpu_coredump.c
> create mode 100644 drivers/accel/ivpu/ivpu_coredump.h
> create mode 100644 drivers/accel/ivpu/ivpu_trace.h
> create mode 100644 drivers/accel/ivpu/ivpu_trace_points.c
>
> --
> 2.45.1
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1
2024-10-02 13:26 ` [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
@ 2024-10-02 14:51 ` Thomas Zimmermann
2024-10-03 8:45 ` Jacek Lawrynowicz
0 siblings, 1 reply; 35+ messages in thread
From: Thomas Zimmermann @ 2024-10-02 14:51 UTC (permalink / raw)
To: Jacek Lawrynowicz, dri-devel; +Cc: oded.gabbay, quic_jhugo
Hi
Am 02.10.24 um 15:26 schrieb Jacek Lawrynowicz:
> Applied to drm-misc-fixes
And removed from drm-misc-fixes.
The -misc-fixes branch is for fixing bugs that either regressed working
code or to resolve serious bugs that affects upstream users. It is NOT a
dumping ground for all kinds of things you want to get into upstream
quickly. Your review process should have found these issues already.
Best regards
Thomas
>
> On 9/30/2024 9:52 PM, Jacek Lawrynowicz wrote:
>> Most notable changes are coredump and tracing support.
>> The rest are stability fixes, some refactoring and typos.
>>
>> Changes in v2:
>> - Fix typos in FW API headers
>> - Split fw refactor commit into 2 commits and improved commit messages
>> - Fixed commit messages for state dump and power island commits
>> - Added limit and NULL termination for FW version string
>> - Documented sched_mode sysfs file
>>
>>
>> Andrzej Kacprowski (4):
>> accel/ivpu: Update VPU FW API headers
>> accel/ivpu: Allow reading dvfs_mode debugfs file
>> accel/ivpu: Add test_mode bit to force turbo
>> accel/ivpu: Fix reset_engine debugfs file logic
>>
>> Jacek Lawrynowicz (11):
>> accel/ivpu: Rename ivpu_log_level to fw_log_level
>> accel/ivpu: Refactor functions in ivpu_fw_log.c
>> accel/ivpu: Fix fw log printing
>> accel/ivpu: Limit FW version string length
>> accel/ivpu: Stop using hardcoded DRIVER_DATE
>> accel/ivpu: Add auto selection logic for job scheduler
>> accel/ivpu: Remove invalid warnings
>> accel/ivpu: Increase MS info buffer size
>> accel/ivpu: Fix ivpu_jsm_dyndbg_control()
>> accel/ivpu: Remove HWS_EXTRA_EVENTS from test modes
>> accel/ivpu: Fix typos in ivpu_pm.c
>>
>> Jakub Pawlak (1):
>> accel/ivpu: Add tracing for IPC/PM/JOB
>>
>> Karol Wachowski (12):
>> accel/ivpu: Add coredump support
>> accel/ivpu: Set 500 ns delay between power island TRICKLE and ENABLE
>> accel/ivpu: Turn on autosuspend on Simics
>> accel/ivpu: Add FW version debugfs entry
>> accel/ivpu: Remove 1-tile power up Simics workaround
>> accel/ivpu: Add one jiffy to bo_wait_ioctl timeout value
>> accel/ivpu: Print JSM message result in case of error
>> accel/ivpu: Remove skip of clock own resource ack on Simics
>> accel/ivpu: Prevent recovery invocation during probe and resume
>> accel/ivpu: Refactor failure diagnostics during boot
>> accel/ivpu: Do not fail on cmdq if failed to allocate preemption
>> buffers
>> accel/ivpu: Use whole user and shave ranges for preemption buffers
>>
>> Tomasz Rusinowicz (3):
>> accel/ivpu: Reset fw log on cold boot
>> accel/ivpu: Add FW state dump on TDR
>> accel/ivpu: Make DB_ID and JOB_ID allocations incremental
>>
>> drivers/accel/ivpu/Kconfig | 1 +
>> drivers/accel/ivpu/Makefile | 6 +-
>> drivers/accel/ivpu/ivpu_coredump.c | 39 ++++
>> drivers/accel/ivpu/ivpu_coredump.h | 25 ++
>> drivers/accel/ivpu/ivpu_debugfs.c | 86 +++----
>> drivers/accel/ivpu/ivpu_drv.c | 52 +++--
>> drivers/accel/ivpu/ivpu_drv.h | 13 +-
>> drivers/accel/ivpu/ivpu_fw.c | 26 ++-
>> drivers/accel/ivpu/ivpu_fw.h | 9 +-
>> drivers/accel/ivpu/ivpu_fw_log.c | 113 +++++----
>> drivers/accel/ivpu/ivpu_fw_log.h | 17 +-
>> drivers/accel/ivpu/ivpu_gem.c | 3 +
>> drivers/accel/ivpu/ivpu_hw.c | 5 +-
>> drivers/accel/ivpu/ivpu_hw.h | 1 -
>> drivers/accel/ivpu/ivpu_hw_btrs.c | 9 -
>> drivers/accel/ivpu/ivpu_hw_ip.c | 8 +-
>> drivers/accel/ivpu/ivpu_ipc.c | 45 ++--
>> drivers/accel/ivpu/ivpu_ipc.h | 9 +-
>> drivers/accel/ivpu/ivpu_job.c | 102 +++++----
>> drivers/accel/ivpu/ivpu_jsm_msg.c | 34 +--
>> drivers/accel/ivpu/ivpu_jsm_msg.h | 2 +
>> drivers/accel/ivpu/ivpu_ms.c | 2 +-
>> drivers/accel/ivpu/ivpu_pm.c | 24 +-
>> drivers/accel/ivpu/ivpu_sysfs.c | 24 ++
>> drivers/accel/ivpu/ivpu_trace.h | 73 ++++++
>> drivers/accel/ivpu/ivpu_trace_points.c | 9 +
>> drivers/accel/ivpu/vpu_boot_api.h | 45 ++--
>> drivers/accel/ivpu/vpu_jsm_api.h | 303 +++++++++++++++++++++----
>> include/uapi/drm/ivpu_accel.h | 3 -
>> 29 files changed, 797 insertions(+), 291 deletions(-)
>> create mode 100644 drivers/accel/ivpu/ivpu_coredump.c
>> create mode 100644 drivers/accel/ivpu/ivpu_coredump.h
>> create mode 100644 drivers/accel/ivpu/ivpu_trace.h
>> create mode 100644 drivers/accel/ivpu/ivpu_trace_points.c
>>
>> --
>> 2.45.1
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1
2024-10-02 14:51 ` Thomas Zimmermann
@ 2024-10-03 8:45 ` Jacek Lawrynowicz
0 siblings, 0 replies; 35+ messages in thread
From: Jacek Lawrynowicz @ 2024-10-03 8:45 UTC (permalink / raw)
To: Thomas Zimmermann, dri-devel; +Cc: oded.gabbay, quic_jhugo
Hi,
On 10/2/2024 4:51 PM, Thomas Zimmermann wrote:
> Hi
>
> Am 02.10.24 um 15:26 schrieb Jacek Lawrynowicz:
>> Applied to drm-misc-fixes
>
> And removed from drm-misc-fixes.
:(
> The -misc-fixes branch is for fixing bugs that either regressed working code or to resolve serious bugs that affects upstream users. It is NOT a dumping ground for all kinds of things you want to get into upstream quickly. Your review process should have found these issues already.
Sorry about this. I guess I allowed my upstreaming backlog to grow beyond sensible size.
I will apply small subset of these patches to -fixes and the rest to -next.
Regards,
Jacek
^ permalink raw reply [flat|nested] 35+ messages in thread
end of thread, other threads:[~2024-10-03 8:45 UTC | newest]
Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 19:52 [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 01/31] accel/ivpu: Update VPU FW API headers Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 02/31] accel/ivpu: Rename ivpu_log_level to fw_log_level Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 03/31] accel/ivpu: Reset fw log on cold boot Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 04/31] accel/ivpu: Refactor functions in ivpu_fw_log.c Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 05/31] accel/ivpu: Fix fw log printing Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 06/31] accel/ivpu: Limit FW version string length Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 07/31] accel/ivpu: Add coredump support Jacek Lawrynowicz
2024-09-30 19:52 ` [PATCH v2 08/31] accel/ivpu: Add FW state dump on TDR Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 09/31] accel/ivpu: Set 500 ns delay between power island TRICKLE and ENABLE Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 10/31] accel/ivpu: Turn on autosuspend on Simics Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 11/31] accel/ivpu: Add FW version debugfs entry Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 12/31] accel/ivpu: Stop using hardcoded DRIVER_DATE Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 13/31] accel/ivpu: Remove 1-tile power up Simics workaround Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 14/31] accel/ivpu: Allow reading dvfs_mode debugfs file Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 15/31] accel/ivpu: Add one jiffy to bo_wait_ioctl timeout value Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 16/31] accel/ivpu: Add auto selection logic for job scheduler Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 17/31] accel/ivpu: Print JSM message result in case of error Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 18/31] accel/ivpu: Make DB_ID and JOB_ID allocations incremental Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 19/31] accel/ivpu: Add test_mode bit to force turbo Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 20/31] accel/ivpu: Remove skip of clock own resource ack on Simics Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 21/31] accel/ivpu: Fix reset_engine debugfs file logic Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 22/31] accel/ivpu: Prevent recovery invocation during probe and resume Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 23/31] accel/ivpu: Refactor failure diagnostics during boot Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 24/31] accel/ivpu: Remove invalid warnings Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 25/31] accel/ivpu: Do not fail on cmdq if failed to allocate preemption buffers Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 26/31] accel/ivpu: Use whole user and shave ranges for " Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 27/31] accel/ivpu: Increase MS info buffer size Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 28/31] accel/ivpu: Fix ivpu_jsm_dyndbg_control() Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 29/31] accel/ivpu: Remove HWS_EXTRA_EVENTS from test modes Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 30/31] accel/ivpu: Add tracing for IPC/PM/JOB Jacek Lawrynowicz
2024-09-30 19:53 ` [PATCH v2 31/31] accel/ivpu: Fix typos in ivpu_pm.c Jacek Lawrynowicz
2024-10-02 13:26 ` [PATCH v2 00/31] accel/ivpu: Fixes for 6.12-rc1 Jacek Lawrynowicz
2024-10-02 14:51 ` Thomas Zimmermann
2024-10-03 8:45 ` Jacek Lawrynowicz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.