From owner-freebsd-hackers Sun May 16 13:19:59 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from dingo.cdrom.com (castles551.castles.com [208.214.165.115]) by hub.freebsd.org (Postfix) with ESMTP id E4D6514D73 for ; Sun, 16 May 1999 13:19:55 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (LOCALHOST [127.0.0.1]) by dingo.cdrom.com (8.9.3/8.8.8) with ESMTP id NAA07860; Sun, 16 May 1999 13:05:05 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Message-Id: <199905162005.NAA07860@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: "Stan Shkolny" Cc: hackers@FreeBSD.ORG Subject: Re: vmapbuf (was:Which O/S routines are subject to change?) In-reply-to: Your message of "Tue, 11 May 1999 10:06:00 CDT." <00e001be9bbf$c8961390$500a0a0a@stan166> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 16 May 1999 13:05:05 -0700 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > My character device driver receives a pointer to a user data buffer in the > user's address space. I need to DMA those data. For this, I need to bring > the pages into memory and lock them before initiating the DMA. > > My book tells about physio(). However, I found it unconvenient for me. > One reason is that its functionality doesn't fit well into my driver's > architecture. You should architect your driver to suit the way the kernel wants to do things; that's generally the role of a driver, to shim between the kernel and the hardware. If you find your driver architecture isn't fitting the kernel well, you need to fix your driver. > In other words, I want to write my own routine. > > In general, physio() looks like this: > > if useracc() > vmapbuf() > *strategy() > vunmapbuf() > endif > > And vmapbuf() like this: > > vm_fault_quick() > vm_page_hold() > pmap_kenter() // maps the memory into the kernel space > > And I want to write something like this in my driver: > if useracc() > vm_fault_quick() > vm_page_hold() > > endif > > So, is this likely for the above 3 functions to change or disappear in the > next versions? Can they be considered "stable"? No, I don't think so. physio() is the "exported" interface for this sort of thing. If there are performance defects with using physio they should be fixed there. All your custom interface wins you is not mapping the buffer into the kernel space, but this will actually hurt you down the track when you try to do the DMA, as it's much harder to traslate the user virtual address into a physical address when you do the DMA setup. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message