summaryrefslogtreecommitdiff
path: root/hw/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'hw/kvm')
-rw-r--r--hw/kvm/apic.c36
-rw-r--r--hw/kvm/clock.c4
-rw-r--r--hw/kvm/i8259.c6
-rw-r--r--hw/kvm/ioapic.c4
4 files changed, 41 insertions, 9 deletions
diff --git a/hw/kvm/apic.c b/hw/kvm/apic.c
index dfc2ab3b03..9ca68f81aa 100644
--- a/hw/kvm/apic.c
+++ b/hw/kvm/apic.c
@@ -92,6 +92,35 @@ static void kvm_apic_set_tpr(APICCommonState *s, uint8_t val)
s->tpr = (val & 0x0f) << 4;
}
+static uint8_t kvm_apic_get_tpr(APICCommonState *s)
+{
+ return s->tpr >> 4;
+}
+
+static void kvm_apic_enable_tpr_reporting(APICCommonState *s, bool enable)
+{
+ struct kvm_tpr_access_ctl ctl = {
+ .enabled = enable
+ };
+
+ kvm_vcpu_ioctl(s->cpu_env, KVM_TPR_ACCESS_REPORTING, &ctl);
+}
+
+static void kvm_apic_vapic_base_update(APICCommonState *s)
+{
+ struct kvm_vapic_addr vapid_addr = {
+ .vapic_addr = s->vapic_paddr,
+ };
+ int ret;
+
+ ret = kvm_vcpu_ioctl(s->cpu_env, KVM_SET_VAPIC_ADDR, &vapid_addr);
+ if (ret < 0) {
+ fprintf(stderr, "KVM: setting VAPIC address failed (%s)\n",
+ strerror(-ret));
+ abort();
+ }
+}
+
static void do_inject_external_nmi(void *data)
{
APICCommonState *s = data;
@@ -129,6 +158,9 @@ static void kvm_apic_class_init(ObjectClass *klass, void *data)
k->init = kvm_apic_init;
k->set_base = kvm_apic_set_base;
k->set_tpr = kvm_apic_set_tpr;
+ k->get_tpr = kvm_apic_get_tpr;
+ k->enable_tpr_reporting = kvm_apic_enable_tpr_reporting;
+ k->vapic_base_update = kvm_apic_vapic_base_update;
k->external_nmi = kvm_apic_external_nmi;
}
@@ -139,9 +171,9 @@ static TypeInfo kvm_apic_info = {
.class_init = kvm_apic_class_init,
};
-static void kvm_apic_register_device(void)
+static void kvm_apic_register_types(void)
{
type_register_static(&kvm_apic_info);
}
-device_init(kvm_apic_register_device)
+type_init(kvm_apic_register_types)
diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c
index d5a53869b3..2157340326 100644
--- a/hw/kvm/clock.c
+++ b/hw/kvm/clock.c
@@ -119,11 +119,11 @@ void kvmclock_create(void)
}
}
-static void kvmclock_register_device(void)
+static void kvmclock_register_types(void)
{
if (kvm_enabled()) {
type_register_static(&kvmclock_info);
}
}
-device_init(kvmclock_register_device);
+type_init(kvmclock_register_types)
diff --git a/hw/kvm/i8259.c b/hw/kvm/i8259.c
index 14bd427518..94d1b9aa95 100644
--- a/hw/kvm/i8259.c
+++ b/hw/kvm/i8259.c
@@ -84,8 +84,8 @@ static void kvm_pic_reset(DeviceState *dev)
{
PICCommonState *s = DO_UPCAST(PICCommonState, dev.qdev, dev);
- pic_reset_common(s);
s->elcr = 0;
+ pic_reset_common(s);
kvm_pic_put(s);
}
@@ -130,9 +130,9 @@ static TypeInfo kvm_i8259_info = {
.class_init = kvm_i8259_class_init,
};
-static void kvm_pic_register(void)
+static void kvm_pic_register_types(void)
{
type_register_static(&kvm_i8259_info);
}
-device_init(kvm_pic_register)
+type_init(kvm_pic_register_types)
diff --git a/hw/kvm/ioapic.c b/hw/kvm/ioapic.c
index b316933a96..3ae3175403 100644
--- a/hw/kvm/ioapic.c
+++ b/hw/kvm/ioapic.c
@@ -117,9 +117,9 @@ static TypeInfo kvm_ioapic_info = {
.class_init = kvm_ioapic_class_init,
};
-static void kvm_ioapic_register_device(void)
+static void kvm_ioapic_register_types(void)
{
type_register_static(&kvm_ioapic_info);
}
-device_init(kvm_ioapic_register_device)
+type_init(kvm_ioapic_register_types)