aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2011-07-24 04:48:18 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2011-07-24 04:48:21 -0400
commit603d1a50acf252621a3598618b018b8123aaba64 (patch)
treef0f8e2d91b34d2cdb9d80b2146a6fdfd48f1d429 /arch/s390/kvm
parentbb25b9ba3e33e941dc48048d0a784e6a05e5648a (diff)
[S390] move sie code to entry.S
The entry to / exit from sie has subtle dependencies to the first level interrupt handler. Move the sie assembler code to entry64.S and replace the SIE_HOOK callback with a test and the new _TIF_SIE bit. In addition this patch fixes several problems in regard to the check for the_TIF_EXIT_SIE bits. The old code checked the TIF bits before executing the interrupt handler and it only modified the instruction address if it pointed directly to the sie instruction. In both cases it could miss a TIF bit that normally would cause an exit from the guest and would reenter the guest context. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm')
-rw-r--r--arch/s390/kvm/Makefile2
-rw-r--r--arch/s390/kvm/sie64a.S98
2 files changed, 1 insertions, 99 deletions
diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile
index 860d26514c08..3975722bb19d 100644
--- a/arch/s390/kvm/Makefile
+++ b/arch/s390/kvm/Makefile
@@ -10,5 +10,5 @@ common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o)
10 10
11ccflags-y := -Ivirt/kvm -Iarch/s390/kvm 11ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
12 12
13kvm-objs := $(common-objs) kvm-s390.o sie64a.o intercept.o interrupt.o priv.o sigp.o diag.o 13kvm-objs := $(common-objs) kvm-s390.o intercept.o interrupt.o priv.o sigp.o diag.o
14obj-$(CONFIG_KVM) += kvm.o 14obj-$(CONFIG_KVM) += kvm.o
diff --git a/arch/s390/kvm/sie64a.S b/arch/s390/kvm/sie64a.S
deleted file mode 100644
index 5faa1b1b23fa..000000000000
--- a/arch/s390/kvm/sie64a.S
+++ /dev/null
@@ -1,98 +0,0 @@
1/*
2 * sie64a.S - low level sie call
3 *
4 * Copyright IBM Corp. 2008,2010
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.
9 *
10 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
11 * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
12 */
13
14#include <linux/errno.h>
15#include <asm/asm-offsets.h>
16#include <asm/setup.h>
17#include <asm/asm-offsets.h>
18#include <asm/ptrace.h>
19#include <asm/thread_info.h>
20
21_TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
22
23/*
24 * offsets into stackframe
25 * SP_ = offsets into stack sie64 is called with
26 * SPI_ = offsets into irq stack
27 */
28SP_GREGS = __SF_EMPTY
29SP_HOOK = __SF_EMPTY+8
30SP_GPP = __SF_EMPTY+16
31SPI_PSW = STACK_FRAME_OVERHEAD + __PT_PSW
32
33
34 .macro SPP newpp
35 tm __LC_MACHINE_FLAGS+6,0x20 # MACHINE_FLAG_SPP
36 jz 0f
37 .insn s,0xb2800000,\newpp
380:
39 .endm
40
41sie_irq_handler:
42 SPP __LC_CMF_HPP # set host id
43 larl %r2,sie_inst
44 clg %r2,SPI_PSW+8(0,%r15) # intercepted sie
45 jne 1f
46 xc __LC_SIE_HOOK(8),__LC_SIE_HOOK
47 lg %r2,__LC_THREAD_INFO # pointer thread_info struct
48 tm __TI_flags+7(%r2),_TIF_EXIT_SIE
49 jz 0f
50 larl %r2,sie_exit # work pending, leave sie
51 stg %r2,SPI_PSW+8(0,%r15)
52 br %r14
530: larl %r2,sie_reenter # re-enter with guest id
54 stg %r2,SPI_PSW+8(0,%r15)
551: br %r14
56
57/*
58 * sie64a calling convention:
59 * %r2 pointer to sie control block
60 * %r3 guest register save area
61 */
62 .globl sie64a
63sie64a:
64 stg %r3,SP_GREGS(%r15) # save guest register save area
65 stmg %r6,%r14,__SF_GPRS(%r15) # save registers on entry
66 lgr %r14,%r2 # pointer to sie control block
67 larl %r5,sie_irq_handler
68 stg %r2,SP_GPP(%r15)
69 stg %r5,SP_HOOK(%r15) # save hook target
70 lmg %r0,%r13,0(%r3) # load guest gprs 0-13
71sie_reenter:
72 mvc __LC_SIE_HOOK(8),SP_HOOK(%r15)
73 SPP SP_GPP(%r15) # set guest id
74sie_inst:
75 sie 0(%r14)
76 xc __LC_SIE_HOOK(8),__LC_SIE_HOOK
77 SPP __LC_CMF_HPP # set host id
78sie_exit:
79 lg %r14,SP_GREGS(%r15)
80 stmg %r0,%r13,0(%r14) # save guest gprs 0-13
81 lghi %r2,0
82 lmg %r6,%r14,__SF_GPRS(%r15)
83 br %r14
84
85sie_err:
86 xc __LC_SIE_HOOK(8),__LC_SIE_HOOK
87 SPP __LC_CMF_HPP # set host id
88 lg %r14,SP_GREGS(%r15)
89 stmg %r0,%r13,0(%r14) # save guest gprs 0-13
90 lghi %r2,-EFAULT
91 lmg %r6,%r14,__SF_GPRS(%r15)
92 br %r14
93
94 .section __ex_table,"a"
95 .quad sie_inst,sie_err
96 .quad sie_exit,sie_err
97 .quad sie_reenter,sie_err
98 .previous