WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

Re: [XenPPC] [RFC] fix stupid grant table flags

To: Hollis Blanchard <hollisb@xxxxxxxxxx>
Subject: Re: [XenPPC] [RFC] fix stupid grant table flags
From: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Date: Wed, 21 Jun 2006 18:49:57 -0400
Cc: xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 21 Jun 2006 15:50:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1150915751.26633.19.camel@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1150915751.26633.19.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
I don't think you definition of clear_entry_flag will work, see below

On Jun 21, 2006, at 2:49 PM, Hollis Blanchard wrote:
diff -r ab08d443113d xen/include/asm-ppc/grant_table.h
--- a/xen/include/asm-ppc/grant_table.h Wed Jun 21 13:36:49 2006 -0500
+++ b/xen/include/asm-ppc/grant_table.h Wed Jun 21 13:42:23 2006 -0500
@@ -6,4 +6,6 @@
 #define mark_dirty(d, f) ((void )0)
 #include "../asm-x86/grant_table.h"

+#define clear_entry_flag(nr, flags) clear_bit((nr), (int *)(flags));

1) clear_bit takes an 'unsigned long *' so this should have cause a warning 2) bitops are designed to find the ulong array element (nr / BITS_PER_LONG) then set the bit like (1 << (nr % BITS_PER_LONG)) so that the word feels like 'C' order.

So I think the definition should be:
static inline void clear_entry_flag(unsigned long nr, volatile uint16_t *addr) {
      volatile unsigned long *laddr;
      unsigned long lnr;
  #ifdef SAFETY_DANCE
      BUG_ON((ulong)addr % sizeof (ulong));
  #endif
      lnr = (BITS_PER_LONG - (sizeof (*addr) * 8)) + nr;
      laddr = (volatile unsigned long *)addr;
      clear_bit(lnr, laddr);
  }

You could macro-tize this, but why.

-JX


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel