smp.h 2.8 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 *  include/asm-s390/smp.h
 *
 *  S390 version
 *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
 *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
 *               Martin Schwidefsky (schwidefsky@de.ibm.com)
 *               Heiko Carstens (heiko.carstens@de.ibm.com)
 */
#ifndef __ASM_SMP_H
#define __ASM_SMP_H

#include <linux/threads.h>
#include <linux/cpumask.h>
#include <linux/bitops.h>

#if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)

#include <asm/lowcore.h>
#include <asm/sigp.h>
H
Heiko Carstens 已提交
21
#include <asm/ptrace.h>
22
#include <asm/system.h>
L
Linus Torvalds 已提交
23 24 25 26 27 28 29 30 31 32 33 34

/*
  s390 specific smp.c headers
 */
typedef struct
{
	int        intresting;
	sigp_ccode ccode; 
	__u32      status;
	__u16      cpu;
} sigp_info;

35 36 37 38
extern void machine_restart_smp(char *);
extern void machine_halt_smp(void);
extern void machine_power_off_smp(void);

L
Linus Torvalds 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52
#define NO_PROC_ID		0xFF		/* No processor magic marker */

/*
 *	This magic constant controls our willingness to transfer
 *	a process across CPUs. Such a transfer incurs misses on the L1
 *	cache, and on a P6 or P5 with multiple L2 caches L2 hits. My
 *	gut feeling is this will vary by board in value. For a board
 *	with separate L2 cache it probably depends also on the RSS, and
 *	for a board with shared L2 cache it ought to decay fast as other
 *	processes are run.
 */
 
#define PROC_CHANGE_PENALTY	20		/* Schedule penalty */

I
Ingo Molnar 已提交
53
#define raw_smp_processor_id()	(S390_lowcore.cpu_data.cpu_nr)
L
Linus Torvalds 已提交
54

55
static inline __u16 hard_smp_processor_id(void)
L
Linus Torvalds 已提交
56
{
57
	return stap();
L
Linus Torvalds 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
}

/*
 * returns 1 if cpu is in stopped/check stopped state or not operational
 * returns 0 otherwise
 */
static inline int
smp_cpu_not_running(int cpu)
{
	__u32 status;

	switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) {
	case sigp_order_code_accepted:
	case sigp_status_stored:
		/* Check for stopped and check stop state */
		if (status & 0x50)
			return 1;
		break;
	case sigp_not_operational:
		return 1;
	default:
		break;
	}
	return 0;
}

#define cpu_logical_map(cpu) (cpu)

extern int __cpu_disable (void);
extern void __cpu_die (unsigned int cpu);
extern void cpu_die (void) __attribute__ ((noreturn));
extern int __cpu_up (unsigned int cpu);

91
extern struct mutex smp_cpu_state_mutex;
H
Heiko Carstens 已提交
92
extern int smp_cpu_polarization[];
93

C
Carsten Otte 已提交
94 95
extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
	void *info, int wait);
L
Linus Torvalds 已提交
96 97 98
#endif

#ifndef CONFIG_SMP
H
Heiko Carstens 已提交
99 100 101
static inline void smp_send_stop(void)
{
	/* Disable all interrupts/machine checks */
G
Gerald Schaefer 已提交
102
	__load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
H
Heiko Carstens 已提交
103 104
}

105
#define hard_smp_processor_id()		0
106
#define smp_cpu_not_running(cpu)	1
L
Linus Torvalds 已提交
107 108
#endif

109 110 111 112 113 114
#ifdef CONFIG_HOTPLUG_CPU
extern int smp_rescan_cpus(void);
#else
static inline int smp_rescan_cpus(void) { return 0; }
#endif

M
Michael Holzheu 已提交
115
extern union save_area *zfcpdump_save_areas[NR_CPUS + 1];
L
Linus Torvalds 已提交
116
#endif