ia64/xen-unstable

changeset 8731:0e87a5bd6e8b

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@XenSource.com>
author Ian.Campbell@xensource.com
date Wed Feb 01 20:11:18 2006 +0000 (2006-02-01)
parents 5a63f675107c
children c84a051d8967
files linux-2.6-xen-sparse/drivers/xen/core/features.c linux-2.6-xen-sparse/include/xen/features.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/features.c	Wed Feb 01 18:00:19 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/features.c	Wed Feb 01 20:11:18 2006 +0000
     1.3 @@ -7,22 +7,23 @@
     1.4   */
     1.5  #include <linux/types.h>
     1.6  #include <linux/cache.h>
     1.7 +#include <linux/module.h>
     1.8  #include <asm/hypervisor.h>
     1.9  #include <xen/features.h>
    1.10  
    1.11 -/* When we rebase to a more recent Linux we can use __read_mostly here. */
    1.12 -unsigned long xen_features[XENFEAT_NR_SUBMAPS] __cacheline_aligned;
    1.13 +u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly;
    1.14 +EXPORT_SYMBOL(xen_features);
    1.15  
    1.16  void setup_xen_features(void)
    1.17  {
    1.18 -	uint32_t *flags = (uint32_t *)&xen_features[0];
    1.19  	xen_feature_info_t fi;
    1.20 -	int i;
    1.21 +	int i, j;
    1.22  
    1.23  	for (i=0; i<XENFEAT_NR_SUBMAPS; i++) {
    1.24  		fi.submap_idx = i;
    1.25  		if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
    1.26  			break;
    1.27 -		flags[i] = fi.submap;
    1.28 +		for (j=0; j<32; j++)
    1.29 +			xen_features[i*32+j] = !!(fi.submap & 1<<j);
    1.30  	}
    1.31  }
     2.1 --- a/linux-2.6-xen-sparse/include/xen/features.h	Wed Feb 01 18:00:19 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/include/xen/features.h	Wed Feb 01 20:11:18 2006 +0000
     2.3 @@ -13,8 +13,8 @@
     2.4  
     2.5  extern void setup_xen_features(void);
     2.6  
     2.7 -extern unsigned long xen_features[XENFEAT_NR_SUBMAPS];
     2.8 +extern u8 xen_features[XENFEAT_NR_SUBMAPS * 32];
     2.9  
    2.10 -#define xen_feature(flag)	(test_bit(flag, xen_features))
    2.11 +#define xen_feature(flag)	(xen_features[flag])
    2.12  
    2.13  #endif /* __ASM_XEN_FEATURES_H__ */