From 75706d555cbba3fe89463c44d797a35eba3995f8 Mon Sep 17 00:00:00 2001 From: jsg Date: Tue, 2 Jun 2026 03:17:28 +0000 Subject: [PATCH] add hrtimer_forward_now() for 6.18.34 drm --- sys/dev/pci/drm/drm_linux.c | 15 ++++++++++++++- sys/dev/pci/drm/include/linux/hrtimer.h | 7 +++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index 369b9fb2a50..6e3d6d9f32e 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.137 2026/04/28 03:44:14 jsg Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.138 2026/06/02 03:17:28 jsg Exp $ */ /* * Copyright (c) 2013 Jonathan Gray * Copyright (c) 2015, 2016 Mark Kettenis @@ -3650,6 +3650,19 @@ seq_buf_printf(struct seq_buf *s, const char *fmt, ...) } } +u64 +hrtimer_forward_now(struct timeout *to, ktime_t val) +{ + struct timespec now, ts; + + getnanotime(&now); + NSEC_TO_TIMESPEC(ktime_to_ns(val), &ts); + timespecadd(&ts, &now, &ts); + timeout_abs_ts(to, &ts); + + return 0; +} + #ifdef __HAVE_FDT #include diff --git a/sys/dev/pci/drm/include/linux/hrtimer.h b/sys/dev/pci/drm/include/linux/hrtimer.h index 075542fef24..d66059c0d3f 100644 --- a/sys/dev/pci/drm/include/linux/hrtimer.h +++ b/sys/dev/pci/drm/include/linux/hrtimer.h @@ -3,10 +3,11 @@ #ifndef _LINUX_HRTIMER_H #define _LINUX_HRTIMER_H -#include -#include +#include #include +#include + enum hrtimer_restart { HRTIMER_NORESTART, HRTIMER_RESTART }; struct hrtimer { enum hrtimer_restart (*function)(struct hrtimer *); @@ -18,4 +19,6 @@ struct hrtimer { #define hrtimer_try_to_cancel(x) timeout_del(x) /* XXX ret -1 if running */ #define hrtimer_active(x) timeout_pending(x) +u64 hrtimer_forward_now(struct timeout *, ktime_t); + #endif