From a751cc56dfe09d881d57a0ae55bb2c92f1992db3 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 28 Mar 2024 02:36:38 +0000 Subject: [PATCH] reduce diff to linux --- sys/dev/pci/drm/i915/gt/uc/intel_huc.c | 8 ++++---- sys/dev/pci/drm/include/linux/ktime.h | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sys/dev/pci/drm/i915/gt/uc/intel_huc.c b/sys/dev/pci/drm/i915/gt/uc/intel_huc.c index 4ff193cbc9b..9c40964c457 100644 --- a/sys/dev/pci/drm/i915/gt/uc/intel_huc.c +++ b/sys/dev/pci/drm/i915/gt/uc/intel_huc.c @@ -136,7 +136,7 @@ static void huc_delayed_load_timer_callback(void *arg) static void huc_delayed_load_start(struct intel_huc *huc) { - int delay; + ktime_t delay; GEM_BUG_ON(intel_huc_is_authenticated(huc, INTEL_HUC_AUTH_BY_GSC)); @@ -146,10 +146,10 @@ static void huc_delayed_load_start(struct intel_huc *huc) */ switch (huc->delayed_load.status) { case INTEL_HUC_WAITING_ON_GSC: - delay = GSC_INIT_TIMEOUT_MS; + delay = ms_to_ktime(GSC_INIT_TIMEOUT_MS); break; case INTEL_HUC_WAITING_ON_PXP: - delay = PXP_INIT_TIMEOUT_MS; + delay = ms_to_ktime(PXP_INIT_TIMEOUT_MS); break; default: gsc_init_error(huc); @@ -171,7 +171,7 @@ static void huc_delayed_load_start(struct intel_huc *huc) #ifdef __linux__ hrtimer_start(&huc->delayed_load.timer, delay, HRTIMER_MODE_REL); #else - timeout_add_msec(&huc->delayed_load.timer, delay); + timeout_add_nsec(&huc->delayed_load.timer, ktime_to_ns(delay)); #endif } diff --git a/sys/dev/pci/drm/include/linux/ktime.h b/sys/dev/pci/drm/include/linux/ktime.h index b3baf7a6890..f1d1c721e21 100644 --- a/sys/dev/pci/drm/include/linux/ktime.h +++ b/sys/dev/pci/drm/include/linux/ktime.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ktime.h,v 1.7 2023/01/01 01:34:58 jsg Exp $ */ +/* $OpenBSD: ktime.h,v 1.8 2024/03/28 02:36:38 jsg Exp $ */ /* * Copyright (c) 2013, 2014, 2015 Mark Kettenis * @@ -150,6 +150,12 @@ ns_to_ktime(uint64_t ns) return ns; } +static inline ktime_t +ms_to_ktime(uint64_t ms) +{ + return ms * NSEC_PER_MSEC; +} + static inline int64_t ktime_divns(ktime_t a, int64_t ns) { -- 2.20.1