Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/external/bsd/drm2 Pull up following revision(s) (requ...
details: https://anonhg.NetBSD.org/src/rev/84f879f21cba
branches: netbsd-8
changeset: 435233:84f879f21cba
user: martin <martin%NetBSD.org@localhost>
date: Sat Sep 01 06:34:00 2018 +0000
description:
Pull up following revision(s) (requested by riastradh in ticket #1003):
sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c: revision 1.8
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c: revision 1.10
sys/external/bsd/drm2/drm/drm_scatter.c: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.2
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.3
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.4
sys/external/bsd/drm2/linux/linux_idr.c: revision 1.6
Pull in upstream commit:
Author: Ville Syrj=E4l=E4 <ville.syrjala%linux.intel.com@localhost>
Date: Mon Jun 9 16:20:46 2014 +0300
drm/i915: Avoid div-by-zero when pixel_multiplier is zero
On certain platforms pixel_multiplier is read out in
.get_pipe_config(), but it also gets used to calculate the
pixel clock in intel_sdvo_get_config(). If the pipe is disabled
but some SDVO outputs are active, we may end up dividing by zero
in intel_sdvo_get_config().
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=3D76520
Tweak slightly sketchy logic in linux_idr.
1. idr_preload can fail if you don't set __GFP_WAIT.
2. If idr_preload fails, it is wrong for idr_alloc to assert.
3. There is no way for idr_alloc to know what flags idr_preload got.
Probably won't *fix* any bugs, but if there is a bug with a missing
__GFP_WAIT, then we will learn about a trifle sooner.
Fix error branch in ttm_dma_tt_init to avoid double-free.
Should fix symptom of PR kern/52438, but who knows what underlying
problem causes us to reach the error branch in the first place.
Fix lockdebug_locked annotations.
When thread A grants ownership to thread B waiting with a context,
thread B needs to assert lockdebug_locked; otherwise, when it
releases, lockdebug_unlocked thinks it's releasing an unlocked
ww_mutex.
Fixes LOCKDEBUG failure with radeon noticed by martin@.
more const
XXX: add a NULL init to avoid a GCC 6 maybe uninit warning.
Remove UB from definition of symbols in i915_reg.h
Kernel Undefined Behavior Sanitizer enforces more warnings in build time.
This makes the build fatal in the drm/i915 code in:
- intel_ddi_put_crtc_pll(),
- intel_ddi_clock_get(),
- intel_ddi_pll_enable(),
- intel_ddi_setup_hw_pll_state().
The error message in all the cases says:
error: case label does not reduce to an integer constant
Set the type of the value left shifted to unsigned.
This change is required to build NetBSD/amd64 with KUBSan.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h | 8 +++---
sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c | 5 +++-
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c | 3 +-
sys/external/bsd/drm2/drm/drm_scatter.c | 6 ++--
sys/external/bsd/drm2/linux/linux_idr.c | 11 ++++++---
sys/external/bsd/drm2/linux/linux_ww_mutex.c | 28 ++++++++++++------------
6 files changed, 34 insertions(+), 27 deletions(-)
diffs (262 lines):
diff -r 523dc8c73e5c -r 84f879f21cba sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h Sat Sep 01 06:28:23 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h Sat Sep 01 06:34:00 2018 +0000
@@ -5426,10 +5426,10 @@
#define PORT_CLK_SEL_LCPLL_1350 (1<<29)
#define PORT_CLK_SEL_LCPLL_810 (2<<29)
#define PORT_CLK_SEL_SPLL (3<<29)
-#define PORT_CLK_SEL_WRPLL1 (4<<29)
-#define PORT_CLK_SEL_WRPLL2 (5<<29)
-#define PORT_CLK_SEL_NONE (7<<29)
-#define PORT_CLK_SEL_MASK (7<<29)
+#define PORT_CLK_SEL_WRPLL1 (4U<<29)
+#define PORT_CLK_SEL_WRPLL2 (5U<<29)
+#define PORT_CLK_SEL_NONE (7U<<29)
+#define PORT_CLK_SEL_MASK (7U<<29)
/* Transcoder clock selection */
#define TRANS_CLK_SEL_A 0x46140
diff -r 523dc8c73e5c -r 84f879f21cba sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c Sat Sep 01 06:28:23 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c Sat Sep 01 06:34:00 2018 +0000
@@ -1391,7 +1391,10 @@
>> SDVO_PORT_MULTIPLY_SHIFT) + 1;
}
- dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier;
+ dotclock = pipe_config->port_clock;
+
+ if (pipe_config->pixel_multiplier)
+ dotclock /= pipe_config->pixel_multiplier;
if (HAS_PCH_SPLIT(dev))
ironlake_check_encoder_dotclock(pipe_config, dotclock);
diff -r 523dc8c73e5c -r 84f879f21cba sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c Sat Sep 01 06:28:23 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c Sat Sep 01 06:34:00 2018 +0000
@@ -284,7 +284,8 @@
fail1: kmem_free(ttm_dma->dma_segs, (ttm->num_pages *
sizeof(ttm_dma->dma_segs[0])));
fail0: KASSERT(error);
- ttm_tt_destroy(ttm);
+ drm_free_large(ttm->pages);
+ uao_detach(ttm->swap_storage);
/* XXX errno NetBSD->Linux */
return -error;
}
diff -r 523dc8c73e5c -r 84f879f21cba sys/external/bsd/drm2/drm/drm_scatter.c
--- a/sys/external/bsd/drm2/drm/drm_scatter.c Sat Sep 01 06:28:23 2018 +0000
+++ b/sys/external/bsd/drm2/drm/drm_scatter.c Sat Sep 01 06:34:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_scatter.c,v 1.3 2014/07/16 20:56:25 riastradh Exp $ */
+/* $NetBSD: drm_scatter.c,v 1.3.22.1 2018/09/01 06:34:00 martin Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_scatter.c,v 1.3 2014/07/16 20:56:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_scatter.c,v 1.3.22.1 2018/09/01 06:34:00 martin Exp $");
#include <sys/types.h>
#include <sys/bus.h>
@@ -50,7 +50,7 @@
struct drm_file *file __unused)
{
struct drm_scatter_gather *const request = data;
- struct drm_sg_mem *sg;
+ struct drm_sg_mem *sg = NULL;
int error;
/*
diff -r 523dc8c73e5c -r 84f879f21cba sys/external/bsd/drm2/linux/linux_idr.c
--- a/sys/external/bsd/drm2/linux/linux_idr.c Sat Sep 01 06:28:23 2018 +0000
+++ b/sys/external/bsd/drm2/linux/linux_idr.c Sat Sep 01 06:34:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_idr.c,v 1.5 2015/01/01 01:15:43 mrg Exp $ */
+/* $NetBSD: linux_idr.c,v 1.5.10.1 2018/09/01 06:34:00 martin Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.5 2015/01/01 01:15:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_idr.c,v 1.5.10.1 2018/09/01 06:34:00 martin Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -191,6 +191,7 @@
ASSERT_SLEEPABLE();
node = kmalloc(sizeof(*node), gfp);
+ KASSERT(node != NULL || !ISSET(gfp, __GFP_WAIT));
if (node == NULL)
return;
@@ -216,8 +217,10 @@
/* Grab a node allocated by idr_preload. */
mutex_spin_enter(&idr_cache.lock);
- KASSERTMSG(!SIMPLEQ_EMPTY(&idr_cache.preloaded_nodes),
- "missing call to idr_preload");
+ if (SIMPLEQ_EMPTY(&idr_cache.preloaded_nodes)) {
+ mutex_spin_exit(&idr_cache.lock);
+ return -ENOMEM;
+ }
node = SIMPLEQ_FIRST(&idr_cache.preloaded_nodes);
SIMPLEQ_REMOVE_HEAD(&idr_cache.preloaded_nodes, in_list);
mutex_spin_exit(&idr_cache.lock);
diff -r 523dc8c73e5c -r 84f879f21cba sys/external/bsd/drm2/linux/linux_ww_mutex.c
--- a/sys/external/bsd/drm2/linux/linux_ww_mutex.c Sat Sep 01 06:28:23 2018 +0000
+++ b/sys/external/bsd/drm2/linux/linux_ww_mutex.c Sat Sep 01 06:34:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ww_mutex.c,v 1.2 2015/05/21 21:55:55 riastradh Exp $ */
+/* $NetBSD: linux_ww_mutex.c,v 1.2.10.1 2018/09/01 06:34:00 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2 2015/05/21 21:55:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.1 2018/09/01 06:34:00 martin Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -122,9 +122,9 @@
#ifdef LOCKDEBUG
static void
-ww_dump(volatile void *cookie)
+ww_dump(const volatile void *cookie)
{
- volatile struct ww_mutex *mutex = cookie;
+ const volatile struct ww_mutex *mutex = cookie;
printf_nolog("%-13s: ", "state");
switch (mutex->wwm_state) {
@@ -135,7 +135,7 @@
printf_nolog("owned by lwp\n");
printf_nolog("%-13s: %p\n", "owner", mutex->wwm_u.owner);
printf_nolog("%-13s: %s\n", "waiters",
- cv_has_waiters(__UNVOLATILE(&mutex->wwm_cv))
+ cv_has_waiters((void *)(intptr_t)&mutex->wwm_cv)
? "yes" : "no");
break;
case WW_CTX:
@@ -144,7 +144,7 @@
printf_nolog("%-13s: %p\n", "lwp",
mutex->wwm_u.ctx->wwx_owner);
printf_nolog("%-13s: %s\n", "waiters",
- cv_has_waiters(__UNVOLATILE(&mutex->wwm_cv))
+ cv_has_waiters((void *)(intptr_t)&mutex->wwm_cv)
? "yes" : "no");
break;
case WW_WANTOWN:
@@ -334,7 +334,6 @@
case WW_UNLOCKED:
mutex->wwm_state = WW_OWNED;
mutex->wwm_u.owner = curlwp;
- WW_LOCKED(mutex);
break;
case WW_OWNED:
KASSERTMSG((mutex->wwm_u.owner != curlwp),
@@ -356,6 +355,7 @@
}
KASSERT(mutex->wwm_state == WW_OWNED);
KASSERT(mutex->wwm_u.owner == curlwp);
+ WW_LOCKED(mutex);
mutex_exit(&mutex->wwm_lock);
}
@@ -369,7 +369,6 @@
case WW_UNLOCKED:
mutex->wwm_state = WW_OWNED;
mutex->wwm_u.owner = curlwp;
- WW_LOCKED(mutex);
break;
case WW_OWNED:
KASSERTMSG((mutex->wwm_u.owner != curlwp),
@@ -395,6 +394,7 @@
}
KASSERT(mutex->wwm_state == WW_OWNED);
KASSERT(mutex->wwm_u.owner == curlwp);
+ WW_LOCKED(mutex);
ret = 0;
out: mutex_exit(&mutex->wwm_lock);
return ret;
@@ -433,7 +433,6 @@
WW_WANTLOCK(mutex);
mutex->wwm_state = WW_CTX;
mutex->wwm_u.ctx = ctx;
- WW_LOCKED(mutex);
goto locked;
case WW_OWNED:
WW_WANTLOCK(mutex);
@@ -490,10 +489,11 @@
*/
ww_mutex_lock_wait(mutex, ctx);
-locked: ctx->wwx_acquired++;
- KASSERT((mutex->wwm_state == WW_CTX) ||
+locked: KASSERT((mutex->wwm_state == WW_CTX) ||
(mutex->wwm_state == WW_WANTOWN));
KASSERT(mutex->wwm_u.ctx == ctx);
+ WW_LOCKED(mutex);
+ ctx->wwx_acquired++;
mutex_exit(&mutex->wwm_lock);
return 0;
}
@@ -531,7 +531,6 @@
WW_WANTLOCK(mutex);
mutex->wwm_state = WW_CTX;
mutex->wwm_u.ctx = ctx;
- WW_LOCKED(mutex);
goto locked;
case WW_OWNED:
WW_WANTLOCK(mutex);
@@ -597,6 +596,7 @@
locked: KASSERT((mutex->wwm_state == WW_CTX) ||
(mutex->wwm_state == WW_WANTOWN));
KASSERT(mutex->wwm_u.ctx == ctx);
+ WW_LOCKED(mutex);
ctx->wwx_acquired++;
ret = 0;
out: mutex_exit(&mutex->wwm_lock);
@@ -634,7 +634,6 @@
case WW_UNLOCKED:
mutex->wwm_state = WW_CTX;
mutex->wwm_u.ctx = ctx;
- WW_LOCKED(mutex);
goto locked;
case WW_OWNED:
KASSERTMSG((mutex->wwm_u.owner != curlwp),
@@ -665,6 +664,7 @@
locked: KASSERT((mutex->wwm_state == WW_CTX) ||
(mutex->wwm_state == WW_WANTOWN));
KASSERT(mutex->wwm_u.ctx == ctx);
+ WW_LOCKED(mutex);
ctx->wwx_acquired++;
mutex_exit(&mutex->wwm_lock);
}
@@ -699,7 +699,6 @@
case WW_UNLOCKED:
mutex->wwm_state = WW_CTX;
mutex->wwm_u.ctx = ctx;
- WW_LOCKED(mutex);
goto locked;
case WW_OWNED:
KASSERTMSG((mutex->wwm_u.owner != curlwp),
@@ -736,6 +735,7 @@
locked: KASSERT((mutex->wwm_state == WW_CTX) ||
(mutex->wwm_state == WW_WANTOWN));
KASSERT(mutex->wwm_u.ctx == ctx);
+ WW_LOCKED(mutex);
ctx->wwx_acquired++;
ret = 0;
out: mutex_exit(&mutex->wwm_lock);
Home |
Main Index |
Thread Index |
Old Index