@@ -5062,6 +5062,30 @@ static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
50625062 return vcpu_post_run_handle_fault (vcpu );
50635063}
50645064
5065+ int noinstr kvm_s390_enter_exit_sie (struct kvm_s390_sie_block * scb ,
5066+ u64 * gprs , unsigned long gasce )
5067+ {
5068+ int ret ;
5069+
5070+ guest_state_enter_irqoff ();
5071+
5072+ /*
5073+ * The guest_state_{enter,exit}_irqoff() functions inform lockdep and
5074+ * tracing that entry to the guest will enable host IRQs, and exit from
5075+ * the guest will disable host IRQs.
5076+ *
5077+ * We must not use lockdep/tracing/RCU in this critical section, so we
5078+ * use the low-level arch_local_irq_*() helpers to enable/disable IRQs.
5079+ */
5080+ arch_local_irq_enable ();
5081+ ret = sie64a (scb , gprs , gasce );
5082+ arch_local_irq_disable ();
5083+
5084+ guest_state_exit_irqoff ();
5085+
5086+ return ret ;
5087+ }
5088+
50655089#define PSW_INT_MASK (PSW_MASK_EXT | PSW_MASK_IO | PSW_MASK_MCHECK)
50665090static int __vcpu_run (struct kvm_vcpu * vcpu )
50675091{
@@ -5082,20 +5106,27 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
50825106 kvm_vcpu_srcu_read_unlock (vcpu );
50835107 /*
50845108 * As PF_VCPU will be used in fault handler, between
5085- * guest_enter and guest_exit should be no uaccess.
5109+ * guest_timing_enter_irqoff and guest_timing_exit_irqoff
5110+ * should be no uaccess.
50865111 */
5087- local_irq_disable ();
5088- guest_enter_irqoff ();
5089- __disable_cpu_timer_accounting (vcpu );
5090- local_irq_enable ();
50915112 if (kvm_s390_pv_cpu_is_protected (vcpu )) {
50925113 memcpy (sie_page -> pv_grregs ,
50935114 vcpu -> run -> s .regs .gprs ,
50945115 sizeof (sie_page -> pv_grregs ));
50955116 }
5096- exit_reason = sie64a (vcpu -> arch .sie_block ,
5097- vcpu -> run -> s .regs .gprs ,
5098- vcpu -> arch .gmap -> asce );
5117+
5118+ local_irq_disable ();
5119+ guest_timing_enter_irqoff ();
5120+ __disable_cpu_timer_accounting (vcpu );
5121+
5122+ exit_reason = kvm_s390_enter_exit_sie (vcpu -> arch .sie_block ,
5123+ vcpu -> run -> s .regs .gprs ,
5124+ vcpu -> arch .gmap -> asce );
5125+
5126+ __enable_cpu_timer_accounting (vcpu );
5127+ guest_timing_exit_irqoff ();
5128+ local_irq_enable ();
5129+
50995130 if (kvm_s390_pv_cpu_is_protected (vcpu )) {
51005131 memcpy (vcpu -> run -> s .regs .gprs ,
51015132 sie_page -> pv_grregs ,
@@ -5111,10 +5142,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
51115142 vcpu -> arch .sie_block -> gpsw .mask &= ~PSW_INT_MASK ;
51125143 }
51135144 }
5114- local_irq_disable ();
5115- __enable_cpu_timer_accounting (vcpu );
5116- guest_exit_irqoff ();
5117- local_irq_enable ();
51185145 kvm_vcpu_srcu_read_lock (vcpu );
51195146
51205147 rc = vcpu_post_run (vcpu , exit_reason );
0 commit comments