1 // SPDX-License-Identifier: GPL-2.0
3 * handling privileged instructions
5 * Copyright IBM Corp. 2008, 2018
7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com>
11 #include <linux/kvm.h>
12 #include <linux/gfp.h>
13 #include <linux/errno.h>
14 #include <linux/compat.h>
15 #include <linux/mm_types.h>
17 #include <asm/asm-offsets.h>
18 #include <asm/facility.h>
19 #include <asm/current.h>
20 #include <asm/debug.h>
21 #include <asm/ebcdic.h>
22 #include <asm/sysinfo.h>
23 #include <asm/pgtable.h>
24 #include <asm/page-states.h>
25 #include <asm/pgalloc.h>
28 #include <asm/ptrace.h>
34 static int handle_ri(struct kvm_vcpu *vcpu)
36 vcpu->stat.instruction_ri++;
38 if (test_kvm_facility(vcpu->kvm, 64)) {
39 VCPU_EVENT(vcpu, 3, "%s", "ENABLE: RI (lazy)");
40 vcpu->arch.sie_block->ecb3 |= ECB3_RI;
41 kvm_s390_retry_instr(vcpu);
44 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
47 int kvm_s390_handle_aa(struct kvm_vcpu *vcpu)
49 if ((vcpu->arch.sie_block->ipa & 0xf) <= 4)
50 return handle_ri(vcpu);
55 static int handle_gs(struct kvm_vcpu *vcpu)
57 vcpu->stat.instruction_gs++;
59 if (test_kvm_facility(vcpu->kvm, 133)) {
60 VCPU_EVENT(vcpu, 3, "%s", "ENABLE: GS (lazy)");
63 current->thread.gs_cb = (struct gs_cb *)&vcpu->run->s.regs.gscb;
64 restore_gs_cb(current->thread.gs_cb);
66 vcpu->arch.sie_block->ecb |= ECB_GS;
67 vcpu->arch.sie_block->ecd |= ECD_HOSTREGMGMT;
68 vcpu->arch.gs_enabled = 1;
69 kvm_s390_retry_instr(vcpu);
72 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
75 int kvm_s390_handle_e3(struct kvm_vcpu *vcpu)
77 int code = vcpu->arch.sie_block->ipb & 0xff;
79 if (code == 0x49 || code == 0x4d)
80 return handle_gs(vcpu);
84 /* Handle SCK (SET CLOCK) interception */
85 static int handle_set_clock(struct kvm_vcpu *vcpu)
87 struct kvm_s390_vm_tod_clock gtod = { 0 };
92 vcpu->stat.instruction_sck++;
94 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
95 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
97 op2 = kvm_s390_get_base_disp_s(vcpu, &ar);
98 if (op2 & 7) /* Operand must be on a doubleword boundary */
99 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
100 rc = read_guest(vcpu, op2, ar, >od.tod, sizeof(gtod.tod));
102 return kvm_s390_inject_prog_cond(vcpu, rc);
104 VCPU_EVENT(vcpu, 3, "SCK: setting guest TOD to 0x%llx", gtod.tod);
105 kvm_s390_set_tod_clock(vcpu->kvm, >od);
107 kvm_s390_set_psw_cc(vcpu, 0);
111 static int handle_set_prefix(struct kvm_vcpu *vcpu)
118 vcpu->stat.instruction_spx++;
120 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
121 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
123 operand2 = kvm_s390_get_base_disp_s(vcpu, &ar);
125 /* must be word boundary */
127 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
130 rc = read_guest(vcpu, operand2, ar, &address, sizeof(address));
132 return kvm_s390_inject_prog_cond(vcpu, rc);
134 address &= 0x7fffe000u;
137 * Make sure the new value is valid memory. We only need to check the
138 * first page, since address is 8k aligned and memory pieces are always
139 * at least 1MB aligned and have at least a size of 1MB.
141 if (kvm_is_error_gpa(vcpu->kvm, address))
142 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
144 kvm_s390_set_prefix(vcpu, address);
145 trace_kvm_s390_handle_prefix(vcpu, 1, address);
149 static int handle_store_prefix(struct kvm_vcpu *vcpu)
156 vcpu->stat.instruction_stpx++;
158 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
159 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
161 operand2 = kvm_s390_get_base_disp_s(vcpu, &ar);
163 /* must be word boundary */
165 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
167 address = kvm_s390_get_prefix(vcpu);
170 rc = write_guest(vcpu, operand2, ar, &address, sizeof(address));
172 return kvm_s390_inject_prog_cond(vcpu, rc);
174 VCPU_EVENT(vcpu, 3, "STPX: storing prefix 0x%x into 0x%llx", address, operand2);
175 trace_kvm_s390_handle_prefix(vcpu, 0, address);
179 static int handle_store_cpu_address(struct kvm_vcpu *vcpu)
181 u16 vcpu_id = vcpu->vcpu_id;
186 vcpu->stat.instruction_stap++;
188 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
189 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
191 ga = kvm_s390_get_base_disp_s(vcpu, &ar);
194 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
196 rc = write_guest(vcpu, ga, ar, &vcpu_id, sizeof(vcpu_id));
198 return kvm_s390_inject_prog_cond(vcpu, rc);
200 VCPU_EVENT(vcpu, 3, "STAP: storing cpu address (%u) to 0x%llx", vcpu_id, ga);
201 trace_kvm_s390_handle_stap(vcpu, ga);
205 int kvm_s390_skey_check_enable(struct kvm_vcpu *vcpu)
209 trace_kvm_s390_skey_related_inst(vcpu);
210 /* Already enabled? */
211 if (vcpu->arch.skey_enabled)
214 rc = s390_enable_skey();
215 VCPU_EVENT(vcpu, 3, "enabling storage keys for guest: %d", rc);
219 if (kvm_s390_test_cpuflags(vcpu, CPUSTAT_KSS))
220 kvm_s390_clear_cpuflags(vcpu, CPUSTAT_KSS);
221 if (!vcpu->kvm->arch.use_skf)
222 vcpu->arch.sie_block->ictl |= ICTL_ISKE | ICTL_SSKE | ICTL_RRBE;
224 vcpu->arch.sie_block->ictl &= ~(ICTL_ISKE | ICTL_SSKE | ICTL_RRBE);
225 vcpu->arch.skey_enabled = true;
229 static int try_handle_skey(struct kvm_vcpu *vcpu)
233 rc = kvm_s390_skey_check_enable(vcpu);
236 if (vcpu->kvm->arch.use_skf) {
237 /* with storage-key facility, SIE interprets it for us */
238 kvm_s390_retry_instr(vcpu);
239 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation");
245 static int handle_iske(struct kvm_vcpu *vcpu)
247 unsigned long gaddr, vmaddr;
253 vcpu->stat.instruction_iske++;
255 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
256 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
258 rc = try_handle_skey(vcpu);
260 return rc != -EAGAIN ? rc : 0;
262 kvm_s390_get_regs_rre(vcpu, ®1, ®2);
264 gaddr = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK;
265 gaddr = kvm_s390_logical_to_effective(vcpu, gaddr);
266 gaddr = kvm_s390_real_to_abs(vcpu, gaddr);
267 vmaddr = gfn_to_hva(vcpu->kvm, gpa_to_gfn(gaddr));
268 if (kvm_is_error_hva(vmaddr))
269 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
272 down_read(¤t->mm->mmap_sem);
273 rc = get_guest_storage_key(current->mm, vmaddr, &key);
276 rc = fixup_user_fault(current, current->mm, vmaddr,
277 FAULT_FLAG_WRITE, &unlocked);
279 up_read(¤t->mm->mmap_sem);
284 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
285 up_read(¤t->mm->mmap_sem);
286 vcpu->run->s.regs.gprs[reg1] &= ~0xff;
287 vcpu->run->s.regs.gprs[reg1] |= key;
291 static int handle_rrbe(struct kvm_vcpu *vcpu)
293 unsigned long vmaddr, gaddr;
298 vcpu->stat.instruction_rrbe++;
300 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
301 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
303 rc = try_handle_skey(vcpu);
305 return rc != -EAGAIN ? rc : 0;
307 kvm_s390_get_regs_rre(vcpu, ®1, ®2);
309 gaddr = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK;
310 gaddr = kvm_s390_logical_to_effective(vcpu, gaddr);
311 gaddr = kvm_s390_real_to_abs(vcpu, gaddr);
312 vmaddr = gfn_to_hva(vcpu->kvm, gpa_to_gfn(gaddr));
313 if (kvm_is_error_hva(vmaddr))
314 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
317 down_read(¤t->mm->mmap_sem);
318 rc = reset_guest_reference_bit(current->mm, vmaddr);
320 rc = fixup_user_fault(current, current->mm, vmaddr,
321 FAULT_FLAG_WRITE, &unlocked);
323 up_read(¤t->mm->mmap_sem);
328 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
329 up_read(¤t->mm->mmap_sem);
330 kvm_s390_set_psw_cc(vcpu, rc);
338 static int handle_sske(struct kvm_vcpu *vcpu)
340 unsigned char m3 = vcpu->arch.sie_block->ipb >> 28;
341 unsigned long start, end;
342 unsigned char key, oldkey;
347 vcpu->stat.instruction_sske++;
349 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
350 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
352 rc = try_handle_skey(vcpu);
354 return rc != -EAGAIN ? rc : 0;
356 if (!test_kvm_facility(vcpu->kvm, 8))
358 if (!test_kvm_facility(vcpu->kvm, 10))
359 m3 &= ~(SSKE_MC | SSKE_MR);
360 if (!test_kvm_facility(vcpu->kvm, 14))
363 kvm_s390_get_regs_rre(vcpu, ®1, ®2);
365 key = vcpu->run->s.regs.gprs[reg1] & 0xfe;
366 start = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK;
367 start = kvm_s390_logical_to_effective(vcpu, start);
369 /* start already designates an absolute address */
370 end = (start + _SEGMENT_SIZE) & ~(_SEGMENT_SIZE - 1);
372 start = kvm_s390_real_to_abs(vcpu, start);
373 end = start + PAGE_SIZE;
376 while (start != end) {
377 unsigned long vmaddr = gfn_to_hva(vcpu->kvm, gpa_to_gfn(start));
380 if (kvm_is_error_hva(vmaddr))
381 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
383 down_read(¤t->mm->mmap_sem);
384 rc = cond_set_guest_storage_key(current->mm, vmaddr, key, &oldkey,
385 m3 & SSKE_NQ, m3 & SSKE_MR,
389 rc = fixup_user_fault(current, current->mm, vmaddr,
390 FAULT_FLAG_WRITE, &unlocked);
391 rc = !rc ? -EAGAIN : rc;
394 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
396 up_read(¤t->mm->mmap_sem);
401 if (m3 & (SSKE_MC | SSKE_MR)) {
403 /* skey in reg1 is unpredictable */
404 kvm_s390_set_psw_cc(vcpu, 3);
406 kvm_s390_set_psw_cc(vcpu, rc);
407 vcpu->run->s.regs.gprs[reg1] &= ~0xff00UL;
408 vcpu->run->s.regs.gprs[reg1] |= (u64) oldkey << 8;
412 if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT)
413 vcpu->run->s.regs.gprs[reg2] &= ~PAGE_MASK;
415 vcpu->run->s.regs.gprs[reg2] &= ~0xfffff000UL;
416 end = kvm_s390_logical_to_effective(vcpu, end);
417 vcpu->run->s.regs.gprs[reg2] |= end;
422 static int handle_ipte_interlock(struct kvm_vcpu *vcpu)
424 vcpu->stat.instruction_ipte_interlock++;
425 if (psw_bits(vcpu->arch.sie_block->gpsw).pstate)
426 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
427 wait_event(vcpu->kvm->arch.ipte_wq, !ipte_lock_held(vcpu));
428 kvm_s390_retry_instr(vcpu);
429 VCPU_EVENT(vcpu, 4, "%s", "retrying ipte interlock operation");
433 static int handle_test_block(struct kvm_vcpu *vcpu)
438 vcpu->stat.instruction_tb++;
440 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
441 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
443 kvm_s390_get_regs_rre(vcpu, NULL, ®2);
444 addr = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK;
445 addr = kvm_s390_logical_to_effective(vcpu, addr);
446 if (kvm_s390_check_low_addr_prot_real(vcpu, addr))
447 return kvm_s390_inject_prog_irq(vcpu, &vcpu->arch.pgm);
448 addr = kvm_s390_real_to_abs(vcpu, addr);
450 if (kvm_is_error_gpa(vcpu->kvm, addr))
451 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
453 * We don't expect errors on modern systems, and do not care
454 * about storage keys (yet), so let's just clear the page.
456 if (kvm_clear_guest(vcpu->kvm, addr, PAGE_SIZE))
458 kvm_s390_set_psw_cc(vcpu, 0);
459 vcpu->run->s.regs.gprs[0] = 0;
463 static int handle_tpi(struct kvm_vcpu *vcpu)
465 struct kvm_s390_interrupt_info *inti;
472 vcpu->stat.instruction_tpi++;
474 addr = kvm_s390_get_base_disp_s(vcpu, &ar);
476 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
478 inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->arch.sie_block->gcr[6], 0);
480 kvm_s390_set_psw_cc(vcpu, 0);
484 tpi_data[0] = inti->io.subchannel_id << 16 | inti->io.subchannel_nr;
485 tpi_data[1] = inti->io.io_int_parm;
486 tpi_data[2] = inti->io.io_int_word;
489 * Store the two-word I/O interruption code into the
492 len = sizeof(tpi_data) - 4;
493 rc = write_guest(vcpu, addr, ar, &tpi_data, len);
495 rc = kvm_s390_inject_prog_cond(vcpu, rc);
496 goto reinject_interrupt;
500 * Store the three-word I/O interruption code into
501 * the appropriate lowcore area.
503 len = sizeof(tpi_data);
504 if (write_guest_lc(vcpu, __LC_SUBCHANNEL_ID, &tpi_data, len)) {
505 /* failed writes to the low core are not recoverable */
507 goto reinject_interrupt;
511 /* irq was successfully handed to the guest */
513 kvm_s390_set_psw_cc(vcpu, 1);
517 * If we encounter a problem storing the interruption code, the
518 * instruction is suppressed from the guest's view: reinject the
521 if (kvm_s390_reinject_io_int(vcpu->kvm, inti)) {
525 /* don't set the cc, a pgm irq was injected or we drop to user space */
526 return rc ? -EFAULT : 0;
529 static int handle_tsch(struct kvm_vcpu *vcpu)
531 struct kvm_s390_interrupt_info *inti = NULL;
532 const u64 isc_mask = 0xffUL << 24; /* all iscs set */
534 vcpu->stat.instruction_tsch++;
536 /* a valid schid has at least one bit set */
537 if (vcpu->run->s.regs.gprs[1])
538 inti = kvm_s390_get_io_int(vcpu->kvm, isc_mask,
539 vcpu->run->s.regs.gprs[1]);
542 * Prepare exit to userspace.
543 * We indicate whether we dequeued a pending I/O interrupt
544 * so that userspace can re-inject it if the instruction gets
545 * a program check. While this may re-order the pending I/O
546 * interrupts, this is no problem since the priority is kept
549 vcpu->run->exit_reason = KVM_EXIT_S390_TSCH;
550 vcpu->run->s390_tsch.dequeued = !!inti;
552 vcpu->run->s390_tsch.subchannel_id = inti->io.subchannel_id;
553 vcpu->run->s390_tsch.subchannel_nr = inti->io.subchannel_nr;
554 vcpu->run->s390_tsch.io_int_parm = inti->io.io_int_parm;
555 vcpu->run->s390_tsch.io_int_word = inti->io.io_int_word;
557 vcpu->run->s390_tsch.ipb = vcpu->arch.sie_block->ipb;
562 static int handle_io_inst(struct kvm_vcpu *vcpu)
564 VCPU_EVENT(vcpu, 4, "%s", "I/O instruction");
566 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
567 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
569 if (vcpu->kvm->arch.css_support) {
571 * Most I/O instructions will be handled by userspace.
572 * Exceptions are tpi and the interrupt portion of tsch.
574 if (vcpu->arch.sie_block->ipa == 0xb236)
575 return handle_tpi(vcpu);
576 if (vcpu->arch.sie_block->ipa == 0xb235)
577 return handle_tsch(vcpu);
578 /* Handle in userspace. */
579 vcpu->stat.instruction_io_other++;
583 * Set condition code 3 to stop the guest from issuing channel
586 kvm_s390_set_psw_cc(vcpu, 3);
591 static int handle_stfl(struct kvm_vcpu *vcpu)
596 vcpu->stat.instruction_stfl++;
598 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
599 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
602 * We need to shift the lower 32 facility bits (bit 0-31) from a u64
603 * into a u32 memory representation. They will remain bits 0-31.
605 fac = *vcpu->kvm->arch.model.fac_list >> 32;
606 rc = write_guest_lc(vcpu, offsetof(struct lowcore, stfl_fac_list),
610 VCPU_EVENT(vcpu, 3, "STFL: store facility list 0x%x", fac);
611 trace_kvm_s390_handle_stfl(vcpu, fac);
615 #define PSW_MASK_ADDR_MODE (PSW_MASK_EA | PSW_MASK_BA)
616 #define PSW_MASK_UNASSIGNED 0xb80800fe7fffffffUL
617 #define PSW_ADDR_24 0x0000000000ffffffUL
618 #define PSW_ADDR_31 0x000000007fffffffUL
620 int is_valid_psw(psw_t *psw)
622 if (psw->mask & PSW_MASK_UNASSIGNED)
624 if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_BA) {
625 if (psw->addr & ~PSW_ADDR_31)
628 if (!(psw->mask & PSW_MASK_ADDR_MODE) && (psw->addr & ~PSW_ADDR_24))
630 if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_EA)
637 int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
639 psw_t *gpsw = &vcpu->arch.sie_block->gpsw;
640 psw_compat_t new_psw;
645 vcpu->stat.instruction_lpsw++;
647 if (gpsw->mask & PSW_MASK_PSTATE)
648 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
650 addr = kvm_s390_get_base_disp_s(vcpu, &ar);
652 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
654 rc = read_guest(vcpu, addr, ar, &new_psw, sizeof(new_psw));
656 return kvm_s390_inject_prog_cond(vcpu, rc);
657 if (!(new_psw.mask & PSW32_MASK_BASE))
658 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
659 gpsw->mask = (new_psw.mask & ~PSW32_MASK_BASE) << 32;
660 gpsw->mask |= new_psw.addr & PSW32_ADDR_AMODE;
661 gpsw->addr = new_psw.addr & ~PSW32_ADDR_AMODE;
662 if (!is_valid_psw(gpsw))
663 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
667 static int handle_lpswe(struct kvm_vcpu *vcpu)
674 vcpu->stat.instruction_lpswe++;
676 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
677 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
679 addr = kvm_s390_get_base_disp_s(vcpu, &ar);
681 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
682 rc = read_guest(vcpu, addr, ar, &new_psw, sizeof(new_psw));
684 return kvm_s390_inject_prog_cond(vcpu, rc);
685 vcpu->arch.sie_block->gpsw = new_psw;
686 if (!is_valid_psw(&vcpu->arch.sie_block->gpsw))
687 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
691 static int handle_stidp(struct kvm_vcpu *vcpu)
693 u64 stidp_data = vcpu->kvm->arch.model.cpuid;
698 vcpu->stat.instruction_stidp++;
700 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
701 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
703 operand2 = kvm_s390_get_base_disp_s(vcpu, &ar);
706 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
708 rc = write_guest(vcpu, operand2, ar, &stidp_data, sizeof(stidp_data));
710 return kvm_s390_inject_prog_cond(vcpu, rc);
712 VCPU_EVENT(vcpu, 3, "STIDP: store cpu id 0x%llx", stidp_data);
716 static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem)
721 cpus = atomic_read(&vcpu->kvm->online_vcpus);
723 /* deal with other level 3 hypervisors */
724 if (stsi(mem, 3, 2, 2))
728 for (n = mem->count - 1; n > 0 ; n--)
729 memcpy(&mem->vm[n], &mem->vm[n - 1], sizeof(mem->vm[0]));
731 memset(&mem->vm[0], 0, sizeof(mem->vm[0]));
732 mem->vm[0].cpus_total = cpus;
733 mem->vm[0].cpus_configured = cpus;
734 mem->vm[0].cpus_standby = 0;
735 mem->vm[0].cpus_reserved = 0;
736 mem->vm[0].caf = 1000;
737 memcpy(mem->vm[0].name, "KVMguest", 8);
738 ASCEBC(mem->vm[0].name, 8);
739 memcpy(mem->vm[0].cpi, "KVM/Linux ", 16);
740 ASCEBC(mem->vm[0].cpi, 16);
743 static void insert_stsi_usr_data(struct kvm_vcpu *vcpu, u64 addr, u8 ar,
744 u8 fc, u8 sel1, u16 sel2)
746 vcpu->run->exit_reason = KVM_EXIT_S390_STSI;
747 vcpu->run->s390_stsi.addr = addr;
748 vcpu->run->s390_stsi.ar = ar;
749 vcpu->run->s390_stsi.fc = fc;
750 vcpu->run->s390_stsi.sel1 = sel1;
751 vcpu->run->s390_stsi.sel2 = sel2;
754 static int handle_stsi(struct kvm_vcpu *vcpu)
756 int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28;
757 int sel1 = vcpu->run->s.regs.gprs[0] & 0xff;
758 int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff;
759 unsigned long mem = 0;
764 vcpu->stat.instruction_stsi++;
765 VCPU_EVENT(vcpu, 3, "STSI: fc: %u sel1: %u sel2: %u", fc, sel1, sel2);
767 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
768 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
771 kvm_s390_set_psw_cc(vcpu, 3);
775 if (vcpu->run->s.regs.gprs[0] & 0x0fffff00
776 || vcpu->run->s.regs.gprs[1] & 0xffff0000)
777 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
780 vcpu->run->s.regs.gprs[0] = 3 << 28;
781 kvm_s390_set_psw_cc(vcpu, 0);
785 operand2 = kvm_s390_get_base_disp_s(vcpu, &ar);
787 if (operand2 & 0xfff)
788 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
791 case 1: /* same handling for 1 and 2 */
793 mem = get_zeroed_page(GFP_KERNEL);
796 if (stsi((void *) mem, fc, sel1, sel2))
800 if (sel1 != 2 || sel2 != 2)
802 mem = get_zeroed_page(GFP_KERNEL);
805 handle_stsi_3_2_2(vcpu, (void *) mem);
809 rc = write_guest(vcpu, operand2, ar, (void *)mem, PAGE_SIZE);
811 rc = kvm_s390_inject_prog_cond(vcpu, rc);
814 if (vcpu->kvm->arch.user_stsi) {
815 insert_stsi_usr_data(vcpu, operand2, ar, fc, sel1, sel2);
818 trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2);
820 kvm_s390_set_psw_cc(vcpu, 0);
821 vcpu->run->s.regs.gprs[0] = 0;
824 kvm_s390_set_psw_cc(vcpu, 3);
830 int kvm_s390_handle_b2(struct kvm_vcpu *vcpu)
832 switch (vcpu->arch.sie_block->ipa & 0x00ff) {
834 return handle_stidp(vcpu);
836 return handle_set_clock(vcpu);
838 return handle_set_prefix(vcpu);
840 return handle_store_prefix(vcpu);
842 return handle_store_cpu_address(vcpu);
844 return kvm_s390_handle_vsie(vcpu);
847 return handle_ipte_interlock(vcpu);
849 return handle_iske(vcpu);
851 return handle_rrbe(vcpu);
853 return handle_sske(vcpu);
855 return handle_test_block(vcpu);
872 return handle_io_inst(vcpu);
874 return handle_sthyi(vcpu);
876 return handle_stsi(vcpu);
878 return handle_stfl(vcpu);
880 return handle_lpswe(vcpu);
886 static int handle_epsw(struct kvm_vcpu *vcpu)
890 vcpu->stat.instruction_epsw++;
892 kvm_s390_get_regs_rre(vcpu, ®1, ®2);
894 /* This basically extracts the mask half of the psw. */
895 vcpu->run->s.regs.gprs[reg1] &= 0xffffffff00000000UL;
896 vcpu->run->s.regs.gprs[reg1] |= vcpu->arch.sie_block->gpsw.mask >> 32;
898 vcpu->run->s.regs.gprs[reg2] &= 0xffffffff00000000UL;
899 vcpu->run->s.regs.gprs[reg2] |=
900 vcpu->arch.sie_block->gpsw.mask & 0x00000000ffffffffUL;
905 #define PFMF_RESERVED 0xfffc0101UL
906 #define PFMF_SK 0x00020000UL
907 #define PFMF_CF 0x00010000UL
908 #define PFMF_UI 0x00008000UL
909 #define PFMF_FSC 0x00007000UL
910 #define PFMF_NQ 0x00000800UL
911 #define PFMF_MR 0x00000400UL
912 #define PFMF_MC 0x00000200UL
913 #define PFMF_KEY 0x000000feUL
915 static int handle_pfmf(struct kvm_vcpu *vcpu)
917 bool mr = false, mc = false, nq;
919 unsigned long start, end;
922 vcpu->stat.instruction_pfmf++;
924 kvm_s390_get_regs_rre(vcpu, ®1, ®2);
926 if (!test_kvm_facility(vcpu->kvm, 8))
927 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
929 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
930 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
932 if (vcpu->run->s.regs.gprs[reg1] & PFMF_RESERVED)
933 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
935 /* Only provide non-quiescing support if enabled for the guest */
936 if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ &&
937 !test_kvm_facility(vcpu->kvm, 14))
938 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
940 /* Only provide conditional-SSKE support if enabled for the guest */
941 if (vcpu->run->s.regs.gprs[reg1] & PFMF_SK &&
942 test_kvm_facility(vcpu->kvm, 10)) {
943 mr = vcpu->run->s.regs.gprs[reg1] & PFMF_MR;
944 mc = vcpu->run->s.regs.gprs[reg1] & PFMF_MC;
947 nq = vcpu->run->s.regs.gprs[reg1] & PFMF_NQ;
948 key = vcpu->run->s.regs.gprs[reg1] & PFMF_KEY;
949 start = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK;
950 start = kvm_s390_logical_to_effective(vcpu, start);
952 if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) {
953 if (kvm_s390_check_low_addr_prot_real(vcpu, start))
954 return kvm_s390_inject_prog_irq(vcpu, &vcpu->arch.pgm);
957 switch (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) {
959 /* only 4k frames specify a real address */
960 start = kvm_s390_real_to_abs(vcpu, start);
961 end = (start + PAGE_SIZE) & ~(PAGE_SIZE - 1);
964 end = (start + _SEGMENT_SIZE) & ~(_SEGMENT_SIZE - 1);
967 /* only support 2G frame size if EDAT2 is available and we are
968 not in 24-bit addressing mode */
969 if (!test_kvm_facility(vcpu->kvm, 78) ||
970 psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_24BIT)
971 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
972 end = (start + _REGION3_SIZE) & ~(_REGION3_SIZE - 1);
975 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
978 while (start != end) {
979 unsigned long vmaddr;
980 bool unlocked = false;
982 /* Translate guest address to host address */
983 vmaddr = gfn_to_hva(vcpu->kvm, gpa_to_gfn(start));
984 if (kvm_is_error_hva(vmaddr))
985 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
987 if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) {
988 if (kvm_clear_guest(vcpu->kvm, start, PAGE_SIZE))
989 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
992 if (vcpu->run->s.regs.gprs[reg1] & PFMF_SK) {
993 int rc = kvm_s390_skey_check_enable(vcpu);
997 down_read(¤t->mm->mmap_sem);
998 rc = cond_set_guest_storage_key(current->mm, vmaddr,
999 key, NULL, nq, mr, mc);
1001 rc = fixup_user_fault(current, current->mm, vmaddr,
1002 FAULT_FLAG_WRITE, &unlocked);
1003 rc = !rc ? -EAGAIN : rc;
1006 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
1008 up_read(¤t->mm->mmap_sem);
1013 if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) {
1014 if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT) {
1015 vcpu->run->s.regs.gprs[reg2] = end;
1017 vcpu->run->s.regs.gprs[reg2] &= ~0xffffffffUL;
1018 end = kvm_s390_logical_to_effective(vcpu, end);
1019 vcpu->run->s.regs.gprs[reg2] |= end;
1026 * Must be called with relevant read locks held (kvm->mm->mmap_sem, kvm->srcu)
1028 static inline int __do_essa(struct kvm_vcpu *vcpu, const int orc)
1030 int r1, r2, nappended, entries;
1031 unsigned long gfn, hva, res, pgstev, ptev;
1032 unsigned long *cbrlo;
1035 * We don't need to set SD.FPF.SK to 1 here, because if we have a
1036 * machine check here we either handle it or crash
1039 kvm_s390_get_regs_rre(vcpu, &r1, &r2);
1040 gfn = vcpu->run->s.regs.gprs[r2] >> PAGE_SHIFT;
1041 hva = gfn_to_hva(vcpu->kvm, gfn);
1042 entries = (vcpu->arch.sie_block->cbrlo & ~PAGE_MASK) >> 3;
1044 if (kvm_is_error_hva(hva))
1045 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
1047 nappended = pgste_perform_essa(vcpu->kvm->mm, hva, orc, &ptev, &pgstev);
1048 if (nappended < 0) {
1049 res = orc ? 0x10 : 0;
1050 vcpu->run->s.regs.gprs[r1] = res; /* Exception Indication */
1053 res = (pgstev & _PGSTE_GPS_USAGE_MASK) >> 22;
1055 * Set the block-content state part of the result. 0 means resident, so
1056 * nothing to do if the page is valid. 2 is for preserved pages
1057 * (non-present and non-zero), and 3 for zero pages (non-present and
1060 if (ptev & _PAGE_INVALID) {
1062 if (pgstev & _PGSTE_GPS_ZERO)
1065 if (pgstev & _PGSTE_GPS_NODAT)
1067 vcpu->run->s.regs.gprs[r1] = res;
1069 * It is possible that all the normal 511 slots were full, in which case
1070 * we will now write in the 512th slot, which is reserved for host use.
1071 * In both cases we let the normal essa handling code process all the
1072 * slots, including the reserved one, if needed.
1074 if (nappended > 0) {
1075 cbrlo = phys_to_virt(vcpu->arch.sie_block->cbrlo & PAGE_MASK);
1076 cbrlo[entries] = gfn << PAGE_SHIFT;
1080 struct kvm_memory_slot *ms = gfn_to_memslot(vcpu->kvm, gfn);
1082 /* Increment only if we are really flipping the bit */
1083 if (ms && !test_and_set_bit(gfn - ms->base_gfn, kvm_second_dirty_bitmap(ms)))
1084 atomic64_inc(&vcpu->kvm->arch.cmma_dirty_pages);
1090 static int handle_essa(struct kvm_vcpu *vcpu)
1092 /* entries expected to be 1FF */
1093 int entries = (vcpu->arch.sie_block->cbrlo & ~PAGE_MASK) >> 3;
1094 unsigned long *cbrlo;
1098 VCPU_EVENT(vcpu, 4, "ESSA: release %d pages", entries);
1099 gmap = vcpu->arch.gmap;
1100 vcpu->stat.instruction_essa++;
1101 if (!vcpu->kvm->arch.use_cmma)
1102 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
1104 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
1105 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
1106 /* Check for invalid operation request code */
1107 orc = (vcpu->arch.sie_block->ipb & 0xf0000000) >> 28;
1108 /* ORCs 0-6 are always valid */
1109 if (orc > (test_kvm_facility(vcpu->kvm, 147) ? ESSA_SET_STABLE_NODAT
1110 : ESSA_SET_STABLE_IF_RESIDENT))
1111 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
1113 if (!vcpu->kvm->arch.migration_mode) {
1115 * CMMA is enabled in the KVM settings, but is disabled in
1116 * the SIE block and in the mm_context, and we are not doing
1117 * a migration. Enable CMMA in the mm_context.
1118 * Since we need to take a write lock to write to the context
1119 * to avoid races with storage keys handling, we check if the
1120 * value really needs to be written to; if the value is
1121 * already correct, we do nothing and avoid the lock.
1123 if (vcpu->kvm->mm->context.uses_cmm == 0) {
1124 down_write(&vcpu->kvm->mm->mmap_sem);
1125 vcpu->kvm->mm->context.uses_cmm = 1;
1126 up_write(&vcpu->kvm->mm->mmap_sem);
1129 * If we are here, we are supposed to have CMMA enabled in
1130 * the SIE block. Enabling CMMA works on a per-CPU basis,
1131 * while the context use_cmma flag is per process.
1132 * It's possible that the context flag is enabled and the
1133 * SIE flag is not, so we set the flag always; if it was
1134 * already set, nothing changes, otherwise we enable it
1137 vcpu->arch.sie_block->ecb2 |= ECB2_CMMA;
1138 /* Retry the ESSA instruction */
1139 kvm_s390_retry_instr(vcpu);
1143 down_read(&vcpu->kvm->mm->mmap_sem);
1144 srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
1145 i = __do_essa(vcpu, orc);
1146 srcu_read_unlock(&vcpu->kvm->srcu, srcu_idx);
1147 up_read(&vcpu->kvm->mm->mmap_sem);
1150 /* Account for the possible extra cbrl entry */
1153 vcpu->arch.sie_block->cbrlo &= PAGE_MASK; /* reset nceo */
1154 cbrlo = phys_to_virt(vcpu->arch.sie_block->cbrlo);
1155 down_read(&gmap->mm->mmap_sem);
1156 for (i = 0; i < entries; ++i)
1157 __gmap_zap(gmap, cbrlo[i]);
1158 up_read(&gmap->mm->mmap_sem);
1162 int kvm_s390_handle_b9(struct kvm_vcpu *vcpu)
1164 switch (vcpu->arch.sie_block->ipa & 0x00ff) {
1168 return handle_ipte_interlock(vcpu);
1170 return handle_epsw(vcpu);
1172 return handle_essa(vcpu);
1174 return handle_pfmf(vcpu);
1180 int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu)
1182 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
1183 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
1184 int reg, rc, nr_regs;
1189 vcpu->stat.instruction_lctl++;
1191 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
1192 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
1194 ga = kvm_s390_get_base_disp_rs(vcpu, &ar);
1197 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
1199 VCPU_EVENT(vcpu, 4, "LCTL: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
1200 trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, ga);
1202 nr_regs = ((reg3 - reg1) & 0xf) + 1;
1203 rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32));
1205 return kvm_s390_inject_prog_cond(vcpu, rc);
1209 vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul;
1210 vcpu->arch.sie_block->gcr[reg] |= ctl_array[nr_regs++];
1213 reg = (reg + 1) % 16;
1215 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
1219 int kvm_s390_handle_stctl(struct kvm_vcpu *vcpu)
1221 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
1222 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
1223 int reg, rc, nr_regs;
1228 vcpu->stat.instruction_stctl++;
1230 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
1231 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
1233 ga = kvm_s390_get_base_disp_rs(vcpu, &ar);
1236 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
1238 VCPU_EVENT(vcpu, 4, "STCTL r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
1239 trace_kvm_s390_handle_stctl(vcpu, 0, reg1, reg3, ga);
1244 ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg];
1247 reg = (reg + 1) % 16;
1249 rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32));
1250 return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0;
1253 static int handle_lctlg(struct kvm_vcpu *vcpu)
1255 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
1256 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
1257 int reg, rc, nr_regs;
1262 vcpu->stat.instruction_lctlg++;
1264 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
1265 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
1267 ga = kvm_s390_get_base_disp_rsy(vcpu, &ar);
1270 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
1272 VCPU_EVENT(vcpu, 4, "LCTLG: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
1273 trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, ga);
1275 nr_regs = ((reg3 - reg1) & 0xf) + 1;
1276 rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64));
1278 return kvm_s390_inject_prog_cond(vcpu, rc);
1282 vcpu->arch.sie_block->gcr[reg] = ctl_array[nr_regs++];
1285 reg = (reg + 1) % 16;
1287 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
1291 static int handle_stctg(struct kvm_vcpu *vcpu)
1293 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
1294 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
1295 int reg, rc, nr_regs;
1300 vcpu->stat.instruction_stctg++;
1302 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
1303 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
1305 ga = kvm_s390_get_base_disp_rsy(vcpu, &ar);
1308 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
1310 VCPU_EVENT(vcpu, 4, "STCTG r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
1311 trace_kvm_s390_handle_stctl(vcpu, 1, reg1, reg3, ga);
1316 ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg];
1319 reg = (reg + 1) % 16;
1321 rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64));
1322 return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0;
1325 int kvm_s390_handle_eb(struct kvm_vcpu *vcpu)
1327 switch (vcpu->arch.sie_block->ipb & 0x000000ff) {
1329 return handle_stctg(vcpu);
1331 return handle_lctlg(vcpu);
1335 return handle_ri(vcpu);
1341 static int handle_tprot(struct kvm_vcpu *vcpu)
1343 u64 address1, address2;
1344 unsigned long hva, gpa;
1345 int ret = 0, cc = 0;
1349 vcpu->stat.instruction_tprot++;
1351 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
1352 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
1354 kvm_s390_get_base_disp_sse(vcpu, &address1, &address2, &ar, NULL);
1356 /* we only handle the Linux memory detection case:
1358 * everything else goes to userspace. */
1359 if (address2 & 0xf0)
1361 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_DAT)
1363 ret = guest_translate_address(vcpu, address1, ar, &gpa, GACC_STORE);
1364 if (ret == PGM_PROTECTION) {
1365 /* Write protected? Try again with read-only... */
1367 ret = guest_translate_address(vcpu, address1, ar, &gpa,
1371 if (ret == PGM_ADDRESSING || ret == PGM_TRANSLATION_SPEC) {
1372 ret = kvm_s390_inject_program_int(vcpu, ret);
1373 } else if (ret > 0) {
1374 /* Translation not available */
1375 kvm_s390_set_psw_cc(vcpu, 3);
1381 hva = gfn_to_hva_prot(vcpu->kvm, gpa_to_gfn(gpa), &writable);
1382 if (kvm_is_error_hva(hva)) {
1383 ret = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
1386 cc = 1; /* Write not permitted ==> read-only */
1387 kvm_s390_set_psw_cc(vcpu, cc);
1388 /* Note: CC2 only occurs for storage keys (not supported yet) */
1391 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_DAT)
1396 int kvm_s390_handle_e5(struct kvm_vcpu *vcpu)
1398 switch (vcpu->arch.sie_block->ipa & 0x00ff) {
1400 return handle_tprot(vcpu);
1406 static int handle_sckpf(struct kvm_vcpu *vcpu)
1410 vcpu->stat.instruction_sckpf++;
1412 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
1413 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
1415 if (vcpu->run->s.regs.gprs[0] & 0x00000000ffff0000)
1416 return kvm_s390_inject_program_int(vcpu,
1419 value = vcpu->run->s.regs.gprs[0] & 0x000000000000ffff;
1420 vcpu->arch.sie_block->todpr = value;
1425 static int handle_ptff(struct kvm_vcpu *vcpu)
1427 vcpu->stat.instruction_ptff++;
1429 /* we don't emulate any control instructions yet */
1430 kvm_s390_set_psw_cc(vcpu, 3);
1434 int kvm_s390_handle_01(struct kvm_vcpu *vcpu)
1436 switch (vcpu->arch.sie_block->ipa & 0x00ff) {
1438 return handle_ptff(vcpu);
1440 return handle_sckpf(vcpu);