2
0

kvm_irqcount.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * KVM PIC functions for counting the delivered IRQs.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, see <http://www.gnu.org/licenses/>
  16. */
  17. #include "qemu/osdep.h"
  18. #include "hw/intc/kvm_irqcount.h"
  19. #include "trace.h"
  20. static int kvm_irq_delivered;
  21. void kvm_report_irq_delivered(int delivered)
  22. {
  23. kvm_irq_delivered += delivered;
  24. trace_kvm_report_irq_delivered(kvm_irq_delivered);
  25. }
  26. void kvm_reset_irq_delivered(void)
  27. {
  28. /*
  29. * Copy this into a local variable to encourage gcc to emit a plain
  30. * register for a sys/sdt.h marker. For details on this workaround, see:
  31. * https://sourceware.org/bugzilla/show_bug.cgi?id=13296
  32. */
  33. volatile int k_i_d = kvm_irq_delivered;
  34. trace_kvm_reset_irq_delivered(k_i_d);
  35. kvm_irq_delivered = 0;
  36. }
  37. int kvm_get_irq_delivered(void)
  38. {
  39. trace_kvm_get_irq_delivered(kvm_irq_delivered);
  40. return kvm_irq_delivered;
  41. }