Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / hw / intc / kvm_irqcount.c
blob2ef8a83a7adc3da12f7cff46c5e2f17dec242c61
1 /*
2 * KVM PIC functions for counting the delivered IRQs.
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.
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.
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/>
18 #include "qemu/osdep.h"
19 #include "hw/intc/kvm_irqcount.h"
20 #include "trace.h"
22 static int kvm_irq_delivered;
24 void kvm_report_irq_delivered(int delivered)
26 kvm_irq_delivered += delivered;
28 trace_kvm_report_irq_delivered(kvm_irq_delivered);
31 void kvm_reset_irq_delivered(void)
34 * Copy this into a local variable to encourage gcc to emit a plain
35 * register for a sys/sdt.h marker. For details on this workaround, see:
36 * https://sourceware.org/bugzilla/show_bug.cgi?id=13296
38 volatile int k_i_d = kvm_irq_delivered;
39 trace_kvm_reset_irq_delivered(k_i_d);
41 kvm_irq_delivered = 0;
44 int kvm_get_irq_delivered(void)
46 trace_kvm_get_irq_delivered(kvm_irq_delivered);
48 return kvm_irq_delivered;