ia64/xen-unstable

changeset 9741:2de95fd92e74

[IA64] dom_rid_bits

dom_rid_bits command line parameter added (set default domain rid bits).
Comments added and cleanups in regionreg.c
panic_domain declared in domain.h

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Wed Apr 19 10:26:50 2006 -0600 (2006-04-19)
parents a1add4e39878
children c3972d632ff6
files xen/arch/ia64/xen/regionreg.c xen/include/asm-ia64/domain.h
line diff
     1.1 --- a/xen/arch/ia64/xen/regionreg.c	Wed Apr 19 10:24:33 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/regionreg.c	Wed Apr 19 10:26:50 2006 -0600
     1.3 @@ -15,24 +15,39 @@
     1.4  #include <asm/regionreg.h>
     1.5  #include <asm/vhpt.h>
     1.6  #include <asm/vcpu.h>
     1.7 +
     1.8 +/* Defined in xemasm.S  */
     1.9  extern void ia64_new_rr7(unsigned long rid,void *shared_info, void *shared_arch_info, unsigned long p_vhpt, unsigned long v_pal);
    1.10 +
    1.11  extern void *pal_vaddr;
    1.12  
    1.13 -/* FIXME: where these declarations should be there ? */
    1.14 -extern void panic_domain(struct pt_regs *, const char *, ...);
    1.15 +/* RID virtualization mechanism is really simple:  domains have less rid bits
    1.16 +   than the host and the host rid space is shared among the domains.  (Values
    1.17 +   in parenthesis are usual default values).
    1.18  
    1.19 -#define DOMAIN_RID_BITS_DEFAULT 18
    1.20 +   The host rid space is partitionned into MAX_RID_BLOCKS (= 64)
    1.21 +   blocks of 2**IA64_MIN_IMPL_RID_BITS (= 18) rids.  The first block is also
    1.22 +   partitionned into MAX_RID_BLOCKS small blocks.  Small blocks are used for
    1.23 +   metaphysical rids.  Small block 0 can't be allocated and is reserved for
    1.24 +   Xen own rids during boot.
    1.25  
    1.26 +   Blocks and small blocks are allocated together and a domain may
    1.27 +   have one or more consecutive blocks (and small blocks).
    1.28 +*/
    1.29 +
    1.30 +/* Minimum number of RID bits for a domain.  The current value is 18, which is
    1.31 +   the minimum defined by the itanium architecture, but it can be lowered
    1.32 +   to increase the number of domain.  */
    1.33  #define	IA64_MIN_IMPL_RID_BITS	(IA64_MIN_IMPL_RID_MSB+1)
    1.34 +/* Maximum number of RID bits.  This is definitly 24.  */
    1.35  #define	IA64_MAX_IMPL_RID_BITS	24
    1.36  
    1.37 -#define MIN_RIDS	(1 << IA64_MIN_IMPL_RID_BITS)
    1.38 -#define	MIN_RID_MAX	(MIN_RIDS - 1)
    1.39 -#define	MIN_RID_MASK	(MIN_RIDS - 1)
    1.40 -#define	MAX_RIDS	(1 << (IA64_MAX_IMPL_RID_BITS))
    1.41 -#define	MAX_RID		(MAX_RIDS - 1)
    1.42 +/* Maximum number of blocks.  */
    1.43  #define	MAX_RID_BLOCKS	(1 << (IA64_MAX_IMPL_RID_BITS-IA64_MIN_IMPL_RID_BITS))
    1.44 -#define RIDS_PER_RIDBLOCK MIN_RIDS
    1.45 +
    1.46 +/* Default number of rid bits for domains.  */
    1.47 +static unsigned int domain_rid_bits_default = IA64_MIN_IMPL_RID_BITS;
    1.48 +integer_param("dom_rid_bits", domain_rid_bits_default); 
    1.49  
    1.50  #if 0
    1.51  // following already defined in include/asm-ia64/gcc_intrin.h
    1.52 @@ -90,11 +105,31 @@ void init_rid_allocator (void)
    1.53  	if (implemented_rid_bits > IA64_MAX_IMPL_RID_BITS)
    1.54  		implemented_rid_bits = IA64_MAX_IMPL_RID_BITS;
    1.55  
    1.56 +	/* Due to RID mangling, we expect 24 RID bits!
    1.57 +	   This test should be removed if RID mangling is removed/modified.  */
    1.58 +	if (implemented_rid_bits != 24) {
    1.59 +		printf ("RID mangling expected 24 RID bits, got only %d!\n",
    1.60 +			implemented_rid_bits);
    1.61 +		BUG();
    1.62 +	}
    1.63 +
    1.64 +	/* Allow the creation of at least domain 0.  */
    1.65 +	if (domain_rid_bits_default > implemented_rid_bits - 1)
    1.66 +		domain_rid_bits_default = implemented_rid_bits - 1;
    1.67 +
    1.68 +	/* Check for too small values.  */
    1.69 +	if (domain_rid_bits_default < IA64_MIN_IMPL_RID_BITS) {
    1.70 +		printf ("Default domain rid bits %d is too small, use %d\n",
    1.71 +			domain_rid_bits_default, IA64_MIN_IMPL_RID_BITS);
    1.72 +		domain_rid_bits_default = IA64_MIN_IMPL_RID_BITS;
    1.73 +	}
    1.74 +
    1.75  	log_blocks = (implemented_rid_bits - IA64_MIN_IMPL_RID_BITS);
    1.76  
    1.77 -	printf ("Maximum of simultaneous domains: %d\n",
    1.78 -		(1 << log_blocks) - 1);
    1.79 -
    1.80 +	printf ("Maximum number of domains: %d; %d RID bits per domain\n",
    1.81 +		(1 << (implemented_rid_bits - domain_rid_bits_default)) - 1,
    1.82 +		domain_rid_bits_default);
    1.83 +	
    1.84  	mp_rid_shift = IA64_MIN_IMPL_RID_BITS - log_blocks;
    1.85  	BUG_ON (mp_rid_shift < 3);
    1.86  }
    1.87 @@ -109,7 +144,7 @@ int allocate_rid_range(struct domain *d,
    1.88  	int i, j, n_rid_blocks;
    1.89  
    1.90  	if (ridbits == 0)
    1.91 -		ridbits = DOMAIN_RID_BITS_DEFAULT;
    1.92 +		ridbits = domain_rid_bits_default;
    1.93  
    1.94  	if (ridbits >= IA64_MAX_IMPL_RID_BITS)
    1.95  		ridbits = IA64_MAX_IMPL_RID_BITS - 1;
    1.96 @@ -152,7 +187,7 @@ int allocate_rid_range(struct domain *d,
    1.97  	d->arch.metaphysical_rr0 = allocate_metaphysical_rr(d, 0);
    1.98  	d->arch.metaphysical_rr4 = allocate_metaphysical_rr(d, 1);
    1.99  
   1.100 -	printf("###allocating rid_range, domain %p: rid=%x-%x mp_rid=%x\n",
   1.101 +	printf("### domain %p: rid=%x-%x mp_rid=%x\n",
   1.102  	       d, d->arch.starting_rid, d->arch.ending_rid,
   1.103  	       d->arch.starting_mp_rid);
   1.104  	
   1.105 @@ -166,20 +201,16 @@ int deallocate_rid_range(struct domain *
   1.106  	int rid_block_end = d->arch.ending_rid >> IA64_MIN_IMPL_RID_BITS;
   1.107  	int rid_block_start = d->arch.starting_rid >> IA64_MIN_IMPL_RID_BITS;
   1.108  
   1.109 -	//
   1.110 -	// not all domains will have allocated RIDs (physical mode loaders for instance)
   1.111 -	//
   1.112 -	if (d->arch.rid_bits == 0) return 1;
   1.113 +	/* Sanity check.  */
   1.114 +	if (d->arch.rid_bits == 0)
   1.115 +		return 1;
   1.116  
   1.117 -#ifdef DEBUG
   1.118 +	
   1.119  	for (i = rid_block_start; i < rid_block_end; ++i) {
   1.120  	        ASSERT(ridblock_owner[i] == d);
   1.121 -	    }
   1.122 -#endif
   1.123 -	
   1.124 -	for (i = rid_block_start; i < rid_block_end; ++i)
   1.125  		ridblock_owner[i] = NULL;
   1.126 -	
   1.127 +	}
   1.128 +
   1.129  	d->arch.rid_bits = 0;
   1.130  	d->arch.starting_rid = 0;
   1.131  	d->arch.ending_rid = 0;
     2.1 --- a/xen/include/asm-ia64/domain.h	Wed Apr 19 10:24:33 2006 -0600
     2.2 +++ b/xen/include/asm-ia64/domain.h	Wed Apr 19 10:26:50 2006 -0600
     2.3 @@ -18,6 +18,10 @@ extern void domain_relinquish_resources(
     2.4     if false, flush and invalidate caches.  */
     2.5  extern void domain_cache_flush (struct domain *d, int sync_only);
     2.6  
     2.7 +/* Cleanly crash the current domain with a message.  */
     2.8 +extern void panic_domain(struct pt_regs *, const char *, ...)
     2.9 +     __attribute__ ((noreturn, format (printf, 2, 3)));
    2.10 +
    2.11  struct arch_domain {
    2.12      struct mm_struct *mm;
    2.13      unsigned long metaphysical_rr0;