summaryrefslogtreecommitdiffstats
path: root/include/qom
Commit message (Collapse)AuthorAgeFilesLines
* exec.c: Capture the memory attributes for a watchpoint hitPeter Maydell2015-04-261-0/+2
| | | | | | | | | | | | Capture the memory attributes for the transaction which triggered a watchpoint; this allows CPU specific code to implement features like ARM's "user-mode only WPs also hit for LDRT/STRT accesses made from privileged code". This change also correctly passes through the memory attributes to the underlying device when a watchpoint access doesn't hit. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
* qom: Add can_be_deleted callback to UserCreatableClassLin Ma2015-04-011-0/+13
| | | | | | | | | | If backends implement the can_be_deleted and it returns false, Then the qmp_object_del won't delete the given backends. Signed-off-by: Lin Ma <lma@suse.com> Message-Id: <1427704589-7688-2-git-send-email-lma@suse.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Fix remaining warnings from Sparse (void return)Stefan Weil2015-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Sparse report: hw/display/vga.c:2000:5: warning: returning void-valued expression hw/intc/arm_gic.c:707:9: warning: returning void-valued expression hw/intc/etraxfs_pic.c:138:9: warning: returning void-valued expression hw/nvram/fw_cfg.c:475:5: warning: returning void-valued expression hw/timer/a9gtimer.c:124:5: warning: returning void-valued expression hw/tpm/tpm_tis.c:794:5: warning: returning void-valued expression hw/usb/hcd-musb.c:558:9: warning: returning void-valued expression hw/usb/hcd-musb.c:776:13: warning: returning void-valued expression hw/usb/hcd-musb.c:867:5: warning: returning void-valued expression hw/usb/hcd-musb.c:932:5: warning: returning void-valued expression include/qom/cpu.h:584:5: warning: returning void-valued expression monitor.c:4686:13: warning: returning void-valued expression monitor.c:4690:13: warning: returning void-valued expression Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Andreas Färber <afaerber@suse.de> Cc: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* cpu: Add missing documentation for some CPUClass methodsPeter Maydell2015-03-101-0/+12
| | | | | | | | | | The CPUClass QOM methods virtio_is_big_endian, write_elf{32,64}_note and write_elf{32,64}_qemunote were added without any description being added to the doc comment. Correct this omission. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* Generalize QOM publishing of date and time from mc146818rtc.cDavid Gibson2015-03-091-0/+14
| | | | | | | | | | | | | | The mc146818rtc driver exposes the current RTC date and time via the "date" property in QOM (which is also aliased to the machine's "rtc-time" property). Currently it uses a custom visitor function rtc_get_date to do this. This patch introduces new helpers to the QOM core to expose struct tm valued properties via a getter function, so that this functionality can be more easily duplicated in other RTC implementations. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
* Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' ↵Peter Maydell2015-03-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging QOM infrastructure fixes and device conversions * Assertion fix for device_add with non-device types * Documentation fix * qdev_init() error reporting cleanups # gpg: Signature made Tue Feb 24 13:56:33 2015 GMT using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: parallel: parallel_hds_isa_init() shouldn't fail parallel: Factor out common parallel_hds_isa_init() serial: serial_hds_isa_init() shouldn't fail serial: Factor out common serial_hds_isa_init() etsec: Replace qdev_init() by qdev_init_nofail() leon3: Replace unchecked qdev_init() by qdev_init_nofail() ide/isa: Replace unchecked qdev_init() by qdev_init_nofail() qdev: Improve qdev_init_nofail()'s error reporting qom: Fix typo, 'my_class_init' -> 'derived_class_init' qdev: Avoid type assertion in qdev_build_hotpluggable_device_list() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * qom: Fix typo, 'my_class_init' -> 'derived_class_init'Zhoujian2015-02-161-1/+1
| | | | | | | | | | | | Signed-off-by: Zhoujian <jianjay.zhou@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* | exec: make iotlb RCU-friendlyPaolo Bonzini2015-02-161-0/+1
|/ | | | | | | | | | | | | After the previous patch, TLBs will be flushed on every change to the memory mapping. This patch augments that with synchronization of the MemoryRegionSections referred to in the iotlb array. With this change, it is guaranteed that iotlb_to_region will access the correct memory map, even once the TLB will be accessed outside the BQL. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qom: Add description field in ObjectProperty structGonglei2014-10-151-0/+14
| | | | | | | | | | | | | The descriptions can serve as documentation in the code, and they can be used to provide better help. Copy property descriptions when copying alias properties. Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* gdbstub: Allow target CPUs to specify watchpoint STOP_BEFORE_ACCESS flagPeter Maydell2014-10-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | GDB assumes that watchpoint set via the gdbstub remote protocol will behave in the same way as hardware watchpoints for the target. In particular, whether the CPU stops with the PC before or after the insn which triggers the watchpoint is target dependent. Allow guest CPU code to specify which behaviour to use. This fixes a bug where with guest CPUs which stop before the accessing insn GDB would manually step forward over what it thought was the insn and end up one insn further forward than it should be. We set this flag for the CPU architectures which set gdbarch_have_nonsteppable_watchpoint in gdb 7.7: ARM, CRIS, LM32, MIPS and Xtensa. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Tested-by: Max Filippov <jcmvbkbc@gmail.com> Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Tested-by: Michael Walle <michael@walle.cc> (for lm32) Message-id: 1410545057-14014-1-git-send-email-peter.maydell@linaro.org
* qom: Add cpu_exec_interrupt hookRichard Henderson2014-09-251-0/+2
| | | | | | | | | | | Continuing the removal of ifdefs from cpu_exec. Cc: Andreas Färber <afaerber@suse.de> Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1410626734-3804-7-git-send-email-rth@twiddle.net Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* qom: Add cpu_exec_enter and cpu_exec_exit hooksRichard Henderson2014-09-251-0/+5
| | | | | | | | | | In preparation for removing a bunch of ifdefs from cpu_exec. Cc: Andreas Färber <afaerber@suse.de> Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1410626734-3804-2-git-send-email-rth@twiddle.net Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* cpu-exec: Make debug_excp_handler a QOM CPU methodPeter Maydell2014-09-121-0/+2
| | | | | | | Make the debug_excp_handler target specific hook into a QOM CPU method. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* exec.c: Record watchpoint fault address and directionPeter Maydell2014-09-121-1/+5
| | | | | | | | | | When we check whether we've hit a watchpoint we know the address that we were attempting to access and whether it was a read or a write. Record this information in the CPUWatchpoint struct so that target-specific code can report it to the guest. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
* exec.c: Relax restrictions on watchpoint length and alignmentPeter Maydell2014-09-121-1/+1
| | | | | | | | | | | The current implementation of watchpoints requires that they have a power of 2 length which is not greater than TARGET_PAGE_SIZE and that their address is a multiple of their length. Watchpoints on ARM don't fit these restrictions, so change the implementation so they can be relaxed. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
* qom: add a generic mechanism to resolve pathsPaolo Bonzini2014-07-011-5/+29
| | | | | | | | | | | | | It may be desirable to have custom link<> properties that do more than just store an object. Even the addition of a "check" function is not enough if setting the link has side effects or if a non-standard reference counting is preferrable. Avoid the assumption that the opaque field of a link<> is a LinkProperty struct, by adding a generic "resolve" callback to ObjectProperty. This fixes aliases of link properties. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qom: add object_property_add_alias()Stefan Hajnoczi2014-07-011-0/+20
| | | | | | | | | | | | | | | | | Sometimes an object needs to present a property which is actually on another object, or it needs to provide an alias name for an existing property. Examples: a.foo -> b.foo a.old_name -> a.new_name The new object_property_add_alias() API allows objects to alias a property on the same object or another object. The source and target names can be different. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
* cpu: introduce CPUClass::virtio_is_big_endian()Greg Kurz2014-06-291-0/+1
| | | | | | | | | | | | | | | If we want to support targets that can change endianness (modern PPC and ARM for the moment), we need to add a per-CPU class method to be called from the virtio code. The virtio_ prefix in the name is a hint for people to avoid misusage (aka. anywhere but from the virtio code). The default behaviour is to return the compile-time default target endianness. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* qom: introduce object_property_get_enum and object_property_get_uint16ListHu Tao2014-06-191-0/+28
| | | | | | Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* softmmu: make do_unaligned_access a method of CPUPaolo Bonzini2014-06-051-2/+13
| | | | | | | | | We will reference it from more files in the next patch. To avoid ruining the small steps we're making towards multi-target, make it a method of CPU rather than just a global. Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* cpu: Avoid QOM casts for CPU()Andreas Färber2014-03-311-1/+6
| | | | | | | | | | | | | | | | | | | | | | | CPU address spaces touching load and store helpers as well as the movement of (almost) all fields from CPU_COMMON to CPUState have led to a noticeable increase of CPU() usage in "hot" paths for both TCG and KVM. While CPU()'s OBJECT_CHECK() might help detect development errors, i.e. in form of crashes due to QOM vs. non-QOM mismatches rather than QOM type mismatches, it is not really needed at runtime since mostly used in CPU-specific paths, coming from a target-specific CPU subtype. If that pointer is damaged, other errors are highly likely to occur elsewhere anyway. Keep the CPU() macro for a consistent developer experience and for flexibility to exchange its implementation, but turn it into a pure, unchecked C cast for now. Compare commit 6e42be7cd10260fd3a006d94f6c870692bf7a2c0. Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* Merge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-2.0' into ↵Peter Maydell2014-03-191-1/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging QOM CPUState refactorings / X86CPU * CPUState layout optimization for TCG # gpg: Signature made Wed 19 Mar 2014 21:51:46 GMT using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-cpu-for-2.0: cpu: Move tcg_exit_req to the end of CPUState Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * cpu: Move tcg_exit_req to the end of CPUStateRichard Henderson2014-03-191-1/+6
| | | | | | | | | | | | | | Reverse an increase in the size of generated code. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
* | qom: Add check() argument to object_property_add_link()Stefan Hajnoczi2014-03-191-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are currently three types of object_property_add_link() callers: 1. The link property may be set at any time. 2. The link property of a DeviceState instance may only be set before realize. 3. The link property may never be set, it is read-only. Something similar can already be achieved with object_property_add_str()'s set() argument. Follow its example and add a check() argument to object_property_add_link(). Also provide default check() functions for case #1 and #2. Case #3 is covered by passing a NULL function pointer. Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com> Cc: Alexander Graf <agraf@suse.de> Cc: Anthony Liguori <aliguori@amazon.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Tweaked documentation comment] Signed-off-by: Andreas Färber <afaerber@suse.de>
* | qom: Make QOM link property unref optionalStefan Hajnoczi2014-03-191-1/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some object_property_add_link() callers expect property deletion to unref the link property object. Other callers expect to manage the refcount themselves. The former are currently broken and therefore leak the link property object. This patch adds a flags argument to object_property_add_link() so the caller can specify which refcount behavior they require. The new OBJ_PROP_LINK_UNREF_ON_RELEASE flag causes the link pointer to be unreferenced when the property is deleted. This fixes refcount leaks in qdev.c, xilinx_axidma.c, xilinx_axienet.c, s390-virtio-bus.c, virtio-pci.c, virtio-rng.c, and ui/console.c. Rationale for refcount behavior: * hw/core/qdev.c - bus children are explicitly unreferenced, don't interfere - parent_bus is essentially a read-only property that doesn't hold a refcount, don't unref - hotplug_handler is leaked, do unref * hw/dma/xilinx_axidma.c - rx stream "dma" links are set using set_link, therefore they need unref - tx streams are set using set_link, therefore they need unref * hw/net/xilinx_axienet.c - same reasoning as hw/dma/xilinx_axidma.c * hw/pcmcia/pxa2xx.c - pxa2xx bypasses set_link and therefore does not use refcounts * hw/s390x/s390-virtio-bus.c * hw/virtio/virtio-pci.c * hw/virtio/virtio-rng.c * ui/console.c - set_link is used and there is no explicit unref, do unref Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com> Cc: Alexander Graf <agraf@suse.de> Cc: Anthony Liguori <aliguori@amazon.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* exec: Change cpu_abort() argument to CPUStateAndreas Färber2014-03-131-0/+3
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* exec: Change cpu_breakpoint_{insert,remove{,_by_ref,_all}} argumentAndreas Färber2014-03-131-0/+15
| | | | | | Use CPUState. Allows to clean up CPUArchState in gdbstub. Signed-off-by: Andreas Färber <afaerber@suse.de>
* exec: Change cpu_watchpoint_{insert,remove{,_by_ref,_all}} argumentAndreas Färber2014-03-131-0/+7
| | | | | | Use CPUState. This lets us drop a few local env usages. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move breakpoints field from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+9
| | | | | | | | Most targets were using offsetof(CPUFooState, breakpoints) to determine how much of CPUFooState to clear on reset. Use the next field after CPU_COMMON instead, if any, or sizeof(CPUFooState) otherwise. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move watchpoint fields from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+10
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move opaque field from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+3
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move exception_index field from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+1
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move jmp_env field from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+2
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move tb_jmp_cache field from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+4
| | | | | | Clear it on reset. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move icount_decr field from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+19
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move icount_extra field from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+2
| | | | | | Reset it. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move can_do_io field from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+2
| | | | | | Rename can_do_io() to cpu_can_do_io() and change argument to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move mem_io_{pc,vaddr} fields from CPU_COMMON to CPUStateAndreas Färber2014-03-131-0/+8
| | | | | | Reset them. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Turn cpu_handle_mmu_fault() into a CPUClass hookAndreas Färber2014-03-131-0/+3
| | | | | | | | Note that while such functions may exist both for *-user and softmmu, only *-user uses the CPUState hook, while softmmu reuses the prototype for calling it directly. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Factor out cpu_generic_init()Andreas Färber2014-03-131-0/+11
| | | | | | | All targets using it gain the ability to set -cpu name,key=value,... options via the default TYPE_CPU CPUClass::parse_features() implementation. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Introduce CPUClass::parse_features() hookAndreas Färber2014-03-131-0/+2
| | | | | | | | Adapt the X86CPU implementation to suit the generic hook. This involves a cleanup of error handling to cope with NULL errp. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Turn cpu_has_work() into a CPUClass hookAndreas Färber2014-03-131-2/+10
| | | | | | | | | Default to false. Tidy variable naming and inline cast uses while at it. Tested-by: Jia Liu <proljc@gmail.com> (or32) Signed-off-by: Andreas Färber <afaerber@suse.de>
* object: add object_get_canonical_path_component()Stefan Hajnoczi2014-03-131-0/+8
| | | | | | | | | It is often useful to find an object's child property name. Also use this new function to simplify the implementation of object_get_canonical_path(). Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* dump: const-qualify the buf of WriteCoreDumpFunctionqiaonuohan2014-02-281-1/+2
| | | | | | | | | WriteCoreDumpFunction is a function pointer that points to the function used to write content in "buf" into core file, so "buf" should be const-qualify. Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qapi: Add human mode to StringOutputVisitorPaolo Bonzini2014-02-141-1/+2
| | | | | | | | | | | | This will be used by "info qtree". For numbers it prints both the decimal and hex values. For sizes it rounds to the nearest power of 2^10. For strings, it puts quotes around the string and separates NULL and empty string. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Add per-cpu address spaceEdgar E. Iglesias2014-02-111-0/+3
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
* add optional 2nd stage initialization to -object/object-add commandsIgor Mammedov2014-01-281-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | Introduces USER_CREATABLE interface that must be implemented by objects which are designed to created with -object CLI option or object-add QMP command. Interface provides an ability to do an optional second stage initialization of the object created with -object/object-add commands. By providing complete() callback, which is called after the object properties were set. It allows to: * prevents misusing of -object/object-add by filtering out objects that are not designed for it. * generalize second stage backend initialization instead of adding custom APIs to perform it * early error detection of backend initialization at -object/ object-add time rather than through a proxy DEVICE object that tries to use backend. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qom: Do not register interface "types" in the type table and fix namesPaolo Bonzini2013-12-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | There should be no need to look up nor enumerate the interface "types", whose "classes" are really just vtables. Just create the types and add them to the interface list of the parent type. Interfaces not registering their type anymore means that accessing superclass::interface by type name will fail when initializing subclass::interface. Thus, we need to pre-initialize the subclass's parent_type field before calling type_initialize. Apart from this, the interface "types" should never be used and thus it is harmless to leave them out of the hashtable. Further, the interface types had a bug with interfaces that are inherited from a superclass: The implementation type name was wrong (for example it was subclass::superclass::interface rather than just subclass::interface). This patch fixes this as well. Reported-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Split out object and class cachesPeter Crosthwaite2013-12-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The object-cast and class-cast caches cannot be shared because class caching is conditional on the target type not being an interface and object caching is unconditional. Leads to a bug when a class cast to an interface follows an object cast to the same interface type: FooObject = FOO(obj); FooClass = FOO_GET_CLASS(obj); Where TYPE_FOO is an interface. The first (object) cast will be successful and cache the casting result (i.e. TYPE_FOO will be cached). The second (class) cast will then check the shared cast cache and register a hit. The issue is, when a class cast hits in the cache it just returns a pointer cast of the input class (i.e. the concrete class). When casting to an interface, the cast itself must return the interface class, not the concrete class. The implementation of class cast caching already ensures that the returned cast result is only a pointer cast before caching. The object cast logic however does not have this check. Resolve by just splitting the object and class caches. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Nathan Rossi <nathan.rossi@xilinx.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qom: Fix pointer to int property helpers' documentationMichael S. Tsirkin2013-11-051-21/+52
| | | | | | Relocate to alongside the other object_property_add_* helpers while at it. Signed-off-by: Andreas Färber <afaerber@suse.de>
OpenPOWER on IntegriCloud