Skip to content

Commit

Permalink
s390/zcore: calculate real memory size using own get_mem_size function
Browse files Browse the repository at this point in the history
The zcore device driver makes use of the global visible real_memory_size
variable with its odd semantics.
Since the zcore device driver already has code in place which calculates
the memory size at module load time, use that code to calculate the current
memory end value.

One user less of the odd real_memory_size variable.

Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed May 2, 2013
1 parent 0a69406 commit 7b1e427
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions drivers/s390/char/zcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static void __init set_lc_mask(struct save_area *map)
/*
* Initialize dump globals for a given architecture
*/
static int __init sys_info_init(enum arch_id arch)
static int __init sys_info_init(enum arch_id arch, unsigned long mem_end)
{
int rc;

Expand All @@ -579,7 +579,7 @@ static int __init sys_info_init(enum arch_id arch)
rc = init_cpu_info(arch);
if (rc)
return rc;
sys_info.mem_size = real_memory_size;
sys_info.mem_size = mem_end;

return 0;
}
Expand All @@ -601,7 +601,7 @@ static int __init check_sdias(void)
return 0;
}

static int __init get_mem_size(unsigned long *mem)
static int __init get_mem_info(unsigned long *mem, unsigned long *end)
{
int i;
struct mem_chunk *chunk_array;
Expand All @@ -615,28 +615,26 @@ static int __init get_mem_size(unsigned long *mem)
if (chunk_array[i].size == 0)
break;
*mem += chunk_array[i].size;
*end = max(*end, chunk_array[i].addr + chunk_array[i].size);
}
kfree(chunk_array);
return 0;
}

static int __init zcore_header_init(int arch, struct zcore_header *hdr)
static void __init zcore_header_init(int arch, struct zcore_header *hdr,
unsigned long mem_size)
{
int rc, i;
unsigned long memory = 0;
u32 prefix;
int i;

if (arch == ARCH_S390X)
hdr->arch_id = DUMP_ARCH_S390X;
else
hdr->arch_id = DUMP_ARCH_S390;
rc = get_mem_size(&memory);
if (rc)
return rc;
hdr->mem_size = memory;
hdr->rmem_size = memory;
hdr->mem_size = mem_size;
hdr->rmem_size = mem_size;
hdr->mem_end = sys_info.mem_size;
hdr->num_pages = memory / PAGE_SIZE;
hdr->num_pages = mem_size / PAGE_SIZE;
hdr->tod = get_tod_clock();
get_cpu_id(&hdr->cpu_id);
for (i = 0; zfcpdump_save_areas[i]; i++) {
Expand All @@ -647,7 +645,6 @@ static int __init zcore_header_init(int arch, struct zcore_header *hdr)
hdr->lc_vec[hdr->cpu_cnt] = prefix;
hdr->cpu_cnt++;
}
return 0;
}

/*
Expand Down Expand Up @@ -682,9 +679,11 @@ static int __init zcore_reipl_init(void)

static int __init zcore_init(void)
{
unsigned long mem_size, mem_end;
unsigned char arch;
int rc;

mem_size = mem_end = 0;
if (ipl_info.type != IPL_TYPE_FCP_DUMP)
return -ENODATA;
if (OLDMEM_BASE)
Expand Down Expand Up @@ -727,13 +726,14 @@ static int __init zcore_init(void)
}
#endif /* CONFIG_64BIT */

rc = sys_info_init(arch);
rc = get_mem_info(&mem_size, &mem_end);
if (rc)
goto fail;

rc = zcore_header_init(arch, &zcore_header);
rc = sys_info_init(arch, mem_end);
if (rc)
goto fail;
zcore_header_init(arch, &zcore_header, mem_size);

rc = zcore_reipl_init();
if (rc)
Expand Down

0 comments on commit 7b1e427

Please sign in to comment.