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/core/subdev/bar Use o...
details: https://anonhg.NetBSD.org/src/rev/d52586c2972d
branches: trunk
changeset: 344711:d52586c2972d
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Apr 12 15:12:12 2016 +0000
description:
Use only the low 32 bits of the bar object's vma offset as intended.
Should fix PR kern/50372, seen by everyone trying to use nouveau on
amd64 with hardware that uses nv50-style BARs and not nvc0-style
BARs.
diffstat:
sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c | 18 +++++++--
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (43 lines):
diff -r 1272780888a3 -r d52586c2972d sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c Tue Apr 12 14:40:16 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/bar/nouveau_subdev_bar_base.c Tue Apr 12 15:12:12 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_subdev_bar_base.c,v 1.4 2016/02/14 03:06:06 riastradh Exp $ */
+/* $NetBSD: nouveau_subdev_bar_base.c,v 1.5 2016/04/12 15:12:12 riastradh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bar_base.c,v 1.4 2016/02/14 03:06:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_bar_base.c,v 1.5 2016/04/12 15:12:12 riastradh Exp $");
#include <core/object.h>
@@ -65,13 +65,21 @@
return ret;
#ifdef __NetBSD__
+ {
+ /* Yes, truncation is really intended here. */
+ uint32_t offset = barobj->vma.offset & 0xffffffffUL;
+
+ KASSERTMSG(offset < bar->iomemsz,
+ "bar object vma exceeds range: %"PRIx32" > %"PRIxMAX,
+ offset, (uintmax_t)bar->iomemsz);
+
barobj->iomemt = bar->iomemt;
/* XXX errno NetBSD->Linux */
- ret = -bus_space_subregion(bar->iomemt, bar->iomemh,
- barobj->vma.offset, bar->iomemsz - barobj->vma.offset,
- &barobj->iomemh);
+ ret = -bus_space_subregion(bar->iomemt, bar->iomemh, offset,
+ bar->iomemsz - offset, &barobj->iomemh);
if (ret)
return ret;
+ }
#else
barobj->iomem = bar->iomem + (u32)barobj->vma.offset;
#endif
Home |
Main Index |
Thread Index |
Old Index