accel/ivpu: Change test_mode module param to bitmask
authorKarol Wachowski <karol.wachowski@linux.intel.com>
Sat, 28 Oct 2023 13:34:10 +0000 (15:34 +0200)
committerStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Mon, 30 Oct 2023 10:06:10 +0000 (11:06 +0100)
Change meaning of test_mode module parameter from integer value
to bitmask allowing setting different test features with corresponding
bits.

Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231028133415.1169975-7-stanislaw.gruszka@linux.intel.com
drivers/accel/ivpu/ivpu_drv.c
drivers/accel/ivpu/ivpu_drv.h
drivers/accel/ivpu/ivpu_job.c

index 4ec8d25a120cfacbdeb42e0e4b63ed7ac82feec6..39bac45d88b5ed2fbb38172cea5997efc7626018 100644 (file)
@@ -39,7 +39,7 @@ MODULE_PARM_DESC(dbg_mask, "Driver debug mask. See IVPU_DBG_* macros.");
 
 int ivpu_test_mode;
 module_param_named_unsafe(test_mode, ivpu_test_mode, int, 0644);
-MODULE_PARM_DESC(test_mode, "Test mode: 0 - disabled , 1 - fw unit test, 2 - null hw, 3 - null submission");
+MODULE_PARM_DESC(test_mode, "Test mode mask. See IVPU_TEST_MODE_* macros.");
 
 u8 ivpu_pll_min_ratio;
 module_param_named(pll_min_ratio, ivpu_pll_min_ratio, byte, 0644);
@@ -315,7 +315,7 @@ static int ivpu_wait_for_ready(struct ivpu_device *vdev)
        unsigned long timeout;
        int ret;
 
-       if (ivpu_test_mode == IVPU_TEST_MODE_FW_TEST)
+       if (ivpu_test_mode & IVPU_TEST_MODE_FW_TEST)
                return 0;
 
        ivpu_ipc_consumer_add(vdev, &cons, IVPU_IPC_CHAN_BOOT_MSG);
index fdec8272da8cf7662ed50acf37f9ea76a91bcc8b..ada43ba565c4a579830fe853e7052cdbf56e39cc 100644 (file)
@@ -147,10 +147,9 @@ extern u8 ivpu_pll_min_ratio;
 extern u8 ivpu_pll_max_ratio;
 extern bool ivpu_disable_mmu_cont_pages;
 
-#define IVPU_TEST_MODE_DISABLED        0
-#define IVPU_TEST_MODE_FW_TEST         1
-#define IVPU_TEST_MODE_NULL_HW         2
-#define IVPU_TEST_MODE_NULL_SUBMISSION 3
+#define IVPU_TEST_MODE_FW_TEST         BIT(0)
+#define IVPU_TEST_MODE_NULL_HW         BIT(1)
+#define IVPU_TEST_MODE_NULL_SUBMISSION BIT(2)
 extern int ivpu_test_mode;
 
 struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv);
index 646b8f812901512f2b323f59da9105f46684189c..6e96c921547d5ae43a8238cbb9069d1a3acb5cf1 100644 (file)
@@ -196,7 +196,7 @@ static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job)
        entry->batch_buf_addr = job->cmd_buf_vpu_addr;
        entry->job_id = job->job_id;
        entry->flags = 0;
-       if (unlikely(ivpu_test_mode == IVPU_TEST_MODE_NULL_SUBMISSION))
+       if (unlikely(ivpu_test_mode & IVPU_TEST_MODE_NULL_SUBMISSION))
                entry->flags = VPU_JOB_FLAGS_NULL_SUBMISSION_MASK;
        wmb(); /* Ensure that tail is updated after filling entry */
        header->tail = next_entry;
@@ -404,7 +404,7 @@ static int ivpu_direct_job_submission(struct ivpu_job *job)
                 job->job_id, job->cmd_buf_vpu_addr, file_priv->ctx.id,
                 job->engine_idx, cmdq->jobq->header.tail);
 
-       if (ivpu_test_mode == IVPU_TEST_MODE_NULL_HW) {
+       if (ivpu_test_mode & IVPU_TEST_MODE_NULL_HW) {
                ivpu_job_done(vdev, job->job_id, VPU_JSM_STATUS_SUCCESS);
                cmdq->jobq->header.head = cmdq->jobq->header.tail;
                wmb(); /* Flush WC buffer for jobq header */