diff --git a/Makefile.target b/Makefile.target
index 760da1e..3ea2ef3 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -110,6 +110,7 @@ CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y)
 
 obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o
 obj-y += hw/
+obj-$(CONFIG_FDT) += device_tree.o
 obj-$(CONFIG_KVM) += kvm-all.o
 obj-$(CONFIG_NO_KVM) += kvm-stub.o
 obj-y += memory.o savevm.o cputlb.o
diff --git a/configure b/configure
index 0657b1a..3ca568b 100755
--- a/configure
+++ b/configure
@@ -4074,9 +4074,6 @@ case "$target_arch2" in
   i386|x86_64)
     echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak
 esac
-if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
-  echo "CONFIG_PSERIES=y" >> $config_target_mak
-fi
 if test "$target_bigendian" = "yes" ; then
   echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
 fi
diff --git a/default-configs/alpha-softmmu.mak b/default-configs/alpha-softmmu.mak
index 501dd41..d3cd5c7 100644
--- a/default-configs/alpha-softmmu.mak
+++ b/default-configs/alpha-softmmu.mak
@@ -12,3 +12,5 @@ CONFIG_IDE_QDEV=y
 CONFIG_VMWARE_VGA=y
 CONFIG_IDE_CMD646=y
 CONFIG_I8259=y
+CONFIG_MC146818RTC=y
+CONFIG_PCI_TYPHOON=y
diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
index 2f1a5c9..272cdd8 100644
--- a/default-configs/arm-softmmu.mak
+++ b/default-configs/arm-softmmu.mak
@@ -16,6 +16,7 @@ CONFIG_TSC2005=y
 CONFIG_LM832X=y
 CONFIG_TMP105=y
 CONFIG_STELLARIS_INPUT=y
+CONFIG_STELLARIS_ENET=y
 CONFIG_SSD0303=y
 CONFIG_SSD0323=y
 CONFIG_ADS7846=y
@@ -30,6 +31,7 @@ CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
 
 CONFIG_ARM_TIMER=y
+CONFIG_ARM_MPTIMER=y
 CONFIG_PL011=y
 CONFIG_PL022=y
 CONFIG_PL031=y
@@ -43,6 +45,21 @@ CONFIG_PL190=y
 CONFIG_PL310=y
 CONFIG_CADENCE=y
 CONFIG_XGMAC=y
+CONFIG_EXYNOS4=y
+CONFIG_PXA2XX=y
+CONFIG_BITBANG_I2C=y
+CONFIG_FRAMEBUFFER=y
+CONFIG_XILINX_SPIPS=y
+
+CONFIG_MARVELL_88W8618=y
+CONFIG_MICRODRIVE=y
+CONFIG_OMAP=y
+CONFIG_TSC210X=y
+CONFIG_BLIZZARD=y
+CONFIG_ONENAND=y
+CONFIG_USB_MUSB=y
+CONFIG_TUSB6010=y
+CONFIG_IMX=y
 
 CONFIG_VERSATILE_PCI=y
 CONFIG_VERSATILE_I2C=y
diff --git a/default-configs/cris-softmmu.mak b/default-configs/cris-softmmu.mak
index 1a479cd..d970d50 100644
--- a/default-configs/cris-softmmu.mak
+++ b/default-configs/cris-softmmu.mak
@@ -1,5 +1,6 @@
 # Default configuration for cris-softmmu
 
+CONFIG_ETRAXFS=y
 CONFIG_NAND=y
 CONFIG_PTIMER=y
 CONFIG_PFLASH_CFI02=y
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 583ea94..1420cf7 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -25,3 +25,10 @@ CONFIG_HPET=y
 CONFIG_APPLESMC=y
 CONFIG_I8259=y
 CONFIG_PFLASH_CFI01=y
+CONFIG_MC146818RTC=y
+CONFIG_PCI_PIIX=y
+CONFIG_PCI_HOTPLUG=y
+CONFIG_WDT_IB700=y
+CONFIG_ISA_DEBUG=y
+CONFIG_LPC_ICH9=y
+CONFIG_Q35=y
diff --git a/default-configs/lm32-softmmu.mak b/default-configs/lm32-softmmu.mak
index 0d19974..ef0f4ba 100644
--- a/default-configs/lm32-softmmu.mak
+++ b/default-configs/lm32-softmmu.mak
@@ -1,5 +1,8 @@
 # Default configuration for lm32-softmmu
 
+CONFIG_LM32=y
+CONFIG_MILKYMIST=y
+CONFIG_FRAMEBUFFER=y
 CONFIG_PTIMER=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
diff --git a/default-configs/m68k-softmmu.mak b/default-configs/m68k-softmmu.mak
index 3e2ec37..1457969 100644
--- a/default-configs/m68k-softmmu.mak
+++ b/default-configs/m68k-softmmu.mak
@@ -1,5 +1,6 @@
 # Default configuration for m68k-softmmu
 
 include pci.mak
+CONFIG_COLDFIRE=y
 CONFIG_GDBSTUB_XML=y
 CONFIG_PTIMER=y
diff --git a/default-configs/microblaze-softmmu.mak b/default-configs/microblaze-softmmu.mak
index 2f442e5..ce26308 100644
--- a/default-configs/microblaze-softmmu.mak
+++ b/default-configs/microblaze-softmmu.mak
@@ -5,5 +5,7 @@ CONFIG_PFLASH_CFI01=y
 CONFIG_SERIAL=y
 CONFIG_XILINX=y
 CONFIG_XILINX_AXI=y
+CONFIG_XILINX_SPI=y
+CONFIG_XILINX_ETHLITE=y
 CONFIG_SSI=y
 CONFIG_SSI_M25P80=y
diff --git a/default-configs/microblazeel-softmmu.mak b/default-configs/microblazeel-softmmu.mak
index af9a3cd..acf22c5 100644
--- a/default-configs/microblazeel-softmmu.mak
+++ b/default-configs/microblazeel-softmmu.mak
@@ -5,5 +5,7 @@ CONFIG_PFLASH_CFI01=y
 CONFIG_SERIAL=y
 CONFIG_XILINX=y
 CONFIG_XILINX_AXI=y
+CONFIG_XILINX_SPI=y
+CONFIG_XILINX_ETHLITE=y
 CONFIG_SSI=y
 CONFIG_SSI_M25P80=y
diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
index 3e87f61..3f312d6 100644
--- a/default-configs/mips-softmmu.mak
+++ b/default-configs/mips-softmmu.mak
@@ -31,3 +31,5 @@ CONFIG_PFLASH_CFI01=y
 CONFIG_G364FB=y
 CONFIG_I8259=y
 CONFIG_JAZZ_LED=y
+CONFIG_PCI_GT64XXX=y
+CONFIG_MC146818RTC=y
diff --git a/default-configs/mips64-softmmu.mak b/default-configs/mips64-softmmu.mak
index 87f4076..3eb6078 100644
--- a/default-configs/mips64-softmmu.mak
+++ b/default-configs/mips64-softmmu.mak
@@ -31,3 +31,5 @@ CONFIG_PFLASH_CFI01=y
 CONFIG_G364FB=y
 CONFIG_I8259=y
 CONFIG_JAZZ_LED=y
+CONFIG_PCI_GT64XXX=y
+CONFIG_MC146818RTC=y
diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak
index beef04f..ac4a782 100644
--- a/default-configs/mips64el-softmmu.mak
+++ b/default-configs/mips64el-softmmu.mak
@@ -33,3 +33,5 @@ CONFIG_FULONG=y
 CONFIG_G364FB=y
 CONFIG_I8259=y
 CONFIG_JAZZ_LED=y
+CONFIG_PCI_GT64XXX=y
+CONFIG_MC146818RTC=y
diff --git a/default-configs/mipsel-softmmu.mak b/default-configs/mipsel-softmmu.mak
index 3571739..25a572e 100644
--- a/default-configs/mipsel-softmmu.mak
+++ b/default-configs/mipsel-softmmu.mak
@@ -31,3 +31,5 @@ CONFIG_PFLASH_CFI01=y
 CONFIG_G364FB=y
 CONFIG_I8259=y
 CONFIG_JAZZ_LED=y
+CONFIG_PCI_GT64XXX=y
+CONFIG_MC146818RTC=y
diff --git a/default-configs/pci.mak b/default-configs/pci.mak
index ee2d18d..4c28e74 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -22,3 +22,4 @@ CONFIG_ESP_PCI=y
 CONFIG_SERIAL=y
 CONFIG_SERIAL_PCI=y
 CONFIG_IPACK=y
+CONFIG_WDT_IB6300ESB=y
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index 3f63473..60aa50e 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -39,3 +39,5 @@ CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
 CONFIG_I8259=y
 CONFIG_XILINX=y
+CONFIG_MC146818RTC=y # For PREP
+CONFIG_XILINX_ETHLITE=y
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
index 6c92067..bf3e36d 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -39,3 +39,8 @@ CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
 CONFIG_I8259=y
 CONFIG_XILINX=y
+CONFIG_PCI_PPC4XX=y
+CONFIG_PSERIES=$(CONFIG_FDT)
+CONFIG_PCI_HOTPLUG=y # For pSeries
+CONFIG_MC146818RTC=y # For PREP
+CONFIG_XILINX_ETHLITE=y
diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak
index 4a9dd5c..26d5b43 100644
--- a/default-configs/ppcemb-softmmu.mak
+++ b/default-configs/ppcemb-softmmu.mak
@@ -34,3 +34,5 @@ CONFIG_PFLASH_CFI02=y
 CONFIG_PTIMER=y
 CONFIG_I8259=y
 CONFIG_XILINX=y
+CONFIG_MC146818RTC=y # For PREP
+CONFIG_XILINX_ETHLITE=y
diff --git a/default-configs/s390x-softmmu.mak b/default-configs/s390x-softmmu.mak
index 3005729..81fbc68 100644
--- a/default-configs/s390x-softmmu.mak
+++ b/default-configs/s390x-softmmu.mak
@@ -1 +1,2 @@
 CONFIG_VIRTIO=y
+CONFIG_SCLPCONSOLE=y
diff --git a/default-configs/sh4-softmmu.mak b/default-configs/sh4-softmmu.mak
index 5c69acc..2a467db 100644
--- a/default-configs/sh4-softmmu.mak
+++ b/default-configs/sh4-softmmu.mak
@@ -5,3 +5,6 @@ CONFIG_SERIAL=y
 CONFIG_PTIMER=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_ISA_MMIO=y
+CONFIG_SH4=y
+CONFIG_IDE_MMIO=y
+CONFIG_SM501=y
diff --git a/default-configs/sh4eb-softmmu.mak b/default-configs/sh4eb-softmmu.mak
index 7cdc122..f4f94ae 100644
--- a/default-configs/sh4eb-softmmu.mak
+++ b/default-configs/sh4eb-softmmu.mak
@@ -5,3 +5,6 @@ CONFIG_SERIAL=y
 CONFIG_PTIMER=y
 CONFIG_PFLASH_CFI02=y
 CONFIG_ISA_MMIO=y
+CONFIG_SH4=y
+CONFIG_IDE_MMIO=y
+CONFIG_SM501=y
diff --git a/default-configs/sparc-softmmu.mak b/default-configs/sparc-softmmu.mak
index b0310c5..3866220 100644
--- a/default-configs/sparc-softmmu.mak
+++ b/default-configs/sparc-softmmu.mak
@@ -8,3 +8,9 @@ CONFIG_PTIMER=y
 CONFIG_FDC=y
 CONFIG_EMPTY_SLOT=y
 CONFIG_PCNET_COMMON=y
+CONFIG_LANCE=y
+CONFIG_TCX=y
+CONFIG_SLAVIO=y
+CONFIG_CS4231=y
+CONFIG_ECCMEMCTL=y
+CONFIG_GRLIB=y
diff --git a/default-configs/sparc64-softmmu.mak b/default-configs/sparc64-softmmu.mak
index 03e8b42..94e9192 100644
--- a/default-configs/sparc64-softmmu.mak
+++ b/default-configs/sparc64-softmmu.mak
@@ -12,3 +12,5 @@ CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_IDE_ISA=y
 CONFIG_IDE_CMD646=y
+CONFIG_PCI_APB=y
+CONFIG_MC146818RTC=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 5288509..62da577 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -25,3 +25,10 @@ CONFIG_HPET=y
 CONFIG_APPLESMC=y
 CONFIG_I8259=y
 CONFIG_PFLASH_CFI01=y
+CONFIG_MC146818RTC=y
+CONFIG_PCI_PIIX=y
+CONFIG_PCI_HOTPLUG=y
+CONFIG_WDT_IB700=y
+CONFIG_ISA_DEBUG=y
+CONFIG_LPC_ICH9=y
+CONFIG_Q35=y
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index f912b5c..a76d37c 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -23,24 +23,3 @@ devices-dirs-$(CONFIG_SOFTMMU) += xen/
 common-obj-y += core/
 common-obj-y += $(devices-dirs-y)
 obj-y += $(devices-dirs-y)
-
-ifeq ($(CONFIG_SOFTMMU),y)
-
-# Per-target files
-# virtio has to be here due to weird dependency between PCI and virtio-net.
-# need to fix this properly
-obj-$(CONFIG_VIRTIO) += dataplane/
-obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o
-obj-$(CONFIG_VIRTIO) += virtio-serial-bus.o virtio-scsi.o
-obj-$(CONFIG_SOFTMMU) += vhost_net.o
-obj-$(CONFIG_VHOST_NET) += vhost.o
-obj-$(CONFIG_VGA) += vga.o
-obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
-
-# Inter-VM PCI shared memory & VFIO PCI device assignment
-ifeq ($(CONFIG_PCI), y)
-obj-$(CONFIG_KVM) += ivshmem.o
-obj-$(CONFIG_LINUX) += vfio_pci.o
-endif
-
-endif
diff --git a/hw/alpha/Makefile.objs b/hw/alpha/Makefile.objs
index 34c6bdb..288d5c8 100644
--- a/hw/alpha/Makefile.objs
+++ b/hw/alpha/Makefile.objs
@@ -1,6 +1 @@
-obj-y = mc146818rtc.o
-obj-y += alpha_typhoon.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 obj-y += pci.o dp264.o
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
index 8067e70..5251e48 100644
--- a/hw/arm/Makefile.objs
+++ b/hw/arm/Makefile.objs
@@ -1,23 +1,3 @@
-obj-y += xilinx_spips.o
-obj-y += arm_mptimer.o
-obj-y += exynos4210_uart.o exynos4210_pwm.o
-obj-y += exynos4210_mct.o exynos4210_fimd.o
-obj-y += exynos4210_rtc.o exynos4210_i2c.o
-obj-y += stellaris_enet.o
-obj-y += pxa2xx_timer.o
-obj-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
-obj-y += ide/microdrive.o
-obj-y += omap_lcdc.o omap_mmc.o omap_i2c.o omap_uart.o
-obj-y += omap_dss.o omap_gptimer.o omap_synctimer.o
-obj-y += tsc210x.o
-obj-y += blizzard.o onenand.o tusb6010.o usb/hcd-musb.o
-obj-y += bitbang_i2c.o marvell_88w8618_audio.o
-obj-y += framebuffer.o
-obj-y += imx_serial.o imx_timer.o
-obj-$(CONFIG_FDT) += ../device_tree.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 obj-y += integratorcp.o versatilepb.o pic.o
 obj-y += arm_sysctl.o
 obj-y += boot.o
diff --git a/hw/audio/Makefile.objs b/hw/audio/Makefile.objs
index c50c367..a3926f8 100644
--- a/hw/audio/Makefile.objs
+++ b/hw/audio/Makefile.objs
@@ -13,4 +13,8 @@ common-obj-$(CONFIG_PCSPK) += pcspk.o
 common-obj-$(CONFIG_WM8750) += wm8750.o
 common-obj-$(CONFIG_PL041) += pl041.o lm4549.o
 
+obj-$(CONFIG_CS4231) += cs4231.o
+obj-$(CONFIG_MARVELL_88W8618) += marvell_88w8618.o
+obj-$(CONFIG_MILKYMIST) += milkymist-ac97.o
+
 $(obj)/adlib.o $(obj)/fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
diff --git a/hw/cs4231.c b/hw/audio/cs4231.c
similarity index 100%
rename from hw/cs4231.c
rename to hw/audio/cs4231.c
diff --git a/hw/marvell_88w8618_audio.c b/hw/audio/marvell_88w8618.c
similarity index 100%
rename from hw/marvell_88w8618_audio.c
rename to hw/audio/marvell_88w8618.c
diff --git a/hw/milkymist-ac97.c b/hw/audio/milkymist-ac97.c
similarity index 100%
rename from hw/milkymist-ac97.c
rename to hw/audio/milkymist-ac97.c
diff --git a/hw/block/Makefile.objs b/hw/block/Makefile.objs
index 660259c..8b5073e 100644
--- a/hw/block/Makefile.objs
+++ b/hw/block/Makefile.objs
@@ -4,3 +4,7 @@ common-obj-$(CONFIG_SSI_M25P80) += m25p80.o
 common-obj-$(CONFIG_NAND) += nand.o
 common-obj-$(CONFIG_PFLASH_CFI01) += pflash_cfi01.o
 common-obj-$(CONFIG_PFLASH_CFI02) += pflash_cfi02.o
+
+obj-$(CONFIG_ONENAND) += onenand.o
+
+obj-$(CONFIG_VIRTIO) += dataplane/ virtio-blk.o
diff --git a/hw/dataplane/Makefile.objs b/hw/block/dataplane/Makefile.objs
similarity index 100%
rename from hw/dataplane/Makefile.objs
rename to hw/block/dataplane/Makefile.objs
diff --git a/hw/dataplane/event-poll.c b/hw/block/dataplane/event-poll.c
similarity index 100%
rename from hw/dataplane/event-poll.c
rename to hw/block/dataplane/event-poll.c
diff --git a/hw/dataplane/event-poll.h b/hw/block/dataplane/event-poll.h
similarity index 100%
rename from hw/dataplane/event-poll.h
rename to hw/block/dataplane/event-poll.h
diff --git a/hw/dataplane/hostmem.c b/hw/block/dataplane/hostmem.c
similarity index 100%
rename from hw/dataplane/hostmem.c
rename to hw/block/dataplane/hostmem.c
diff --git a/hw/dataplane/hostmem.h b/hw/block/dataplane/hostmem.h
similarity index 100%
rename from hw/dataplane/hostmem.h
rename to hw/block/dataplane/hostmem.h
diff --git a/hw/dataplane/ioq.c b/hw/block/dataplane/ioq.c
similarity index 100%
rename from hw/dataplane/ioq.c
rename to hw/block/dataplane/ioq.c
diff --git a/hw/dataplane/ioq.h b/hw/block/dataplane/ioq.h
similarity index 100%
rename from hw/dataplane/ioq.h
rename to hw/block/dataplane/ioq.h
diff --git a/hw/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
similarity index 100%
rename from hw/dataplane/virtio-blk.c
rename to hw/block/dataplane/virtio-blk.c
diff --git a/hw/dataplane/virtio-blk.h b/hw/block/dataplane/virtio-blk.h
similarity index 100%
rename from hw/dataplane/virtio-blk.h
rename to hw/block/dataplane/virtio-blk.h
diff --git a/hw/dataplane/vring.c b/hw/block/dataplane/vring.c
similarity index 100%
rename from hw/dataplane/vring.c
rename to hw/block/dataplane/vring.c
diff --git a/hw/dataplane/vring.h b/hw/block/dataplane/vring.h
similarity index 100%
rename from hw/dataplane/vring.h
rename to hw/block/dataplane/vring.h
diff --git a/hw/onenand.c b/hw/block/onenand.c
similarity index 100%
rename from hw/onenand.c
rename to hw/block/onenand.c
diff --git a/hw/virtio-blk.c b/hw/block/virtio-blk.c
similarity index 100%
rename from hw/virtio-blk.c
rename to hw/block/virtio-blk.c
diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs
index 44febec..a8850ef 100644
--- a/hw/char/Makefile.objs
+++ b/hw/char/Makefile.objs
@@ -7,3 +7,18 @@ common-obj-$(CONFIG_SERIAL_PCI) += serial-pci.o
 common-obj-$(CONFIG_VIRTIO) += virtio-console.o
 common-obj-$(CONFIG_XILINX) += xilinx_uartlite.o
 common-obj-$(CONFIG_CADENCE) += cadence_uart.o
+
+obj-$(CONFIG_ETRAXFS) += etraxfs_ser.o
+obj-$(CONFIG_EXYNOS4) += exynos4210_uart.o
+obj-$(CONFIG_GRLIB) += grlib_apbuart.o
+obj-$(CONFIG_IMX) += imx_serial.o
+obj-$(CONFIG_LM32) += lm32_juart.o
+obj-$(CONFIG_LM32) += lm32_uart.o
+obj-$(CONFIG_COLDFIRE) += mcf_uart.o
+obj-$(CONFIG_MILKYMIST) += milkymist-uart.o
+obj-$(CONFIG_OMAP) += omap_uart.o
+obj-$(CONFIG_SH4) += sh_serial.o
+obj-$(CONFIG_PSERIES) += spapr_vty.o
+obj-$(CONFIG_SCLPCONSOLE) += sclpconsole.o
+
+obj-$(CONFIG_VIRTIO) += virtio-serial-bus.o
diff --git a/hw/etraxfs_ser.c b/hw/char/etraxfs_ser.c
similarity index 100%
rename from hw/etraxfs_ser.c
rename to hw/char/etraxfs_ser.c
diff --git a/hw/exynos4210_uart.c b/hw/char/exynos4210_uart.c
similarity index 100%
rename from hw/exynos4210_uart.c
rename to hw/char/exynos4210_uart.c
diff --git a/hw/grlib_apbuart.c b/hw/char/grlib_apbuart.c
similarity index 100%
rename from hw/grlib_apbuart.c
rename to hw/char/grlib_apbuart.c
diff --git a/hw/imx_serial.c b/hw/char/imx_serial.c
similarity index 100%
rename from hw/imx_serial.c
rename to hw/char/imx_serial.c
diff --git a/hw/lm32_juart.c b/hw/char/lm32_juart.c
similarity index 100%
rename from hw/lm32_juart.c
rename to hw/char/lm32_juart.c
diff --git a/hw/lm32_uart.c b/hw/char/lm32_uart.c
similarity index 100%
rename from hw/lm32_uart.c
rename to hw/char/lm32_uart.c
diff --git a/hw/mcf_uart.c b/hw/char/mcf_uart.c
similarity index 100%
rename from hw/mcf_uart.c
rename to hw/char/mcf_uart.c
diff --git a/hw/milkymist-uart.c b/hw/char/milkymist-uart.c
similarity index 100%
rename from hw/milkymist-uart.c
rename to hw/char/milkymist-uart.c
diff --git a/hw/omap_uart.c b/hw/char/omap_uart.c
similarity index 100%
rename from hw/omap_uart.c
rename to hw/char/omap_uart.c
diff --git a/hw/s390x/sclpconsole.c b/hw/char/sclpconsole.c
similarity index 100%
rename from hw/s390x/sclpconsole.c
rename to hw/char/sclpconsole.c
diff --git a/hw/sh_serial.c b/hw/char/sh_serial.c
similarity index 100%
rename from hw/sh_serial.c
rename to hw/char/sh_serial.c
diff --git a/hw/spapr_vty.c b/hw/char/spapr_vty.c
similarity index 100%
rename from hw/spapr_vty.c
rename to hw/char/spapr_vty.c
diff --git a/hw/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
similarity index 100%
rename from hw/virtio-serial-bus.c
rename to hw/char/virtio-serial-bus.c
diff --git a/hw/cris/Makefile.objs b/hw/cris/Makefile.objs
index b7d3849..464a884 100644
--- a/hw/cris/Makefile.objs
+++ b/hw/cris/Makefile.objs
@@ -1,9 +1,3 @@
-obj-y += etraxfs_eth.o
-obj-y += etraxfs_timer.o
-obj-y += etraxfs_ser.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 # Boards
 obj-y += pic_cpu.o
 obj-y += boot.o
diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
index ef7c048..4a8ef17 100644
--- a/hw/display/Makefile.objs
+++ b/hw/display/Makefile.objs
@@ -10,3 +10,20 @@ common-obj-$(CONFIG_VGA_PCI) += vga-pci.o
 common-obj-$(CONFIG_VGA_ISA) += vga-isa.o
 common-obj-$(CONFIG_VGA_ISA_MM) += vga-isa-mm.o
 common-obj-$(CONFIG_VMWARE_VGA) += vmware_vga.o
+
+obj-$(CONFIG_BLIZZARD) += blizzard.o
+obj-$(CONFIG_EXYNOS4) += exynos4210_fimd.o
+obj-$(CONFIG_FRAMEBUFFER) += framebuffer.o
+obj-$(CONFIG_MILKYMIST) += milkymist-vgafb.o
+obj-$(CONFIG_OMAP) += omap_dss.o
+obj-$(CONFIG_OMAP) += omap_lcdc.o
+obj-$(CONFIG_PXA2XX) += pxa2xx_lcd.o
+obj-$(CONFIG_SPICE) += qxl-logger.o qxl-render.o qxl.o
+obj-$(CONFIG_SM501) += sm501.o
+obj-$(CONFIG_TCX) += tcx.o
+
+ifeq ($(CONFIG_OPENGL),y)
+obj-$(CONFIG_MILKYMIST) += milkymist-tmu2.o
+endif
+
+obj-$(CONFIG_VGA) += vga.o
diff --git a/hw/blizzard.c b/hw/display/blizzard.c
similarity index 100%
rename from hw/blizzard.c
rename to hw/display/blizzard.c
diff --git a/hw/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c
similarity index 100%
rename from hw/exynos4210_fimd.c
rename to hw/display/exynos4210_fimd.c
diff --git a/hw/framebuffer.c b/hw/display/framebuffer.c
similarity index 100%
rename from hw/framebuffer.c
rename to hw/display/framebuffer.c
diff --git a/hw/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c
similarity index 100%
rename from hw/milkymist-tmu2.c
rename to hw/display/milkymist-tmu2.c
diff --git a/hw/milkymist-vgafb.c b/hw/display/milkymist-vgafb.c
similarity index 100%
rename from hw/milkymist-vgafb.c
rename to hw/display/milkymist-vgafb.c
diff --git a/hw/omap_dss.c b/hw/display/omap_dss.c
similarity index 100%
rename from hw/omap_dss.c
rename to hw/display/omap_dss.c
diff --git a/hw/omap_lcdc.c b/hw/display/omap_lcdc.c
similarity index 100%
rename from hw/omap_lcdc.c
rename to hw/display/omap_lcdc.c
diff --git a/hw/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c
similarity index 100%
rename from hw/pxa2xx_lcd.c
rename to hw/display/pxa2xx_lcd.c
diff --git a/hw/qxl-logger.c b/hw/display/qxl-logger.c
similarity index 100%
rename from hw/qxl-logger.c
rename to hw/display/qxl-logger.c
diff --git a/hw/qxl-render.c b/hw/display/qxl-render.c
similarity index 100%
rename from hw/qxl-render.c
rename to hw/display/qxl-render.c
diff --git a/hw/qxl.c b/hw/display/qxl.c
similarity index 100%
rename from hw/qxl.c
rename to hw/display/qxl.c
diff --git a/hw/sm501.c b/hw/display/sm501.c
similarity index 100%
rename from hw/sm501.c
rename to hw/display/sm501.c
diff --git a/hw/tcx.c b/hw/display/tcx.c
similarity index 100%
rename from hw/tcx.c
rename to hw/display/tcx.c
diff --git a/hw/vga.c b/hw/display/vga.c
similarity index 100%
rename from hw/vga.c
rename to hw/display/vga.c
diff --git a/hw/i2c/Makefile.objs b/hw/i2c/Makefile.objs
index f6bd8fa..18e0773 100644
--- a/hw/i2c/Makefile.objs
+++ b/hw/i2c/Makefile.objs
@@ -2,3 +2,6 @@ common-obj-y += core.o smbus.o smbus_eeprom.o
 common-obj-$(CONFIG_VERSATILE_I2C) += versatile_i2c.o
 common-obj-$(CONFIG_ACPI) += smbus_ich9.o
 common-obj-$(CONFIG_APM) += pm_smbus.o
+obj-$(CONFIG_BITBANG_I2C) += bitbang-i2c.o
+obj-$(CONFIG_EXYNOS4) += exynos4210_i2c.o
+obj-$(CONFIG_OMAP) += omap_i2c.o
diff --git a/hw/bitbang_i2c.c b/hw/i2c/bitbang-i2c.c
similarity index 100%
rename from hw/bitbang_i2c.c
rename to hw/i2c/bitbang-i2c.c
diff --git a/hw/exynos4210_i2c.c b/hw/i2c/exynos4210_i2c.c
similarity index 100%
rename from hw/exynos4210_i2c.c
rename to hw/i2c/exynos4210_i2c.c
diff --git a/hw/omap_i2c.c b/hw/i2c/omap_i2c.c
similarity index 100%
rename from hw/omap_i2c.c
rename to hw/i2c/omap_i2c.c
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 364f4ba..4f74592 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -1,15 +1,4 @@
-obj-y += mc146818rtc.o
-obj-y += piix_pci.o
-obj-y += pci/pci-hotplug.o wdt_ib700.o
-obj-y += debugcon.o debugexit.o
-obj-y += lpc_ich9.o q35.o
-obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
-obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
-obj-y += kvm/
-obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
+obj-y += ../kvm/
 obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o
 obj-y += vmport.o
diff --git a/hw/ide/Makefile.objs b/hw/ide/Makefile.objs
index 5c8c22a..122f086 100644
--- a/hw/ide/Makefile.objs
+++ b/hw/ide/Makefile.objs
@@ -8,3 +8,6 @@ common-obj-$(CONFIG_IDE_MACIO) += macio.o
 common-obj-$(CONFIG_IDE_VIA) += via.o
 common-obj-$(CONFIG_AHCI) += ahci.o
 common-obj-$(CONFIG_AHCI) += ich.o
+
+obj-$(CONFIG_MICRODRIVE) += microdrive.o
+obj-$(CONFIG_IDE_MMIO) += mmio.o
diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs
index 5394634..ea1ff34 100644
--- a/hw/input/Makefile.objs
+++ b/hw/input/Makefile.objs
@@ -6,3 +6,8 @@ common-obj-$(CONFIG_PL050) += pl050.o
 common-obj-y += ps2.o
 common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o
 common-obj-$(CONFIG_TSC2005) += tsc2005.o
+
+obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o
+obj-$(CONFIG_PXA2XX) += pxa2xx_keypad.o
+obj-$(CONFIG_TSC210X) += tsc210x.o
+
diff --git a/hw/milkymist-softusb.c b/hw/input/milkymist-softusb.c
similarity index 100%
rename from hw/milkymist-softusb.c
rename to hw/input/milkymist-softusb.c
diff --git a/hw/pxa2xx_keypad.c b/hw/input/pxa2xx_keypad.c
similarity index 100%
rename from hw/pxa2xx_keypad.c
rename to hw/input/pxa2xx_keypad.c
diff --git a/hw/tsc210x.c b/hw/input/tsc210x.c
similarity index 100%
rename from hw/tsc210x.c
rename to hw/input/tsc210x.c
diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
index 9e2f49d..2516657 100644
--- a/hw/isa/Makefile.objs
+++ b/hw/isa/Makefile.objs
@@ -8,3 +8,6 @@ common-obj-$(CONFIG_I8259) += i8259_common.o i8259.o
 common-obj-$(CONFIG_ISA_MMIO) += isa_mmio.o
 common-obj-$(CONFIG_PC87312) += pc87312.o
 
+obj-$(CONFIG_ISA_DEBUG) += debugcon.o debugexit.o
+obj-$(CONFIG_LPC_ICH9) += lpc_ich9.o
+obj-$(CONFIG_FULONG) += vt82c686.o
diff --git a/hw/debugcon.c b/hw/isa/debugcon.c
similarity index 100%
rename from hw/debugcon.c
rename to hw/isa/debugcon.c
diff --git a/hw/debugexit.c b/hw/isa/debugexit.c
similarity index 100%
rename from hw/debugexit.c
rename to hw/isa/debugexit.c
diff --git a/hw/lpc_ich9.c b/hw/isa/lpc_ich9.c
similarity index 100%
rename from hw/lpc_ich9.c
rename to hw/isa/lpc_ich9.c
diff --git a/hw/vt82c686.c b/hw/isa/vt82c686.c
similarity index 100%
rename from hw/vt82c686.c
rename to hw/isa/vt82c686.c
diff --git a/hw/lm32/Makefile.objs b/hw/lm32/Makefile.objs
index a8c2197..026eaac 100644
--- a/hw/lm32/Makefile.objs
+++ b/hw/lm32/Makefile.objs
@@ -1,17 +1,3 @@
-obj-y += lm32_juart.o
-obj-y += lm32_timer.o
-obj-y += lm32_uart.o
-obj-y += milkymist-ac97.o
-obj-y += milkymist-memcard.o
-obj-y += milkymist-minimac2.o
-obj-y += milkymist-softusb.o
-obj-$(CONFIG_OPENGL) += milkymist-tmu2.o
-obj-y += milkymist-uart.o
-obj-y += milkymist-vgafb.o
-obj-y += framebuffer.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 # LM32 boards
 obj-y += lm32_boards.o
 obj-y += milkymist.o
diff --git a/hw/m68k/Makefile.objs b/hw/m68k/Makefile.objs
index 4d19b02..31236be 100644
--- a/hw/m68k/Makefile.objs
+++ b/hw/m68k/Makefile.objs
@@ -1,6 +1,2 @@
-obj-y = mcf_uart.o mcf_fec.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 obj-y += an5206.o mcf_intc.o mcf5206.o mcf5208.o
 obj-y += dummy_m68k.o
diff --git a/hw/microblaze/Makefile.objs b/hw/microblaze/Makefile.objs
index b5cd920..0a27c79 100644
--- a/hw/microblaze/Makefile.objs
+++ b/hw/microblaze/Makefile.objs
@@ -1,10 +1,3 @@
-obj-y += xilinx_spi.o
-
-obj-y += xilinx_ethlite.o
-obj-$(CONFIG_FDT) += ../device_tree.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 obj-y = petalogix_s3adsp1800_mmu.o
 obj-y += petalogix_ml605_mmu.o
 
diff --git a/hw/mips/Makefile.objs b/hw/mips/Makefile.objs
index 1e3bca1..ae3c949 100644
--- a/hw/mips/Makefile.objs
+++ b/hw/mips/Makefile.objs
@@ -1,8 +1,3 @@
-obj-y += gt64xxx.o mc146818rtc.o
-obj-$(CONFIG_FULONG) += bonito.o vt82c686.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 obj-y += mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
 obj-y += addr.o cputimer.o mips_int.o
 obj-$(CONFIG_FULONG) += mips_fulong2e.o
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index 5c093cd..8cc2834 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -34,3 +34,6 @@ common-obj-$(CONFIG_PUV3) += puv3_gpio.o
 common-obj-$(CONFIG_PUV3) += puv3_pm.o
 common-obj-$(CONFIG_PUV3) += puv3_dma.o
 
+obj-$(CONFIG_ECCMEMCTL) += eccmemctl.o
+obj-$(CONFIG_PXA2XX) += pxa2xx_pcmcia.o
+
diff --git a/hw/eccmemctl.c b/hw/misc/eccmemctl.c
similarity index 100%
rename from hw/eccmemctl.c
rename to hw/misc/eccmemctl.c
diff --git a/hw/pxa2xx_pcmcia.c b/hw/misc/pxa2xx_pcmcia.c
similarity index 100%
rename from hw/pxa2xx_pcmcia.c
rename to hw/misc/pxa2xx_pcmcia.c
diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs
index 221c355..5fd2cca 100644
--- a/hw/net/Makefile.objs
+++ b/hw/net/Makefile.objs
@@ -18,3 +18,14 @@ common-obj-$(CONFIG_XILINX_AXI) += xilinx_axidma.o
 common-obj-$(CONFIG_XILINX_AXI) += xilinx_axienet.o
 
 common-obj-$(CONFIG_CADENCE) += cadence_gem.o
+
+obj-$(CONFIG_STELLARIS_ENET) += stellaris_enet.o
+obj-$(CONFIG_ETRAXFS) += etraxfs_eth.o
+obj-$(CONFIG_LANCE) += lance.o
+obj-$(CONFIG_COLDFIRE) += mcf_fec.o
+obj-$(CONFIG_MILKYMIST) += milkymist-minimac2.o
+obj-$(CONFIG_PSERIES) += spapr_llan.o
+obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o
+
+obj-$(CONFIG_VIRTIO) += virtio-net.o
+obj-y += vhost_net.o
diff --git a/hw/etraxfs_eth.c b/hw/net/etraxfs_eth.c
similarity index 100%
rename from hw/etraxfs_eth.c
rename to hw/net/etraxfs_eth.c
diff --git a/hw/lance.c b/hw/net/lance.c
similarity index 100%
rename from hw/lance.c
rename to hw/net/lance.c
diff --git a/hw/mcf_fec.c b/hw/net/mcf_fec.c
similarity index 100%
rename from hw/mcf_fec.c
rename to hw/net/mcf_fec.c
diff --git a/hw/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
similarity index 100%
rename from hw/milkymist-minimac2.c
rename to hw/net/milkymist-minimac2.c
diff --git a/hw/spapr_llan.c b/hw/net/spapr_llan.c
similarity index 100%
rename from hw/spapr_llan.c
rename to hw/net/spapr_llan.c
diff --git a/hw/stellaris_enet.c b/hw/net/stellaris_enet.c
similarity index 100%
rename from hw/stellaris_enet.c
rename to hw/net/stellaris_enet.c
diff --git a/hw/vhost_net.c b/hw/net/vhost_net.c
similarity index 100%
rename from hw/vhost_net.c
rename to hw/net/vhost_net.c
diff --git a/hw/virtio-net.c b/hw/net/virtio-net.c
similarity index 100%
rename from hw/virtio-net.c
rename to hw/net/virtio-net.c
diff --git a/hw/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
similarity index 100%
rename from hw/xilinx_ethlite.c
rename to hw/net/xilinx_ethlite.c
diff --git a/hw/pci/Makefile.objs b/hw/pci/Makefile.objs
index 1480e46..eba67d6 100644
--- a/hw/pci/Makefile.objs
+++ b/hw/pci/Makefile.objs
@@ -29,3 +29,20 @@ common-obj-$(CONFIG_PIIX4) += piix4.o
 # ARM devices
 common-obj-$(CONFIG_VERSATILE_PCI) += host-versatile.o
 
+ifeq ($(CONFIG_PCI), y)
+obj-$(CONFIG_KVM) += ivshmem.o
+obj-$(CONFIG_LINUX) += vfio.o
+endif
+
+obj-$(CONFIG_PCI_APB) += host-apb.o
+obj-$(CONFIG_FULONG) += host-bonito.o
+obj-$(CONFIG_PCI_GT64XXX) += host-gt64xxx.o
+obj-$(CONFIG_PCI_PIIX) += host-piix.o
+obj-$(CONFIG_PCI_PPC4XX) += host-ppc4xx.o
+obj-$(CONFIG_Q35) += q35.o
+obj-$(CONFIG_SH4) += host-sh.o
+obj-$(CONFIG_PSERIES) += host-spapr.o
+obj-$(CONFIG_PCI_TYPHOON) += host-typhoon.o
+obj-$(CONFIG_PSERIES) += spapr_pci.o
+
+obj-$(CONFIG_PCI_HOTPLUG) += pci-hotplug.o
diff --git a/hw/apb_pci.c b/hw/pci/host-apb.c
similarity index 100%
rename from hw/apb_pci.c
rename to hw/pci/host-apb.c
diff --git a/hw/bonito.c b/hw/pci/host-bonito.c
similarity index 100%
rename from hw/bonito.c
rename to hw/pci/host-bonito.c
diff --git a/hw/gt64xxx.c b/hw/pci/host-gt64xxx.c
similarity index 100%
rename from hw/gt64xxx.c
rename to hw/pci/host-gt64xxx.c
diff --git a/hw/piix_pci.c b/hw/pci/host-piix.c
similarity index 100%
rename from hw/piix_pci.c
rename to hw/pci/host-piix.c
diff --git a/hw/ppc4xx_pci.c b/hw/pci/host-ppc4xx.c
similarity index 100%
rename from hw/ppc4xx_pci.c
rename to hw/pci/host-ppc4xx.c
diff --git a/hw/sh_pci.c b/hw/pci/host-sh.c
similarity index 100%
rename from hw/sh_pci.c
rename to hw/pci/host-sh.c
diff --git a/hw/spapr_pci.c b/hw/pci/host-spapr.c
similarity index 100%
rename from hw/spapr_pci.c
rename to hw/pci/host-spapr.c
diff --git a/hw/alpha_typhoon.c b/hw/pci/host-typhoon.c
similarity index 100%
rename from hw/alpha_typhoon.c
rename to hw/pci/host-typhoon.c
diff --git a/hw/ivshmem.c b/hw/pci/ivshmem.c
similarity index 100%
rename from hw/ivshmem.c
rename to hw/pci/ivshmem.c
diff --git a/hw/q35.c b/hw/pci/q35.c
similarity index 100%
rename from hw/q35.c
rename to hw/pci/q35.c
diff --git a/hw/vfio_pci.c b/hw/pci/vfio.c
similarity index 100%
rename from hw/vfio_pci.c
rename to hw/pci/vfio.c
diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs
index 6445ecd..f3a5abb 100644
--- a/hw/ppc/Makefile.objs
+++ b/hw/ppc/Makefile.objs
@@ -1,17 +1,3 @@
-# PREP target
-obj-y += mc146818rtc.o
-# IBM pSeries (sPAPR)
-obj-$(CONFIG_PSERIES) += spapr_vty.o spapr_llan.o spapr_vscsi.o
-obj-$(CONFIG_PSERIES) += spapr_pci.o pci/pci-hotplug.o
-# PowerPC 4xx boards
-obj-y += ppc4xx_pci.o
-obj-$(CONFIG_FDT) += ../device_tree.o
-
-# Xilinx PPC peripherals
-obj-y += xilinx_ethlite.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 # shared objects
 obj-y = ppc.o ppc_booke.o
 # PReP
diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs
index 9f2f419..77e1218 100644
--- a/hw/s390x/Makefile.objs
+++ b/hw/s390x/Makefile.objs
@@ -2,7 +2,7 @@ obj-y = s390-virtio-bus.o s390-virtio.o
 obj-y += s390-virtio-hcall.o
 obj-y += sclp.o
 obj-y += event-facility.o
-obj-y += sclpquiesce.o sclpconsole.o
+obj-y += sclpquiesce.o
 obj-y += ipl.o
 obj-y += css.o
 obj-y += s390-virtio-ccw.o
diff --git a/hw/scsi/Makefile.objs b/hw/scsi/Makefile.objs
index 6a56504..dc00876 100644
--- a/hw/scsi/Makefile.objs
+++ b/hw/scsi/Makefile.objs
@@ -4,3 +4,6 @@ common-obj-$(CONFIG_LSI_SCSI_PCI) += lsi53c895a.o
 common-obj-$(CONFIG_MEGASAS_SCSI_PCI) += megasas.o
 common-obj-$(CONFIG_ESP) += esp.o
 common-obj-$(CONFIG_ESP_PCI) += esp-pci.o
+obj-$(CONFIG_PSERIES) += spapr_vscsi.o
+obj-$(CONFIG_VIRTIO) += virtio-scsi.o
+
diff --git a/hw/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
similarity index 100%
rename from hw/spapr_vscsi.c
rename to hw/scsi/spapr_vscsi.c
diff --git a/hw/virtio-scsi.c b/hw/scsi/virtio-scsi.c
similarity index 100%
rename from hw/virtio-scsi.c
rename to hw/scsi/virtio-scsi.c
diff --git a/hw/sd/Makefile.objs b/hw/sd/Makefile.objs
index 68635a1..6d64c5e 100644
--- a/hw/sd/Makefile.objs
+++ b/hw/sd/Makefile.objs
@@ -1,3 +1,6 @@
 common-obj-$(CONFIG_PL181) += pl181.o
 common-obj-$(CONFIG_SSI_SD) += ssi-sd.o
 common-obj-$(CONFIG_SD) += sd.o
+obj-$(CONFIG_MILKYMIST) += milkymist-memcard.o
+obj-$(CONFIG_OMAP) += omap_mmc.o
+obj-$(CONFIG_PXA2XX) += pxa2xx_mmci.o
diff --git a/hw/milkymist-memcard.c b/hw/sd/milkymist-memcard.c
similarity index 100%
rename from hw/milkymist-memcard.c
rename to hw/sd/milkymist-memcard.c
diff --git a/hw/omap_mmc.c b/hw/sd/omap_mmc.c
similarity index 100%
rename from hw/omap_mmc.c
rename to hw/sd/omap_mmc.c
diff --git a/hw/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
similarity index 100%
rename from hw/pxa2xx_mmci.c
rename to hw/sd/pxa2xx_mmci.c
diff --git a/hw/sh4/Makefile.objs b/hw/sh4/Makefile.objs
index ecb5e31..5b98edc 100644
--- a/hw/sh4/Makefile.objs
+++ b/hw/sh4/Makefile.objs
@@ -1,7 +1,2 @@
-obj-y += sh_timer.o sh_serial.o sh_pci.o sm501.o
-obj-y += ide/mmio.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 obj-y += shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
 obj-y += sh_intc.o
diff --git a/hw/sparc/Makefile.objs b/hw/sparc/Makefile.objs
index 48cccf9..d58fb9f 100644
--- a/hw/sparc/Makefile.objs
+++ b/hw/sparc/Makefile.objs
@@ -1,12 +1,3 @@
-obj-y = lance.o tcx.o
-obj-y += slavio_timer.o
-obj-y += cs4231.o eccmemctl.o
-
-# GRLIB
-obj-y += grlib_gptimer.o grlib_apbuart.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 obj-y = sun4m.o sun4m_iommu.o slavio_intctl.o
 obj-y += slavio_misc.o sparc32_dma.o
 obj-y += sbi.o sun4c_intctl.o leon3.o
diff --git a/hw/sparc64/Makefile.objs b/hw/sparc64/Makefile.objs
index 4df0d90..a84cfe3 100644
--- a/hw/sparc64/Makefile.objs
+++ b/hw/sparc64/Makefile.objs
@@ -1,6 +1 @@
-obj-y = apb_pci.o
-obj-y += mc146818rtc.o
-
-obj-y := $(addprefix ../,$(obj-y))
-
 obj-y += sun4u.o
diff --git a/hw/ssi/Makefile.objs b/hw/ssi/Makefile.objs
index daada5c..b388438 100644
--- a/hw/ssi/Makefile.objs
+++ b/hw/ssi/Makefile.objs
@@ -1,2 +1,4 @@
 common-obj-$(CONFIG_PL022) += pl022.o
 common-obj-$(CONFIG_SSI) += ssi.o
+obj-$(CONFIG_XILINX_SPI) += xilinx_spi.o
+obj-$(CONFIG_XILINX_SPIPS) += xilinx_spips.o
diff --git a/hw/xilinx_spi.c b/hw/ssi/xilinx_spi.c
similarity index 100%
rename from hw/xilinx_spi.c
rename to hw/ssi/xilinx_spi.c
diff --git a/hw/xilinx_spips.c b/hw/ssi/xilinx_spips.c
similarity index 100%
rename from hw/xilinx_spips.c
rename to hw/ssi/xilinx_spips.c
diff --git a/hw/timer/Makefile.objs b/hw/timer/Makefile.objs
index 12781dd..ce407bb 100644
--- a/hw/timer/Makefile.objs
+++ b/hw/timer/Makefile.objs
@@ -8,3 +8,20 @@ common-obj-$(CONFIG_PL031) += pl031.o
 common-obj-$(CONFIG_PUV3) += puv3_ost.o
 common-obj-$(CONFIG_TWL92230) += twl92230.o
 common-obj-$(CONFIG_XILINX) += xilinx_timer.o
+
+obj-$(CONFIG_SLAVIO) += slavio_timer.o
+obj-$(CONFIG_ARM_MPTIMER) += arm_mptimer.o
+obj-$(CONFIG_ETRAXFS) += etraxfs_timer.o
+obj-$(CONFIG_EXYNOS4) += exynos4210_mct.o
+obj-$(CONFIG_EXYNOS4) += exynos4210_pwm.o
+obj-$(CONFIG_EXYNOS4) += exynos4210_rtc.o
+obj-$(CONFIG_GRLIB) += grlib_gptimer.o
+obj-$(CONFIG_IMX) += imx_timer.o
+obj-$(CONFIG_LM32) += lm32_timer.o
+obj-$(CONFIG_OMAP) += omap_gptimer.o
+obj-$(CONFIG_OMAP) += omap_synctimer.o
+obj-$(CONFIG_PXA2XX) += pxa2xx_timer.o
+obj-$(CONFIG_SH4) += sh_timer.o
+obj-$(CONFIG_TUSB6010) += tusb6010.o
+
+obj-$(CONFIG_MC146818RTC) += mc146818rtc.o
diff --git a/hw/arm_mptimer.c b/hw/timer/arm_mptimer.c
similarity index 100%
rename from hw/arm_mptimer.c
rename to hw/timer/arm_mptimer.c
diff --git a/hw/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
similarity index 100%
rename from hw/etraxfs_timer.c
rename to hw/timer/etraxfs_timer.c
diff --git a/hw/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
similarity index 100%
rename from hw/exynos4210_mct.c
rename to hw/timer/exynos4210_mct.c
diff --git a/hw/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
similarity index 100%
rename from hw/exynos4210_pwm.c
rename to hw/timer/exynos4210_pwm.c
diff --git a/hw/exynos4210_rtc.c b/hw/timer/exynos4210_rtc.c
similarity index 100%
rename from hw/exynos4210_rtc.c
rename to hw/timer/exynos4210_rtc.c
diff --git a/hw/grlib_gptimer.c b/hw/timer/grlib_gptimer.c
similarity index 100%
rename from hw/grlib_gptimer.c
rename to hw/timer/grlib_gptimer.c
diff --git a/hw/imx_timer.c b/hw/timer/imx_timer.c
similarity index 100%
rename from hw/imx_timer.c
rename to hw/timer/imx_timer.c
diff --git a/hw/lm32_timer.c b/hw/timer/lm32_timer.c
similarity index 100%
rename from hw/lm32_timer.c
rename to hw/timer/lm32_timer.c
diff --git a/hw/mc146818rtc.c b/hw/timer/mc146818rtc.c
similarity index 100%
rename from hw/mc146818rtc.c
rename to hw/timer/mc146818rtc.c
diff --git a/hw/omap_gptimer.c b/hw/timer/omap_gptimer.c
similarity index 100%
rename from hw/omap_gptimer.c
rename to hw/timer/omap_gptimer.c
diff --git a/hw/omap_synctimer.c b/hw/timer/omap_synctimer.c
similarity index 100%
rename from hw/omap_synctimer.c
rename to hw/timer/omap_synctimer.c
diff --git a/hw/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c
similarity index 100%
rename from hw/pxa2xx_timer.c
rename to hw/timer/pxa2xx_timer.c
diff --git a/hw/sh_timer.c b/hw/timer/sh_timer.c
similarity index 100%
rename from hw/sh_timer.c
rename to hw/timer/sh_timer.c
diff --git a/hw/slavio_timer.c b/hw/timer/slavio_timer.c
similarity index 100%
rename from hw/slavio_timer.c
rename to hw/timer/slavio_timer.c
diff --git a/hw/tusb6010.c b/hw/timer/tusb6010.c
similarity index 100%
rename from hw/tusb6010.c
rename to hw/timer/tusb6010.c
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
index 1d41577..54029b2 100644
--- a/hw/usb/Makefile.objs
+++ b/hw/usb/Makefile.objs
@@ -2,6 +2,8 @@ common-obj-$(CONFIG_USB_UHCI) += hcd-uhci.o
 common-obj-$(CONFIG_USB_OHCI) += hcd-ohci.o
 common-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o hcd-ehci-pci.o hcd-ehci-sysbus.o
 common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o
+obj-$(CONFIG_USB_MUSB) += hcd-musb.o
+
 common-obj-y += libhw.o
 
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs
index ed63495..4564bad 100644
--- a/hw/virtio/Makefile.objs
+++ b/hw/virtio/Makefile.objs
@@ -2,3 +2,6 @@ common-obj-$(CONFIG_VIRTIO) += virtio-rng.o
 common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
 common-obj-$(CONFIG_VIRTIO) += virtio-bus.o
 
+obj-$(CONFIG_VIRTIO) += virtio.o virtio-balloon.o 
+obj-$(CONFIG_VHOST_NET) += vhost.o
+
diff --git a/hw/vhost.c b/hw/virtio/vhost.c
similarity index 100%
rename from hw/vhost.c
rename to hw/virtio/vhost.c
diff --git a/hw/virtio-balloon.c b/hw/virtio/virtio-balloon.c
similarity index 100%
rename from hw/virtio-balloon.c
rename to hw/virtio/virtio-balloon.c
diff --git a/hw/virtio.c b/hw/virtio/virtio.c
similarity index 100%
rename from hw/virtio.c
rename to hw/virtio/virtio.c
diff --git a/hw/watchdog/Makefile.objs b/hw/watchdog/Makefile.objs
index f57133b..308510e 100644
--- a/hw/watchdog/Makefile.objs
+++ b/hw/watchdog/Makefile.objs
@@ -1,2 +1,3 @@
 common-obj-y += watchdog.o
-common-obj-$(CONFIG_PCI) += wdt_i6300esb.o
+obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
+obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
diff --git a/hw/wdt_ib700.c b/hw/watchdog/wdt_ib700.c
similarity index 100%
rename from hw/wdt_ib700.c
rename to hw/watchdog/wdt_ib700.c
diff --git a/hw/xen/Makefile.objs b/hw/xen/Makefile.objs
index 6a1c13b..7d9b1ef 100644
--- a/hw/xen/Makefile.objs
+++ b/hw/xen/Makefile.objs
@@ -1,3 +1,7 @@
 # xen backend driver support
 common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o
 common-obj-$(CONFIG_XEN_BACKEND) += xen_console.o xenfb.o xen_disk.o xen_nic.o
+
+obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
+obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
+obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
