@@ -547,6 +547,46 @@ int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq,
547547 irq -> level , irq -> trig_mode , dest_map );
548548}
549549
550+ int kvm_pv_send_ipi (struct kvm * kvm , unsigned long ipi_bitmap_low ,
551+ unsigned long ipi_bitmap_high , int min ,
552+ unsigned long icr , int op_64_bit )
553+ {
554+ int i ;
555+ struct kvm_apic_map * map ;
556+ struct kvm_vcpu * vcpu ;
557+ struct kvm_lapic_irq irq = {0 };
558+ int cluster_size = op_64_bit ? 64 : 32 ;
559+ int count = 0 ;
560+
561+ irq .vector = icr & APIC_VECTOR_MASK ;
562+ irq .delivery_mode = icr & APIC_MODE_MASK ;
563+ irq .level = (icr & APIC_INT_ASSERT ) != 0 ;
564+ irq .trig_mode = icr & APIC_INT_LEVELTRIG ;
565+
566+ if (icr & APIC_DEST_MASK )
567+ return - KVM_EINVAL ;
568+ if (icr & APIC_SHORT_MASK )
569+ return - KVM_EINVAL ;
570+
571+ rcu_read_lock ();
572+ map = rcu_dereference (kvm -> arch .apic_map );
573+
574+ /* Bits above cluster_size are masked in the caller. */
575+ for_each_set_bit (i , & ipi_bitmap_low , BITS_PER_LONG ) {
576+ vcpu = map -> phys_map [min + i ]-> vcpu ;
577+ count += kvm_apic_set_irq (vcpu , & irq , NULL );
578+ }
579+
580+ min += cluster_size ;
581+ for_each_set_bit (i , & ipi_bitmap_high , BITS_PER_LONG ) {
582+ vcpu = map -> phys_map [min + i ]-> vcpu ;
583+ count += kvm_apic_set_irq (vcpu , & irq , NULL );
584+ }
585+
586+ rcu_read_unlock ();
587+ return count ;
588+ }
589+
550590static int pv_eoi_put_user (struct kvm_vcpu * vcpu , u8 val )
551591{
552592
0 commit comments