Skip to content

Commit

Permalink
[S390] New get_cpu_id() inline assembly
Browse files Browse the repository at this point in the history
Replace two stidp inline assemblies with one global implementation.

Signed-off-by: Michael Holzheu <holzheu@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Michael Holzheu authored and Martin Schwidefsky committed Feb 21, 2007
1 parent 6c732de commit 72960a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/s390/kernel/early.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static noinline __init void detect_machine_type(void)
{
struct cpuinfo_S390 *cpuinfo = &S390_lowcore.cpu_data;

asm volatile("stidp %0" : "=m" (S390_lowcore.cpu_data.cpu_id));
get_cpu_id(&S390_lowcore.cpu_data.cpu_id);

/* Running under z/VM ? */
if (cpuinfo->cpu_id.version == 0xff)
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void __devinit cpu_init (void)
/*
* Store processor id in lowcore (used e.g. in timer_interrupt)
*/
asm volatile("stidp %0": "=m" (S390_lowcore.cpu_data.cpu_id));
get_cpu_id(&S390_lowcore.cpu_data.cpu_id);
S390_lowcore.cpu_data.cpu_addr = addr;

/*
Expand Down
5 changes: 5 additions & 0 deletions include/asm-s390/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ typedef struct
unsigned int unused : 16;
} __attribute__ ((packed)) cpuid_t;

static inline void get_cpu_id(cpuid_t *ptr)
{
asm volatile("stidp 0(%1)" : "=m" (*ptr) : "a" (ptr));
}

struct cpuinfo_S390
{
cpuid_t cpu_id;
Expand Down

0 comments on commit 72960a0

Please sign in to comment.