mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2015-10-09' into staging
Fix device introspection regressions # gpg: Signature made Fri 09 Oct 2015 14:43:41 BST using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-monitor-2015-10-09: Revert "qdev: Use qdev_get_device_class() for -device <type>,help" qdev: Protect device-list-properties against broken devices qmp: Fix device-list-properties not to crash for abstract device device-introspect-test: New, covering device introspection libqtest: New hmp() & friends libqtest: Clean up unused QTestState member sigact_old tests: Fix how qom-test is run macio: move DBDMA_init from instance_init to realize hw: do not pass NULL to memory_region_init from instance_init memory: allow destroying a non-empty MemoryRegion virtio-input: Fix device introspection on non-Linux hosts update-linux-headers: Rename SW_MAX to SW_MAX_ Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -103,6 +103,12 @@ static void aw_a10_class_init(ObjectClass *oc, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
dc->realize = aw_a10_realize;
|
||||
|
||||
/*
|
||||
* Reason: creates an ARM CPU, thus use after free(), see
|
||||
* arm_cpu_class_init()
|
||||
*/
|
||||
dc->cannot_destroy_with_object_finalize_yet = true;
|
||||
}
|
||||
|
||||
static const TypeInfo aw_a10_type_info = {
|
||||
|
||||
@@ -97,6 +97,12 @@ static void digic_class_init(ObjectClass *oc, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
dc->realize = digic_realize;
|
||||
|
||||
/*
|
||||
* Reason: creates an ARM CPU, thus use after free(), see
|
||||
* arm_cpu_class_init()
|
||||
*/
|
||||
dc->cannot_destroy_with_object_finalize_yet = true;
|
||||
}
|
||||
|
||||
static const TypeInfo digic_type_info = {
|
||||
|
||||
@@ -284,6 +284,12 @@ static void fsl_imx25_class_init(ObjectClass *oc, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
dc->realize = fsl_imx25_realize;
|
||||
|
||||
/*
|
||||
* Reason: creates an ARM CPU, thus use after free(), see
|
||||
* arm_cpu_class_init()
|
||||
*/
|
||||
dc->cannot_destroy_with_object_finalize_yet = true;
|
||||
}
|
||||
|
||||
static const TypeInfo fsl_imx25_type_info = {
|
||||
|
||||
@@ -258,6 +258,12 @@ static void fsl_imx31_class_init(ObjectClass *oc, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
dc->realize = fsl_imx31_realize;
|
||||
|
||||
/*
|
||||
* Reason: creates an ARM CPU, thus use after free(), see
|
||||
* arm_cpu_class_init()
|
||||
*/
|
||||
dc->cannot_destroy_with_object_finalize_yet = true;
|
||||
}
|
||||
|
||||
static const TypeInfo fsl_imx31_type_info = {
|
||||
|
||||
+1
-1
@@ -1958,7 +1958,7 @@ static void pxa2xx_fir_instance_init(Object *obj)
|
||||
PXA2xxFIrState *s = PXA2XX_FIR(obj);
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
|
||||
|
||||
memory_region_init_io(&s->iomem, NULL, &pxa2xx_fir_ops, s,
|
||||
memory_region_init_io(&s->iomem, obj, &pxa2xx_fir_ops, s,
|
||||
"pxa2xx-fir", 0x1000);
|
||||
sysbus_init_mmio(sbd, &s->iomem);
|
||||
sysbus_init_irq(sbd, &s->irq);
|
||||
|
||||
@@ -271,6 +271,12 @@ static void xlnx_zynqmp_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
dc->props = xlnx_zynqmp_props;
|
||||
dc->realize = xlnx_zynqmp_realize;
|
||||
|
||||
/*
|
||||
* Reason: creates an ARM CPU, thus use after free(), see
|
||||
* arm_cpu_class_init()
|
||||
*/
|
||||
dc->cannot_destroy_with_object_finalize_yet = true;
|
||||
}
|
||||
|
||||
static const TypeInfo xlnx_zynqmp_type_info = {
|
||||
|
||||
+2
-2
@@ -280,12 +280,12 @@ static void cg3_initfn(Object *obj)
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
|
||||
CG3State *s = CG3(obj);
|
||||
|
||||
memory_region_init_ram(&s->rom, NULL, "cg3.prom", FCODE_MAX_ROM_SIZE,
|
||||
memory_region_init_ram(&s->rom, obj, "cg3.prom", FCODE_MAX_ROM_SIZE,
|
||||
&error_fatal);
|
||||
memory_region_set_readonly(&s->rom, true);
|
||||
sysbus_init_mmio(sbd, &s->rom);
|
||||
|
||||
memory_region_init_io(&s->reg, NULL, &cg3_reg_ops, s, "cg3.reg",
|
||||
memory_region_init_io(&s->reg, obj, &cg3_reg_ops, s, "cg3.reg",
|
||||
CG3_REG_SIZE);
|
||||
sysbus_init_mmio(sbd, &s->reg);
|
||||
}
|
||||
|
||||
+1
-1
@@ -944,7 +944,7 @@ static void tcx_initfn(Object *obj)
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
|
||||
TCXState *s = TCX(obj);
|
||||
|
||||
memory_region_init_ram(&s->rom, NULL, "tcx.prom", FCODE_MAX_ROM_SIZE,
|
||||
memory_region_init_ram(&s->rom, OBJECT(s), "tcx.prom", FCODE_MAX_ROM_SIZE,
|
||||
&error_fatal);
|
||||
memory_region_set_readonly(&s->rom, true);
|
||||
sysbus_init_mmio(sbd, &s->rom);
|
||||
|
||||
@@ -8,9 +8,9 @@ common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o
|
||||
common-obj-$(CONFIG_TSC2005) += tsc2005.o
|
||||
common-obj-$(CONFIG_VMMOUSE) += vmmouse.o
|
||||
|
||||
ifeq ($(CONFIG_LINUX),y)
|
||||
common-obj-$(CONFIG_VIRTIO) += virtio-input.o
|
||||
common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
|
||||
ifeq ($(CONFIG_LINUX),y)
|
||||
common-obj-$(CONFIG_VIRTIO) += virtio-input-host.o
|
||||
endif
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ static void intdbg_control_init(Object *obj)
|
||||
SysBusDevice *sd = SYS_BUS_DEVICE(obj);
|
||||
IntegratorDebugState *s = INTEGRATOR_DEBUG(obj);
|
||||
|
||||
memory_region_init_io(&s->iomem, NULL, &intdbg_control_ops,
|
||||
memory_region_init_io(&s->iomem, obj, &intdbg_control_ops,
|
||||
NULL, "dbg-leds", 0x1000000);
|
||||
sysbus_init_mmio(sd, &s->iomem);
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ static void cuda_initfn(Object *obj)
|
||||
CUDAState *s = CUDA(obj);
|
||||
int i;
|
||||
|
||||
memory_region_init_io(&s->mem, NULL, &cuda_ops, s, "cuda", 0x2000);
|
||||
memory_region_init_io(&s->mem, obj, &cuda_ops, s, "cuda", 0x2000);
|
||||
sysbus_init_mmio(d, &s->mem);
|
||||
sysbus_init_irq(d, &s->irq);
|
||||
|
||||
|
||||
@@ -105,10 +105,10 @@ static void macio_escc_legacy_setup(MacIOState *macio_state)
|
||||
0xF0, 0xE0,
|
||||
};
|
||||
|
||||
memory_region_init(escc_legacy, NULL, "escc-legacy", 256);
|
||||
memory_region_init(escc_legacy, OBJECT(macio_state), "escc-legacy", 256);
|
||||
for (i = 0; i < ARRAY_SIZE(maps); i += 2) {
|
||||
MemoryRegion *port = g_new(MemoryRegion, 1);
|
||||
memory_region_init_alias(port, NULL, "escc-legacy-port",
|
||||
memory_region_init_alias(port, OBJECT(macio_state), "escc-legacy-port",
|
||||
macio_state->escc_mem, maps[i+1], 0x2);
|
||||
memory_region_add_subregion(escc_legacy, maps[i], port);
|
||||
}
|
||||
@@ -131,6 +131,10 @@ static void macio_common_realize(PCIDevice *d, Error **errp)
|
||||
MacIOState *s = MACIO(d);
|
||||
SysBusDevice *sysbus_dev;
|
||||
Error *err = NULL;
|
||||
MemoryRegion *dbdma_mem;
|
||||
|
||||
s->dbdma = DBDMA_init(&dbdma_mem);
|
||||
memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem);
|
||||
|
||||
object_property_set_bool(OBJECT(&s->cuda), true, "realized", &err);
|
||||
if (err) {
|
||||
@@ -328,16 +332,12 @@ static void macio_newworld_init(Object *obj)
|
||||
static void macio_instance_init(Object *obj)
|
||||
{
|
||||
MacIOState *s = MACIO(obj);
|
||||
MemoryRegion *dbdma_mem;
|
||||
|
||||
memory_region_init(&s->bar, NULL, "macio", 0x80000);
|
||||
memory_region_init(&s->bar, obj, "macio", 0x80000);
|
||||
|
||||
object_initialize(&s->cuda, sizeof(s->cuda), TYPE_CUDA);
|
||||
qdev_set_parent_bus(DEVICE(&s->cuda), sysbus_get_default());
|
||||
object_property_add_child(obj, "cuda", OBJECT(&s->cuda), NULL);
|
||||
|
||||
s->dbdma = DBDMA_init(&dbdma_mem);
|
||||
memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_macio_oldworld = {
|
||||
|
||||
@@ -500,6 +500,8 @@ static void pci_vpb_class_init(ObjectClass *klass, void *data)
|
||||
dc->reset = pci_vpb_reset;
|
||||
dc->vmsd = &pci_vpb_vmstate;
|
||||
dc->props = pci_vpb_properties;
|
||||
/* Reason: object_unref() hangs */
|
||||
dc->cannot_destroy_with_object_finalize_yet = true;
|
||||
}
|
||||
|
||||
static const TypeInfo pci_vpb_info = {
|
||||
@@ -521,10 +523,19 @@ static void pci_realview_init(Object *obj)
|
||||
s->mem_win_size[2] = 0x08000000;
|
||||
}
|
||||
|
||||
static void pci_realview_class_init(ObjectClass *class, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(class);
|
||||
|
||||
/* Reason: object_unref() hangs */
|
||||
dc->cannot_destroy_with_object_finalize_yet = true;
|
||||
}
|
||||
|
||||
static const TypeInfo pci_realview_info = {
|
||||
.name = "realview_pci",
|
||||
.parent = TYPE_VERSATILE_PCI,
|
||||
.instance_init = pci_realview_init,
|
||||
.class_init = pci_realview_class_init,
|
||||
};
|
||||
|
||||
static void versatile_pci_register_types(void)
|
||||
|
||||
+3
-3
@@ -163,7 +163,7 @@ static void pxa2xx_pcmcia_initfn(Object *obj)
|
||||
sysbus_init_mmio(sbd, &s->container_mem);
|
||||
|
||||
/* Socket I/O Memory Space */
|
||||
memory_region_init_io(&s->iomem, NULL, &pxa2xx_pcmcia_io_ops, s,
|
||||
memory_region_init_io(&s->iomem, obj, &pxa2xx_pcmcia_io_ops, s,
|
||||
"pxa2xx-pcmcia-io", 0x04000000);
|
||||
memory_region_add_subregion(&s->container_mem, 0x00000000,
|
||||
&s->iomem);
|
||||
@@ -171,13 +171,13 @@ static void pxa2xx_pcmcia_initfn(Object *obj)
|
||||
/* Then next 64 MB is reserved */
|
||||
|
||||
/* Socket Attribute Memory Space */
|
||||
memory_region_init_io(&s->attr_iomem, NULL, &pxa2xx_pcmcia_attr_ops, s,
|
||||
memory_region_init_io(&s->attr_iomem, obj, &pxa2xx_pcmcia_attr_ops, s,
|
||||
"pxa2xx-pcmcia-attribute", 0x04000000);
|
||||
memory_region_add_subregion(&s->container_mem, 0x08000000,
|
||||
&s->attr_iomem);
|
||||
|
||||
/* Socket Common Memory Space */
|
||||
memory_region_init_io(&s->common_iomem, NULL, &pxa2xx_pcmcia_common_ops, s,
|
||||
memory_region_init_io(&s->common_iomem, obj, &pxa2xx_pcmcia_common_ops, s,
|
||||
"pxa2xx-pcmcia-common", 0x04000000);
|
||||
memory_region_add_subregion(&s->container_mem, 0x0c000000,
|
||||
&s->common_iomem);
|
||||
|
||||
+12
-8
@@ -2134,14 +2134,6 @@ static void virtio_tablet_initfn(Object *obj)
|
||||
TYPE_VIRTIO_TABLET);
|
||||
}
|
||||
|
||||
static void virtio_host_initfn(Object *obj)
|
||||
{
|
||||
VirtIOInputHostPCI *dev = VIRTIO_INPUT_HOST_PCI(obj);
|
||||
|
||||
virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
|
||||
TYPE_VIRTIO_INPUT_HOST);
|
||||
}
|
||||
|
||||
static const TypeInfo virtio_input_pci_info = {
|
||||
.name = TYPE_VIRTIO_INPUT_PCI,
|
||||
.parent = TYPE_VIRTIO_PCI,
|
||||
@@ -2180,12 +2172,22 @@ static const TypeInfo virtio_tablet_pci_info = {
|
||||
.instance_init = virtio_tablet_initfn,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
static void virtio_host_initfn(Object *obj)
|
||||
{
|
||||
VirtIOInputHostPCI *dev = VIRTIO_INPUT_HOST_PCI(obj);
|
||||
|
||||
virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
|
||||
TYPE_VIRTIO_INPUT_HOST);
|
||||
}
|
||||
|
||||
static const TypeInfo virtio_host_pci_info = {
|
||||
.name = TYPE_VIRTIO_INPUT_HOST_PCI,
|
||||
.parent = TYPE_VIRTIO_INPUT_PCI,
|
||||
.instance_size = sizeof(VirtIOInputHostPCI),
|
||||
.instance_init = virtio_host_initfn,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* virtio-pci-bus */
|
||||
|
||||
@@ -2233,7 +2235,9 @@ static void virtio_pci_register_types(void)
|
||||
type_register_static(&virtio_keyboard_pci_info);
|
||||
type_register_static(&virtio_mouse_pci_info);
|
||||
type_register_static(&virtio_tablet_pci_info);
|
||||
#ifdef CONFIG_LINUX
|
||||
type_register_static(&virtio_host_pci_info);
|
||||
#endif
|
||||
type_register_static(&virtio_pci_bus_info);
|
||||
type_register_static(&virtio_pci_info);
|
||||
#ifdef CONFIG_VIRTFS
|
||||
|
||||
@@ -267,6 +267,8 @@ struct VirtIOInputHIDPCI {
|
||||
VirtIOInputHID vdev;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_LINUX
|
||||
|
||||
#define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci"
|
||||
#define VIRTIO_INPUT_HOST_PCI(obj) \
|
||||
OBJECT_CHECK(VirtIOInputHostPCI, (obj), TYPE_VIRTIO_INPUT_HOST_PCI)
|
||||
@@ -276,6 +278,8 @@ struct VirtIOInputHostPCI {
|
||||
VirtIOInputHost vdev;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* virtio-gpu-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
|
||||
@@ -114,6 +114,19 @@ typedef struct DeviceClass {
|
||||
* TODO remove once we're there
|
||||
*/
|
||||
bool cannot_instantiate_with_device_add_yet;
|
||||
/*
|
||||
* Does this device model survive object_unref(object_new(TNAME))?
|
||||
* All device models should, and this flag shouldn't exist. Some
|
||||
* devices crash in object_new(), some crash or hang in
|
||||
* object_unref(). Makes introspecting properties with
|
||||
* qmp_device_list_properties() dangerous. Bad, because it's used
|
||||
* by -device FOO,help. This flag serves to protect that code.
|
||||
* It should never be set without a comment explaining why it is
|
||||
* set.
|
||||
* TODO remove once we're there
|
||||
*/
|
||||
bool cannot_destroy_with_object_finalize_yet;
|
||||
|
||||
bool hotpluggable;
|
||||
|
||||
/* callbacks */
|
||||
|
||||
@@ -887,8 +887,8 @@ struct input_keymap_entry {
|
||||
#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
|
||||
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
|
||||
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
|
||||
#define SW_MAX 0x0f
|
||||
#define SW_CNT (SW_MAX+1)
|
||||
#define SW_MAX_ 0x0f
|
||||
#define SW_CNT (SW_MAX_+1)
|
||||
|
||||
/*
|
||||
* Misc events
|
||||
|
||||
@@ -1304,7 +1304,22 @@ static void memory_region_finalize(Object *obj)
|
||||
{
|
||||
MemoryRegion *mr = MEMORY_REGION(obj);
|
||||
|
||||
assert(QTAILQ_EMPTY(&mr->subregions));
|
||||
assert(!mr->container);
|
||||
|
||||
/* We know the region is not visible in any address space (it
|
||||
* does not have a container and cannot be a root either because
|
||||
* it has no references, so we can blindly clear mr->enabled.
|
||||
* memory_region_set_enabled instead could trigger a transaction
|
||||
* and cause an infinite loop.
|
||||
*/
|
||||
mr->enabled = false;
|
||||
memory_region_transaction_begin();
|
||||
while (!QTAILQ_EMPTY(&mr->subregions)) {
|
||||
MemoryRegion *subregion = QTAILQ_FIRST(&mr->subregions);
|
||||
memory_region_del_subregion(mr, subregion);
|
||||
}
|
||||
memory_region_transaction_commit();
|
||||
|
||||
mr->destructor(mr);
|
||||
memory_region_clear_coalescing(mr);
|
||||
g_free((char *)mr->name);
|
||||
|
||||
+6
-3
@@ -237,9 +237,12 @@ int qdev_device_help(QemuOpts *opts)
|
||||
return 0;
|
||||
}
|
||||
|
||||
qdev_get_device_class(&driver, &local_err);
|
||||
if (local_err) {
|
||||
goto error;
|
||||
if (!object_class_by_name(driver)) {
|
||||
const char *typename = find_typename_by_alias(driver);
|
||||
|
||||
if (typename) {
|
||||
driver = typename;
|
||||
}
|
||||
}
|
||||
|
||||
prop_list = qmp_device_list_properties(driver, &local_err);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user