aboutsummaryrefslogtreecommitdiff
path: root/hw/intc/kvm_irqcount.c
blob: 2ef8a83a7adc3da12f7cff46c5e2f17dec242c61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * KVM PIC functions for counting the delivered IRQs.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>
 */

#include "qemu/osdep.h"
#include "hw/intc/kvm_irqcount.h"
#include "trace.h"

static int kvm_irq_delivered;

void kvm_report_irq_delivered(int delivered)
{
    kvm_irq_delivered += delivered;

    trace_kvm_report_irq_delivered(kvm_irq_delivered);
}

void kvm_reset_irq_delivered(void)
{
    /*
     * Copy this into a local variable to encourage gcc to emit a plain
     * register for a sys/sdt.h marker.  For details on this workaround, see:
     * https://sourceware.org/bugzilla/show_bug.cgi?id=13296
     */
    volatile int k_i_d = kvm_irq_delivered;
    trace_kvm_reset_irq_delivered(k_i_d);

    kvm_irq_delivered = 0;
}

int kvm_get_irq_delivered(void)
{
    trace_kvm_get_irq_delivered(kvm_irq_delivered);

    return kvm_irq_delivered;
}