Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/external/bsd/drm2 Pull up following revision(s) (requ...
details: https://anonhg.NetBSD.org/src/rev/87523bba3d44
branches: netbsd-7
changeset: 800053:87523bba3d44
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Dec 12 09:13:41 2016 +0000
description:
Pull up following revision(s) (requested by snj in ticket #1280):
sys/external/bsd/drm2/ttm/ttm_bus_dma.c: revision 1.2
sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h: revision 1.14
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dp.c: revision 1.2
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c: revision 1.7
sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c: revision 1.11
sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c: revision 1.2
sys/external/bsd/drm2/dist/include/drm/ttm/ttm_bo_driver.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c: revision 1.8
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c: revision 1.7
sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_object.c: revision 1.3
sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_mxms.c: revision 1.2
sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_nv50.c: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c: revision 1.5
sys/external/bsd/drm2/include/drm/ttm/ttm_page_alloc.h: revision 1.2
sys/external/bsd/drm2/drm/drm_vma_manager.c: revision 1.4
sys/external/bsd/drm2/nouveau/nouveau_pci.c: revision 1.8
- fix non-debug build
- Use %"PRIx8", not %hx, for uint8_t. %hx is for unsigned short.
- Flush unused function. Found by joerg.
- Make sure rbtrees are empty on desctruction.
If related to PR kern/51076, might help catch the bug a bit earlier.
- revert rev 1.6. we don't have access to those files as normal files
and possible will get them directly elsewhere soon.
(if i hack my nouveau to ignore fireware failure, it end up having
a vaguely working console and slowly working X, which is better than
the current situation.)
- Avoid possible null pointer dereference. Found by Coverity, CID 709895.
- Mark fallthrough to suppress Coverity complaints.
CID 143119
CID 143120
CID 143121
CID 143122
CID 143123
CID 143124
- Sanity-check that the encoder we found is not null.
I think the previous code guarantees that finding this encoder should
work, so this should be a moot point. CID 145720.
- Mark intended fallthrough to suppress Coverity CID 201378.
- Mark fallthrough with a comment to appease Coverity, CID 703385.
- Make it clearer to Coverity that there's no array overrun. CID 989067.
- Rework ttm tt swapin/swapout logic.
Rather than handling `swapping in/out' here, per se, we let uvm do
that, we interpret `swap out' as `deactivate pages', and we add
generic ttm operations to wire and unwire pages, for the ttm_tt
driver to use.
This fixes certain graphics buffer eviction logic, which enables
nouveau to suspend/resume on one of my machines. (The machine
doesn't resume overall for other reasons, but the nouveau device
suspends and resumes in isolation.)
- Use bus_space_subregion to get fifo channels out of mmio registers.
Evidently it is not enough to just map them separately. Ran out of
time to investigate why, last time I poked at this and confirmed this
change works.
- Avoid taking locks during interrupts and explain why we are doing it this way.
- We now use cpu_intr_p() all the time.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c | 33 ++-
sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_object.c | 8 +-
sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c | 10 +-
sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c | 7 +-
sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c | 73 +++++-
sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c | 5 +-
sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c | 12 +-
sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_mxms.c | 6 +-
sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/mxm/nouveau_subdev_mxm_nv50.c | 5 +-
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c | 15 +-
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_connector.c | 5 +-
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_dp.c | 8 +-
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c | 17 +-
sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c | 10 +
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c | 83 +++++--
sys/external/bsd/drm2/dist/include/drm/ttm/ttm_bo_driver.h | 29 ++
sys/external/bsd/drm2/drm/drm_vma_manager.c | 8 +-
sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h | 4 +-
sys/external/bsd/drm2/include/drm/ttm/ttm_page_alloc.h | 3 +-
sys/external/bsd/drm2/nouveau/nouveau_pci.c | 20 +-
sys/external/bsd/drm2/ttm/ttm_bus_dma.c | 110 ++++++++-
21 files changed, 345 insertions(+), 126 deletions(-)
diffs (truncated from 1015 to 300 lines):
diff -r 5434af310e99 -r 87523bba3d44 sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c Mon Dec 12 08:08:33 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c Mon Dec 12 09:13:41 2016 +0000
@@ -604,18 +604,33 @@
memcpy_fromio(d, (void __iomem *) offset, PAGE_SIZE);
} else {
- struct page *page;
- void *s;
-
- page = i915_gem_object_get_page(src, i);
- drm_clflush_pages(&page, 1);
+ if (cpu_intr_p() || cpu_softintr_p() ||
+ (curlwp->l_pflag & LP_INTR) != 0) {
+ /*
+ * We can't take locks during interrupts
+ * and finding the page from uvm requires
+ * taking a lock. Checking for an interrupt
+ * context is bogus, but this is the least
+ * intrusive change. Zero the result, doesn't
+ * matter much, because this is only used
+ * for diagnostics.
+ */
+ memset(d, 0, PAGE_SIZE);
+ } else {
+ struct page *page;
+ void *s;
- s = kmap_atomic(page);
- memcpy(d, s, PAGE_SIZE);
- kunmap_atomic(s);
+ page = i915_gem_object_get_page(src, i);
+
+ drm_clflush_pages(&page, 1);
- drm_clflush_pages(&page, 1);
+ s = kmap_atomic(page);
+ memcpy(d, s, PAGE_SIZE);
+ kunmap_atomic(s);
+
+ drm_clflush_pages(&page, 1);
+ }
}
local_irq_restore(flags);
diff -r 5434af310e99 -r 87523bba3d44 sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_object.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_object.c Mon Dec 12 08:08:33 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/core/nouveau_core_object.c Mon Dec 12 09:13:41 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_core_object.c,v 1.2 2014/08/06 13:35:13 riastradh Exp $ */
+/* $NetBSD: nouveau_core_object.c,v 1.2.4.1 2016/12/12 09:13:42 msaitoh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_core_object.c,v 1.2 2014/08/06 13:35:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_core_object.c,v 1.2.4.1 2016/12/12 09:13:42 msaitoh Exp $");
#include <core/object.h>
#include <core/parent.h>
@@ -47,14 +47,18 @@
nouveau_objects_init(void)
{
+#ifdef NOUVEAU_OBJECT_MAGIC
spin_lock_init(&_objlist_lock);
+#endif
}
void
nouveau_objects_fini(void)
{
+#ifdef NOUVEAU_OBJECT_MAGIC
spin_lock_destroy(&_objlist_lock);
+#endif
}
#endif
diff -r 5434af310e99 -r 87523bba3d44 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c Mon Dec 12 08:08:33 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c Mon Dec 12 09:13:41 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_engine_device_base.c,v 1.2.4.4 2016/04/15 08:46:42 snj Exp $ */
+/* $NetBSD: nouveau_engine_device_base.c,v 1.2.4.5 2016/12/12 09:13:42 msaitoh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.2.4.4 2016/04/15 08:46:42 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.2.4.5 2016/12/12 09:13:42 msaitoh Exp $");
#include <core/object.h>
#include <core/device.h>
@@ -297,12 +297,6 @@
#ifdef __NetBSD__
if (!(args->disable & NV_DEVICE_DISABLE_MMIO) &&
!nv_subdev(device)->mmiosz) {
- /*
- * Map only through PRAMIN -- don't map the command
- * FIFO MMIO regions, which start at NV_FIFO_OFFSET =
- * 0x800000 and are mapped separately.
- */
- mmio_size = MIN(mmio_size, 0x800000);
/* XXX errno NetBSD->Linux */
ret = -bus_space_map(mmiot, mmio_base, mmio_size, 0, &mmioh);
if (ret) {
diff -r 5434af310e99 -r 87523bba3d44 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c Mon Dec 12 08:08:33 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/disp/nouveau_engine_disp_nvd0.c Mon Dec 12 09:13:41 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_engine_disp_nvd0.c,v 1.1.1.1.4.1 2014/09/21 17:41:53 snj Exp $ */
+/* $NetBSD: nouveau_engine_disp_nvd0.c,v 1.1.1.1.4.2 2016/12/12 09:13:42 msaitoh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nvd0.c,v 1.1.1.1.4.1 2014/09/21 17:41:53 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_disp_nvd0.c,v 1.1.1.1.4.2 2016/12/12 09:13:42 msaitoh Exp $");
#include <core/object.h>
#include <core/parent.h>
@@ -1042,7 +1042,8 @@
}
data = nvbios_ocfg_match(bios, data, conf, &ver, &hdr, &cnt, &len, &info2);
- if (data && id < 0xff) {
+ CTASSERT(__arraycount(info2.clkcmp) <= 0xff);
+ if (data && id < __arraycount(info2.clkcmp)) {
data = nvbios_oclk_match(bios, info2.clkcmp[id], pclk);
if (data) {
struct nvbios_init init = {
diff -r 5434af310e99 -r 87523bba3d44 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c Mon Dec 12 08:08:33 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c Mon Dec 12 09:13:41 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_engine_fifo_base.c,v 1.2.4.2 2016/02/11 23:49:52 snj Exp $ */
+/* $NetBSD: nouveau_engine_fifo_base.c,v 1.2.4.3 2016/12/12 09:13:42 msaitoh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.2.4.2 2016/02/11 23:49:52 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.2.4.3 2016/12/12 09:13:42 msaitoh Exp $");
#include <core/client.h>
#include <core/object.h>
@@ -92,13 +92,68 @@
/* map fifo control registers */
#ifdef __NetBSD__
- chan->bst = nv_device_resource_tag(device, bar);
- /* XXX errno NetBSD->Linux */
- ret = -bus_space_map(chan->bst, nv_device_resource_start(device, bar) +
- addr + (chan->chid * size), size, 0, &chan->bsh);
- if (ret)
- return ret;
- chan->mapped = true;
+ if (bar == 0) {
+ /*
+ * We already map BAR 0 in the engine device base, so
+ * grab a subregion of that.
+ */
+ bus_space_tag_t mmiot = nv_subdev(device)->mmiot;
+ bus_space_handle_t mmioh = nv_subdev(device)->mmioh;
+ bus_size_t mmiosz = nv_subdev(device)->mmiosz;
+
+ /* Check whether it lies inside the region. */
+ if (mmiosz < addr ||
+ mmiosz - addr < chan->chid*size ||
+ mmiosz - addr - chan->chid*size < size) {
+ ret = EIO;
+ nv_error(priv, "fifo channel out of range:"
+ " addr 0x%"PRIxMAX
+ " chid 0x%"PRIxMAX" size 0x%"PRIxMAX
+ " mmiosz 0x%"PRIxMAX"\n",
+ (uintmax_t)addr,
+ (uintmax_t)chan->chid, (uintmax_t)size,
+ (uintmax_t)mmiosz);
+ return ret;
+ }
+
+ /* Grab a subregion. */
+ /* XXX errno NetBSD->Linux */
+ ret = -bus_space_subregion(mmiot, mmioh,
+ (addr + chan->chid*size), size, &chan->bsh);
+ if (ret) {
+ nv_error(priv, "bus_space_subregion failed: %d\n",
+ ret);
+ return ret;
+ }
+
+ /* Success! No need to unmap a subregion. */
+ chan->mapped = false;
+ chan->bst = mmiot;
+ } else {
+ chan->bst = nv_device_resource_tag(device, bar);
+ /* XXX errno NetBSD->Linux */
+ ret = -bus_space_map(chan->bst,
+ (nv_device_resource_start(device, bar) +
+ addr + (chan->chid * size)),
+ size, 0, &chan->bsh);
+ if (ret) {
+ nv_error(priv, "failed to map fifo channel:"
+ " bar %d addr %"PRIxMAX" + %"PRIxMAX
+ " + (%"PRIxMAX" * %"PRIxMAX") = %"PRIxMAX
+ " size %"PRIxMAX": %d\n",
+ bar,
+ (uintmax_t)nv_device_resource_start(device, bar),
+ (uintmax_t)addr,
+ (uintmax_t)chan->chid,
+ (uintmax_t)size,
+ (uintmax_t)(nv_device_resource_start(device, bar) +
+ addr + (chan->chid * size)),
+ (uintmax_t)size,
+ ret);
+ return ret;
+ }
+ chan->mapped = true;
+ }
#else
chan->user = ioremap(nv_device_resource_start(device, bar) + addr +
(chan->chid * size), size);
diff -r 5434af310e99 -r 87523bba3d44 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c Mon Dec 12 08:08:33 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nv40.c Mon Dec 12 09:13:41 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_engine_fifo_nv40.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $ */
+/* $NetBSD: nouveau_engine_fifo_nv40.c,v 1.1.1.1.4.1 2016/12/12 09:13:42 msaitoh Exp $ */
/*
* Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_nv40.c,v 1.1.1.1 2014/08/06 12:36:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_nv40.c,v 1.1.1.1.4.1 2016/12/12 09:13:42 msaitoh Exp $");
#include <core/os.h>
#include <core/class.h>
@@ -315,6 +315,7 @@
case 0x49:
case 0x4b:
nv_wr32(priv, 0x002230, 0x00000001);
+ /*FALLTHROUGH*/
case 0x40:
case 0x41:
case 0x42:
diff -r 5434af310e99 -r 87523bba3d44 sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c Mon Dec 12 08:08:33 2016 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/devinit/nouveau_subdev_devinit_nv04.c Mon Dec 12 09:13:41 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_subdev_devinit_nv04.c,v 1.1.1.1.4.1 2015/03/06 21:39:09 snj Exp $ */
+/* $NetBSD: nouveau_subdev_devinit_nv04.c,v 1.1.1.1.4.2 2016/12/12 09:13:42 msaitoh Exp $ */
/*
* Copyright (C) 2010 Francisco Jerez.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_devinit_nv04.c,v 1.1.1.1.4.1 2015/03/06 21:39:09 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_devinit_nv04.c,v 1.1.1.1.4.2 2016/12/12 09:13:42 msaitoh Exp $");
#include <subdev/vga.h>
@@ -121,12 +121,16 @@
switch (reg) {
case 0x680520:
shift += 4;
+ /*FALLTHROUGH*/
case 0x680508:
shift += 4;
+ /*FALLTHROUGH*/
case 0x680504:
shift += 4;
+ /*FALLTHROUGH*/
case 0x680500:
shift += 4;
+ /*FALLTHROUGH*/
}
/*
@@ -245,12 +249,16 @@
switch (reg1) {
case 0x680504:
Home |
Main Index |
Thread Index |
Old Index