All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15
@ 2013-04-16  0:46 Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 01/12] target-i386: Fix including "host" in -cpu ? output Andreas Färber
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Blue Swirl, Anthony Liguori, Igor Mammedov,
	Andreas Färber, Aurélien Jarno

Hello,

This is my current QOM CPU patch queue. Please pull.

It includes:
* -cpu ? fixes,
* preparations for x86 CPU static properties,
* preparations for x86 CPU hot-plug,
* preparations for x86 CPUID features array cleanup,
* do_interrupt cleanup for cris.

Regards,
Andreas

Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Aurélien Jarno <aurelien@aurel32.net>

Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>


The following changes since commit 24a6e7f4d91e9ed5f8117ecb083431a23f8609a0:

  virtio-balloon: fix dynamic properties. (2013-04-15 17:06:58 -0500)

are available in the git repository at:

  git://github.com/afaerber/qemu-cpu.git qom-cpu

for you to fetch changes up to b21bfeead284cf212d88dfa25171fee122407bc2:

  target-cris: Override do_interrupt for pre-v32 CPU cores (2013-04-16 02:45:11 +0200)

----------------------------------------------------------------
Andreas Färber (1):
      target-cris: Override do_interrupt for pre-v32 CPU cores

Eduardo Habkost (1):
      target-i386/cpu.c: Coding style fixes

Igor Mammedov (8):
      qdev: Add qdev property for bool type
      target-i386: Consolidate error propagation in x86_cpu_realizefn()
      target-i386: Split APIC creation from initialization in x86_cpu_realizefn()
      kvmvapic: Replace FROM_SYSBUS() with QOM type cast
      ioapic: Replace FROM_SYSBUS() with QOM type cast
      target-i386: Split out CPU creation and features parsing
      cpu: Pass CPUState to *cpu_synchronize_post*()
      qdev: Set device's parent before calling realize() down inheritance chain

Jan Kiszka (2):
      target-i386: Fix including "host" in -cpu ? output
      target-i386: Improve -cpu ? features output

 cpus.c                       |  4 +-
 hw/core/qdev-properties.c    | 33 ++++++++++++++++
 hw/core/qdev.c               |  8 ++--
 hw/i386/kvmvapic.c           |  7 +++-
 hw/intc/ioapic_common.c      |  2 +-
 include/hw/qdev-properties.h | 10 +++++
 include/sysemu/kvm.h         | 12 +++---
 kvm-all.c                    |  8 +---
 kvm-stub.c                   |  4 +-
 target-cris/cpu-qom.h        |  1 +
 target-cris/cpu.c            |  8 ++++
 target-cris/helper.c         | 14 ++++---
 target-i386/cpu.c            | 89 ++++++++++++++++++++++++++++++--------------
 target-i386/cpu.h            |  1 +
 14 files changed, 145 insertions(+), 56 deletions(-)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 01/12] target-i386: Fix including "host" in -cpu ? output
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 02/12] target-i386: Improve -cpu ? features output Andreas Färber
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, Andreas Färber

From: Jan Kiszka <jan.kiszka@siemens.com>

kvm_enabled() cannot be true at this point because accelerators are
initialized much later during init. Also, hiding this makes it very hard
to discover for users. Simply dump unconditionally if CONFIG_KVM is set.

Add explanation for "host" CPU type.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 6dd993f..b8690d2 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1463,9 +1463,12 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
         snprintf(buf, sizeof(buf), "%s", def->name);
         (*cpu_fprintf)(f, "x86 %16s  %-48s\n", buf, def->model_id);
     }
-    if (kvm_enabled()) {
-        (*cpu_fprintf)(f, "x86 %16s\n", "[host]");
-    }
+#ifdef CONFIG_KVM
+    (*cpu_fprintf)(f, "x86 %16s  %-48s\n", "host",
+                   "KVM processor with all supported host features "
+                   "(only available in KVM mode)");
+#endif
+
     (*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
     listflags(buf, sizeof(buf), (uint32_t)~0, feature_name, 1);
     (*cpu_fprintf)(f, "  %s\n", buf);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 02/12] target-i386: Improve -cpu ? features output
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 01/12] target-i386: Fix including "host" in -cpu ? output Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 03/12] qdev: Add qdev property for bool type Andreas Färber
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Kiszka, Andreas Färber

From: Jan Kiszka <jan.kiszka@siemens.com>

We were missing a bunch of feature lists. Fix this by simply dumping
the meta list feature_word_info.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index b8690d2..0a4e5ae 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1470,14 +1470,12 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
 #endif
 
     (*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
-    listflags(buf, sizeof(buf), (uint32_t)~0, feature_name, 1);
-    (*cpu_fprintf)(f, "  %s\n", buf);
-    listflags(buf, sizeof(buf), (uint32_t)~0, ext_feature_name, 1);
-    (*cpu_fprintf)(f, "  %s\n", buf);
-    listflags(buf, sizeof(buf), (uint32_t)~0, ext2_feature_name, 1);
-    (*cpu_fprintf)(f, "  %s\n", buf);
-    listflags(buf, sizeof(buf), (uint32_t)~0, ext3_feature_name, 1);
-    (*cpu_fprintf)(f, "  %s\n", buf);
+    for (i = 0; i < ARRAY_SIZE(feature_word_info); i++) {
+        FeatureWordInfo *fw = &feature_word_info[i];
+
+        listflags(buf, sizeof(buf), (uint32_t)~0, fw->feat_names, 1);
+        (*cpu_fprintf)(f, "  %s\n", buf);
+    }
 }
 
 CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 03/12] qdev: Add qdev property for bool type
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 01/12] target-i386: Fix including "host" in -cpu ? output Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 02/12] target-i386: Improve -cpu ? features output Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 04/12] target-i386: Consolidate error propagation in x86_cpu_realizefn() Andreas Färber
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Andreas Färber

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
[AF: Use new qdev_prop_set_after_realize()]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev-properties.c    | 33 +++++++++++++++++++++++++++++++++
 include/hw/qdev-properties.h | 10 ++++++++++
 2 files changed, 43 insertions(+)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index ddde18e..ca1739e 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -120,6 +120,39 @@ PropertyInfo qdev_prop_bit = {
     .set   = set_bit,
 };
 
+/* --- bool --- */
+
+static void get_bool(Object *obj, Visitor *v, void *opaque,
+                     const char *name, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    bool *ptr = qdev_get_prop_ptr(dev, prop);
+
+    visit_type_bool(v, ptr, name, errp);
+}
+
+static void set_bool(Object *obj, Visitor *v, void *opaque,
+                     const char *name, Error **errp)
+{
+    DeviceState *dev = DEVICE(obj);
+    Property *prop = opaque;
+    bool *ptr = qdev_get_prop_ptr(dev, prop);
+
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
+    visit_type_bool(v, ptr, name, errp);
+}
+
+PropertyInfo qdev_prop_bool = {
+    .name  = "boolean",
+    .get   = get_bool,
+    .set   = set_bool,
+};
+
 /* --- 8bit integer --- */
 
 static void get_uint8(Object *obj, Visitor *v, void *opaque,
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index a379339..25dd1bb 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -6,6 +6,7 @@
 /*** qdev-properties.c ***/
 
 extern PropertyInfo qdev_prop_bit;
+extern PropertyInfo qdev_prop_bool;
 extern PropertyInfo qdev_prop_uint8;
 extern PropertyInfo qdev_prop_uint16;
 extern PropertyInfo qdev_prop_uint32;
@@ -52,6 +53,15 @@ extern PropertyInfo qdev_prop_arraylen;
         .defval    = (bool)_defval,                              \
         }
 
+#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) {       \
+        .name      = (_name),                                    \
+        .info      = &(qdev_prop_bool),                          \
+        .offset    = offsetof(_state, _field)                    \
+            + type_check(bool, typeof_field(_state, _field)),    \
+        .qtype     = QTYPE_QBOOL,                                \
+        .defval    = (bool)_defval,                              \
+        }
+
 #define PROP_ARRAY_LEN_PREFIX "len-"
 
 /**
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 04/12] target-i386: Consolidate error propagation in x86_cpu_realizefn()
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
                   ` (2 preceding siblings ...)
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 03/12] qdev: Add qdev property for bool type Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 05/12] target-i386: Split APIC creation from initialization " Andreas Färber
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Andreas Färber

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 0a4e5ae..9d45f09 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2099,9 +2099,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     X86CPU *cpu = X86_CPU(dev);
     X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
     CPUX86State *env = &cpu->env;
-#ifndef CONFIG_USER_ONLY
     Error *local_err = NULL;
-#endif
 
     if (env->cpuid_7_0_ebx_features && env->cpuid_level < 7) {
         env->cpuid_level = 7;
@@ -2131,8 +2129,9 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     } else {
         if (check_cpuid && kvm_check_features_against_host(cpu)
             && enforce_cpuid) {
-            error_setg(errp, "Host's CPU doesn't support requested features");
-            return;
+            error_setg(&local_err,
+                       "Host's CPU doesn't support requested features");
+            goto out;
         }
 #ifdef CONFIG_KVM
         filter_features_for_kvm(cpu);
@@ -2145,8 +2144,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     if (cpu->env.cpuid_features & CPUID_APIC || smp_cpus > 1) {
         x86_cpu_apic_init(cpu, &local_err);
         if (local_err != NULL) {
-            error_propagate(errp, local_err);
-            return;
+            goto out;
         }
     }
 #endif
@@ -2155,7 +2153,12 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     qemu_init_vcpu(&cpu->env);
     cpu_reset(CPU(cpu));
 
-    xcc->parent_realize(dev, errp);
+    xcc->parent_realize(dev, &local_err);
+out:
+    if (local_err != NULL) {
+        error_propagate(errp, local_err);
+        return;
+    }
 }
 
 /* Enables contiguous-apic-ID mode, for compatibility */
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 05/12] target-i386: Split APIC creation from initialization in x86_cpu_realizefn()
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
                   ` (3 preceding siblings ...)
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 04/12] target-i386: Consolidate error propagation in x86_cpu_realizefn() Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 06/12] kvmvapic: Replace FROM_SYSBUS() with QOM type cast Andreas Färber
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Andreas Färber

From: Igor Mammedov <imammedo@redhat.com>

When APIC is hotplugged during CPU hotplug, device_set_realized()
calls device_reset() on it. And if QEMU runs in KVM mode, following
call chain will fail:
    apic_reset_common()
        -> kvm_apic_vapic_base_update()
            -> kvm_vcpu_ioctl(cpu->kvm_fd,...)
due to cpu->kvm_fd not being initialized yet.

cpu->kvm_fd is initialized during qemu_init_vcpu() but x86_cpu_apic_init()
can't be moved after it because kvm_init_vcpu() -> kvm_arch_reset_vcpu()
relies on APIC to determine if CPU is BSP for setting initial env->mp_state.

So split APIC device creation from its initialization and realize APIC
after CPU is created, when it's safe to call APIC's reset method.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 9d45f09..5d05803 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2050,9 +2050,8 @@ static void mce_init(X86CPU *cpu)
 }
 
 #ifndef CONFIG_USER_ONLY
-static void x86_cpu_apic_init(X86CPU *cpu, Error **errp)
+static void x86_cpu_apic_create(X86CPU *cpu, Error **errp)
 {
-    static int apic_mapped;
     CPUX86State *env = &cpu->env;
     APICCommonState *apic;
     const char *apic_type = "apic";
@@ -2075,6 +2074,16 @@ static void x86_cpu_apic_init(X86CPU *cpu, Error **errp)
     /* TODO: convert to link<> */
     apic = APIC_COMMON(env->apic_state);
     apic->cpu = cpu;
+}
+
+static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)
+{
+    CPUX86State *env = &cpu->env;
+    static int apic_mapped;
+
+    if (env->apic_state == NULL) {
+        return;
+    }
 
     if (qdev_init(env->apic_state)) {
         error_setg(errp, "APIC device '%s' could not be initialized",
@@ -2092,6 +2101,10 @@ static void x86_cpu_apic_init(X86CPU *cpu, Error **errp)
         apic_mapped = 1;
     }
 }
+#else
+static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)
+{
+}
 #endif
 
 static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
@@ -2142,7 +2155,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
     qemu_register_reset(x86_cpu_machine_reset_cb, cpu);
 
     if (cpu->env.cpuid_features & CPUID_APIC || smp_cpus > 1) {
-        x86_cpu_apic_init(cpu, &local_err);
+        x86_cpu_apic_create(cpu, &local_err);
         if (local_err != NULL) {
             goto out;
         }
@@ -2151,6 +2164,11 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
 
     mce_init(cpu);
     qemu_init_vcpu(&cpu->env);
+
+    x86_cpu_apic_realize(cpu, &local_err);
+    if (local_err != NULL) {
+        goto out;
+    }
     cpu_reset(CPU(cpu));
 
     xcc->parent_realize(dev, &local_err);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 06/12] kvmvapic: Replace FROM_SYSBUS() with QOM type cast
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
                   ` (4 preceding siblings ...)
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 05/12] target-i386: Split APIC creation from initialization " Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 07/12] ioapic: " Andreas Färber
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Andreas Färber

From: Igor Mammedov <imammedo@redhat.com>

... and define type name and type cast macro for kvmvapic according
to accepted convention.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/i386/kvmvapic.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index ed9b448..3a10c07 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -60,6 +60,9 @@ typedef struct VAPICROMState {
     bool rom_mapped_writable;
 } VAPICROMState;
 
+#define TYPE_VAPIC "kvmvapic"
+#define VAPIC(obj) OBJECT_CHECK(VAPICROMState, (obj), TYPE_VAPIC)
+
 #define TPR_INSTR_ABS_MODRM             0x1
 #define TPR_INSTR_MATCH_MODRM_REG       0x2
 
@@ -690,7 +693,7 @@ static const MemoryRegionOps vapic_ops = {
 
 static int vapic_init(SysBusDevice *dev)
 {
-    VAPICROMState *s = FROM_SYSBUS(VAPICROMState, dev);
+    VAPICROMState *s = VAPIC(dev);
 
     memory_region_init_io(&s->io, &vapic_ops, s, "kvmvapic", 2);
     sysbus_add_io(dev, VAPIC_IO_PORT, &s->io);
@@ -806,7 +809,7 @@ static void vapic_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo vapic_type = {
-    .name          = "kvmvapic",
+    .name          = TYPE_VAPIC,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(VAPICROMState),
     .class_init    = vapic_class_init,
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 07/12] ioapic: Replace FROM_SYSBUS() with QOM type cast
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
                   ` (5 preceding siblings ...)
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 06/12] kvmvapic: Replace FROM_SYSBUS() with QOM type cast Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 08/12] target-i386/cpu.c: Coding style fixes Andreas Färber
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Andreas Färber

From: Igor Mammedov <imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/intc/ioapic_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c
index 42c7adc..5c5bb3c 100644
--- a/hw/intc/ioapic_common.c
+++ b/hw/intc/ioapic_common.c
@@ -59,7 +59,7 @@ static int ioapic_dispatch_post_load(void *opaque, int version_id)
 
 static int ioapic_init_common(SysBusDevice *dev)
 {
-    IOAPICCommonState *s = FROM_SYSBUS(IOAPICCommonState, dev);
+    IOAPICCommonState *s = IOAPIC_COMMON(dev);
     IOAPICCommonClass *info;
     static int ioapic_no;
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 08/12] target-i386/cpu.c: Coding style fixes
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
                   ` (6 preceding siblings ...)
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 07/12] ioapic: " Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 09/12] target-i386: Split out CPU creation and features parsing Andreas Färber
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost, Andreas Färber

From: Eduardo Habkost <ehabkost@redhat.com>

 * Add braces to 'if' statements;
 * Remove last TAB character from the source.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
[AF: Changed whitespace]
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 5d05803..0a84000 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1869,12 +1869,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         if (env->cpuid_ext2_features & CPUID_EXT2_LM) {
             /* 64 bit processor */
 /* XXX: The physical address space is limited to 42 bits in exec.c. */
-            *eax = 0x00003028;	/* 48 bits virtual, 40 bits physical */
+            *eax = 0x00003028; /* 48 bits virtual, 40 bits physical */
         } else {
-            if (env->cpuid_features & CPUID_PSE36)
+            if (env->cpuid_features & CPUID_PSE36) {
                 *eax = 0x00000024; /* 36 bits physical */
-            else
+            } else {
                 *eax = 0x00000020; /* 32 bits physical */
+            }
         }
         *ebx = 0;
         *ecx = 0;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 09/12] target-i386: Split out CPU creation and features parsing
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
                   ` (7 preceding siblings ...)
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 08/12] target-i386/cpu.c: Coding style fixes Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46   ` [Qemu-devel] " Andreas Färber
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Andreas Färber

From: Igor Mammedov <imammedo@redhat.com>

Move CPU creation and features parsing into a separate cpu_x86_create()
function, so that board would be able to set board-specific CPU
properties before CPU is realized.

Keep cpu_x86_init() for compatibility with the code that uses cpu_init()
and doesn't need to modify CPU properties.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.c | 18 +++++++++++++++---
 target-i386/cpu.h |  1 +
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 0a84000..e2302d8 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1563,7 +1563,7 @@ static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp)
     object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp);
 }
 
-X86CPU *cpu_x86_init(const char *cpu_model)
+X86CPU *cpu_x86_create(const char *cpu_model, Error **errp)
 {
     X86CPU *cpu = NULL;
     CPUX86State *env;
@@ -1593,13 +1593,25 @@ X86CPU *cpu_x86_init(const char *cpu_model)
         goto out;
     }
 
-    object_property_set_bool(OBJECT(cpu), true, "realized", &error);
+out:
+    error_propagate(errp, error);
+    g_strfreev(model_pieces);
+    return cpu;
+}
+
+X86CPU *cpu_x86_init(const char *cpu_model)
+{
+    Error *error = NULL;
+    X86CPU *cpu;
+
+    cpu = cpu_x86_create(cpu_model, &error);
     if (error) {
         goto out;
     }
 
+    object_property_set_bool(OBJECT(cpu), true, "realized", &error);
+
 out:
-    g_strfreev(model_pieces);
     if (error) {
         fprintf(stderr, "%s\n", error_get_pretty(error));
         error_free(error);
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 2b4e319..cf1b05c 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -896,6 +896,7 @@ typedef struct CPUX86State {
 #include "cpu-qom.h"
 
 X86CPU *cpu_x86_init(const char *cpu_model);
+X86CPU *cpu_x86_create(const char *cpu_model, Error **errp);
 int cpu_x86_exec(CPUX86State *s);
 void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf);
 void x86_cpudef_setup(void);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/12] cpu: Pass CPUState to *cpu_synchronize_post*()
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
@ 2013-04-16  0:46   ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 02/12] target-i386: Improve -cpu ? features output Andreas Färber
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Andreas Färber, Gleb Natapov, Marcelo Tosatti,
	open list:Overall

From: Igor Mammedov <imammedo@redhat.com>

... so it could be called without requiring CPUArchState.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 cpus.c               |  4 ++--
 include/sysemu/kvm.h | 12 ++++++------
 kvm-all.c            |  8 ++------
 kvm-stub.c           |  4 ++--
 4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/cpus.c b/cpus.c
index 97e9ab4..c15ff6c 100644
--- a/cpus.c
+++ b/cpus.c
@@ -419,7 +419,7 @@ void cpu_synchronize_all_post_reset(void)
     CPUArchState *cpu;
 
     for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
-        cpu_synchronize_post_reset(cpu);
+        cpu_synchronize_post_reset(ENV_GET_CPU(cpu));
     }
 }
 
@@ -428,7 +428,7 @@ void cpu_synchronize_all_post_init(void)
     CPUArchState *cpu;
 
     for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
-        cpu_synchronize_post_init(cpu);
+        cpu_synchronize_post_init(ENV_GET_CPU(cpu));
     }
 }
 
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index f2d97b5..495e6f8 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -250,8 +250,8 @@ int kvm_check_extension(KVMState *s, unsigned int extension);
 uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
                                       uint32_t index, int reg);
 void kvm_cpu_synchronize_state(CPUArchState *env);
-void kvm_cpu_synchronize_post_reset(CPUArchState *env);
-void kvm_cpu_synchronize_post_init(CPUArchState *env);
+void kvm_cpu_synchronize_post_reset(CPUState *cpu);
+void kvm_cpu_synchronize_post_init(CPUState *cpu);
 
 /* generic hooks - to be moved/refactored once there are more users */
 
@@ -262,17 +262,17 @@ static inline void cpu_synchronize_state(CPUArchState *env)
     }
 }
 
-static inline void cpu_synchronize_post_reset(CPUArchState *env)
+static inline void cpu_synchronize_post_reset(CPUState *cpu)
 {
     if (kvm_enabled()) {
-        kvm_cpu_synchronize_post_reset(env);
+        kvm_cpu_synchronize_post_reset(cpu);
     }
 }
 
-static inline void cpu_synchronize_post_init(CPUArchState *env)
+static inline void cpu_synchronize_post_init(CPUState *cpu)
 {
     if (kvm_enabled()) {
-        kvm_cpu_synchronize_post_init(env);
+        kvm_cpu_synchronize_post_init(cpu);
     }
 }
 
diff --git a/kvm-all.c b/kvm-all.c
index 9b433d3..fc4e17c 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1510,18 +1510,14 @@ void kvm_cpu_synchronize_state(CPUArchState *env)
     }
 }
 
-void kvm_cpu_synchronize_post_reset(CPUArchState *env)
+void kvm_cpu_synchronize_post_reset(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
-
     kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
     cpu->kvm_vcpu_dirty = false;
 }
 
-void kvm_cpu_synchronize_post_init(CPUArchState *env)
+void kvm_cpu_synchronize_post_init(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
-
     kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE);
     cpu->kvm_vcpu_dirty = false;
 }
diff --git a/kvm-stub.c b/kvm-stub.c
index f6137d3..723a813 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -41,11 +41,11 @@ void kvm_cpu_synchronize_state(CPUArchState *env)
 {
 }
 
-void kvm_cpu_synchronize_post_reset(CPUArchState *env)
+void kvm_cpu_synchronize_post_reset(CPUState *cpu)
 {
 }
 
-void kvm_cpu_synchronize_post_init(CPUArchState *env)
+void kvm_cpu_synchronize_post_init(CPUState *cpu)
 {
 }
 
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 10/12] cpu: Pass CPUState to *cpu_synchronize_post*()
@ 2013-04-16  0:46   ` Andreas Färber
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Marcelo Tosatti, Andreas Färber, Gleb Natapov,
	open list:Overall

From: Igor Mammedov <imammedo@redhat.com>

... so it could be called without requiring CPUArchState.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 cpus.c               |  4 ++--
 include/sysemu/kvm.h | 12 ++++++------
 kvm-all.c            |  8 ++------
 kvm-stub.c           |  4 ++--
 4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/cpus.c b/cpus.c
index 97e9ab4..c15ff6c 100644
--- a/cpus.c
+++ b/cpus.c
@@ -419,7 +419,7 @@ void cpu_synchronize_all_post_reset(void)
     CPUArchState *cpu;
 
     for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
-        cpu_synchronize_post_reset(cpu);
+        cpu_synchronize_post_reset(ENV_GET_CPU(cpu));
     }
 }
 
@@ -428,7 +428,7 @@ void cpu_synchronize_all_post_init(void)
     CPUArchState *cpu;
 
     for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
-        cpu_synchronize_post_init(cpu);
+        cpu_synchronize_post_init(ENV_GET_CPU(cpu));
     }
 }
 
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index f2d97b5..495e6f8 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -250,8 +250,8 @@ int kvm_check_extension(KVMState *s, unsigned int extension);
 uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
                                       uint32_t index, int reg);
 void kvm_cpu_synchronize_state(CPUArchState *env);
-void kvm_cpu_synchronize_post_reset(CPUArchState *env);
-void kvm_cpu_synchronize_post_init(CPUArchState *env);
+void kvm_cpu_synchronize_post_reset(CPUState *cpu);
+void kvm_cpu_synchronize_post_init(CPUState *cpu);
 
 /* generic hooks - to be moved/refactored once there are more users */
 
@@ -262,17 +262,17 @@ static inline void cpu_synchronize_state(CPUArchState *env)
     }
 }
 
-static inline void cpu_synchronize_post_reset(CPUArchState *env)
+static inline void cpu_synchronize_post_reset(CPUState *cpu)
 {
     if (kvm_enabled()) {
-        kvm_cpu_synchronize_post_reset(env);
+        kvm_cpu_synchronize_post_reset(cpu);
     }
 }
 
-static inline void cpu_synchronize_post_init(CPUArchState *env)
+static inline void cpu_synchronize_post_init(CPUState *cpu)
 {
     if (kvm_enabled()) {
-        kvm_cpu_synchronize_post_init(env);
+        kvm_cpu_synchronize_post_init(cpu);
     }
 }
 
diff --git a/kvm-all.c b/kvm-all.c
index 9b433d3..fc4e17c 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1510,18 +1510,14 @@ void kvm_cpu_synchronize_state(CPUArchState *env)
     }
 }
 
-void kvm_cpu_synchronize_post_reset(CPUArchState *env)
+void kvm_cpu_synchronize_post_reset(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
-
     kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
     cpu->kvm_vcpu_dirty = false;
 }
 
-void kvm_cpu_synchronize_post_init(CPUArchState *env)
+void kvm_cpu_synchronize_post_init(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
-
     kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE);
     cpu->kvm_vcpu_dirty = false;
 }
diff --git a/kvm-stub.c b/kvm-stub.c
index f6137d3..723a813 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -41,11 +41,11 @@ void kvm_cpu_synchronize_state(CPUArchState *env)
 {
 }
 
-void kvm_cpu_synchronize_post_reset(CPUArchState *env)
+void kvm_cpu_synchronize_post_reset(CPUState *cpu)
 {
 }
 
-void kvm_cpu_synchronize_post_init(CPUArchState *env)
+void kvm_cpu_synchronize_post_init(CPUState *cpu)
 {
 }
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 11/12] qdev: Set device's parent before calling realize() down inheritance chain
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
                   ` (9 preceding siblings ...)
  2013-04-16  0:46   ` [Qemu-devel] " Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 12/12] target-cris: Override do_interrupt for pre-v32 CPU cores Andreas Färber
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Andreas Färber

From: Igor Mammedov <imammedo@redhat.com>

Currently device_set_realized() sets parent only after device was realized,
but qdev_device_add() sets it before device is realized.
Make behavior consistent and alter device_set_realized() to behave like
qdev_device_add().

It will allow to set link<> properties in realize() method in classes
inherited from DEVICE.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/core/qdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index bab4ed7..4eb0134 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -684,10 +684,6 @@ static void device_set_realized(Object *obj, bool value, Error **err)
     Error *local_err = NULL;
 
     if (value && !dev->realized) {
-        if (dc->realize) {
-            dc->realize(dev, &local_err);
-        }
-
         if (!obj->parent && local_err == NULL) {
             static int unattached_count;
             gchar *name = g_strdup_printf("device[%d]", unattached_count++);
@@ -698,6 +694,10 @@ static void device_set_realized(Object *obj, bool value, Error **err)
             g_free(name);
         }
 
+        if (dc->realize) {
+            dc->realize(dev, &local_err);
+        }
+
         if (qdev_get_vmsd(dev) && local_err == NULL) {
             vmstate_register_with_alias_id(dev, -1, qdev_get_vmsd(dev), dev,
                                            dev->instance_id_alias,
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Qemu-devel] [PATCH 12/12] target-cris: Override do_interrupt for pre-v32 CPU cores
  2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
                   ` (10 preceding siblings ...)
  2013-04-16  0:46 ` [Qemu-devel] [PATCH 11/12] qdev: Set device's parent before calling realize() down inheritance chain Andreas Färber
@ 2013-04-16  0:46 ` Andreas Färber
  11 siblings, 0 replies; 16+ messages in thread
From: Andreas Färber @ 2013-04-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Edgar E. Iglesias, Andreas Färber

Instead of forwarding from cris_cpu_do_interrupt() to do_interruptv10(),
override CPUClass::do_interrupt with crisv10_cpu_do_interrupt() in the
newly introduced class_init functions.

Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-cris/cpu-qom.h |  1 +
 target-cris/cpu.c     |  8 ++++++++
 target-cris/helper.c  | 14 ++++++++------
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/target-cris/cpu-qom.h b/target-cris/cpu-qom.h
index deea1d8..03829bd 100644
--- a/target-cris/cpu-qom.h
+++ b/target-cris/cpu-qom.h
@@ -74,5 +74,6 @@ static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env)
 #define ENV_OFFSET offsetof(CRISCPU, env)
 
 void cris_cpu_do_interrupt(CPUState *cpu);
+void crisv10_cpu_do_interrupt(CPUState *cpu);
 
 #endif
diff --git a/target-cris/cpu.c b/target-cris/cpu.c
index 95cbf39..67181e5 100644
--- a/target-cris/cpu.c
+++ b/target-cris/cpu.c
@@ -169,30 +169,38 @@ static void cris_cpu_initfn(Object *obj)
 
 static void crisv8_cpu_class_init(ObjectClass *oc, void *data)
 {
+    CPUClass *cc = CPU_CLASS(oc);
     CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
 
     ccc->vr = 8;
+    cc->do_interrupt = crisv10_cpu_do_interrupt;
 }
 
 static void crisv9_cpu_class_init(ObjectClass *oc, void *data)
 {
+    CPUClass *cc = CPU_CLASS(oc);
     CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
 
     ccc->vr = 9;
+    cc->do_interrupt = crisv10_cpu_do_interrupt;
 }
 
 static void crisv10_cpu_class_init(ObjectClass *oc, void *data)
 {
+    CPUClass *cc = CPU_CLASS(oc);
     CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
 
     ccc->vr = 10;
+    cc->do_interrupt = crisv10_cpu_do_interrupt;
 }
 
 static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
 {
+    CPUClass *cc = CPU_CLASS(oc);
     CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
 
     ccc->vr = 11;
+    cc->do_interrupt = crisv10_cpu_do_interrupt;
 }
 
 static void crisv32_cpu_class_init(ObjectClass *oc, void *data)
diff --git a/target-cris/helper.c b/target-cris/helper.c
index e1ef7bc..466cc2f 100644
--- a/target-cris/helper.c
+++ b/target-cris/helper.c
@@ -45,6 +45,11 @@ void cris_cpu_do_interrupt(CPUState *cs)
     env->pregs[PR_ERP] = env->pc;
 }
 
+void crisv10_cpu_do_interrupt(CPUState *cs)
+{
+    cris_cpu_do_interrupt(cs);
+}
+
 int cpu_cris_handle_mmu_fault(CPUCRISState * env, target_ulong address, int rw,
                               int mmu_idx)
 {
@@ -109,9 +114,10 @@ int cpu_cris_handle_mmu_fault(CPUCRISState *env, target_ulong address, int rw,
     return r;
 }
 
-static void do_interruptv10(CPUCRISState *env)
+void crisv10_cpu_do_interrupt(CPUState *cs)
 {
-    D(CPUState *cs = CPU(cris_env_get_cpu(env)));
+    CRISCPU *cpu = CRIS_CPU(cs);
+    CPUCRISState *env = &cpu->env;
     int ex_vec = -1;
 
     D_LOG("exception index=%d interrupt_req=%d\n",
@@ -171,10 +177,6 @@ void cris_cpu_do_interrupt(CPUState *cs)
     CPUCRISState *env = &cpu->env;
     int ex_vec = -1;
 
-    if (env->pregs[PR_VR] < 32) {
-        return do_interruptv10(env);
-    }
-
     D_LOG("exception index=%d interrupt_req=%d\n",
           env->exception_index,
           cs->interrupt_request);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 10/12] cpu: Pass CPUState to *cpu_synchronize_post*()
  2013-04-16  0:46   ` [Qemu-devel] " Andreas Färber
@ 2013-04-18  9:18     ` Gleb Natapov
  -1 siblings, 0 replies; 16+ messages in thread
From: Gleb Natapov @ 2013-04-18  9:18 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Igor Mammedov, Marcelo Tosatti, qemu-devel, open list:Overall

On Tue, Apr 16, 2013 at 02:46:47AM +0200, Andreas Färber wrote:
> From: Igor Mammedov <imammedo@redhat.com>
> 
> ... so it could be called without requiring CPUArchState.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Gleb Natapov <gleb@redhat.com>

> ---
>  cpus.c               |  4 ++--
>  include/sysemu/kvm.h | 12 ++++++------
>  kvm-all.c            |  8 ++------
>  kvm-stub.c           |  4 ++--
>  4 files changed, 12 insertions(+), 16 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 97e9ab4..c15ff6c 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -419,7 +419,7 @@ void cpu_synchronize_all_post_reset(void)
>      CPUArchState *cpu;
>  
>      for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
> -        cpu_synchronize_post_reset(cpu);
> +        cpu_synchronize_post_reset(ENV_GET_CPU(cpu));
>      }
>  }
>  
> @@ -428,7 +428,7 @@ void cpu_synchronize_all_post_init(void)
>      CPUArchState *cpu;
>  
>      for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
> -        cpu_synchronize_post_init(cpu);
> +        cpu_synchronize_post_init(ENV_GET_CPU(cpu));
>      }
>  }
>  
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index f2d97b5..495e6f8 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -250,8 +250,8 @@ int kvm_check_extension(KVMState *s, unsigned int extension);
>  uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
>                                        uint32_t index, int reg);
>  void kvm_cpu_synchronize_state(CPUArchState *env);
> -void kvm_cpu_synchronize_post_reset(CPUArchState *env);
> -void kvm_cpu_synchronize_post_init(CPUArchState *env);
> +void kvm_cpu_synchronize_post_reset(CPUState *cpu);
> +void kvm_cpu_synchronize_post_init(CPUState *cpu);
>  
>  /* generic hooks - to be moved/refactored once there are more users */
>  
> @@ -262,17 +262,17 @@ static inline void cpu_synchronize_state(CPUArchState *env)
>      }
>  }
>  
> -static inline void cpu_synchronize_post_reset(CPUArchState *env)
> +static inline void cpu_synchronize_post_reset(CPUState *cpu)
>  {
>      if (kvm_enabled()) {
> -        kvm_cpu_synchronize_post_reset(env);
> +        kvm_cpu_synchronize_post_reset(cpu);
>      }
>  }
>  
> -static inline void cpu_synchronize_post_init(CPUArchState *env)
> +static inline void cpu_synchronize_post_init(CPUState *cpu)
>  {
>      if (kvm_enabled()) {
> -        kvm_cpu_synchronize_post_init(env);
> +        kvm_cpu_synchronize_post_init(cpu);
>      }
>  }
>  
> diff --git a/kvm-all.c b/kvm-all.c
> index 9b433d3..fc4e17c 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1510,18 +1510,14 @@ void kvm_cpu_synchronize_state(CPUArchState *env)
>      }
>  }
>  
> -void kvm_cpu_synchronize_post_reset(CPUArchState *env)
> +void kvm_cpu_synchronize_post_reset(CPUState *cpu)
>  {
> -    CPUState *cpu = ENV_GET_CPU(env);
> -
>      kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
>      cpu->kvm_vcpu_dirty = false;
>  }
>  
> -void kvm_cpu_synchronize_post_init(CPUArchState *env)
> +void kvm_cpu_synchronize_post_init(CPUState *cpu)
>  {
> -    CPUState *cpu = ENV_GET_CPU(env);
> -
>      kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE);
>      cpu->kvm_vcpu_dirty = false;
>  }
> diff --git a/kvm-stub.c b/kvm-stub.c
> index f6137d3..723a813 100644
> --- a/kvm-stub.c
> +++ b/kvm-stub.c
> @@ -41,11 +41,11 @@ void kvm_cpu_synchronize_state(CPUArchState *env)
>  {
>  }
>  
> -void kvm_cpu_synchronize_post_reset(CPUArchState *env)
> +void kvm_cpu_synchronize_post_reset(CPUState *cpu)
>  {
>  }
>  
> -void kvm_cpu_synchronize_post_init(CPUArchState *env)
> +void kvm_cpu_synchronize_post_init(CPUState *cpu)
>  {
>  }
>  
> -- 
> 1.8.1.4

--
			Gleb.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH 10/12] cpu: Pass CPUState to *cpu_synchronize_post*()
@ 2013-04-18  9:18     ` Gleb Natapov
  0 siblings, 0 replies; 16+ messages in thread
From: Gleb Natapov @ 2013-04-18  9:18 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Igor Mammedov, Marcelo Tosatti, qemu-devel, open list:Overall

On Tue, Apr 16, 2013 at 02:46:47AM +0200, Andreas Färber wrote:
> From: Igor Mammedov <imammedo@redhat.com>
> 
> ... so it could be called without requiring CPUArchState.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Gleb Natapov <gleb@redhat.com>

> ---
>  cpus.c               |  4 ++--
>  include/sysemu/kvm.h | 12 ++++++------
>  kvm-all.c            |  8 ++------
>  kvm-stub.c           |  4 ++--
>  4 files changed, 12 insertions(+), 16 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 97e9ab4..c15ff6c 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -419,7 +419,7 @@ void cpu_synchronize_all_post_reset(void)
>      CPUArchState *cpu;
>  
>      for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
> -        cpu_synchronize_post_reset(cpu);
> +        cpu_synchronize_post_reset(ENV_GET_CPU(cpu));
>      }
>  }
>  
> @@ -428,7 +428,7 @@ void cpu_synchronize_all_post_init(void)
>      CPUArchState *cpu;
>  
>      for (cpu = first_cpu; cpu; cpu = cpu->next_cpu) {
> -        cpu_synchronize_post_init(cpu);
> +        cpu_synchronize_post_init(ENV_GET_CPU(cpu));
>      }
>  }
>  
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index f2d97b5..495e6f8 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -250,8 +250,8 @@ int kvm_check_extension(KVMState *s, unsigned int extension);
>  uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
>                                        uint32_t index, int reg);
>  void kvm_cpu_synchronize_state(CPUArchState *env);
> -void kvm_cpu_synchronize_post_reset(CPUArchState *env);
> -void kvm_cpu_synchronize_post_init(CPUArchState *env);
> +void kvm_cpu_synchronize_post_reset(CPUState *cpu);
> +void kvm_cpu_synchronize_post_init(CPUState *cpu);
>  
>  /* generic hooks - to be moved/refactored once there are more users */
>  
> @@ -262,17 +262,17 @@ static inline void cpu_synchronize_state(CPUArchState *env)
>      }
>  }
>  
> -static inline void cpu_synchronize_post_reset(CPUArchState *env)
> +static inline void cpu_synchronize_post_reset(CPUState *cpu)
>  {
>      if (kvm_enabled()) {
> -        kvm_cpu_synchronize_post_reset(env);
> +        kvm_cpu_synchronize_post_reset(cpu);
>      }
>  }
>  
> -static inline void cpu_synchronize_post_init(CPUArchState *env)
> +static inline void cpu_synchronize_post_init(CPUState *cpu)
>  {
>      if (kvm_enabled()) {
> -        kvm_cpu_synchronize_post_init(env);
> +        kvm_cpu_synchronize_post_init(cpu);
>      }
>  }
>  
> diff --git a/kvm-all.c b/kvm-all.c
> index 9b433d3..fc4e17c 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1510,18 +1510,14 @@ void kvm_cpu_synchronize_state(CPUArchState *env)
>      }
>  }
>  
> -void kvm_cpu_synchronize_post_reset(CPUArchState *env)
> +void kvm_cpu_synchronize_post_reset(CPUState *cpu)
>  {
> -    CPUState *cpu = ENV_GET_CPU(env);
> -
>      kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
>      cpu->kvm_vcpu_dirty = false;
>  }
>  
> -void kvm_cpu_synchronize_post_init(CPUArchState *env)
> +void kvm_cpu_synchronize_post_init(CPUState *cpu)
>  {
> -    CPUState *cpu = ENV_GET_CPU(env);
> -
>      kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE);
>      cpu->kvm_vcpu_dirty = false;
>  }
> diff --git a/kvm-stub.c b/kvm-stub.c
> index f6137d3..723a813 100644
> --- a/kvm-stub.c
> +++ b/kvm-stub.c
> @@ -41,11 +41,11 @@ void kvm_cpu_synchronize_state(CPUArchState *env)
>  {
>  }
>  
> -void kvm_cpu_synchronize_post_reset(CPUArchState *env)
> +void kvm_cpu_synchronize_post_reset(CPUState *cpu)
>  {
>  }
>  
> -void kvm_cpu_synchronize_post_init(CPUArchState *env)
> +void kvm_cpu_synchronize_post_init(CPUState *cpu)
>  {
>  }
>  
> -- 
> 1.8.1.4

--
			Gleb.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-04-18  9:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16  0:46 [Qemu-devel] [PULL 00/12] QOM CPUState patch queue 2013-04-15 Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 01/12] target-i386: Fix including "host" in -cpu ? output Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 02/12] target-i386: Improve -cpu ? features output Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 03/12] qdev: Add qdev property for bool type Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 04/12] target-i386: Consolidate error propagation in x86_cpu_realizefn() Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 05/12] target-i386: Split APIC creation from initialization " Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 06/12] kvmvapic: Replace FROM_SYSBUS() with QOM type cast Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 07/12] ioapic: " Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 08/12] target-i386/cpu.c: Coding style fixes Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 09/12] target-i386: Split out CPU creation and features parsing Andreas Färber
2013-04-16  0:46 ` [PATCH 10/12] cpu: Pass CPUState to *cpu_synchronize_post*() Andreas Färber
2013-04-16  0:46   ` [Qemu-devel] " Andreas Färber
2013-04-18  9:18   ` Gleb Natapov
2013-04-18  9:18     ` [Qemu-devel] " Gleb Natapov
2013-04-16  0:46 ` [Qemu-devel] [PATCH 11/12] qdev: Set device's parent before calling realize() down inheritance chain Andreas Färber
2013-04-16  0:46 ` [Qemu-devel] [PATCH 12/12] target-cris: Override do_interrupt for pre-v32 CPU cores Andreas Färber

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.