From: Keir Fraser Subject: Re: Re: user/hypervisor address space solution Date: Fri, 17 Feb 2006 08:58:08 +0000 Message-ID: <9a7b8a3f6235ad47c50fdf5fb1216ea1@cl.cam.ac.uk> References: <1139283935.13776.71.camel@localhost.localdomain> <1139871396.8407.124.camel@localhost.localdomain> <1140000495.23614.27.camel@localhost.localdomain> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Hollis Blanchard Cc: Jimi Xenidis , Dan Magenheimer , xen-devel List-Id: xen-devel@lists.xenproject.org On 17 Feb 2006, at 05:39, Hollis Blanchard wrote: >> Should be called get_guest/put_guest/copy_from_guest/copy_to_guest. >> Better names, and the arch-specific old functions can still keep >> their old names. > > I don't think I understood your full meaning before, but I'm with you > now. get/put_user() will still exist on x86 and mean virtual addresses > (kernel or user). The new get/put_guest_offset() implementations will > be equivalent. > > PowerPC will implement get/put_guest_offset(), but will not implement > get/put_user() at all. If those latter calls do make their way into > common code (after the PPC code has been merged), every PPC build in > the regression test suite will fail, so the patch will be flagged as > bad and not committed. > > This sounds fine to me, other than that bit about confusing the word > "user" to mean "virtual" (since it could of course be a kernel address > as well). I actually managed to get rid of get/put_user from common code, so we only need replacements for copy_to/from_user. I suggest e.g., copy_to_guest(handle, offset, xen_ptr, nr_items) where handle is a 'guest pointer' of type foo *, which we view as pointing at an array of foos. 'offset' is the offset into the foo array to start copying to. xen_ptr must be of type foo *; it is the start address to copy from. nr_items is the number of foos to copy. There are a few other thgings to consider too. We could have copy_array_to_guest with the above declaration, and have a simpler copy_to_guest with no 'nr_items' parameter. We will need __copy_to_guest alternatives where the handle has been pre-validated. How does that sound? -- Keir