From: jsg Date: Fri, 12 Jan 2018 11:03:15 +0000 (+0000) Subject: Constrain alloc_pages() to the dma_constraint range. Avoids a X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4dadd951639fe9c4aed8ef76a7c95996a1759c79;p=openbsd Constrain alloc_pages() to the dma_constraint range. Avoids a "Non dma-reachable buffer" panic when trying to use it from ttm code on a machine with 8GB of physmem and a radeon. ok kettenis@ dlg@ visa@ deraadt@ --- diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index 03ada0f9750..4c4498bb58d 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.15 2017/07/12 20:12:19 kettenis Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.16 2018/01/12 11:03:15 jsg Exp $ */ /* * Copyright (c) 2013 Jonathan Gray * Copyright (c) 2015, 2016 Mark Kettenis @@ -204,8 +204,8 @@ alloc_pages(unsigned int gfp_mask, unsigned int order) flags |= UVM_PLA_ZERO; TAILQ_INIT(&mlist); - if (uvm_pglistalloc(PAGE_SIZE << order, 0, -1, PAGE_SIZE, 0, - &mlist, 1, flags)) + if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low, + dma_constraint.ucr_high, PAGE_SIZE, 0, &mlist, 1, flags)) return NULL; return TAILQ_FIRST(&mlist); }