On Tue, Aug 28, 2007 at 03:45:56PM +0100, Keir Fraser wrote:
> On 28/8/07 07:17, "Isaku Yamahata" <[EMAIL PROTECTED]> wrote:
> 
> > +static int
> > +xencomm_ctxt_next(struct xencomm_ctxt *ctxt, int i)
> > +{
> > +    BUG_ON(i >= ctxt->nr_addrs);
> > +    /* in i == 0 case, we already calculated in xecomm_addr_init() */
> > +    if ( i != 0 )
> > +        ctxt->address++;
> 
> This function may deserve a comment -- what is it for? The 'i == 0' comment
> is confusing, and appears to refer to a function that doesn't exist (I
> couldn't find any function with suffix _addr_init()).
> 
> These patches are all in the staging tree now, so provide delta patches to
> apply on top.

I attached the patch to add the comment. I hope that the comment clarify.

-- 
yamahata
# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1188355084 -32400
# Node ID d4283f2a12f7d5e9b968da53bdb53d0e0b063157
# Parent  8e9ec8711efac6f62784d916b6018d8ec75f007d
add the comment ot xencomm_ctxt_next()
PATCHNAME: comment_xencomm_ctxt_next

Signed-off-by: Isaku Yamahata <[EMAIL PROTECTED]>

diff -r 8e9ec8711efa -r d4283f2a12f7 xen/common/xencomm.c
--- a/xen/common/xencomm.c	Tue Aug 28 16:13:35 2007 +0100
+++ b/xen/common/xencomm.c	Wed Aug 29 11:38:04 2007 +0900
@@ -138,6 +138,22 @@ xencomm_ctxt_init(const void *handle, st
     return 0;
 }
 
+/*
+ * Calculate the vaddr of &ctxt->desc_in_paddr->address[i] and get_page().
+ * And put the results in ctxt->page and ctxt->address.
+ * If there is the previous page, put_page().
+ *
+ * A guest domain passes the array, ctxt->desc_in_paddr->address[].
+ * It is gpaddr-contiguous, but not maddr-contiguous so that
+ * we can't obtain the vaddr by simple offsetting.
+ * We need to convert gpaddr, &ctxt->desc_in_paddr->address[i],
+ * into maddr and then convert it to the xen virtual address in order
+ * to access there.
+ * The conversion can be optimized out by using the last result of
+ * ctxt->address because we access the array sequentially.
+ * The conversion, gpaddr -> maddr -> vaddr, is necessary only when
+ * crossing page boundary.
+ */
 static int
 xencomm_ctxt_next(struct xencomm_ctxt *ctxt, int i)
 {
@@ -147,7 +163,7 @@ xencomm_ctxt_next(struct xencomm_ctxt *c
 
     BUG_ON(i >= ctxt->nr_addrs);
 
-    /* In i == 0 case, we already calculated in xecomm_addr_init(). */
+    /* For i == 0 case we already calculated it in xencomm_ctxt_init(). */
     if ( i != 0 )
         ctxt->address++;
 
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to