xref: /kvm-unit-tests/lib/s390x/smp.h (revision c604fa931a1cb70c3649ac1b7223178fc79eab6a)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * s390x smp
4  *
5  * Copyright (c) 2019 IBM Corp
6  *
7  * Authors:
8  *  Janosch Frank <frankja@linux.ibm.com>
9  */
10 #ifndef _S390X_SMP_H_
11 #define _S390X_SMP_H_
12 
13 #include <asm/arch_def.h>
14 
15 struct cpu {
16 	struct lowcore *lowcore;
17 	uint64_t *stack;
18 	uint16_t addr;
19 	bool active;
20 };
21 
22 struct cpu_status {
23     uint64_t    fprs[16];                       /* 0x0000 */
24     uint64_t    grs[16];                        /* 0x0080 */
25     struct psw  psw;                            /* 0x0100 */
26     uint8_t     pad_0x0110[0x0118 - 0x0110];    /* 0x0110 */
27     uint32_t    prefix;                         /* 0x0118 */
28     uint32_t    fpc;                            /* 0x011c */
29     uint8_t     pad_0x0120[0x0124 - 0x0120];    /* 0x0120 */
30     uint32_t    todpr;                          /* 0x0124 */
31     uint64_t    cputm;                          /* 0x0128 */
32     uint64_t    ckc;                            /* 0x0130 */
33     uint8_t     pad_0x0138[0x0140 - 0x0138];    /* 0x0138 */
34     uint32_t    ars[16];                        /* 0x0140 */
35     uint64_t    crs[16];                        /* 0x0384 */
36 };
37 
38 int smp_query_num_cpus(void);
39 struct cpu *smp_cpu_from_addr(uint16_t addr);
40 struct cpu *smp_cpu_from_idx(uint16_t idx);
41 uint16_t smp_cpu_addr(uint16_t idx);
42 bool smp_cpu_stopped(uint16_t idx);
43 bool smp_sense_running_status(uint16_t idx);
44 int smp_cpu_restart(uint16_t idx);
45 int smp_cpu_restart_nowait(uint16_t idx);
46 int smp_cpu_start(uint16_t idx, struct psw psw);
47 int smp_cpu_stop(uint16_t idx);
48 int smp_cpu_stop_nowait(uint16_t idx);
49 int smp_cpu_stop_store_status(uint16_t idx);
50 int smp_cpu_destroy(uint16_t idx);
51 int smp_cpu_setup(uint16_t idx, struct psw psw);
52 void smp_teardown(void);
53 void smp_setup(void);
54 int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status);
55 
56 #endif
57