Re: vm_page_hold() and drm-legacy-kmod

From: Mark Johnston <markj_at_freebsd.org>
Date: Tue, 9 Jul 2019 01:43:42 -0400
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
_at__at_ -222,8 +222,10 _at__at_ 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;
_at__at_ -239,6 +241,7 _at__at_ 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);
_at__at_ -246,6 +249,7 _at__at_ 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");
Received on Tue Jul 09 2019 - 03:43:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:21 UTC