intercept.c (af941f3dd8d75d0f6ae911f25a1e68cdc5db2cfd) intercept.c (d6c8097803cbc3bb8d875baef542e6d77d10c203)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * in-kernel handling for sie intercepts
4 *
5 * Copyright IBM Corp. 2008, 2020
6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com>
9 */
10
11#include <linux/kvm_host.h>
12#include <linux/errno.h>
13#include <linux/pagemap.h>
14
15#include <asm/asm-offsets.h>
16#include <asm/irq.h>
17#include <asm/sysinfo.h>
18#include <asm/uv.h>
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * in-kernel handling for sie intercepts
4 *
5 * Copyright IBM Corp. 2008, 2020
6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com>
9 */
10
11#include <linux/kvm_host.h>
12#include <linux/errno.h>
13#include <linux/pagemap.h>
14
15#include <asm/asm-offsets.h>
16#include <asm/irq.h>
17#include <asm/sysinfo.h>
18#include <asm/uv.h>
19#include <asm/gmap.h>
20
21#include "kvm-s390.h"
22#include "gaccess.h"
23#include "trace.h"
24#include "trace-s390.h"
19
20#include "kvm-s390.h"
21#include "gaccess.h"
22#include "trace.h"
23#include "trace-s390.h"
25#include "gmap.h"
26
27u8 kvm_s390_get_ilen(struct kvm_vcpu *vcpu)
28{
29 struct kvm_s390_sie_block *sie_block = vcpu->arch.sie_block;
30 u8 ilen = 0;
31
32 switch (vcpu->arch.sie_block->icptcode) {
33 case ICPT_INST:

--- 507 unchanged lines hidden (view full) ---

541 };
542 int rc;
543
544 if (guest_uvcb->header.cmd != UVC_CMD_REMOVE_SHARED_ACCESS) {
545 WARN_ONCE(1, "Unexpected notification intercept for UVC 0x%x\n",
546 guest_uvcb->header.cmd);
547 return 0;
548 }
24
25u8 kvm_s390_get_ilen(struct kvm_vcpu *vcpu)
26{
27 struct kvm_s390_sie_block *sie_block = vcpu->arch.sie_block;
28 u8 ilen = 0;
29
30 switch (vcpu->arch.sie_block->icptcode) {
31 case ICPT_INST:

--- 507 unchanged lines hidden (view full) ---

539 };
540 int rc;
541
542 if (guest_uvcb->header.cmd != UVC_CMD_REMOVE_SHARED_ACCESS) {
543 WARN_ONCE(1, "Unexpected notification intercept for UVC 0x%x\n",
544 guest_uvcb->header.cmd);
545 return 0;
546 }
549 rc = gmap_make_secure(vcpu->arch.gmap, uvcb.gaddr, &uvcb);
547 rc = kvm_s390_pv_make_secure(vcpu->kvm, uvcb.gaddr, &uvcb);
550 /*
551 * If the unpin did not succeed, the guest will exit again for the UVC
552 * and we will retry the unpin.
553 */
554 if (rc == -EINVAL || rc == -ENXIO)
555 return 0;
556 /*
557 * If we got -EAGAIN here, we simply return it. It will eventually

--- 91 unchanged lines hidden (view full) ---

649 case ICPT_PV_INSTR:
650 rc = handle_instruction(vcpu);
651 break;
652 case ICPT_PV_NOTIFY:
653 rc = handle_pv_notification(vcpu);
654 break;
655 case ICPT_PV_PREF:
656 rc = 0;
548 /*
549 * If the unpin did not succeed, the guest will exit again for the UVC
550 * and we will retry the unpin.
551 */
552 if (rc == -EINVAL || rc == -ENXIO)
553 return 0;
554 /*
555 * If we got -EAGAIN here, we simply return it. It will eventually

--- 91 unchanged lines hidden (view full) ---

647 case ICPT_PV_INSTR:
648 rc = handle_instruction(vcpu);
649 break;
650 case ICPT_PV_NOTIFY:
651 rc = handle_pv_notification(vcpu);
652 break;
653 case ICPT_PV_PREF:
654 rc = 0;
657 gmap_convert_to_secure(vcpu->arch.gmap,
658 kvm_s390_get_prefix(vcpu));
659 gmap_convert_to_secure(vcpu->arch.gmap,
660 kvm_s390_get_prefix(vcpu) + PAGE_SIZE);
655 kvm_s390_pv_convert_to_secure(vcpu->kvm, kvm_s390_get_prefix(vcpu));
656 kvm_s390_pv_convert_to_secure(vcpu->kvm, kvm_s390_get_prefix(vcpu) + PAGE_SIZE);
661 break;
662 default:
663 return -EOPNOTSUPP;
664 }
665
666 if (should_handle_per_ifetch(vcpu, rc))
667 per_rc = kvm_s390_handle_per_ifetch_icpt(vcpu);
668 return per_rc ? per_rc : rc;
669}
657 break;
658 default:
659 return -EOPNOTSUPP;
660 }
661
662 if (should_handle_per_ifetch(vcpu, rc))
663 per_rc = kvm_s390_handle_per_ifetch_icpt(vcpu);
664 return per_rc ? per_rc : rc;
665}