aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/virtual/kvm/api.txt56
-rw-r--r--arch/s390/kvm/kvm-s390.c10
-rw-r--r--include/uapi/linux/kvm.h3
-rw-r--r--virt/kvm/kvm_main.c2
4 files changed, 70 insertions, 1 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 0d7fc66289a0..a7c651d0dc63 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -2820,6 +2820,62 @@ single frame starting at start_gfn for count frames.
2820Note: If any architecturally invalid key value is found in the given data then 2820Note: If any architecturally invalid key value is found in the given data then
2821the ioctl will return -EINVAL. 2821the ioctl will return -EINVAL.
2822 2822
28234.92 KVM_S390_IRQ
2824
2825Capability: KVM_CAP_S390_INJECT_IRQ
2826Architectures: s390
2827Type: vcpu ioctl
2828Parameters: struct kvm_s390_irq (in)
2829Returns: 0 on success, -1 on error
2830Errors:
2831 EINVAL: interrupt type is invalid
2832 type is KVM_S390_SIGP_STOP and flag parameter is invalid value
2833 type is KVM_S390_INT_EXTERNAL_CALL and code is bigger
2834 than the maximum of VCPUs
2835 EBUSY: type is KVM_S390_SIGP_SET_PREFIX and vcpu is not stopped
2836 type is KVM_S390_SIGP_STOP and a stop irq is already pending
2837 type is KVM_S390_INT_EXTERNAL_CALL and an external call interrupt
2838 is already pending
2839
2840Allows to inject an interrupt to the guest.
2841
2842Using struct kvm_s390_irq as a parameter allows
2843to inject additional payload which is not
2844possible via KVM_S390_INTERRUPT.
2845
2846Interrupt parameters are passed via kvm_s390_irq:
2847
2848struct kvm_s390_irq {
2849 __u64 type;
2850 union {
2851 struct kvm_s390_io_info io;
2852 struct kvm_s390_ext_info ext;
2853 struct kvm_s390_pgm_info pgm;
2854 struct kvm_s390_emerg_info emerg;
2855 struct kvm_s390_extcall_info extcall;
2856 struct kvm_s390_prefix_info prefix;
2857 struct kvm_s390_stop_info stop;
2858 struct kvm_s390_mchk_info mchk;
2859 char reserved[64];
2860 } u;
2861};
2862
2863type can be one of the following:
2864
2865KVM_S390_SIGP_STOP - sigp stop; parameter in .stop
2866KVM_S390_PROGRAM_INT - program check; parameters in .pgm
2867KVM_S390_SIGP_SET_PREFIX - sigp set prefix; parameters in .prefix
2868KVM_S390_RESTART - restart; no parameters
2869KVM_S390_INT_CLOCK_COMP - clock comparator interrupt; no parameters
2870KVM_S390_INT_CPU_TIMER - CPU timer interrupt; no parameters
2871KVM_S390_INT_EMERGENCY - sigp emergency; parameters in .emerg
2872KVM_S390_INT_EXTERNAL_CALL - sigp external call; parameters in .extcall
2873KVM_S390_MCHK - machine check interrupt; parameters in .mchk
2874
2875
2876Note that the vcpu ioctl is asynchronous to vcpu execution.
2877
2878
28235. The kvm_run structure 28795. The kvm_run structure
2824------------------------ 2880------------------------
2825 2881
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index dbc9ca34d9da..8bc25d405edf 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -177,6 +177,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
177 case KVM_CAP_S390_IRQCHIP: 177 case KVM_CAP_S390_IRQCHIP:
178 case KVM_CAP_VM_ATTRIBUTES: 178 case KVM_CAP_VM_ATTRIBUTES:
179 case KVM_CAP_MP_STATE: 179 case KVM_CAP_MP_STATE:
180 case KVM_CAP_S390_INJECT_IRQ:
180 case KVM_CAP_S390_USER_SIGP: 181 case KVM_CAP_S390_USER_SIGP:
181 case KVM_CAP_S390_USER_STSI: 182 case KVM_CAP_S390_USER_STSI:
182 case KVM_CAP_S390_SKEYS: 183 case KVM_CAP_S390_SKEYS:
@@ -2391,6 +2392,15 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2391 long r; 2392 long r;
2392 2393
2393 switch (ioctl) { 2394 switch (ioctl) {
2395 case KVM_S390_IRQ: {
2396 struct kvm_s390_irq s390irq;
2397
2398 r = -EFAULT;
2399 if (copy_from_user(&s390irq, argp, sizeof(s390irq)))
2400 break;
2401 r = kvm_s390_inject_vcpu(vcpu, &s390irq);
2402 break;
2403 }
2394 case KVM_S390_INTERRUPT: { 2404 case KVM_S390_INTERRUPT: {
2395 struct kvm_s390_interrupt s390int; 2405 struct kvm_s390_interrupt s390int;
2396 struct kvm_s390_irq s390irq; 2406 struct kvm_s390_irq s390irq;
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 1162ef7a3fa1..c0632e87a00f 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -802,6 +802,7 @@ struct kvm_ppc_smmu_info {
802#define KVM_CAP_S390_MEM_OP 108 802#define KVM_CAP_S390_MEM_OP 108
803#define KVM_CAP_S390_USER_STSI 109 803#define KVM_CAP_S390_USER_STSI 109
804#define KVM_CAP_S390_SKEYS 110 804#define KVM_CAP_S390_SKEYS 110
805#define KVM_CAP_S390_INJECT_IRQ 113
805 806
806#ifdef KVM_CAP_IRQ_ROUTING 807#ifdef KVM_CAP_IRQ_ROUTING
807 808
@@ -1182,6 +1183,8 @@ struct kvm_s390_ucas_mapping {
1182/* Available with KVM_CAP_S390_SKEYS */ 1183/* Available with KVM_CAP_S390_SKEYS */
1183#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys) 1184#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys)
1184#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys) 1185#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys)
1186/* Available with KVM_CAP_S390_INJECT_IRQ */
1187#define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq)
1185 1188
1186#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 1189#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
1187#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) 1190#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a1093700f3a4..34310a8d24b9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2118,7 +2118,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
2118 * Special cases: vcpu ioctls that are asynchronous to vcpu execution, 2118 * Special cases: vcpu ioctls that are asynchronous to vcpu execution,
2119 * so vcpu_load() would break it. 2119 * so vcpu_load() would break it.
2120 */ 2120 */
2121 if (ioctl == KVM_S390_INTERRUPT || ioctl == KVM_INTERRUPT) 2121 if (ioctl == KVM_S390_INTERRUPT || ioctl == KVM_S390_IRQ || ioctl == KVM_INTERRUPT)
2122 return kvm_arch_vcpu_ioctl(filp, ioctl, arg); 2122 return kvm_arch_vcpu_ioctl(filp, ioctl, arg);
2123#endif 2123#endif
2124 2124