Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/dist/drm/nouveau Convert nouveau clk t...
details: https://anonhg.NetBSD.org/src/rev/23bded72db25
branches: trunk
changeset: 366061:23bded72db25
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 07:43:06 2018 +0000
description:
Convert nouveau clk to condition variables.
Not totally sure that the activity in nvkm_pstate_work that must
happen atomically with wakeup is kosher under a spin lock, but we'll
see.
diffstat:
sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/subdev/clk.h | 7 +-
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/clk/nouveau_nvkm_subdev_clk_base.c | 37 ++++++++-
2 files changed, 39 insertions(+), 5 deletions(-)
diffs (112 lines):
diff -r 38a33772923e -r 23bded72db25 sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/subdev/clk.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/subdev/clk.h Mon Aug 27 07:42:55 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/subdev/clk.h Mon Aug 27 07:43:06 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clk.h,v 1.2 2018/08/27 04:58:30 riastradh Exp $ */
+/* $NetBSD: clk.h,v 1.3 2018/08/27 07:43:06 riastradh Exp $ */
#ifndef __NVKM_CLK_H__
#define __NVKM_CLK_H__
@@ -83,7 +83,12 @@
int state_nr;
struct work_struct work;
+#ifdef __NetBSD__
+ drm_waitqueue_t wait;
+ spinlock_t lock;
+#else
wait_queue_head_t wait;
+#endif
atomic_t waiting;
struct nvkm_notify pwrsrc_ntfy;
diff -r 38a33772923e -r 23bded72db25 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/clk/nouveau_nvkm_subdev_clk_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/clk/nouveau_nvkm_subdev_clk_base.c Mon Aug 27 07:42:55 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/clk/nouveau_nvkm_subdev_clk_base.c Mon Aug 27 07:43:06 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_nvkm_subdev_clk_base.c,v 1.2 2018/08/27 04:58:33 riastradh Exp $ */
+/* $NetBSD: nouveau_nvkm_subdev_clk_base.c,v 1.3 2018/08/27 07:43:06 riastradh Exp $ */
/*
* Copyright 2013 Red Hat Inc.
@@ -24,7 +24,7 @@
* Authors: Ben Skeggs
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_clk_base.c,v 1.2 2018/08/27 04:58:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_clk_base.c,v 1.3 2018/08/27 07:43:06 riastradh Exp $");
#include "priv.h"
@@ -212,8 +212,12 @@
struct nvkm_subdev *subdev = &clk->subdev;
int pstate;
- if (!atomic_xchg(&clk->waiting, 0))
+ spin_lock(&clk->lock);
+ if (!atomic_xchg(&clk->waiting, 0)) {
+ spin_unlock(&clk->lock);
return;
+ }
+
clk->pwrsrc = power_supply_is_system_supplied();
nvkm_trace(subdev, "P %d PWR %d U(AC) %d U(DC) %d A %d T %d D %d\n",
@@ -238,7 +242,12 @@
}
}
+#ifdef __NetBSD__
+ DRM_SPIN_WAKEUP_ALL(&clk->wait, &clk->lock);
+#else
wake_up_all(&clk->wait);
+#endif
+ spin_unlock(&clk->lock);
nvkm_notify_get(&clk->pwrsrc_ntfy);
}
@@ -247,8 +256,18 @@
{
atomic_set(&clk->waiting, 1);
schedule_work(&clk->work);
- if (wait)
+ if (wait) {
+#ifdef __NetBSD__
+ int ret;
+ spin_lock(&clk->lock);
+ DRM_SPIN_WAIT_NOINTR_UNTIL(ret, &clk->wait, &clk->lock,
+ !atomic_read(&clk->waiting));
+ spin_unlock(&clk->lock);
+ KASSERT(ret == 0);
+#else
wait_event(clk->wait, !atomic_read(&clk->waiting));
+#endif
+ }
return 0;
}
@@ -546,6 +565,11 @@
nvkm_pstate_del(pstate);
}
+#ifdef __NetBSD__
+ DRM_DESTROY_WAITQUEUE(&clk->wait);
+ spin_lock_destroy(&clk->lock);
+#endif
+
return clk;
}
@@ -572,7 +596,12 @@
clk->allow_reclock = allow_reclock;
INIT_WORK(&clk->work, nvkm_pstate_work);
+#ifdef __NetBSD__
+ spin_lock_init(&clk->lock);
+ DRM_INIT_WAITQUEUE(&clk->wait, "nvclk");
+#else
init_waitqueue_head(&clk->wait);
+#endif
atomic_set(&clk->waiting, 0);
/* If no pstates are provided, try and fetch them from the BIOS */
Home |
Main Index |
Thread Index |
Old Index