Memory patches, part 4: region ownership
Subsystems (5)
v2 cover Memory patches, part 4: region ownership
This series, split out of the previous attempt to set owners for memory regions, adds reference counting operations to memory regions and uses them. As requested by Peter, I'm adding an argument for the owner to all memory region creation functions.
The big patches to actually add the owners will come soon, since I found a decent way to split it.
Paolo
v1->v2: patches 7/11 redone and placed at the end of the series; refcount
changes for address_space_translate left for a later series, they are not yet necessary; rebased on top of Jan's patches.
Paolo Bonzini (11):
memory: add owner argument to initialization functions
memory: destroy phys_sections one by one
exec: simplify destruction of the phys map
memory: add getter for owner
memory: add ref/unref
memory: add ref/unref calls
exec: check MRU in qemu_ram_addr_from_host
exec: move qemu_ram_addr_from_host_nofail to cputlb.c
memory: return MemoryRegion from qemu_ram_addr_from_host
exec: reorganize address_space_map
memory: ref/unref memory across address_space_map/unmap
cputlb.c | 11 ++ exec.c | 218 +++++++++++++++---------------- hw/acpi/core.c | 6 +- hw/acpi/ich9.c | 6 +- hw/acpi/piix4.c | 8 +- hw/alpha/typhoon.c | 16 +-- hw/arm/armv7m.c | 8 +- hw/arm/exynos4210.c | 12 +- hw/arm/highbank.c | 6 +- hw/arm/integratorcp.c | 12 +- hw/arm/kzm.c | 6 +- hw/arm/mainstone.c | 2 +- hw/arm/musicpal.c | 22 ++-- hw/arm/omap1.c | 52 ++++---- hw/arm/omap2.c | 16 +-- hw/arm/omap_sx1.c | 14 +- hw/arm/palm.c | 10 +- hw/arm/pxa2xx.c | 30 ++--- hw/arm/pxa2xx_gpio.c | 2 +- hw/arm/pxa2xx_pic.c | 2 +- hw/arm/realview.c | 8 +- hw/arm/spitz.c | 4 +- hw/arm/stellaris.c | 8 +- hw/arm/strongarm.c | 14 +- hw/arm/tosa.c | 2 +- hw/arm/versatilepb.c | 4 +- hw/arm/vexpress.c | 12 +- hw/arm/xilinx_zynq.c | 4 +- hw/audio/ac97.c | 4 +- hw/audio/cs4231.c | 2 +- hw/audio/cs4231a.c | 2 +- hw/audio/es1370.c | 2 +- hw/audio/intel-hda.c | 2 +- hw/audio/marvell_88w8618.c | 2 +- hw/audio/milkymist-ac97.c | 2 +- hw/audio/pcspk.c | 2 +- hw/audio/pl041.c | 2 +- hw/block/fdc.c | 4 +- hw/block/nvme.c | 2 +- hw/block/onenand.c | 8 +- hw/block/pc_sysfw.c | 6 +- hw/block/pflash_cfi01.c | 3 +- hw/block/pflash_cfi02.c | 6 +- hw/char/cadence_uart.c | 2 +- hw/char/debugcon.c | 2 +- hw/char/escc.c | 2 +- hw/char/etraxfs_ser.c | 2 +- hw/char/exynos4210_uart.c | 2 +- hw/char/grlib_apbuart.c | 2 +- hw/char/imx_serial.c | 2 +- hw/char/lm32_uart.c | 2 +- hw/char/mcf_uart.c | 2 +- hw/char/milkymist-uart.c | 2 +- hw/char/omap_uart.c | 2 +- hw/char/parallel.c | 2 +- hw/char/pl011.c | 2 +- hw/char/serial-isa.c | 2 +- hw/char/serial-pci.c | 6 +- hw/char/serial.c | 4 +- hw/char/sh_serial.c | 6 +- hw/char/tpci200.c | 12 +- hw/char/xilinx_uartlite.c | 2 +- hw/core/empty_slot.c | 2 +- hw/core/loader.c | 1 + hw/cpu/a15mpcore.c | 2 +- hw/cpu/a9mpcore.c | 2 +- hw/cpu/arm11mpcore.c | 4 +- hw/cpu/icc_bus.c | 2 +- hw/cris/axis_dev88.c | 8 +- hw/display/cirrus_vga.c | 16 +-- hw/display/exynos4210_fimd.c | 8 +- hw/display/framebuffer.c | 12 +- hw/display/g364fb.c | 4 +- hw/display/jazz_led.c | 2 +- hw/display/milkymist-tmu2.c | 2 +- hw/display/milkymist-vgafb.c | 2 +- hw/display/omap_dss.c | 10 +- hw/display/omap_lcdc.c | 2 +- hw/display/pl110.c | 2 +- hw/display/pxa2xx_lcd.c | 2 +- hw/display/qxl.c | 10 +- hw/display/sm501.c | 8 +- hw/display/tc6393xb.c | 4 +- hw/display/tcx.c | 16 +-- hw/display/vga-isa-mm.c | 4 +- hw/display/vga-pci.c | 6 +- hw/display/vga.c | 8 +- hw/display/vmware_vga.c | 4 +- hw/dma/etraxfs_dma.c | 2 +- hw/dma/i8257.c | 4 +- hw/dma/omap_dma.c | 4 +- hw/dma/pl080.c | 2 +- hw/dma/pl330.c | 2 +- hw/dma/puv3_dma.c | 2 +- hw/dma/pxa2xx_dma.c | 2 +- hw/dma/rc4030.c | 4 +- hw/dma/sparc32_dma.c | 2 +- hw/dma/sun4m_iommu.c | 2 +- hw/dma/xilinx_axidma.c | 2 +- hw/gpio/omap_gpio.c | 6 +- hw/gpio/pl061.c | 2 +- hw/gpio/puv3_gpio.c | 2 +- hw/gpio/zaurus.c | 2 +- hw/i2c/bitbang_i2c.c | 2 +- hw/i2c/exynos4210_i2c.c | 2 +- hw/i2c/omap_i2c.c | 2 +- hw/i2c/pm_smbus.c | 2 +- hw/i2c/versatile_i2c.c | 2 +- hw/i386/kvm/apic.c | 2 +- hw/i386/kvm/i8254.c | 2 +- hw/i386/kvm/i8259.c | 4 +- hw/i386/kvm/ioapic.c | 2 +- hw/i386/kvm/pci-assign.c | 14 +- hw/i386/kvmvapic.c | 5 +- hw/i386/pc.c | 14 +- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- hw/ide/ahci.c | 4 +- hw/ide/cmd646.c | 10 +- hw/ide/macio.c | 2 +- hw/ide/mmio.c | 4 +- hw/ide/piix.c | 6 +- hw/ide/via.c | 6 +- hw/input/milkymist-softusb.c | 6 +- hw/input/pckbd.c | 6 +- hw/input/pl050.c | 2 +- hw/input/pxa2xx_keypad.c | 2 +- hw/intc/apic.c | 2 +- hw/intc/arm_gic.c | 6 +- hw/intc/arm_gic_kvm.c | 4 +- hw/intc/armv7m_nvic.c | 6 +- hw/intc/etraxfs_pic.c | 2 +- hw/intc/exynos4210_combiner.c | 2 +- hw/intc/exynos4210_gic.c | 8 +- hw/intc/grlib_irqmp.c | 2 +- hw/intc/heathrow_pic.c | 2 +- hw/intc/i8259.c | 4 +- hw/intc/imx_avic.c | 2 +- hw/intc/ioapic.c | 2 +- hw/intc/omap_intc.c | 4 +- hw/intc/openpic.c | 4 +- hw/intc/pl190.c | 2 +- hw/intc/puv3_intc.c | 2 +- hw/intc/realview_gic.c | 2 +- hw/intc/sh_intc.c | 6 +- hw/intc/slavio_intctl.c | 4 +- hw/intc/xilinx_intc.c | 2 +- hw/isa/apm.c | 2 +- hw/isa/i82378.c | 4 +- hw/isa/isa_mmio.c | 2 +- hw/isa/lpc_ich9.c | 4 +- hw/isa/pc87312.c | 2 +- hw/isa/vt82c686.c | 6 +- hw/lm32/lm32_boards.c | 4 +- hw/lm32/milkymist.c | 2 +- hw/m68k/an5206.c | 4 +- hw/m68k/dummy_m68k.c | 2 +- hw/m68k/mcf5206.c | 2 +- hw/m68k/mcf5208.c | 8 +- hw/m68k/mcf_intc.c | 2 +- hw/microblaze/petalogix_ml605_mmu.c | 4 +- hw/microblaze/petalogix_s3adsp1800_mmu.c | 4 +- hw/mips/gt64xxx_pci.c | 2 +- hw/mips/mips_fulong2e.c | 4 +- hw/mips/mips_jazz.c | 12 +- hw/mips/mips_malta.c | 10 +- hw/mips/mips_mipssim.c | 4 +- hw/mips/mips_r4k.c | 6 +- hw/misc/a9scu.c | 2 +- hw/misc/applesmc.c | 4 +- hw/misc/arm_l2x0.c | 2 +- hw/misc/arm_sysctl.c | 2 +- hw/misc/debugexit.c | 2 +- hw/misc/eccmemctl.c | 4 +- hw/misc/exynos4210_pmu.c | 2 +- hw/misc/imx_ccm.c | 2 +- hw/misc/ivshmem.c | 8 +- hw/misc/lm32_sys.c | 2 +- hw/misc/macio/cuda.c | 2 +- hw/misc/macio/mac_dbdma.c | 2 +- hw/misc/macio/macio.c | 2 +- hw/misc/milkymist-hpdmc.c | 2 +- hw/misc/milkymist-pfpu.c | 2 +- hw/misc/mst_fpga.c | 2 +- hw/misc/omap_gpmc.c | 8 +- hw/misc/omap_l4.c | 2 +- hw/misc/omap_sdrc.c | 2 +- hw/misc/omap_tap.c | 2 +- hw/misc/pc-testdev.c | 8 +- hw/misc/pci-testdev.c | 4 +- hw/misc/puv3_pm.c | 2 +- hw/misc/pvpanic.c | 2 +- hw/misc/pxa2xx_pcmcia.c | 6 +- hw/misc/slavio_misc.c | 16 +-- hw/misc/vfio.c | 30 +++-- hw/misc/vmport.c | 2 +- hw/misc/zynq_slcr.c | 2 +- hw/moxie/moxiesim.c | 4 +- hw/net/cadence_gem.c | 2 +- hw/net/dp8393x.c | 2 +- hw/net/e1000.c | 4 +- hw/net/eepro100.c | 6 +- hw/net/etraxfs_eth.c | 2 +- hw/net/lan9118.c | 2 +- hw/net/lance.c | 2 +- hw/net/mcf_fec.c | 2 +- hw/net/milkymist-minimac2.c | 4 +- hw/net/mipsnet.c | 2 +- hw/net/ne2000.c | 2 +- hw/net/opencores_eth.c | 4 +- hw/net/pcnet-pci.c | 4 +- hw/net/rtl8139.c | 4 +- hw/net/smc91c111.c | 2 +- hw/net/stellaris_enet.c | 2 +- hw/net/vmxnet3.c | 6 +- hw/net/xgmac.c | 2 +- hw/net/xilinx_axienet.c | 2 +- hw/net/xilinx_ethlite.c | 2 +- hw/nvram/ds1225y.c | 2 +- hw/nvram/fw_cfg.c | 6 +- hw/nvram/mac_nvram.c | 2 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci-bridge/dec.c | 4 +- hw/pci-bridge/pci_bridge_dev.c | 2 +- hw/pci-host/apb.c | 8 +- hw/pci-host/bonito.c | 10 +- hw/pci-host/grackle.c | 8 +- hw/pci-host/pam.c | 8 +- hw/pci-host/piix.c | 12 +- hw/pci-host/ppce500.c | 12 +- hw/pci-host/prep.c | 8 +- hw/pci-host/q35.c | 10 +- hw/pci-host/uninorth.c | 24 ++-- hw/pci-host/versatile.c | 14 +- hw/pci/msix.c | 6 +- hw/pci/pci.c | 4 +- hw/pci/pci_bridge.c | 12 +- hw/pci/pcie_host.c | 2 +- hw/pci/shpc.c | 2 +- hw/ppc/e500.c | 4 +- hw/ppc/mac_newworld.c | 8 +- hw/ppc/mac_oldworld.c | 6 +- hw/ppc/mpc8544_guts.c | 2 +- hw/ppc/ppc405_boards.c | 18 +-- hw/ppc/ppc405_uc.c | 12 +- hw/ppc/ppc4xx_devs.c | 4 +- hw/ppc/ppc4xx_pci.c | 8 +- hw/ppc/ppce500_spin.c | 2 +- hw/ppc/prep.c | 8 +- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_pci.c | 10 +- hw/ppc/virtex_ml507.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- hw/s390x/s390-virtio.c | 2 +- hw/scsi/esp-pci.c | 2 +- hw/scsi/esp.c | 2 +- hw/scsi/lsi53c895a.c | 6 +- hw/scsi/megasas.c | 6 +- hw/scsi/vmw_pvscsi.c | 2 +- hw/sd/milkymist-memcard.c | 2 +- hw/sd/omap_mmc.c | 4 +- hw/sd/pl181.c | 2 +- hw/sd/pxa2xx_mmci.c | 2 +- hw/sd/sdhci.c | 2 +- hw/sh4/r2d.c | 4 +- hw/sh4/sh7750.c | 16 +-- hw/sh4/sh_pci.c | 4 +- hw/sh4/shix.c | 6 +- hw/sparc/leon3.c | 4 +- hw/sparc/sun4m.c | 8 +- hw/sparc64/sun4u.c | 4 +- hw/ssi/omap_spi.c | 2 +- hw/ssi/pl022.c | 2 +- hw/ssi/xilinx_spi.c | 2 +- hw/ssi/xilinx_spips.c | 4 +- hw/timer/arm_mptimer.c | 4 +- hw/timer/arm_timer.c | 4 +- hw/timer/cadence_ttc.c | 2 +- hw/timer/etraxfs_timer.c | 2 +- hw/timer/exynos4210_mct.c | 2 +- hw/timer/exynos4210_pwm.c | 2 +- hw/timer/exynos4210_rtc.c | 2 +- hw/timer/grlib_gptimer.c | 2 +- hw/timer/hpet.c | 2 +- hw/timer/i8254.c | 2 +- hw/timer/imx_epit.c | 2 +- hw/timer/imx_gpt.c | 2 +- hw/timer/lm32_timer.c | 2 +- hw/timer/m48t59.c | 6 +- hw/timer/mc146818rtc.c | 2 +- hw/timer/milkymist-sysctl.c | 2 +- hw/timer/omap_gptimer.c | 2 +- hw/timer/omap_synctimer.c | 2 +- hw/timer/pl031.c | 2 +- hw/timer/puv3_ost.c | 2 +- hw/timer/pxa2xx_timer.c | 2 +- hw/timer/sh_timer.c | 6 +- hw/timer/slavio_timer.c | 2 +- hw/timer/tusb6010.c | 2 +- hw/timer/xilinx_timer.c | 2 +- hw/tpm/tpm_tis.c | 2 +- hw/unicore32/puv3.c | 2 +- hw/usb/hcd-ehci-sysbus.c | 2 +- hw/usb/hcd-ehci.c | 8 +- hw/usb/hcd-ohci.c | 2 +- hw/usb/hcd-uhci.c | 2 +- hw/usb/hcd-xhci.c | 12 +- hw/virtio/dataplane/hostmem.c | 7 + hw/virtio/vhost.c | 2 + hw/virtio/virtio-balloon.c | 1 + hw/virtio/virtio-pci.c | 2 +- hw/watchdog/wdt_i6300esb.c | 2 +- hw/xen/xen_apic.c | 2 +- hw/xen/xen_platform.c | 6 +- hw/xen/xen_pt.c | 8 +- hw/xen/xen_pt_msi.c | 2 +- hw/xtensa/xtensa_lx60.c | 12 +- hw/xtensa/xtensa_sim.c | 4 +- include/exec/cpu-common.h | 3 +- include/exec/memory.h | 54 ++++++++ include/hw/virtio/dataplane/hostmem.h | 1 + ioport.c | 2 +- kvm-all.c | 2 + memory.c | 64 ++++++++- target-arm/kvm.c | 2 + target-i386/kvm.c | 4 +- target-ppc/kvm.c | 2 +- target-sparc/mmu_helper.c | 1 + xen-all.c | 10 +- 330 files changed, 1009 insertions(+), 870 deletions(-)
Signature · 1 line
1.8.1.4
PATCH v2 1/11 memory: add owner argument to initialization functions
--- exec.c | 14 ++++----- hw/acpi/core.c | 6 ++-- hw/acpi/ich9.c | 6 ++-- hw/acpi/piix4.c | 8 ++--- hw/alpha/typhoon.c | 16 +++++----- hw/arm/armv7m.c | 8 ++--- hw/arm/exynos4210.c | 12 ++++---- hw/arm/highbank.c | 6 ++-- hw/arm/integratorcp.c | 12 ++++---- hw/arm/kzm.c | 6 ++-- hw/arm/mainstone.c | 2 +- hw/arm/musicpal.c | 22 +++++++------- hw/arm/omap1.c | 52 ++++++++++++++++---------------- hw/arm/omap2.c | 16 +++++----- hw/arm/omap_sx1.c | 14 ++++----- hw/arm/palm.c | 10 +++--- hw/arm/pxa2xx.c | 30 +++++++++--------- hw/arm/pxa2xx_gpio.c | 2 +- hw/arm/pxa2xx_pic.c | 2 +- hw/arm/realview.c | 8 ++--- hw/arm/spitz.c | 4 +-- hw/arm/stellaris.c | 8 ++--- hw/arm/strongarm.c | 14 ++++----- hw/arm/tosa.c | 2 +- hw/arm/versatilepb.c | 4 +-- hw/arm/vexpress.c | 12 ++++---- hw/arm/xilinx_zynq.c | 4 +-- hw/audio/ac97.c | 4 +-- hw/audio/cs4231.c | 2 +- hw/audio/cs4231a.c | 2 +- hw/audio/es1370.c | 2 +- hw/audio/intel-hda.c | 2 +- hw/audio/marvell_88w8618.c | 2 +- hw/audio/milkymist-ac97.c | 2 +- hw/audio/pcspk.c | 2 +- hw/audio/pl041.c | 2 +- hw/block/fdc.c | 4 +-- hw/block/nvme.c | 2 +- hw/block/onenand.c | 8 ++--- hw/block/pc_sysfw.c | 6 ++-- hw/block/pflash_cfi01.c | 3 +- hw/block/pflash_cfi02.c | 6 ++-- hw/char/cadence_uart.c | 2 +- hw/char/debugcon.c | 2 +- hw/char/escc.c | 2 +- hw/char/etraxfs_ser.c | 2 +- hw/char/exynos4210_uart.c | 2 +- hw/char/grlib_apbuart.c | 2 +- hw/char/imx_serial.c | 2 +- hw/char/lm32_uart.c | 2 +- hw/char/mcf_uart.c | 2 +- hw/char/milkymist-uart.c | 2 +- hw/char/omap_uart.c | 2 +- hw/char/parallel.c | 2 +- hw/char/pl011.c | 2 +- hw/char/serial-isa.c | 2 +- hw/char/serial-pci.c | 6 ++-- hw/char/serial.c | 4 +-- hw/char/sh_serial.c | 6 ++-- hw/char/tpci200.c | 12 ++++---- hw/char/xilinx_uartlite.c | 2 +- hw/core/empty_slot.c | 2 +- hw/cpu/a15mpcore.c | 2 +- hw/cpu/a9mpcore.c | 2 +- hw/cpu/arm11mpcore.c | 4 +-- hw/cpu/icc_bus.c | 2 +- hw/cris/axis_dev88.c | 8 ++--- hw/display/cirrus_vga.c | 16 +++++----- hw/display/exynos4210_fimd.c | 2 +- hw/display/g364fb.c | 4 +-- hw/display/jazz_led.c | 2 +- hw/display/milkymist-tmu2.c | 2 +- hw/display/milkymist-vgafb.c | 2 +- hw/display/omap_dss.c | 10 +++--- hw/display/omap_lcdc.c | 2 +- hw/display/pl110.c | 2 +- hw/display/pxa2xx_lcd.c | 2 +- hw/display/qxl.c | 10 +++--- hw/display/sm501.c | 8 ++--- hw/display/tc6393xb.c | 4 +-- hw/display/tcx.c | 16 +++++----- hw/display/vga-isa-mm.c | 4 +-- hw/display/vga-pci.c | 6 ++-- hw/display/vga.c | 8 ++--- hw/display/vmware_vga.c | 4 +-- hw/dma/etraxfs_dma.c | 2 +- hw/dma/i8257.c | 4 +-- hw/dma/omap_dma.c | 4 +-- hw/dma/pl080.c | 2 +- hw/dma/pl330.c | 2 +- hw/dma/puv3_dma.c | 2 +- hw/dma/pxa2xx_dma.c | 2 +- hw/dma/rc4030.c | 4 +-- hw/dma/sparc32_dma.c | 2 +- hw/dma/sun4m_iommu.c | 2 +- hw/dma/xilinx_axidma.c | 2 +- hw/gpio/omap_gpio.c | 6 ++-- hw/gpio/pl061.c | 2 +- hw/gpio/puv3_gpio.c | 2 +- hw/gpio/zaurus.c | 2 +- hw/i2c/bitbang_i2c.c | 2 +- hw/i2c/exynos4210_i2c.c | 2 +- hw/i2c/omap_i2c.c | 2 +- hw/i2c/pm_smbus.c | 2 +- hw/i2c/versatile_i2c.c | 2 +- hw/i386/kvm/apic.c | 2 +- hw/i386/kvm/i8254.c | 2 +- hw/i386/kvm/i8259.c | 4 +-- hw/i386/kvm/ioapic.c | 2 +- hw/i386/kvm/pci-assign.c | 14 ++++----- hw/i386/kvmvapic.c | 4 +-- hw/i386/pc.c | 14 ++++----- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- hw/ide/ahci.c | 4 +-- hw/ide/cmd646.c | 10 +++--- hw/ide/macio.c | 2 +- hw/ide/mmio.c | 4 +-- hw/ide/piix.c | 6 ++-- hw/ide/via.c | 6 ++-- hw/input/milkymist-softusb.c | 6 ++-- hw/input/pckbd.c | 6 ++-- hw/input/pl050.c | 2 +- hw/input/pxa2xx_keypad.c | 2 +- hw/intc/apic.c | 2 +- hw/intc/arm_gic.c | 6 ++-- hw/intc/arm_gic_kvm.c | 4 +-- hw/intc/armv7m_nvic.c | 6 ++-- hw/intc/etraxfs_pic.c | 2 +- hw/intc/exynos4210_combiner.c | 2 +- hw/intc/exynos4210_gic.c | 8 ++--- hw/intc/grlib_irqmp.c | 2 +- hw/intc/heathrow_pic.c | 2 +- hw/intc/i8259.c | 4 +-- hw/intc/imx_avic.c | 2 +- hw/intc/ioapic.c | 2 +- hw/intc/omap_intc.c | 4 +-- hw/intc/openpic.c | 4 +-- hw/intc/pl190.c | 2 +- hw/intc/puv3_intc.c | 2 +- hw/intc/realview_gic.c | 2 +- hw/intc/sh_intc.c | 6 ++-- hw/intc/slavio_intctl.c | 4 +-- hw/intc/xilinx_intc.c | 2 +- hw/isa/apm.c | 2 +- hw/isa/i82378.c | 4 +-- hw/isa/isa_mmio.c | 2 +- hw/isa/lpc_ich9.c | 4 +-- hw/isa/pc87312.c | 2 +- hw/isa/vt82c686.c | 6 ++-- hw/lm32/lm32_boards.c | 4 +-- hw/lm32/milkymist.c | 2 +- hw/m68k/an5206.c | 4 +-- hw/m68k/dummy_m68k.c | 2 +- hw/m68k/mcf5206.c | 2 +- hw/m68k/mcf5208.c | 8 ++--- hw/m68k/mcf_intc.c | 2 +- hw/microblaze/petalogix_ml605_mmu.c | 4 +-- hw/microblaze/petalogix_s3adsp1800_mmu.c | 4 +-- hw/mips/gt64xxx_pci.c | 2 +- hw/mips/mips_fulong2e.c | 4 +-- hw/mips/mips_jazz.c | 12 ++++---- hw/mips/mips_malta.c | 10 +++--- hw/mips/mips_mipssim.c | 4 +-- hw/mips/mips_r4k.c | 6 ++-- hw/misc/a9scu.c | 2 +- hw/misc/applesmc.c | 4 +-- hw/misc/arm_l2x0.c | 2 +- hw/misc/arm_sysctl.c | 2 +- hw/misc/debugexit.c | 2 +- hw/misc/eccmemctl.c | 4 +-- hw/misc/exynos4210_pmu.c | 2 +- hw/misc/imx_ccm.c | 2 +- hw/misc/ivshmem.c | 8 ++--- hw/misc/lm32_sys.c | 2 +- hw/misc/macio/cuda.c | 2 +- hw/misc/macio/mac_dbdma.c | 2 +- hw/misc/macio/macio.c | 2 +- hw/misc/milkymist-hpdmc.c | 2 +- hw/misc/milkymist-pfpu.c | 2 +- hw/misc/mst_fpga.c | 2 +- hw/misc/omap_gpmc.c | 8 ++--- hw/misc/omap_l4.c | 2 +- hw/misc/omap_sdrc.c | 2 +- hw/misc/omap_tap.c | 2 +- hw/misc/pc-testdev.c | 8 ++--- hw/misc/pci-testdev.c | 4 +-- hw/misc/puv3_pm.c | 2 +- hw/misc/pvpanic.c | 2 +- hw/misc/pxa2xx_pcmcia.c | 6 ++-- hw/misc/slavio_misc.c | 16 +++++----- hw/misc/vfio.c | 28 ++++++++--------- hw/misc/vmport.c | 2 +- hw/misc/zynq_slcr.c | 2 +- hw/moxie/moxiesim.c | 4 +-- hw/net/cadence_gem.c | 2 +- hw/net/dp8393x.c | 2 +- hw/net/e1000.c | 4 +-- hw/net/eepro100.c | 6 ++-- hw/net/etraxfs_eth.c | 2 +- hw/net/lan9118.c | 2 +- hw/net/lance.c | 2 +- hw/net/mcf_fec.c | 2 +- hw/net/milkymist-minimac2.c | 4 +-- hw/net/mipsnet.c | 2 +- hw/net/ne2000.c | 2 +- hw/net/opencores_eth.c | 4 +-- hw/net/pcnet-pci.c | 4 +-- hw/net/rtl8139.c | 4 +-- hw/net/smc91c111.c | 2 +- hw/net/stellaris_enet.c | 2 +- hw/net/vmxnet3.c | 6 ++-- hw/net/xgmac.c | 2 +- hw/net/xilinx_axienet.c | 2 +- hw/net/xilinx_ethlite.c | 2 +- hw/nvram/ds1225y.c | 2 +- hw/nvram/fw_cfg.c | 6 ++-- hw/nvram/mac_nvram.c | 2 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci-bridge/dec.c | 4 +-- hw/pci-bridge/pci_bridge_dev.c | 2 +- hw/pci-host/apb.c | 8 ++--- hw/pci-host/bonito.c | 10 +++--- hw/pci-host/grackle.c | 8 ++--- hw/pci-host/pam.c | 8 ++--- hw/pci-host/piix.c | 12 ++++---- hw/pci-host/ppce500.c | 12 ++++---- hw/pci-host/prep.c | 8 ++--- hw/pci-host/q35.c | 10 +++--- hw/pci-host/uninorth.c | 24 +++++++-------- hw/pci-host/versatile.c | 14 ++++----- hw/pci/msix.c | 6 ++-- hw/pci/pci.c | 4 +-- hw/pci/pci_bridge.c | 12 ++++---- hw/pci/pcie_host.c | 2 +- hw/pci/shpc.c | 2 +- hw/ppc/e500.c | 4 +-- hw/ppc/mac_newworld.c | 8 ++--- hw/ppc/mac_oldworld.c | 6 ++-- hw/ppc/mpc8544_guts.c | 2 +- hw/ppc/ppc405_boards.c | 18 +++++------ hw/ppc/ppc405_uc.c | 12 ++++---- hw/ppc/ppc4xx_devs.c | 4 +-- hw/ppc/ppc4xx_pci.c | 8 ++--- hw/ppc/ppce500_spin.c | 2 +- hw/ppc/prep.c | 8 ++--- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_pci.c | 10 +++--- hw/ppc/virtex_ml507.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- hw/s390x/s390-virtio.c | 2 +- hw/scsi/esp-pci.c | 2 +- hw/scsi/esp.c | 2 +- hw/scsi/lsi53c895a.c | 6 ++-- hw/scsi/megasas.c | 6 ++-- hw/scsi/vmw_pvscsi.c | 2 +- hw/sd/milkymist-memcard.c | 2 +- hw/sd/omap_mmc.c | 4 +-- hw/sd/pl181.c | 2 +- hw/sd/pxa2xx_mmci.c | 2 +- hw/sd/sdhci.c | 2 +- hw/sh4/r2d.c | 4 +-- hw/sh4/sh7750.c | 16 +++++----- hw/sh4/sh_pci.c | 4 +-- hw/sh4/shix.c | 6 ++-- hw/sparc/leon3.c | 4 +-- hw/sparc/sun4m.c | 8 ++--- hw/sparc64/sun4u.c | 4 +-- hw/ssi/omap_spi.c | 2 +- hw/ssi/pl022.c | 2 +- hw/ssi/xilinx_spi.c | 2 +- hw/ssi/xilinx_spips.c | 4 +-- hw/timer/arm_mptimer.c | 4 +-- hw/timer/arm_timer.c | 4 +-- hw/timer/cadence_ttc.c | 2 +- hw/timer/etraxfs_timer.c | 2 +- hw/timer/exynos4210_mct.c | 2 +- hw/timer/exynos4210_pwm.c | 2 +- hw/timer/exynos4210_rtc.c | 2 +- hw/timer/grlib_gptimer.c | 2 +- hw/timer/hpet.c | 2 +- hw/timer/i8254.c | 2 +- hw/timer/imx_epit.c | 2 +- hw/timer/imx_gpt.c | 2 +- hw/timer/lm32_timer.c | 2 +- hw/timer/m48t59.c | 6 ++-- hw/timer/mc146818rtc.c | 2 +- hw/timer/milkymist-sysctl.c | 2 +- hw/timer/omap_gptimer.c | 2 +- hw/timer/omap_synctimer.c | 2 +- hw/timer/pl031.c | 2 +- hw/timer/puv3_ost.c | 2 +- hw/timer/pxa2xx_timer.c | 2 +- hw/timer/sh_timer.c | 6 ++-- hw/timer/slavio_timer.c | 2 +- hw/timer/tusb6010.c | 2 +- hw/timer/xilinx_timer.c | 2 +- hw/tpm/tpm_tis.c | 2 +- hw/unicore32/puv3.c | 2 +- hw/usb/hcd-ehci-sysbus.c | 2 +- hw/usb/hcd-ehci.c | 8 ++--- hw/usb/hcd-ohci.c | 2 +- hw/usb/hcd-uhci.c | 2 +- hw/usb/hcd-xhci.c | 12 ++++---- hw/virtio/virtio-pci.c | 2 +- hw/watchdog/wdt_i6300esb.c | 2 +- hw/xen/xen_apic.c | 2 +- hw/xen/xen_platform.c | 6 ++-- hw/xen/xen_pt.c | 4 +-- hw/xen/xen_pt_msi.c | 2 +- hw/xtensa/xtensa_lx60.c | 12 ++++---- hw/xtensa/xtensa_sim.c | 4 +-- include/exec/memory.h | 17 +++++++++++ ioport.c | 2 +- memory.c | 24 ++++++++++----- target-ppc/kvm.c | 2 +- xen-all.c | 8 ++--- 318 files changed, 782 insertions(+), 754 deletions(-)
exec.c +7 -7
@@ -1681,7 +1681,7 @@ static subpage_t *subpage_init(AddressSpace *as, hwaddr base) mmio->as = as; mmio->base = base; -memory_region_init_io (&mmio->iomem, &subpage_ops, mmio, +memory_region_init_io (&mmio->iomem,NULL , &subpage_ops, mmio,"subpage" ,TARGET_PAGE_SIZE ); mmio->iomem.subpage = true;#if defined(DEBUG_SUBPAGE )
@@ -1712,12 +1712,12 @@ MemoryRegion *iotlb_to_region(hwaddr index)static void io_mem_init (void ) { -memory_region_init_io (&io_mem_rom, &unassigned_mem_ops,NULL ,"rom" ,UINT64_MAX ); -memory_region_init_io (&io_mem_unassigned, &unassigned_mem_ops,NULL , +memory_region_init_io (&io_mem_rom,NULL , &unassigned_mem_ops,NULL ,"rom" ,UINT64_MAX ); +memory_region_init_io (&io_mem_unassigned,NULL , &unassigned_mem_ops,NULL ,"unassigned" ,UINT64_MAX ); -memory_region_init_io (&io_mem_notdirty, ¬dirty_mem_ops,NULL , +memory_region_init_io (&io_mem_notdirty,NULL , ¬dirty_mem_ops,NULL ,"notdirty" ,UINT64_MAX ); -memory_region_init_io (&io_mem_watch, &watch_mem_ops,NULL , +memory_region_init_io (&io_mem_watch,NULL , &watch_mem_ops,NULL ,"watch" ,UINT64_MAX ); }
@@ -1800,11 +1800,11 @@ void address_space_destroy_dispatch(AddressSpace *as)static void memory_map_init (void ) { system_memory =g_malloc (sizeof (*system_memory)); -memory_region_init (system_memory,"system" ,INT64_MAX ); +memory_region_init (system_memory,NULL ,"system" ,INT64_MAX );address_space_init (&address_space_memory, system_memory,"memory" ); system_io =g_malloc (sizeof (*system_io)); -memory_region_init (system_io,"io" ,65536 ); +memory_region_init (system_io,NULL ,"io" ,65536 );address_space_init (&address_space_io, system_io,"I/O" );memory_listener_register (&core_memory_listener, &address_space_memory);
hw/acpi/core.c +3 -3
@@ -419,7 +419,7 @@ void acpi_pm1_evt_init(ACPIREGS *ar, acpi_update_sci_fn update_sci, MemoryRegion *parent) { ar->pm1.evt.update_sci = update_sci; -memory_region_init_io (&ar->pm1.evt.io, &acpi_pm_evt_ops, ar,"acpi-evt" ,4 ); +memory_region_init_io (&ar->pm1.evt.io,NULL , &acpi_pm_evt_ops, ar,"acpi-evt" ,4 );memory_region_add_subregion (parent,0 , &ar->pm1.evt.io); }
@@ -481,7 +481,7 @@ void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci, { ar->tmr.update_sci = update_sci; ar->tmr.timer =qemu_new_timer_ns (vm_clock, acpi_pm_tmr_timer, ar); -memory_region_init_io (&ar->tmr.io, &acpi_pm_tmr_ops, ar,"acpi-tmr" ,4 ); +memory_region_init_io (&ar->tmr.io,NULL , &acpi_pm_tmr_ops, ar,"acpi-tmr" ,4 );memory_region_add_subregion (parent,8 , &ar->tmr.io); }
@@ -552,7 +552,7 @@ void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent, uint8_t s4_val) ar->pm1.cnt.s4_val = s4_val; ar->wakeup.notify = acpi_notify_wakeup;qemu_register_wakeup_notifier (&ar->wakeup); -memory_region_init_io (&ar->pm1.cnt.io, &acpi_pm_cnt_ops, ar,"acpi-cnt" ,2 ); +memory_region_init_io (&ar->pm1.cnt.io,NULL , &acpi_pm_cnt_ops, ar,"acpi-cnt" ,2 );memory_region_add_subregion (parent,4 , &ar->pm1.cnt.io); }
hw/acpi/ich9.c +3 -3
@@ -205,7 +205,7 @@ static void pm_powerdown_req(Notifier *n, void *opaque)void ich9_pm_init (PCIDevice *lpc_pci,ICH9LPCPMRegs *pm,qemu_irq sci_irq) { -memory_region_init (&pm->io,"ich9-pm" ,ICH9_PMIO_SIZE ); +memory_region_init (&pm->io,NULL ,"ich9-pm" ,ICH9_PMIO_SIZE );memory_region_set_enabled (&pm->io, false);memory_region_add_subregion (pci_address_space_io (lpc_pci),0 , &pm->io);
@@ -215,11 +215,11 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,acpi_pm1_cnt_init (&pm->acpi_regs, &pm->io,2 );acpi_gpe_init (&pm->acpi_regs,ICH9_PMIO_GPE0_LEN ); -memory_region_init_io (&pm->io_gpe, &ich9_gpe_ops, pm,"apci-gpe0" , +memory_region_init_io (&pm->io_gpe,NULL , &ich9_gpe_ops, pm,"apci-gpe0" ,ICH9_PMIO_GPE0_LEN );memory_region_add_subregion (&pm->io,ICH9_PMIO_GPE0_STS , &pm->io_gpe); -memory_region_init_io (&pm->io_smi, &ich9_smi_ops, pm,"apci-smi" , +memory_region_init_io (&pm->io_smi,NULL , &ich9_smi_ops, pm,"apci-smi" ,8 );memory_region_add_subregion (&pm->io,ICH9_PMIO_SMI_EN , &pm->io_smi);
hw/acpi/piix4.c +4 -4
@@ -424,7 +424,7 @@ static int piix4_pm_initfn(PCIDevice *dev)memory_region_add_subregion (pci_address_space_io (dev), s->smb_io_base, &s->smb.io); -memory_region_init (&s->io,"piix4-pm" ,64 ); +memory_region_init (&s->io,NULL ,"piix4-pm" ,64 );memory_region_set_enabled (&s->io, false);memory_region_add_subregion (pci_address_space_io (dev),0 , &s->io);
@@ -671,18 +671,18 @@ static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev,static void piix4_acpi_system_hot_add_init (MemoryRegion *parent,PCIBus *bus,PIIX4PMState *s) { -memory_region_init_io (&s->io_gpe, &piix4_gpe_ops, s,"apci-gpe0" , +memory_region_init_io (&s->io_gpe,NULL , &piix4_gpe_ops, s,"apci-gpe0" ,GPE_LEN );memory_region_add_subregion (parent,GPE_BASE , &s->io_gpe); -memory_region_init_io (&s->io_pci, &piix4_pci_ops, s,"apci-pci-hotplug" , +memory_region_init_io (&s->io_pci,NULL , &piix4_pci_ops, s,"apci-pci-hotplug" ,PCI_HOTPLUG_SIZE );memory_region_add_subregion (parent,PCI_HOTPLUG_ADDR , &s->io_pci);pci_bus_hotplug (bus, piix4_device_hotplug, &s->dev.qdev);qemu_for_each_cpu (piix4_init_cpu_status, &s->gpe_cpu); -memory_region_init_io (&s->io_cpu, &cpu_hotplug_ops, s,"apci-cpu-hotplug" , +memory_region_init_io (&s->io_cpu,NULL , &cpu_hotplug_ops, s,"apci-cpu-hotplug" ,PIIX4_PROC_LEN );memory_region_add_subregion (parent,PIIX4_PROC_BASE , &s->io_cpu); s->cpu_added_notifier.notify = piix4_cpu_added_req;
hw/alpha/typhoon.c +8 -8
@@ -735,7 +735,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, but the address space hole reserved at this point is 8TB. */ -memory_region_init_ram (&s->ram_region,"ram" , ram_size); +memory_region_init_ram (&s->ram_region,NULL ,"ram" , ram_size);vmstate_register_ram_global (&s->ram_region);memory_region_add_subregion (addr_space,0 , &s->ram_region);
@@ -744,22 +744,22 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,the flash ROM. I'm not sure that we need to implement it at all. */ /* Pchip0 CSRs, 0x801.8000.0000, 256MB. */ -memory_region_init_io (&s->pchip.region, &pchip_ops, s,"pchip0" ,256 *MB ); +memory_region_init_io (&s->pchip.region,NULL , &pchip_ops, s,"pchip0" ,256 *MB );memory_region_add_subregion (addr_space,0x80180000000ULL , &s->pchip.region);/* Cchip CSRs, 0x801.A000.0000, 256MB. */ -memory_region_init_io (&s->cchip.region, &cchip_ops, s,"cchip0" ,256 *MB ); +memory_region_init_io (&s->cchip.region,NULL , &cchip_ops, s,"cchip0" ,256 *MB );memory_region_add_subregion (addr_space,0x801a0000000ULL , &s->cchip.region);/* Dchip CSRs, 0x801.B000.0000, 256MB. */ -memory_region_init_io (&s->dchip_region, &dchip_ops, s,"dchip0" ,256 *MB ); +memory_region_init_io (&s->dchip_region,NULL , &dchip_ops, s,"dchip0" ,256 *MB );memory_region_add_subregion (addr_space,0x801b0000000ULL , &s->dchip_region);/* Pchip0 PCI memory, 0x800.0000.0000, 4GB. */ -memory_region_init (&s->pchip.reg_mem,"pci0-mem" ,4 *GB ); +memory_region_init (&s->pchip.reg_mem,NULL ,"pci0-mem" ,4 *GB );memory_region_add_subregion (addr_space,0x80000000000ULL , &s->pchip.reg_mem);
@@ -767,7 +767,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,/* ??? Ideally we drop the "system" i/o space on the floor and give the PCI subsystem the full address space reserved by the chipset. We can't do that until the MEM and IO paths in memory.c are unified. */ -memory_region_init_io (&s->pchip.reg_io, &alpha_pci_bw_io_ops,NULL , +memory_region_init_io (&s->pchip.reg_io,NULL , &alpha_pci_bw_io_ops,NULL ,"pci0-io" ,32 *MB );memory_region_add_subregion (addr_space,0x801fc000000ULL , &s->pchip.reg_io);
@@ -778,13 +778,13 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, phb->bus = b;/* Pchip0 PCI special/interrupt acknowledge, 0x801.F800.0000, 64MB. */ -memory_region_init_io (&s->pchip.reg_iack, &alpha_pci_iack_ops, b, +memory_region_init_io (&s->pchip.reg_iack,NULL , &alpha_pci_iack_ops, b,"pci0-iack" ,64 *MB );memory_region_add_subregion (addr_space,0x801f8000000ULL , &s->pchip.reg_iack);/* Pchip0 PCI configuration, 0x801.FE00.0000, 16MB. */ -memory_region_init_io (&s->pchip.reg_conf, &alpha_pci_conf1_ops, b, +memory_region_init_io (&s->pchip.reg_conf,NULL , &alpha_pci_conf1_ops, b,"pci0-conf" ,16 *MB );memory_region_add_subregion (addr_space,0x801fe000000ULL , &s->pchip.reg_conf);
hw/arm/armv7m.c +4 -4
@@ -124,7 +124,7 @@ static int bitband_init(SysBusDevice *dev) {BitBandState *s =FROM_SYSBUS (BitBandState, dev); -memory_region_init_io (&s->iomem, &bitband_ops, &s->base,"bitband" , +memory_region_init_io (&s->iomem,NULL , &bitband_ops, &s->base,"bitband" ,0x02000000 );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -203,11 +203,11 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,#endif /* Flash programming is done via the SCU, so pretend it is ROM. */ -memory_region_init_ram (flash,"armv7m.flash" , flash_size); +memory_region_init_ram (flash,NULL ,"armv7m.flash" , flash_size);vmstate_register_ram_global (flash);memory_region_set_readonly (flash, true);memory_region_add_subregion (address_space_mem,0 , flash); -memory_region_init_ram (sram,"armv7m.sram" , sram_size); +memory_region_init_ram (sram,NULL ,"armv7m.sram" , sram_size);vmstate_register_ram_global (sram);memory_region_add_subregion (address_space_mem,0x20000000 , sram);armv7m_bitband_init ();
@@ -247,7 +247,7 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,/* Hack to map an additional page of ram at the top of the address space. This stops qemu complaining about executing code outside RAM when returning from an exception. */ -memory_region_init_ram (hack,"armv7m.hack" ,0x1000 ); +memory_region_init_ram (hack,NULL ,"armv7m.hack" ,0x1000 );vmstate_register_ram_global (hack);memory_region_add_subregion (address_space_mem,0xfffff000 , hack);
hw/arm/exynos4210.c +6 -6
@@ -241,20 +241,20 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,/*** Memory ***/ /* Chip-ID and OMR */ -memory_region_init_io (&s->chipid_mem, &exynos4210_chipid_and_omr_ops, +memory_region_init_io (&s->chipid_mem,NULL , &exynos4210_chipid_and_omr_ops,NULL ,"exynos4210.chipid" ,sizeof (chipid_and_omr));memory_region_add_subregion (system_mem,EXYNOS4210_CHIPID_ADDR , &s->chipid_mem);/* Internal ROM */ -memory_region_init_ram (&s->irom_mem,"exynos4210.irom" , +memory_region_init_ram (&s->irom_mem,NULL ,"exynos4210.irom" ,EXYNOS4210_IROM_SIZE );vmstate_register_ram_global (&s->irom_mem);memory_region_set_readonly (&s->irom_mem, true);memory_region_add_subregion (system_mem,EXYNOS4210_IROM_BASE_ADDR , &s->irom_mem);/* mirror of iROM */ -memory_region_init_alias (&s->irom_alias_mem,"exynos4210.irom_alias" , +memory_region_init_alias (&s->irom_alias_mem,NULL ,"exynos4210.irom_alias" , &s->irom_mem,0 ,EXYNOS4210_IROM_SIZE );
@@ -263,7 +263,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, &s->irom_alias_mem);/* Internal RAM */ -memory_region_init_ram (&s->iram_mem,"exynos4210.iram" , +memory_region_init_ram (&s->iram_mem,NULL ,"exynos4210.iram" ,EXYNOS4210_IRAM_SIZE );vmstate_register_ram_global (&s->iram_mem); memory_region_add_subregion(system_mem, EXYNOS4210_IRAM_BASE_ADDR,
@@ -272,14 +272,14 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,/* DRAM */ mem_size = ram_size;if (mem_size >EXYNOS4210_DRAM_MAX_SIZE ) { -memory_region_init_ram (&s->dram1_mem,"exynos4210.dram1" , +memory_region_init_ram (&s->dram1_mem,NULL ,"exynos4210.dram1" , mem_size -EXYNOS4210_DRAM_MAX_SIZE );vmstate_register_ram_global (&s->dram1_mem);memory_region_add_subregion (system_mem,EXYNOS4210_DRAM1_BASE_ADDR , &s->dram1_mem); mem_size =EXYNOS4210_DRAM_MAX_SIZE ; } -memory_region_init_ram (&s->dram0_mem,"exynos4210.dram0" , mem_size); +memory_region_init_ram (&s->dram0_mem,NULL ,"exynos4210.dram0" , mem_size);vmstate_register_ram_global (&s->dram0_mem);memory_region_add_subregion (system_mem,EXYNOS4210_DRAM0_BASE_ADDR , &s->dram0_mem);
hw/arm/highbank.c +3 -3
@@ -149,7 +149,7 @@ static int highbank_regs_init(SysBusDevice *dev)HighbankRegsState *s =FROM_SYSBUS (HighbankRegsState, dev); s->iomem =g_new (MemoryRegion,1 ); -memory_region_init_io (s->iomem, &hb_mem_ops, s->regs,"highbank_regs" , +memory_region_init_io (s->iomem,NULL , &hb_mem_ops, s->regs,"highbank_regs" ,0x1000 );sysbus_init_mmio (dev, s->iomem);
@@ -227,12 +227,12 @@ static void highbank_init(QEMUMachineInitArgs *args) sysmem =get_system_memory (); dram =g_new (MemoryRegion,1 ); -memory_region_init_ram (dram,"highbank.dram" , ram_size); +memory_region_init_ram (dram,NULL ,"highbank.dram" , ram_size);/* SDRAM at address zero. */ memory_region_add_subregion (sysmem,0 , dram); sysram =g_new (MemoryRegion,1 ); -memory_region_init_ram (sysram,"highbank.sysram" ,0x8000 ); +memory_region_init_ram (sysram,NULL ,"highbank.sysram" ,0x8000 );memory_region_add_subregion (sysmem,0xfff88000 , sysram);if (bios_name !=NULL ) { sysboot_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name);
hw/arm/integratorcp.c +6 -6
@@ -249,10 +249,10 @@ static int integratorcm_init(SysBusDevice *dev) }memcpy (integrator_spd +73 ,"QEMU-MEMORY" ,11 ); s->cm_init =0x00000112 ; -memory_region_init_ram (&s->flash,"integrator.flash" ,0x100000 ); +memory_region_init_ram (&s->flash,NULL ,"integrator.flash" ,0x100000 );vmstate_register_ram_global (&s->flash); -memory_region_init_io (&s->iomem, &integratorcm_ops, s, +memory_region_init_io (&s->iomem,NULL , &integratorcm_ops, s,"integratorcm" ,0x00800000 );sysbus_init_mmio (dev, &s->iomem);
@@ -374,7 +374,7 @@ static int icp_pic_init(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, icp_pic_set_irq,32 );sysbus_init_irq (dev, &s->parent_irq);sysbus_init_irq (dev, &s->parent_fiq); -memory_region_init_io (&s->iomem, &icp_pic_ops, s,"icp-pic" ,0x00800000 ); +memory_region_init_io (&s->iomem,NULL , &icp_pic_ops, s,"icp-pic" ,0x00800000 );sysbus_init_mmio (dev, &s->iomem);return 0 ; }
@@ -424,7 +424,7 @@ static void icp_control_init(hwaddr base)MemoryRegion *io; io = (MemoryRegion *)g_malloc0 (sizeof (MemoryRegion)); -memory_region_init_io (io, &icp_control_ops,NULL , +memory_region_init_io (io,NULL , &icp_control_ops,NULL ,"control" ,0x00800000 );memory_region_add_subregion (get_system_memory (), base, io);/* ??? Save/restore. */
@@ -463,14 +463,14 @@ static void integratorcp_init(QEMUMachineInitArgs *args)exit (1 ); } -memory_region_init_ram (ram,"integrator.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"integrator.ram" , ram_size);vmstate_register_ram_global (ram);/* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */ /* ??? RAM should repeat to fill physical memory space. */ /* SDRAM at address zero*/ memory_region_add_subregion (address_space_mem,0 , ram);/* And again at address 0x80000000 */ -memory_region_init_alias (ram_alias,"ram.alias" , ram,0 , ram_size); +memory_region_init_alias (ram_alias,NULL ,"ram.alias" , ram,0 , ram_size);memory_region_add_subregion (address_space_mem,0x80000000 , ram_alias); dev =qdev_create (NULL ,"integrator_core" );
hw/arm/kzm.c +3 -3
@@ -98,14 +98,14 @@ static void kzm_init(QEMUMachineInitArgs *args)/* On a real system, the first 16k is a `secure boot rom' */ -memory_region_init_ram (ram,"kzm.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"kzm.ram" , ram_size);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,KZM_RAMADDRESS , ram); -memory_region_init_alias (ram_alias,"ram.alias" , ram,0 , ram_size); +memory_region_init_alias (ram_alias,NULL ,"ram.alias" , ram,0 , ram_size);memory_region_add_subregion (address_space_mem,0x88000000 , ram_alias); -memory_region_init_ram (sram,"kzm.sram" ,0x4000 ); +memory_region_init_ram (sram,NULL ,"kzm.sram" ,0x4000 );memory_region_add_subregion (address_space_mem,0x1FFFC000 , sram); cpu_pic =arm_pic_init_cpu (cpu);
hw/arm/mainstone.c +1 -1
@@ -113,7 +113,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,/* Setup CPU & memory */ mpu =pxa270_init (address_space_mem, mainstone_binfo.ram_size, cpu_model); -memory_region_init_ram (rom,"mainstone.rom" ,MAINSTONE_ROM ); +memory_region_init_ram (rom,NULL ,"mainstone.rom" ,MAINSTONE_ROM );vmstate_register_ram_global (rom);memory_region_set_readonly (rom, true);memory_region_add_subregion (address_space_mem,0 , rom);
hw/arm/musicpal.c +11 -11
@@ -389,7 +389,7 @@ static int mv88w8618_eth_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); s->nic =qemu_new_nic (&net_mv88w8618_info, &s->conf,object_get_typename (OBJECT (dev)), dev->qdev.id, s); -memory_region_init_io (&s->iomem, &mv88w8618_eth_ops, s,"mv88w8618-eth" , +memory_region_init_io (&s->iomem,NULL , &mv88w8618_eth_ops, s,"mv88w8618-eth" ,MP_ETH_SIZE );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -612,7 +612,7 @@ static int musicpal_lcd_init(SysBusDevice *dev) s->brightness =7 ; -memory_region_init_io (&s->iomem, &musicpal_lcd_ops, s, +memory_region_init_io (&s->iomem,NULL , &musicpal_lcd_ops, s,"musicpal-lcd" ,MP_LCD_SIZE );sysbus_init_mmio (dev, &s->iomem);
@@ -740,7 +740,7 @@ static int mv88w8618_pic_init(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, mv88w8618_pic_set_irq,32 );sysbus_init_irq (dev, &s->parent_irq); -memory_region_init_io (&s->iomem, &mv88w8618_pic_ops, s, +memory_region_init_io (&s->iomem,NULL , &mv88w8618_pic_ops, s,"musicpal-pic" ,MP_PIC_SIZE );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -905,7 +905,7 @@ static int mv88w8618_pit_init(SysBusDevice *dev)mv88w8618_timer_init (dev, &s->timer[i],1000000 ); } -memory_region_init_io (&s->iomem, &mv88w8618_pit_ops, s, +memory_region_init_io (&s->iomem,NULL , &mv88w8618_pit_ops, s,"musicpal-pit" ,MP_PIT_SIZE );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -999,7 +999,7 @@ static int mv88w8618_flashcfg_init(SysBusDevice *dev)mv88w8618_flashcfg_state *s =FROM_SYSBUS (mv88w8618_flashcfg_state, dev); s->cfgr0 =0xfffe4285 ;/* Default as set by U-Boot for 8 MB flash */ -memory_region_init_io (&s->iomem, &mv88w8618_flashcfg_ops, s, +memory_region_init_io (&s->iomem,NULL , &mv88w8618_flashcfg_ops, s,"musicpal-flashcfg" ,MP_FLASHCFG_SIZE );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -1074,7 +1074,7 @@ static void musicpal_misc_init(Object *obj)SysBusDevice *sd =SYS_BUS_DEVICE (obj);MusicPalMiscState *s =MUSICPAL_MISC (obj); -memory_region_init_io (&s->iomem, &musicpal_misc_ops,NULL , +memory_region_init_io (&s->iomem,NULL , &musicpal_misc_ops,NULL ,"musicpal-misc" ,MP_MISC_SIZE );sysbus_init_mmio (sd, &s->iomem); }
@@ -1121,7 +1121,7 @@ static int mv88w8618_wlan_init(SysBusDevice *dev) {MemoryRegion *iomem =g_new (MemoryRegion,1 ); -memory_region_init_io (iomem, &mv88w8618_wlan_ops,NULL , +memory_region_init_io (iomem,NULL , &mv88w8618_wlan_ops,NULL ,"musicpal-wlan" ,MP_WLAN_SIZE );sysbus_init_mmio (dev, iomem);return 0 ;
@@ -1327,7 +1327,7 @@ static int musicpal_gpio_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->iomem, &musicpal_gpio_ops, s, +memory_region_init_io (&s->iomem,NULL , &musicpal_gpio_ops, s,"musicpal-gpio" ,MP_GPIO_SIZE );sysbus_init_mmio (dev, &s->iomem);
@@ -1484,7 +1484,7 @@ static int musicpal_key_init(SysBusDevice *dev) {musicpal_key_state *s =FROM_SYSBUS (musicpal_key_state, dev); -memory_region_init (&s->iomem,"dummy" ,0 ); +memory_region_init (&s->iomem,NULL ,"dummy" ,0 );sysbus_init_mmio (dev, &s->iomem); s->kbd_extended =0 ;
@@ -1564,11 +1564,11 @@ static void musicpal_init(QEMUMachineInitArgs *args) cpu_pic =arm_pic_init_cpu (cpu);/* For now we use a fixed - the original - RAM size */ -memory_region_init_ram (ram,"musicpal.ram" ,MP_RAM_DEFAULT_SIZE ); +memory_region_init_ram (ram,NULL ,"musicpal.ram" ,MP_RAM_DEFAULT_SIZE );vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0 , ram); -memory_region_init_ram (sram,"musicpal.sram" ,MP_SRAM_SIZE ); +memory_region_init_ram (sram,NULL ,"musicpal.sram" ,MP_SRAM_SIZE );vmstate_register_ram_global (sram);memory_region_add_subregion (address_space_mem,MP_SRAM_BASE , sram);
hw/arm/omap1.c +26 -26
187 lines not on this page · raw message
hw/arm/omap2.c +8 -8
@@ -603,7 +603,7 @@ static struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta,AUD_register_card ("OMAP EAC" , &s->codec.card); -memory_region_init_io (&s->iomem, &omap_eac_ops, s,"omap.eac" , +memory_region_init_io (&s->iomem,NULL , &omap_eac_ops, s,"omap.eac" ,omap_l4_region_size (ta,0 ));omap_l4_attach (ta,0 , &s->iomem);
@@ -791,11 +791,11 @@ static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta, s->chr = chr ?:qemu_chr_new ("null" ,"null" ,NULL ); -memory_region_init_io (&s->iomem, &omap_sti_ops, s,"omap.sti" , +memory_region_init_io (&s->iomem,NULL , &omap_sti_ops, s,"omap.sti" ,omap_l4_region_size (ta,0 ));omap_l4_attach (ta,0 , &s->iomem); -memory_region_init_io (&s->iomem_fifo, &omap_sti_fifo_ops, s, +memory_region_init_io (&s->iomem_fifo,NULL , &omap_sti_fifo_ops, s,"omap.sti.fifo" ,0x10000 );memory_region_add_subregion (sysmem, channel_base, &s->iomem_fifo);
@@ -1809,9 +1809,9 @@ static struct omap_prcm_s *omap_prcm_init(struct omap_target_agent_s *ta, s->mpu = mpu;omap_prcm_coldreset (s); -memory_region_init_io (&s->iomem0, &omap_prcm_ops, s,"omap.pcrm0" , +memory_region_init_io (&s->iomem0,NULL , &omap_prcm_ops, s,"omap.pcrm0" ,omap_l4_region_size (ta,0 )); -memory_region_init_io (&s->iomem1, &omap_prcm_ops, s,"omap.pcrm1" , +memory_region_init_io (&s->iomem1,NULL , &omap_prcm_ops, s,"omap.pcrm1" ,omap_l4_region_size (ta,1 ));omap_l4_attach (ta,0 , &s->iomem0);omap_l4_attach (ta,1 , &s->iomem1);
@@ -2185,7 +2185,7 @@ static struct omap_sysctl_s *omap_sysctl_init(struct omap_target_agent_s *ta, s->mpu = mpu;omap_sysctl_reset (s); -memory_region_init_io (&s->iomem, &omap_sysctl_ops, s,"omap.sysctl" , +memory_region_init_io (&s->iomem,NULL , &omap_sysctl_ops, s,"omap.sysctl" ,omap_l4_region_size (ta,0 ));omap_l4_attach (ta,0 , &s->iomem);
@@ -2267,10 +2267,10 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,omap_clk_init (s);/* Memory-mapped stuff */ -memory_region_init_ram (&s->sdram,"omap2.dram" , s->sdram_size); +memory_region_init_ram (&s->sdram,NULL ,"omap2.dram" , s->sdram_size);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (sysmem,OMAP2_Q2_BASE , &s->sdram); -memory_region_init_ram (&s->sram,"omap2.sram" , s->sram_size); +memory_region_init_ram (&s->sram,NULL ,"omap2.sram" , s->sram_size);vmstate_register_ram_global (&s->sram);memory_region_add_subregion (sysmem,OMAP2_SRAM_BASE , &s->sram);
hw/arm/omap_sx1.c +7 -7
@@ -120,23 +120,23 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version) mpu =omap310_mpu_init (address_space, sx1_binfo.ram_size, args->cpu_model);/* External Flash (EMIFS) */ -memory_region_init_ram (flash,"omap_sx1.flash0-0" , flash_size); +memory_region_init_ram (flash,NULL ,"omap_sx1.flash0-0" , flash_size);vmstate_register_ram_global (flash);memory_region_set_readonly (flash, true);memory_region_add_subregion (address_space,OMAP_CS0_BASE , flash); -memory_region_init_io (&cs[0 ], &static_ops, &cs0val, +memory_region_init_io (&cs[0 ],NULL , &static_ops, &cs0val,"sx1.cs0" ,OMAP_CS0_SIZE - flash_size);memory_region_add_subregion (address_space,OMAP_CS0_BASE + flash_size, &cs[0 ]); -memory_region_init_io (&cs[2 ], &static_ops, &cs2val, +memory_region_init_io (&cs[2 ],NULL , &static_ops, &cs2val,"sx1.cs2" ,OMAP_CS2_SIZE );memory_region_add_subregion (address_space,OMAP_CS2_BASE , &cs[2 ]); -memory_region_init_io (&cs[3 ], &static_ops, &cs3val, +memory_region_init_io (&cs[3 ],NULL , &static_ops, &cs3val,"sx1.cs3" ,OMAP_CS3_SIZE );memory_region_add_subregion (address_space,OMAP_CS2_BASE , &cs[3 ]);
@@ -162,12 +162,12 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version)if ((version ==1 ) && (dinfo =drive_get (IF_PFLASH ,0 , fl_idx)) !=NULL ) { -memory_region_init_ram (flash_1,"omap_sx1.flash1-0" , flash1_size); +memory_region_init_ram (flash_1,NULL ,"omap_sx1.flash1-0" , flash1_size);vmstate_register_ram_global (flash_1);memory_region_set_readonly (flash_1, true);memory_region_add_subregion (address_space,OMAP_CS1_BASE , flash_1); -memory_region_init_io (&cs[1 ], &static_ops, &cs1val, +memory_region_init_io (&cs[1 ],NULL , &static_ops, &cs1val,"sx1.cs1" ,OMAP_CS1_SIZE - flash1_size);memory_region_add_subregion (address_space,OMAP_CS1_BASE + flash1_size, &cs[1 ]);
@@ -182,7 +182,7 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version) } fl_idx++; }else { -memory_region_init_io (&cs[1 ], &static_ops, &cs1val, +memory_region_init_io (&cs[1 ],NULL , &static_ops, &cs1val,"sx1.cs1" ,OMAP_CS1_SIZE );memory_region_add_subregion (address_space,OMAP_CS1_BASE , &cs[1 ]);
hw/arm/palm.c +5 -5
@@ -211,22 +211,22 @@ static void palmte_init(QEMUMachineInitArgs *args) mpu =omap310_mpu_init (address_space_mem, sdram_size, cpu_model);/* External Flash (EMIFS) */ -memory_region_init_ram (flash,"palmte.flash" , flash_size); +memory_region_init_ram (flash,NULL ,"palmte.flash" , flash_size);vmstate_register_ram_global (flash);memory_region_set_readonly (flash, true);memory_region_add_subregion (address_space_mem,OMAP_CS0_BASE , flash); -memory_region_init_io (&cs[0 ], &static_ops, &cs0val,"palmte-cs0" , +memory_region_init_io (&cs[0 ],NULL , &static_ops, &cs0val,"palmte-cs0" ,OMAP_CS0_SIZE - flash_size);memory_region_add_subregion (address_space_mem,OMAP_CS0_BASE + flash_size, &cs[0 ]); -memory_region_init_io (&cs[1 ], &static_ops, &cs1val,"palmte-cs1" , +memory_region_init_io (&cs[1 ],NULL , &static_ops, &cs1val,"palmte-cs1" ,OMAP_CS1_SIZE );memory_region_add_subregion (address_space_mem,OMAP_CS1_BASE , &cs[1 ]); -memory_region_init_io (&cs[2 ], &static_ops, &cs2val,"palmte-cs2" , +memory_region_init_io (&cs[2 ],NULL , &static_ops, &cs2val,"palmte-cs2" ,OMAP_CS2_SIZE );memory_region_add_subregion (address_space_mem,OMAP_CS2_BASE , &cs[2 ]); -memory_region_init_io (&cs[3 ], &static_ops, &cs3val,"palmte-cs3" , +memory_region_init_io (&cs[3 ],NULL , &static_ops, &cs3val,"palmte-cs3" ,OMAP_CS3_SIZE );memory_region_add_subregion (address_space_mem,OMAP_CS3_BASE , &cs[3 ]);
hw/arm/pxa2xx.c +15 -15
@@ -764,7 +764,7 @@ static int pxa2xx_ssp_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->iomem, &pxa2xx_ssp_ops, s,"pxa2xx-ssp" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pxa2xx_ssp_ops, s,"pxa2xx-ssp" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);register_savevm (&dev->qdev,"pxa2xx_ssp" ,-1 ,0 , pxa2xx_ssp_save, pxa2xx_ssp_load, s);
@@ -1131,7 +1131,7 @@ static int pxa2xx_rtc_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->rtc_irq); -memory_region_init_io (&s->iomem, &pxa2xx_rtc_ops, s,"pxa2xx-rtc" ,0x10000 ); +memory_region_init_io (&s->iomem,NULL , &pxa2xx_rtc_ops, s,"pxa2xx-rtc" ,0x10000 );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -1481,7 +1481,7 @@ static int pxa2xx_i2c_initfn(SysBusDevice *dev) s->bus =i2c_init_bus (&dev->qdev,"i2c" ); -memory_region_init_io (&s->iomem, &pxa2xx_i2c_ops, s, +memory_region_init_io (&s->iomem,NULL , &pxa2xx_i2c_ops, s,"pxa2xx-i2x" , s->region_size);sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);
@@ -1720,7 +1720,7 @@ static PXA2xxI2SState *pxa2xx_i2s_init(MemoryRegion *sysmem,pxa2xx_i2s_reset (s); -memory_region_init_io (&s->iomem, &pxa2xx_i2s_ops, s, +memory_region_init_io (&s->iomem,NULL , &pxa2xx_i2s_ops, s,"pxa2xx-i2s" ,0x100000 );memory_region_add_subregion (sysmem, base, &s->iomem);
@@ -1978,7 +1978,7 @@ static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem,pxa2xx_fir_reset (s); -memory_region_init_io (&s->iomem, &pxa2xx_fir_ops, s,"pxa2xx-fir" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pxa2xx_fir_ops, s,"pxa2xx-fir" ,0x1000 );memory_region_add_subregion (sysmem, base, &s->iomem);if (chr) {
@@ -2027,10 +2027,10 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, s->reset =qemu_allocate_irqs (pxa2xx_reset, s,1 )[0 ];/* SDRAM & Internal Memory Storage */ -memory_region_init_ram (&s->sdram,"pxa270.sdram" , sdram_size); +memory_region_init_ram (&s->sdram,NULL ,"pxa270.sdram" , sdram_size);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (address_space,PXA2XX_SDRAM_BASE , &s->sdram); -memory_region_init_ram (&s->internal,"pxa270.internal" ,0x40000 ); +memory_region_init_ram (&s->internal,NULL ,"pxa270.internal" ,0x40000 );vmstate_register_ram_global (&s->internal);memory_region_add_subregion (address_space,PXA2XX_INTERNAL_BASE , &s->internal);
@@ -2083,7 +2083,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, s->cm_base =0x41300000 ; s->cm_regs[CCCR >>2 ] =0x02000210 ;/* 416.0 MHz */ s->clkcfg =0x00000009 ;/* Turbo mode active */ -memory_region_init_io (&s->cm_iomem, &pxa2xx_cm_ops, s,"pxa2xx-cm" ,0x1000 ); +memory_region_init_io (&s->cm_iomem,NULL , &pxa2xx_cm_ops, s,"pxa2xx-cm" ,0x1000 );memory_region_add_subregion (address_space, s->cm_base, &s->cm_iomem);vmstate_register (NULL ,0 , &vmstate_pxa2xx_cm, s);
@@ -2093,12 +2093,12 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, s->mm_regs[MDMRS >>2 ] =0x00020002 ; s->mm_regs[MDREFR >>2 ] =0x03ca4000 ; s->mm_regs[MECR >>2 ] =0x00000001 ;/* Two PC Card sockets */ -memory_region_init_io (&s->mm_iomem, &pxa2xx_mm_ops, s,"pxa2xx-mm" ,0x1000 ); +memory_region_init_io (&s->mm_iomem,NULL , &pxa2xx_mm_ops, s,"pxa2xx-mm" ,0x1000 );memory_region_add_subregion (address_space, s->mm_base, &s->mm_iomem);vmstate_register (NULL ,0 , &vmstate_pxa2xx_mm, s); s->pm_base =0x40f00000 ; -memory_region_init_io (&s->pm_iomem, &pxa2xx_pm_ops, s,"pxa2xx-pm" ,0x100 ); +memory_region_init_io (&s->pm_iomem,NULL , &pxa2xx_pm_ops, s,"pxa2xx-pm" ,0x100 );memory_region_add_subregion (address_space, s->pm_base, &s->pm_iomem);vmstate_register (NULL ,0 , &vmstate_pxa2xx_pm, s);
@@ -2158,10 +2158,10 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) s->reset =qemu_allocate_irqs (pxa2xx_reset, s,1 )[0 ];/* SDRAM & Internal Memory Storage */ -memory_region_init_ram (&s->sdram,"pxa255.sdram" , sdram_size); +memory_region_init_ram (&s->sdram,NULL ,"pxa255.sdram" , sdram_size);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (address_space,PXA2XX_SDRAM_BASE , &s->sdram); -memory_region_init_ram (&s->internal,"pxa255.internal" , +memory_region_init_ram (&s->internal,NULL ,"pxa255.internal" ,PXA2XX_INTERNAL_SIZE );vmstate_register_ram_global (&s->internal); memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE,
@@ -2214,7 +2214,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) s->cm_base =0x41300000 ; s->cm_regs[CCCR >>2 ] =0x02000210 ;/* 416.0 MHz */ s->clkcfg =0x00000009 ;/* Turbo mode active */ -memory_region_init_io (&s->cm_iomem, &pxa2xx_cm_ops, s,"pxa2xx-cm" ,0x1000 ); +memory_region_init_io (&s->cm_iomem,NULL , &pxa2xx_cm_ops, s,"pxa2xx-cm" ,0x1000 );memory_region_add_subregion (address_space, s->cm_base, &s->cm_iomem);vmstate_register (NULL ,0 , &vmstate_pxa2xx_cm, s);
@@ -2224,12 +2224,12 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) s->mm_regs[MDMRS >>2 ] =0x00020002 ; s->mm_regs[MDREFR >>2 ] =0x03ca4000 ; s->mm_regs[MECR >>2 ] =0x00000001 ;/* Two PC Card sockets */ -memory_region_init_io (&s->mm_iomem, &pxa2xx_mm_ops, s,"pxa2xx-mm" ,0x1000 ); +memory_region_init_io (&s->mm_iomem,NULL , &pxa2xx_mm_ops, s,"pxa2xx-mm" ,0x1000 );memory_region_add_subregion (address_space, s->mm_base, &s->mm_iomem);vmstate_register (NULL ,0 , &vmstate_pxa2xx_mm, s); s->pm_base =0x40f00000 ; -memory_region_init_io (&s->pm_iomem, &pxa2xx_pm_ops, s,"pxa2xx-pm" ,0x100 ); +memory_region_init_io (&s->pm_iomem,NULL , &pxa2xx_pm_ops, s,"pxa2xx-pm" ,0x100 );memory_region_add_subregion (address_space, s->pm_base, &s->pm_iomem);vmstate_register (NULL ,0 , &vmstate_pxa2xx_pm, s);
hw/arm/pxa2xx_gpio.c +1 -1
@@ -283,7 +283,7 @@ static int pxa2xx_gpio_initfn(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, pxa2xx_gpio_set, s->lines);qdev_init_gpio_out (&dev->qdev, s->handler, s->lines); -memory_region_init_io (&s->iomem, &pxa_gpio_ops, s,"pxa2xx-gpio" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pxa_gpio_ops, s,"pxa2xx-gpio" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq0);sysbus_init_irq (dev, &s->irq1);
hw/arm/pxa2xx_pic.c +1 -1
@@ -278,7 +278,7 @@ DeviceState *pxa2xx_pic_init(hwaddr base, ARMCPU *cpu)qdev_init_gpio_in (dev, pxa2xx_pic_set_irq,PXA2XX_PIC_SRCS );/* Enable IC memory-mapped registers access. */ -memory_region_init_io (&s->iomem, &pxa2xx_pic_ops, s, +memory_region_init_io (&s->iomem,NULL , &pxa2xx_pic_ops, s,"pxa2xx-pic" ,0x00100000 );sysbus_init_mmio (SYS_BUS_DEVICE (dev), &s->iomem);sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 , base);
hw/arm/realview.c +4 -4
@@ -114,18 +114,18 @@ static void realview_init(QEMUMachineInitArgs *args,/* Core tile RAM. */ low_ram_size = ram_size -0x20000000 ; ram_size =0x20000000 ; -memory_region_init_ram (ram_lo,"realview.lowmem" , low_ram_size); +memory_region_init_ram (ram_lo,NULL ,"realview.lowmem" , low_ram_size);vmstate_register_ram_global (ram_lo);memory_region_add_subregion (sysmem,0x20000000 , ram_lo); } -memory_region_init_ram (ram_hi,"realview.highmem" , ram_size); +memory_region_init_ram (ram_hi,NULL ,"realview.highmem" , ram_size);vmstate_register_ram_global (ram_hi); low_ram_size = ram_size;if (low_ram_size >0x10000000 ) low_ram_size =0x10000000 ;/* SDRAM at address zero. */ -memory_region_init_alias (ram_alias,"realview.alias" , +memory_region_init_alias (ram_alias,NULL ,"realview.alias" , ram_hi,0 , low_ram_size);memory_region_add_subregion (sysmem,0 , ram_alias);if (is_pb) {
@@ -318,7 +318,7 @@ static void realview_init(QEMUMachineInitArgs *args,startup code. I guess this works on real hardware because the BootROM happens to be in ROM/flash or in memory that isn't clobbered until after Linux boots the secondary CPUs. */ -memory_region_init_ram (ram_hack,"realview.hack" ,0x1000 ); +memory_region_init_ram (ram_hack,NULL ,"realview.hack" ,0x1000 );vmstate_register_ram_global (ram_hack);memory_region_add_subregion (sysmem,SMP_BOOT_ADDR , ram_hack);
hw/arm/spitz.c +2 -2
@@ -169,7 +169,7 @@ static int sl_nand_init(SysBusDevice *dev) { nand =drive_get (IF_MTD ,0 ,0 ); s->nand =nand_init (nand ? nand->bdrv :NULL , s->manf_id, s->chip_id); -memory_region_init_io (&s->iomem, &sl_ops, s,"sl" ,0x40 ); +memory_region_init_io (&s->iomem,NULL , &sl_ops, s,"sl" ,0x40 );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -896,7 +896,7 @@ static void spitz_common_init(QEMUMachineInitArgs *args,sl_flash_register (mpu, (model == spitz) ?FLASH_128M :FLASH_1024M ); -memory_region_init_ram (rom,"spitz.rom" ,SPITZ_ROM ); +memory_region_init_ram (rom,NULL ,"spitz.rom" ,SPITZ_ROM );vmstate_register_ram_global (rom);memory_region_set_readonly (rom, true);memory_region_add_subregion (address_space_mem,0 , rom);
hw/arm/stellaris.c +4 -4
@@ -307,7 +307,7 @@ static int stellaris_gptm_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq);qdev_init_gpio_out (&dev->qdev, &s->trigger,1 ); -memory_region_init_io (&s->iomem, &gptm_ops, s, +memory_region_init_io (&s->iomem,NULL , &gptm_ops, s,"gptm" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);
@@ -669,7 +669,7 @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq, s->user0 = macaddr[0 ] | (macaddr[1 ] <<8 ) | (macaddr[2 ] <<16 ); s->user1 = macaddr[3 ] | (macaddr[4 ] <<8 ) | (macaddr[5 ] <<16 ); -memory_region_init_io (&s->iomem, &ssys_ops, s,"ssys" ,0x00001000 ); +memory_region_init_io (&s->iomem,NULL , &ssys_ops, s,"ssys" ,0x00001000 );memory_region_add_subregion (get_system_memory (), base, &s->iomem);ssys_reset (s);vmstate_register (NULL ,-1 , &vmstate_stellaris_sys, s);
@@ -862,7 +862,7 @@ static int stellaris_i2c_init(SysBusDevice * dev) bus =i2c_init_bus (&dev->qdev,"i2c" ); s->bus = bus; -memory_region_init_io (&s->iomem, &stellaris_i2c_ops, s, +memory_region_init_io (&s->iomem,NULL , &stellaris_i2c_ops, s,"i2c" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);/* ??? For now we only implement the master interface. */
@@ -1145,7 +1145,7 @@ static int stellaris_adc_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq[n]); } -memory_region_init_io (&s->iomem, &stellaris_adc_ops, s, +memory_region_init_io (&s->iomem,NULL , &stellaris_adc_ops, s,"adc" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);stellaris_adc_reset (s);
hw/arm/strongarm.c +7 -7
@@ -173,7 +173,7 @@ static int strongarm_pic_initfn(SysBusDevice *dev)StrongARMPICState *s =FROM_SYSBUS (StrongARMPICState, dev);qdev_init_gpio_in (&dev->qdev, strongarm_pic_set_irq,SA_PIC_SRCS ); -memory_region_init_io (&s->iomem, &strongarm_pic_ops, s,"pic" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &strongarm_pic_ops, s,"pic" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);sysbus_init_irq (dev, &s->fiq);
@@ -383,7 +383,7 @@ static int strongarm_rtc_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->rtc_irq);sysbus_init_irq (dev, &s->rtc_hz_irq); -memory_region_init_io (&s->iomem, &strongarm_rtc_ops, s,"rtc" ,0x10000 ); +memory_region_init_io (&s->iomem,NULL , &strongarm_rtc_ops, s,"rtc" ,0x10000 );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -637,7 +637,7 @@ static int strongarm_gpio_initfn(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, strongarm_gpio_set,28 );qdev_init_gpio_out (&dev->qdev, s->handler,28 ); -memory_region_init_io (&s->iomem, &strongarm_gpio_ops, s,"gpio" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &strongarm_gpio_ops, s,"gpio" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);for (i =0 ; i <11 ; i++) {
@@ -808,7 +808,7 @@ static int strongarm_ppc_init(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, strongarm_ppc_set,22 );qdev_init_gpio_out (&dev->qdev, s->handler,22 ); -memory_region_init_io (&s->iomem, &strongarm_ppc_ops, s,"ppc" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &strongarm_ppc_ops, s,"ppc" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);
@@ -1204,7 +1204,7 @@ static int strongarm_uart_init(SysBusDevice *dev) {StrongARMUARTState *s =FROM_SYSBUS (StrongARMUARTState, dev); -memory_region_init_io (&s->iomem, &strongarm_uart_ops, s,"uart" ,0x10000 ); +memory_region_init_io (&s->iomem,NULL , &strongarm_uart_ops, s,"uart" ,0x10000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);
@@ -1496,7 +1496,7 @@ static int strongarm_ssp_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->iomem, &strongarm_ssp_ops, s,"ssp" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &strongarm_ssp_ops, s,"ssp" ,0x1000 );sysbus_init_mmio (dev, &s->iomem); s->bus =ssi_create_bus (&dev->qdev,"ssi" );
@@ -1571,7 +1571,7 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,exit (1 ); } -memory_region_init_ram (&s->sdram,"strongarm.sdram" , sdram_size); +memory_region_init_ram (&s->sdram,NULL ,"strongarm.sdram" , sdram_size);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (sysmem,SA_SDCS0 , &s->sdram);
hw/arm/tosa.c +1 -1
@@ -222,7 +222,7 @@ static void tosa_init(QEMUMachineInitArgs *args) mpu =pxa255_init (address_space_mem, tosa_binfo.ram_size); -memory_region_init_ram (rom,"tosa.rom" ,TOSA_ROM ); +memory_region_init_ram (rom,NULL ,"tosa.rom" ,TOSA_ROM );vmstate_register_ram_global (rom);memory_region_set_readonly (rom, true);memory_region_add_subregion (address_space_mem,0 , rom);
hw/arm/versatilepb.c +2 -2
@@ -154,7 +154,7 @@ static int vpb_sic_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->parent[i]); } s->irq =31 ; -memory_region_init_io (&s->iomem, &vpb_sic_ops, s,"vpb-sic" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &vpb_sic_ops, s,"vpb-sic" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);return 0 ; }
@@ -193,7 +193,7 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)fprintf (stderr,"Unable to find CPU definition\n" );exit (1 ); } -memory_region_init_ram (ram,"versatile.ram" , args->ram_size); +memory_region_init_ram (ram,NULL ,"versatile.ram" , args->ram_size);vmstate_register_ram_global (ram);/* ??? RAM should repeat to fill physical memory space. */ /* SDRAM at address zero. */
hw/arm/vexpress.c +6 -6
@@ -196,7 +196,7 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,exit (1 ); } -memory_region_init_ram (ram,"vexpress.highmem" , ram_size); +memory_region_init_ram (ram,NULL ,"vexpress.highmem" , ram_size);vmstate_register_ram_global (ram); low_ram_size = ram_size;if (low_ram_size >0x4000000 ) {
@@ -206,7 +206,7 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,* address space should in theory be remappable to various * things including ROM or RAM; we always map the RAM there. */ -memory_region_init_alias (lowram,"vexpress.lowmem" , ram,0 , low_ram_size); +memory_region_init_alias (lowram,NULL ,"vexpress.lowmem" , ram,0 , low_ram_size);memory_region_add_subregion (sysmem,0x0 , lowram);memory_region_add_subregion (sysmem,0x60000000 , ram);
@@ -323,7 +323,7 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard, } } -memory_region_init_ram (ram,"vexpress.highmem" , ram_size); +memory_region_init_ram (ram,NULL ,"vexpress.highmem" , ram_size);vmstate_register_ram_global (ram);/* RAM is from 0x80000000 upwards; there is no low-memory alias for it. */ memory_region_add_subregion (sysmem,0x80000000 , ram);
@@ -357,7 +357,7 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard,/* 0x2b060000: SP805 watchdog: not modelled */ /* 0x2b0a0000: PL341 dynamic memory controller: not modelled */ /* 0x2e000000: system SRAM */ -memory_region_init_ram (sram,"vexpress.a15sram" ,0x10000 ); +memory_region_init_ram (sram,NULL ,"vexpress.a15sram" ,0x10000 );vmstate_register_ram_global (sram);memory_region_add_subregion (sysmem,0x2e000000 , sram);
@@ -491,12 +491,12 @@ static void vexpress_common_init(const VEDBoardInfo *daughterboard, } sram_size =0x2000000 ; -memory_region_init_ram (sram,"vexpress.sram" , sram_size); +memory_region_init_ram (sram,NULL ,"vexpress.sram" , sram_size);vmstate_register_ram_global (sram);memory_region_add_subregion (sysmem, map[VE_SRAM ], sram); vram_size =0x800000 ; -memory_region_init_ram (vram,"vexpress.vram" , vram_size); +memory_region_init_ram (vram,NULL ,"vexpress.vram" , vram_size);vmstate_register_ram_global (vram);memory_region_add_subregion (sysmem, map[VE_VIDEORAM ], vram);
hw/arm/xilinx_zynq.c +2 -2
@@ -132,12 +132,12 @@ static void zynq_init(QEMUMachineInitArgs *args) }/* DDR remapped to address zero. */ -memory_region_init_ram (ext_ram,"zynq.ext_ram" , ram_size); +memory_region_init_ram (ext_ram,NULL ,"zynq.ext_ram" , ram_size);vmstate_register_ram_global (ext_ram);memory_region_add_subregion (address_space_mem,0 , ext_ram);/* 256K of on-chip memory */ -memory_region_init_ram (ocm_ram,"zynq.ocm_ram" ,256 <<10 ); +memory_region_init_ram (ocm_ram,NULL ,"zynq.ocm_ram" ,256 <<10 );vmstate_register_ram_global (ocm_ram);memory_region_add_subregion (address_space_mem,0xFFFC0000 , ocm_ram);
hw/audio/ac97.c +2 -2
@@ -1378,8 +1378,8 @@ static int ac97_initfn (PCIDevice *dev) c[PCI_INTERRUPT_LINE ] =0x00 ;/* intr_ln interrupt line rw */ c[PCI_INTERRUPT_PIN ] =0x01 ;/* intr_pn interrupt pin ro */ -memory_region_init_io (&s->io_nam, &ac97_io_nam_ops, s,"ac97-nam" ,1024 ); -memory_region_init_io (&s->io_nabm, &ac97_io_nabm_ops, s,"ac97-nabm" ,256 ); +memory_region_init_io (&s->io_nam,NULL , &ac97_io_nam_ops, s,"ac97-nam" ,1024 ); +memory_region_init_io (&s->io_nabm,NULL , &ac97_io_nabm_ops, s,"ac97-nabm" ,256 );pci_register_bar (&s->dev,0 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io_nam);pci_register_bar (&s->dev,1 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io_nabm);qemu_register_reset (ac97_on_reset, s);
hw/audio/cs4231.c +1 -1
@@ -144,7 +144,7 @@ static int cs4231_init1(SysBusDevice *dev) {CSState *s =FROM_SYSBUS (CSState, dev); -memory_region_init_io (&s->iomem, &cs_mem_ops, s,"cs4321" ,CS_SIZE ); +memory_region_init_io (&s->iomem,NULL , &cs_mem_ops, s,"cs4321" ,CS_SIZE );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);
hw/audio/cs4231a.c +1 -1
@@ -648,7 +648,7 @@ static void cs4231a_initfn (Object *obj) {CSState *s =CS4231A (obj); -memory_region_init_io (&s->ioports, &cs_ioport_ops, s,"cs4231a" ,4 ); +memory_region_init_io (&s->ioports,NULL , &cs_ioport_ops, s,"cs4231a" ,4 ); }static void cs4231a_realizefn (DeviceState *dev,Error **errp)
hw/audio/es1370.c +1 -1
@@ -1035,7 +1035,7 @@ static int es1370_initfn (PCIDevice *dev) c[PCI_MIN_GNT ] =0x0c ; c[PCI_MAX_LAT ] =0x80 ; -memory_region_init_io (&s->io, &es1370_io_ops, s,"es1370" ,256 ); +memory_region_init_io (&s->io,NULL , &es1370_io_ops, s,"es1370" ,256 );pci_register_bar (&s->dev,0 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io);qemu_register_reset (es1370_on_reset, s);
hw/audio/intel-hda.c +1 -1
@@ -1135,7 +1135,7 @@ static int intel_hda_init(PCIDevice *pci)/* HDCTL off 0x40 bit 0 selects signaling mode (1-HDA, 0 - Ac97) 18.1.19 */ conf[0x40 ] =0x01 ; -memory_region_init_io (&d->mmio, &intel_hda_mmio_ops, d, +memory_region_init_io (&d->mmio,NULL , &intel_hda_mmio_ops, d,"intel-hda" ,0x4000 );pci_register_bar (&d->pci,0 ,0 , &d->mmio);if (d->msi) {
hw/audio/marvell_88w8618.c +1 -1
@@ -244,7 +244,7 @@ static int mv88w8618_audio_init(SysBusDevice *dev)wm8750_data_req_set (s->wm, mv88w8618_audio_callback, s); -memory_region_init_io (&s->iomem, &mv88w8618_audio_ops, s, +memory_region_init_io (&s->iomem,NULL , &mv88w8618_audio_ops, s,"audio" ,MP_AUDIO_SIZE );sysbus_init_mmio (dev, &s->iomem);
hw/audio/milkymist-ac97.c +1 -1
@@ -300,7 +300,7 @@ static int milkymist_ac97_init(SysBusDevice *dev) s->voice_out =AUD_open_out (&s->card, s->voice_out,"mm_ac97.out" , s, ac97_out_cb, &as); -memory_region_init_io (&s->regs_region, &ac97_mmio_ops, s, +memory_region_init_io (&s->regs_region,NULL , &ac97_mmio_ops, s,"milkymist-ac97" ,R_MAX *4 );sysbus_init_mmio (dev, &s->regs_region);
hw/audio/pcspk.c +1 -1
@@ -167,7 +167,7 @@ static void pcspk_initfn(Object *obj) {PCSpkState *s =PC_SPEAKER (obj); -memory_region_init_io (&s->ioport, &pcspk_io_ops, s,"elcr" ,1 ); +memory_region_init_io (&s->ioport,NULL , &pcspk_io_ops, s,"elcr" ,1 ); }static void pcspk_realizefn (DeviceState *dev,Error **errp)
hw/audio/pl041.c +1 -1
@@ -543,7 +543,7 @@ static int pl041_init(SysBusDevice *dev) }/* Connect the device to the sysbus */ -memory_region_init_io (&s->iomem, &pl041_ops, s,"pl041" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pl041_ops, s,"pl041" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);
hw/block/fdc.c +2 -2
@@ -2149,7 +2149,7 @@ static int sysbus_fdc_init1(SysBusDevice *dev)FDCtrl *fdctrl = &sys->state;int ret; -memory_region_init_io (&fdctrl->iomem, &fdctrl_mem_ops, fdctrl,"fdc" ,0x08 ); +memory_region_init_io (&fdctrl->iomem,NULL , &fdctrl_mem_ops, fdctrl,"fdc" ,0x08 );sysbus_init_mmio (dev, &fdctrl->iomem);sysbus_init_irq (dev, &fdctrl->irq);qdev_init_gpio_in (&dev->qdev, fdctrl_handle_tc,1 );
@@ -2165,7 +2165,7 @@ static int sun4m_fdc_init1(SysBusDevice *dev) {FDCtrl *fdctrl = &(FROM_SYSBUS (FDCtrlSysBus, dev)->state); -memory_region_init_io (&fdctrl->iomem, &fdctrl_mem_strict_ops, fdctrl, +memory_region_init_io (&fdctrl->iomem,NULL , &fdctrl_mem_strict_ops, fdctrl,"fdctrl" ,0x08 );sysbus_init_mmio (dev, &fdctrl->iomem);sysbus_init_irq (dev, &fdctrl->irq);
hw/block/nvme.c +1 -1
@@ -777,7 +777,7 @@ static int nvme_init(PCIDevice *pci_dev) n->sq =g_malloc0 (sizeof (*n->sq)*n->num_queues); n->cq =g_malloc0 (sizeof (*n->cq)*n->num_queues); -memory_region_init_io (&n->iomem, &nvme_mmio_ops, n,"nvme" , n->reg_size); +memory_region_init_io (&n->iomem,NULL , &nvme_mmio_ops, n,"nvme" , n->reg_size);pci_register_bar (&n->parent_obj,0 ,PCI_BASE_ADDRESS_SPACE_MEMORY |PCI_BASE_ADDRESS_MEM_TYPE_64 , &n->iomem);
hw/block/onenand.c +4 -4
@@ -113,9 +113,9 @@ static void onenand_mem_setup(OneNANDState *s)/* XXX: We should use IO_MEM_ROMD but we broke it earlier... * Both 0x0000 ... 0x01ff and 0x8000 ... 0x800f can be used to * write boot commands. Also take note of the BWPS bit. */ -memory_region_init (&s->container,"onenand" ,0x10000 << s->shift); +memory_region_init (&s->container,NULL ,"onenand" ,0x10000 << s->shift);memory_region_add_subregion (&s->container,0 , &s->iomem); -memory_region_init_alias (&s->mapped_ram,"onenand-mapped-ram" , +memory_region_init_alias (&s->mapped_ram,NULL ,"onenand-mapped-ram" , &s->ram,0x0200 << s->shift,0xbe00 << s->shift); memory_region_add_subregion_overlap(&s->container,
@@ -768,7 +768,7 @@ static int onenand_initfn(SysBusDevice *dev) s->blockwp =g_malloc (s->blocks); s->density_mask = (s->id.dev &0x08 ) ? (1 << (6 + ((s->id.dev >>4 ) &7 ))) :0 ; -memory_region_init_io (&s->iomem, &onenand_ops, s,"onenand" , +memory_region_init_io (&s->iomem,NULL , &onenand_ops, s,"onenand" ,0x10000 << s->shift);if (!s->bdrv) { s->image = memset(g_malloc(size + (size >> 5)),
@@ -782,7 +782,7 @@ static int onenand_initfn(SysBusDevice *dev) } s->otp =memset (g_malloc ((64 +2 ) <<PAGE_SHIFT ),0xff , (64 +2 ) <<PAGE_SHIFT ); -memory_region_init_ram (&s->ram,"onenand.ram" ,0xc000 << s->shift); +memory_region_init_ram (&s->ram,NULL ,"onenand.ram" ,0xc000 << s->shift);vmstate_register_ram_global (&s->ram); ram =memory_region_get_ram_ptr (&s->ram); s->boot[0 ] = ram + (0x0000 << s->shift);
hw/block/pc_sysfw.c +3 -3
@@ -59,7 +59,7 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory, isa_bios_size =128 *1024 ; } isa_bios =g_malloc (sizeof (*isa_bios)); -memory_region_init_ram (isa_bios,"isa-bios" , isa_bios_size); +memory_region_init_ram (isa_bios,NULL ,"isa-bios" , isa_bios_size);vmstate_register_ram_global (isa_bios); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size,
@@ -162,7 +162,7 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) goto bios_error; } bios =g_malloc (sizeof (*bios)); -memory_region_init_ram (bios,"pc.bios" , bios_size); +memory_region_init_ram (bios,NULL ,"pc.bios" , bios_size);vmstate_register_ram_global (bios);if (!isapc_ram_fw) {memory_region_set_readonly (bios, true);
@@ -183,7 +183,7 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) isa_bios_size =128 *1024 ; } isa_bios =g_malloc (sizeof (*isa_bios)); -memory_region_init_alias (isa_bios,"isa-bios" , bios, +memory_region_init_alias (isa_bios,NULL ,"isa-bios" , bios, bios_size - isa_bios_size, isa_bios_size); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size,
hw/block/pflash_cfi01.c +2 -1
@@ -579,7 +579,8 @@ static int pflash_cfi01_init(SysBusDevice *dev)#endif memory_region_init_rom_device ( - &pfl->mem, pfl->be ? &pflash_cfi01_ops_be : &pflash_cfi01_ops_le, pfl, + &pfl->mem,NULL , + pfl->be ? &pflash_cfi01_ops_be : &pflash_cfi01_ops_le, pfl, pfl->name, total_len);vmstate_register_ram (&pfl->mem,DEVICE (pfl)); pfl->storage =memory_region_get_ram_ptr (&pfl->mem);
hw/block/pflash_cfi02.c +3 -3
@@ -100,10 +100,10 @@ static void pflash_setup_mappings(pflash_t *pfl)unsigned i;hwaddr size =memory_region_size (&pfl->orig_mem); -memory_region_init (&pfl->mem,"pflash" , pfl->mappings * size); +memory_region_init (&pfl->mem,NULL ,"pflash" , pfl->mappings * size); pfl->mem_mappings =g_new (MemoryRegion, pfl->mappings);for (i =0 ; i < pfl->mappings; ++i) { -memory_region_init_alias (&pfl->mem_mappings[i],"pflash-alias" , +memory_region_init_alias (&pfl->mem_mappings[i],NULL ,"pflash-alias" , &pfl->orig_mem,0 , size);memory_region_add_subregion (&pfl->mem, i * size, &pfl->mem_mappings[i]); }
@@ -600,7 +600,7 @@ static int pflash_cfi02_init(SysBusDevice *dev)return NULL ;#endif -memory_region_init_rom_device (&pfl->orig_mem, pfl->be ? +memory_region_init_rom_device (&pfl->orig_mem,NULL , pfl->be ? &pflash_cfi02_ops_be : &pflash_cfi02_ops_le, pfl, pfl->name, chip_len);vmstate_register_ram (&pfl->orig_mem,DEVICE (pfl));
hw/char/cadence_uart.c +1 -1
@@ -442,7 +442,7 @@ static int cadence_uart_init(SysBusDevice *dev) {UartState *s =FROM_SYSBUS (UartState, dev); -memory_region_init_io (&s->iomem, &uart_ops, s,"uart" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &uart_ops, s,"uart" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);
hw/char/debugcon.c +1 -1
@@ -103,7 +103,7 @@ static void debugcon_isa_realizefn(DeviceState *dev, Error **errp)error_propagate (errp, err);return ; } -memory_region_init_io (&s->io, &debugcon_ops, s, +memory_region_init_io (&s->io,NULL , &debugcon_ops, s,TYPE_ISA_DEBUGCON_DEVICE ,1 );memory_region_add_subregion (isa_address_space_io (d), isa->iobase, &s->io);
hw/char/escc.c +1 -1
@@ -886,7 +886,7 @@ static int escc_init1(SysBusDevice *dev) s->chn[0 ].otherchn = &s->chn[1 ]; s->chn[1 ].otherchn = &s->chn[0 ]; -memory_region_init_io (&s->mmio, &escc_mem_ops, s,"escc" , +memory_region_init_io (&s->mmio,NULL , &escc_mem_ops, s,"escc" ,ESCC_SIZE << s->it_shift);sysbus_init_mmio (dev, &s->mmio);
hw/char/etraxfs_ser.c +1 -1
@@ -211,7 +211,7 @@ static int etraxfs_ser_init(SysBusDevice *dev)struct etrax_serial *s =FROM_SYSBUS (typeof (*s), dev);sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->mmio, &ser_ops, s,"etraxfs-serial" ,R_MAX *4 ); +memory_region_init_io (&s->mmio,NULL , &ser_ops, s,"etraxfs-serial" ,R_MAX *4 );sysbus_init_mmio (dev, &s->mmio); s->chr =qemu_char_get_next_serial ();
hw/char/exynos4210_uart.c +1 -1
@@ -630,7 +630,7 @@ static int exynos4210_uart_init(SysBusDevice *dev)Exynos4210UartState *s =FROM_SYSBUS (Exynos4210UartState, dev);/* memory mapping */ -memory_region_init_io (&s->iomem, &exynos4210_uart_ops, s,"exynos4210.uart" , +memory_region_init_io (&s->iomem,NULL , &exynos4210_uart_ops, s,"exynos4210.uart" ,EXYNOS4210_UART_REGS_MEM_SIZE );sysbus_init_mmio (dev, &s->iomem);
hw/char/grlib_apbuart.c +1 -1
@@ -242,7 +242,7 @@ static int grlib_apbuart_init(SysBusDevice *dev)sysbus_init_irq (dev, &uart->irq); -memory_region_init_io (&uart->iomem, &grlib_apbuart_ops, uart, +memory_region_init_io (&uart->iomem,NULL , &grlib_apbuart_ops, uart,"uart" ,UART_REG_SIZE );sysbus_init_mmio (dev, &uart->iomem);
hw/char/imx_serial.c +1 -1
@@ -386,7 +386,7 @@ static int imx_serial_init(SysBusDevice *dev)IMXSerialState *s =FROM_SYSBUS (IMXSerialState, dev); -memory_region_init_io (&s->iomem, &imx_serial_ops, s,"imx-serial" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &imx_serial_ops, s,"imx-serial" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);
hw/char/lm32_uart.c +1 -1
@@ -250,7 +250,7 @@ static int lm32_uart_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->iomem, &uart_ops, s,"uart" ,R_MAX *4 ); +memory_region_init_io (&s->iomem,NULL , &uart_ops, s,"uart" ,R_MAX *4 );sysbus_init_mmio (dev, &s->iomem); s->chr =qemu_char_get_next_serial ();
hw/char/mcf_uart.c +1 -1
@@ -302,6 +302,6 @@ void mcf_uart_mm_init(MemoryRegion *sysmem,mcf_uart_state *s; s =mcf_uart_init (irq, chr); -memory_region_init_io (&s->iomem, &mcf_uart_ops, s,"uart" ,0x40 ); +memory_region_init_io (&s->iomem,NULL , &mcf_uart_ops, s,"uart" ,0x40 );memory_region_add_subregion (sysmem, base, &s->iomem); }
hw/char/milkymist-uart.c +1 -1
@@ -196,7 +196,7 @@ static int milkymist_uart_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->regs_region, &uart_mmio_ops, s, +memory_region_init_io (&s->regs_region,NULL , &uart_mmio_ops, s,"milkymist-uart" ,R_MAX *4 );sysbus_init_mmio (dev, &s->regs_region);
hw/char/omap_uart.c +1 -1
@@ -168,7 +168,7 @@ struct omap_uart_s *omap2_uart_init(MemoryRegion *sysmem,struct omap_uart_s *s =omap_uart_init (base, irq, fclk, iclk, txdma, rxdma, label, chr); -memory_region_init_io (&s->iomem, &omap_uart_ops, s,"omap.uart" ,0x100 ); +memory_region_init_io (&s->iomem,NULL , &omap_uart_ops, s,"omap.uart" ,0x100 ); s->ta = ta;
hw/char/parallel.c +1 -1
@@ -587,7 +587,7 @@ bool parallel_mm_init(MemoryRegion *address_space, s->it_shift = it_shift;qemu_register_reset (parallel_reset, s); -memory_region_init_io (&s->iomem, ¶llel_mm_ops, s, +memory_region_init_io (&s->iomem,NULL , ¶llel_mm_ops, s,"parallel" ,8 << it_shift);memory_region_add_subregion (address_space, base, &s->iomem);return true;
hw/char/pl011.c +1 -1
@@ -265,7 +265,7 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id) {pl011_state *s =FROM_SYSBUS (pl011_state, dev); -memory_region_init_io (&s->iomem, &pl011_ops, s,"pl011" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pl011_ops, s,"pl011" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq); s->id = id;
hw/char/serial-isa.c +1 -1
@@ -72,7 +72,7 @@ static void serial_isa_realizefn(DeviceState *dev, Error **errp)serial_realize_core (s, errp);qdev_set_legacy_instance_id (dev, isa->iobase,3 ); -memory_region_init_io (&s->io, &serial_io_ops, s,"serial" ,8 ); +memory_region_init_io (&s->io,NULL , &serial_io_ops, s,"serial" ,8 );isa_register_ioport (isadev, &s->io, isa->iobase); }
hw/char/serial-pci.c +3 -3
@@ -63,7 +63,7 @@ static int serial_pci_init(PCIDevice *dev) pci->dev.config[PCI_INTERRUPT_PIN ] =0x01 ; s->irq = pci->dev.irq[0 ]; -memory_region_init_io (&s->io, &serial_io_ops, s,"serial" ,8 ); +memory_region_init_io (&s->io,NULL , &serial_io_ops, s,"serial" ,8 );pci_register_bar (&pci->dev,0 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io);return 0 ; }
@@ -102,7 +102,7 @@ static int multi_serial_pci_init(PCIDevice *dev)assert (pci->ports <=PCI_SERIAL_MAX_PORTS ); pci->dev.config[PCI_INTERRUPT_PIN ] =0x01 ; -memory_region_init (&pci->iobar,"multiserial" ,8 * pci->ports); +memory_region_init (&pci->iobar,NULL ,"multiserial" ,8 * pci->ports);pci_register_bar (&pci->dev,0 ,PCI_BASE_ADDRESS_SPACE_IO , &pci->iobar); pci->irqs =qemu_allocate_irqs (multi_serial_irq_mux, pci, pci->ports);
@@ -118,7 +118,7 @@ static int multi_serial_pci_init(PCIDevice *dev) } s->irq = pci->irqs[i]; pci->name[i] =g_strdup_printf ("uart #%d" , i+1 ); -memory_region_init_io (&s->io, &serial_io_ops, s, pci->name[i],8 ); +memory_region_init_io (&s->io,NULL , &serial_io_ops, s, pci->name[i],8 );memory_region_add_subregion (&pci->iobar,8 * i, &s->io); }return 0 ;
hw/char/serial.c +2 -2
@@ -703,7 +703,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase,vmstate_register (NULL , base, &vmstate_serial, s); -memory_region_init_io (&s->io, &serial_io_ops, s,"serial" ,8 ); +memory_region_init_io (&s->io,NULL , &serial_io_ops, s,"serial" ,8 );memory_region_add_subregion (system_io, base, &s->io);return s;
@@ -766,7 +766,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space, }vmstate_register (NULL , base, &vmstate_serial, s); -memory_region_init_io (&s->io, &serial_mm_ops[end], s, +memory_region_init_io (&s->io,NULL , &serial_mm_ops[end], s,"serial" ,8 << it_shift);memory_region_add_subregion (address_space, base, &s->io);
hw/char/sh_serial.c +3 -3
@@ -383,14 +383,14 @@ void sh_serial_init(MemoryRegion *sysmem,sh_serial_clear_fifo (s); -memory_region_init_io (&s->iomem, &sh_serial_ops, s, +memory_region_init_io (&s->iomem,NULL , &sh_serial_ops, s,"serial" ,0x100000000ULL ); -memory_region_init_alias (&s->iomem_p4,"serial-p4" , &s->iomem, +memory_region_init_alias (&s->iomem_p4,NULL ,"serial-p4" , &s->iomem,0 ,0x28 );memory_region_add_subregion (sysmem,P4ADDR (base), &s->iomem_p4); -memory_region_init_alias (&s->iomem_a7,"serial-a7" , &s->iomem, +memory_region_init_alias (&s->iomem_a7,NULL ,"serial-a7" , &s->iomem,0 ,0x28 );memory_region_add_subregion (sysmem,A7ADDR (base), &s->iomem_a7);
hw/char/tpci200.c +6 -6
@@ -588,17 +588,17 @@ static int tpci200_initfn(PCIDevice *pci_dev)pci_set_long (c +0x48 ,0x00024C06 );pci_set_long (c +0x4C ,0x00000003 ); -memory_region_init_io (&s->mmio, &tpci200_cfg_ops, +memory_region_init_io (&s->mmio,NULL , &tpci200_cfg_ops, s,"tpci200_mmio" ,128 ); -memory_region_init_io (&s->io, &tpci200_cfg_ops, +memory_region_init_io (&s->io,NULL , &tpci200_cfg_ops, s,"tpci200_io" ,128 ); -memory_region_init_io (&s->las0, &tpci200_las0_ops, +memory_region_init_io (&s->las0,NULL , &tpci200_las0_ops, s,"tpci200_las0" ,256 ); -memory_region_init_io (&s->las1, &tpci200_las1_ops, +memory_region_init_io (&s->las1,NULL , &tpci200_las1_ops, s,"tpci200_las1" ,1024 ); -memory_region_init_io (&s->las2, &tpci200_las2_ops, +memory_region_init_io (&s->las2,NULL , &tpci200_las2_ops, s,"tpci200_las2" ,1024 *1024 *32 ); -memory_region_init_io (&s->las3, &tpci200_las3_ops, +memory_region_init_io (&s->las3,NULL , &tpci200_las3_ops, s,"tpci200_las3" ,1024 *1024 *16 );pci_register_bar (&s->dev,0 ,PCI_BASE_ADDRESS_SPACE_MEMORY , &s->mmio);pci_register_bar (&s->dev,1 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io);
hw/char/xilinx_uartlite.c +1 -1
@@ -199,7 +199,7 @@ static int xilinx_uartlite_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq);uart_update_status (s); -memory_region_init_io (&s->mmio, &uart_ops, s,"xlnx.xps-uartlite" , +memory_region_init_io (&s->mmio,NULL , &uart_ops, s,"xlnx.xps-uartlite" ,R_MAX *4 );sysbus_init_mmio (dev, &s->mmio);
hw/core/empty_slot.c +1 -1
@@ -70,7 +70,7 @@ static int empty_slot_init1(SysBusDevice *dev) {EmptySlot *s =FROM_SYSBUS (EmptySlot, dev); -memory_region_init_io (&s->iomem, &empty_slot_ops, s, +memory_region_init_io (&s->iomem,NULL , &empty_slot_ops, s,"empty-slot" , s->size);sysbus_init_mmio (dev, &s->iomem);return 0 ;
hw/cpu/a15mpcore.c +1 -1
@@ -68,7 +68,7 @@ static int a15mp_priv_init(SysBusDevice *dev)* 0x5000-0x5fff -- GIC virtual interface control (not modelled) * 0x6000-0x7fff -- GIC virtual CPU interface (not modelled) */ -memory_region_init (&s->container,"a15mp-priv-container" ,0x8000 ); +memory_region_init (&s->container,NULL ,"a15mp-priv-container" ,0x8000 );memory_region_add_subregion (&s->container,0x1000 ,sysbus_mmio_get_region (busdev,0 )); memory_region_add_subregion(&s->container, 0x2000,
hw/cpu/a9mpcore.c +1 -1
@@ -71,7 +71,7 @@ static int a9mp_priv_init(SysBusDevice *dev)* * We should implement the global timer but don't currently do so. */ -memory_region_init (&s->container,"a9mp-priv-container" ,0x2000 ); +memory_region_init (&s->container,NULL ,"a9mp-priv-container" ,0x2000 );memory_region_add_subregion (&s->container,0 ,sysbus_mmio_get_region (scubusdev,0 ));/* GIC CPU interface */
hw/cpu/arm11mpcore.c +2 -2
@@ -87,8 +87,8 @@ static void mpcore_priv_map_setup(ARM11MPCorePriveState *s)SysBusDevice *gicbusdev =SYS_BUS_DEVICE (s->gic);SysBusDevice *timerbusdev =SYS_BUS_DEVICE (s->mptimer);SysBusDevice *wdtbusdev =SYS_BUS_DEVICE (s->wdtimer); -memory_region_init (&s->container,"mpcode-priv-container" ,0x2000 ); -memory_region_init_io (&s->iomem, &mpcore_scu_ops, s,"mpcore-scu" ,0x100 ); +memory_region_init (&s->container,NULL ,"mpcode-priv-container" ,0x2000 ); +memory_region_init_io (&s->iomem,NULL , &mpcore_scu_ops, s,"mpcore-scu" ,0x100 );memory_region_add_subregion (&s->container,0 , &s->iomem);/* GIC CPU interfaces: "current CPU" at 0x100, then specific CPUs * at 0x200, 0x300...
hw/cpu/icc_bus.c +1 -1
@@ -95,7 +95,7 @@ static void icc_bridge_init(Object *obj)/* Do not change order of registering regions, * APIC must be first registered region, board maps it by 0 index */ -memory_region_init (&s->apic_container,"icc-apic-container" , +memory_region_init (&s->apic_container,NULL ,"icc-apic-container" ,APIC_SPACE_SIZE );sysbus_init_mmio (sb, &s->apic_container); s->icc_bus.apic_address_space = &s->apic_container;
hw/cris/axis_dev88.c +4 -4
@@ -269,13 +269,13 @@ void axisdev88_init(QEMUMachineInitArgs *args) env = &cpu->env;/* allocate RAM */ -memory_region_init_ram (phys_ram,"axisdev88.ram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"axisdev88.ram" , ram_size);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (address_space_mem,0x40000000 , phys_ram);/* The ETRAX-FS has 128Kb on chip ram, the docs refer to it as the internal memory. */ -memory_region_init_ram (phys_intmem,"axisdev88.chipram" ,INTMEM_SIZE ); +memory_region_init_ram (phys_intmem,NULL ,"axisdev88.chipram" ,INTMEM_SIZE );vmstate_register_ram_global (phys_intmem);memory_region_add_subregion (address_space_mem,0x38000000 , phys_intmem);
@@ -283,13 +283,13 @@ void axisdev88_init(QEMUMachineInitArgs *args) nand =drive_get (IF_MTD ,0 ,0 ); nand_state.nand =nand_init (nand ? nand->bdrv :NULL ,NAND_MFR_STMICRO ,0x39 ); -memory_region_init_io (&nand_state.iomem, &nand_ops, &nand_state, +memory_region_init_io (&nand_state.iomem,NULL , &nand_ops, &nand_state,"nand" ,0x05000000 );memory_region_add_subregion (address_space_mem,0x10000000 , &nand_state.iomem); gpio_state.nand = &nand_state; -memory_region_init_io (&gpio_state.iomem, &gpio_ops, &gpio_state, +memory_region_init_io (&gpio_state.iomem,NULL , &gpio_ops, &gpio_state,"gpio" ,0x5c );memory_region_add_subregion (address_space_mem,0x3001a000 , &gpio_state.iomem);
hw/display/cirrus_vga.c +8 -8
@@ -2840,21 +2840,21 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci, }/* Register ioport 0x3b0 - 0x3df */ -memory_region_init_io (&s->cirrus_vga_io, &cirrus_vga_io_ops, s, +memory_region_init_io (&s->cirrus_vga_io,NULL , &cirrus_vga_io_ops, s,"cirrus-io" ,0x30 );memory_region_add_subregion (system_io,0x3b0 , &s->cirrus_vga_io); -memory_region_init (&s->low_mem_container, +memory_region_init (&s->low_mem_container,NULL ,"cirrus-lowmem-container" ,0x20000 ); -memory_region_init_io (&s->low_mem, &cirrus_vga_mem_ops, s, +memory_region_init_io (&s->low_mem,NULL , &cirrus_vga_mem_ops, s,"cirrus-low-memory" ,0x20000 );memory_region_add_subregion (&s->low_mem_container,0 , &s->low_mem);for (i =0 ; i <2 ; ++i) {static const char *names[] = {"vga.bank0" ,"vga.bank1" };MemoryRegion *bank = &s->cirrus_bank[i]; -memory_region_init_alias (bank, names[i], &s->vga.vram,0 ,0x8000 ); +memory_region_init_alias (bank,NULL , names[i], &s->vga.vram,0 ,0x8000 );memory_region_set_enabled (bank, false);memory_region_add_subregion_overlap (&s->low_mem_container, i *0x8000 , bank,1 );
@@ -2866,13 +2866,13 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci,memory_region_set_coalescing (&s->low_mem);/* I/O handler for LFB */ -memory_region_init_io (&s->cirrus_linear_io, &cirrus_linear_io_ops, s, +memory_region_init_io (&s->cirrus_linear_io,NULL , &cirrus_linear_io_ops, s,"cirrus-linear-io" , s->vga.vram_size_mb *1024 *1024 );memory_region_set_flush_coalesced (&s->cirrus_linear_io);/* I/O handler for LFB */ - memory_region_init_io(&s->cirrus_linear_bitblt_io, + memory_region_init_io(&s->cirrus_linear_bitblt_io, NULL, &cirrus_linear_bitblt_io_ops, s, "cirrus-bitblt-mmio",
@@ -2880,7 +2880,7 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci,memory_region_set_flush_coalesced (&s->cirrus_linear_bitblt_io);/* I/O handler for memory-mapped I/O */ -memory_region_init_io (&s->cirrus_mmio_io, &cirrus_mmio_io_ops, s, +memory_region_init_io (&s->cirrus_mmio_io,NULL , &cirrus_mmio_io_ops, s,"cirrus-mmio" ,CIRRUS_PNPMMIO_SIZE );memory_region_set_flush_coalesced (&s->cirrus_mmio_io);
@@ -2965,7 +2965,7 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)/* setup PCI */ -memory_region_init (&s->pci_bar,"cirrus-pci-bar0" ,0x2000000 ); +memory_region_init (&s->pci_bar,NULL ,"cirrus-pci-bar0" ,0x2000000 );/* XXX: add byte swapping apertures */ memory_region_add_subregion (&s->pci_bar,0 , &s->cirrus_linear_io);
hw/display/exynos4210_fimd.c +1 -1
@@ -1902,7 +1902,7 @@ static int exynos4210_fimd_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq[1 ]);sysbus_init_irq (dev, &s->irq[2 ]); -memory_region_init_io (&s->iomem, &exynos4210_fimd_mmio_ops, s, +memory_region_init_io (&s->iomem,NULL , &exynos4210_fimd_mmio_ops, s,"exynos4210.fimd" ,FIMD_REGS_SIZE );sysbus_init_mmio (dev, &s->iomem); s->console =graphic_console_init (DEVICE (dev), &exynos4210_fimd_ops, s);
hw/display/g364fb.c +2 -2
@@ -486,8 +486,8 @@ static void g364fb_init(DeviceState *dev, G364State *s) s->con =graphic_console_init (dev, &g364fb_ops, s); -memory_region_init_io (&s->mem_ctrl, &g364fb_ctrl_ops, s,"ctrl" ,0x180000 ); -memory_region_init_ram_ptr (&s->mem_vram,"vram" , +memory_region_init_io (&s->mem_ctrl,NULL , &g364fb_ctrl_ops, s,"ctrl" ,0x180000 ); +memory_region_init_ram_ptr (&s->mem_vram,NULL ,"vram" , s->vram_size, s->vram);vmstate_register_ram (&s->mem_vram, dev);memory_region_set_coalescing (&s->mem_vram);
hw/display/jazz_led.c +1 -1
@@ -264,7 +264,7 @@ static int jazz_led_init(SysBusDevice *dev) {LedState *s =FROM_SYSBUS (LedState, dev); -memory_region_init_io (&s->iomem, &led_ops, s,"led" ,1 ); +memory_region_init_io (&s->iomem,NULL , &led_ops, s,"led" ,1 );sysbus_init_mmio (dev, &s->iomem); s->con =graphic_console_init (DEVICE (dev), &jazz_led_ops, s);
hw/display/milkymist-tmu2.c +1 -1
@@ -447,7 +447,7 @@ static int milkymist_tmu2_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->regs_region, &tmu2_mmio_ops, s, +memory_region_init_io (&s->regs_region,NULL , &tmu2_mmio_ops, s,"milkymist-tmu2" ,R_MAX *4 );sysbus_init_mmio (dev, &s->regs_region);
hw/display/milkymist-vgafb.c +1 -1
@@ -279,7 +279,7 @@ static int milkymist_vgafb_init(SysBusDevice *dev) {MilkymistVgafbState *s =FROM_SYSBUS (typeof (*s), dev); -memory_region_init_io (&s->regs_region, &vgafb_mmio_ops, s, +memory_region_init_io (&s->regs_region,NULL , &vgafb_mmio_ops, s,"milkymist-vgafb" ,R_MAX *4 );sysbus_init_mmio (dev, &s->regs_region);
hw/display/omap_dss.c +5 -5
@@ -1053,15 +1053,15 @@ struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta, s->drq = drq;omap_dss_reset (s); -memory_region_init_io (&s->iomem_diss1, &omap_diss_ops, s,"omap.diss1" , +memory_region_init_io (&s->iomem_diss1,NULL , &omap_diss_ops, s,"omap.diss1" ,omap_l4_region_size (ta,0 )); -memory_region_init_io (&s->iomem_disc1, &omap_disc_ops, s,"omap.disc1" , +memory_region_init_io (&s->iomem_disc1,NULL , &omap_disc_ops, s,"omap.disc1" ,omap_l4_region_size (ta,1 )); -memory_region_init_io (&s->iomem_rfbi1, &omap_rfbi_ops, s,"omap.rfbi1" , +memory_region_init_io (&s->iomem_rfbi1,NULL , &omap_rfbi_ops, s,"omap.rfbi1" ,omap_l4_region_size (ta,2 )); -memory_region_init_io (&s->iomem_venc1, &omap_venc_ops, s,"omap.venc1" , +memory_region_init_io (&s->iomem_venc1,NULL , &omap_venc_ops, s,"omap.venc1" ,omap_l4_region_size (ta,3 )); -memory_region_init_io (&s->iomem_im3, &omap_im3_ops, s, +memory_region_init_io (&s->iomem_im3,NULL , &omap_im3_ops, s,"omap.im3" ,0x1000 );omap_l4_attach (ta,0 , &s->iomem_diss1);
hw/display/omap_lcdc.c +1 -1
@@ -403,7 +403,7 @@ struct omap_lcd_panel_s *omap_lcdc_init(MemoryRegion *sysmem, s->sysmem = sysmem;omap_lcdc_reset (s); -memory_region_init_io (&s->iomem, &omap_lcdc_ops, s,"omap.lcdc" ,0x100 ); +memory_region_init_io (&s->iomem,NULL , &omap_lcdc_ops, s,"omap.lcdc" ,0x100 );memory_region_add_subregion (sysmem, base, &s->iomem); s->con =graphic_console_init (NULL , &omap_ops, s);
hw/display/pl110.c +1 -1
@@ -453,7 +453,7 @@ static int pl110_init(SysBusDevice *dev) {pl110_state *s =FROM_SYSBUS (pl110_state, dev); -memory_region_init_io (&s->iomem, &pl110_ops, s,"pl110" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pl110_ops, s,"pl110" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);qdev_init_gpio_in (&s->busdev.qdev, pl110_mux_ctrl_set,1 );
hw/display/pxa2xx_lcd.c +1 -1
@@ -1009,7 +1009,7 @@ PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem,pxa2xx_lcdc_orientation (s, graphic_rotate); -memory_region_init_io (&s->iomem, &pxa2xx_lcdc_ops, s, +memory_region_init_io (&s->iomem,NULL , &pxa2xx_lcdc_ops, s,"pxa2xx-lcd-controller" ,0x00100000 );memory_region_add_subregion (sysmem, base, &s->iomem);
hw/display/qxl.c +5 -5
@@ -1981,18 +1981,18 @@ static int qxl_init_common(PCIQXLDevice *qxl)pci_set_byte (&config[PCI_INTERRUPT_PIN ],1 ); qxl->rom_size =qxl_rom_size (); -memory_region_init_ram (&qxl->rom_bar,"qxl.vrom" , qxl->rom_size); +memory_region_init_ram (&qxl->rom_bar,NULL ,"qxl.vrom" , qxl->rom_size);vmstate_register_ram (&qxl->rom_bar, &qxl->pci.qdev);init_qxl_rom (qxl);init_qxl_ram (qxl); qxl->guest_surfaces.cmds =g_new0 (QXLPHYSICAL , qxl->ssd.num_surfaces); -memory_region_init_ram (&qxl->vram_bar,"qxl.vram" , qxl->vram_size); +memory_region_init_ram (&qxl->vram_bar,NULL ,"qxl.vram" , qxl->vram_size);vmstate_register_ram (&qxl->vram_bar, &qxl->pci.qdev); -memory_region_init_alias (&qxl->vram32_bar,"qxl.vram32" , &qxl->vram_bar, +memory_region_init_alias (&qxl->vram32_bar,NULL ,"qxl.vram32" , &qxl->vram_bar,0 , qxl->vram32_size); -memory_region_init_io (&qxl->io_bar, &qxl_io_ops, qxl, +memory_region_init_io (&qxl->io_bar,NULL , &qxl_io_ops, qxl,"qxl-ioports" , io_size);if (qxl->id ==0 ) {vga_dirty_log_start (&qxl->vga);
@@ -2093,7 +2093,7 @@ static int qxl_init_secondary(PCIDevice *dev) qxl->id = device_id++;qxl_init_ramsize (qxl); -memory_region_init_ram (&qxl->vga.vram,"qxl.vgavram" , qxl->vga.vram_size); +memory_region_init_ram (&qxl->vga.vram,NULL ,"qxl.vgavram" , qxl->vga.vram_size);vmstate_register_ram (&qxl->vga.vram, &qxl->pci.qdev); qxl->vga.vram_ptr =memory_region_get_ram_ptr (&qxl->vga.vram); qxl->vga.con =graphic_console_init (DEVICE (dev), &qxl_ops, qxl);
hw/display/sm501.c +4 -4
@@ -1408,23 +1408,23 @@ void sm501_init(MemoryRegion *address_space_mem, uint32_t base, s->dc_crt_control =0x00010000 ;/* allocate local memory */ -memory_region_init_ram (&s->local_mem_region,"sm501.local" , +memory_region_init_ram (&s->local_mem_region,NULL ,"sm501.local" , local_mem_bytes);vmstate_register_ram_global (&s->local_mem_region); s->local_mem =memory_region_get_ram_ptr (&s->local_mem_region);memory_region_add_subregion (address_space_mem, base, &s->local_mem_region);/* map mmio */ -memory_region_init_io (sm501_system_config, &sm501_system_config_ops, s, +memory_region_init_io (sm501_system_config,NULL , &sm501_system_config_ops, s,"sm501-system-config" ,0x6c );memory_region_add_subregion (address_space_mem, base +MMIO_BASE_OFFSET , sm501_system_config); -memory_region_init_io (sm501_disp_ctrl, &sm501_disp_ctrl_ops, s, +memory_region_init_io (sm501_disp_ctrl,NULL , &sm501_disp_ctrl_ops, s,"sm501-disp-ctrl" ,0x1000 );memory_region_add_subregion (address_space_mem, base +MMIO_BASE_OFFSET +SM501_DC , sm501_disp_ctrl); -memory_region_init_io (sm501_2d_engine, &sm501_2d_engine_ops, s, +memory_region_init_io (sm501_2d_engine,NULL , &sm501_2d_engine_ops, s,"sm501-2d-engine" ,0x54 ); memory_region_add_subregion(address_space_mem, base + MMIO_BASE_OFFSET + SM501_2D_ENGINE,
hw/display/tc6393xb.c +2 -2
@@ -578,10 +578,10 @@ TC6393xbState *tc6393xb_init(MemoryRegion *sysmem, uint32_t base, qemu_irq irq) nand =drive_get (IF_MTD ,0 ,0 ); s->flash =nand_init (nand ? nand->bdrv :NULL ,NAND_MFR_TOSHIBA ,0x76 ); -memory_region_init_io (&s->iomem, &tc6393xb_ops, s,"tc6393xb" ,0x10000 ); +memory_region_init_io (&s->iomem,NULL , &tc6393xb_ops, s,"tc6393xb" ,0x10000 );memory_region_add_subregion (sysmem, base, &s->iomem); -memory_region_init_ram (&s->vram,"tc6393xb.vram" ,0x100000 ); +memory_region_init_ram (&s->vram,NULL ,"tc6393xb.vram" ,0x100000 );vmstate_register_ram_global (&s->vram); s->vram_ptr =memory_region_get_ram_ptr (&s->vram);memory_region_add_subregion (sysmem, base +0x100000 , &s->vram);
hw/display/tcx.c +8 -8
@@ -528,7 +528,7 @@ static int tcx_init1(SysBusDevice *dev)int size;uint8_t *vram_base; -memory_region_init_ram (&s->vram_mem,"tcx.vram" , +memory_region_init_ram (&s->vram_mem,NULL ,"tcx.vram" , s->vram_size * (1 +4 +4 ));vmstate_register_ram_global (&s->vram_mem); vram_base =memory_region_get_ram_ptr (&s->vram_mem);
@@ -536,21 +536,21 @@ static int tcx_init1(SysBusDevice *dev)/* 8-bit plane */ s->vram = vram_base; size = s->vram_size; -memory_region_init_alias (&s->vram_8bit,"tcx.vram.8bit" , +memory_region_init_alias (&s->vram_8bit,NULL ,"tcx.vram.8bit" , &s->vram_mem, vram_offset, size);sysbus_init_mmio (dev, &s->vram_8bit); vram_offset += size; vram_base += size;/* DAC */ -memory_region_init_io (&s->dac, &tcx_dac_ops, s,"tcx.dac" ,TCX_DAC_NREGS ); +memory_region_init_io (&s->dac,NULL , &tcx_dac_ops, s,"tcx.dac" ,TCX_DAC_NREGS );sysbus_init_mmio (dev, &s->dac);/* TEC (dummy) */ -memory_region_init_io (&s->tec, &dummy_ops, s,"tcx.tec" ,TCX_TEC_NREGS ); +memory_region_init_io (&s->tec,NULL , &dummy_ops, s,"tcx.tec" ,TCX_TEC_NREGS );sysbus_init_mmio (dev, &s->tec);/* THC: NetBSD writes here even with 8-bit display: dummy */ -memory_region_init_io (&s->thc24, &dummy_ops, s,"tcx.thc24" , +memory_region_init_io (&s->thc24,NULL , &dummy_ops, s,"tcx.thc24" ,TCX_THC_NREGS_24 );sysbus_init_mmio (dev, &s->thc24);
@@ -559,7 +559,7 @@ static int tcx_init1(SysBusDevice *dev) size = s->vram_size *4 ; s->vram24 = (uint32_t *)vram_base; s->vram24_offset = vram_offset; -memory_region_init_alias (&s->vram_24bit,"tcx.vram.24bit" , +memory_region_init_alias (&s->vram_24bit,NULL ,"tcx.vram.24bit" , &s->vram_mem, vram_offset, size);sysbus_init_mmio (dev, &s->vram_24bit); vram_offset += size;
@@ -569,14 +569,14 @@ static int tcx_init1(SysBusDevice *dev) size = s->vram_size *4 ; s->cplane = (uint32_t *)vram_base; s->cplane_offset = vram_offset; -memory_region_init_alias (&s->vram_cplane,"tcx.vram.cplane" , +memory_region_init_alias (&s->vram_cplane,NULL ,"tcx.vram.cplane" , &s->vram_mem, vram_offset, size);sysbus_init_mmio (dev, &s->vram_cplane); s->con =graphic_console_init (DEVICE (dev), &tcx24_ops, s); }else {/* THC 8 bit (dummy) */ -memory_region_init_io (&s->thc8, &dummy_ops, s,"tcx.thc8" , +memory_region_init_io (&s->thc8,NULL , &dummy_ops, s,"tcx.thc8" ,TCX_THC_NREGS_8 );sysbus_init_mmio (dev, &s->thc8);
hw/display/vga-isa-mm.c +2 -2
@@ -105,13 +105,13 @@ static void vga_mm_init(ISAVGAMMState *s, hwaddr vram_base, s->it_shift = it_shift; s_ioport_ctrl =g_malloc (sizeof (*s_ioport_ctrl)); -memory_region_init_io (s_ioport_ctrl, &vga_mm_ctrl_ops, s, +memory_region_init_io (s_ioport_ctrl,NULL , &vga_mm_ctrl_ops, s,"vga-mm-ctrl" ,0x100000 );memory_region_set_flush_coalesced (s_ioport_ctrl); vga_io_memory =g_malloc (sizeof (*vga_io_memory));/* XXX: endianness? */ -memory_region_init_io (vga_io_memory, &vga_mem_ops, &s->vga, +memory_region_init_io (vga_io_memory,NULL , &vga_mem_ops, &s->vga,"vga-mem" ,0x20000 );vmstate_register (NULL ,0 , &vmstate_vga_common, s);
hw/display/vga-pci.c +3 -3
@@ -157,10 +157,10 @@ static int pci_std_vga_initfn(PCIDevice *dev)/* mmio bar for vga register access */ if (d->flags & (1 <<PCI_VGA_FLAG_ENABLE_MMIO )) { -memory_region_init (&d->mmio,"vga.mmio" ,4096 ); -memory_region_init_io (&d->ioport, &pci_vga_ioport_ops, d, +memory_region_init (&d->mmio,NULL ,"vga.mmio" ,4096 ); +memory_region_init_io (&d->ioport,NULL , &pci_vga_ioport_ops, d,"vga ioports remapped" ,PCI_VGA_IOPORT_SIZE ); -memory_region_init_io (&d->bochs, &pci_vga_bochs_ops, d, +memory_region_init_io (&d->bochs,NULL , &pci_vga_bochs_ops, d,"bochs dispi interface" ,PCI_VGA_BOCHS_SIZE ); memory_region_add_subregion(&d->mmio, PCI_VGA_IOPORT_OFFSET,
hw/display/vga.c +4 -4
@@ -198,7 +198,7 @@ static void vga_update_memory_access(VGACommonState *s) } base += isa_mem_base; region =g_malloc (sizeof (*region)); -memory_region_init_alias (region,"vga.chain4" , &s->vram, offset, size); +memory_region_init_alias (region,NULL ,"vga.chain4" , &s->vram, offset, size);memory_region_add_subregion_overlap (s->legacy_address_space, base, region,2 ); s->chain4_alias = region;
@@ -2292,7 +2292,7 @@ void vga_common_init(VGACommonState *s) s->vram_size_mb = s->vram_size >>20 ; s->is_vbe_vmstate =1 ; -memory_region_init_ram (&s->vram,"vga.vram" , s->vram_size); +memory_region_init_ram (&s->vram,NULL ,"vga.vram" , s->vram_size);vmstate_register_ram_global (&s->vram);xen_register_framebuffer (&s->vram); s->vram_ptr =memory_region_get_ram_ptr (&s->vram);
@@ -2343,7 +2343,7 @@ MemoryRegion *vga_init_io(VGACommonState *s, *vbe_ports = vbe_portio_list; vga_mem =g_malloc (sizeof (*vga_mem)); -memory_region_init_io (vga_mem, &vga_mem_ops, s, +memory_region_init_io (vga_mem,NULL , &vga_mem_ops, s,"vga-lowmem" ,0x20000 );memory_region_set_flush_coalesced (vga_mem);
@@ -2385,7 +2385,7 @@ void vga_init_vbe(VGACommonState *s, MemoryRegion *system_memory)/* With pc-0.12 and below we map both the PCI BAR and the fixed VBE region, * so use an alias to avoid double-mapping the same region. */ -memory_region_init_alias (&s->vram_vbe,"vram.vbe" , +memory_region_init_alias (&s->vram_vbe,NULL ,"vram.vbe" , &s->vram,0 ,memory_region_size (&s->vram));/* XXX: use optimized standard vga accesses */ memory_region_add_subregion(system_memory,
hw/display/vmware_vga.c +2 -2
@@ -1194,7 +1194,7 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s, s->vga.con =graphic_console_init (dev, &vmsvga_ops, s); s->fifo_size =SVGA_FIFO_SIZE ; -memory_region_init_ram (&s->fifo_ram,"vmsvga.fifo" , s->fifo_size); +memory_region_init_ram (&s->fifo_ram,NULL ,"vmsvga.fifo" , s->fifo_size);vmstate_register_ram_global (&s->fifo_ram); s->fifo_ptr =memory_region_get_ram_ptr (&s->fifo_ram);
@@ -1257,7 +1257,7 @@ static int pci_vmsvga_initfn(PCIDevice *dev) s->card.config[PCI_LATENCY_TIMER ] =0x40 ;/* Latency timer */ s->card.config[PCI_INTERRUPT_LINE ] =0xff ;/* End */ -memory_region_init_io (&s->io_bar, &vmsvga_io_ops, &s->chip, +memory_region_init_io (&s->io_bar,NULL , &vmsvga_io_ops, &s->chip,"vmsvga-io" ,0x10 );memory_region_set_flush_coalesced (&s->io_bar);pci_register_bar (&s->card,0 ,PCI_BASE_ADDRESS_SPACE_IO , &s->io_bar);
hw/dma/etraxfs_dma.c +1 -1
@@ -773,7 +773,7 @@ void *etraxfs_dmac_init(hwaddr base, int nr_channels) ctrl->nr_channels = nr_channels; ctrl->channels =g_malloc0 (sizeof ctrl->channels[0 ] * nr_channels); -memory_region_init_io (&ctrl->mmio, &dma_ops, ctrl,"etraxfs-dma" , +memory_region_init_io (&ctrl->mmio,NULL , &dma_ops, ctrl,"etraxfs-dma" , nr_channels *0x2000 );memory_region_add_subregion (get_system_memory (), base, &ctrl->mmio);
hw/dma/i8257.c +2 -2
@@ -523,7 +523,7 @@ static void dma_init2(struct dma_cont *d, int base, int dshift, d->dshift = dshift; d->cpu_request_exit = cpu_request_exit; -memory_region_init_io (&d->channel_io, &channel_io_ops, d, +memory_region_init_io (&d->channel_io,NULL , &channel_io_ops, d,"dma-chan" ,8 << d->dshift);memory_region_add_subregion (isa_address_space_io (NULL ), base, &d->channel_io);
@@ -535,7 +535,7 @@ static void dma_init2(struct dma_cont *d, int base, int dshift, "dma-pageh"); } -memory_region_init_io (&d->cont_io, &cont_io_ops, d,"dma-cont" , +memory_region_init_io (&d->cont_io,NULL , &cont_io_ops, d,"dma-cont" ,8 << d->dshift);memory_region_add_subregion (isa_address_space_io (NULL ), base + (8 << d->dshift), &d->cont_io);
hw/dma/omap_dma.c +2 -2
@@ -1663,7 +1663,7 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,omap_dma_reset (s->dma);omap_dma_clk_update (s,0 ,1 ); -memory_region_init_io (&s->iomem, &omap_dma_ops, s,"omap.dma" , memsize); +memory_region_init_io (&s->iomem,NULL , &omap_dma_ops, s,"omap.dma" , memsize);memory_region_add_subregion (sysmem, base, &s->iomem); mpu->drq = s->dma->drq;
@@ -2085,7 +2085,7 @@ struct soc_dma_s *omap_dma4_init(hwaddr base, qemu_irq *irqs,omap_dma_reset (s->dma);omap_dma_clk_update (s,0 , !!s->dma->freq); -memory_region_init_io (&s->iomem, &omap_dma4_ops, s,"omap.dma4" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &omap_dma4_ops, s,"omap.dma4" ,0x1000 );memory_region_add_subregion (sysmem, base, &s->iomem); mpu->drq = s->dma->drq;
hw/dma/pl080.c +1 -1
@@ -359,7 +359,7 @@ static int pl08x_init(SysBusDevice *dev, int nchannels) {pl080_state *s =FROM_SYSBUS (pl080_state, dev); -memory_region_init_io (&s->iomem, &pl080_ops, s,"pl080" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pl080_ops, s,"pl080" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq); s->nchannels = nchannels;
hw/dma/pl330.c +1 -1
@@ -1528,7 +1528,7 @@ static void pl330_realize(DeviceState *dev, Error **errp)PL330State *s =PL330 (dev);sysbus_init_irq (SYS_BUS_DEVICE (dev), &s->irq_abort); -memory_region_init_io (&s->iomem, &pl330_ops, s,"dma" ,PL330_IOMEM_SIZE ); +memory_region_init_io (&s->iomem,NULL , &pl330_ops, s,"dma" ,PL330_IOMEM_SIZE );sysbus_init_mmio (SYS_BUS_DEVICE (dev), &s->iomem); s->timer =qemu_new_timer_ns (vm_clock, pl330_exec_cycle_timer, s);
hw/dma/puv3_dma.c +1 -1
@@ -80,7 +80,7 @@ static int puv3_dma_init(SysBusDevice *dev) s->reg_CFG[i] =0x0 ; } -memory_region_init_io (&s->iomem, &puv3_dma_ops, s,"puv3_dma" , +memory_region_init_io (&s->iomem,NULL , &puv3_dma_ops, s,"puv3_dma" ,PUV3_REGS_OFFSET );sysbus_init_mmio (dev, &s->iomem);
hw/dma/pxa2xx_dma.c +1 -1
@@ -465,7 +465,7 @@ static int pxa2xx_dma_init(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, pxa2xx_dma_request,PXA2XX_DMA_NUM_REQUESTS ); -memory_region_init_io (&s->iomem, &pxa2xx_dma_ops, s, +memory_region_init_io (&s->iomem,NULL , &pxa2xx_dma_ops, s,"pxa2xx.dma" ,0x00010000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);
hw/dma/rc4030.c +2 -2
@@ -814,10 +814,10 @@ void *rc4030_init(qemu_irq timer, qemu_irq jazz_bus,register_savevm (NULL ,"rc4030" ,0 ,2 , rc4030_save, rc4030_load, s);rc4030_reset (s); -memory_region_init_io (&s->iomem_chipset, &rc4030_ops, s, +memory_region_init_io (&s->iomem_chipset,NULL , &rc4030_ops, s,"rc4030.chipset" ,0x300 );memory_region_add_subregion (sysmem,0x80000000 , &s->iomem_chipset); -memory_region_init_io (&s->iomem_jazzio, &jazzio_ops, s, +memory_region_init_io (&s->iomem_jazzio,NULL , &jazzio_ops, s,"rc4030.jazzio" ,0x00001000 );memory_region_add_subregion (sysmem,0xf0000000 , &s->iomem_jazzio);
hw/dma/sparc32_dma.c +1 -1
@@ -274,7 +274,7 @@ static int sparc32_dma_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); reg_size = s->is_ledma ?DMA_ETH_SIZE :DMA_SIZE ; -memory_region_init_io (&s->iomem, &dma_mem_ops, s,"dma" , reg_size); +memory_region_init_io (&s->iomem,NULL , &dma_mem_ops, s,"dma" , reg_size);sysbus_init_mmio (dev, &s->iomem);qdev_init_gpio_in (&dev->qdev, dma_set_irq,1 );
hw/dma/sun4m_iommu.c +1 -1
@@ -349,7 +349,7 @@ static int iommu_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->iomem, &iommu_mem_ops, s,"iommu" , +memory_region_init_io (&s->iomem,NULL , &iommu_mem_ops, s,"iommu" ,IOMMU_NREGS *sizeof (uint32_t ));sysbus_init_mmio (dev, &s->iomem);
hw/dma/xilinx_axidma.c +1 -1
@@ -590,7 +590,7 @@ static void xilinx_axidma_init(Object *obj)sysbus_init_irq (sbd, &s->streams[0 ].irq);sysbus_init_irq (sbd, &s->streams[1 ].irq); -memory_region_init_io (&s->iomem, &axidma_ops, s, +memory_region_init_io (&s->iomem,NULL , &axidma_ops, s,"xlnx.axi-dma" ,R_MAX *4 *2 );sysbus_init_mmio (sbd, &s->iomem); }
hw/gpio/omap_gpio.c +3 -3
@@ -677,7 +677,7 @@ static int omap_gpio_init(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, omap_gpio_set,16 );qdev_init_gpio_out (&dev->qdev, s->omap1.handler,16 );sysbus_init_irq (dev, &s->omap1.irq); -memory_region_init_io (&s->iomem, &omap_gpio_ops, &s->omap1, +memory_region_init_io (&s->iomem,NULL , &omap_gpio_ops, &s->omap1,"omap.gpio" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);return 0 ;
@@ -692,7 +692,7 @@ static int omap2_gpio_init(SysBusDevice *dev) }if (s->mpu_model < omap3430) { s->modulecount = (s->mpu_model < omap2430) ?4 :5 ; -memory_region_init_io (&s->iomem, &omap2_gpif_top_ops, s, +memory_region_init_io (&s->iomem,NULL , &omap2_gpif_top_ops, s,"omap2.gpio" ,0x1000 );sysbus_init_mmio (dev, &s->iomem); }else {
@@ -712,7 +712,7 @@ static int omap2_gpio_init(SysBusDevice *dev)sysbus_init_irq (dev, &m->irq[0 ]);/* mpu irq */ sysbus_init_irq (dev, &m->irq[1 ]);/* dsp irq */ sysbus_init_irq (dev, &m->wkup); -memory_region_init_io (&m->iomem, &omap2_gpio_module_ops, m, +memory_region_init_io (&m->iomem,NULL , &omap2_gpio_module_ops, m,"omap.gpio-module" ,0x1000 );sysbus_init_mmio (dev, &m->iomem); }
hw/gpio/pl061.c +1 -1
@@ -276,7 +276,7 @@ static int pl061_init(SysBusDevice *dev, const unsigned char *id) {pl061_state *s =FROM_SYSBUS (pl061_state, dev); s->id = id; -memory_region_init_io (&s->iomem, &pl061_ops, s,"pl061" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pl061_ops, s,"pl061" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);qdev_init_gpio_in (&dev->qdev, pl061_set_irq,8 );
hw/gpio/puv3_gpio.c +1 -1
@@ -112,7 +112,7 @@ static int puv3_gpio_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq[PUV3_IRQS_GPIOLOW7 ]);sysbus_init_irq (dev, &s->irq[PUV3_IRQS_GPIOHIGH ]); -memory_region_init_io (&s->iomem, &puv3_gpio_ops, s,"puv3_gpio" , +memory_region_init_io (&s->iomem,NULL , &puv3_gpio_ops, s,"puv3_gpio" ,PUV3_REGS_OFFSET );sysbus_init_mmio (dev, &s->iomem);
hw/gpio/zaurus.c +1 -1
@@ -169,7 +169,7 @@ static int scoop_init(SysBusDevice *dev) s->status =0x02 ;qdev_init_gpio_out (&s->busdev.qdev, s->handler,16 );qdev_init_gpio_in (&s->busdev.qdev, scoop_gpio_set,16 ); -memory_region_init_io (&s->iomem, &scoop_ops, s,"scoop" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &scoop_ops, s,"scoop" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);
hw/i2c/bitbang_i2c.c +1 -1
@@ -209,7 +209,7 @@ static int gpio_i2c_init(SysBusDevice *dev)GPIOI2CState *s =FROM_SYSBUS (GPIOI2CState, dev);i2c_bus *bus; -memory_region_init (&s->dummy_iomem,"gpio_i2c" ,0 ); +memory_region_init (&s->dummy_iomem,NULL ,"gpio_i2c" ,0 );sysbus_init_mmio (dev, &s->dummy_iomem); bus =i2c_init_bus (&dev->qdev,"i2c" );
hw/i2c/exynos4210_i2c.c +1 -1
@@ -301,7 +301,7 @@ static int exynos4210_i2c_realize(SysBusDevice *dev) {Exynos4210I2CState *s =EXYNOS4_I2C (dev); -memory_region_init_io (&s->iomem, &exynos4210_i2c_ops, s,TYPE_EXYNOS4_I2C , +memory_region_init_io (&s->iomem,NULL , &exynos4210_i2c_ops, s,TYPE_EXYNOS4_I2C ,EXYNOS4_I2C_MEM_SIZE );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq);
hw/i2c/omap_i2c.c +1 -1
@@ -448,7 +448,7 @@ static int omap_i2c_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq);sysbus_init_irq (dev, &s->drq[0 ]);sysbus_init_irq (dev, &s->drq[1 ]); -memory_region_init_io (&s->iomem, &omap_i2c_ops, s,"omap.i2c" , +memory_region_init_io (&s->iomem,NULL , &omap_i2c_ops, s,"omap.i2c" , (s->revision <OMAP2_INTR_REV ) ?0x800 :0x1000 );sysbus_init_mmio (dev, &s->iomem); s->bus =i2c_init_bus (&dev->qdev,NULL );
hw/i2c/pm_smbus.c +1 -1
@@ -181,5 +181,5 @@ static const MemoryRegionOps pm_smbus_ops = {void pm_smbus_init (DeviceState *parent,PMSMBus *smb) { smb->smbus =i2c_init_bus (parent,"i2c" ); -memory_region_init_io (&smb->io, &pm_smbus_ops, smb,"pm-smbus" ,64 ); +memory_region_init_io (&smb->io,NULL , &pm_smbus_ops, smb,"pm-smbus" ,64 ); }
hw/i2c/versatile_i2c.c +1 -1
@@ -79,7 +79,7 @@ static int versatile_i2c_init(SysBusDevice *dev) bus =i2c_init_bus (&dev->qdev,"i2c" ); s->bitbang =bitbang_i2c_init (bus); -memory_region_init_io (&s->iomem, &versatile_i2c_ops, s, +memory_region_init_io (&s->iomem,NULL , &versatile_i2c_ops, s,"versatile_i2c" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);return 0 ;
hw/i386/kvm/apic.c +1 -1
@@ -173,7 +173,7 @@ static const MemoryRegionOps kvm_apic_io_ops = {static void kvm_apic_init (APICCommonState *s) { -memory_region_init_io (&s->io_memory, &kvm_apic_io_ops, s,"kvm-apic-msi" , +memory_region_init_io (&s->io_memory,NULL , &kvm_apic_io_ops, s,"kvm-apic-msi" ,APIC_SPACE_SIZE );if (kvm_has_gsi_routing ()) {
hw/i386/kvm/i8254.c +1 -1
@@ -288,7 +288,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)return ; } -memory_region_init_reservation (&pit->ioports,"kvm-pit" ,4 ); +memory_region_init_reservation (&pit->ioports,NULL ,"kvm-pit" ,4 );qdev_init_gpio_in (dev, kvm_pit_irq_control,1 );
hw/i386/kvm/i8259.c +2 -2
@@ -119,8 +119,8 @@ static void kvm_pic_realize(DeviceState *dev, Error **errp)PICCommonState *s =PIC_COMMON (dev);KVMPICClass *kpc =KVM_PIC_GET_CLASS (dev); -memory_region_init_reservation (&s->base_io,"kvm-pic" ,2 ); -memory_region_init_reservation (&s->elcr_io,"kvm-elcr" ,1 ); +memory_region_init_reservation (&s->base_io,NULL ,"kvm-pic" ,2 ); +memory_region_init_reservation (&s->elcr_io,NULL ,"kvm-elcr" ,1 ); kpc->parent_realize (dev, errp); }
hw/i386/kvm/ioapic.c +1 -1
@@ -128,7 +128,7 @@ static void kvm_ioapic_set_irq(void *opaque, int irq, int level)static void kvm_ioapic_init (IOAPICCommonState *s,int instance_no) { -memory_region_init_reservation (&s->io_memory,"kvm-ioapic" ,0x1000 ); +memory_region_init_reservation (&s->io_memory,NULL ,"kvm-ioapic" ,0x1000 );qdev_init_gpio_in (&s->busdev.qdev, kvm_ioapic_set_irq,IOAPIC_NUM_PINS ); }
hw/i386/kvm/pci-assign.c +7 -7
@@ -298,7 +298,7 @@ static void assigned_dev_iomem_setup(PCIDevice *pci_dev, int region_num,PCIRegion *real_region = &r_dev->real_device.regions[region_num];if (e_size >0 ) { -memory_region_init (®ion->container,"assigned-dev-container" , +memory_region_init (®ion->container,NULL ,"assigned-dev-container" , e_size);memory_region_add_subregion (®ion->container,0 , ®ion->real_iomem);
@@ -329,8 +329,8 @@ static void assigned_dev_ioport_setup(PCIDevice *pci_dev, int region_num,AssignedDevRegion *region = &r_dev->v_addrs[region_num]; region->e_size = size; -memory_region_init (®ion->container,"assigned-dev-container" , size); -memory_region_init_io (®ion->real_iomem, &assigned_dev_ioport_ops, +memory_region_init (®ion->container,NULL ,"assigned-dev-container" , size); +memory_region_init_io (®ion->real_iomem,NULL , &assigned_dev_ioport_ops, r_dev->v_addrs + region_num,"assigned-dev-iomem" , size);memory_region_add_subregion (®ion->container,0 , ®ion->real_iomem);
@@ -478,7 +478,7 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,"4K. You might experience some performance hit " "due to that." , i, cur_region->base_addr, cur_region->size); -memory_region_init_io (&pci_dev->v_addrs[i].real_iomem, +memory_region_init_io (&pci_dev->v_addrs[i].real_iomem,NULL , &slow_bar_ops, &pci_dev->v_addrs[i],"assigned-dev-slow-bar" , cur_region->size);
@@ -487,7 +487,7 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,char name[32 ];snprintf (name,sizeof (name),"%s.bar%d" ,object_get_typename (OBJECT (pci_dev)), i); -memory_region_init_ram_ptr (&pci_dev->v_addrs[i].real_iomem, +memory_region_init_ram_ptr (&pci_dev->v_addrs[i].real_iomem,NULL , name, cur_region->size, virtbase); vmstate_register_ram(&pci_dev->v_addrs[i].real_iomem,
@@ -1650,7 +1650,7 @@ static int assigned_dev_register_msix_mmio(AssignedDevice *dev)assigned_dev_msix_reset (dev); -memory_region_init_io (&dev->mmio, &assigned_dev_msix_mmio_ops, dev, +memory_region_init_io (&dev->mmio,NULL , &assigned_dev_msix_mmio_ops, dev,"assigned-dev-msix" ,MSIX_PAGE_SIZE );return 0 ; }
@@ -1916,7 +1916,7 @@ static void assigned_dev_load_option_rom(AssignedDevice *dev)snprintf (name,sizeof (name),"%s.rom" ,object_get_typename (OBJECT (dev))); -memory_region_init_ram (&dev->dev.rom, name, st.st_size); +memory_region_init_ram (&dev->dev.rom,NULL , name, st.st_size);vmstate_register_ram (&dev->dev.rom, &dev->dev.qdev); ptr =memory_region_get_ram_ptr (&dev->dev.rom);memset (ptr,0xff , st.st_size);
hw/i386/kvmvapic.c +2 -2
@@ -601,7 +601,7 @@ static void vapic_map_rom_writable(VAPICROMState *s) rom_paddr &=TARGET_PAGE_MASK ; rom_size =TARGET_PAGE_ALIGN (rom_size); -memory_region_init_alias (&s->rom,"kvmvapic-rom" , section.mr, rom_paddr, +memory_region_init_alias (&s->rom,NULL ,"kvmvapic-rom" , section.mr, rom_paddr, rom_size);memory_region_add_subregion_overlap (as, rom_paddr, &s->rom,1000 ); s->rom_mapped_writable = true;
@@ -702,7 +702,7 @@ static int vapic_init(SysBusDevice *dev) {VAPICROMState *s =VAPIC (dev); -memory_region_init_io (&s->io, &vapic_ops, s,"kvmvapic" ,2 ); +memory_region_init_io (&s->io,NULL , &vapic_ops, s,"kvmvapic" ,2 );sysbus_add_io (dev,VAPIC_IO_PORT , &s->io);sysbus_init_ioports (dev,VAPIC_IO_PORT ,2 );
hw/i386/pc.c +7 -7
@@ -525,7 +525,7 @@ static void port92_initfn(Object *obj) {Port92State *s =PORT92 (obj); -memory_region_init_io (&s->io, &port92_ops, s,"port92" ,1 ); +memory_region_init_io (&s->io,NULL , &port92_ops, s,"port92" ,1 ); s->outport =0 ; }
@@ -1044,17 +1044,17 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory,* with older qemus that used qemu_ram_alloc(). */ ram =g_malloc (sizeof (*ram)); -memory_region_init_ram (ram,"pc.ram" , +memory_region_init_ram (ram,NULL ,"pc.ram" , below_4g_mem_size + above_4g_mem_size);vmstate_register_ram_global (ram); *ram_memory = ram; ram_below_4g =g_malloc (sizeof (*ram_below_4g)); -memory_region_init_alias (ram_below_4g,"ram-below-4g" , ram, +memory_region_init_alias (ram_below_4g,NULL ,"ram-below-4g" , ram,0 , below_4g_mem_size);memory_region_add_subregion (system_memory,0 , ram_below_4g);if (above_4g_mem_size >0 ) { ram_above_4g =g_malloc (sizeof (*ram_above_4g)); -memory_region_init_alias (ram_above_4g,"ram-above-4g" , ram, +memory_region_init_alias (ram_above_4g,NULL ,"ram-above-4g" , ram, below_4g_mem_size, above_4g_mem_size);memory_region_add_subregion (system_memory,0x100000000ULL , ram_above_4g);
@@ -1065,7 +1065,7 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory,pc_system_firmware_init (rom_memory); option_rom_mr =g_malloc (sizeof (*option_rom_mr)); -memory_region_init_ram (option_rom_mr,"pc.rom" ,PC_ROM_SIZE ); +memory_region_init_ram (option_rom_mr,NULL ,"pc.rom" ,PC_ROM_SIZE );vmstate_register_ram_global (option_rom_mr); memory_region_add_subregion_overlap(rom_memory, PC_ROM_MIN_VGA,
@@ -1150,10 +1150,10 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,MemoryRegion *ioport80_io =g_new (MemoryRegion,1 );MemoryRegion *ioportF0_io =g_new (MemoryRegion,1 ); -memory_region_init_io (ioport80_io, &ioport80_io_ops,NULL ,"ioport80" ,1 ); +memory_region_init_io (ioport80_io,NULL , &ioport80_io_ops,NULL ,"ioport80" ,1 );memory_region_add_subregion (isa_bus->address_space_io,0x80 , ioport80_io); -memory_region_init_io (ioportF0_io, &ioportF0_io_ops,NULL ,"ioportF0" ,1 ); +memory_region_init_io (ioportF0_io,NULL , &ioportF0_io_ops,NULL ,"ioportF0" ,1 );memory_region_add_subregion (isa_bus->address_space_io,0xf0 , ioportF0_io);/*
hw/i386/pc_piix.c +1 -1
@@ -117,7 +117,7 @@ static void pc_init1(MemoryRegion *system_memory,if (pci_enabled) { pci_memory =g_new (MemoryRegion,1 ); -memory_region_init (pci_memory,"pci" ,INT64_MAX ); +memory_region_init (pci_memory,NULL ,"pci" ,INT64_MAX ); rom_memory = pci_memory; }else { pci_memory =NULL ;
hw/i386/pc_q35.c +1 -1
@@ -98,7 +98,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)/* pci enabled */ if (pci_enabled) { pci_memory =g_new (MemoryRegion,1 ); -memory_region_init (pci_memory,"pci" ,INT64_MAX ); +memory_region_init (pci_memory,NULL ,"pci" ,INT64_MAX ); rom_memory = pci_memory; }else { pci_memory =NULL ;
hw/ide/ahci.c +2 -2
@@ -1156,8 +1156,8 @@ void ahci_init(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports) s->dev =g_malloc0 (sizeof (AHCIDevice) * ports);ahci_reg_init (s);/* XXX BAR size should be 1k, but that breaks, so bump it to 4k for now */ -memory_region_init_io (&s->mem, &ahci_mem_ops, s,"ahci" ,AHCI_MEM_BAR_SIZE ); -memory_region_init_io (&s->idp, &ahci_idp_ops, s,"ahci-idp" ,32 ); +memory_region_init_io (&s->mem,NULL , &ahci_mem_ops, s,"ahci" ,AHCI_MEM_BAR_SIZE ); +memory_region_init_io (&s->idp,NULL , &ahci_idp_ops, s,"ahci-idp" ,32 ); irqs =qemu_allocate_irqs (ahci_irq_set, s, s->ports);
hw/ide/cmd646.c +5 -5
@@ -117,8 +117,8 @@ static void setup_cmd646_bar(PCIIDEState *d, int bus_num) bar->bus = bus; bar->pci_dev = d; -memory_region_init_io (&bar->cmd, &cmd646_cmd_ops, bar,"cmd646-cmd" ,4 ); -memory_region_init_io (&bar->data, &cmd646_data_ops, bar,"cmd646-data" ,8 ); +memory_region_init_io (&bar->cmd,NULL , &cmd646_cmd_ops, bar,"cmd646-cmd" ,4 ); +memory_region_init_io (&bar->data,NULL , &cmd646_data_ops, bar,"cmd646-data" ,8 ); } static uint64_t bmdma_read(void *opaque, hwaddr addr,
@@ -203,13 +203,13 @@ static void bmdma_setup_bar(PCIIDEState *d)BMDMAState *bm;int i; -memory_region_init (&d->bmdma_bar,"cmd646-bmdma" ,16 ); +memory_region_init (&d->bmdma_bar,NULL ,"cmd646-bmdma" ,16 );for (i =0 ;i <2 ; i++) { bm = &d->bmdma[i]; -memory_region_init_io (&bm->extra_io, &cmd646_bmdma_ops, bm, +memory_region_init_io (&bm->extra_io,NULL , &cmd646_bmdma_ops, bm,"cmd646-bmdma-bus" ,4 );memory_region_add_subregion (&d->bmdma_bar, i *8 , &bm->extra_io); -memory_region_init_io (&bm->addr_ioport, &bmdma_addr_ioport_ops, bm, +memory_region_init_io (&bm->addr_ioport,NULL , &bmdma_addr_ioport_ops, bm,"cmd646-bmdma-ioport" ,4 );memory_region_add_subregion (&d->bmdma_bar, i *8 +4 , &bm->addr_ioport); }
hw/ide/macio.c +1 -1
@@ -335,7 +335,7 @@ static void macio_ide_initfn(Object *obj)MACIOIDEState *s =MACIO_IDE (obj);ide_bus_new (&s->bus,DEVICE (obj),0 ,2 ); -memory_region_init_io (&s->mem, &pmac_ide_ops, s,"pmac-ide" ,0x1000 ); +memory_region_init_io (&s->mem,NULL , &pmac_ide_ops, s,"pmac-ide" ,0x1000 );sysbus_init_mmio (d, &s->mem);sysbus_init_irq (d, &s->irq);sysbus_init_irq (d, &s->dma_irq);
hw/ide/mmio.c +2 -2
@@ -124,9 +124,9 @@ static void mmio_ide_realizefn(DeviceState *dev, Error **errp)ide_init2 (&s->bus, s->irq); -memory_region_init_io (&s->iomem1, &mmio_ide_ops, s, +memory_region_init_io (&s->iomem1,NULL , &mmio_ide_ops, s,"ide-mmio.1" ,16 << s->shift); -memory_region_init_io (&s->iomem2, &mmio_ide_cs_ops, s, +memory_region_init_io (&s->iomem2,NULL , &mmio_ide_cs_ops, s,"ide-mmio.2" ,2 << s->shift);sysbus_init_mmio (d, &s->iomem1);sysbus_init_mmio (d, &s->iomem2);
hw/ide/piix.c +3 -3
@@ -90,14 +90,14 @@ static void bmdma_setup_bar(PCIIDEState *d) {int i; -memory_region_init (&d->bmdma_bar,"piix-bmdma-container" ,16 ); +memory_region_init (&d->bmdma_bar,NULL ,"piix-bmdma-container" ,16 );for (i =0 ;i <2 ; i++) {BMDMAState *bm = &d->bmdma[i]; -memory_region_init_io (&bm->extra_io, &piix_bmdma_ops, bm, +memory_region_init_io (&bm->extra_io,NULL , &piix_bmdma_ops, bm,"piix-bmdma" ,4 );memory_region_add_subregion (&d->bmdma_bar, i *8 , &bm->extra_io); -memory_region_init_io (&bm->addr_ioport, &bmdma_addr_ioport_ops, bm, +memory_region_init_io (&bm->addr_ioport,NULL , &bmdma_addr_ioport_ops, bm,"bmdma" ,4 );memory_region_add_subregion (&d->bmdma_bar, i *8 +4 , &bm->addr_ioport); }
hw/ide/via.c +3 -3
@@ -92,14 +92,14 @@ static void bmdma_setup_bar(PCIIDEState *d) {int i; -memory_region_init (&d->bmdma_bar,"via-bmdma-container" ,16 ); +memory_region_init (&d->bmdma_bar,NULL ,"via-bmdma-container" ,16 );for (i =0 ;i <2 ; i++) {BMDMAState *bm = &d->bmdma[i]; -memory_region_init_io (&bm->extra_io, &via_bmdma_ops, bm, +memory_region_init_io (&bm->extra_io,NULL , &via_bmdma_ops, bm,"via-bmdma" ,4 );memory_region_add_subregion (&d->bmdma_bar, i *8 , &bm->extra_io); -memory_region_init_io (&bm->addr_ioport, &bmdma_addr_ioport_ops, bm, +memory_region_init_io (&bm->addr_ioport,NULL , &bmdma_addr_ioport_ops, bm,"bmdma" ,4 );memory_region_add_subregion (&d->bmdma_bar, i *8 +4 , &bm->addr_ioport); }
hw/input/milkymist-softusb.c +3 -3
@@ -265,17 +265,17 @@ static int milkymist_softusb_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); -memory_region_init_io (&s->regs_region, &softusb_mmio_ops, s, +memory_region_init_io (&s->regs_region,NULL , &softusb_mmio_ops, s,"milkymist-softusb" ,R_MAX *4 );sysbus_init_mmio (dev, &s->regs_region);/* register pmem and dmem */ -memory_region_init_ram (&s->pmem,"milkymist-softusb.pmem" , +memory_region_init_ram (&s->pmem,NULL ,"milkymist-softusb.pmem" , s->pmem_size);vmstate_register_ram_global (&s->pmem); s->pmem_ptr =memory_region_get_ram_ptr (&s->pmem);sysbus_init_mmio (dev, &s->pmem); -memory_region_init_ram (&s->dmem,"milkymist-softusb.dmem" , +memory_region_init_ram (&s->dmem,NULL ,"milkymist-softusb.dmem" , s->dmem_size);vmstate_register_ram_global (&s->dmem); s->dmem_ptr =memory_region_get_ram_ptr (&s->dmem);
hw/input/pckbd.c +3 -3
@@ -424,7 +424,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,vmstate_register (NULL ,0 , &vmstate_kbd, s); -memory_region_init_io (region, &i8042_mmio_ops, s,"i8042" , size); +memory_region_init_io (region,NULL , &i8042_mmio_ops, s,"i8042" , size); s->kbd =ps2_kbd_init (kbd_update_kbd_irq, s); s->mouse =ps2_mouse_init (kbd_update_aux_irq, s);
@@ -494,8 +494,8 @@ static void i8042_initfn(Object *obj)ISAKBDState *isa_s =I8042 (obj);KBDState *s = &isa_s->kbd; -memory_region_init_io (isa_s->io +0 , &i8042_data_ops, s,"i8042-data" ,1 ); -memory_region_init_io (isa_s->io +1 , &i8042_cmd_ops, s,"i8042-cmd" ,1 ); +memory_region_init_io (isa_s->io +0 ,NULL , &i8042_data_ops, s,"i8042-data" ,1 ); +memory_region_init_io (isa_s->io +1 ,NULL , &i8042_cmd_ops, s,"i8042-cmd" ,1 ); }static void i8042_realizefn (DeviceState *dev,Error **errp)
hw/input/pl050.c +1 -1
@@ -137,7 +137,7 @@ static int pl050_init(SysBusDevice *dev, int is_mouse) {pl050_state *s =FROM_SYSBUS (pl050_state, dev); -memory_region_init_io (&s->iomem, &pl050_ops, s,"pl050" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pl050_ops, s,"pl050" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);sysbus_init_irq (dev, &s->irq); s->is_mouse = is_mouse;
hw/input/pxa2xx_keypad.c +1 -1
@@ -313,7 +313,7 @@ PXA2xxKeyPadState *pxa27x_keypad_init(MemoryRegion *sysmem, s = (PXA2xxKeyPadState *)g_malloc0 (sizeof (PXA2xxKeyPadState)); s->irq = irq; -memory_region_init_io (&s->iomem, &pxa2xx_keypad_ops, s, +memory_region_init_io (&s->iomem,NULL , &pxa2xx_keypad_ops, s,"pxa2xx-keypad" ,0x00100000 );memory_region_add_subregion (sysmem, base, &s->iomem);
hw/intc/apic.c +1 -1
@@ -873,7 +873,7 @@ static const MemoryRegionOps apic_io_ops = {static void apic_init (APICCommonState *s) { -memory_region_init_io (&s->io_memory, &apic_io_ops, s,"apic-msi" , +memory_region_init_io (&s->io_memory,NULL , &apic_io_ops, s,"apic-msi" ,APIC_SPACE_SIZE ); s->timer =qemu_new_timer_ns (vm_clock, apic_timer, s);
hw/intc/arm_gic.c +3 -3
@@ -656,7 +656,7 @@ void gic_init_irqs_and_distributor(GICState *s, int num_irq)for (i =0 ; i <NUM_CPU (s); i++) {sysbus_init_irq (&s->busdev, &s->parent_irq[i]); } -memory_region_init_io (&s->iomem, &gic_dist_ops, s,"gic_dist" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &gic_dist_ops, s,"gic_dist" ,0x1000 ); }static void arm_gic_realize (DeviceState *dev,Error **errp)
@@ -682,11 +682,11 @@ static void arm_gic_realize(DeviceState *dev, Error **errp)* GIC v2 defines a larger memory region (0x1000) so this will need * to be extended when we implement A15. */ -memory_region_init_io (&s->cpuiomem[0 ], &gic_thiscpu_ops, s, +memory_region_init_io (&s->cpuiomem[0 ],NULL , &gic_thiscpu_ops, s,"gic_cpu" ,0x100 );for (i =0 ; i <NUM_CPU (s); i++) { s->backref[i] = s; -memory_region_init_io (&s->cpuiomem[i+1 ], &gic_cpu_ops, &s->backref[i], +memory_region_init_io (&s->cpuiomem[i+1 ],NULL , &gic_cpu_ops, &s->backref[i],"gic_cpu" ,0x100 ); }/* Distributor */
hw/intc/arm_gic_kvm.c +2 -2
@@ -120,7 +120,7 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)sysbus_init_irq (sbd, &s->parent_irq[i]); }/* Distributor */ -memory_region_init_reservation (&s->iomem,"kvm-gic_dist" ,0x1000 ); +memory_region_init_reservation (&s->iomem,NULL ,"kvm-gic_dist" ,0x1000 );sysbus_init_mmio (sbd, &s->iomem);kvm_arm_register_device (&s->iomem, (KVM_ARM_DEVICE_VGIC_V2 << KVM_ARM_DEVICE_ID_SHIFT)
@@ -129,7 +129,7 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)* provide the "interface for core #N" memory regions, because * cores with a VGIC don't have those. */ -memory_region_init_reservation (&s->cpuiomem[0 ],"kvm-gic_cpu" ,0x1000 ); +memory_region_init_reservation (&s->cpuiomem[0 ],NULL ,"kvm-gic_cpu" ,0x1000 );sysbus_init_mmio (sbd, &s->cpuiomem[0 ]);kvm_arm_register_device (&s->cpuiomem[0 ], (KVM_ARM_DEVICE_VGIC_V2 << KVM_ARM_DEVICE_ID_SHIFT)
hw/intc/armv7m_nvic.c +3 -3
@@ -487,17 +487,17 @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp)* We use overlaying to put the GIC like registers * over the top of the system control register region. */ -memory_region_init (&s->container,"nvic" ,0x1000 ); +memory_region_init (&s->container,NULL ,"nvic" ,0x1000 );/* The system register region goes at the bottom of the priority * stack as it covers the whole page. */ -memory_region_init_io (&s->sysregmem, &nvic_sysreg_ops, s, +memory_region_init_io (&s->sysregmem,NULL , &nvic_sysreg_ops, s,"nvic_sysregs" ,0x1000 );memory_region_add_subregion (&s->container,0 , &s->sysregmem);/* Alias the GIC region so we can get only the section of it * we need, and layer it on top of the system register region. */ -memory_region_init_alias (&s->gic_iomem_alias,"nvic-gic" , &s->gic.iomem, +memory_region_init_alias (&s->gic_iomem_alias,NULL ,"nvic-gic" , &s->gic.iomem,0x100 ,0xc00 );memory_region_add_subregion_overlap (&s->container,0x100 , &s->gic_iomem_alias,1 );
hw/intc/etraxfs_pic.c +1 -1
@@ -146,7 +146,7 @@ static int etraxfs_pic_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->parent_irq);sysbus_init_irq (dev, &s->parent_nmi); -memory_region_init_io (&s->mmio, &pic_ops, s,"etraxfs-pic" ,R_MAX *4 ); +memory_region_init_io (&s->mmio,NULL , &pic_ops, s,"etraxfs-pic" ,R_MAX *4 );sysbus_init_mmio (dev, &s->mmio);return 0 ; }
hw/intc/exynos4210_combiner.c +1 -1
@@ -417,7 +417,7 @@ static int exynos4210_combiner_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->output_irq[i]); } -memory_region_init_io (&s->iomem, &exynos4210_combiner_ops, s, +memory_region_init_io (&s->iomem,NULL , &exynos4210_combiner_ops, s,"exynos4210-combiner" ,IIC_REGION_SIZE );sysbus_init_mmio (dev, &s->iomem);
hw/intc/exynos4210_gic.c +4 -4
@@ -299,15 +299,15 @@ static int exynos4210_gic_init(SysBusDevice *dev)qdev_init_gpio_in (&s->busdev.qdev, exynos4210_gic_set_irq,EXYNOS4210_GIC_NIRQ -32 ); -memory_region_init (&s->cpu_container,"exynos4210-cpu-container" , +memory_region_init (&s->cpu_container,NULL ,"exynos4210-cpu-container" ,EXYNOS4210_EXT_GIC_CPU_REGION_SIZE ); -memory_region_init (&s->dist_container,"exynos4210-dist-container" , +memory_region_init (&s->dist_container,NULL ,"exynos4210-dist-container" ,EXYNOS4210_EXT_GIC_DIST_REGION_SIZE );for (i =0 ; i < s->num_cpu; i++) {/* Map CPU interface per SMP Core */ sprintf (cpu_alias_name,"%s%x" , cpu_prefix, i); - memory_region_init_alias(&s->cpu_alias[i], + memory_region_init_alias(&s->cpu_alias[i], NULL, cpu_alias_name, sysbus_mmio_get_region(busdev, 1), 0,
@@ -317,7 +317,7 @@ static int exynos4210_gic_init(SysBusDevice *dev)/* Map Distributor per SMP Core */ sprintf (dist_alias_name,"%s%x" , dist_prefix, i); - memory_region_init_alias(&s->dist_alias[i], + memory_region_init_alias(&s->dist_alias[i], NULL, dist_alias_name, sysbus_mmio_get_region(busdev, 0), 0,
hw/intc/grlib_irqmp.c +1 -1
@@ -344,7 +344,7 @@ static int grlib_irqmp_init(SysBusDevice *dev)return -1 ; } -memory_region_init_io (&irqmp->iomem, &grlib_irqmp_ops, irqmp, +memory_region_init_io (&irqmp->iomem,NULL , &grlib_irqmp_ops, irqmp,"irqmp" ,IRQMP_REG_SIZE ); irqmp->state =g_malloc0 (sizeof *irqmp->state);
hw/intc/heathrow_pic.c +1 -1
@@ -205,7 +205,7 @@ qemu_irq *heathrow_pic_init(MemoryRegion **pmem, s =g_malloc0 (sizeof (HeathrowPICS));/* only 1 CPU */ s->irqs = irqs[0 ]; -memory_region_init_io (&s->mem, &heathrow_pic_ops, s, +memory_region_init_io (&s->mem,NULL , &heathrow_pic_ops, s,"heathrow-pic" ,0x1000 ); *pmem = &s->mem;
hw/intc/i8259.c +2 -2
@@ -417,8 +417,8 @@ static void pic_realize(DeviceState *dev, Error **err)PICCommonState *s =PIC_COMMON (dev);PICClass *pc =PIC_GET_CLASS (dev); -memory_region_init_io (&s->base_io, &pic_base_ioport_ops, s,"pic" ,2 ); -memory_region_init_io (&s->elcr_io, &pic_elcr_ioport_ops, s,"elcr" ,1 ); +memory_region_init_io (&s->base_io,NULL , &pic_base_ioport_ops, s,"pic" ,2 ); +memory_region_init_io (&s->elcr_io,NULL , &pic_elcr_ioport_ops, s,"elcr" ,1 );qdev_init_gpio_out (dev, s->int_out,ARRAY_SIZE (s->int_out));qdev_init_gpio_in (dev, pic_set_irq,8 );
hw/intc/imx_avic.c +1 -1
@@ -372,7 +372,7 @@ static int imx_avic_init(SysBusDevice *dev) {IMXAVICState *s =FROM_SYSBUS (IMXAVICState, dev); -memory_region_init_io (&s->iomem, &imx_avic_ops, s,"imx_avic" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &imx_avic_ops, s,"imx_avic" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);qdev_init_gpio_in (&dev->qdev, imx_avic_set_irq,IMX_AVIC_NUM_IRQS );
hw/intc/ioapic.c +1 -1
@@ -227,7 +227,7 @@ static const MemoryRegionOps ioapic_io_ops = {static void ioapic_init (IOAPICCommonState *s,int instance_no) { -memory_region_init_io (&s->io_memory, &ioapic_io_ops, s,"ioapic" ,0x1000 ); +memory_region_init_io (&s->io_memory,NULL , &ioapic_io_ops, s,"ioapic" ,0x1000 );qdev_init_gpio_in (&s->busdev.qdev, ioapic_set_irq,IOAPIC_NUM_PINS );
hw/intc/omap_intc.c +2 -2
@@ -367,7 +367,7 @@ static int omap_intc_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->parent_intr[0 ]);sysbus_init_irq (dev, &s->parent_intr[1 ]);qdev_init_gpio_in (&dev->qdev, omap_set_intr, s->nbanks *32 ); -memory_region_init_io (&s->mmio, &omap_inth_mem_ops, s, +memory_region_init_io (&s->mmio,NULL , &omap_inth_mem_ops, s,"omap-intc" , s->size);sysbus_init_mmio (dev, &s->mmio);return 0 ;
@@ -609,7 +609,7 @@ static int omap2_intc_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->parent_intr[0 ]);sysbus_init_irq (dev, &s->parent_intr[1 ]);qdev_init_gpio_in (&dev->qdev, omap_set_intr_noedge, s->nbanks *32 ); -memory_region_init_io (&s->mmio, &omap2_inth_mem_ops, s, +memory_region_init_io (&s->mmio,NULL , &omap2_inth_mem_ops, s,"omap2-intc" ,0x1000 );sysbus_init_mmio (dev, &s->mmio);return 0 ;
hw/intc/openpic.c +2 -2
@@ -1515,7 +1515,7 @@ static void map_list(OpenPICState *opp, const MemReg *list, int *count)while (list->name) {assert (*count <ARRAY_SIZE (opp->sub_io_mem)); -memory_region_init_io (&opp->sub_io_mem[*count], list->ops, opp, +memory_region_init_io (&opp->sub_io_mem[*count],NULL , list->ops, opp, list->name, list->size); memory_region_add_subregion(&opp->mem, list->start_addr,
@@ -1561,7 +1561,7 @@ static int openpic_init(SysBusDevice *dev) {NULL} }; -memory_region_init (&opp->mem,"openpic" ,0x40000 ); +memory_region_init (&opp->mem,NULL ,"openpic" ,0x40000 );switch (opp->model) {case OPENPIC_MODEL_FSL_MPIC_20 :
hw/intc/pl190.c +1 -1
@@ -236,7 +236,7 @@ static int pl190_init(SysBusDevice *dev) {pl190_state *s =FROM_SYSBUS (pl190_state, dev); -memory_region_init_io (&s->iomem, &pl190_ops, s,"pl190" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &pl190_ops, s,"pl190" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);qdev_init_gpio_in (&dev->qdev, pl190_set_irq,32 );sysbus_init_irq (dev, &s->irq);
hw/intc/puv3_intc.c +1 -1
@@ -106,7 +106,7 @@ static int puv3_intc_init(SysBusDevice *dev) s->reg_ICMR =0 ; s->reg_ICPR =0 ; -memory_region_init_io (&s->iomem, &puv3_intc_ops, s,"puv3_intc" , +memory_region_init_io (&s->iomem,NULL , &puv3_intc_ops, s,"puv3_intc" ,PUV3_REGS_OFFSET );sysbus_init_mmio (dev, &s->iomem);
hw/intc/realview_gic.c +1 -1
@@ -43,7 +43,7 @@ static int realview_gic_init(SysBusDevice *dev)/* Pass through inbound GPIO lines to the GIC */ qdev_init_gpio_in (&s->busdev.qdev, realview_gic_set_irq, numirq -32 ); -memory_region_init (&s->container,"realview-gic-container" ,0x2000 ); +memory_region_init (&s->container,NULL ,"realview-gic-container" ,0x2000 );memory_region_add_subregion (&s->container,0 ,sysbus_mmio_get_region (busdev,1 )); memory_region_add_subregion(&s->container, 0x1000,
hw/intc/sh_intc.c +3 -3
@@ -319,11 +319,11 @@ static unsigned int sh_intc_register(MemoryRegion *sysmem,#define SH_INTC_IOMEM_FORMAT "interrupt-controller-%s-%s-%s"snprintf (name,sizeof (name),SH_INTC_IOMEM_FORMAT , type, action,"p4" ); -memory_region_init_alias (iomem_p4, name, iomem,INTC_A7 (address),4 ); +memory_region_init_alias (iomem_p4,NULL , name, iomem,INTC_A7 (address),4 );memory_region_add_subregion (sysmem,P4ADDR (address), iomem_p4);snprintf (name,sizeof (name),SH_INTC_IOMEM_FORMAT , type, action,"a7" ); -memory_region_init_alias (iomem_a7, name, iomem,INTC_A7 (address),4 ); +memory_region_init_alias (iomem_a7,NULL , name, iomem,INTC_A7 (address),4 );memory_region_add_subregion (sysmem,A7ADDR (address), iomem_a7);#undef SH_INTC_IOMEM_FORMAT
@@ -466,7 +466,7 @@ int sh_intc_init(MemoryRegion *sysmem, desc->irqs =qemu_allocate_irqs (sh_intc_set_irq, desc, nr_sources); -memory_region_init_io (&desc->iomem, &sh_intc_ops, desc, +memory_region_init_io (&desc->iomem,NULL , &sh_intc_ops, desc,"interrupt-controller" ,0x100000000ULL );#define INT_REG_PARAMS (reg_struct, type, action, j) \
hw/intc/slavio_intctl.c +2 -2
@@ -426,7 +426,7 @@ static int slavio_intctl_init1(SysBusDevice *dev)char slave_name[45 ];qdev_init_gpio_in (&dev->qdev, slavio_set_irq_all,32 +MAX_CPUS ); -memory_region_init_io (&s->iomem, &slavio_intctlm_mem_ops, s, +memory_region_init_io (&s->iomem,NULL , &slavio_intctlm_mem_ops, s,"master-interrupt-controller" ,INTCTLM_SIZE );sysbus_init_mmio (dev, &s->iomem);
@@ -436,7 +436,7 @@ static int slavio_intctl_init1(SysBusDevice *dev)for (j =0 ; j <MAX_PILS ; j++) {sysbus_init_irq (dev, &s->cpu_irqs[i][j]); } -memory_region_init_io (&s->slaves[i].iomem, &slavio_intctl_mem_ops, +memory_region_init_io (&s->slaves[i].iomem,NULL , &slavio_intctl_mem_ops, &s->slaves[i], slave_name,INTCTL_SIZE );sysbus_init_mmio (dev, &s->slaves[i].iomem); s->slaves[i].cpu = i;
hw/intc/xilinx_intc.c +1 -1
@@ -160,7 +160,7 @@ static int xilinx_intc_init(SysBusDevice *dev)qdev_init_gpio_in (&dev->qdev, irq_handler,32 );sysbus_init_irq (dev, &p->parent_irq); -memory_region_init_io (&p->mmio, &pic_ops, p,"xlnx.xps-intc" ,R_MAX *4 ); +memory_region_init_io (&p->mmio,NULL , &pic_ops, p,"xlnx.xps-intc" ,R_MAX *4 );sysbus_init_mmio (dev, &p->mmio);return 0 ; }
hw/isa/apm.c +1 -1
@@ -96,7 +96,7 @@ void apm_init(PCIDevice *dev, APMState *apm, apm_ctrl_changed_t callback, apm->arg = arg;/* ioport 0xb2, 0xb3 */ -memory_region_init_io (&apm->io, &apm_ops, apm,"apm-io" ,2 ); +memory_region_init_io (&apm->io,NULL , &apm_ops, apm,"apm-io" ,2 );memory_region_add_subregion (pci_address_space_io (dev),APM_CNT_IOPORT , &apm->io); }
hw/isa/i82378.c +2 -2
@@ -221,10 +221,10 @@ static int pci_i82378_init(PCIDevice *dev) pci_conf[PCI_INTERRUPT_PIN ] =1 ;/* interrupt pin 0 */ -memory_region_init_io (&s->io, &i82378_io_ops, s,"i82378-io" ,0x00010000 ); +memory_region_init_io (&s->io,NULL , &i82378_io_ops, s,"i82378-io" ,0x00010000 );pci_register_bar (dev,0 ,PCI_BASE_ADDRESS_SPACE_MEMORY , &s->io); -memory_region_init_io (&s->mem, &i82378_mem_ops, s,"i82378-mem" ,0x01000000 ); +memory_region_init_io (&s->mem,NULL , &i82378_mem_ops, s,"i82378-mem" ,0x01000000 );pci_register_bar (dev,1 ,PCI_BASE_ADDRESS_SPACE_MEMORY , &s->mem);/* Make I/O address read only */
hw/isa/isa_mmio.c +1 -1
@@ -69,7 +69,7 @@ static const MemoryRegionOps isa_mmio_ops = {void isa_mmio_setup (MemoryRegion *mr,hwaddr size) { -memory_region_init_io (mr, &isa_mmio_ops,NULL ,"isa-mmio" , size); +memory_region_init_io (mr,NULL , &isa_mmio_ops,NULL ,"isa-mmio" , size); }void isa_mmio_init (hwaddr base,hwaddr size)
hw/isa/lpc_ich9.c +2 -2
@@ -535,7 +535,7 @@ static int ich9_lpc_initfn(PCIDevice *d)pci_set_long (d->wmask +ICH9_LPC_PMBASE ,ICH9_LPC_PMBASE_BASE_ADDRESS_MASK ); -memory_region_init_io (&lpc->rbca_mem, &rbca_mmio_ops, lpc, +memory_region_init_io (&lpc->rbca_mem,NULL , &rbca_mmio_ops, lpc,"lpc-rbca-mmio" ,ICH9_CC_SIZE ); lpc->isa_bus = isa_bus;
@@ -546,7 +546,7 @@ static int ich9_lpc_initfn(PCIDevice *d) lpc->machine_ready.notify = ich9_lpc_machine_ready;qemu_add_machine_init_done_notifier (&lpc->machine_ready); -memory_region_init_io (&lpc->rst_cnt_mem, &ich9_rst_cnt_ops, lpc, +memory_region_init_io (&lpc->rst_cnt_mem,NULL , &ich9_rst_cnt_ops, lpc,"lpc-reset-control" ,1 ); memory_region_add_subregion_overlap(pci_address_space_io(d), ICH9_RST_CNT_IOPORT, &lpc->rst_cnt_mem,
hw/isa/pc87312.c +1 -1
@@ -352,7 +352,7 @@ static void pc87312_initfn(Object *obj) {PC87312State *s =PC87312 (obj); -memory_region_init_io (&s->io, &pc87312_io_ops, s,"pc87312" ,2 ); +memory_region_init_io (&s->io,NULL , &pc87312_io_ops, s,"pc87312" ,2 ); }static const VMStateDescription vmstate_pc87312 = {
hw/isa/vt82c686.c +3 -3
@@ -356,7 +356,7 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)apm_init (dev, &s->apm,NULL , s); -memory_region_init (&s->io,"vt82c686-pm" ,64 ); +memory_region_init (&s->io,NULL ,"vt82c686-pm" ,64 );memory_region_set_enabled (&s->io, false);memory_region_add_subregion (get_system_io (),0 , &s->io);
@@ -443,8 +443,8 @@ static int vt82c686b_initfn(PCIDevice *d) } } -memory_region_init_io (&vt82c->superio, &superio_ops, &vt82c->superio_conf, -"superio" ,2 ); +memory_region_init_io (&vt82c->superio,NULL , &superio_ops, + &vt82c->superio_conf,"superio" ,2 );memory_region_set_enabled (&vt82c->superio, false);/* The floppy also uses 0x3f0 and 0x3f1. * But we do not emulate a floppy, so just set it here. */
hw/lm32/lm32_boards.c +2 -2
@@ -106,7 +106,7 @@ static void lm32_evr_init(QEMUMachineInitArgs *args) reset_info->flash_base = flash_base; -memory_region_init_ram (phys_ram,"lm32_evr.sdram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"lm32_evr.sdram" , ram_size);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (address_space_mem, ram_base, phys_ram);
@@ -203,7 +203,7 @@ static void lm32_uclinux_init(QEMUMachineInitArgs *args) reset_info->flash_base = flash_base; -memory_region_init_ram (phys_ram,"lm32_uclinux.sdram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"lm32_uclinux.sdram" , ram_size);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (address_space_mem, ram_base, phys_ram);
hw/lm32/milkymist.c +1 -1
@@ -112,7 +112,7 @@ milkymist_init(QEMUMachineInitArgs *args)cpu_lm32_set_phys_msb_ignore (env,1 ); -memory_region_init_ram (phys_sdram,"milkymist.sdram" , sdram_size); +memory_region_init_ram (phys_sdram,NULL ,"milkymist.sdram" , sdram_size);vmstate_register_ram_global (phys_sdram);memory_region_add_subregion (address_space_mem, sdram_base, phys_sdram);
hw/m68k/an5206.c +2 -2
@@ -49,12 +49,12 @@ static void an5206_init(QEMUMachineInitArgs *args) env->rambar0 =AN5206_RAMBAR_ADDR |1 ;/* DRAM at address zero */ -memory_region_init_ram (ram,"an5206.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"an5206.ram" , ram_size);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0 , ram);/* Internal SRAM. */ -memory_region_init_ram (sram,"an5206.sram" ,512 ); +memory_region_init_ram (sram,NULL ,"an5206.sram" ,512 );vmstate_register_ram_global (sram);memory_region_add_subregion (address_space_mem,AN5206_RAMBAR_ADDR , sram);
hw/m68k/dummy_m68k.c +1 -1
@@ -40,7 +40,7 @@ static void dummy_m68k_init(QEMUMachineInitArgs *args) env->vbr =0 ;/* RAM at address zero */ -memory_region_init_ram (ram,"dummy_m68k.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"dummy_m68k.ram" , ram_size);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0 , ram);
hw/m68k/mcf5206.c +1 -1
@@ -532,7 +532,7 @@ qemu_irq *mcf5206_init(MemoryRegion *sysmem, uint32_t base, M68kCPU *cpu) s = (m5206_mbar_state *)g_malloc0 (sizeof (m5206_mbar_state)); -memory_region_init_io (&s->iomem, &m5206_mbar_ops, s, +memory_region_init_io (&s->iomem,NULL , &m5206_mbar_ops, s,"mbar" ,0x00001000 );memory_region_add_subregion (sysmem, base, &s->iomem);
hw/m68k/mcf5208.c +4 -4
@@ -172,14 +172,14 @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)int i;/* SDRAMC. */ -memory_region_init_io (iomem, &m5208_sys_ops,NULL ,"m5208-sys" ,0x00004000 ); +memory_region_init_io (iomem,NULL , &m5208_sys_ops,NULL ,"m5208-sys" ,0x00004000 );memory_region_add_subregion (address_space,0xfc0a8000 , iomem);/* Timers. */ for (i =0 ; i <2 ; i++) { s = (m5208_timer_state *)g_malloc0 (sizeof (m5208_timer_state)); bh =qemu_bh_new (m5208_timer_trigger, s); s->timer =ptimer_init (bh); -memory_region_init_io (&s->iomem, &m5208_timer_ops, s, +memory_region_init_io (&s->iomem,NULL , &m5208_timer_ops, s,"m5208-timer" ,0x00004000 );memory_region_add_subregion (address_space,0xfc080000 +0x4000 * i, &s->iomem);
@@ -217,12 +217,12 @@ static void mcf5208evb_init(QEMUMachineInitArgs *args)/* TODO: Configure BARs. */ /* DRAM at 0x40000000 */ -memory_region_init_ram (ram,"mcf5208.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mcf5208.ram" , ram_size);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0x40000000 , ram);/* Internal SRAM. */ -memory_region_init_ram (sram,"mcf5208.sram" ,16384 ); +memory_region_init_ram (sram,NULL ,"mcf5208.sram" ,16384 );vmstate_register_ram_global (sram);memory_region_add_subregion (address_space_mem,0x80000000 , sram);
hw/m68k/mcf_intc.c +1 -1
@@ -147,7 +147,7 @@ qemu_irq *mcf_intc_init(MemoryRegion *sysmem, s->cpu = cpu;mcf_intc_reset (s); -memory_region_init_io (&s->iomem, &mcf_intc_ops, s,"mcf" ,0x100 ); +memory_region_init_io (&s->iomem,NULL , &mcf_intc_ops, s,"mcf" ,0x100 );memory_region_add_subregion (sysmem, base, &s->iomem);return qemu_allocate_irqs (mcf_intc_set_irq, s,64 );
hw/microblaze/petalogix_ml605_mmu.c +2 -2
@@ -98,12 +98,12 @@ petalogix_ml605_init(QEMUMachineInitArgs *args) env = &cpu->env;/* Attach emulated BRAM through the LMB. */ -memory_region_init_ram (phys_lmb_bram,"petalogix_ml605.lmb_bram" , +memory_region_init_ram (phys_lmb_bram,NULL ,"petalogix_ml605.lmb_bram" ,LMB_BRAM_SIZE );vmstate_register_ram_global (phys_lmb_bram);memory_region_add_subregion (address_space_mem,0x00000000 , phys_lmb_bram); -memory_region_init_ram (phys_ram,"petalogix_ml605.ram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"petalogix_ml605.ram" , ram_size);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (address_space_mem, ddr_base, phys_ram);
hw/microblaze/petalogix_s3adsp1800_mmu.c +2 -2
@@ -80,12 +80,12 @@ petalogix_s3adsp1800_init(QEMUMachineInitArgs *args) env = &cpu->env;/* Attach emulated BRAM through the LMB. */ -memory_region_init_ram (phys_lmb_bram, +memory_region_init_ram (phys_lmb_bram,NULL ,"petalogix_s3adsp1800.lmb_bram" ,LMB_BRAM_SIZE );vmstate_register_ram_global (phys_lmb_bram);memory_region_add_subregion (sysmem,0x00000000 , phys_lmb_bram); -memory_region_init_ram (phys_ram,"petalogix_s3adsp1800.ram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"petalogix_s3adsp1800.ram" , ram_size);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (sysmem, ddr_base, phys_ram);
hw/mips/gt64xxx_pci.c +1 -1
@@ -1108,7 +1108,7 @@ PCIBus *gt64120_register(qemu_irq *pic)get_system_memory (),get_system_io (), PCI_DEVFN(18, 0), 4, TYPE_PCI_BUS); -memory_region_init_io (&d->ISD_mem, &isd_mem_ops, d,"isd-mem" ,0x1000 ); +memory_region_init_io (&d->ISD_mem,NULL , &isd_mem_ops, d,"isd-mem" ,0x1000 );pci_create_simple (phb->bus,PCI_DEVFN (0 ,0 ),"gt64120_pci" );return phb->bus;
hw/mips/mips_fulong2e.c +2 -2
@@ -300,9 +300,9 @@ static void mips_fulong2e_init(QEMUMachineInitArgs *args) bios_size =1024 *1024 ;/* allocate RAM */ -memory_region_init_ram (ram,"fulong2e.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"fulong2e.ram" , ram_size);vmstate_register_ram_global (ram); -memory_region_init_ram (bios,"fulong2e.bios" , bios_size); +memory_region_init_ram (bios,NULL ,"fulong2e.bios" , bios_size);vmstate_register_ram_global (bios);memory_region_set_readonly (bios, true);
hw/mips/mips_jazz.c +6 -6
@@ -152,14 +152,14 @@ static void mips_jazz_init(MemoryRegion *address_space,qemu_register_reset (main_cpu_reset, cpu);/* allocate RAM */ -memory_region_init_ram (ram,"mips_jazz.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mips_jazz.ram" , ram_size);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space,0 , ram); -memory_region_init_ram (bios,"mips_jazz.bios" ,MAGNUM_BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"mips_jazz.bios" ,MAGNUM_BIOS_SIZE );vmstate_register_ram_global (bios);memory_region_set_readonly (bios, true); -memory_region_init_alias (bios2,"mips_jazz.bios" , bios, +memory_region_init_alias (bios2,NULL ,"mips_jazz.bios" , bios,0 ,MAGNUM_BIOS_SIZE );memory_region_add_subregion (address_space,0x1fc00000LL , bios);memory_region_add_subregion (address_space,0xfff00000LL , bios2);
@@ -188,7 +188,7 @@ static void mips_jazz_init(MemoryRegion *address_space,/* Chipset */ rc4030_opaque =rc4030_init (env->irq[6 ], env->irq[3 ], &rc4030, &dmas, address_space); -memory_region_init_io (dma_dummy, &dma_dummy_ops,NULL ,"dummy_dma" ,0x1000 ); +memory_region_init_io (dma_dummy,NULL , &dma_dummy_ops,NULL ,"dummy_dma" ,0x1000 );memory_region_add_subregion (address_space,0x8000d000 , dma_dummy);/* ISA devices */
@@ -216,7 +216,7 @@ static void mips_jazz_init(MemoryRegion *address_space, {/* Simple ROM, so user doesn't have to provide one */ MemoryRegion *rom_mr =g_new (MemoryRegion,1 ); -memory_region_init_ram (rom_mr,"g364fb.rom" ,0x80000 ); +memory_region_init_ram (rom_mr,NULL ,"g364fb.rom" ,0x80000 );vmstate_register_ram_global (rom_mr);memory_region_set_readonly (rom_mr, true);uint8_t *rom =memory_region_get_ram_ptr (rom_mr);
@@ -266,7 +266,7 @@ static void mips_jazz_init(MemoryRegion *address_space,/* Real time clock */ rtc_init (isa_bus,1980 ,NULL ); -memory_region_init_io (rtc, &rtc_ops,NULL ,"rtc" ,0x1000 ); +memory_region_init_io (rtc,NULL , &rtc_ops,NULL ,"rtc" ,0x1000 );memory_region_add_subregion (address_space,0x80004000 , rtc);/* Keyboard (i8042) */
hw/mips/mips_malta.c +5 -5
@@ -446,11 +446,11 @@ static MaltaFPGAState *malta_fpga_init(MemoryRegion *address_space, s = (MaltaFPGAState *)g_malloc0 (sizeof (MaltaFPGAState)); -memory_region_init_io (&s->iomem, &malta_fpga_ops, s, +memory_region_init_io (&s->iomem,NULL , &malta_fpga_ops, s,"malta-fpga" ,0x100000 ); -memory_region_init_alias (&s->iomem_lo,"malta-fpga" , +memory_region_init_alias (&s->iomem_lo,NULL ,"malta-fpga" , &s->iomem,0 ,0x900 ); -memory_region_init_alias (&s->iomem_hi,"malta-fpga" , +memory_region_init_alias (&s->iomem_hi,NULL ,"malta-fpga" , &s->iomem,0xa00 ,0x10000 -0xa00 );memory_region_add_subregion (address_space, base, &s->iomem_lo);
@@ -853,7 +853,7 @@ void mips_malta_init(QEMUMachineInitArgs *args) ((unsigned int)ram_size / (1 << 20)));exit (1 ); } -memory_region_init_ram (ram,"mips_malta.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mips_malta.ram" , ram_size);vmstate_register_ram_global (ram);memory_region_add_subregion (system_memory,0 , ram);
@@ -927,7 +927,7 @@ void mips_malta_init(QEMUMachineInitArgs *args) }/* Map the BIOS at a 2nd physical location, as on the real board. */ -memory_region_init_alias (bios_alias,"bios.1fc" , bios,0 ,BIOS_SIZE ); +memory_region_init_alias (bios_alias,NULL ,"bios.1fc" , bios,0 ,BIOS_SIZE );memory_region_add_subregion (system_memory,RESET_ADDRESS , bios_alias);/* Board ID = 0x420 (Malta Board with CoreLV)
hw/mips/mips_mipssim.c +2 -2
@@ -168,9 +168,9 @@ mips_mipssim_init(QEMUMachineInitArgs *args)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate RAM. */ -memory_region_init_ram (ram,"mips_mipssim.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mips_mipssim.ram" , ram_size);vmstate_register_ram_global (ram); -memory_region_init_ram (bios,"mips_mipssim.bios" ,BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"mips_mipssim.bios" ,BIOS_SIZE );vmstate_register_ram_global (bios);memory_region_set_readonly (bios, true);
hw/mips/mips_r4k.c +3 -3
@@ -202,12 +202,12 @@ void mips_r4k_init(QEMUMachineInitArgs *args) ((unsigned int)ram_size / (1 << 20)));exit (1 ); } -memory_region_init_ram (ram,"mips_r4k.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mips_r4k.ram" , ram_size);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0 , ram); -memory_region_init_io (iomem, &mips_qemu_ops,NULL ,"mips-qemu" ,0x10000 ); +memory_region_init_io (iomem,NULL , &mips_qemu_ops,NULL ,"mips-qemu" ,0x10000 );memory_region_add_subregion (address_space_mem,0x1fbf0000 , iomem);/* Try to load a BIOS image. If this fails, we continue regardless,
@@ -229,7 +229,7 @@ void mips_r4k_init(QEMUMachineInitArgs *args)#endif if ((bios_size >0 ) && (bios_size <=BIOS_SIZE )) { bios =g_new (MemoryRegion,1 ); -memory_region_init_ram (bios,"mips_r4k.bios" ,BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"mips_r4k.bios" ,BIOS_SIZE );vmstate_register_ram_global (bios);memory_region_set_readonly (bios, true);memory_region_add_subregion (get_system_memory (),0x1fc00000 , bios);
hw/misc/a9scu.c +1 -1
@@ -119,7 +119,7 @@ static void a9_scu_realize(DeviceState *dev, Error ** errp)A9SCUState *s =A9_SCU (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); -memory_region_init_io (&s->iomem, &a9_scu_ops, s,"a9-scu" ,0x100 ); +memory_region_init_io (&s->iomem,NULL , &a9_scu_ops, s,"a9-scu" ,0x100 );sysbus_init_mmio (sbd, &s->iomem); }
hw/misc/applesmc.c +2 -2
@@ -230,12 +230,12 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp) {AppleSMCState *s =APPLE_SMC (dev); -memory_region_init_io (&s->io_data, &applesmc_data_io_ops, s, +memory_region_init_io (&s->io_data,NULL , &applesmc_data_io_ops, s,"applesmc-data" ,4 );isa_register_ioport (&s->parent_obj, &s->io_data, s->iobase +APPLESMC_DATA_PORT ); -memory_region_init_io (&s->io_cmd, &applesmc_cmd_io_ops, s, +memory_region_init_io (&s->io_cmd,NULL , &applesmc_cmd_io_ops, s,"applesmc-cmd" ,4 );isa_register_ioport (&s->parent_obj, &s->io_cmd, s->iobase +APPLESMC_CMD_PORT );
hw/misc/arm_l2x0.c +1 -1
@@ -157,7 +157,7 @@ static int l2x0_priv_init(SysBusDevice *dev) {l2x0_state *s =FROM_SYSBUS (l2x0_state, dev); -memory_region_init_io (&s->iomem, &l2x0_mem_ops, s,"l2x0_cc" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &l2x0_mem_ops, s,"l2x0_cc" ,0x1000 );sysbus_init_mmio (dev, &s->iomem);return 0 ; }
hw/misc/arm_sysctl.c +1 -1
@@ -589,7 +589,7 @@ static void arm_sysctl_init(Object *obj)SysBusDevice *sd =SYS_BUS_DEVICE (obj);arm_sysctl_state *s =FROM_SYSBUS (arm_sysctl_state, sd); -memory_region_init_io (&s->iomem, &arm_sysctl_ops, s,"arm-sysctl" ,0x1000 ); +memory_region_init_io (&s->iomem,NULL , &arm_sysctl_ops, s,"arm-sysctl" ,0x1000 );sysbus_init_mmio (sd, &s->iomem);qdev_init_gpio_in (dev, arm_sysctl_gpio_set,2 );qdev_init_gpio_out (dev, &s->pl110_mux_ctrl,1 );
hw/misc/debugexit.c +1 -1
@@ -40,7 +40,7 @@ static void debug_exit_realizefn(DeviceState *d, Error **errp)ISADevice *dev =ISA_DEVICE (d);ISADebugExitState *isa =ISA_DEBUG_EXIT_DEVICE (d); -memory_region_init_io (&isa->io, &debug_exit_ops, isa, +memory_region_init_io (&isa->io,NULL , &debug_exit_ops, isa,TYPE_ISA_DEBUG_EXIT_DEVICE , isa->iosize);memory_region_add_subregion (isa_address_space_io (dev), isa->iobase, &isa->io);
hw/misc/eccmemctl.c +2 -2
@@ -296,11 +296,11 @@ static int ecc_init1(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); s->regs[0 ] = s->version; -memory_region_init_io (&s->iomem, &ecc_mem_ops, s,"ecc" ,ECC_SIZE ); +memory_region_init_io (&s->iomem,NULL , &ecc_mem_ops, s,"ecc" ,ECC_SIZE );sysbus_init_mmio (dev, &s->iomem);if (s->version ==ECC_MCC ) {// SS-600MP only -memory_region_init_io (&s->iomem_diag, &ecc_diag_mem_ops, s, +memory_region_init_io (&s->iomem_diag,NULL , &ecc_diag_mem_ops, s,"ecc.diag" ,ECC_DIAG_SIZE );sysbus_init_mmio (dev, &s->iomem_diag); }
hw/misc/exynos4210_pmu.c +1 -1
@@ -458,7 +458,7 @@ static int exynos4210_pmu_init(SysBusDevice *dev)Exynos4210PmuState *s =FROM_SYSBUS (Exynos4210PmuState, dev);/* memory mapping */ -memory_region_init_io (&s->iomem, &exynos4210_pmu_ops, s,"exynos4210.pmu" , +memory_region_init_io (&s->iomem,NULL , &exynos4210_pmu_ops, s,"exynos4210.pmu" ,EXYNOS4210_PMU_REGS_MEM_SIZE );sysbus_init_mmio (dev, &s->iomem);return 0 ;
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.1.4
Part of the diff is not shown here. View the raw message.
Re: [Qemu-devel] [PATCH v2 01/11] memory: add owner argument to initialization functions
Am 28.06.2013 18:58, schrieb Paolo Bonzini:
Quoted 1 line
Signed-off-by Paolo Bonzini <[email protected]>
Since the ppc-next merge, something like the attached is necessary for iommu-for-anythony branch to apply to master.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
hw/intc/openpic.c +0 -0
@@@ -1527,17 -1526,9 +1527,17 @@@ static void map_list(OpenPICState *opp } } -static int openpic_init(SysBusDevice *dev) +static void openpic_init(Object *obj) { - OpenPICState *opp =FROM_SYSBUS (typeof (*opp), dev); + OpenPICState *opp =OPENPIC (obj); + -memory_region_init (&opp->mem,"openpic" ,0x40000 ); ++memory_region_init (&opp->mem,NULL ,"openpic" ,0x40000 ); +} + +static void openpic_realize(DeviceState *dev, Error **errp) +{ + SysBusDevice *d =SYS_BUS_DEVICE (dev); + OpenPICState *opp =OPENPIC (dev);int i, j;int list_count =0 ; static const MemReg list_le[] = {
hw/ppc/mac_newworld.c +0 -0
@@@ -289,13 -279,10 +289,13 @@@ static void ppc_core99_init(QEMUMachine/* Register 8 MB of ISA IO space */ isa_mmio_init (0xf2000000 ,0x00800000 ); -/* UniN init */ -memory_region_init_io (unin_memory,NULL , &unin_ops,NULL ,"unin" ,0x1000 ); +/* UniN init: XXX should be a real device */ -memory_region_init_io (unin_memory, &unin_ops, token,"unin" ,0x1000 ); ++memory_region_init_io (unin_memory,NULL , &unin_ops, token,"unin" ,0x1000 );memory_region_add_subregion (get_system_memory (),0xf8000000 , unin_memory); -memory_region_init_io (unin2_memory, &unin_ops, token,"unin" ,0x1000 ); ++memory_region_init_io (unin2_memory,NULL , &unin_ops, token,"unin" ,0x1000 ); +memory_region_add_subregion (get_system_memory (),0xf3000000 , unin2_memory); + openpic_irqs =g_malloc0 (smp_cpus *sizeof (qemu_irq *)); openpic_irqs[0 ] =g_malloc0 (smp_cpus *sizeof (qemu_irq) *OPENPIC_OUTPUT_NB );
hw/ppc/mpc8544_guts.c +0 -0
@@@ -114,14 -108,24 +114,14 @@@ static const MemoryRegionOps mpc8544_gu }, }; -static int mpc8544_guts_initfn(SysBusDevice *dev) +static void mpc8544_guts_initfn(Object *obj) { - GutsState *s; - - s =FROM_SYSBUS (GutsState,SYS_BUS_DEVICE (dev)); + SysBusDevice *d =SYS_BUS_DEVICE (obj); + GutsState *s =MPC8544_GUTS (obj); -memory_region_init_io (&s->iomem, &mpc8544_guts_ops, s, +memory_region_init_io (&s->iomem,NULL , &mpc8544_guts_ops, s, -"mpc6544.guts" ,MPC8544_GUTS_MMIO_SIZE ); -sysbus_init_mmio (dev, &s->iomem); - - return 0; -} - -static void mpc8544_guts_class_init(ObjectClass *klass, void *data) -{ - SysBusDeviceClass *k =SYS_BUS_DEVICE_CLASS (klass); - - k->init = mpc8544_guts_initfn; + "mpc8544.guts", MPC8544_GUTS_MMIO_SIZE); +sysbus_init_mmio (d, &s->iomem); }static const TypeInfo mpc8544_guts_info = {
hw/misc/macio/macio.c +3 -3
@@ -104,11 +104,11 @@ static void macio_escc_legacy_setup(MacIOState *macio_state)0xF0 ,0xE0 , }; -memory_region_init (escc_legacy,"escc-legacy" ,256 ); +memory_region_init (escc_legacy,NULL ,"escc-legacy" ,256 );for (i =0 ; i <ARRAY_SIZE (maps); i +=2 ) {MemoryRegion *port =g_new (MemoryRegion,1 ); -memory_region_init_alias (port,"escc-legacy-port" , macio_state->escc_mem, - maps[i+1 ],0x2 ); +memory_region_init_alias (port,NULL ,"escc-legacy-port" , + macio_state->escc_mem, maps[i +1 ],0x2 );memory_region_add_subregion (escc_legacy, maps[i], port); }
Re: [Qemu-devel] [PATCH v2 01/11] memory: add owner argument to initialization functions
Am 02.07.2013 01:16, schrieb Andreas Färber:
Quoted 5 lines
Am 28.06.2013 18:58, schrieb Paolo Bonzini:
Quoted 1 line
Signed-off-by Paolo Bonzini <[email protected]>Since the ppc-next merge, something like the attached is necessary for iommu-for-anythony branch to apply to master.
Add to that the ppc KVM-only:
hw/intc/openpic_kvm.c +1 -1
@@ -155,7 +155,7 @@ static void kvm_openpic_init(Object *obj) {KVMOpenPICState *opp =KVM_OPENPIC (obj); -memory_region_init_io (&opp->mem, &kvm_openpic_mem_ops, opp, +memory_region_init_io (&opp->mem,NULL , &kvm_openpic_mem_ops, opp,"kvm-openpic" ,0x40000 ); }
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
PATCH v2 2/11 memory: destroy phys_sections one by one
In reply to Paolo Bonziniphys_sections_clear is invoked after the dispatch tree has been destroyed. This leaves a window where phys_sections_nb > 0 but the subpages are not valid anymore, which is a recipe for use-after-free bugs.
Move the destruction of subpages in phys_sections_clear.
--- exec.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
exec.c +13 -14
@@ -762,17 +762,6 @@ hwaddr memory_region_section_get_iotlb(CPUArchState *env,static int subpage_register (subpage_t *mmio,uint32_t start,uint32_t end,uint16_t section);static subpage_t *subpage_init (AddressSpace *as,hwaddr base); -static void destroy_page_desc (uint16_t section_index) -{ -MemoryRegionSection *section = &phys_sections[section_index]; -MemoryRegion *mr = section->mr; - -if (mr->subpage) { -subpage_t *subpage =container_of (mr, subpage_t, iomem); -memory_region_destroy (&subpage->iomem); -g_free (subpage); - } -}static void destroy_l2_mapping (PhysPageEntry *lp,unsigned level) {
@@ -787,8 +776,6 @@ static void destroy_l2_mapping(PhysPageEntry *lp, unsigned level)for (i =0 ; i <L2_SIZE ; ++i) {if (!p[i].is_leaf) {destroy_l2_mapping (&p[i], level -1 ); - }else { -destroy_page_desc (p[i].ptr); } } lp->is_leaf =0 ;
@@ -818,9 +805,21 @@ static uint16_t phys_section_add(MemoryRegionSection *section)return phys_sections_nb++; } +static void phys_section_destroy (MemoryRegion *mr) +{ +if (mr->subpage) { +subpage_t *subpage =container_of (mr, subpage_t, iomem); +memory_region_destroy (&subpage->iomem); +g_free (subpage); + } +} +static void phys_sections_clear (void ) { - phys_sections_nb =0 ; +while (phys_sections_nb >0 ) { +MemoryRegionSection *section = &phys_sections[--phys_sections_nb]; +phys_section_destroy (section->mr); + } }static void register_subpage (AddressSpaceDispatch *d,MemoryRegionSection *section)
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 02/11] memory: destroy phys_sections one by one
Quoted 2 lines · Paolo Bonzini
phys_sections_clearis invoked after the dispatch tree has been destroyed.
You mean destroy_all_mappings called by mem_begin vs. phys_sections_clear called by core_begin, right?
Quoted 5 lines
This leaves a window where
phys_sections_nb> 0 but the
subpages are not valid anymore, which is a recipe for use-after-free bugs.Move the destruction of subpages in
phys_sections_clear.
What ensures that we still destroy the subpages when an address space is cleaned up (address_space_destroy_dispatch)? The fact that an address space has to be / is de facto empty when destroying it? That question also applies on the next patch.
Jan
Quoted 61 lines
Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)exec.c +13
-14@@ -762,17 +762,6 @@ hwaddr memory_region_section_get_iotlb(CPUArchState *env,static int subpage_register (subpage_t *mmio,uint32_t start,uint32_t end,uint16_t section);static subpage_t *subpage_init (AddressSpace *as,hwaddr base); -static void destroy_page_desc (uint16_t section_index) -{ -MemoryRegionSection *section = &phys_sections[section_index]; -MemoryRegion *mr = section->mr; - -if (mr->subpage) { -subpage_t *subpage =container_of (mr, subpage_t, iomem); -memory_region_destroy (&subpage->iomem); -g_free (subpage); - } -}static void destroy_l2_mapping (PhysPageEntry *lp,unsigned level) {@@ -787,8 +776,6 @@ static void destroy_l2_mapping(PhysPageEntry *lp, unsigned level)for (i =0 ; i <L2_SIZE ; ++i) {if (!p[i].is_leaf) {destroy_l2_mapping (&p[i], level -1 ); - }else { -destroy_page_desc (p[i].ptr); } } lp->is_leaf =0 ;@@ -818,9 +805,21 @@ static uint16_t phys_section_add(MemoryRegionSection *section)return phys_sections_nb++; } +static void phys_section_destroy (MemoryRegion *mr) +{ +if (mr->subpage) { +subpage_t *subpage =container_of (mr, subpage_t, iomem); +memory_region_destroy (&subpage->iomem); +g_free (subpage); + } +} +static void phys_sections_clear (void ) { - phys_sections_nb =0 ; +while (phys_sections_nb >0 ) { +MemoryRegionSection *section = &phys_sections[--phys_sections_nb]; +phys_section_destroy (section->mr); + } }static void register_subpage (AddressSpaceDispatch *d,MemoryRegionSection *section)
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 02/11] memory: destroy phys_sections one by one
Il 01/07/2013 16:14, Jan Kiszka ha scritto:
Quoted 11 lines · Paolo Bonzini
Quoted 2 lines
phys_sections_clearis invoked after the dispatch tree has been destroyed.You mean
destroy_all_mappingscalled bymem_beginvs.phys_sections_clearcalled bycore_begin, right?Quoted 4 lines
This leaves a window where
phys_sections_nb> 0 but the
subpages are not valid anymore, which is a recipe for use-after-free bugs.
Quoted 5 lines
Quoted 1 line
Move the destruction of subpages in
phys_sections_clear.What ensures that we still destroy the subpages when an address space is cleaned up (
address_space_destroy_dispatch)? The fact that an address space has to be / is de facto empty when destroying it?
Yes, the address space is emptied at destruction time. See
memory_region_transaction_begin();
as->root = NULL;
memory_region_transaction_commit();in address_space_destroy.
Paolo
Quoted 64 lines
Jan
Quoted 61 lines
Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)exec.c +13
-14@@ -762,17 +762,6 @@ hwaddr memory_region_section_get_iotlb(CPUArchState *env,static int subpage_register (subpage_t *mmio,uint32_t start,uint32_t end,uint16_t section);static subpage_t *subpage_init (AddressSpace *as,hwaddr base); -static void destroy_page_desc (uint16_t section_index) -{ -MemoryRegionSection *section = &phys_sections[section_index]; -MemoryRegion *mr = section->mr; - -if (mr->subpage) { -subpage_t *subpage =container_of (mr, subpage_t, iomem); -memory_region_destroy (&subpage->iomem); -g_free (subpage); - } -}static void destroy_l2_mapping (PhysPageEntry *lp,unsigned level) {@@ -787,8 +776,6 @@ static void destroy_l2_mapping(PhysPageEntry *lp, unsigned level)for (i =0 ; i <L2_SIZE ; ++i) {if (!p[i].is_leaf) {destroy_l2_mapping (&p[i], level -1 ); - }else { -destroy_page_desc (p[i].ptr); } } lp->is_leaf =0 ;@@ -818,9 +805,21 @@ static uint16_t phys_section_add(MemoryRegionSection *section)return phys_sections_nb++; } +static void phys_section_destroy (MemoryRegion *mr) +{ +if (mr->subpage) { +subpage_t *subpage =container_of (mr, subpage_t, iomem); +memory_region_destroy (&subpage->iomem); +g_free (subpage); + } +} +static void phys_sections_clear (void ) { - phys_sections_nb =0 ; +while (phys_sections_nb >0 ) { +MemoryRegionSection *section = &phys_sections[--phys_sections_nb]; +phys_section_destroy (section->mr); + } }static void register_subpage (AddressSpaceDispatch *d,MemoryRegionSection *section)
PATCH v2 3/11 exec: simplify destruction of the phys map
In reply to Paolo BonziniDo not bother visiting the radix tree when an address space is destroyed.
--- exec.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-)
exec.c +1 -33
@@ -154,12 +154,6 @@ static uint16_t phys_map_node_alloc(void)return ret; } -static void phys_map_nodes_reset (void ) -{ - phys_map_nodes_nb =0 ; -} - -static void phys_page_set_level (PhysPageEntry *lp,hwaddr *index,hwaddr *nb,uint16_t leaf,int level)
@@ -763,31 +757,6 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end, uint16_t section);static subpage_t *subpage_init (AddressSpace *as,hwaddr base); -static void destroy_l2_mapping (PhysPageEntry *lp,unsigned level) -{ -unsigned i; -PhysPageEntry *p; - -if (lp->ptr ==PHYS_MAP_NODE_NIL ) { -return ; - } - - p = phys_map_nodes[lp->ptr]; -for (i =0 ; i <L2_SIZE ; ++i) { -if (!p[i].is_leaf) { -destroy_l2_mapping (&p[i], level -1 ); - } - } - lp->is_leaf =0 ; - lp->ptr =PHYS_MAP_NODE_NIL ; -} - -static void destroy_all_mappings (AddressSpaceDispatch *d) -{ -destroy_l2_mapping (&d->phys_map,P_L2_LEVELS -1 ); -phys_map_nodes_reset (); -} -static uint16_t phys_section_add (MemoryRegionSection *section) {/* The physical section number is ORed with a page-aligned
@@ -820,6 +789,7 @@ static void phys_sections_clear(void)MemoryRegionSection *section = &phys_sections[--phys_sections_nb];phys_section_destroy (section->mr); } + phys_map_nodes_nb =0 ; }static void register_subpage (AddressSpaceDispatch *d,MemoryRegionSection *section)
@@ -1724,7 +1694,6 @@ static void mem_begin(MemoryListener *listener) {AddressSpaceDispatch *d =container_of (listener, AddressSpaceDispatch, listener); -destroy_all_mappings (d); d->phys_map.ptr =PHYS_MAP_NODE_NIL ; }
@@ -1791,7 +1760,6 @@ void address_space_destroy_dispatch(AddressSpace *as)AddressSpaceDispatch *d = as->dispatch;memory_listener_unregister (&d->listener); -destroy_l2_mapping (&d->phys_map,P_L2_LEVELS -1 );g_free (d); as->dispatch =NULL ; }
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 03/11] exec: simplify destruction of the phys map
Quoted 1 line · Paolo Bonzini
Do not bother visiting the radix tree when an address space is destroyed.
The "because" is missing, see my comment on the previous patch. If you can clarify this, the rest is fine.
Jan
Quoted 80 lines
Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-)exec.c +1
-33@@ -154,12 +154,6 @@ static uint16_t phys_map_node_alloc(void)return ret; } -static void phys_map_nodes_reset (void ) -{ - phys_map_nodes_nb =0 ; -} - -static void phys_page_set_level (PhysPageEntry *lp,hwaddr *index,hwaddr *nb,uint16_t leaf,int level)@@ -763,31 +757,6 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end, uint16_t section);static subpage_t *subpage_init (AddressSpace *as,hwaddr base); -static void destroy_l2_mapping (PhysPageEntry *lp,unsigned level) -{ -unsigned i; -PhysPageEntry *p; - -if (lp->ptr ==PHYS_MAP_NODE_NIL ) { -return ; - } - - p = phys_map_nodes[lp->ptr]; -for (i =0 ; i <L2_SIZE ; ++i) { -if (!p[i].is_leaf) { -destroy_l2_mapping (&p[i], level -1 ); - } - } - lp->is_leaf =0 ; - lp->ptr =PHYS_MAP_NODE_NIL ; -} - -static void destroy_all_mappings (AddressSpaceDispatch *d) -{ -destroy_l2_mapping (&d->phys_map,P_L2_LEVELS -1 ); -phys_map_nodes_reset (); -} -static uint16_t phys_section_add (MemoryRegionSection *section) {/* The physical section number is ORed with a page-aligned @@ -820,6 +789,7 @@ static void phys_sections_clear(void)MemoryRegionSection *section = &phys_sections[--phys_sections_nb];phys_section_destroy (section->mr); } + phys_map_nodes_nb =0 ; }static void register_subpage (AddressSpaceDispatch *d,MemoryRegionSection *section)@@ -1724,7 +1694,6 @@ static void mem_begin(MemoryListener *listener) {AddressSpaceDispatch *d =container_of (listener, AddressSpaceDispatch, listener); -destroy_all_mappings (d); d->phys_map.ptr =PHYS_MAP_NODE_NIL ; }@@ -1791,7 +1760,6 @@ void address_space_destroy_dispatch(AddressSpace *as)AddressSpaceDispatch *d = as->dispatch;memory_listener_unregister (&d->listener); -destroy_l2_mapping (&d->phys_map,P_L2_LEVELS -1 );g_free (d); as->dispatch =NULL ; }
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 03/11] exec: simplify destruction of the phys map
Il 01/07/2013 16:23, Jan Kiszka ha scritto:
Quoted 5 lines · Paolo Bonzini
Quoted 1 line
Do not bother visiting the radix tree when an address space is destroyed.
The "because" is missing, see my comment on the previous patch. If you can clarify this, the rest is fine.
After the previous patch, the "because" is that this is has become a pointless exercise: all you're doing is zeroing out a structure that will be freed as soon as you come back.
I'll add the justification to both patches.
Paolo
Quoted 83 lines
Jan
Quoted 80 lines
Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-)exec.c +1
-33@@ -154,12 +154,6 @@ static uint16_t phys_map_node_alloc(void)return ret; } -static void phys_map_nodes_reset (void ) -{ - phys_map_nodes_nb =0 ; -} - -static void phys_page_set_level (PhysPageEntry *lp,hwaddr *index,hwaddr *nb,uint16_t leaf,int level)@@ -763,31 +757,6 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end, uint16_t section);static subpage_t *subpage_init (AddressSpace *as,hwaddr base); -static void destroy_l2_mapping (PhysPageEntry *lp,unsigned level) -{ -unsigned i; -PhysPageEntry *p; - -if (lp->ptr ==PHYS_MAP_NODE_NIL ) { -return ; - } - - p = phys_map_nodes[lp->ptr]; -for (i =0 ; i <L2_SIZE ; ++i) { -if (!p[i].is_leaf) { -destroy_l2_mapping (&p[i], level -1 ); - } - } - lp->is_leaf =0 ; - lp->ptr =PHYS_MAP_NODE_NIL ; -} - -static void destroy_all_mappings (AddressSpaceDispatch *d) -{ -destroy_l2_mapping (&d->phys_map,P_L2_LEVELS -1 ); -phys_map_nodes_reset (); -} -static uint16_t phys_section_add (MemoryRegionSection *section) {/* The physical section number is ORed with a page-aligned @@ -820,6 +789,7 @@ static void phys_sections_clear(void)MemoryRegionSection *section = &phys_sections[--phys_sections_nb];phys_section_destroy (section->mr); } + phys_map_nodes_nb =0 ; }static void register_subpage (AddressSpaceDispatch *d,MemoryRegionSection *section)@@ -1724,7 +1694,6 @@ static void mem_begin(MemoryListener *listener) {AddressSpaceDispatch *d =container_of (listener, AddressSpaceDispatch, listener); -destroy_all_mappings (d); d->phys_map.ptr =PHYS_MAP_NODE_NIL ; }@@ -1791,7 +1760,6 @@ void address_space_destroy_dispatch(AddressSpace *as)AddressSpaceDispatch *d = as->dispatch;memory_listener_unregister (&d->listener); -destroy_l2_mapping (&d->phys_map,P_L2_LEVELS -1 );g_free (d); as->dispatch =NULL ; }
PATCH v2 4/11 memory: add getter for owner
In reply to Paolo BonziniWhenever memory regions are accessed outside the BQL, they need to be preserved against hot-unplug. MemoryRegions actually do not have their own reference count; they piggyback on a QOM object, their "owner". The owner is set at creation time, and there is a function to retrieve the owner.
--- include/exec/memory.h | 7 +++++++ memory.c | 6 ++++++ 2 files changed, 13 insertions(+)
include/exec/memory.h +7 -0
@@ -380,6 +380,13 @@ void memory_region_init_iommu(MemoryRegion *mr,void memory_region_destroy (MemoryRegion *mr);/** +* memory_region_owner: get a memory region's owner. +* +* @mr: the memory region being queried. +*/ +struct Object *memory_region_owner (MemoryRegion *mr); + +/** * memory_region_size: get a memory region's size. * * @mr: the memory region being queried.
memory.c +6 -0
@@ -738,6 +738,7 @@ void memory_region_init(MemoryRegion *mr, mr->owner = owner; mr->iommu_ops =NULL ; mr->parent =NULL ; + mr->owner =NULL ; mr->size =int128_make64 (size);if (size ==UINT64_MAX ) { mr->size =int128_2_64 ();
@@ -1011,6 +1012,11 @@ void memory_region_destroy(MemoryRegion *mr)g_free (mr->ioeventfds); } +Object *memory_region_owner (MemoryRegion *mr) +{ +return mr->owner; +} +uint64_t memory_region_size (MemoryRegion *mr) {if (int128_eq (mr->size,int128_2_64 ())) {
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 04/11] memory: add getter for owner
Quoted 45 lines · Paolo Bonzini
Whenever memory regions are accessed outside the BQL, they need to be preserved against hot-unplug. MemoryRegions actually do not have their own reference count; they piggyback on a QOM object, their "owner". The owner is set at creation time, and there is a function to retrieve the owner.
Signed-off-by Paolo Bonzini <[email protected]>--- include/exec/memory.h | 7 +++++++ memory.c | 6 ++++++ 2 files changed, 13 insertions(+)include/exec/memory.h +7
-0@@ -380,6 +380,13 @@ void memory_region_init_iommu(MemoryRegion *mr,void memory_region_destroy (MemoryRegion *mr);/** +* memory_region_owner: get a memory region's owner. +* +* @mr: the memory region being queried. +*/ +struct Object *memory_region_owner (MemoryRegion *mr); + +/** * memory_region_size: get a memory region's size. * * @mr: the memory region being queried. memory.c +1
-0@@ -738,6 +738,7 @@ void memory_region_init(MemoryRegion *mr, mr->owner = owner; mr->iommu_ops =NULL ; mr->parent =NULL ; + mr->owner =NULL ; mr->size =int128_make64 (size);if (size ==UINT64_MAX ) { mr->size =int128_2_64 ();@@ -1011,6 +1012,11 @@ void memory_region_destroy(MemoryRegion *mr)g_free (mr->ioeventfds);
memory.c void memory_region_destroy(MemoryRegion *mr) · line 1022
Quoted 10 lines
memory.c +5
-0} +Object *memory_region_owner (MemoryRegion *mr) +{ +return mr->owner; +} +uint64_t memory_region_size (MemoryRegion *mr) {if (int128_eq (mr->size,int128_2_64 ())) {
OK, fine... and who is using this? ;)
Also, as this is trivial and the structure publicly known anyway, I'd go for a static inline function instead.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 04/11] memory: add getter for owner
Il 01/07/2013 16:24, Jan Kiszka ha scritto:
Quoted 47 lines · Paolo Bonzini
Quoted 46 lines
Whenever memory regions are accessed outside the BQL, they need to be preserved against hot-unplug. MemoryRegions actually do not have their own reference count; they piggyback on a QOM object, their "owner". The owner is set at creation time, and there is a function to retrieve the owner.
Signed-off-by Paolo Bonzini <[email protected]>--- include/exec/memory.h | 7 +++++++ memory.c | 6 ++++++ 2 files changed, 13 insertions(+)include/exec/memory.h +7
-0@@ -380,6 +380,13 @@ void memory_region_init_iommu(MemoryRegion *mr,void memory_region_destroy (MemoryRegion *mr);/** +* memory_region_owner: get a memory region's owner. +* +* @mr: the memory region being queried. +*/ +struct Object *memory_region_owner (MemoryRegion *mr); + +/** * memory_region_size: get a memory region's size. * * @mr: the memory region being queried. memory.c +1
-0@@ -738,6 +738,7 @@ void memory_region_init(MemoryRegion *mr, mr->owner = owner; mr->iommu_ops =NULL ; mr->parent =NULL ; + mr->owner =NULL ; mr->size =int128_make64 (size);if (size ==UINT64_MAX ) { mr->size =int128_2_64 ();@@ -1011,6 +1012,11 @@ void memory_region_destroy(MemoryRegion *mr)g_free (mr->ioeventfds); }
Quoted 11 lines
memory.c void memory_region_destroy(MemoryRegion *mr) · line 1022
Quoted 9 lines
memory.c +5
-0+Object *memory_region_owner (MemoryRegion *mr) +{ +return mr->owner; +} +uint64_t memory_region_size (MemoryRegion *mr) {if (int128_eq (mr->size,int128_2_64 ())) {OK, fine... and who is using this? ;)
There'll be a couple users in hw/acpi/core.c.
Quoted 2 lines
Also, as this is trivial and the structure publicly known anyway, I'd go for a static inline function instead.
Ok. Though it's not a fast path anyway.
Paolo
PATCH v2 5/11 memory: add ref/unref
In reply to Paolo Bonzini--- include/exec/memory.h | 30 ++++++++++++++++++++++++++++++ memory.c | 14 ++++++++++++++ 2 files changed, 44 insertions(+)
include/exec/memory.h +30 -0
@@ -245,6 +245,36 @@ void memory_region_init(MemoryRegion *mr,struct Object *owner, const char *name, uint64_t size); + +/** +* memory_region_ref: Add 1 to a memory region's reference count +* +* Whenever memory regions are accessed outside the BQL, they need to be +* preserved against hot-unplug. MemoryRegions actually do not have their +* own reference count; they piggyback on a QOM object, their "owner". +* This function adds a reference to the owner. +* +* All MemoryRegions must have an owner if they can disappear, even if the +* device they belong to operates exclusively under the BQL. This is because +* the region could be returned at any time by memory_region_find, and this +* is usually under guest control. +* +* @mr: the #MemoryRegion +*/ +void memory_region_ref (MemoryRegion *mr); + +/** +* memory_region_unref: Remove 1 to a memory region's reference count +* +* Whenever memory regions are accessed outside the BQL, they need to be +* preserved against hot-unplug. MemoryRegions actually do not have their +* own reference count; they piggyback on a QOM object, their "owner". +* This function removes a reference to the owner and possibly destroys it. +* +* @mr: the #MemoryRegion +*/ +void memory_region_unref (MemoryRegion *mr); +/** * memory_region_init_io: Initialize an I/O memory region. *
memory.c +14 -0
@@ -1017,6 +1017,20 @@ Object *memory_region_owner(MemoryRegion *mr)return mr->owner; } +void memory_region_ref (MemoryRegion *mr) +{ +if (mr && mr->owner) { +object_ref (mr->owner); + } +} + +void memory_region_unref (MemoryRegion *mr) +{ +if (mr && mr->owner) { +object_unref (mr->owner); + } +} +uint64_t memory_region_size (MemoryRegion *mr) {if (int128_eq (mr->size,int128_2_64 ())) {
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 05/11] memory: add ref/unref
Quoted 63 lines · Paolo Bonzini
Signed-off-by Paolo Bonzini <[email protected]>--- include/exec/memory.h | 30 ++++++++++++++++++++++++++++++ memory.c | 14 ++++++++++++++ 2 files changed, 44 insertions(+)include/exec/memory.h +30
-0@@ -245,6 +245,36 @@ void memory_region_init(MemoryRegion *mr,struct Object *owner, const char *name, uint64_t size); + +/** +* memory_region_ref: Add 1 to a memory region's reference count +* +* Whenever memory regions are accessed outside the BQL, they need to be +* preserved against hot-unplug. MemoryRegions actually do not have their +* own reference count; they piggyback on a QOM object, their "owner". +* This function adds a reference to the owner. +* +* All MemoryRegions must have an owner if they can disappear, even if the +* device they belong to operates exclusively under the BQL. This is because +* the region could be returned at any time by memory_region_find, and this +* is usually under guest control. +* +* @mr: the #MemoryRegion +*/ +void memory_region_ref (MemoryRegion *mr); + +/** +* memory_region_unref: Remove 1 to a memory region's reference count +* +* Whenever memory regions are accessed outside the BQL, they need to be +* preserved against hot-unplug. MemoryRegions actually do not have their +* own reference count; they piggyback on a QOM object, their "owner". +* This function removes a reference to the owner and possibly destroys it. +* +* @mr: the #MemoryRegion +*/ +void memory_region_unref (MemoryRegion *mr); +/** * memory_region_init_io: Initialize an I/O memory region. * memory.c +7
-0@@ -1017,6 +1017,20 @@ Object *memory_region_owner(MemoryRegion *mr)return mr->owner; } +void memory_region_ref (MemoryRegion *mr) +{ +if (mr && mr->owner) { +object_ref (mr->owner); + } +} +
memory.c Object *memory_region_owner(MemoryRegion *mr) · line 1036
Quoted 10 lines
memory.c +7
-0+void memory_region_unref (MemoryRegion *mr) +{ +if (mr && mr->owner) { +object_unref (mr->owner); + } +} +uint64_t memory_region_size (MemoryRegion *mr) {if (int128_eq (mr->size,int128_2_64 ())) {
BTW, shouldn't object_ref/unref be converted to atomics / __sync_fetch_and_add/sub? I'm carrying a modified patch by Ping Fan for this here.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 05/11] memory: add ref/unref
Il 01/07/2013 16:29, Jan Kiszka ha scritto:
Quoted 5 lines
Reviewed-by Jan Kiszka <[email protected]>BTW, shouldn't object_ref/unref be converted to atomics / __sync_fetch_and_add/sub? I'm carrying a modified patch by Ping Fan for this here.
Yes, they should. Not necessarily _now_, but certainly before the RCU stuff I posted (which should include call_rcu-ification of the object_finalize call). If you send that patch I'll pick it up as well.
Paolo
PATCH v2 6/11 memory: add ref/unref calls
In reply to Paolo BonziniAdd ref/unref calls at the following places:
- places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM).
- memory_region_find callsites
- creation of aliases and containers (only the aliased/contained region gets a reference to avoid loops)
- around calls to del_subregion/add_subregion, where the region could disappear after the first call
--- exec.c | 3 +++ hw/core/loader.c | 1 + hw/display/exynos4210_fimd.c | 6 ++++++ hw/display/framebuffer.c | 12 +++++++----- hw/i386/kvmvapic.c | 1 + hw/misc/vfio.c | 2 ++ hw/virtio/dataplane/hostmem.c | 7 +++++++ hw/virtio/vhost.c | 2 ++ hw/virtio/virtio-balloon.c | 1 + hw/xen/xen_pt.c | 4 ++++ include/hw/virtio/dataplane/hostmem.h | 1 + kvm-all.c | 2 ++ memory.c | 20 ++++++++++++++++++++ target-arm/kvm.c | 2 ++ target-sparc/mmu_helper.c | 1 + xen-all.c | 2 ++ 16 files changed, 62 insertions(+), 5 deletions(-)
exec.c +3 -0
@@ -771,11 +771,14 @@ static uint16_t phys_section_add(MemoryRegionSection *section) phys_sections_nb_alloc); } phys_sections[phys_sections_nb] = *section; +memory_region_ref (section->mr);return phys_sections_nb++; }static void phys_section_destroy (MemoryRegion *mr) { +memory_region_unref (mr); +if (mr->subpage) {subpage_t *subpage =container_of (mr, subpage_t, iomem);memory_region_destroy (&subpage->iomem);
hw/core/loader.c +1 -0
@@ -727,6 +727,7 @@ int rom_load_all(void) addr += rom->romsize; section =memory_region_find (get_system_memory (), rom->addr,1 ); rom->isrom =int128_nz (section.size) &&memory_region_is_rom (section.mr); +memory_region_unref (section.mr); }qemu_register_reset (rom_reset,NULL ); roms_loaded =1 ;
hw/display/exynos4210_fimd.c +6 -0
@@ -1126,6 +1126,11 @@ static void fimd_update_memory_section(Exynos4210fimdState *s, unsigned win)/* Total number of bytes of virtual screen used by current window */ w->fb_len = fb_mapped_len = (w->virtpage_width + w->virtpage_offsize) * (w->rightbot_y - w->lefttop_y +1 ); + +/* TODO: add .exit and unref the region there. Not needed yet since sysbus +* does not support hot-unplug. +*/ +memory_region_unref (w->mem_section.mr); w->mem_section =memory_region_find (sysbus_address_space (&s->busdev), fb_start_addr, w->fb_len);assert (w->mem_section.mr);
@@ -1154,6 +1159,7 @@ static void fimd_update_memory_section(Exynos4210fimdState *s, unsigned win)return ; error_return: +memory_region_unref (w->mem_section.mr); w->mem_section.mr =NULL ; w->mem_section.size =int128_zero (); w->host_fb_addr =NULL ;
hw/display/framebuffer.c +7 -5
@@ -54,11 +54,11 @@ void framebuffer_update_display( src_len = src_width * rows; mem_section =memory_region_find (address_space, base, src_len); + mem = mem_section.mr;if (int128_get64 (mem_section.size) != src_len || !memory_region_is_ram (mem_section.mr)) { -return ; + goto out; } - mem = mem_section.mr;assert (mem);assert (mem_section.offset_within_address_space == base);
@@ -68,10 +68,10 @@ void framebuffer_update_display(but it's not really worth it as dirty flag tracking will probably already have failed above. */ if (!src_base) -return ; + goto out;if (src_len != src_width * rows) {cpu_physical_memory_unmap (src_base, src_len,0 ,0 ); -return ; + goto out; } src = src_base; dest =surface_data (ds);
@@ -102,10 +102,12 @@ void framebuffer_update_display( }cpu_physical_memory_unmap (src_base, src_len,0 ,0 );if (first <0 ) { -return ; + goto out; }memory_region_reset_dirty (mem, mem_section.offset_within_region, src_len,DIRTY_MEMORY_VGA ); *first_row = first; *last_row = last; +out: +memory_region_unref (mem); }
hw/i386/kvmvapic.c +1 -0
@@ -605,6 +605,7 @@ static void vapic_map_rom_writable(VAPICROMState *s) rom_size);memory_region_add_subregion_overlap (as, rom_paddr, &s->rom,1000 ); s->rom_mapped_writable = true; +memory_region_unref (section.mr); }static int vapic_prepare (VAPICROMState *s)
hw/misc/vfio.c +2 -0
@@ -1969,6 +1969,7 @@ static void vfio_listener_region_add(MemoryListener *listener,DPRINTF ("region_add %" HWADDR_PRIx" - %" HWADDR_PRIx" [%p]\n" , iova, end -1 , vaddr); +memory_region_ref (section->mr); ret =vfio_dma_map (container, iova, end - iova, vaddr, section->readonly);if (ret) { error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
@@ -2010,6 +2011,7 @@ static void vfio_listener_region_del(MemoryListener *listener, iova, end - 1); ret =vfio_dma_unmap (container, iova, end - iova); +memory_region_unref (section->mr);if (ret) { error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx") = %d (%m)",
hw/virtio/dataplane/hostmem.c +7 -0
@@ -64,8 +64,12 @@ out:static void hostmem_listener_commit (MemoryListener *listener) {HostMem *hostmem =container_of (listener, HostMem, listener); +int i;qemu_mutex_lock (&hostmem->current_regions_lock); +for (i =0 ; i < hostmem->num_current_regions; i++) { +memory_region_unref (hostmem->current_regions[i].mr); + }g_free (hostmem->current_regions); hostmem->current_regions = hostmem->new_regions; hostmem->num_current_regions = hostmem->num_new_regions;
@@ -92,8 +96,11 @@ static void hostmem_append_new_region(HostMem *hostmem, .guest_addr = section->offset_within_address_space, .size = int128_get64(section->size), .readonly = section->readonly, + .mr = section->mr, }; hostmem->num_new_regions++; + +memory_region_ref (section->mr); } static void hostmem_listener_append_region(MemoryListener *listener,
hw/virtio/vhost.c +2 -0
@@ -497,6 +497,7 @@ static void vhost_region_add(MemoryListener *listener, dev->mem_sections =g_renew (MemoryRegionSection, dev->mem_sections, dev->n_mem_sections); dev->mem_sections[dev->n_mem_sections -1 ] = *section; +memory_region_ref (section->mr);vhost_set_memory (listener, section, true); }
@@ -512,6 +513,7 @@ static void vhost_region_del(MemoryListener *listener, }vhost_set_memory (listener, section, false); +memory_region_unref (section->mr);for (i =0 ; i < dev->n_mem_sections; ++i) {if (dev->mem_sections[i].offset_within_address_space == section->offset_within_address_space) {
hw/virtio/virtio-balloon.c +1 -0
@@ -205,6 +205,7 @@ static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq) addr = section.offset_within_region;balloon_page (memory_region_get_ram_ptr (section.mr) + addr, !!(vq == s->dvq)); +memory_region_unref (section.mr); }virtqueue_push (vq, &elem, offset);
hw/xen/xen_pt.c +4 -0
@@ -606,6 +606,7 @@ static void xen_pt_region_add(MemoryListener *l, MemoryRegionSection *sec)XenPCIPassthroughState *s =container_of (l, XenPCIPassthroughState, memory_listener); +memory_region_ref (sec->mr);xen_pt_region_update (s, sec, true); }
@@ -615,6 +616,7 @@ static void xen_pt_region_del(MemoryListener *l, MemoryRegionSection *sec) memory_listener);xen_pt_region_update (s, sec, false); +memory_region_unref (sec->mr); }static void xen_pt_io_region_add (MemoryListener *l,MemoryRegionSection *sec)
@@ -622,6 +624,7 @@ static void xen_pt_io_region_add(MemoryListener *l, MemoryRegionSection *sec)XenPCIPassthroughState *s =container_of (l, XenPCIPassthroughState, io_listener); +memory_region_ref (sec->mr);xen_pt_region_update (s, sec, true); }
@@ -631,6 +634,7 @@ static void xen_pt_io_region_del(MemoryListener *l, MemoryRegionSection *sec) io_listener);xen_pt_region_update (s, sec, false); +memory_region_unref (sec->mr); }static const MemoryListener xen_pt_memory_listener = {
include/hw/virtio/dataplane/hostmem.h +1 -0
@@ -18,6 +18,7 @@#include "qemu/thread.h" typedef struct { + MemoryRegion *mr; void *host_addr; hwaddr guest_addr; uint64_t size;
kvm-all.c +2 -0
@@ -788,6 +788,7 @@ static void kvm_set_phys_mem(MemoryRegionSection *section, bool add)static void kvm_region_add (MemoryListener *listener,MemoryRegionSection *section) { +memory_region_ref (section->mr);kvm_set_phys_mem (section, true); }
@@ -795,6 +796,7 @@ static void kvm_region_del(MemoryListener *listener, MemoryRegionSection *section) {kvm_set_phys_mem (section, false); +memory_region_unref (section->mr); } static void kvm_log_sync(MemoryListener *listener,
memory.c +20 -0
@@ -148,6 +148,7 @@ static bool memory_listener_match(MemoryListener *listener, } \ }while (0 ) +/* No need to ref/unref .mr, the FlatRange keeps it alive. */#define MEMORY_LISTENER_UPDATE_REGION (fr, as, dir, callback) \ MEMORY_LISTENER_CALL(callback, dir, (&(MemoryRegionSection) { \ .mr = (fr)->mr, \
@@ -263,11 +264,17 @@ static void flatview_insert(FlatView *view, unsigned pos, FlatRange *range)memmove (view->ranges + pos +1 , view->ranges + pos, (view->nr - pos) *sizeof (FlatRange)); view->ranges[pos] = *range; +memory_region_ref (range->mr); ++view->nr; }static void flatview_destroy (FlatView *view) { +int i; + +for (i =0 ; i < view->nr; i++) { +memory_region_unref (view->ranges[i].mr); + }g_free (view->ranges); }
@@ -709,6 +716,11 @@ static void memory_region_destructor_ram(MemoryRegion *mr)qemu_ram_free (mr->ram_addr); } +static void memory_region_destructor_alias (MemoryRegion *mr) +{ +memory_region_unref (mr->alias); +} +static void memory_region_destructor_ram_from_ptr (MemoryRegion *mr) {qemu_ram_free_from_ptr (mr->ram_addr);
@@ -962,6 +974,8 @@ void memory_region_init_alias(MemoryRegion *mr, uint64_t size) {memory_region_init (mr, owner, name, size); +memory_region_ref (orig); + mr->destructor = memory_region_destructor_alias; mr->alias = orig; mr->alias_offset = offset; }
@@ -1340,6 +1354,7 @@ static void memory_region_add_subregion_common(MemoryRegion *mr,memory_region_transaction_begin ();assert (!subregion->parent); +memory_region_ref (subregion); subregion->parent = mr; subregion->addr = offset; QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {
@@ -1402,6 +1417,7 @@ void memory_region_del_subregion(MemoryRegion *mr,assert (subregion->parent == mr); subregion->parent =NULL ;QTAILQ_REMOVE (&mr->subregions, subregion, subregions_link); +memory_region_unref (subregion); memory_region_update_pending |= mr->enabled && subregion->enabled;memory_region_transaction_commit (); }
@@ -1429,12 +1445,14 @@ void memory_region_set_address(MemoryRegion *mr, hwaddr addr) }memory_region_transaction_begin (); +memory_region_ref (mr);memory_region_del_subregion (parent, mr);if (may_overlap) {memory_region_add_subregion_overlap (parent, addr, mr, priority); }else {memory_region_add_subregion (parent, addr, mr); } +memory_region_unref (mr);memory_region_transaction_commit (); }
@@ -1512,6 +1530,8 @@ MemoryRegionSection memory_region_find(MemoryRegion *mr, ret.size = range.size; ret.offset_within_address_space =int128_get64 (range.start); ret.readonly = fr->readonly; +memory_region_ref (ret.mr); +return ret; }
target-arm/kvm.c +2 -0
@@ -233,6 +233,7 @@ static void kvm_arm_machine_init_done(Notifier *notifier, void *data)abort (); } } +memory_region_unref (kd->mr);g_free (kd); } }
@@ -258,6 +259,7 @@ void kvm_arm_register_device(MemoryRegion *mr, uint64_t devid) kd->kda.id = devid; kd->kda.addr =-1 ;QSLIST_INSERT_HEAD (&kvm_devices_head, kd, entries); +memory_region_ref (kd->mr); }bool write_kvmstate_to_list (ARMCPU *cpu)
target-sparc/mmu_helper.c +1 -0
@@ -845,6 +845,7 @@ hwaddr cpu_get_phys_page_debug(CPUSPARCState *env, target_ulong addr) } } section =memory_region_find (get_system_memory (), phys_addr,1 ); +memory_region_unref (section.mr);if (!int128_nz (section.size)) {return -1 ; }
xen-all.c +2 -0
@@ -459,6 +459,7 @@ static void xen_set_memory(struct MemoryListener *listener,static void xen_region_add (MemoryListener *listener,MemoryRegionSection *section) { +memory_region_ref (section->mr);xen_set_memory (listener, section, true); }
@@ -466,6 +467,7 @@ static void xen_region_del(MemoryListener *listener, MemoryRegionSection *section) {xen_set_memory (listener, section, false); +memory_region_unref (section->mr); } static void xen_sync_dirty_bitmap(XenIOState *state,
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 06/11] memory: add ref/unref calls
Quoted 6 lines · Paolo Bonzini
Add ref/unref calls at the following places:
- places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM).
-
memory_region_findcallsites
You missed some recently added ones. Check hw/acpi/piix4.c and hw/isa/lpc_ich9.c (both will require some refactorings for this).
Quoted 177 lines
- creation of aliases and containers (only the aliased/contained region gets a reference to avoid loops)
- around calls to del_subregion/add_subregion, where the region could disappear after the first call
Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 3 +++ hw/core/loader.c | 1 + hw/display/exynos4210_fimd.c | 6 ++++++ hw/display/framebuffer.c | 12 +++++++----- hw/i386/kvmvapic.c | 1 + hw/misc/vfio.c | 2 ++ hw/virtio/dataplane/hostmem.c | 7 +++++++ hw/virtio/vhost.c | 2 ++ hw/virtio/virtio-balloon.c | 1 + hw/xen/xen_pt.c | 4 ++++ include/hw/virtio/dataplane/hostmem.h | 1 + kvm-all.c | 2 ++ memory.c | 20 ++++++++++++++++++++ target-arm/kvm.c | 2 ++ target-sparc/mmu_helper.c | 1 + xen-all.c | 2 ++ 16 files changed, 62 insertions(+), 5 deletions(-)exec.c +3
-0@@ -771,11 +771,14 @@ static uint16_t phys_section_add(MemoryRegionSection *section) phys_sections_nb_alloc); } phys_sections[phys_sections_nb] = *section; +memory_region_ref (section->mr);return phys_sections_nb++; }static void phys_section_destroy (MemoryRegion *mr) { +memory_region_unref (mr); +if (mr->subpage) {subpage_t *subpage =container_of (mr, subpage_t, iomem);memory_region_destroy (&subpage->iomem);hw/core/loader.c +1
-0@@ -727,6 +727,7 @@ int rom_load_all(void) addr += rom->romsize; section =memory_region_find (get_system_memory (), rom->addr,1 ); rom->isrom =int128_nz (section.size) &&memory_region_is_rom (section.mr); +memory_region_unref (section.mr); }qemu_register_reset (rom_reset,NULL ); roms_loaded =1 ;hw/display/exynos4210_fimd.c +6
-0@@ -1126,6 +1126,11 @@ static void fimd_update_memory_section(Exynos4210fimdState *s, unsigned win)/* Total number of bytes of virtual screen used by current window */ w->fb_len = fb_mapped_len = (w->virtpage_width + w->virtpage_offsize) * (w->rightbot_y - w->lefttop_y +1 ); + +/* TODO: add .exit and unref the region there. Not needed yet since sysbus +* does not support hot-unplug. +*/ +memory_region_unref (w->mem_section.mr); w->mem_section =memory_region_find (sysbus_address_space (&s->busdev), fb_start_addr, w->fb_len);assert (w->mem_section.mr);@@ -1154,6 +1159,7 @@ static void fimd_update_memory_section(Exynos4210fimdState *s, unsigned win)return ; error_return: +memory_region_unref (w->mem_section.mr); w->mem_section.mr =NULL ; w->mem_section.size =int128_zero (); w->host_fb_addr =NULL ;hw/display/framebuffer.c +7
-5@@ -54,11 +54,11 @@ void framebuffer_update_display( src_len = src_width * rows; mem_section =memory_region_find (address_space, base, src_len); + mem = mem_section.mr;if (int128_get64 (mem_section.size) != src_len || !memory_region_is_ram (mem_section.mr)) { -return ; + goto out; } - mem = mem_section.mr;assert (mem);assert (mem_section.offset_within_address_space == base);@@ -68,10 +68,10 @@ void framebuffer_update_display(but it's not really worth it as dirty flag tracking will probably already have failed above. */ if (!src_base) -return ; + goto out;if (src_len != src_width * rows) {cpu_physical_memory_unmap (src_base, src_len,0 ,0 ); -return ; + goto out; } src = src_base; dest =surface_data (ds);@@ -102,10 +102,12 @@ void framebuffer_update_display( }cpu_physical_memory_unmap (src_base, src_len,0 ,0 );if (first <0 ) { -return ; + goto out; }memory_region_reset_dirty (mem, mem_section.offset_within_region, src_len,DIRTY_MEMORY_VGA ); *first_row = first; *last_row = last; +out: +memory_region_unref (mem); }hw/i386/kvmvapic.c +1
-0@@ -605,6 +605,7 @@ static void vapic_map_rom_writable(VAPICROMState *s) rom_size);memory_region_add_subregion_overlap (as, rom_paddr, &s->rom,1000 ); s->rom_mapped_writable = true; +memory_region_unref (section.mr); }static int vapic_prepare (VAPICROMState *s)hw/misc/vfio.c +2
-0@@ -1969,6 +1969,7 @@ static void vfio_listener_region_add(MemoryListener *listener,DPRINTF ("region_add %" HWADDR_PRIx" - %" HWADDR_PRIx" [%p]\n" , iova, end -1 , vaddr); +memory_region_ref (section->mr); ret =vfio_dma_map (container, iova, end - iova, vaddr, section->readonly);if (ret) { error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "@@ -2010,6 +2011,7 @@ static void vfio_listener_region_del(MemoryListener *listener, iova, end - 1); ret =vfio_dma_unmap (container, iova, end - iova); +memory_region_unref (section->mr);if (ret) { error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx") = %d (%m)",hw/virtio/dataplane/hostmem.c +4
-0@@ -64,8 +64,12 @@ out:static void hostmem_listener_commit (MemoryListener *listener) {HostMem *hostmem =container_of (listener, HostMem, listener); +int i;qemu_mutex_lock (&hostmem->current_regions_lock); +for (i =0 ; i < hostmem->num_current_regions; i++) { +memory_region_unref (hostmem->current_regions[i].mr); + }g_free (hostmem->current_regions); hostmem->current_regions = hostmem->new_regions; hostmem->num_current_regions = hostmem->num_new_regions;
hw/virtio/dataplane/hostmem.c static void hostmem_append_new_region(HostMem *hostmem, · line 103
Quoted 8 lines
hw/virtio/dataplane/hostmem.c +3
-0@@ -92,8 +96,11 @@ static void hostmem_append_new_region(HostMem *hostmem, .guest_addr = section->offset_within_address_space, .size = int128_get64(section->size), .readonly = section->readonly, + .mr = section->mr, }; hostmem->num_new_regions++; + +memory_region_ref (section->mr);
Hmm, hostmem_append_new_region is also called on region_nop. Don't we accumulate them? But that's not changed by this patch.
Quoted 247 lines
hw/virtio/dataplane/hostmem.c +0
-0} static void hostmem_listener_append_region(MemoryListener *listener,hw/virtio/vhost.c +2
-0@@ -497,6 +497,7 @@ static void vhost_region_add(MemoryListener *listener, dev->mem_sections =g_renew (MemoryRegionSection, dev->mem_sections, dev->n_mem_sections); dev->mem_sections[dev->n_mem_sections -1 ] = *section; +memory_region_ref (section->mr);vhost_set_memory (listener, section, true); }@@ -512,6 +513,7 @@ static void vhost_region_del(MemoryListener *listener, }vhost_set_memory (listener, section, false); +memory_region_unref (section->mr);for (i =0 ; i < dev->n_mem_sections; ++i) {if (dev->mem_sections[i].offset_within_address_space == section->offset_within_address_space) {hw/virtio/virtio-balloon.c +1
-0@@ -205,6 +205,7 @@ static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq) addr = section.offset_within_region;balloon_page (memory_region_get_ram_ptr (section.mr) + addr, !!(vq == s->dvq)); +memory_region_unref (section.mr); }virtqueue_push (vq, &elem, offset);hw/xen/xen_pt.c +4
-0@@ -606,6 +606,7 @@ static void xen_pt_region_add(MemoryListener *l, MemoryRegionSection *sec)XenPCIPassthroughState *s =container_of (l, XenPCIPassthroughState, memory_listener); +memory_region_ref (sec->mr);xen_pt_region_update (s, sec, true); }@@ -615,6 +616,7 @@ static void xen_pt_region_del(MemoryListener *l, MemoryRegionSection *sec) memory_listener);xen_pt_region_update (s, sec, false); +memory_region_unref (sec->mr); }static void xen_pt_io_region_add (MemoryListener *l,MemoryRegionSection *sec)@@ -622,6 +624,7 @@ static void xen_pt_io_region_add(MemoryListener *l, MemoryRegionSection *sec)XenPCIPassthroughState *s =container_of (l, XenPCIPassthroughState, io_listener); +memory_region_ref (sec->mr);xen_pt_region_update (s, sec, true); }@@ -631,6 +634,7 @@ static void xen_pt_io_region_del(MemoryListener *l, MemoryRegionSection *sec) io_listener);xen_pt_region_update (s, sec, false); +memory_region_unref (sec->mr); }static const MemoryListener xen_pt_memory_listener = {include/hw/virtio/dataplane/hostmem.h +1
-0@@ -18,6 +18,7 @@#include "qemu/thread.h" typedef struct { + MemoryRegion *mr; void *host_addr; hwaddr guest_addr; uint64_t size;kvm-all.c +2
-0@@ -788,6 +788,7 @@ static void kvm_set_phys_mem(MemoryRegionSection *section, bool add)static void kvm_region_add (MemoryListener *listener,MemoryRegionSection *section) { +memory_region_ref (section->mr);kvm_set_phys_mem (section, true); }@@ -795,6 +796,7 @@ static void kvm_region_del(MemoryListener *listener, MemoryRegionSection *section) {kvm_set_phys_mem (section, false); +memory_region_unref (section->mr); } static void kvm_log_sync(MemoryListener *listener,memory.c +20
-0@@ -148,6 +148,7 @@ static bool memory_listener_match(MemoryListener *listener, } \ }while (0 ) +/* No need to ref/unref .mr, the FlatRange keeps it alive. */#define MEMORY_LISTENER_UPDATE_REGION (fr, as, dir, callback) \ MEMORY_LISTENER_CALL(callback, dir, (&(MemoryRegionSection) { \ .mr = (fr)->mr, \@@ -263,11 +264,17 @@ static void flatview_insert(FlatView *view, unsigned pos, FlatRange *range)memmove (view->ranges + pos +1 , view->ranges + pos, (view->nr - pos) *sizeof (FlatRange)); view->ranges[pos] = *range; +memory_region_ref (range->mr); ++view->nr; }static void flatview_destroy (FlatView *view) { +int i; + +for (i =0 ; i < view->nr; i++) { +memory_region_unref (view->ranges[i].mr); + }g_free (view->ranges); }@@ -709,6 +716,11 @@ static void memory_region_destructor_ram(MemoryRegion *mr)qemu_ram_free (mr->ram_addr); } +static void memory_region_destructor_alias (MemoryRegion *mr) +{ +memory_region_unref (mr->alias); +} +static void memory_region_destructor_ram_from_ptr (MemoryRegion *mr) {qemu_ram_free_from_ptr (mr->ram_addr);@@ -962,6 +974,8 @@ void memory_region_init_alias(MemoryRegion *mr, uint64_t size) {memory_region_init (mr, owner, name, size); +memory_region_ref (orig); + mr->destructor = memory_region_destructor_alias; mr->alias = orig; mr->alias_offset = offset; }@@ -1340,6 +1354,7 @@ static void memory_region_add_subregion_common(MemoryRegion *mr,memory_region_transaction_begin ();assert (!subregion->parent); +memory_region_ref (subregion); subregion->parent = mr; subregion->addr = offset; QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {@@ -1402,6 +1417,7 @@ void memory_region_del_subregion(MemoryRegion *mr,assert (subregion->parent == mr); subregion->parent =NULL ;QTAILQ_REMOVE (&mr->subregions, subregion, subregions_link); +memory_region_unref (subregion); memory_region_update_pending |= mr->enabled && subregion->enabled;memory_region_transaction_commit (); }@@ -1429,12 +1445,14 @@ void memory_region_set_address(MemoryRegion *mr, hwaddr addr) }memory_region_transaction_begin (); +memory_region_ref (mr);memory_region_del_subregion (parent, mr);if (may_overlap) {memory_region_add_subregion_overlap (parent, addr, mr, priority); }else {memory_region_add_subregion (parent, addr, mr); } +memory_region_unref (mr);memory_region_transaction_commit (); }@@ -1512,6 +1530,8 @@ MemoryRegionSection memory_region_find(MemoryRegion *mr, ret.size = range.size; ret.offset_within_address_space =int128_get64 (range.start); ret.readonly = fr->readonly; +memory_region_ref (ret.mr); +return ret; }target-arm/kvm.c +2
-0@@ -233,6 +233,7 @@ static void kvm_arm_machine_init_done(Notifier *notifier, void *data)abort (); } } +memory_region_unref (kd->mr);g_free (kd); } }@@ -258,6 +259,7 @@ void kvm_arm_register_device(MemoryRegion *mr, uint64_t devid) kd->kda.id = devid; kd->kda.addr =-1 ;QSLIST_INSERT_HEAD (&kvm_devices_head, kd, entries); +memory_region_ref (kd->mr); }bool write_kvmstate_to_list (ARMCPU *cpu)target-sparc/mmu_helper.c +1
-0@@ -845,6 +845,7 @@ hwaddr cpu_get_phys_page_debug(CPUSPARCState *env, target_ulong addr) } } section =memory_region_find (get_system_memory (), phys_addr,1 ); +memory_region_unref (section.mr);if (!int128_nz (section.size)) {return -1 ; }xen-all.c +2
-1@@ -459,6 +459,7 @@ static void xen_set_memory(struct MemoryListener *listener,static void xen_region_add (MemoryListener *listener,MemoryRegionSection *section) { +memory_region_ref (section->mr);xen_set_memory (listener, section, true); }@@ -466,6 +467,7 @@ static void xen_region_del(MemoryListener *listener, MemoryRegionSection *section) {xen_set_memory (listener, section, false); +memory_region_unref (section->mr); } static void xen_sync_dirty_bitmap(XenIOState *state, --
Quoted 3 lines
1.8.1.4
Looks good otherwise.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 06/11] memory: add ref/unref calls
Il 01/07/2013 20:33, Jan Kiszka ha scritto:
Quoted 10 lines · Paolo Bonzini
Quoted 6 lines
Add ref/unref calls at the following places:
- places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM).
-
memory_region_findcallsitesYou missed some recently added ones. Check
hw/acpi/piix4.candhw/isa/lpc_ich9.c(both will require some refactorings for this).
Here are the required changes:
hw/acpi/piix4.c +13 -3
@@ -380,6 +380,16 @@ static void piix4_pm_powerdown_req(Notifier *n, void *opaque)acpi_pm1_evt_power_down (&s->ar); } +static bool memory_region_present (MemoryRegion *io,hwaddr port) +{ +MemoryRegion *mr =memory_region_find (io, port,1 ); +if (!mr) { +return false; + } +memory_region_unref (mr); +return true; +} +static void piix4_pm_machine_ready (Notifier *n,void *opaque) {PIIX4PMState *s =container_of (n, PIIX4PMState, machine_ready);
@@ -388,10 +398,10 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque) pci_conf = s->dev.config; pci_conf[0x5f ] =0x10 | - (memory_region_find (io_as,0x378 ,1 ).mr ?0x80 :0 ); + (memory_region_present (io_as,0x378 ,1 ) ?0x80 :0 ); pci_conf[0x63 ] =0x60 ; - pci_conf[0x67 ] = (memory_region_find (io_as,0x3f8 ,1 ).mr ?0x08 :0 ) | - (memory_region_find (io_as,0x2f8 ,1 ).mr ?0x90 :0 ); + pci_conf[0x67 ] = (memory_region_present (io_as,0x3f8 ,1 ) ?0x08 :0 ) | + (memory_region_present (io_as,0x2f8 ,1 ) ?0x90 :0 ); }static int piix4_pm_initfn (PCIDevice *dev)
hw/isa/lpc_ich9.c +13 -4
@@ -478,24 +478,33 @@ static void ich9_lpc_machine_ready(Notifier *n, void *opaque) {ICH9LPCState *s =container_of (n, ICH9LPCState, machine_ready);MemoryRegion *io_as =pci_address_space_io (&s->d); +MemoryRegion *mr;uint8_t *pci_conf; pci_conf = s->d.config; -if (memory_region_find (io_as,0x3f8 ,1 ).mr) { + mr =memory_region_find (io_as,0x3f8 ,1 ).mr; +if (mr) {/* com1 */ pci_conf[0x82 ] |=0x01 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x2f8 ,1 ).mr) { + mr =memory_region_find (io_as,0x2f8 ,1 ).mr; +if (mr) {/* com2 */ pci_conf[0x82 ] |=0x02 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x378 ,1 ).mr) { + mr =memory_region_find (io_as,0x378 ,1 ).mr; +if (mr) {/* lpt */ pci_conf[0x82 ] |=0x04 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x3f0 ,1 ).mr) { + mr =memory_region_find (io_as,0x3f0 ,1 ).mr; +if (mr) {/* floppy */ pci_conf[0x82 ] |=0x08 ; +memory_region_unref (mr); } }
Re: [Qemu-devel] [PATCH v2 06/11] memory: add ref/unref calls
Quoted 83 lines · Paolo Bonzini
Il 01/07/2013 20:33, Jan Kiszka ha scritto:
Quoted 10 lines · Paolo Bonzini
Quoted 6 lines
Add ref/unref calls at the following places:
- places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM).
-
memory_region_findcallsitesYou missed some recently added ones. Check
hw/acpi/piix4.candhw/isa/lpc_ich9.c(both will require some refactorings for this).Here are the required changes:
hw/acpi/piix4.c +13
-3@@ -380,6 +380,16 @@ static void piix4_pm_powerdown_req(Notifier *n, void *opaque)acpi_pm1_evt_power_down (&s->ar); } +static bool memory_region_present (MemoryRegion *io,hwaddr port) +{ +MemoryRegion *mr =memory_region_find (io, port,1 ); +if (!mr) { +return false; + } +memory_region_unref (mr); +return true; +} +static void piix4_pm_machine_ready (Notifier *n,void *opaque) {PIIX4PMState *s =container_of (n, PIIX4PMState, machine_ready);@@ -388,10 +398,10 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque) pci_conf = s->dev.config; pci_conf[0x5f ] =0x10 | - (memory_region_find (io_as,0x378 ,1 ).mr ?0x80 :0 ); + (memory_region_present (io_as,0x378 ,1 ) ?0x80 :0 ); pci_conf[0x63 ] =0x60 ; - pci_conf[0x67 ] = (memory_region_find (io_as,0x3f8 ,1 ).mr ?0x08 :0 ) | - (memory_region_find (io_as,0x2f8 ,1 ).mr ?0x90 :0 ); + pci_conf[0x67 ] = (memory_region_present (io_as,0x3f8 ,1 ) ?0x08 :0 ) | + (memory_region_present (io_as,0x2f8 ,1 ) ?0x90 :0 ); }static int piix4_pm_initfn (PCIDevice *dev)hw/isa/lpc_ich9.c +10
-3@@ -478,24 +478,33 @@ static void ich9_lpc_machine_ready(Notifier *n, void *opaque) {ICH9LPCState *s =container_of (n, ICH9LPCState, machine_ready);MemoryRegion *io_as =pci_address_space_io (&s->d); +MemoryRegion *mr;uint8_t *pci_conf; pci_conf = s->d.config; -if (memory_region_find (io_as,0x3f8 ,1 ).mr) { + mr =memory_region_find (io_as,0x3f8 ,1 ).mr; +if (mr) {/* com1 */ pci_conf[0x82 ] |=0x01 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x2f8 ,1 ).mr) { + mr =memory_region_find (io_as,0x2f8 ,1 ).mr; +if (mr) {/* com2 */ pci_conf[0x82 ] |=0x02 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x378 ,1 ).mr) { + mr =memory_region_find (io_as,0x378 ,1 ).mr; +if (mr) {/* lpt */ pci_conf[0x82 ] |=0x04 ; +memory_region_unref (mr);
hw/isa/lpc_ich9.c static void ich9_lpc_machine_ready(Notifier *n, void *opaque) · line 510
Quoted 10 lines
hw/isa/lpc_ich9.c +3
-1} -if (memory_region_find (io_as,0x3f0 ,1 ).mr) { + mr =memory_region_find (io_as,0x3f0 ,1 ).mr; +if (mr) {/* floppy */ pci_conf[0x82 ] |=0x08 ; +memory_region_unref (mr); } }
Hmm, two solutions for one problem - can we improve this in the next round?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 06/11] memory: add ref/unref calls
Il 02/07/2013 09:11, Jan Kiszka ha scritto:
Quoted 88 lines · Paolo Bonzini
Quoted 87 lines
Il 01/07/2013 20:33, Jan Kiszka ha scritto:
Quoted 10 lines · Paolo Bonzini
Quoted 6 lines
Add ref/unref calls at the following places:
- places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM).
-
memory_region_findcallsitesYou missed some recently added ones. Check
hw/acpi/piix4.candhw/isa/lpc_ich9.c(both will require some refactorings for this).Here are the required changes:
hw/acpi/piix4.c +13
-3@@ -380,6 +380,16 @@ static void piix4_pm_powerdown_req(Notifier *n, void *opaque)acpi_pm1_evt_power_down (&s->ar); } +static bool memory_region_present (MemoryRegion *io,hwaddr port) +{ +MemoryRegion *mr =memory_region_find (io, port,1 ); +if (!mr) { +return false; + } +memory_region_unref (mr); +return true; +} +static void piix4_pm_machine_ready (Notifier *n,void *opaque) {PIIX4PMState *s =container_of (n, PIIX4PMState, machine_ready);@@ -388,10 +398,10 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque) pci_conf = s->dev.config; pci_conf[0x5f ] =0x10 | - (memory_region_find (io_as,0x378 ,1 ).mr ?0x80 :0 ); + (memory_region_present (io_as,0x378 ,1 ) ?0x80 :0 ); pci_conf[0x63 ] =0x60 ; - pci_conf[0x67 ] = (memory_region_find (io_as,0x3f8 ,1 ).mr ?0x08 :0 ) | - (memory_region_find (io_as,0x2f8 ,1 ).mr ?0x90 :0 ); + pci_conf[0x67 ] = (memory_region_present (io_as,0x3f8 ,1 ) ?0x08 :0 ) | + (memory_region_present (io_as,0x2f8 ,1 ) ?0x90 :0 ); }static int piix4_pm_initfn (PCIDevice *dev)hw/isa/lpc_ich9.c +12
-4@@ -478,24 +478,33 @@ static void ich9_lpc_machine_ready(Notifier *n, void *opaque) {ICH9LPCState *s =container_of (n, ICH9LPCState, machine_ready);MemoryRegion *io_as =pci_address_space_io (&s->d); +MemoryRegion *mr;uint8_t *pci_conf; pci_conf = s->d.config; -if (memory_region_find (io_as,0x3f8 ,1 ).mr) { + mr =memory_region_find (io_as,0x3f8 ,1 ).mr; +if (mr) {/* com1 */ pci_conf[0x82 ] |=0x01 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x2f8 ,1 ).mr) { + mr =memory_region_find (io_as,0x2f8 ,1 ).mr; +if (mr) {/* com2 */ pci_conf[0x82 ] |=0x02 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x378 ,1 ).mr) { + mr =memory_region_find (io_as,0x378 ,1 ).mr; +if (mr) {/* lpt */ pci_conf[0x82 ] |=0x04 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x3f0 ,1 ).mr) { + mr =memory_region_find (io_as,0x3f0 ,1 ).mr; +if (mr) {/* floppy */ pci_conf[0x82 ] |=0x08 ;
Quoted 8 lines
hw/isa/lpc_ich9.c static void ich9_lpc_machine_ready(Notifier *n, void *opaque) · line 510
Quoted 6 lines
hw/isa/lpc_ich9.c +1
-0+memory_region_unref (mr); } }Hmm, two solutions for one problem - can we improve this in the next round?
Sure, I can adapt the hw/acpi/piix4.c to use ifs in the same style as hw/isa/lpc_ich9.c (I find the code easier to read).
Paolo
Re: [Qemu-devel] [PATCH v2 06/11] memory: add ref/unref calls
Quoted 98 lines · Paolo Bonzini
Il 02/07/2013 09:11, Jan Kiszka ha scritto:
Quoted 88 lines · Paolo Bonzini
Quoted 87 lines
Il 01/07/2013 20:33, Jan Kiszka ha scritto:
Quoted 10 lines · Paolo Bonzini
Quoted 6 lines
Add ref/unref calls at the following places:
- places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM).
-
memory_region_findcallsitesYou missed some recently added ones. Check
hw/acpi/piix4.candhw/isa/lpc_ich9.c(both will require some refactorings for this).Here are the required changes:
hw/acpi/piix4.c +13
-3@@ -380,6 +380,16 @@ static void piix4_pm_powerdown_req(Notifier *n, void *opaque)acpi_pm1_evt_power_down (&s->ar); } +static bool memory_region_present (MemoryRegion *io,hwaddr port) +{ +MemoryRegion *mr =memory_region_find (io, port,1 ); +if (!mr) { +return false; + } +memory_region_unref (mr); +return true; +} +static void piix4_pm_machine_ready (Notifier *n,void *opaque) {PIIX4PMState *s =container_of (n, PIIX4PMState, machine_ready);@@ -388,10 +398,10 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque) pci_conf = s->dev.config; pci_conf[0x5f ] =0x10 | - (memory_region_find (io_as,0x378 ,1 ).mr ?0x80 :0 ); + (memory_region_present (io_as,0x378 ,1 ) ?0x80 :0 ); pci_conf[0x63 ] =0x60 ; - pci_conf[0x67 ] = (memory_region_find (io_as,0x3f8 ,1 ).mr ?0x08 :0 ) | - (memory_region_find (io_as,0x2f8 ,1 ).mr ?0x90 :0 ); + pci_conf[0x67 ] = (memory_region_present (io_as,0x3f8 ,1 ) ?0x08 :0 ) | + (memory_region_present (io_as,0x2f8 ,1 ) ?0x90 :0 ); }static int piix4_pm_initfn (PCIDevice *dev)hw/isa/lpc_ich9.c +12
-4@@ -478,24 +478,33 @@ static void ich9_lpc_machine_ready(Notifier *n, void *opaque) {ICH9LPCState *s =container_of (n, ICH9LPCState, machine_ready);MemoryRegion *io_as =pci_address_space_io (&s->d); +MemoryRegion *mr;uint8_t *pci_conf; pci_conf = s->d.config; -if (memory_region_find (io_as,0x3f8 ,1 ).mr) { + mr =memory_region_find (io_as,0x3f8 ,1 ).mr; +if (mr) {/* com1 */ pci_conf[0x82 ] |=0x01 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x2f8 ,1 ).mr) { + mr =memory_region_find (io_as,0x2f8 ,1 ).mr; +if (mr) {/* com2 */ pci_conf[0x82 ] |=0x02 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x378 ,1 ).mr) { + mr =memory_region_find (io_as,0x378 ,1 ).mr; +if (mr) {/* lpt */ pci_conf[0x82 ] |=0x04 ; +memory_region_unref (mr); } -if (memory_region_find (io_as,0x3f0 ,1 ).mr) { + mr =memory_region_find (io_as,0x3f0 ,1 ).mr; +if (mr) {/* floppy */ pci_conf[0x82 ] |=0x08 ;Quoted 8 lines
hw/isa/lpc_ich9.c static void ich9_lpc_machine_ready(Notifier *n, void *opaque) · line 510
Quoted 6 lines
hw/isa/lpc_ich9.c +1
-0+memory_region_unref (mr); } }Hmm, two solutions for one problem - can we improve this in the next round?
Quoted 2 lines
Sure, I can adapt the
hw/acpi/piix4.cto use ifs in the same style ashw/isa/lpc_ich9.c(I find the code easier to read).
I was more referring to memory_region_present vs. open-coding.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 06/11] memory: add ref/unref calls
Il 02/07/2013 10:36, Jan Kiszka ha scritto:
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Hmm, two solutions for one problem - can we improve this in the next round?
Sure, I can adapt the
hw/acpi/piix4.cto use ifs in the same style ashw/isa/lpc_ich9.c(I find the code easier to read).I was more referring to
memory_region_presentvs. open-coding.
Understood, but once you replace ?: with "if", the memory_region_present wrapper loses most of the appeal. So I actually prefer the open-coded one.
Paolo
Re: [Qemu-devel] [PATCH v2 06/11] memory: add ref/unref calls
Quoted 9 lines · Paolo Bonzini
Il 02/07/2013 10:36, Jan Kiszka ha scritto:
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Hmm, two solutions for one problem - can we improve this in the next round?
Sure, I can adapt the
hw/acpi/piix4.cto use ifs in the same style ashw/isa/lpc_ich9.c(I find the code easier to read).I was more referring to
memory_region_presentvs. open-coding.Understood, but once you replace ?: with "if", the
memory_region_presentwrapper loses most of the appeal. So I actually prefer the open-coded one.
Well, count the memory_region_unref calls.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 06/11] memory: add ref/unref calls
Il 02/07/2013 11:31, Jan Kiszka ha scritto:
Quoted 12 lines · Paolo Bonzini
Quoted 9 lines
Il 02/07/2013 10:36, Jan Kiszka ha scritto:
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Hmm, two solutions for one problem - can we improve this in the next round?
Sure, I can adapt the
hw/acpi/piix4.cto use ifs in the same style ashw/isa/lpc_ich9.c(I find the code easier to read).I was more referring to
memory_region_presentvs. open-coding.Understood, but once you replace ?: with "if", the
memory_region_presentwrapper loses most of the appeal. So I actually prefer the open-coded one.Well, count the
memory_region_unrefcalls.
Fair enough... I'll move memory_region_present to memory.h/c.
Paolo
PATCH v2 7/11 exec: check MRU in qemu_ram_addr_from_host
In reply to Paolo BonziniThis function is not used outside the iothread mutex, so it can use ram_list.mru_block.
--- exec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
exec.c +10 -2
@@ -1408,18 +1408,26 @@ int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr)return 0 ; } + block = ram_list.mru_block; +if (block && block->host && host - block->host < block->length) { + goto found; + } + QTAILQ_FOREACH(block, &ram_list.blocks, next) {/* This case append when the block is not mapped. */ if (block->host ==NULL ) {continue ; }if (host - block->host < block->length) { - *ram_addr = block->offset + (host - block->host); -return 0 ; + goto found; } }return -1 ; + +found: + *ram_addr = block->offset + (host - block->host); +return 0 ; }/* Some of the softmmu routines need to translate from a host pointer
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 07/11] exec: check MRU in qemu_ram_addr_from_host
Quoted 2 lines · Paolo Bonzini
This function is not used outside the iothread mutex, so it can use ram_list.mru_block.
Add a comment to qemu_ram_addr_from_host to document this requirement?
Quoted 30 lines
Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)exec.c +6
-2@@ -1408,18 +1408,26 @@ int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr)return 0 ; } + block = ram_list.mru_block; +if (block && block->host && host - block->host < block->length) { + goto found; + } + QTAILQ_FOREACH(block, &ram_list.blocks, next) {/* This case append when the block is not mapped. */ if (block->host ==NULL ) {continue ; }if (host - block->host < block->length) { - *ram_addr = block->offset + (host - block->host); -return 0 ; + goto found; }
exec.c int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr) · line 1433
Quoted 10 lines
exec.c +4
-0}return -1 ; + +found: + *ram_addr = block->offset + (host - block->host); +return 0 ; }/* Some of the softmmu routines need to translate from a host pointer
Beside the nit:
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 07/11] exec: check MRU in qemu_ram_addr_from_host
Il 01/07/2013 20:33, Jan Kiszka ha scritto:
Quoted 4 lines
Quoted 2 lines
This function is not used outside the iothread mutex, so it can use ram_list.mru_block.
Add a comment to
qemu_ram_addr_from_hostto document this requirement?
Right now there is hardly any documentation of what does _not_ require the iothread mutex... basically everything except qemu_safe_ram_ptr and qemu_ram_ptr_length requires it.
Paolo
Re: [Qemu-devel] [PATCH v2 07/11] exec: check MRU in qemu_ram_addr_from_host
Quoted 9 lines · Paolo Bonzini
Il 01/07/2013 20:33, Jan Kiszka ha scritto:
Quoted 4 lines
Quoted 2 lines
This function is not used outside the iothread mutex, so it can use ram_list.mru_block.
Add a comment to
qemu_ram_addr_from_hostto document this requirement?Right now there is hardly any documentation of what does _not_ require the iothread mutex... basically everything except
qemu_safe_ram_ptrandqemu_ram_ptr_lengthrequires it.
I don't disagree regarding the current state. But that doesn't imply it has to be preserved.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 07/11] exec: check MRU in qemu_ram_addr_from_host
Il 02/07/2013 09:09, Jan Kiszka ha scritto:
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Right now there is hardly any documentation of what does _not_ require the iothread mutex... basically everything except
qemu_safe_ram_ptrandqemu_ram_ptr_lengthrequires it.I don't disagree regarding the current state. But that doesn't imply it has to be preserved.
As soon as there are exec.c APIs that are BQL-safe, I'll document the state of all of them.
In the meanwhile, I'll add a note that memory_region_find can be called outside the BQL.
Paolo
PATCH v2 8/11 exec: move qemu_ram_addr_from_host_nofail to cputlb.c
In reply to Paolo BonziniAfter the next patch it would not be used elsewhere anyway. Also, the _nofail and the standard versions of this function return different things, which is confusing. Removing the function from the public headers limits the confusion.
--- cputlb.c | 11 +++++++++++ exec.c | 18 ++++-------------- include/exec/cpu-common.h | 1 - 3 files changed, 15 insertions(+), 15 deletions(-)
cputlb.c +11 -0
@@ -158,6 +158,17 @@ void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start, } } +static inline ram_addr_t qemu_ram_addr_from_host_nofail (void *ptr) +{ +ram_addr_t ram_addr; + +if (qemu_ram_addr_from_host (ptr, &ram_addr)) { +fprintf (stderr,"Bad ram pointer %p\n" , ptr); +abort (); + } +return ram_addr; +} +static inline void tlb_update_dirty (CPUTLBEntry *tlb_entry) {ram_addr_t ram_addr;
exec.c +4 -14
@@ -1398,6 +1398,8 @@ static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size) } } +/* Some of the softmmu routines need to translate from a host pointer +(typically a TLB entry) back to a ram offset. */ int qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr) {RAMBlock *block;
@@ -1430,19 +1432,6 @@ found:return 0 ; } -/* Some of the softmmu routines need to translate from a host pointer -(typically a TLB entry) back to a ram offset. */ -ram_addr_t qemu_ram_addr_from_host_nofail (void *ptr) -{ -ram_addr_t ram_addr; - -if (qemu_ram_addr_from_host (ptr, &ram_addr)) { -fprintf (stderr,"Bad ram pointer %p\n" , ptr); -abort (); - } -return ram_addr; -} -static void notdirty_mem_write (void *opaque,hwaddr ram_addr,uint64_t val,unsigned size) {
@@ -2129,7 +2118,8 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, {if (buffer != bounce.buffer) {if (is_write) { -ram_addr_t addr1 =qemu_ram_addr_from_host_nofail (buffer); +ram_addr_t addr1; +qemu_ram_addr_from_host (buffer, &addr1);while (access_len) {unsigned l; l =TARGET_PAGE_SIZE ;
include/exec/cpu-common.h +0 -1
@@ -51,7 +51,6 @@ typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr);void qemu_ram_remap (ram_addr_t addr,ram_addr_t length);/* This should not be used by devices. */ int qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr); -ram_addr_t qemu_ram_addr_from_host_nofail (void *ptr);void qemu_ram_set_idstr (ram_addr_t addr,const char *name,DeviceState *dev); void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 08/11] exec: move qemu_ram_addr_from_host_nofail to cputlb.c
Quoted 68 lines · Paolo Bonzini
After the next patch it would not be used elsewhere anyway. Also, the
_nofailand the standard versions of this function return different things, which is confusing. Removing the function from the public headers limits the confusion.Signed-off-by Paolo Bonzini <[email protected]>--- cputlb.c | 11 +++++++++++ exec.c | 18 ++++-------------- include/exec/cpu-common.h | 1 - 3 files changed, 15 insertions(+), 15 deletions(-)cputlb.c +11
-0@@ -158,6 +158,17 @@ void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start, } } +static inline ram_addr_t qemu_ram_addr_from_host_nofail (void *ptr) +{ +ram_addr_t ram_addr; + +if (qemu_ram_addr_from_host (ptr, &ram_addr)) { +fprintf (stderr,"Bad ram pointer %p\n" , ptr); +abort (); + } +return ram_addr; +} +static inline void tlb_update_dirty (CPUTLBEntry *tlb_entry) {ram_addr_t ram_addr;exec.c +2
-13@@ -1398,6 +1398,8 @@ static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size) } } +/* Some of the softmmu routines need to translate from a host pointer +(typically a TLB entry) back to a ram offset. */ int qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr) {RAMBlock *block;@@ -1430,19 +1432,6 @@ found:return 0 ; } -/* Some of the softmmu routines need to translate from a host pointer -(typically a TLB entry) back to a ram offset. */ -ram_addr_t qemu_ram_addr_from_host_nofail (void *ptr) -{ -ram_addr_t ram_addr; - -if (qemu_ram_addr_from_host (ptr, &ram_addr)) { -fprintf (stderr,"Bad ram pointer %p\n" , ptr); -abort (); - } -return ram_addr; -} -static void notdirty_mem_write (void *opaque,hwaddr ram_addr,uint64_t val,unsigned size) {
exec.c void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, · line 2122
Quoted 6 lines
exec.c +2
-1@@ -2129,7 +2118,8 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, {if (buffer != bounce.buffer) {if (is_write) { -ram_addr_t addr1 =qemu_ram_addr_from_host_nofail (buffer); +ram_addr_t addr1; +qemu_ram_addr_from_host (buffer, &addr1);
assert() that it succeeds? There remains the risk someone passes an invalid buffer address.
Ah, wait, you'll do this in patch 11. Well, OK.
Quoted 9 lines
exec.c +0
-0while (access_len) {unsigned l; l =TARGET_PAGE_SIZE ;include/exec/cpu-common.h +0
-0
include/exec/cpu-common.h typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr); · line 56
Quoted 7 lines
include/exec/cpu-common.h +0
-1@@ -51,7 +51,6 @@ typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr);void qemu_ram_remap (ram_addr_t addr,ram_addr_t length);/* This should not be used by devices. */ int qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr); -ram_addr_t qemu_ram_addr_from_host_nofail (void *ptr);void qemu_ram_set_idstr (ram_addr_t addr,const char *name,DeviceState *dev); void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
PATCH v2 9/11 memory: return MemoryRegion from qemu_ram_addr_from_host
In reply to Paolo BonziniIt will be needed in the next patches.
--- cputlb.c | 2 +- exec.c | 33 ++++++++++++++++++++------------- include/exec/cpu-common.h | 2 +- target-i386/kvm.c | 4 ++-- 4 files changed, 24 insertions(+), 17 deletions(-)
cputlb.c +1 -1
@@ -162,7 +162,7 @@ static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) {ram_addr_t ram_addr; -if (qemu_ram_addr_from_host (ptr, &ram_addr)) { +if (qemu_ram_addr_from_host (ptr, &ram_addr) ==NULL ) {fprintf (stderr,"Bad ram pointer %p\n" , ptr);abort (); }
exec.c +20 -13
@@ -1296,15 +1296,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) }#endif /* !_WIN32 */ -/* Return a host pointer to ram allocated with qemu_ram_alloc. -With the exception of the softmmu code in this file, this should -only be used for local memory (e.g. video ram) that the device owns, -and knows it isn't going to access beyond the end of the block. - -It should not be used for general purpose DMA. -Use cpu_physical_memory_map/cpu_physical_memory_rw instead. -*/ -void *qemu_get_ram_ptr (ram_addr_t addr) +static RAMBlock *qemu_get_ram_block (ram_addr_t addr) {RAMBlock *block;
@@ -1324,6 +1316,21 @@ void *qemu_get_ram_ptr(ram_addr_t addr) found: ram_list.mru_block = block; +return block; +} + +/* Return a host pointer to ram allocated with qemu_ram_alloc. +With the exception of the softmmu code in this file, this should +only be used for local memory (e.g. video ram) that the device owns, +and knows it isn't going to access beyond the end of the block. + +It should not be used for general purpose DMA. +Use cpu_physical_memory_map/cpu_physical_memory_rw instead. +*/ +void *qemu_get_ram_ptr (ram_addr_t addr) +{ +RAMBlock *block =qemu_get_ram_block (addr); +if (xen_enabled ()) {/* We need to check if the requested address is in the RAM * because we don't want to map the entire memory in QEMU.
@@ -1400,14 +1407,14 @@ static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)/* Some of the softmmu routines need to translate from a host pointer (typically a TLB entry) back to a ram offset. */ -int qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr) +MemoryRegion *qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr) {RAMBlock *block;uint8_t *host = ptr;if (xen_enabled ()) { *ram_addr =xen_ram_addr_from_mapcache (ptr); -return 0 ; +return qemu_get_ram_block (*ram_addr)->mr; } block = ram_list.mru_block;
@@ -1425,11 +1432,11 @@ int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr) } } -return -1 ; +return NULL ; found: *ram_addr = block->offset + (host - block->host); -return 0 ; +return block->mr; } static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
include/exec/cpu-common.h +1 -1
@@ -50,7 +50,7 @@ typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr);void qemu_ram_remap (ram_addr_t addr,ram_addr_t length);/* This should not be used by devices. */ -int qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr); +MemoryRegion *qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr);void qemu_ram_set_idstr (ram_addr_t addr,const char *name,DeviceState *dev); void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
target-i386/kvm.c +2 -2
@@ -318,7 +318,7 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)if ((env->mcg_cap &MCG_SER_P ) && addr && (code ==BUS_MCEERR_AR || code ==BUS_MCEERR_AO )) { -if (qemu_ram_addr_from_host (addr, &ram_addr) || +if (qemu_ram_addr_from_host (addr, &ram_addr) ==NULL || !kvm_physical_memory_addr_from_host (c->kvm_state, addr, &paddr)) {fprintf (stderr,"Hardware memory error for memory used by " "QEMU itself instead of guest system!\n" );
@@ -350,7 +350,7 @@ int kvm_arch_on_sigbus(int code, void *addr)hwaddr paddr;/* Hope we are lucky for AO MCE */ -if (qemu_ram_addr_from_host (addr, &ram_addr) || +if (qemu_ram_addr_from_host (addr, &ram_addr) ==NULL || !kvm_physical_memory_addr_from_host (CPU (first_cpu)->kvm_state, addr, &paddr)) { fprintf(stderr, "Hardware memory error for memory used by "
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 09/11] memory: return MemoryRegion from qemu_ram_addr_from_host
Quoted 125 lines · Paolo Bonzini
It will be needed in the next patches.
Signed-off-by Paolo Bonzini <[email protected]>--- cputlb.c | 2 +- exec.c | 33 ++++++++++++++++++++------------- include/exec/cpu-common.h | 2 +- target-i386/kvm.c | 4 ++-- 4 files changed, 24 insertions(+), 17 deletions(-)cputlb.c +1
-1@@ -162,7 +162,7 @@ static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) {ram_addr_t ram_addr; -if (qemu_ram_addr_from_host (ptr, &ram_addr)) { +if (qemu_ram_addr_from_host (ptr, &ram_addr) ==NULL ) {fprintf (stderr,"Bad ram pointer %p\n" , ptr);abort (); }exec.c +20
-13@@ -1296,15 +1296,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) }#endif /* !_WIN32 */ -/* Return a host pointer to ram allocated with qemu_ram_alloc. -With the exception of the softmmu code in this file, this should -only be used for local memory (e.g. video ram) that the device owns, -and knows it isn't going to access beyond the end of the block. - -It should not be used for general purpose DMA. -Use cpu_physical_memory_map/cpu_physical_memory_rw instead. -*/ -void *qemu_get_ram_ptr (ram_addr_t addr) +static RAMBlock *qemu_get_ram_block (ram_addr_t addr) {RAMBlock *block;@@ -1324,6 +1316,21 @@ void *qemu_get_ram_ptr(ram_addr_t addr) found: ram_list.mru_block = block; +return block; +} + +/* Return a host pointer to ram allocated with qemu_ram_alloc. +With the exception of the softmmu code in this file, this should +only be used for local memory (e.g. video ram) that the device owns, +and knows it isn't going to access beyond the end of the block. + +It should not be used for general purpose DMA. +Use cpu_physical_memory_map/cpu_physical_memory_rw instead. +*/ +void *qemu_get_ram_ptr (ram_addr_t addr) +{ +RAMBlock *block =qemu_get_ram_block (addr); +if (xen_enabled ()) {/* We need to check if the requested address is in the RAM * because we don't want to map the entire memory in QEMU. @@ -1400,14 +1407,14 @@ static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size)/* Some of the softmmu routines need to translate from a host pointer (typically a TLB entry) back to a ram offset. */ -int qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr) +MemoryRegion *qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr) {RAMBlock *block;uint8_t *host = ptr;if (xen_enabled ()) { *ram_addr =xen_ram_addr_from_mapcache (ptr); -return 0 ; +return qemu_get_ram_block (*ram_addr)->mr; } block = ram_list.mru_block;@@ -1425,11 +1432,11 @@ int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr) } } -return -1 ; +return NULL ; found: *ram_addr = block->offset + (host - block->host); -return 0 ; +return block->mr; } static void notdirty_mem_write(void *opaque, hwaddr ram_addr,include/exec/cpu-common.h +1
-1@@ -50,7 +50,7 @@ typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr);void qemu_ram_remap (ram_addr_t addr,ram_addr_t length);/* This should not be used by devices. */ -int qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr); +MemoryRegion *qemu_ram_addr_from_host (void *ptr,ram_addr_t *ram_addr);void qemu_ram_set_idstr (ram_addr_t addr,const char *name,DeviceState *dev); void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,target-i386/kvm.c +1
-1@@ -318,7 +318,7 @@ int kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr)if ((env->mcg_cap &MCG_SER_P ) && addr && (code ==BUS_MCEERR_AR || code ==BUS_MCEERR_AO )) { -if (qemu_ram_addr_from_host (addr, &ram_addr) || +if (qemu_ram_addr_from_host (addr, &ram_addr) ==NULL || !kvm_physical_memory_addr_from_host (c->kvm_state, addr, &paddr)) {fprintf (stderr,"Hardware memory error for memory used by " "QEMU itself instead of guest system!\n" );
target-i386/kvm.c int kvm_arch_on_sigbus(int code, void *addr) · line 356
Quoted 8 lines
target-i386/kvm.c +1
-1@@ -350,7 +350,7 @@ int kvm_arch_on_sigbus(int code, void *addr)hwaddr paddr;/* Hope we are lucky for AO MCE */ -if (qemu_ram_addr_from_host (addr, &ram_addr) || +if (qemu_ram_addr_from_host (addr, &ram_addr) ==NULL || !kvm_physical_memory_addr_from_host (CPU (first_cpu)->kvm_state, addr, &paddr)) { fprintf(stderr, "Hardware memory error for memory used by "
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
PATCH v2 10/11 exec: reorganize address_space_map
In reply to Paolo BonziniFirst of all, rename "todo" to "done".
Second, clearly separate the case of done == 0 from the case of done != 0. This will help handling reference counting in the next patch.
Third, this test:
if (memory_region_get_ram_addr(mr) + xlat != raddr + todo) {does not guarantee that the memory region is the same across two iterations of the while loop. For example, you could have two blocks:
A) size 640 K, mapped at physical address 0, ram_addr_t 0
B) size 64 K, mapped at physical address 0xa0000, ram_addr_t 0xa0000
then mapping 1 M starting at physical address zero will erroneously treat B as the continuation of block A. qemu_ram_ptr_length ensures that no invalid memory is accessed, but it is still a pointless complication of the algorithm. The patch makes the logic clearer with an explicit test that the memory region is the same.
--- exec.c | 71 +++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 33 deletions(-)
exec.c +38 -33
@@ -2073,47 +2073,52 @@ void *address_space_map(AddressSpace *as, bool is_write) {hwaddr len = *plen; -hwaddr todo =0 ; -hwaddr l, xlat; -MemoryRegion *mr; -ram_addr_t raddr =RAM_ADDR_MAX ; -ram_addr_t rlen; -void *ret; +hwaddr done =0 ; +hwaddr l, xlat, base; +MemoryRegion *mr, *this_mr; +ram_addr_t raddr; -while (len >0 ) { - l = len; - mr =address_space_translate (as, addr, &xlat, &l, is_write); - -if (!memory_access_is_direct (mr, is_write)) { -if (todo || bounce.buffer) { -break ; - } - bounce.buffer =qemu_memalign (TARGET_PAGE_SIZE ,TARGET_PAGE_SIZE ); - bounce.addr = addr; - bounce.len = l; -if (!is_write) { -address_space_read (as, addr, bounce.buffer, l); - } +if (len ==0 ) { +return NULL ; + } - *plen = l; -return bounce.buffer; + l = len; + mr =address_space_translate (as, addr, &xlat, &l, is_write); +if (!memory_access_is_direct (mr, is_write)) { +if (bounce.buffer) { +return NULL ; } -if (!todo) { - raddr =memory_region_get_ram_addr (mr) + xlat; - }else { -if (memory_region_get_ram_addr (mr) + xlat != raddr + todo) { -break ; - } + bounce.buffer =qemu_memalign (TARGET_PAGE_SIZE ,TARGET_PAGE_SIZE ); + bounce.addr = addr; + bounce.len = l; +if (!is_write) { +address_space_read (as, addr, bounce.buffer, l); } + *plen = l; +return bounce.buffer; + } + + base = xlat; + raddr =memory_region_get_ram_addr (mr); + +for (;;) { len -= l; addr += l; - todo += l; + done += l; +if (len ==0 ) { +break ; + } + + l = len; + this_mr =address_space_translate (as, addr, &xlat, &l, is_write); +if (this_mr != mr || xlat != base + done) { +break ; + } } - rlen = todo; - ret =qemu_ram_ptr_length (raddr, &rlen); - *plen = rlen; -return ret; + + *plen = done; +return qemu_ram_ptr_length (raddr + base, plen); }/* Unmaps a memory region previously mapped by address_space_map().
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 10/11] exec: reorganize address_space_map
Quoted 107 lines · Paolo Bonzini
First of all, rename "todo" to "done".
Second, clearly separate the case of done == 0 from the case of done != 0. This will help handling reference counting in the next patch.
Third, this test:
if (memory_region_get_ram_addr(mr) + xlat != raddr + todo) {does not guarantee that the memory region is the same across two iterations of the while loop. For example, you could have two blocks:
A) size 640 K, mapped at physical address 0,
ram_addr_t0
B) size 64 K, mapped at physical address0xa0000,ram_addr_t0xa0000then mapping 1 M starting at physical address zero will erroneously treat B as the continuation of block A.
qemu_ram_ptr_lengthensures that no invalid memory is accessed, but it is still a pointless complication of the algorithm. The patch makes the logic clearer with an explicit test that the memory region is the same.Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 71 +++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 33 deletions(-)exec.c +35
-29@@ -2073,47 +2073,52 @@ void *address_space_map(AddressSpace *as, bool is_write) {hwaddr len = *plen; -hwaddr todo =0 ; -hwaddr l, xlat; -MemoryRegion *mr; -ram_addr_t raddr =RAM_ADDR_MAX ; -ram_addr_t rlen; -void *ret; +hwaddr done =0 ; +hwaddr l, xlat, base; +MemoryRegion *mr, *this_mr; +ram_addr_t raddr; -while (len >0 ) { - l = len; - mr =address_space_translate (as, addr, &xlat, &l, is_write); - -if (!memory_access_is_direct (mr, is_write)) { -if (todo || bounce.buffer) { -break ; - } - bounce.buffer =qemu_memalign (TARGET_PAGE_SIZE ,TARGET_PAGE_SIZE ); - bounce.addr = addr; - bounce.len = l; -if (!is_write) { -address_space_read (as, addr, bounce.buffer, l); - } +if (len ==0 ) { +return NULL ; + } - *plen = l; -return bounce.buffer; + l = len; + mr =address_space_translate (as, addr, &xlat, &l, is_write); +if (!memory_access_is_direct (mr, is_write)) { +if (bounce.buffer) { +return NULL ; } -if (!todo) { - raddr =memory_region_get_ram_addr (mr) + xlat; - }else { -if (memory_region_get_ram_addr (mr) + xlat != raddr + todo) { -break ; - } + bounce.buffer =qemu_memalign (TARGET_PAGE_SIZE ,TARGET_PAGE_SIZE ); + bounce.addr = addr; + bounce.len = l; +if (!is_write) { +address_space_read (as, addr, bounce.buffer, l); } + *plen = l; +return bounce.buffer; + } + + base = xlat; + raddr =memory_region_get_ram_addr (mr); + +for (;;) { len -= l; addr += l; - todo += l; + done += l; +if (len ==0 ) { +break ; + } + + l = len; + this_mr =address_space_translate (as, addr, &xlat, &l, is_write); +if (this_mr != mr || xlat != base + done) { +break ; + } }
exec.c void *address_space_map(AddressSpace *as, · line 2124
Quoted 10 lines
exec.c +3
-4- rlen = todo; - ret =qemu_ram_ptr_length (raddr, &rlen); - *plen = rlen; -return ret; + + *plen = done; +return qemu_ram_ptr_length (raddr + base, plen); }/* Unmaps a memory region previously mapped by address_space_map().
The transformation looks correct, but I'm currently not understanding in which cases we still need the loop. address_space_translate should return as much of the target mr as the region can contiguously provide, no?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Re: [Qemu-devel] [PATCH v2 10/11] exec: reorganize address_space_map
Il 01/07/2013 20:34, Jan Kiszka ha scritto:
Quoted 3 lines
The transformation looks correct, but I'm currently not understanding in which cases we still need the loop.
address_space_translateshould return as much of the target mr as the region can contiguously provide, no?
You could have separate sections if, for example, two consecutive ranges map to contiguous sections but one is read-only and one is read-write.
Paolo
Jan Kiszka
Reviewed-byRe: [Qemu-devel] [PATCH v2 10/11] exec: reorganize address_space_map
Quoted 7 lines · Paolo Bonzini
Il 01/07/2013 20:34, Jan Kiszka ha scritto:
Quoted 3 lines
The transformation looks correct, but I'm currently not understanding in which cases we still need the loop.
address_space_translateshould return as much of the target mr as the region can contiguously provide, no?You could have separate sections if, for example, two consecutive ranges map to contiguous sections but one is read-only and one is read-write.
OK, makes sense. You can add my
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
PATCH v2 11/11 memory: ref/unref memory across address_space_map/unmap
In reply to Paolo BonziniThe iothread mutex might be released between map and unmap, so the mapped region might disappear.
--- exec.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
exec.c +12 -2
@@ -1994,6 +1994,7 @@ void cpu_physical_memory_write_rom(hwaddr addr, } typedef struct { + MemoryRegion *mr; void *buffer; hwaddr addr; hwaddr len;
@@ -2091,6 +2092,9 @@ void *address_space_map(AddressSpace *as, bounce.buffer =qemu_memalign (TARGET_PAGE_SIZE ,TARGET_PAGE_SIZE ); bounce.addr = addr; bounce.len = l; + +memory_region_ref (mr); + bounce.mr = mr;if (!is_write) {address_space_read (as, addr, bounce.buffer, l); }
@@ -2117,6 +2121,7 @@ void *address_space_map(AddressSpace *as, } } +memory_region_ref (mr); *plen = done;return qemu_ram_ptr_length (raddr + base, plen); }
@@ -2129,9 +2134,12 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, int is_write, hwaddr access_len) {if (buffer != bounce.buffer) { +MemoryRegion *mr; +ram_addr_t addr1; + + mr =qemu_ram_addr_from_host (buffer, &addr1); +assert (mr);if (is_write) { -ram_addr_t addr1; -qemu_ram_addr_from_host (buffer, &addr1);while (access_len) {unsigned l; l =TARGET_PAGE_SIZE ;
@@ -2145,6 +2153,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,if (xen_enabled ()) {xen_invalidate_map_cache_entry (buffer); } +memory_region_unref (mr);return ; }if (is_write) {
@@ -2152,6 +2161,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, }qemu_vfree (bounce.buffer); bounce.buffer =NULL ; +memory_region_unref (bounce.mr);cpu_notify_map_clients (); }
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH v2 11/11] memory: ref/unref memory across address_space_map/unmap
Quoted 63 lines · Paolo Bonzini
The iothread mutex might be released between map and unmap, so the mapped region might disappear.
Signed-off-by Paolo Bonzini <[email protected]>--- exec.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)exec.c +11
-2@@ -1994,6 +1994,7 @@ void cpu_physical_memory_write_rom(hwaddr addr, } typedef struct { + MemoryRegion *mr; void *buffer; hwaddr addr; hwaddr len;@@ -2091,6 +2092,9 @@ void *address_space_map(AddressSpace *as, bounce.buffer =qemu_memalign (TARGET_PAGE_SIZE ,TARGET_PAGE_SIZE ); bounce.addr = addr; bounce.len = l; + +memory_region_ref (mr); + bounce.mr = mr;if (!is_write) {address_space_read (as, addr, bounce.buffer, l); }@@ -2117,6 +2121,7 @@ void *address_space_map(AddressSpace *as, } } +memory_region_ref (mr); *plen = done;return qemu_ram_ptr_length (raddr + base, plen); }@@ -2129,9 +2134,12 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, int is_write, hwaddr access_len) {if (buffer != bounce.buffer) { +MemoryRegion *mr; +ram_addr_t addr1; + + mr =qemu_ram_addr_from_host (buffer, &addr1); +assert (mr);if (is_write) { -ram_addr_t addr1; -qemu_ram_addr_from_host (buffer, &addr1);while (access_len) {unsigned l; l =TARGET_PAGE_SIZE ;@@ -2145,6 +2153,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,if (xen_enabled ()) {xen_invalidate_map_cache_entry (buffer); } +memory_region_unref (mr);return ; }if (is_write) {
exec.c void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, · line 2167
Quoted 7 lines
exec.c +1
-0@@ -2152,6 +2161,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len, }qemu_vfree (bounce.buffer); bounce.buffer =NULL ; +memory_region_unref (bounce.mr);cpu_notify_map_clients (); }
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 5 lines · Paolo Bonzini
This series, split out of the previous attempt to set owners for memory regions, adds reference counting operations to memory regions and uses them. As requested by Peter, I'm adding an argument for the owner to all memory region creation functions.
Quoted 8 lines
The big patches to actually add the owners will come soon, since I found a decent way to split it.
Paolo
v1->v2: patches 7/11 redone and placed at the end of the series; refcount
changes foraddress_space_translateleft for a later series, they are not yet necessary; rebased on top of Jan's patches.
Do I find these patches in some git of yours as well?
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · Paolo Bonzini
This series, split out of the previous attempt to set owners for memory regions, adds reference counting operations to memory regions and uses them. As requested by Peter, I'm adding an argument for the owner to all memory region creation functions.
The big patches to actually add the owners will come soon, since I found a decent way to split it.
Quoted 7 lines
Quoted 5 lines
Paolo
v1->v2: patches 7/11 redone and placed at the end of the series; refcount
changes foraddress_space_translateleft for a later series, they are not yet necessary; rebased on top of Jan's patches.Do I find these patches in some git of yours as well?
Ah, found them in iommu-for-anthony - was initially confused by the earlier commit date.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux