dect
/
linux-2.6
Archived
13
0
Fork 0

[S390] topology: move topology sysinfo code

Move the topology sysinfo SYSIB definitions to the proper place in
asm/sysinfo.h where they should be.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Heiko Carstens 2010-10-25 16:10:53 +02:00 committed by Martin Schwidefsky
parent 9186d7a9cf
commit c30f91b6a2
2 changed files with 56 additions and 54 deletions

View File

@ -14,6 +14,8 @@
#ifndef __ASM_S390_SYSINFO_H #ifndef __ASM_S390_SYSINFO_H
#define __ASM_S390_SYSINFO_H #define __ASM_S390_SYSINFO_H
#include <asm/bitsperlong.h>
struct sysinfo_1_1_1 { struct sysinfo_1_1_1 {
unsigned short :16; unsigned short :16;
unsigned char ccr; unsigned char ccr;
@ -107,6 +109,39 @@ struct sysinfo_3_2_2 {
char reserved_544[3552]; char reserved_544[3552];
}; };
#define TOPOLOGY_CPU_BITS 64
#define TOPOLOGY_NR_MAG 6
struct topology_cpu {
unsigned char reserved0[4];
unsigned char :6;
unsigned char pp:2;
unsigned char reserved1;
unsigned short origin;
unsigned long mask[TOPOLOGY_CPU_BITS / BITS_PER_LONG];
};
struct topology_container {
unsigned char reserved[7];
unsigned char id;
};
union topology_entry {
unsigned char nl;
struct topology_cpu cpu;
struct topology_container container;
};
struct sysinfo_15_1_x {
unsigned char reserved0[2];
unsigned short length;
unsigned char mag[TOPOLOGY_NR_MAG];
unsigned char reserved1;
unsigned char mnest;
unsigned char reserved2[4];
union topology_entry tle[0];
};
static inline int stsi(void *sysinfo, int fc, int sel1, int sel2) static inline int stsi(void *sysinfo, int fc, int sel1, int sel2)
{ {
register int r0 asm("0") = (fc << 28) | sel1; register int r0 asm("0") = (fc << 28) | sel1;

View File

@ -20,43 +20,10 @@
#include <asm/s390_ext.h> #include <asm/s390_ext.h>
#include <asm/sysinfo.h> #include <asm/sysinfo.h>
#define CPU_BITS 64
#define NR_MAG 6
#define PTF_HORIZONTAL (0UL) #define PTF_HORIZONTAL (0UL)
#define PTF_VERTICAL (1UL) #define PTF_VERTICAL (1UL)
#define PTF_CHECK (2UL) #define PTF_CHECK (2UL)
struct tl_cpu {
unsigned char reserved0[4];
unsigned char :6;
unsigned char pp:2;
unsigned char reserved1;
unsigned short origin;
unsigned long mask[CPU_BITS / BITS_PER_LONG];
};
struct tl_container {
unsigned char reserved[7];
unsigned char id;
};
union tl_entry {
unsigned char nl;
struct tl_cpu cpu;
struct tl_container container;
};
struct tl_info {
unsigned char reserved0[2];
unsigned short length;
unsigned char mag[NR_MAG];
unsigned char reserved1;
unsigned char mnest;
unsigned char reserved2[4];
union tl_entry tle[0];
};
struct mask_info { struct mask_info {
struct mask_info *next; struct mask_info *next;
unsigned char id; unsigned char id;
@ -65,7 +32,7 @@ struct mask_info {
static int topology_enabled = 1; static int topology_enabled = 1;
static void topology_work_fn(struct work_struct *work); static void topology_work_fn(struct work_struct *work);
static struct tl_info *tl_info; static struct sysinfo_15_1_x *tl_info;
static struct timer_list topology_timer; static struct timer_list topology_timer;
static void set_topology_timer(void); static void set_topology_timer(void);
static DECLARE_WORK(topology_work, topology_work_fn); static DECLARE_WORK(topology_work, topology_work_fn);
@ -101,18 +68,18 @@ static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu)
return mask; return mask;
} }
static void add_cpus_to_mask(struct tl_cpu *tl_cpu, struct mask_info *book, static void add_cpus_to_mask(struct topology_cpu *tl_cpu,
struct mask_info *core) struct mask_info *book, struct mask_info *core)
{ {
unsigned int cpu; unsigned int cpu;
for (cpu = find_first_bit(&tl_cpu->mask[0], CPU_BITS); for (cpu = find_first_bit(&tl_cpu->mask[0], TOPOLOGY_CPU_BITS);
cpu < CPU_BITS; cpu < TOPOLOGY_CPU_BITS;
cpu = find_next_bit(&tl_cpu->mask[0], CPU_BITS, cpu + 1)) cpu = find_next_bit(&tl_cpu->mask[0], TOPOLOGY_CPU_BITS, cpu + 1))
{ {
unsigned int rcpu, lcpu; unsigned int rcpu, lcpu;
rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin; rcpu = TOPOLOGY_CPU_BITS - 1 - cpu + tl_cpu->origin;
for_each_present_cpu(lcpu) { for_each_present_cpu(lcpu) {
if (cpu_logical_map(lcpu) != rcpu) if (cpu_logical_map(lcpu) != rcpu)
continue; continue;
@ -145,15 +112,14 @@ static void clear_masks(void)
#endif #endif
} }
static union tl_entry *next_tle(union tl_entry *tle) static union topology_entry *next_tle(union topology_entry *tle)
{ {
if (tle->nl) if (!tle->nl)
return (union tl_entry *)((struct tl_container *)tle + 1); return (union topology_entry *)((struct topology_cpu *)tle + 1);
else return (union topology_entry *)((struct topology_container *)tle + 1);
return (union tl_entry *)((struct tl_cpu *)tle + 1);
} }
static void tl_to_cores(struct tl_info *info) static void tl_to_cores(struct sysinfo_15_1_x *info)
{ {
#ifdef CONFIG_SCHED_BOOK #ifdef CONFIG_SCHED_BOOK
struct mask_info *book = &book_info; struct mask_info *book = &book_info;
@ -161,13 +127,13 @@ static void tl_to_cores(struct tl_info *info)
struct mask_info *book = NULL; struct mask_info *book = NULL;
#endif #endif
struct mask_info *core = &core_info; struct mask_info *core = &core_info;
union tl_entry *tle, *end; union topology_entry *tle, *end;
spin_lock_irq(&topology_lock); spin_lock_irq(&topology_lock);
clear_masks(); clear_masks();
tle = info->tle; tle = info->tle;
end = (union tl_entry *)((unsigned long)info + info->length); end = (union topology_entry *)((unsigned long)info + info->length);
while (tle < end) { while (tle < end) {
switch (tle->nl) { switch (tle->nl) {
#ifdef CONFIG_SCHED_BOOK #ifdef CONFIG_SCHED_BOOK
@ -263,7 +229,7 @@ static void store_topology(struct tl_info *info)
int arch_update_cpu_topology(void) int arch_update_cpu_topology(void)
{ {
struct tl_info *info = tl_info; struct sysinfo_15_1_x *info = tl_info;
struct sys_device *sysdev; struct sys_device *sysdev;
int cpu; int cpu;
@ -333,13 +299,14 @@ out:
} }
__initcall(init_topology_update); __initcall(init_topology_update);
static void alloc_masks(struct tl_info *info, struct mask_info *mask, int offset) static void alloc_masks(struct sysinfo_15_1_x *info, struct mask_info *mask,
int offset)
{ {
int i, nr_masks; int i, nr_masks;
nr_masks = info->mag[NR_MAG - offset]; nr_masks = info->mag[TOPOLOGY_NR_MAG - offset];
for (i = 0; i < info->mnest - offset; i++) for (i = 0; i < info->mnest - offset; i++)
nr_masks *= info->mag[NR_MAG - offset - 1 - i]; nr_masks *= info->mag[TOPOLOGY_NR_MAG - offset - 1 - i];
nr_masks = max(nr_masks, 1); nr_masks = max(nr_masks, 1);
for (i = 0; i < nr_masks; i++) { for (i = 0; i < nr_masks; i++) {
mask->next = alloc_bootmem(sizeof(struct mask_info)); mask->next = alloc_bootmem(sizeof(struct mask_info));
@ -349,7 +316,7 @@ static void alloc_masks(struct tl_info *info, struct mask_info *mask, int offset
void __init s390_init_cpu_topology(void) void __init s390_init_cpu_topology(void)
{ {
struct tl_info *info; struct sysinfo_15_1_x *info;
int i; int i;
if (!MACHINE_HAS_TOPOLOGY) if (!MACHINE_HAS_TOPOLOGY)
@ -358,7 +325,7 @@ void __init s390_init_cpu_topology(void)
info = tl_info; info = tl_info;
store_topology(info); store_topology(info);
pr_info("The CPU configuration topology of the machine is:"); pr_info("The CPU configuration topology of the machine is:");
for (i = 0; i < NR_MAG; i++) for (i = 0; i < TOPOLOGY_NR_MAG; i++)
printk(" %d", info->mag[i]); printk(" %d", info->mag[i]);
printk(" / %d\n", info->mnest); printk(" / %d\n", info->mnest);
alloc_masks(info, &core_info, 2); alloc_masks(info, &core_info, 2);