Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6:
  [S390] boot cputime accounting
  [S390] add read_persistent_clock
  [S390] cpu hotplug and accounting values
  [S390] fix idle time accounting
  [S390] smp: fix cpu_possible_map initialization
  [S390] dasd: fix idaw boundary checking for track based ccw
  [S390] dasd: Use the new async framework for autoonlining.
  [S390] qdio: remove dead timeout handler
  [S390] appldata: Use new mod_virt_timer_periodic() function.
  [S390] extend virtual timer interface by mod_virt_timer_periodic
  [S390] stp synchronization retry timer
  [S390] call nmi_enter/nmi_exit on machine checks
  [S390] wire up preadv/pwritev system calls
  [S390] s390: move machine flags to lowcore
  • Loading branch information
Linus Torvalds committed Apr 15, 2009
2 parents 3ee8da8 + ab96e79 commit 31712ee
Show file tree
Hide file tree
Showing 26 changed files with 280 additions and 159 deletions.
2 changes: 1 addition & 1 deletion arch/s390/appldata/appldata_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static void __appldata_mod_vtimer_wrap(void *p) {
struct vtimer_list *timer;
u64 expires;
} *args = p;
mod_virt_timer(args->timer, args->expires);
mod_virt_timer_periodic(args->timer, args->expires);
}

#define APPLDATA_ADD_TIMER 0
Expand Down
25 changes: 25 additions & 0 deletions arch/s390/include/asm/cpuid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright IBM Corp. 2000,2009
* Author(s): Hartmut Penner <hp@de.ibm.com>,
* Martin Schwidefsky <schwidefsky@de.ibm.com>
* Christian Ehrhardt <ehrhardt@de.ibm.com>
*/

#ifndef _ASM_S390_CPUID_H_
#define _ASM_S390_CPUID_H_

/*
* CPU type and hardware bug flags. Kept separately for each CPU.
* Members of this structure are referenced in head.S, so think twice
* before touching them. [mj]
*/

typedef struct
{
unsigned int version : 8;
unsigned int ident : 24;
unsigned int machine : 16;
unsigned int unused : 16;
} __attribute__ ((packed)) cpuid_t;

#endif /* _ASM_S390_CPUID_H_ */
1 change: 1 addition & 0 deletions arch/s390/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define ASM_KVM_HOST_H
#include <linux/kvm_host.h>
#include <asm/debug.h>
#include <asm/cpuid.h>

#define KVM_MAX_VCPUS 64
#define KVM_MEMORY_SLOTS 32
Expand Down
12 changes: 8 additions & 4 deletions arch/s390/include/asm/lowcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#define __LC_USER_EXEC_ASCE 0x02ac
#define __LC_CPUID 0x02b0
#define __LC_INT_CLOCK 0x02c8
#define __LC_MACHINE_FLAGS 0x02d8
#define __LC_IRB 0x0300
#define __LC_PFAULT_INTPARM 0x0080
#define __LC_CPU_TIMER_SAVE_AREA 0x00d8
Expand Down Expand Up @@ -110,6 +111,7 @@
#define __LC_CPUID 0x0320
#define __LC_INT_CLOCK 0x0340
#define __LC_VDSO_PER_CPU 0x0350
#define __LC_MACHINE_FLAGS 0x0358
#define __LC_IRB 0x0380
#define __LC_PASTE 0x03c0
#define __LC_PFAULT_INTPARM 0x11b8
Expand All @@ -127,9 +129,9 @@

#ifndef __ASSEMBLY__

#include <asm/processor.h>
#include <asm/cpuid.h>
#include <asm/ptrace.h>
#include <linux/types.h>
#include <asm/sigp.h>

void restart_int_handler(void);
void ext_int_handler(void);
Expand Down Expand Up @@ -277,7 +279,8 @@ struct _lowcore
__u32 ext_call_fast; /* 0x02c4 */
__u64 int_clock; /* 0x02c8 */
__u64 clock_comparator; /* 0x02d0 */
__u8 pad_0x02d8[0x0300-0x02d8]; /* 0x02d8 */
__u32 machine_flags; /* 0x02d8 */
__u8 pad_0x02dc[0x0300-0x02dc]; /* 0x02dc */

/* Interrupt response block */
__u8 irb[64]; /* 0x0300 */
Expand Down Expand Up @@ -381,7 +384,8 @@ struct _lowcore
__u64 int_clock; /* 0x0340 */
__u64 clock_comparator; /* 0x0348 */
__u64 vdso_per_cpu_data; /* 0x0350 */
__u8 pad_0x0358[0x0380-0x0358]; /* 0x0358 */
__u64 machine_flags; /* 0x0358 */
__u8 pad_0x0360[0x0380-0x0360]; /* 0x0360 */

/* Interrupt response block. */
__u8 irb[64]; /* 0x0380 */
Expand Down
17 changes: 3 additions & 14 deletions arch/s390/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
#define __ASM_S390_PROCESSOR_H

#include <linux/linkage.h>
#include <asm/cpuid.h>
#include <asm/page.h>
#include <asm/ptrace.h>
#include <asm/setup.h>

#ifdef __KERNEL__
/*
Expand All @@ -23,20 +26,6 @@
*/
#define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; })

/*
* CPU type and hardware bug flags. Kept separately for each CPU.
* Members of this structure are referenced in head.S, so think twice
* before touching them. [mj]
*/

typedef struct
{
unsigned int version : 8;
unsigned int ident : 24;
unsigned int machine : 16;
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));
Expand Down
2 changes: 0 additions & 2 deletions arch/s390/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ typedef struct


#ifdef __KERNEL__
#include <asm/setup.h>
#include <asm/page.h>

/*
* The pt_regs struct defines the way the registers are stored on
Expand Down
24 changes: 12 additions & 12 deletions arch/s390/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#ifdef __KERNEL__

#include <asm/lowcore.h>
#include <asm/types.h>

#define PARMAREA 0x10400
Expand Down Expand Up @@ -63,7 +64,6 @@ extern unsigned int s390_noexec;
/*
* Machine features detected in head.S
*/
extern unsigned long machine_flags;

#define MACHINE_FLAG_VM (1UL << 0)
#define MACHINE_FLAG_IEEE (1UL << 1)
Expand All @@ -77,28 +77,28 @@ extern unsigned long machine_flags;
#define MACHINE_FLAG_HPAGE (1UL << 10)
#define MACHINE_FLAG_PFMF (1UL << 11)

#define MACHINE_IS_VM (machine_flags & MACHINE_FLAG_VM)
#define MACHINE_IS_KVM (machine_flags & MACHINE_FLAG_KVM)
#define MACHINE_HAS_DIAG9C (machine_flags & MACHINE_FLAG_DIAG9C)
#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)

#ifndef __s390x__
#define MACHINE_HAS_IEEE (machine_flags & MACHINE_FLAG_IEEE)
#define MACHINE_HAS_CSP (machine_flags & MACHINE_FLAG_CSP)
#define MACHINE_HAS_IEEE (S390_lowcore.machine_flags & MACHINE_FLAG_IEEE)
#define MACHINE_HAS_CSP (S390_lowcore.machine_flags & MACHINE_FLAG_CSP)
#define MACHINE_HAS_IDTE (0)
#define MACHINE_HAS_DIAG44 (1)
#define MACHINE_HAS_MVPG (machine_flags & MACHINE_FLAG_MVPG)
#define MACHINE_HAS_MVPG (S390_lowcore.machine_flags & MACHINE_FLAG_MVPG)
#define MACHINE_HAS_MVCOS (0)
#define MACHINE_HAS_HPAGE (0)
#define MACHINE_HAS_PFMF (0)
#else /* __s390x__ */
#define MACHINE_HAS_IEEE (1)
#define MACHINE_HAS_CSP (1)
#define MACHINE_HAS_IDTE (machine_flags & MACHINE_FLAG_IDTE)
#define MACHINE_HAS_DIAG44 (machine_flags & MACHINE_FLAG_DIAG44)
#define MACHINE_HAS_IDTE (S390_lowcore.machine_flags & MACHINE_FLAG_IDTE)
#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44)
#define MACHINE_HAS_MVPG (1)
#define MACHINE_HAS_MVCOS (machine_flags & MACHINE_FLAG_MVCOS)
#define MACHINE_HAS_HPAGE (machine_flags & MACHINE_FLAG_HPAGE)
#define MACHINE_HAS_PFMF (machine_flags & MACHINE_FLAG_PFMF)
#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS)
#define MACHINE_HAS_HPAGE (S390_lowcore.machine_flags & MACHINE_FLAG_HPAGE)
#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF)
#endif /* __s390x__ */

#define ZFCPDUMP_HSA_SIZE (32UL<<20)
Expand Down
3 changes: 2 additions & 1 deletion arch/s390/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
#define ASYNC_SIZE (PAGE_SIZE << ASYNC_ORDER)

#ifndef __ASSEMBLY__
#include <asm/processor.h>
#include <asm/lowcore.h>
#include <asm/page.h>
#include <asm/processor.h>

/*
* low level task data that entry.S needs immediate access to
Expand Down
1 change: 1 addition & 0 deletions arch/s390/include/asm/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ extern void init_virt_timer(struct vtimer_list *timer);
extern void add_virt_timer(void *new);
extern void add_virt_timer_periodic(void *new);
extern int mod_virt_timer(struct vtimer_list *timer, __u64 expires);
extern int mod_virt_timer_periodic(struct vtimer_list *timer, __u64 expires);
extern int del_virt_timer(struct vtimer_list *timer);

extern void init_cpu_vtimer(void);
Expand Down
5 changes: 5 additions & 0 deletions arch/s390/include/asm/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#ifndef _ASM_S390_TIMEX_H
#define _ASM_S390_TIMEX_H

/* The value of the TOD clock for 1.1.1970. */
#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL

/* Inline functions for clock register access. */
static inline int set_clock(__u64 time)
{
Expand Down Expand Up @@ -85,4 +88,6 @@ int get_sync_clock(unsigned long long *clock);
void init_cpu_timer(void);
unsigned long long monotonic_clock(void);

extern u64 sched_clock_base_cc;

#endif
4 changes: 3 additions & 1 deletion arch/s390/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@
#define __NR_pipe2 325
#define __NR_dup3 326
#define __NR_epoll_create1 327
#define NR_syscalls 328
#define __NR_preadv 328
#define __NR_pwritev 329
#define NR_syscalls 330

/*
* There are some system calls that are not present on 64 bit, some
Expand Down
2 changes: 2 additions & 0 deletions arch/s390/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ int main(void)
DEFINE(__TI_flags, offsetof(struct thread_info, flags));
DEFINE(__TI_cpu, offsetof(struct thread_info, cpu));
DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count));
DEFINE(__TI_user_timer, offsetof(struct thread_info, user_timer));
DEFINE(__TI_system_timer, offsetof(struct thread_info, system_timer));
BLANK();
DEFINE(__PT_ARGS, offsetof(struct pt_regs, args));
DEFINE(__PT_PSW, offsetof(struct pt_regs, psw));
Expand Down
18 changes: 18 additions & 0 deletions arch/s390/kernel/compat_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -1805,3 +1805,21 @@ compat_sys_keyctl_wrapper:
llgfr %r5,%r5 # u32
llgfr %r6,%r6 # u32
jg compat_sys_keyctl # branch to system call

.globl compat_sys_preadv_wrapper
compat_sys_preadv_wrapper:
llgfr %r2,%r2 # unsigned long
llgtr %r3,%r3 # compat_iovec *
llgfr %r4,%r4 # unsigned long
llgfr %r5,%r5 # u32
llgfr %r6,%r6 # u32
jg compat_sys_preadv # branch to system call

.globl compat_sys_pwritev_wrapper
compat_sys_pwritev_wrapper:
llgfr %r2,%r2 # unsigned long
llgtr %r3,%r3 # compat_iovec *
llgfr %r4,%r4 # unsigned long
llgfr %r5,%r5 # u32
llgfr %r6,%r6 # u32
jg compat_sys_pwritev # branch to system call
19 changes: 19 additions & 0 deletions arch/s390/kernel/early.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,25 @@

char kernel_nss_name[NSS_NAME_SIZE + 1];

static unsigned long machine_flags;

static void __init setup_boot_command_line(void);

/*
* Get the TOD clock running.
*/
static void __init reset_tod_clock(void)
{
u64 time;

if (store_clock(&time) == 0)
return;
/* TOD clock not running. Set the clock to Unix Epoch. */
if (set_clock(TOD_UNIX_EPOCH) != 0 || store_clock(&time) != 0)
disabled_wait(0);

sched_clock_base_cc = TOD_UNIX_EPOCH;
}

#ifdef CONFIG_SHARED_KERNEL
int __init savesys_ipl_nss(char *cmd, const int cmdlen);
Expand Down Expand Up @@ -370,6 +387,7 @@ static void __init setup_boot_command_line(void)
*/
void __init startup_init(void)
{
reset_tod_clock();
ipl_save_parameters();
rescue_initrd();
clear_bss_section();
Expand All @@ -391,5 +409,6 @@ void __init startup_init(void)
setup_hpage();
sclp_facilities_detect();
detect_memory_layout(memory_chunk);
S390_lowcore.machine_flags = machine_flags;
lockdep_on();
}
13 changes: 13 additions & 0 deletions arch/s390/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -837,16 +837,29 @@ mcck_return:
__CPUINIT
.globl restart_int_handler
restart_int_handler:
basr %r1,0
restart_base:
spt restart_vtime-restart_base(%r1)
stck __LC_LAST_UPDATE_CLOCK
mvc __LC_LAST_UPDATE_TIMER(8),restart_vtime-restart_base(%r1)
mvc __LC_EXIT_TIMER(8),restart_vtime-restart_base(%r1)
l %r15,__LC_SAVE_AREA+60 # load ksp
lctl %c0,%c15,__LC_CREGS_SAVE_AREA # get new ctl regs
lam %a0,%a15,__LC_AREGS_SAVE_AREA
lm %r6,%r15,__SF_GPRS(%r15) # load registers from clone
l %r1,__LC_THREAD_INFO
mvc __LC_USER_TIMER(8),__TI_user_timer(%r1)
mvc __LC_SYSTEM_TIMER(8),__TI_system_timer(%r1)
xc __LC_STEAL_TIMER(8),__LC_STEAL_TIMER
stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on
basr %r14,0
l %r14,restart_addr-.(%r14)
br %r14 # branch to start_secondary
restart_addr:
.long start_secondary
.align 8
restart_vtime:
.long 0x7fffffff,0xffffffff
.previous
#else
/*
Expand Down
13 changes: 13 additions & 0 deletions arch/s390/kernel/entry64.S
Original file line number Diff line number Diff line change
Expand Up @@ -831,14 +831,27 @@ mcck_return:
__CPUINIT
.globl restart_int_handler
restart_int_handler:
basr %r1,0
restart_base:
spt restart_vtime-restart_base(%r1)
stck __LC_LAST_UPDATE_CLOCK
mvc __LC_LAST_UPDATE_TIMER(8),restart_vtime-restart_base(%r1)
mvc __LC_EXIT_TIMER(8),restart_vtime-restart_base(%r1)
lg %r15,__LC_SAVE_AREA+120 # load ksp
lghi %r10,__LC_CREGS_SAVE_AREA
lctlg %c0,%c15,0(%r10) # get new ctl regs
lghi %r10,__LC_AREGS_SAVE_AREA
lam %a0,%a15,0(%r10)
lmg %r6,%r15,__SF_GPRS(%r15) # load registers from clone
lg %r1,__LC_THREAD_INFO
mvc __LC_USER_TIMER(8),__TI_user_timer(%r1)
mvc __LC_SYSTEM_TIMER(8),__TI_system_timer(%r1)
xc __LC_STEAL_TIMER(8),__LC_STEAL_TIMER
stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on
jg start_secondary
.align 8
restart_vtime:
.long 0x7fffffff,0xffffffff
.previous
#else
/*
Expand Down
15 changes: 12 additions & 3 deletions arch/s390/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,12 @@ startup:basr %r13,0 # get base
.LPG0:
xc 0x200(256),0x200 # partially clear lowcore
xc 0x300(256),0x300

l %r1,5f-.LPG0(%r13)
stck 0(%r1)
spt 6f-.LPG0(%r13)
mvc __LC_LAST_UPDATE_CLOCK(8),0(%r1)
mvc __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
mvc __LC_EXIT_TIMER(8),5f-.LPG0(%r13)
#ifndef CONFIG_MARCH_G5
# check processor version against MARCH_{G5,Z900,Z990,Z9_109,Z10}
stidp __LC_CPUID # store cpuid
Expand All @@ -496,9 +501,13 @@ startup:basr %r13,0 # get base
brct %r0,0b
#endif

l %r13,0f-.LPG0(%r13)
l %r13,4f-.LPG0(%r13)
b 0(%r13)
0: .long startup_continue
.align 4
4: .long startup_continue
5: .long sched_clock_base_cc
.align 8
6: .long 0x7fffffff,0xffffffff

#
# params at 10400 (setup.h)
Expand Down
Loading

0 comments on commit 31712ee

Please sign in to comment.