xref: /kvm-unit-tests/lib/s390x/smp.h (revision 6163f75d09a0a96a5c3db82dd768b13f79629c00)
1 /*
2  * s390x smp
3  *
4  * Copyright (c) 2019 IBM Corp
5  *
6  * Authors:
7  *  Janosch Frank <frankja@linux.ibm.com>
8  *
9  * This code is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License version 2.
11  */
12 #ifndef SMP_H
13 #define SMP_H
14 
15 #include <asm/arch_def.h>
16 
17 struct cpu {
18 	struct lowcore *lowcore;
19 	uint64_t *stack;
20 	uint16_t addr;
21 	bool active;
22 };
23 
24 struct cpu_status {
25     uint64_t    fprs[16];                       /* 0x0000 */
26     uint64_t    grs[16];                        /* 0x0080 */
27     struct psw  psw;                            /* 0x0100 */
28     uint8_t     pad_0x0110[0x0118 - 0x0110];    /* 0x0110 */
29     uint32_t    prefix;                         /* 0x0118 */
30     uint32_t    fpc;                            /* 0x011c */
31     uint8_t     pad_0x0120[0x0124 - 0x0120];    /* 0x0120 */
32     uint32_t    todpr;                          /* 0x0124 */
33     uint64_t    cputm;                          /* 0x0128 */
34     uint64_t    ckc;                            /* 0x0130 */
35     uint8_t     pad_0x0138[0x0140 - 0x0138];    /* 0x0138 */
36     uint32_t    ars[16];                        /* 0x0140 */
37     uint64_t    crs[16];                        /* 0x0384 */
38 };
39 
40 int smp_query_num_cpus(void);
41 struct cpu *smp_cpu_from_addr(uint16_t addr);
42 bool smp_cpu_stopped(uint16_t addr);
43 bool smp_cpu_running(uint16_t addr);
44 int smp_cpu_restart(uint16_t addr);
45 int smp_cpu_start(uint16_t addr, struct psw psw);
46 int smp_cpu_stop(uint16_t addr);
47 int smp_cpu_stop_store_status(uint16_t addr);
48 int smp_cpu_destroy(uint16_t addr);
49 int smp_cpu_setup(uint16_t addr, struct psw psw);
50 void smp_teardown(void);
51 void smp_setup(void);
52 
53 #endif
54