WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] x86: a little bit of genapic cleanup

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86: a little bit of genapic cleanup
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Thu, 23 Dec 2010 13:12:26 +0000
Delivery-date: Thu, 23 Dec 2010 05:13:07 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Eliminate redundancy among the individual handler functions, and mark
init-only functions as such.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2010-12-23.orig/xen/arch/x86/genapic/delivery.c
+++ 2010-12-23/xen/arch/x86/genapic/delivery.c
@@ -7,6 +7,11 @@
 #include <mach_apic.h>
 
 
+const cpumask_t *target_cpus_all(void)
+{
+       return &cpu_online_map;
+}
+
 /*
  * LOGICAL FLAT DELIVERY MODE (multicast via bitmask to <= 8 logical APIC IDs).
  */
@@ -21,16 +26,11 @@ void init_apic_ldr_flat(void)
        apic_write_around(APIC_LDR, val);
 }
 
-void clustered_apic_check_flat(void)
+void __init clustered_apic_check_flat(void)
 {
        printk("Enabling APIC mode:  Flat.  Using %d I/O APICs\n", nr_ioapics);
 }
 
-const cpumask_t *target_cpus_flat(void)
-{
-       return &cpu_online_map;
-}
-
 const cpumask_t *vector_allocation_cpumask_flat(int cpu)
 {
        return &cpu_online_map;
@@ -54,16 +54,11 @@ void init_apic_ldr_phys(void)
        apic_write_around(APIC_LDR, val);
 }
 
-void clustered_apic_check_phys(void)
+void __init clustered_apic_check_phys(void)
 {
        printk("Enabling APIC mode:  Phys.  Using %d I/O APICs\n", nr_ioapics);
 }
 
-const cpumask_t *target_cpus_phys(void)
-{
-       return &cpu_online_map;
-}
-
 const cpumask_t *vector_allocation_cpumask_phys(int cpu)
 {
        return cpumask_of(cpu);
--- 2010-12-23.orig/xen/arch/x86/genapic/x2apic.c
+++ 2010-12-23/xen/arch/x86/genapic/x2apic.c
@@ -40,25 +40,10 @@ static void init_apic_ldr_x2apic_cluster
     cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR);
 }
 
-static void clustered_apic_check_x2apic(void)
+static void __init clustered_apic_check_x2apic(void)
 {
 }
 
-static const cpumask_t *target_cpus_x2apic(void)
-{
-    return &cpu_online_map;
-}
-
-static const cpumask_t *vector_allocation_cpumask_x2apic(int cpu)
-{
-    return cpumask_of(cpu);
-}
-
-static unsigned int cpu_mask_to_apicid_x2apic_phys(const cpumask_t *cpumask)
-{
-    return cpu_physical_id(cpumask_first(cpumask));
-}
-
 static unsigned int cpu_mask_to_apicid_x2apic_cluster(const cpumask_t *cpumask)
 {
     return cpu_2_logical_apicid[cpumask_first(cpumask)];
@@ -114,9 +99,9 @@ static const struct genapic apic_x2apic_
     .int_dest_mode = 0 /* physical delivery */,
     .init_apic_ldr = init_apic_ldr_x2apic_phys,
     .clustered_apic_check = clustered_apic_check_x2apic,
-    .target_cpus = target_cpus_x2apic,
-    .vector_allocation_cpumask = vector_allocation_cpumask_x2apic,
-    .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_phys,
+    .target_cpus = target_cpus_all,
+    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
+    .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
     .send_IPI_mask = send_IPI_mask_x2apic_phys,
     .send_IPI_self = send_IPI_self_x2apic
 };
@@ -127,8 +112,8 @@ static const struct genapic apic_x2apic_
     .int_dest_mode = 1 /* logical delivery */,
     .init_apic_ldr = init_apic_ldr_x2apic_cluster,
     .clustered_apic_check = clustered_apic_check_x2apic,
-    .target_cpus = target_cpus_x2apic,
-    .vector_allocation_cpumask = vector_allocation_cpumask_x2apic,
+    .target_cpus = target_cpus_all,
+    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster,
     .send_IPI_mask = send_IPI_mask_x2apic_cluster,
     .send_IPI_self = send_IPI_self_x2apic
--- 2010-12-23.orig/xen/include/asm-x86/genapic.h
+++ 2010-12-23/xen/include/asm-x86/genapic.h
@@ -50,9 +50,10 @@ struct genapic { 
 
 extern const struct genapic *genapic;
 
+const cpumask_t *target_cpus_all(void);
+
 void init_apic_ldr_flat(void);
 void clustered_apic_check_flat(void);
-const cpumask_t *target_cpus_flat(void);
 unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
 void send_IPI_mask_flat(const cpumask_t *mask, int vector);
 void send_IPI_self_flat(int vector);
@@ -62,7 +63,7 @@ const cpumask_t *vector_allocation_cpuma
        .int_dest_mode = 1 /* logical delivery */, \
        .init_apic_ldr = init_apic_ldr_flat, \
        .clustered_apic_check = clustered_apic_check_flat, \
-       .target_cpus = target_cpus_flat, \
+       .target_cpus = target_cpus_all, \
        .vector_allocation_cpumask = vector_allocation_cpumask_flat, \
        .cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \
        .send_IPI_mask = send_IPI_mask_flat, \
@@ -70,7 +71,6 @@ const cpumask_t *vector_allocation_cpuma
 
 void init_apic_ldr_phys(void);
 void clustered_apic_check_phys(void);
-const cpumask_t *target_cpus_phys(void);
 unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask);
 void send_IPI_mask_phys(const cpumask_t *mask, int vector);
 void send_IPI_self_phys(int vector);
@@ -80,7 +80,7 @@ const cpumask_t *vector_allocation_cpuma
        .int_dest_mode = 0 /* physical delivery */, \
        .init_apic_ldr = init_apic_ldr_phys, \
        .clustered_apic_check = clustered_apic_check_phys, \
-       .target_cpus = target_cpus_phys, \
+       .target_cpus = target_cpus_all, \
        .vector_allocation_cpumask = vector_allocation_cpumask_phys, \
        .cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \
        .send_IPI_mask = send_IPI_mask_phys, \


Attachment: x86-genapic-cleanup.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] x86: a little bit of genapic cleanup, Jan Beulich <=