Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 2019 01:43:42 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc:        freebsd-current@freebsd.org
Subject:   Re: vm_page_hold() and drm-legacy-kmod
Message-ID:  <20190709054342.GF41568@raichu>
In-Reply-To: <20190709050400.GA63317@troutmask.apl.washington.edu>
References:  <20190709043058.GA63004@troutmask.apl.washington.edu> <20190709043505.GC63004@troutmask.apl.washington.edu> <20190709044336.GA63186@troutmask.apl.washington.edu> <20190709050400.GA63317@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 08, 2019 at 10:04:00PM -0700, Steve Kargl wrote:
> On Mon, Jul 08, 2019 at 09:43:36PM -0700, Steve Kargl wrote:
> > On Mon, Jul 08, 2019 at 09:35:05PM -0700, Steve Kargl wrote:
> > > On Mon, Jul 08, 2019 at 09:31:12PM -0700, Steve Kargl wrote:
> > > > It seems the recent flurry of vm commits has
> > > > broken the graphics/drm-legacy-kmod port.
> > > > vm_page_hold() no longer exists.  How do I
> > > > fix the port?
> > > > 
> > > 
> > > Whoops.  The missing function is vm_page_unhold().
> > > Anywhoo, how do I fix this?
> > > 
> > The code in question is 
> > 
> >         for (i = 0; i < vsg->num_pages; i++) {
> >                 m = vsg->pages[i];
> >                 vm_page_lock(m);
> >                 vm_page_wire(m);
> >                 vm_page_unhold(m);
> >                 vm_page_unlock(m);
> >         }
> 
> This was broken by r349846 committed by markj.

Please try this patch.  If it works for you I will submit a pull request
to the drm-legacy repo.

diff --git a/src/dev/drm/via_dmablit.c b/src/dev/drm/via_dmablit.c
index e8096f2..aa57944 100644
--- a/src/dev/drm/via_dmablit.c
+++ b/src/dev/drm/via_dmablit.c
@@ -222,8 +222,10 @@ static int
 via_lock_all_dma_pages(drm_via_sg_info_t *vsg,  drm_via_dmablit_t *xfer)
 {
 	unsigned long first_pfn = VIA_PFN(xfer->mem_addr);
+#if __FreeBSD_version < 1300035
 	vm_page_t m;
 	int i;
+#endif
 
 	vsg->num_pages = VIA_PFN(xfer->mem_addr +
 	    (xfer->num_lines * xfer->mem_stride -1)) - first_pfn + 1;
@@ -239,6 +241,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg,  drm_via_dmablit_t *xfer)
 	    VM_PROT_READ | VM_PROT_WRITE, vsg->pages, vsg->num_pages) < 0)
 		return -EACCES;
 
+#if __FreeBSD_version < 1300035
 	for (i = 0; i < vsg->num_pages; i++) {
 		m = vsg->pages[i];
 		vm_page_lock(m);
@@ -246,6 +249,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg,  drm_via_dmablit_t *xfer)
 		vm_page_unhold(m);
 		vm_page_unlock(m);
 	}
+#endif
 	vsg->state = dr_via_pages_locked;
 
 	DRM_DEBUG("DMA pages locked\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190709054342.GF41568>