Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324085
b: refs/heads/master
c: fade4dc
h: refs/heads/master
i:
  324083: 270ebd2
v: v3
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Sep 26, 2012
1 parent 5841535 commit 8fa81f3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34cda99260247873df53ae00885fb0f426b149a5
refs/heads/master: fade4dc49101e3b68fb375fd2b00d0ef1f31a36f
2 changes: 2 additions & 0 deletions trunk/arch/s390/include/asm/sysinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ struct sysinfo_3_2_2 {
char reserved_544[3552];
};

extern int topology_max_mnest;

#define TOPOLOGY_CPU_BITS 64
#define TOPOLOGY_NR_MAG 6

Expand Down
27 changes: 22 additions & 5 deletions trunk/arch/s390/kernel/early.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,26 +215,44 @@ static noinline __init void init_kernel_storage_key(void)
PAGE_DEFAULT_KEY, 0);
}

static __initdata struct sysinfo_3_2_2 vmms __aligned(PAGE_SIZE);
static __initdata char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE);

static noinline __init void detect_machine_type(void)
{
struct sysinfo_3_2_2 *vmms = (struct sysinfo_3_2_2 *)&sysinfo_page;

/* Check current-configuration-level */
if ((stsi(NULL, 0, 0, 0) >> 28) <= 2) {
S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR;
return;
}
/* Get virtual-machine cpu information. */
if (stsi(&vmms, 3, 2, 2) == -ENOSYS || !vmms.count)
if (stsi(vmms, 3, 2, 2) == -ENOSYS || !vmms->count)
return;

/* Running under KVM? If not we assume z/VM */
if (!memcmp(vmms.vm[0].cpi, "\xd2\xe5\xd4", 3))
if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3))
S390_lowcore.machine_flags |= MACHINE_FLAG_KVM;
else
S390_lowcore.machine_flags |= MACHINE_FLAG_VM;
}

static __init void setup_topology(void)
{
#ifdef CONFIG_64BIT
int max_mnest;

if (!test_facility(11))
return;
S390_lowcore.machine_flags |= MACHINE_FLAG_TOPOLOGY;
for (max_mnest = 6; max_mnest > 1; max_mnest--) {
if (stsi(&sysinfo_page, 15, 1, max_mnest) != -ENOSYS)
break;
}
topology_max_mnest = max_mnest;
#endif
}

static void early_pgm_check_handler(void)
{
unsigned long addr;
Expand Down Expand Up @@ -364,8 +382,6 @@ static __init void detect_machine_facilities(void)
S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE;
if (test_facility(8))
S390_lowcore.machine_flags |= MACHINE_FLAG_PFMF;
if (test_facility(11))
S390_lowcore.machine_flags |= MACHINE_FLAG_TOPOLOGY;
if (test_facility(27))
S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS;
if (test_facility(40))
Expand Down Expand Up @@ -467,6 +483,7 @@ void __init startup_init(void)
detect_diag44();
detect_machine_facilities();
setup_hpage();
setup_topology();
sclp_facilities_detect();
detect_memory_layout(memory_chunk);
#ifdef CONFIG_DYNAMIC_FTRACE
Expand Down
12 changes: 3 additions & 9 deletions trunk/arch/s390/kernel/sysinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <math-emu/soft-fp.h>
#include <math-emu/single.h>

int topology_max_mnest;

static inline int stsi_0(void)
{
int rc = stsi(NULL, 0, 0, 0);
Expand Down Expand Up @@ -95,15 +97,7 @@ static void stsi_15_1_x(struct seq_file *m, struct sysinfo_15_1_x *info)
seq_putc(m, '\n');
if (!MACHINE_HAS_TOPOLOGY)
return;
if (max_mnest) {
stsi(info, 15, 1, max_mnest);
} else {
for (max_mnest = 6; max_mnest > 1; max_mnest--) {
rc = stsi(info, 15, 1, max_mnest);
if (rc != -ENOSYS)
break;
}
}
stsi(info, 15, 1, topology_max_mnest);
seq_printf(m, "CPU Topology HW: ");
for (i = 0; i < TOPOLOGY_NR_MAG; i++)
seq_printf(m, " %d", info->mag[i]);
Expand Down
10 changes: 4 additions & 6 deletions trunk/arch/s390/kernel/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,10 @@ static void update_cpu_core_map(void)

void store_topology(struct sysinfo_15_1_x *info)
{
int rc;

rc = stsi(info, 15, 1, 3);
if (rc != -ENOSYS)
return;
stsi(info, 15, 1, 2);
if (topology_max_mnest >= 3)
stsi(info, 15, 1, 3);
else
stsi(info, 15, 1, 2);
}

int arch_update_cpu_topology(void)
Expand Down

0 comments on commit 8fa81f3

Please sign in to comment.