Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe: Promote relaxed_ms_sleep

We want to have single place with sleep related helpers for better
code reuse. Create xe_sleep.h and move relaxed_ms_sleep() there.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260127193727.601-2-michal.wajdeczko@intel.com

+38 -21
+2 -21
drivers/gpu/drm/xe/xe_guc_submit.c
··· 8 8 #include <linux/bitfield.h> 9 9 #include <linux/bitmap.h> 10 10 #include <linux/circ_buf.h> 11 - #include <linux/delay.h> 12 11 #include <linux/dma-fence-array.h> 13 - #include <linux/math64.h> 14 12 15 13 #include <drm/drm_managed.h> 16 14 ··· 40 42 #include "xe_pm.h" 41 43 #include "xe_ring_ops_types.h" 42 44 #include "xe_sched_job.h" 45 + #include "xe_sleep.h" 43 46 #include "xe_trace.h" 44 47 #include "xe_uc_fw.h" 45 48 #include "xe_vm.h" ··· 1031 1032 return (WQ_SIZE - q->guc->wqi_tail); 1032 1033 } 1033 1034 1034 - static inline void relaxed_ms_sleep(unsigned int delay_ms) 1035 - { 1036 - unsigned long min_us, max_us; 1037 - 1038 - if (!delay_ms) 1039 - return; 1040 - 1041 - if (delay_ms > 20) { 1042 - msleep(delay_ms); 1043 - return; 1044 - } 1045 - 1046 - min_us = mul_u32_u32(delay_ms, 1000); 1047 - max_us = min_us + 500; 1048 - 1049 - usleep_range(min_us, max_us); 1050 - } 1051 - 1052 1035 static int wq_wait_for_space(struct xe_exec_queue *q, u32 wqi_size) 1053 1036 { 1054 1037 struct xe_guc *guc = exec_queue_to_guc(q); ··· 1815 1834 since_resume_ms; 1816 1835 1817 1836 if (wait_ms > 0 && q->guc->resume_time) 1818 - relaxed_ms_sleep(wait_ms); 1837 + xe_sleep_relaxed_ms(wait_ms); 1819 1838 1820 1839 set_exec_queue_suspended(q); 1821 1840 disable_scheduling(q, false);
+36
drivers/gpu/drm/xe/xe_sleep.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* 3 + * Copyright © 2026 Intel Corporation 4 + */ 5 + 6 + #ifndef _XE_SLEEP_H_ 7 + #define _XE_SLEEP_H_ 8 + 9 + #include <linux/delay.h> 10 + #include <linux/math64.h> 11 + 12 + /** 13 + * xe_sleep_relaxed_ms() - Sleep for an approximate time. 14 + * @delay_ms: time in msec to sleep 15 + * 16 + * For smaller timeouts, sleep with 0.5ms accuracy. 17 + */ 18 + static inline void xe_sleep_relaxed_ms(unsigned int delay_ms) 19 + { 20 + unsigned long min_us, max_us; 21 + 22 + if (!delay_ms) 23 + return; 24 + 25 + if (delay_ms > 20) { 26 + msleep(delay_ms); 27 + return; 28 + } 29 + 30 + min_us = mul_u32_u32(delay_ms, 1000); 31 + max_us = min_us + 500; 32 + 33 + usleep_range(min_us, max_us); 34 + } 35 + 36 + #endif