[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Unpack xen_features into an array of u8 'booleans'



# HG changeset patch
# User Ian.Campbell@xxxxxxxxxxxxx
# Node ID 0e87a5bd6e8bbfe5e6921e32e0d6cc91d14bded8
# Parent  5a63f675107cd84970e299a291485420d97bc139
Unpack xen_features into an array of u8 'booleans'

This allows us to avoid including bitops.h all over the tree as well
as avoiding any potential endianness issues in the future.

Use __read_mostly on the xen_features array now that the tree is based
on a version of Linux which supports it.

Also export xen_features for use in modules.

Signed-off-by: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>

diff -r 5a63f675107c -r 0e87a5bd6e8b 
linux-2.6-xen-sparse/drivers/xen/core/features.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/features.c  Wed Feb  1 18:00:19 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/core/features.c  Wed Feb  1 20:11:18 2006
@@ -7,22 +7,23 @@
  */
 #include <linux/types.h>
 #include <linux/cache.h>
+#include <linux/module.h>
 #include <asm/hypervisor.h>
 #include <xen/features.h>
 
-/* When we rebase to a more recent Linux we can use __read_mostly here. */
-unsigned long xen_features[XENFEAT_NR_SUBMAPS] __cacheline_aligned;
+u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly;
+EXPORT_SYMBOL(xen_features);
 
 void setup_xen_features(void)
 {
-       uint32_t *flags = (uint32_t *)&xen_features[0];
        xen_feature_info_t fi;
-       int i;
+       int i, j;
 
        for (i=0; i<XENFEAT_NR_SUBMAPS; i++) {
                fi.submap_idx = i;
                if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
                        break;
-               flags[i] = fi.submap;
+               for (j=0; j<32; j++)
+                       xen_features[i*32+j] = !!(fi.submap & 1<<j);
        }
 }
diff -r 5a63f675107c -r 0e87a5bd6e8b linux-2.6-xen-sparse/include/xen/features.h
--- a/linux-2.6-xen-sparse/include/xen/features.h       Wed Feb  1 18:00:19 2006
+++ b/linux-2.6-xen-sparse/include/xen/features.h       Wed Feb  1 20:11:18 2006
@@ -13,8 +13,8 @@
 
 extern void setup_xen_features(void);
 
-extern unsigned long xen_features[XENFEAT_NR_SUBMAPS];
+extern u8 xen_features[XENFEAT_NR_SUBMAPS * 32];
 
-#define xen_feature(flag)      (test_bit(flag, xen_features))
+#define xen_feature(flag)      (xen_features[flag])
 
 #endif /* __ASM_XEN_FEATURES_H__ */

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.