What about adding L1_CACHE_MASK and L1_CACHE_ALIGNED?

From: Robin Holt (holt@sgi.com)
Date: Thu Aug 08 2002 - 14:29:33 EST


While doing some work with a hardware specific driver, I kept running
across cases where the following mod to <linux/cache.h> would be helpful.
What is the general opinion towards getting this accepted into 2.5? How
about 2.4.20?

Thanks,
Robin Holt

--------------------------- Diff follows ---------------------------
--- linux-2.4.19/include/linux/cache.h Fri Dec 21 11:42:03 2001
+++ linux-2.4.19-modified/include/linux/cache.h Thu Aug 8 14:26:32 2002
@@ -4,8 +4,16 @@
 #include <linux/config.h>
 #include <asm/cache.h>

+#ifndef L1_CACHE_MASK
+#define L1_CACHE_MASK L1_CACHE_BYTES - 1
+#endif
+
 #ifndef L1_CACHE_ALIGN
-#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
+#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_MASK))&~(L1_CACHE_MASK))
+#endif
+
+#ifndef L1_CACHE_ALIGNED
+#define L1_CACHE_ALIGNED(_p) (((u64)(_p) & L1_CACHE_MASK) == 0)
 #endif

 #ifndef SMP_CACHE_BYTES

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:17 EST