Skip to content

Commit

Permalink
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
Browse files Browse the repository at this point in the history
* afaerber/qom-cpu:
  target-i386: Explicitly set vendor for each built-in cpudef
  target-i386: Sanitize AMD's ext2_features at realize time
  target-i386: Filter out unsupported features at realize time
  qemu-common.h: Make qemu_init_vcpu() stub static inline
  target-i386: check/enforce: Eliminate check_feat field
  target-i386: check/enforce: Check SVM flag support as well
  target-i386: check/enforce: Check all CPUID.80000001H.EDX bits
  target-i386: check/enforce: Do not ignore "hypervisor" flag
  target-i386: check/enforce: Fix CPUID leaf numbers on error messages
  target-i386: kvm: Enable all supported KVM features for -cpu host
  target-i386: kvm: -cpu host: Use GET_SUPPORTED_CPUID for SVM features
  cpu: Change parent type to Device
  qdev: Don't assume existence of parent bus on unparenting
  qdev: Include qdev code into *-user, too
  libqemustub: sysbus_get_default() stub
  libqemustub: vmstate register/unregister stubs
  libqemustub: Add qemu_[un]register_reset() stubs

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
Anthony Liguori committed Jan 8, 2013
2 parents 560c30b + ebe8b9c commit 4b274b1
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 67 deletions.
8 changes: 8 additions & 0 deletions Makefile.objs
Expand Up @@ -21,6 +21,13 @@ qom-obj-y = qom/

universal-obj-y += $(qom-obj-y)

#######################################################################
# Core hw code (qdev core)
hw-core-obj-y += hw/
hw-core-obj-y += qemu-option.o

universal-obj-y += $(hw-core-obj-y)

#######################################################################
# oslib-obj-y is code depending on the OS (win32 vs posix)
oslib-obj-y = osdep.o cutils.o qemu-timer-common.o
Expand Down Expand Up @@ -182,6 +189,7 @@ nested-vars += \
user-obj-y \
common-obj-y \
universal-obj-y \
hw-core-obj-y \
extra-obj-y \
trace-obj-y
dummy := $(call unnest-vars)
9 changes: 7 additions & 2 deletions hw/Makefile.objs
@@ -1,3 +1,9 @@
# core qdev-related obj files, also used by *-user:
hw-core-obj-y += qdev.o qdev-properties.o
# irq.o needed for qdev GPIO handling:
hw-core-obj-y += irq.o


common-obj-y = usb/ ide/ pci/
common-obj-y += loader.o
common-obj-$(CONFIG_VIRTIO) += virtio-console.o
Expand Down Expand Up @@ -154,7 +160,6 @@ common-obj-$(CONFIG_SOUND) += $(sound-obj-y)
common-obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/

common-obj-y += usb/
common-obj-y += irq.o
common-obj-$(CONFIG_PTIMER) += ptimer.o
common-obj-$(CONFIG_MAX7310) += max7310.o
common-obj-$(CONFIG_WM8750) += wm8750.o
Expand All @@ -180,7 +185,7 @@ common-obj-$(CONFIG_SD) += sd.o
common-obj-y += bt.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o
common-obj-y += bt-hci-csr.o
common-obj-y += msmouse.o ps2.o
common-obj-y += qdev.o qdev-properties.o qdev-monitor.o
common-obj-y += qdev-monitor.o
common-obj-y += qdev-properties-system.o
common-obj-$(CONFIG_BRLAPI) += baum.o

Expand Down
8 changes: 5 additions & 3 deletions hw/qdev.c
Expand Up @@ -698,16 +698,18 @@ static void device_class_base_init(ObjectClass *class, void *data)
klass->props = NULL;
}

static void qdev_remove_from_bus(Object *obj)
static void device_unparent(Object *obj)
{
DeviceState *dev = DEVICE(obj);

bus_remove_child(dev->parent_bus, dev);
if (dev->parent_bus != NULL) {
bus_remove_child(dev->parent_bus, dev);
}
}

static void device_class_init(ObjectClass *class, void *data)
{
class->unparent = qdev_remove_from_bus;
class->unparent = device_unparent;
}

void device_reset(DeviceState *dev)
Expand Down
4 changes: 3 additions & 1 deletion include/qemu-common.h
Expand Up @@ -288,7 +288,9 @@ struct qemu_work_item {
};

#ifdef CONFIG_USER_ONLY
#define qemu_init_vcpu(env) do { } while (0)
static inline void qemu_init_vcpu(void *env)
{
}
#else
void qemu_init_vcpu(void *env);
#endif
Expand Down
6 changes: 3 additions & 3 deletions include/qom/cpu.h
Expand Up @@ -20,7 +20,7 @@
#ifndef QEMU_CPU_H
#define QEMU_CPU_H

#include "qom/object.h"
#include "hw/qdev-core.h"
#include "qemu/thread.h"

/**
Expand All @@ -46,7 +46,7 @@ typedef struct CPUState CPUState;
*/
typedef struct CPUClass {
/*< private >*/
ObjectClass parent_class;
DeviceClass parent_class;
/*< public >*/

void (*reset)(CPUState *cpu);
Expand All @@ -66,7 +66,7 @@ struct kvm_run;
*/
struct CPUState {
/*< private >*/
Object parent_obj;
DeviceState parent_obj;
/*< public >*/

struct QemuThread *thread;
Expand Down
6 changes: 4 additions & 2 deletions qom/cpu.c
Expand Up @@ -36,14 +36,16 @@ static void cpu_common_reset(CPUState *cpu)

static void cpu_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
CPUClass *k = CPU_CLASS(klass);

k->reset = cpu_common_reset;
dc->no_user = 1;
}

static TypeInfo cpu_type_info = {
static const TypeInfo cpu_type_info = {
.name = TYPE_CPU,
.parent = TYPE_OBJECT,
.parent = TYPE_DEVICE,
.instance_size = sizeof(CPUState),
.abstract = true,
.class_size = sizeof(CPUClass),
Expand Down
3 changes: 3 additions & 0 deletions stubs/Makefile.objs
Expand Up @@ -5,4 +5,7 @@ stub-obj-y += fdset-get-fd.o
stub-obj-y += fdset-remove-fd.o
stub-obj-y += get-fd.o
stub-obj-y += set-fd-handler.o
stub-obj-y += reset.o
stub-obj-y += vmstate.o
stub-obj-y += sysbus.o
stub-obj-$(CONFIG_WIN32) += fd-register.o
13 changes: 13 additions & 0 deletions stubs/reset.c
@@ -0,0 +1,13 @@
#include "hw/hw.h"

/* Stub functions for binaries that never call qemu_devices_reset(),
* and don't need to keep track of the reset handler list.
*/

void qemu_register_reset(QEMUResetHandler *func, void *opaque)
{
}

void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
{
}
6 changes: 6 additions & 0 deletions stubs/sysbus.c
@@ -0,0 +1,6 @@
#include "hw/qdev-core.h"

BusState *sysbus_get_default(void)
{
return NULL;
}
17 changes: 17 additions & 0 deletions stubs/vmstate.c
@@ -0,0 +1,17 @@
#include "qemu-common.h"
#include "migration/vmstate.h"

int vmstate_register_with_alias_id(DeviceState *dev,
int instance_id,
const VMStateDescription *vmsd,
void *base, int alias_id,
int required_for_version)
{
return 0;
}

void vmstate_unregister(DeviceState *dev,
const VMStateDescription *vmsd,
void *opaque)
{
}
2 changes: 0 additions & 2 deletions target-alpha/cpu.c
Expand Up @@ -26,11 +26,9 @@

static void alpha_cpu_realize(Object *obj, Error **errp)
{
#ifndef CONFIG_USER_ONLY
AlphaCPU *cpu = ALPHA_CPU(obj);

qemu_init_vcpu(&cpu->env);
#endif
}

/* Sort alphabetically by type name. */
Expand Down

0 comments on commit 4b274b1

Please sign in to comment.