debuggers.hg

changeset 22679:609da2035aab

x86: a little bit of genapic cleanup

Eliminate redundancy among the individual handler functions, and mark
init-only functions as such.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir@xen.org>
date Fri Dec 24 10:14:36 2010 +0000 (2010-12-24)
parents 7cc87dcf30a1
children 0292bec5e98d
files xen/arch/x86/genapic/delivery.c xen/arch/x86/genapic/x2apic.c xen/include/asm-x86/genapic.h
line diff
     1.1 --- a/xen/arch/x86/genapic/delivery.c	Fri Dec 24 10:14:01 2010 +0000
     1.2 +++ b/xen/arch/x86/genapic/delivery.c	Fri Dec 24 10:14:36 2010 +0000
     1.3 @@ -7,6 +7,11 @@
     1.4  #include <mach_apic.h>
     1.5  
     1.6  
     1.7 +const cpumask_t *target_cpus_all(void)
     1.8 +{
     1.9 +	return &cpu_online_map;
    1.10 +}
    1.11 +
    1.12  /*
    1.13   * LOGICAL FLAT DELIVERY MODE (multicast via bitmask to <= 8 logical APIC IDs).
    1.14   */
    1.15 @@ -21,16 +26,11 @@ void init_apic_ldr_flat(void)
    1.16  	apic_write_around(APIC_LDR, val);
    1.17  }
    1.18  
    1.19 -void clustered_apic_check_flat(void)
    1.20 +void __init clustered_apic_check_flat(void)
    1.21  {
    1.22  	printk("Enabling APIC mode:  Flat.  Using %d I/O APICs\n", nr_ioapics);
    1.23  }
    1.24  
    1.25 -const cpumask_t *target_cpus_flat(void)
    1.26 -{
    1.27 -	return &cpu_online_map;
    1.28 -}
    1.29 -
    1.30  const cpumask_t *vector_allocation_cpumask_flat(int cpu)
    1.31  {
    1.32  	return &cpu_online_map;
    1.33 @@ -54,16 +54,11 @@ void init_apic_ldr_phys(void)
    1.34  	apic_write_around(APIC_LDR, val);
    1.35  }
    1.36  
    1.37 -void clustered_apic_check_phys(void)
    1.38 +void __init clustered_apic_check_phys(void)
    1.39  {
    1.40  	printk("Enabling APIC mode:  Phys.  Using %d I/O APICs\n", nr_ioapics);
    1.41  }
    1.42  
    1.43 -const cpumask_t *target_cpus_phys(void)
    1.44 -{
    1.45 -	return &cpu_online_map;
    1.46 -}
    1.47 -
    1.48  const cpumask_t *vector_allocation_cpumask_phys(int cpu)
    1.49  {
    1.50  	return cpumask_of(cpu);
     2.1 --- a/xen/arch/x86/genapic/x2apic.c	Fri Dec 24 10:14:01 2010 +0000
     2.2 +++ b/xen/arch/x86/genapic/x2apic.c	Fri Dec 24 10:14:36 2010 +0000
     2.3 @@ -40,23 +40,8 @@ static void init_apic_ldr_x2apic_cluster
     2.4      cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR);
     2.5  }
     2.6  
     2.7 -static void clustered_apic_check_x2apic(void)
     2.8 -{
     2.9 -}
    2.10 -
    2.11 -static const cpumask_t *target_cpus_x2apic(void)
    2.12 +static void __init clustered_apic_check_x2apic(void)
    2.13  {
    2.14 -    return &cpu_online_map;
    2.15 -}
    2.16 -
    2.17 -static const cpumask_t *vector_allocation_cpumask_x2apic(int cpu)
    2.18 -{
    2.19 -    return cpumask_of(cpu);
    2.20 -}
    2.21 -
    2.22 -static unsigned int cpu_mask_to_apicid_x2apic_phys(const cpumask_t *cpumask)
    2.23 -{
    2.24 -    return cpu_physical_id(cpumask_first(cpumask));
    2.25  }
    2.26  
    2.27  static unsigned int cpu_mask_to_apicid_x2apic_cluster(const cpumask_t *cpumask)
    2.28 @@ -114,9 +99,9 @@ static const struct genapic apic_x2apic_
    2.29      .int_dest_mode = 0 /* physical delivery */,
    2.30      .init_apic_ldr = init_apic_ldr_x2apic_phys,
    2.31      .clustered_apic_check = clustered_apic_check_x2apic,
    2.32 -    .target_cpus = target_cpus_x2apic,
    2.33 -    .vector_allocation_cpumask = vector_allocation_cpumask_x2apic,
    2.34 -    .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_phys,
    2.35 +    .target_cpus = target_cpus_all,
    2.36 +    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
    2.37 +    .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
    2.38      .send_IPI_mask = send_IPI_mask_x2apic_phys,
    2.39      .send_IPI_self = send_IPI_self_x2apic
    2.40  };
    2.41 @@ -127,8 +112,8 @@ static const struct genapic apic_x2apic_
    2.42      .int_dest_mode = 1 /* logical delivery */,
    2.43      .init_apic_ldr = init_apic_ldr_x2apic_cluster,
    2.44      .clustered_apic_check = clustered_apic_check_x2apic,
    2.45 -    .target_cpus = target_cpus_x2apic,
    2.46 -    .vector_allocation_cpumask = vector_allocation_cpumask_x2apic,
    2.47 +    .target_cpus = target_cpus_all,
    2.48 +    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
    2.49      .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster,
    2.50      .send_IPI_mask = send_IPI_mask_x2apic_cluster,
    2.51      .send_IPI_self = send_IPI_self_x2apic
     3.1 --- a/xen/include/asm-x86/genapic.h	Fri Dec 24 10:14:01 2010 +0000
     3.2 +++ b/xen/include/asm-x86/genapic.h	Fri Dec 24 10:14:36 2010 +0000
     3.3 @@ -50,9 +50,10 @@ struct genapic {
     3.4  
     3.5  extern const struct genapic *genapic;
     3.6  
     3.7 +const cpumask_t *target_cpus_all(void);
     3.8 +
     3.9  void init_apic_ldr_flat(void);
    3.10  void clustered_apic_check_flat(void);
    3.11 -const cpumask_t *target_cpus_flat(void);
    3.12  unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
    3.13  void send_IPI_mask_flat(const cpumask_t *mask, int vector);
    3.14  void send_IPI_self_flat(int vector);
    3.15 @@ -62,7 +63,7 @@ const cpumask_t *vector_allocation_cpuma
    3.16  	.int_dest_mode = 1 /* logical delivery */, \
    3.17  	.init_apic_ldr = init_apic_ldr_flat, \
    3.18  	.clustered_apic_check = clustered_apic_check_flat, \
    3.19 -	.target_cpus = target_cpus_flat, \
    3.20 +	.target_cpus = target_cpus_all, \
    3.21  	.vector_allocation_cpumask = vector_allocation_cpumask_flat, \
    3.22  	.cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \
    3.23  	.send_IPI_mask = send_IPI_mask_flat, \
    3.24 @@ -70,7 +71,6 @@ const cpumask_t *vector_allocation_cpuma
    3.25  
    3.26  void init_apic_ldr_phys(void);
    3.27  void clustered_apic_check_phys(void);
    3.28 -const cpumask_t *target_cpus_phys(void);
    3.29  unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask);
    3.30  void send_IPI_mask_phys(const cpumask_t *mask, int vector);
    3.31  void send_IPI_self_phys(int vector);
    3.32 @@ -80,7 +80,7 @@ const cpumask_t *vector_allocation_cpuma
    3.33  	.int_dest_mode = 0 /* physical delivery */, \
    3.34  	.init_apic_ldr = init_apic_ldr_phys, \
    3.35  	.clustered_apic_check = clustered_apic_check_phys, \
    3.36 -	.target_cpus = target_cpus_phys, \
    3.37 +	.target_cpus = target_cpus_all, \
    3.38  	.vector_allocation_cpumask = vector_allocation_cpumask_phys, \
    3.39  	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \
    3.40  	.send_IPI_mask = send_IPI_mask_phys, \