aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorMichael Mueller <mimu@linux.vnet.ibm.com>2014-03-13 07:16:45 -0400
committerChristian Borntraeger <borntraeger@de.ibm.com>2014-04-22 07:24:54 -0400
commite325fe69aa37b485635521568651642791d6d140 (patch)
treeae3679e872a7786a8c4dff91c089d05df7262859 /arch/s390
parenta86dcc2482cf29ffcf6fbc174ce55e4f5f18cd8b (diff)
KVM: s390: Factor out handle_itdb to handle TX aborts
Factor out the new function handle_itdb(), which copies the ITDB into guest lowcore to fully handle a TX abort. Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kvm/intercept.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index f39160406efa..30e1c5eb726a 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -171,12 +171,33 @@ static void __extract_prog_irq(struct kvm_vcpu *vcpu,
171 } 171 }
172} 172}
173 173
174/*
175 * restore ITDB to program-interruption TDB in guest lowcore
176 * and set TX abort indication if required
177*/
178static int handle_itdb(struct kvm_vcpu *vcpu)
179{
180 struct kvm_s390_itdb *itdb;
181 int rc;
182
183 if (!IS_TE_ENABLED(vcpu) || !IS_ITDB_VALID(vcpu))
184 return 0;
185 if (current->thread.per_flags & PER_FLAG_NO_TE)
186 return 0;
187 itdb = (struct kvm_s390_itdb *)vcpu->arch.sie_block->itdba;
188 rc = write_guest_lc(vcpu, __LC_PGM_TDB, itdb, sizeof(*itdb));
189 if (rc)
190 return rc;
191 memset(itdb, 0, sizeof(*itdb));
192
193 return 0;
194}
195
174#define per_event(vcpu) (vcpu->arch.sie_block->iprcc & PGM_PER) 196#define per_event(vcpu) (vcpu->arch.sie_block->iprcc & PGM_PER)
175 197
176static int handle_prog(struct kvm_vcpu *vcpu) 198static int handle_prog(struct kvm_vcpu *vcpu)
177{ 199{
178 struct kvm_s390_pgm_info pgm_info; 200 struct kvm_s390_pgm_info pgm_info;
179 struct kvm_s390_itdb *itdb;
180 int rc; 201 int rc;
181 202
182 vcpu->stat.exit_program_interruption++; 203 vcpu->stat.exit_program_interruption++;
@@ -188,20 +209,13 @@ static int handle_prog(struct kvm_vcpu *vcpu)
188 return 0; 209 return 0;
189 } 210 }
190 211
191 /* Restore ITDB to Program-Interruption TDB in guest memory */ 212 trace_kvm_s390_intercept_prog(vcpu, vcpu->arch.sie_block->iprcc);
192 if (!IS_TE_ENABLED(vcpu) || !IS_ITDB_VALID(vcpu)) 213
193 goto skip_itdb; 214 rc = handle_itdb(vcpu);
194 if (current->thread.per_flags & PER_FLAG_NO_TE)
195 goto skip_itdb;
196 itdb = (struct kvm_s390_itdb *)vcpu->arch.sie_block->itdba;
197 rc = write_guest_lc(vcpu, __LC_PGM_TDB, itdb, sizeof(*itdb));
198 if (rc) 215 if (rc)
199 return rc; 216 return rc;
200 memset(itdb, 0, sizeof(*itdb));
201skip_itdb:
202 trace_kvm_s390_intercept_prog(vcpu, vcpu->arch.sie_block->iprcc);
203 __extract_prog_irq(vcpu, &pgm_info);
204 217
218 __extract_prog_irq(vcpu, &pgm_info);
205 return kvm_s390_inject_prog_irq(vcpu, &pgm_info); 219 return kvm_s390_inject_prog_irq(vcpu, &pgm_info);
206} 220}
207 221