aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-10-31 06:06:49 +0100
committerAndreas Färber <afaerber@suse.de>2012-12-19 14:09:31 +0100
commit1bc22652d62f862a5def54f939e87fdb7a5593ae (patch)
tree007c4c834f580f81989b94c5c5489a57ff2b2263 /hw
parent20d695a9254c1b086a456d3b79a3c311236643ba (diff)
downloadqemu-1bc22652d62f862a5def54f939e87fdb7a5593ae.zip
qemu-1bc22652d62f862a5def54f939e87fdb7a5593ae.tar.gz
qemu-1bc22652d62f862a5def54f939e87fdb7a5593ae.tar.bz2
kvm: Pass CPUState to kvm_vcpu_ioctl()
Adapt helper functions to pass X86CPU / PowerPCCPU / S390CPU. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw')
-rw-r--r--hw/kvm/apic.c10
-rw-r--r--hw/kvm/clock.c2
-rw-r--r--hw/ppc.c2
-rw-r--r--hw/s390-virtio-bus.c12
-rw-r--r--hw/spapr.c2
5 files changed, 14 insertions, 14 deletions
diff --git a/hw/kvm/apic.c b/hw/kvm/apic.c
index 8b65d51..c4d74ee 100644
--- a/hw/kvm/apic.c
+++ b/hw/kvm/apic.c
@@ -104,7 +104,7 @@ static void kvm_apic_enable_tpr_reporting(APICCommonState *s, bool enable)
.enabled = enable
};
- kvm_vcpu_ioctl(&s->cpu->env, KVM_TPR_ACCESS_REPORTING, &ctl);
+ kvm_vcpu_ioctl(CPU(s->cpu), KVM_TPR_ACCESS_REPORTING, &ctl);
}
static void kvm_apic_vapic_base_update(APICCommonState *s)
@@ -114,7 +114,7 @@ static void kvm_apic_vapic_base_update(APICCommonState *s)
};
int ret;
- ret = kvm_vcpu_ioctl(&s->cpu->env, KVM_SET_VAPIC_ADDR, &vapid_addr);
+ ret = kvm_vcpu_ioctl(CPU(s->cpu), KVM_SET_VAPIC_ADDR, &vapid_addr);
if (ret < 0) {
fprintf(stderr, "KVM: setting VAPIC address failed (%s)\n",
strerror(-ret));
@@ -125,15 +125,15 @@ static void kvm_apic_vapic_base_update(APICCommonState *s)
static void do_inject_external_nmi(void *data)
{
APICCommonState *s = data;
- CPUX86State *env = &s->cpu->env;
+ CPUState *cpu = CPU(s->cpu);
uint32_t lvt;
int ret;
- cpu_synchronize_state(env);
+ cpu_synchronize_state(&s->cpu->env);
lvt = s->lvt[APIC_LVT_LINT1];
if (!(lvt & APIC_LVT_MASKED) && ((lvt >> 8) & 7) == APIC_DM_NMI) {
- ret = kvm_vcpu_ioctl(env, KVM_NMI);
+ ret = kvm_vcpu_ioctl(cpu, KVM_NMI);
if (ret < 0) {
fprintf(stderr, "KVM: injection failed, NMI lost (%s)\n",
strerror(-ret));
diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c
index 824b978..4cf62f6 100644
--- a/hw/kvm/clock.c
+++ b/hw/kvm/clock.c
@@ -76,7 +76,7 @@ static void kvmclock_vm_state_change(void *opaque, int running,
return;
}
for (penv = first_cpu; penv != NULL; penv = penv->next_cpu) {
- ret = kvm_vcpu_ioctl(penv, KVM_KVMCLOCK_CTRL, 0);
+ ret = kvm_vcpu_ioctl(ENV_GET_CPU(penv), KVM_KVMCLOCK_CTRL, 0);
if (ret) {
if (ret != -EINVAL) {
fprintf(stderr, "%s: %s\n", __func__, strerror(-ret));
diff --git a/hw/ppc.c b/hw/ppc.c
index 11fd199..e99a93d 100644
--- a/hw/ppc.c
+++ b/hw/ppc.c
@@ -65,7 +65,7 @@ void ppc_set_irq(CPUPPCState *env, int n_IRQ, int level)
if (old_pending != env->pending_interrupts) {
#ifdef CONFIG_KVM
- kvmppc_set_interrupt(env, n_IRQ, level);
+ kvmppc_set_interrupt(ppc_env_get_cpu(env), n_IRQ, level);
#endif
}
diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index e0ac2d1..716028d 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -111,10 +111,12 @@ VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size)
return bus;
}
-static void s390_virtio_irq(CPUS390XState *env, int config_change, uint64_t token)
+static void s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token)
{
+ CPUS390XState *env = &cpu->env;
+
if (kvm_enabled()) {
- kvm_s390_virtio_irq(env, config_change, token);
+ kvm_s390_virtio_irq(cpu, config_change, token);
} else {
cpu_inject_ext(env, VIRTIO_EXT_CODE, config_change, token);
}
@@ -143,8 +145,7 @@ static int s390_virtio_device_init(VirtIOS390Device *dev, VirtIODevice *vdev)
s390_virtio_reset_idx(dev);
if (dev->qdev.hotplugged) {
S390CPU *cpu = s390_cpu_addr2state(0);
- CPUS390XState *env = &cpu->env;
- s390_virtio_irq(env, VIRTIO_PARAM_DEV_ADD, dev->dev_offs);
+ s390_virtio_irq(cpu, VIRTIO_PARAM_DEV_ADD, dev->dev_offs);
}
return 0;
@@ -369,9 +370,8 @@ static void virtio_s390_notify(void *opaque, uint16_t vector)
VirtIOS390Device *dev = (VirtIOS390Device*)opaque;
uint64_t token = s390_virtio_device_vq_token(dev, vector);
S390CPU *cpu = s390_cpu_addr2state(0);
- CPUS390XState *env = &cpu->env;
- s390_virtio_irq(env, 0, token);
+ s390_virtio_irq(cpu, 0, token);
}
static unsigned virtio_s390_get_features(void *opaque)
diff --git a/hw/spapr.c b/hw/spapr.c
index 504d0fc..341f0b9 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -797,7 +797,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
/* Tell KVM that we're in PAPR mode */
if (kvm_enabled()) {
- kvmppc_set_papr(env);
+ kvmppc_set_papr(cpu);
}
qemu_register_reset(spapr_cpu_reset, cpu);