CPU DeviceState v8
cover CPU DeviceState v8
Changes on v8:
- Use a simpler copyright header on qdev-properties-system.c
- Use the new libqemustub.a mechanism instead of the (now exting) QEMU_WEAK_ALIAS mechanism
- Move the reset-handler registration code to a new hw/reset.c file
- This is based on afaerber's qom-cpu branch, that has some header cleanup changes. You can get the complete series in a git tree at:
https://github.com/ehabkost/qemu-hacks/tree/cpu_qdev.v8
git://github.com/ehabkost/qemu-hacks.git cpu_qdev.v8
v7:
- Use the new QEMU_WEAK_ALIAS mechanism instead of the (now extinct) GCC_WEAK attribute (patches 20 and 21)
v6:
- Simple rebase against latest qemu.git master
- Patch 13: some new typedefs were added and others were removed
- Patch 19: trivial rebase
v5:
- Tons of header cleanups just to eliminate qlist.h <-> cpu-common.h circular dependency (patches 1-17)
- Add copyright/license information to qdev-properties.c (patch 17)
- Add copyright/license information to qdev-properties-system.c (patch 22)
- use error_report()+abort() instead of hw_error() on qdev.c (patch 18)
- Move qemu_[un]register_reset() and qemu_devices_reset() to qdev-core.c (patch 19)
- Make vmstate_[un]register() weak stubs, instead of a new function (patch 20)
- Make sysbus_get_default() weak stub, instead of new qbus reset (un)register functions (patch 21)
- Eliminate qdev-system.c (all code is kept on qdev.c, now) (patch 22)
v4:
- Add GCC_WEAK_DECL to functions that have GCC_WEAK versions
- Updated the qdev_init_gpio_in() code on qdev-system.c to current version
- Patch description updates (moved changelog below "---" and/or move info about changes made by different authors between SoB lines)
v3 (submitted by Igor):
- rebased on top of 8b4a3df (today's master)
- slight code reshuffling in (see commit's changelog)
"qdev: separate core from the code used only by qemu-system-*" "move qemu_irq typedef out of cpu-common.h"
- commit messages cleanup
v2:
Removes the CONFIG_USER_ONLY ifdefs, and use weak symbols to move the vmstate and qemu_register_reset() handling to qdev-system.c
git tree for testing:
https://github.com/ehabkost/qemu-hacks/tree/cpu_qdev.v8
git://github.com/ehabkost/qemu-hacks.git cpu_qdev.v8
References to previous versions:
v7: http://article.gmane.org/gmane.comp.emulators.qemu/179969
v6: http://article.gmane.org/gmane.comp.emulators.qemu/179918
v5: http://article.gmane.org/gmane.comp.emulators.qemu/177426
v4: http://article.gmane.org/gmane.comp.emulators.qemu/176127
v3: http://article.gmane.org/gmane.comp.emulators.qemu/175980
v2: http://article.gmane.org/gmane.comp.emulators.qemu/173909
v1: http://article.gmane.org/gmane.comp.emulators.qemu/166630
Eduardo Habkost (9):
create qemu-types.h for struct typedefs
sysemu.h: include qemu-types.h instead of qemu-common.h move -I$(SRC_PATH)/include compiler flag to Makefile.objs
qdev: qdev_create(): use error_report() instead of hw_error()
qdev: move reset handler list from vl.c to hw/reset.c
qdev: add stubs for vmstate register/unregister functions
qdev: add sysbus_get_default() stub qdev-properties.c: separate core from the code used only by
qemu-system-*
include qdev code into *-user, too
Igor Mammedov (1):
qom: make CPU a child of DeviceState
Makefile | 1 - Makefile.objs | 23 ++- hw/Makefile.objs | 12 +- hw/ac97.c | 1 + hw/acpi_ich9.c | 1 + hw/acpi_piix4.c | 1 + hw/adb.c | 1 + hw/arm_boot.c | 1 + hw/armv7m.c | 1 + hw/bonito.c | 1 + hw/cirrus_vga.c | 1 + hw/cris-boot.c | 1 + hw/cs4231a.c | 1 + hw/cuda.c | 1 + hw/dma.c | 1 + hw/dp8393x.c | 1 + hw/eepro100.c | 1 + hw/es1370.c | 1 + hw/etraxfs_timer.c | 1 + hw/gt64xxx.c | 1 + hw/heathrow_pic.c | 1 + hw/hw.h | 5 - hw/ide/cmd646.c | 1 + hw/ide/macio.c | 1 + hw/ide/mmio.c | 1 + hw/ide/piix.c | 1 + hw/ide/via.c | 1 + hw/leon3.c | 1 + hw/lm32_boards.c | 1 + hw/lm832x.c | 1 + hw/loader.c | 1 + hw/mac_dbdma.c | 1 + hw/mac_nvram.c | 1 + hw/mc146818rtc.c | 1 + hw/microblaze_boot.c | 1 + hw/milkymist.c | 1 + hw/mips_fulong2e.c | 1 + hw/mips_jazz.c | 1 + hw/mips_malta.c | 1 + hw/mips_mipssim.c | 1 + hw/mips_r4k.c | 1 + hw/nseries.c | 1 + hw/omap1.c | 1 + hw/omap2.c | 1 + hw/openpic.c | 1 + hw/openrisc_sim.c | 1 + hw/parallel.c | 1 + hw/pc.c | 1 + hw/pckbd.c | 1 + hw/piix4.c | 1 + hw/piix_pci.c | 1 + hw/ppc/e500.c | 1 + hw/ppc405_boards.c | 1 + hw/ppc405_uc.c | 1 + hw/ppc440_bamboo.c | 1 + hw/ppc4xx_devs.c | 1 + hw/ppc4xx_pci.c | 1 + hw/ppc_newworld.c | 1 + hw/ppc_oldworld.c | 1 + hw/ppc_prep.c | 1 + hw/ppce500_spin.c | 1 + hw/ps2.c | 1 + hw/qdev-core.h | 11 +- hw/qdev-properties-system.c | 352 ++++++++++++++++++++++++++++++++++++++++++++ hw/qdev-properties.c | 321 +--------------------------------------- hw/qdev-properties.h | 1 + hw/qdev.c | 22 +-- hw/r2d.c | 1 + hw/rc4030.c | 1 + hw/reset.c | 43 ++++++ hw/reset.h | 11 ++ hw/s390-virtio-bus.c | 1 + hw/serial.c | 1 + hw/spapr.c | 1 + hw/sun4m.c | 1 + hw/sun4u.c | 1 + hw/tsc2005.c | 1 + hw/tsc210x.c | 1 + hw/usb/hcd-ehci.c | 1 + hw/usb/hcd-ohci.c | 1 + hw/usb/hcd-uhci.c | 1 + hw/vga.c | 1 + hw/virtex_ml507.c | 1 + hw/vt82c686.c | 1 + hw/xics.c | 1 + hw/xtensa_lx60.c | 1 + hw/xtensa_sim.c | 1 + include/qemu/cpu.h | 6 +- kvm-all.c | 1 + qemu-common.h | 52 +------ qemu-types.h | 61 ++++++++ qom/cpu.c | 3 +- stubs/Makefile.objs | 2 + stubs/sysbus.c | 6 + stubs/vmstate.c | 17 +++ sysemu.h | 3 +- target-i386/cpu.c | 1 + target-i386/kvm.c | 1 + vl.c | 41 +----- xen-all.c | 1 + 100 files changed, 616 insertions(+), 457 deletions(-) create mode 100644 hw/qdev-properties-system.c create mode 100644 hw/reset.c create mode 100644 hw/reset.h create mode 100644 qemu-types.h create mode 100644 stubs/sysbus.c create mode 100644 stubs/vmstate.c
Signature · 1 line
1.7.11.7
RFC 1/10 create qemu-types.h for struct typedefs
Instead of keeping all those struct typedefs on qemu-common.h, move it to a header that can be safely included by other headers, containing only the struct typedefs and not pulling other dependencies.
Also, move some of the qdev-core.h typedefs to the new file, too, so other headers don't need to include qdev-core.h only because of DeviceState and other typedefs.
This will help us remove qemu-common.h dependencies from some headers later.
--- hw/qdev-core.h | 11 +---------- qemu-common.h | 52 +------------------------------------------------ qemu-types.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 61 deletions(-) create mode 100644 qemu-types.h
hw/qdev-core.h +1 -10
@@ -3,20 +3,11 @@#include "qemu-queue.h" #include "qemu-option.h" +#include "qemu-types.h" #include "qemu/object.h" #include "hw/irq.h" #include "error.h" -typedef struct Property Property ; - -typedef struct PropertyInfo PropertyInfo ; - -typedef struct CompatProperty CompatProperty ; - -typedef struct BusState BusState ; - -typedef struct BusClass BusClass ; -enum DevState {DEV_STATE_CREATED =1 ,DEV_STATE_INITIALIZED ,
qemu-common.h +1 -51
70 lines not on this page · raw message
qemu-types.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
1.7.11.7
RFC 2/10 sysemu.h: include qemu-types.h instead of qemu-common.h
In reply to Eduardo HabkostIt just needs the Monitor and DeviceState typedefs, so it doesn't need all of qemu-common.h.
--- sysemu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sysemu.h +1 -1
@@ -2,7 +2,7 @@#define SYSEMU_H /* Misc. things related to the system emulator. */ -#include "qemu-common.h" +#include "qemu-types.h" #include "qemu-option.h" #include "qemu-queue.h" #include "qemu-timer.h"
Signature · 1 line
1.7.11.7
RFC 3/10 move -I$(SRC_PATH)/include compiler flag to Makefile.objs
In reply to Eduardo HabkostThe flag is necessary for code that doesn't use the variables from Makefile (but use Makefile.objs), like libcacard/ and stubs/.
--- Makefile | 1 - Makefile.objs | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-)
Makefile +0 -1
@@ -145,7 +145,6 @@ audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS) QEMU_CFLAGS+=$(CURL_CFLAGS) -QEMU_CFLAGS += -I$(SRC_PATH)/include ui/cocoa.o: ui/cocoa.m
Makefile.objs +9 -6
@@ -1,4 +1,13 @@ ####################################################################### +# general compiler flags + +QEMU_CFLAGS += $(GLIB_CFLAGS) +QEMU_CFLAGS += -I$(SRC_PATH)/include + +vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) +vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) + +####################################################################### # Stub library, linked in tools stub-obj-y = stubs/
@@ -236,12 +245,6 @@ universal-obj-y += $(qapi-obj-y) qga-obj-y = qga/ qemu-ga.o module.o qemu-tool.o qga-obj-$(CONFIG_POSIX) += qemu-sockets.o qemu-option.o -vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) - -vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) - -QEMU_CFLAGS+=$(GLIB_CFLAGS) - nested-vars += \ stub-obj-y \ qga-obj-y \
Signature · 1 line
1.7.11.7
RFC 4/10 qdev: qdev_create(): use error_report() instead of hw_error()
In reply to Eduardo Habkosthw_error() is specific for fatal hardware emulation errors, not for internal errors related to the qdev object/class abstraction or object initialization.
Replace it with an error_report() call, followed by abort().
This will also help reduce dependencies of the qdev code (as hw_error() is from cpus.o, and depends on the CPU list from exec.o).
--- hw/qdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/qdev.c +5 -3
@@ -109,10 +109,12 @@ DeviceState *qdev_create(BusState *bus, const char *name) dev =qdev_try_create (bus, name);if (!dev) {if (bus) { -hw_error ("Unknown device '%s' for bus '%s'\n" , name, -object_get_typename (OBJECT (bus))); +error_report ("Unknown device '%s' for bus '%s'\n" , name, +object_get_typename (OBJECT (bus))); +abort (); }else { -hw_error ("Unknown device '%s' for default sysbus\n" , name); +error_report ("Unknown device '%s' for default sysbus\n" , name); +abort (); } }
Signature · 1 line
1.7.11.7
RFC 5/10 qdev: move reset handler list from vl.c to hw/reset.c
In reply to Eduardo HabkostThe core qdev code uses the reset handler list from vl.c, and currently *-user has some hacks to make CPU reset work.
This moves qemu_register_reset(), qemu_unregister_reset() and qemu_devices_reset() to a new file, hw/reset.c, that can be used by qdev and by *-user.
--- hw/Makefile.objs | 1 + hw/ac97.c | 1 + hw/acpi_ich9.c | 1 + hw/acpi_piix4.c | 1 + hw/adb.c | 1 + hw/arm_boot.c | 1 + hw/armv7m.c | 1 + hw/bonito.c | 1 + hw/cirrus_vga.c | 1 + hw/cris-boot.c | 1 + hw/cs4231a.c | 1 + hw/cuda.c | 1 + hw/dma.c | 1 + hw/dp8393x.c | 1 + hw/eepro100.c | 1 + hw/es1370.c | 1 + hw/etraxfs_timer.c | 1 + hw/gt64xxx.c | 1 + hw/heathrow_pic.c | 1 + hw/hw.h | 5 ----- hw/ide/cmd646.c | 1 + hw/ide/macio.c | 1 + hw/ide/mmio.c | 1 + hw/ide/piix.c | 1 + hw/ide/via.c | 1 + hw/leon3.c | 1 + hw/lm32_boards.c | 1 + hw/lm832x.c | 1 + hw/loader.c | 1 + hw/mac_dbdma.c | 1 + hw/mac_nvram.c | 1 + hw/mc146818rtc.c | 1 + hw/microblaze_boot.c | 1 + hw/milkymist.c | 1 + hw/mips_fulong2e.c | 1 + hw/mips_jazz.c | 1 + hw/mips_malta.c | 1 + hw/mips_mipssim.c | 1 + hw/mips_r4k.c | 1 + hw/nseries.c | 1 + hw/omap1.c | 1 + hw/omap2.c | 1 + hw/openpic.c | 1 + hw/openrisc_sim.c | 1 + hw/parallel.c | 1 + hw/pc.c | 1 + hw/pckbd.c | 1 + hw/piix4.c | 1 + hw/piix_pci.c | 1 + hw/ppc/e500.c | 1 + hw/ppc405_boards.c | 1 + hw/ppc405_uc.c | 1 + hw/ppc440_bamboo.c | 1 + hw/ppc4xx_devs.c | 1 + hw/ppc4xx_pci.c | 1 + hw/ppc_newworld.c | 1 + hw/ppc_oldworld.c | 1 + hw/ppc_prep.c | 1 + hw/ppce500_spin.c | 1 + hw/ps2.c | 1 + hw/qdev.c | 1 + hw/r2d.c | 1 + hw/rc4030.c | 1 + hw/reset.c | 43 +++++++++++++++++++++++++++++++++++++++++++ hw/reset.h | 11 +++++++++++ hw/s390-virtio-bus.c | 1 + hw/serial.c | 1 + hw/spapr.c | 1 + hw/sun4m.c | 1 + hw/sun4u.c | 1 + hw/tsc2005.c | 1 + hw/tsc210x.c | 1 + hw/usb/hcd-ehci.c | 1 + hw/usb/hcd-ohci.c | 1 + hw/usb/hcd-uhci.c | 1 + hw/vga.c | 1 + hw/virtex_ml507.c | 1 + hw/vt82c686.c | 1 + hw/xics.c | 1 + hw/xtensa_lx60.c | 1 + hw/xtensa_sim.c | 1 + kvm-all.c | 1 + sysemu.h | 1 - target-i386/cpu.c | 1 + target-i386/kvm.c | 1 + vl.c | 41 +---------------------------------------- xen-all.c | 1 + 87 files changed, 137 insertions(+), 46 deletions(-) create mode 100644 hw/reset.c create mode 100644 hw/reset.h
hw/Makefile.objs +1 -0
@@ -1,5 +1,6 @@ common-obj-y = usb/ ide/ common-obj-y += loader.o +common-obj-y += reset.o common-obj-$(CONFIG_VIRTIO) += virtio-console.o common-obj-$(CONFIG_VIRTIO) += virtio-rng.o common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
hw/ac97.c +1 -0
@@ -17,6 +17,7 @@* GNU GPL, version 2 or (at your option) any later version. */ +#include "hw/reset.h" #include "hw.h" #include "audiodev.h" #include "audio/audio.h"
hw/acpi_ich9.c +1 -0
@@ -22,6 +22,7 @@* * This is based on acpi.c. */ +#include "hw/reset.h" #include "hw.h" #include "pc.h" #include "pci.h"
hw/acpi_piix4.c +1 -0
@@ -18,6 +18,7 @@* Contributions after 2012-01-13 are licensed under the terms of the * GNU GPL, version 2 or (at your option) any later version. */ +#include "hw/reset.h" #include "hw.h" #include "pc.h" #include "apm.h"
hw/adb.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "adb.h" #include "console.h"
hw/arm_boot.c +1 -0
@@ -8,6 +8,7 @@*/ #include "config.h" +#include "hw/reset.h" #include "hw.h" #include "arm-misc.h" #include "sysemu.h"
hw/armv7m.c +1 -0
@@ -7,6 +7,7 @@* This code is licensed under the GPL. */ +#include "hw/reset.h" #include "sysbus.h" #include "arm-misc.h" #include "loader.h"
hw/bonito.c +1 -0
@@ -39,6 +39,7 @@#include <assert.h> +#include "hw/reset.h" #include "hw.h" #include "pci.h" #include "pc.h"
hw/cirrus_vga.c +1 -0
@@ -26,6 +26,7 @@* Reference: Finn Thogersons' VGADOC4b * available at http://home.worldonline.dk/~finth/ */ +#include "hw/reset.h" #include "hw.h" #include "pci.h" #include "console.h"
hw/cris-boot.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "loader.h" #include "elf.h"
hw/cs4231a.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "audiodev.h" #include "audio/audio.h"
hw/cuda.c +1 -0
@@ -22,6 +22,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "ppc_mac.h" #include "adb.h"
hw/dma.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "isa.h"
hw/dp8393x.c +1 -0
@@ -17,6 +17,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "hw/reset.h" #include "hw.h" #include "qemu-timer.h" #include "net.h"
hw/eepro100.c +1 -0
@@ -41,6 +41,7 @@*/ #include <stddef.h> /* offsetof */ +#include "hw/reset.h" #include "hw.h" #include "pci.h" #include "net.h"
hw/es1370.c +1 -0
@@ -26,6 +26,7 @@/* #define VERBOSE_ES1370 */ #define SILENT_ES1370 +#include "hw/reset.h" #include "hw.h" #include "audiodev.h" #include "audio/audio.h"
hw/etraxfs_timer.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ #include "sysbus.h" +#include "hw/reset.h" #include "sysemu.h" #include "qemu-timer.h" #include "ptimer.h"
hw/gt64xxx.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "mips.h" #include "pci.h"
hw/heathrow_pic.c +1 -0
@@ -22,6 +22,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "ppc_mac.h"
hw/hw.h +0 -5
@@ -37,11 +37,6 @@#endif #endif -typedef void QEMUResetHandler (void *opaque); - -void qemu_register_reset (QEMUResetHandler *func,void *opaque); -void qemu_unregister_reset (QEMUResetHandler *func,void *opaque); -/* handler to set the boot_device order for a specific type of QEMUMachine */ /* return 0 if success */ typedef int QEMUBootSetHandler (void *opaque,const char *boot_devices);
hw/ide/cmd646.c +1 -0
@@ -27,6 +27,7 @@#include <hw/pci.h> #include <hw/isa.h> #include "block.h" +#include "hw/reset.h" #include "sysemu.h" #include "dma.h"
hw/ide/macio.c +1 -0
@@ -22,6 +22,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include <hw/hw.h> #include <hw/ppc_mac.h> #include <hw/mac_dbdma.h>
hw/ide/mmio.c +1 -0
@@ -22,6 +22,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include <hw/hw.h> #include "block.h" #include "dma.h"
hw/ide/piix.c +1 -0
@@ -28,6 +28,7 @@#include <hw/pci.h> #include <hw/isa.h> #include "blockdev.h" +#include "hw/reset.h" #include "sysemu.h" #include "dma.h"
hw/ide/via.c +1 -0
@@ -28,6 +28,7 @@#include <hw/pci.h> #include <hw/isa.h> #include "block.h" +#include "hw/reset.h" #include "sysemu.h" #include "dma.h"
hw/leon3.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "qemu-timer.h" #include "ptimer.h"
hw/lm32_boards.c +1 -0
@@ -18,6 +18,7 @@*/ #include "sysbus.h" +#include "hw/reset.h" #include "hw.h" #include "net.h" #include "flash.h"
hw/lm832x.c +1 -0
@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "hw/reset.h" #include "hw.h" #include "i2c.h" #include "qemu-timer.h"
hw/loader.c +1 -0
@@ -42,6 +42,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "hw/reset.h" #include "hw.h" #include "disas.h" #include "monitor.h"
hw/mac_dbdma.c +1 -0
@@ -36,6 +36,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "isa.h" #include "mac_dbdma.h"
hw/mac_nvram.c +1 -0
@@ -22,6 +22,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "firmware_abi.h" #include "sysemu.h"
hw/mc146818rtc.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "qemu-timer.h" #include "sysemu.h"
hw/microblaze_boot.c +1 -0
@@ -28,6 +28,7 @@#include "qemu-config.h" #include "qemu-common.h" #include "device_tree.h" +#include "hw/reset.h" #include "loader.h" #include "elf.h"
hw/milkymist.c +1 -0
@@ -18,6 +18,7 @@*/ #include "sysbus.h" +#include "hw/reset.h" #include "hw.h" #include "net.h" #include "flash.h"
hw/mips_fulong2e.c +1 -0
@@ -18,6 +18,7 @@* http://www.loongsondeveloper.com/doc/Loongson2EUserGuide.pdf */ +#include "hw/reset.h" #include "hw.h" #include "pc.h" #include "serial.h"
hw/mips_jazz.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "mips.h" #include "mips_cpudevs.h"
hw/mips_malta.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "pc.h" #include "serial.h"
hw/mips_mipssim.c +1 -0
@@ -24,6 +24,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "mips.h" #include "mips_cpudevs.h"
hw/mips_r4k.c +1 -0
@@ -7,6 +7,7 @@* All peripherial devices are attached to this "bus" with * the standard PC ISA addresses. */ +#include "hw/reset.h" #include "hw.h" #include "mips.h" #include "mips_cpudevs.h"
hw/nseries.c +1 -0
@@ -28,6 +28,7 @@#include "i2c.h" #include "devices.h" #include "flash.h" +#include "hw/reset.h" #include "hw.h" #include "bt.h" #include "loader.h"
hw/omap1.c +1 -0
@@ -16,6 +16,7 @@* You should have received a copy of the GNU General Public License along * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "hw/reset.h" #include "hw.h" #include "arm-misc.h" #include "omap.h"
hw/omap2.c +1 -0
@@ -19,6 +19,7 @@*/ #include "blockdev.h" +#include "hw/reset.h" #include "hw.h" #include "arm-misc.h" #include "omap.h"
hw/openpic.c +1 -0
@@ -33,6 +33,7 @@* Serial interrupts, as implemented in Raven chipset are not supported yet. * */ +#include "hw/reset.h" #include "hw.h" #include "ppc_mac.h" #include "pci.h"
hw/openrisc_sim.c +1 -0
@@ -18,6 +18,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ +#include "hw/reset.h" #include "hw.h" #include "boards.h" #include "elf.h"
hw/parallel.c +1 -0
@@ -22,6 +22,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "qemu-char.h" #include "isa.h"
hw/pc.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "pc.h" #include "serial.h"
hw/pckbd.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "isa.h" #include "pc.h"
hw/piix4.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "pc.h" #include "pci.h"
hw/piix_pci.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "pc.h" #include "pci.h"
hw/ppc/e500.c +1 -0
@@ -18,6 +18,7 @@#include "qemu-common.h" #include "e500.h" #include "net.h" +#include "hw/reset.h" #include "hw/hw.h" #include "hw/serial.h" #include "hw/pci.h"
hw/ppc405_boards.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "ppc.h" #include "ppc405.h"
hw/ppc405_uc.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "ppc.h" #include "ppc405.h"
hw/ppc440_bamboo.c +1 -0
@@ -14,6 +14,7 @@#include "config.h" #include "qemu-common.h" #include "net.h" +#include "hw/reset.h" #include "hw.h" #include "pci.h" #include "boards.h"
hw/ppc4xx_devs.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "ppc.h" #include "ppc4xx.h"
hw/ppc4xx_pci.c +1 -0
@@ -19,6 +19,7 @@/* This file implements emulation of the 32-bit PCI controller found in some * 4xx SoCs, such as the 440EP. */ +#include "hw/reset.h" #include "hw.h" #include "ppc.h" #include "ppc4xx.h"
hw/ppc_newworld.c +1 -0
@@ -46,6 +46,7 @@* 0001:05:0c.0 IDE interface [0101]: Broadcom K2 SATA [1166:0240] * */ +#include "hw/reset.h" #include "hw.h" #include "ppc.h" #include "ppc_mac.h"
hw/ppc_oldworld.c +1 -0
@@ -23,6 +23,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "ppc.h" #include "ppc_mac.h"
hw/ppc_prep.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "nvram.h" #include "pc.h"
hw/ppce500_spin.c +1 -0
@@ -27,6 +27,7 @@* */ +#include "hw/reset.h" #include "hw.h" #include "sysemu.h" #include "sysbus.h"
hw/ps2.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "ps2.h" #include "console.h"
hw/qdev.c +1 -0
@@ -27,6 +27,7 @@#include "net.h" #include "qdev.h" +#include "hw/reset.h" #include "sysemu.h" #include "error.h" #include "qapi/qapi-visit-core.h"
hw/r2d.c +1 -0
@@ -24,6 +24,7 @@*/ #include "sysbus.h" +#include "hw/reset.h" #include "hw.h" #include "sh.h" #include "devices.h"
hw/rc4030.c +1 -0
@@ -22,6 +22,7 @@* THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "mips.h" #include "qemu-timer.h"
hw/reset.c new file +43 -0
43 lines not on this page · raw message
hw/reset.h new file +11 -0
@@ -0,0 +1,11 @@ +/* Device reset handler function registration, used by qdev and other code */ +#ifndef QDEV_RESET_H +#define QDEV_RESET_H + +typedef void QEMUResetHandler (void *opaque); + +void qemu_register_reset (QEMUResetHandler *func,void *opaque); +void qemu_unregister_reset (QEMUResetHandler *func,void *opaque); +void qemu_devices_reset (void ); + +#endif /* QDEV_RESET_H */
hw/s390-virtio-bus.c +1 -0
@@ -17,6 +17,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ +#include "hw/reset.h" #include "hw.h" #include "block.h" #include "sysemu.h"
hw/serial.c +1 -0
@@ -27,6 +27,7 @@#include "qemu-char.h" #include "qemu-timer.h" #include "exec-memory.h" +#include "hw/reset.h" //#define DEBUG_SERIAL
hw/spapr.c +1 -0
@@ -25,6 +25,7 @@* */ #include "sysemu.h" +#include "hw/reset.h" #include "hw.h" #include "elf.h" #include "net.h"
hw/sun4m.c +1 -0
@@ -27,6 +27,7 @@#include "nvram.h" #include "sparc32_dma.h" #include "fdc.h" +#include "hw/reset.h" #include "sysemu.h" #include "net.h" #include "boards.h"
hw/sun4u.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "pci.h" #include "apb_pci.h"
hw/tsc2005.c +1 -0
@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "hw/reset.h" #include "hw.h" #include "qemu-timer.h" #include "console.h"
hw/tsc210x.c +1 -0
@@ -19,6 +19,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "hw/reset.h" #include "hw.h" #include "audio/audio.h" #include "qemu-timer.h"
hw/usb/hcd-ehci.c +1 -0
@@ -28,6 +28,7 @@*/ #include "hw/usb/hcd-ehci.h" +#include "hw/reset.h" /* Capability Registers Base Address - section 2.2 */ #define CAPLENGTH 0x0000/* 1-byte, 0x0001 reserved */
hw/usb/hcd-ohci.c +1 -0
@@ -26,6 +26,7 @@* o BIOS work to boot from USB storage */ +#include "hw/reset.h" #include "hw/hw.h" #include "qemu-timer.h" #include "hw/usb.h"
hw/usb/hcd-uhci.c +1 -0
@@ -25,6 +25,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw/hw.h" #include "hw/usb.h" #include "hw/pci.h"
hw/vga.c +1 -0
@@ -21,6 +21,7 @@* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#include "hw/reset.h" #include "hw.h" #include "vga.h" #include "console.h"
hw/virtex_ml507.c +1 -0
@@ -23,6 +23,7 @@*/ #include "sysbus.h" +#include "hw/reset.h" #include "hw.h" #include "serial.h" #include "net.h"
hw/vt82c686.c +1 -0
@@ -10,6 +10,7 @@* GNU GPL, version 2 or (at your option) any later version. */ +#include "hw/reset.h" #include "hw.h" #include "pc.h" #include "vt82c686.h"
hw/xics.c +1 -0
@@ -25,6 +25,7 @@* */ +#include "hw/reset.h" #include "hw.h" #include "hw/spapr.h" #include "hw/xics.h"
hw/xtensa_lx60.c +1 -0
@@ -25,6 +25,7 @@* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "hw/reset.h" #include "sysemu.h" #include "boards.h" #include "loader.h"
hw/xtensa_sim.c +1 -0
@@ -25,6 +25,7 @@* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "hw/reset.h" #include "sysemu.h" #include "boards.h" #include "loader.h"
kvm-all.c +1 -0
@@ -25,6 +25,7 @@#include "qemu-option.h" #include "qemu-config.h" #include "sysemu.h" +#include "hw/reset.h" #include "hw/hw.h" #include "hw/msi.h" #include "gdbstub.h"
sysemu.h +0 -1
@@ -57,7 +57,6 @@ void qemu_system_vmstop_request(RunState reason);int qemu_shutdown_requested_get (void );int qemu_reset_requested_get (void );void qemu_system_killed (int signal,pid_t pid); -void qemu_devices_reset (void );void qemu_system_reset (bool report);void qemu_add_exit_notifier (Notifier *notify);
target-i386/cpu.c +1 -0
@@ -32,6 +32,7 @@#include "hyperv.h" +#include "hw/reset.h" #include "hw/hw.h" #if defined(CONFIG_KVM )#include <linux/kvm_para.h>
target-i386/kvm.c +1 -0
@@ -21,6 +21,7 @@#include <linux/kvm_para.h> #include "qemu-common.h" +#include "hw/reset.h" #include "sysemu.h" #include "kvm.h" #include "kvm_i386.h"
vl.c +1 -40
59 lines not on this page · raw message
xen-all.c +1 -0
@@ -14,6 +14,7 @@#include "hw/pc.h" #include "hw/xen_common.h" #include "hw/xen_backend.h" +#include "hw/reset.h" #include "qmp-commands.h" #include "range.h"
Signature · 1 line
1.7.11.7
Re: [Qemu-devel] [RFC 05/10] qdev: move reset handler list from vl.c to hw/reset.c
Quoted 7 lines · On Fri, 30 Nov 2012 17:27:17 -0200 Eduardo Habkost <[email protected]> wrote:
The core qdev code uses the reset handler list from
vl.c, and currently *-user has some hacks to make CPU reset work.This moves
qemu_register_reset(),qemu_unregister_reset()andqemu_devices_reset()to a new file,hw/reset.c, that can be used by qdev and by *-user.
Quoted 5 lines
Signed-off-by Eduardo Habkost <[email protected]>--- hw/Makefile.objs | 1 + hw/ac97.c | 1 + hw/acpi_ich9.c | 1 +
patch doesn't apply to the current tree.
Signature · 2 lines
Regards, Igor
Re: [Qemu-devel] [RFC 05/10] qdev: move reset handler list from vl.c to hw/reset.c
In reply to Eduardo HabkostQuoted 9 lines · On Fri, 30 Nov 2012 17:27:17 -0200 Eduardo Habkost <[email protected]> wrote:
The core qdev code uses the reset handler list from
vl.c, and currently *-user has some hacks to make CPU reset work.This moves
qemu_register_reset(),qemu_unregister_reset()andqemu_devices_reset()to a new file,hw/reset.c, that can be used by qdev and by *-user.Signed-off-by Eduardo Habkost <[email protected]>---
[...]
hw/reset.c line 2
Quoted 8 lines
hw/reset.c new file +2
-0@@ -0,0 +1,43 @@ +#include "hw/reset.h" +#include "qlist.h"
missing #include <glib.h> for g_malloc/g_free
[...]
Quoted 16 lines
xen-all.c +1
-0@@ -14,6 +14,7 @@#include "hw/pc.h" #include "hw/xen_common.h" #include "hw/xen_backend.h" +#include "hw/reset.h" #include "qmp-commands.h" #include "range.h" Signature · 1 line
1.7.11.7
Since you are going not include reset.o in *-user:
although dedicated reset.c is nice to have perhaps you can drop reset.c /it's not very related to this series topic/ altogether to minimize scope of review and limit patch only to reset.h and qemu_register_reset(), qemu_unregister_reset() and qemu_devices_reset() stubs for *-user.
Signature · 2 lines
Regards, Igor
Re: [Qemu-devel] [RFC 05/10] qdev: move reset handler list from vl.c to hw/reset.c
Quoted 35 lines · Igor Mammedov
Quoted 9 lines · On Fri, 30 Nov 2012 17:27:17 -0200 Eduardo Habkost <[email protected]> wrote:
The core qdev code uses the reset handler list from
vl.c, and currently *-user has some hacks to make CPU reset work.This moves
qemu_register_reset(),qemu_unregister_reset()andqemu_devices_reset()to a new file,hw/reset.c, that can be used by qdev and by *-user.Signed-off-by Eduardo Habkost <[email protected]>---
[...]
hw/reset.c line 2
Quoted 8 lines
hw/reset.c new file +2
-0@@ -0,0 +1,43 @@ +#include "hw/reset.h" +#include "qlist.h" missing #include <
glib.h> for g_malloc/g_free[...]
Quoted 11 lines
xen-all.c +1
-0@@ -14,6 +14,7 @@#include "hw/pc.h" #include "hw/xen_common.h" #include "hw/xen_backend.h" +#include "hw/reset.h" #include "qmp-commands.h"
Quoted 10 lines
Quoted 5 lines
xen-all.c +0
-0#include "range.h" Signature · 1 line
1.7.11.7Since you are going not include reset.o in *-user:
although dedicatedreset.cis nice to have perhaps you can dropreset.c/it's not very related to this series topic/ altogether to minimize scope of review and limit patch only toreset.handqemu_register_reset(),qemu_unregister_reset()andqemu_devices_reset()stubs for *-user.
I plan to remove this patch on the next respin of the series, and add qemu_[un]register_reset() stubs to *-user instead. When I sent this version of the series, I was still planning to include reset.o in *-user.
Signature · 1 line
Eduardo
RFC 6/10 qdev: add stubs for vmstate register/unregister functions
In reply to Eduardo HabkostAdd vmstate stub functions, so that qdev.o can be used without savevm.o when vmstate support is not necessary (i.e. by *-user).
---
Originally submitted as:
Subject: qdev-core: isolate vmstate handling into separate functions
Changes v1 -> v2:
- Add GCC_WEAK_DECL to function declarations
Changes v2 -> v3:
- Subject: qdev: add weak aliases for vmstate handling on qdev.c
- Make vmstate_register_with_alias_id()/vmstate_unregister() have GCC_WEAK versions, instead of creating a new function
- Kept qdev_get_vmsd() inside qdev.c
Changss v3 -> v4:
- Use the new QEMU_WEAK_ALIAS system instead of GCC_WEAK
Changes v4 -> v5:
- Use the new libqemustub.a, instead of QEMU_WEAK_ALIAS
--- stubs/Makefile.objs | 1 + stubs/vmstate.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 stubs/vmstate.c
stubs/Makefile.objs +1 -0
@@ -5,4 +5,5 @@ 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 += vmstate.o stub-obj-$(CONFIG_WIN32) += fd-register.o
stubs/vmstate.c new file +17 -0
@@ -0,0 +1,17 @@ +#include "qemu-common.h" +#include "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) +{ +}
Signature · 1 line
1.7.11.7
Re: [Qemu-devel] [RFC 06/10] qdev: add stubs for vmstate register/unregister functions
Quoted 66 lines · On Fri, 30 Nov 2012 17:27:18 -0200 Eduardo Habkost <[email protected]> wrote:
Add vmstate stub functions, so that qdev.o can be used without savevm.o when vmstate support is not necessary (i.e. by *-user).
Signed-off-by Eduardo Habkost <[email protected]>---
Originally submitted as:
Subject: qdev-core: isolate vmstate handling into separate functionsChanges v1 -> v2:
- AddGCC_WEAK_DECLto function declarationsChanges v2 -> v3:
- Subject: qdev: add weak aliases for vmstate handling onqdev.c
- Make vmstate_register_with_alias_id()/vmstate_unregister() haveGCC_WEAKversions, instead of creating a new function
- Keptqdev_get_vmsd()insideqdev.cChangss v3 -> v4:
- Use the newQEMU_WEAK_ALIASsystem instead ofGCC_WEAKChanges v4 -> v5:
- Use the new libqemustub.a, instead ofQEMU_WEAK_ALIASSigned-off-by Eduardo Habkost <[email protected]>--- stubs/Makefile.objs | 1 + stubs/vmstate.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 stubs/vmstate.cstubs/Makefile.objs +1
-0@@ -5,4 +5,5 @@ 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 += vmstate.o stub-obj-$(CONFIG_WIN32) += fd-register.ostubs/vmstate.c new file +17
-0@@ -0,0 +1,17 @@ +#include "qemu-common.h" +#include "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) +{ +}Signature · 1 line
1.7.11.7
commit 3bc2f570ec9f description says, there should be a 1 object file per stub /with a corresponding file name if 3bc2f570ec9f is used as a model/.
Paolo,
Is it ok to put several related stub functions in one file?
Signature · 2 lines
Regards, Igor
Re: [Qemu-devel] [RFC 06/10] qdev: add stubs for vmstate register/unregister functions
Quoted 64 lines · Igor Mammedov
Quoted 61 lines · On Fri, 30 Nov 2012 17:27:18 -0200 Eduardo Habkost <[email protected]> wrote:
Add vmstate stub functions, so that qdev.o can be used without savevm.o when vmstate support is not necessary (i.e. by *-user).
Signed-off-by Eduardo Habkost <[email protected]>---
Originally submitted as:
Subject: qdev-core: isolate vmstate handling into separate functionsChanges v1 -> v2:
- AddGCC_WEAK_DECLto function declarationsChanges v2 -> v3:
- Subject: qdev: add weak aliases for vmstate handling onqdev.c
- Make vmstate_register_with_alias_id()/vmstate_unregister() haveGCC_WEAKversions, instead of creating a new function
- Keptqdev_get_vmsd()insideqdev.cChangss v3 -> v4:
- Use the newQEMU_WEAK_ALIASsystem instead ofGCC_WEAKChanges v4 -> v5:
- Use the new libqemustub.a, instead ofQEMU_WEAK_ALIASSigned-off-by Eduardo Habkost <[email protected]>--- stubs/Makefile.objs | 1 + stubs/vmstate.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 stubs/vmstate.cstubs/Makefile.objs +1
-0@@ -5,4 +5,5 @@ 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 += vmstate.o stub-obj-$(CONFIG_WIN32) += fd-register.ostubs/vmstate.c new file +15
-0@@ -0,0 +1,17 @@ +#include "qemu-common.h" +#include "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)
Quoted 8 lines
Quoted 5 lines
stubs/vmstate.c new file +2
-0+{ +}Signature · 1 line
1.7.11.7commit
3bc2f570ec9fdescription says, there should be a 1 object file per stub /with a corresponding file name if3bc2f570ec9fis used as a model/.
Well, the commit description says that "if you place each function in a separate source file, object files for unused functions will not be taken in", I don't see it as a requirement. In this case, pulling both stubs is a feature: if a binary ends up using the vmstate_register stub, we really want it to use the vmstate_unregister stub as well.
Quoted 8 lines
Paolo,
Is it ok to put several related stub functions in one file?Signature · 2 lines
Regards, Igor
Signature · 1 line
Eduardo
Re: [Qemu-devel] [RFC 06/10] qdev: add stubs for vmstate register/unregister functions
Il 04/12/2012 13:49, Eduardo Habkost ha scritto:
Quoted 5 lines
Well, the commit description says that "if you place each function in a separate source file, object files for unused functions will not be taken in", I don't see it as a requirement. In this case, pulling both stubs is a feature: if a binary ends up using the
vmstate_registerstub, we really want it to use thevmstate_unregisterstub as well.
I think Eduardo is right. In the beginning I was thinking more of having one function per file, but then in some cases the functions are clearly related.
For example, if you have monitor_printf/monitor_vprintf, you have two choices:
- put both of them in the same file, as done here for vmstate.
- put each in a separate file. In this case, it doesn't really make sense to implement only one, so the monitor_printf stub should use va_start/va_end to forward to monitor_vprintf.
In the second case, the monitor_printf stub is not even a stub anymore, because the same function will always be usable. This makes it much better to put both of them in the same file, IMHO.
Paolo
RFC 7/10 qdev: add sysbus_get_default() stub
In reply to Eduardo HabkostThis version will be used on cases where sysbus.c is not compiled in (e.g. *-user).
Note that code that uses NULL as the bus with qdev{_try,}_create() implicitly uses sysbus_get_default() as the bus, and requires sysbus.c to be compiled in.
---
Changes v1 -> v2:
- Use the new QEMU_WEAK_ALIAS mechanism, instead of GCC_WEAK
Changes v2 -> v3:
- Use the new libqemustub.a mechanism, instead of QEMU_WEAK_ALIAS
--- stubs/Makefile.objs | 1 + stubs/sysbus.c | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 stubs/sysbus.c
stubs/Makefile.objs +1 -0
@@ -6,4 +6,5 @@ stub-obj-y += fdset-remove-fd.o stub-obj-y += get-fd.o stub-obj-y += set-fd-handler.o stub-obj-y += vmstate.o +stub-obj-y += sysbus.o stub-obj-$(CONFIG_WIN32) += fd-register.o
stubs/sysbus.c new file +6 -0
@@ -0,0 +1,6 @@ +#include "hw/qdev-core.h" + +BusState *sysbus_get_default (void ) +{ +return NULL ; +}
Signature · 1 line
1.7.11.7
RFC 8/10 qdev-properties.c: separate core from the code used only by qemu-system-*
In reply to Eduardo HabkostThis separates the qdev properties code in two parts:
- qdev-properties.c, that contains most of the qdev properties code;
- qdev-properties-system.c for code specific for qemu-system-*, containing:
- Property types: drive, chr, netdev, vlan, that depend on code that won't be included on *-user
- qemu_add_globals(), that depends on qemu-config.o.
This change should help on two things:
- Allowing DeviceState to be used by *-user without pulling dependencies that are specific for qemu-system-*;
- Writing qdev unit tests without pulling too many dependencies.
The copyright/license header for the new file is directly copied from qdev-properties.c.
[ehabkost: updated the qdev_init_gpio_in() code on qdev-system.c to current
version]
---
Yes, there is "changelog" data before the "---" mark, but I believe that in this case they are important to indicate authorship and the scope of the Signed-off-by lines (so they need to get into the git commit message).
Detailed changelog:
Changes v1 (ehabkost) -> v2 (imammedo):
- keep qdev_get_child_bus() in hw/qdev.c
- put qdev_set_nic_properties() in hw/qdev-properties-system.c
Changes v2 -> v3 (ehabkost):
- updated the qdev_init_gpio_in() code on qdev-system.c to current version
Changes v3 -> v4 (ehabkost):
- Added copyright/license information to qdev-properties-system.c (based on copyright/license of qdev-properties.c)
- Whitespace change at the end of qdev-properties.c
- Don't create qdev-system.c, now we can keep the qdev.c code as-is as the qdev.c dependencies were reduced
- Rewrite patch description
Changes v4 -> v5 (ehabkost):
- Remove large copyright header and instead just point to the original file it was based on
--- hw/Makefile.objs | 1 + hw/qdev-properties-system.c | 352 ++++++++++++++++++++++++++++++++++++++++++++ hw/qdev-properties.c | 321 +--------------------------------------- hw/qdev-properties.h | 1 + hw/qdev.c | 13 -- 5 files changed, 355 insertions(+), 333 deletions(-) create mode 100644 hw/qdev-properties-system.c
hw/Makefile.objs +1 -0
@@ -186,6 +186,7 @@ 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-properties-system.o common-obj-$(CONFIG_BRLAPI) += baum.o # xen backend driver support
hw/qdev-properties-system.c new file +352 -0
352 lines not on this page · raw message
hw/qdev-properties.c +1 -320
348 lines not on this page · raw message
hw/qdev-properties.h +1 -0
@@ -116,6 +116,7 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);/* FIXME: Remove opaque pointer properties. */ void qdev_prop_set_ptr (DeviceState *dev,const char *name,void *value); +void qdev_prop_register_global (GlobalProperty *prop);void qdev_prop_register_global_list (GlobalProperty *props);void qdev_prop_set_globals (DeviceState *dev); void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
hw/qdev.c +0 -13
@@ -25,7 +25,6 @@inherit from a particular bus (e.g. PCI or I2C) rather than this API directly. */ -#include "net.h" #include "qdev.h" #include "hw/reset.h" #include "sysemu.h"
@@ -313,18 +312,6 @@ void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin) dev->gpio_out[n] = pin; } -void qdev_set_nic_properties (DeviceState *dev,NICInfo *nd) -{ -qdev_prop_set_macaddr (dev,"mac" , nd->macaddr.a); -if (nd->netdev) -qdev_prop_set_netdev (dev,"netdev" , nd->netdev); -if (nd->nvectors !=DEV_NVECTORS_UNSPECIFIED && -object_property_find (OBJECT (dev),"vectors" ,NULL )) { -qdev_prop_set_uint32 (dev,"vectors" , nd->nvectors); - } - nd->instantiated =1 ; -} -BusState *qdev_get_child_bus (DeviceState *dev,const char *name) {BusState *bus;
Signature · 1 line
1.7.11.7
RFC 9/10 include qdev code into *-user, too
In reply to Eduardo HabkostThe code depends on some functions from qemu-option.o, so add qemu-option.o to universal-obj-y to make sure it's included.
---
Changes v1 -> v2:
- Keep files on the hw/ directory
(it's simply easier to keep them there, as qdev.o depends on irq.o)
- Add a $(hw-core-obj-y) variable to Makefile.objs for the qdev core code
- Add irq.o to the list of core qdev files
(as now the gpio code is being kept inside qdev.c)
Changes v2 -> v3:
- Add reset.o to hw-core-obj-y
--- Makefile.objs | 8 ++++++++ hw/Makefile.objs | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-)
Makefile.objs +8 -0
@@ -31,6 +31,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 oslib-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o
@@ -253,5 +260,6 @@ nested-vars += \ block-obj-y \ user-obj-y \ common-obj-y \ + hw-core-obj-y \ extra-obj-y dummy := $(call unnest-vars)
hw/Makefile.objs +9 -3
@@ -1,6 +1,13 @@ +# 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 +# reset.o used by qdev to register reset handlers: +hw-core-obj-y += reset.o + + common-obj-y = usb/ ide/ common-obj-y += loader.o -common-obj-y += reset.o common-obj-$(CONFIG_VIRTIO) += virtio-console.o common-obj-$(CONFIG_VIRTIO) += virtio-rng.o common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
@@ -159,7 +166,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
@@ -185,7 +191,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
Signature · 1 line
1.7.11.7
RFC 10/10 qom: make CPU a child of DeviceState
In reply to Eduardo HabkostFrom: Igor Mammedov <[email protected]>
---
Yes, there is "changelog" data before the "---" mark, but I believe that in this case they are important to indicate authorship and the scope of the Signed-off-by lines (so they need to get into the git commit message).
--- include/qemu/cpu.h | 6 +++--- qom/cpu.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
include/qemu/cpu.h +3 -3
@@ -20,7 +20,7 @@#ifndef QEMU_CPU_H #define QEMU_CPU_H -#include "qemu/object.h" +#include "hw/qdev-core.h" #include "qemu-thread.h" /**
@@ -46,7 +46,7 @@ typedef struct CPUState CPUState;*/ typedef struct CPUClass { /*< private >*/ - ObjectClass parent_class; + DeviceClass parent_class; /*< public >*/ void (*reset)(CPUState *cpu);
@@ -62,7 +62,7 @@ typedef struct CPUClass {*/ struct CPUState {/*< private >*/ -Object parent_obj; +DeviceState parent_obj;/*< public >*/ struct QemuThread *thread;
qom/cpu.c +2 -1
@@ -20,6 +20,7 @@#include "qemu/cpu.h" #include "qemu-common.h" +#include "hw/qdev-core.h" void cpu_reset (CPUState *cpu) {
@@ -43,7 +44,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)static TypeInfo cpu_type_info = { .name =TYPE_CPU , - .parent =TYPE_OBJECT , + .parent =TYPE_DEVICE , .instance_size =sizeof (CPUState), .abstract = true, .class_size =sizeof (CPUClass),
Signature · 1 line
1.7.11.7