sdk/emulator/qemu.git
12 years agoi8254: Open-code timer restore
Jan Kiszka [Fri, 2 Mar 2012 19:28:47 +0000 (20:28 +0100)]
i8254: Open-code timer restore

Same as for the APIC: To enable migration between accelerated and
non-accelerated models, we need to arm the channel 0 timer only inside
the emulated PIT model. The common code just saves/restores that timer
to the the next_transition_time field.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoi8254: Factor out base class for KVM reuse
Jan Kiszka [Fri, 2 Mar 2012 19:28:46 +0000 (20:28 +0100)]
i8254: Factor out base class for KVM reuse

Applying the concept used for the *PICs once again: establish a base
class for the i8254 that can be used both by the current user space
emulation and the upcoming KVM in-kernel version. We share most of the
public interface of the i8254, specifically to the pcspk, vmstate, reset
and certain init parts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoxilinx_zynq: machine model initial version
Peter A. G. Crosthwaite [Mon, 5 Mar 2012 04:39:13 +0000 (14:39 +1000)]
xilinx_zynq: machine model initial version

Xilinx zynq-7000 machine model. Also includes device model for the zynq-specific
system level control register (SLCR) module.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agocadence_gem: initial version of device model
Peter A. G. Crosthwaite [Mon, 5 Mar 2012 04:39:12 +0000 (14:39 +1000)]
cadence_gem: initial version of device model

Device model for cadence gem ethernet controller.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: John Linn <john.linn@xilinx.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agocadence_ttc: initial version of device model
Peter A. G. Crosthwaite [Mon, 5 Mar 2012 04:39:11 +0000 (14:39 +1000)]
cadence_ttc: initial version of device model

Implemented cadence Triple Timer Counter (TCC)

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: John Linn <john.linn@xilinx.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agocadence_uart: initial version of device model
Peter A. G. Crosthwaite [Mon, 5 Mar 2012 04:39:10 +0000 (14:39 +1000)]
cadence_uart: initial version of device model

Implemented cadence UART serial controller

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: John Linn <john.linn@xilinx.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agomicroblaze_boot: enabled -dtb argument
Peter A. G. Crosthwaite [Sun, 4 Mar 2012 11:03:55 +0000 (21:03 +1000)]
microblaze_boot: enabled -dtb argument

Use the -dtb argument for passing is a custom dtb rather than the old
hardcoded "mb.dtb"

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoqemu-options.hx: allow -dtb argument for all archs
Peter A. G. Crosthwaite [Sun, 4 Mar 2012 11:03:54 +0000 (21:03 +1000)]
qemu-options.hx: allow -dtb argument for all archs

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agopetalogix_s2adsp1800: macro'd magic numbers
Peter A. G. Crosthwaite [Sun, 4 Mar 2012 11:03:53 +0000 (21:03 +1000)]
petalogix_s2adsp1800: macro'd magic numbers

defined macros for the addresses of the peripherals in machine model

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agopetalogix_s2adsp1800: moved rst logic to rst fn
Peter A. G. Crosthwaite [Sun, 4 Mar 2012 11:03:52 +0000 (21:03 +1000)]
petalogix_s2adsp1800: moved rst logic to rst fn

This belongs in the machine specific reset function

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agomicroblaze: factored out common boot code
Peter A. G. Crosthwaite [Sun, 4 Mar 2012 11:03:51 +0000 (21:03 +1000)]
microblaze: factored out common boot code

factored out the copy-pasted common boot code from the two microblaze platforms
into a dedicated microblaze bootloader (microblaze_boot.o).

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoMerge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf
Blue Swirl [Mon, 5 Mar 2012 18:55:11 +0000 (18:55 +0000)]
Merge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf

* 's390-for-upstream' of git://repo.or.cz/qemu/agraf:
  Move helpers.h to helper.h
  s390: Rework kernel loading: supports elf and newer kernels

12 years agoMove helpers.h to helper.h
Lluís Vilanova [Mon, 13 Feb 2012 05:33:45 +0000 (05:33 +0000)]
Move helpers.h to helper.h

Provides a file naming scheme consistent with other targets.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agos390: Rework kernel loading: supports elf and newer kernels
Christian Borntraeger [Thu, 29 Dec 2011 23:10:26 +0000 (23:10 +0000)]
s390: Rework kernel loading: supports elf and newer kernels

This reworks the image loading on s390.

Newer kernels will not always have a 0dd0 (basr 13,0) at address 0x10000.
We must not rely on specific code at certain  addresses. This check was
introduced to warn users that tried to load vmlinux, since ELF loading
was not supported. Lets wire that up. If elf loading fails, we assume
that this is a standard kernel image and load that via load_image_targphys.
This patch also changes all other users of load_image to
load_image_targphys to be consistent. (the elf loader registers the kernel
as rom).

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agomemory: fix I/O port aliases
Avi Kivity [Mon, 5 Mar 2012 15:40:12 +0000 (17:40 +0200)]
memory: fix I/O port aliases

Commit e58ac72b6a0 ("ioport: change portio_list not to use
memory_region_set_offset()") started using aliases of I/O memory
regions.  Since the IORange used for the I/O was contained in the
target region, the alias information (specifically, the offset
into the region) was lost.  This broke -vga std.

Fix by allocating an independent object to hold the IORange and
also the new offset.

Note that I/O memory regions were conceptually broken wrt aliases
in a different way: an alias can cause the same region to appear
twice in an address space, but we had just one IORange to service it.
This patch fixes that problem as well, since we can now have multiple
IORange/MemoryRegion associations.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoioport: add destructor method to IORange
Avi Kivity [Mon, 5 Mar 2012 15:36:19 +0000 (17:36 +0200)]
ioport: add destructor method to IORange

Previously all callers had a containing object with a destructor that
could be used to trigger cleanup of the IORange objects (typically
just freeing the containing object), but a forthcoming memory API
change doesn't fit this pattern.  Rather than setting up a new global
table, extend the ioport system to support destructors.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agow64: fix type casts when calling flush_icache_range
Stefan Weil [Fri, 2 Mar 2012 22:30:07 +0000 (23:30 +0100)]
w64: fix type casts when calling flush_icache_range

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocache-utils: Change data type of parameters for flush_icache_range
Stefan Weil [Fri, 2 Mar 2012 22:30:06 +0000 (23:30 +0100)]
cache-utils: Change data type of parameters for flush_icache_range

The TCG targets i386 and tci needed a change of the function
prototype for w64.

This change is currently not needed here, but it can be applied
to avoid code differences.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agow64: Change data type of parameters for flush_icache_range
Stefan Weil [Fri, 2 Mar 2012 22:30:05 +0000 (23:30 +0100)]
w64: Change data type of parameters for flush_icache_range

The TCG targets i386 and tci needed a change of the function
prototype for w64.

This change is currently not needed for the other TCG targets,
but it can be applied to avoid code differences.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agow64: Fix data type of parameters for flush_icache_range
Stefan Weil [Fri, 2 Mar 2012 22:30:04 +0000 (23:30 +0100)]
w64: Fix data type of parameters for flush_icache_range

flush_icache_range takes two address parameters which must be large
enough to address any address of the host.

For hosts with sizeof(unsigned long) == sizeof(void *), this patch
changes nothing. All currently supported hosts fall into this category.

For w64 hosts, sizeof(unsigned long) is 4 while sizeof(void *) is 8,
so the use of tcg_target_ulong is needed for i386 and tci (the tcg
targets which work with w64).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcg: Rearrange definitions and include statements
Stefan Weil [Fri, 2 Mar 2012 22:30:03 +0000 (23:30 +0100)]
tcg: Rearrange definitions and include statements

This change makes tcg_target_ulong available in tcg-target.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agow64: Fix size of ram_addr_t
Stefan Weil [Fri, 2 Mar 2012 22:30:02 +0000 (23:30 +0100)]
w64: Fix size of ram_addr_t

ram_addr_t must be large enough to address any address of the host.

For hosts with sizeof(unsigned long) == sizeof(void *), this patch
changes nothing. All currently supported hosts fall into this category.

For w64 hosts, sizeof(unsigned long) is 4 while sizeof(void *) is 8,
so the use of uintptr_t is needed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'upstream' of git://qemu.weilnetz.de/qemu
Blue Swirl [Sat, 3 Mar 2012 17:59:06 +0000 (17:59 +0000)]
Merge branch 'upstream' of git://qemu.weilnetz.de/qemu

* 'upstream' of git://qemu.weilnetz.de/qemu:
  Move definition of HOST_LONG_BITS to qemu-common.h
  target-xtensa: Clean includes
  target-unicore32: Clean includes
  target-sh4: Clean includes
  target-s390x: Clean includes
  target-ppc: Clean includes
  target-mips: Clean includes
  target-microblaze: Clean includes
  target-m68k: Clean includes
  target-lm32: Clean includes
  target-i386: Clean includes
  target-cris: Clean includes
  target-arm: Clean includes
  target-alpha: Clean includes
  Remove macro HOST_LONG_SIZE

12 years agousb: Fix signature of stub usb_host_device_open
Jan Kiszka [Thu, 1 Mar 2012 09:43:50 +0000 (10:43 +0100)]
usb: Fix signature of stub usb_host_device_open

This was a breakage of 3741715cf2.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 3 Mar 2012 17:53:56 +0000 (17:53 +0000)]
Merge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  hw/arm11mpcore: Fix broken realview_mpcore/arm11mpcore_priv properties
  arm: add device tree support
  arm: make sure that number of irqs can be represented in GICD_TYPER.
  arm: clean up GIC constants

12 years agoMerge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa
Blue Swirl [Sat, 3 Mar 2012 17:53:41 +0000 (17:53 +0000)]
Merge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa

* 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa:
  target-xtensa: add breakpoint tests
  target-xtensa: add DEBUG_SECTION to overlay tool
  target-xtensa: add DBREAK data breakpoints
  exec: let cpu_watchpoint_insert accept larger watchpoints
  exec: fix check_watchpoint exiting cpu_loop
  exec: add missing breaks to the watch_mem_write
  target-xtensa: add ICOUNT SR and debug exception
  target-xtensa: implement instruction breakpoints
  target-xtensa: add DEBUGCAUSE SR and configuration
  target-xtensa: fetch 3rd opcode byte only when needed
  target-xtensa: implement info tlb monitor command
  target-xtensa: define TLB_TEMPLATE for MMU-less cores

12 years agohw/arm11mpcore: Fix broken realview_mpcore/arm11mpcore_priv properties
Peter Maydell [Fri, 2 Mar 2012 11:56:39 +0000 (11:56 +0000)]
hw/arm11mpcore: Fix broken realview_mpcore/arm11mpcore_priv properties

Fix confusion in the Property arrays for the "arm11mpcore_priv"
(per-CPU devices for the ARM11MPcore CPU) and "realview_mpcore"
(realview-eb board specific device encapsulating CPU and some
extra interrupt controllers) -- the num-irq property was defined
on the wrong device and the mpcore_rirq_properties were defined
as offsets in the wrong structure. The effect was that the
realview-eb-mpcore machine would abort on startup trying to
allocate an insane amount of memory. (This bug was introduced in
the QOM conversion in commit 999e12bb.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoarm: add device tree support
Grant Likely [Fri, 2 Mar 2012 11:56:38 +0000 (11:56 +0000)]
arm: add device tree support

If compiled with CONFIG_FDT, allow user to specify a device tree file using
the -dtb argument.  If the machine supports it then the dtb will be loaded
into memory and passed to the kernel on boot.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
[Peter Maydell: Use machine opt rather than global to pass dtb filename]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoarm: make sure that number of irqs can be represented in GICD_TYPER.
Rusty Russell [Fri, 2 Mar 2012 11:56:38 +0000 (11:56 +0000)]
arm: make sure that number of irqs can be represented in GICD_TYPER.

We currently assume that the number of interrupts (ITLinesNumber in
the architecture reference manual) is divisible by 32, since we
present it to the guest when it reads GICD_TYPER (in gic_dist_readb())
as (N / 32) - 1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoarm: clean up GIC constants
Rusty Russell [Fri, 2 Mar 2012 11:56:38 +0000 (11:56 +0000)]
arm: clean up GIC constants

Interrupts numbers 0-31 are private to the processor interface, 32-1019 are
general interrupts.  Add GIC_INTERNAL and substitute everywhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
[Peter Maydell: converted some tabs to spaces]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoMerge remote-tracking branch 'qemu-kvm/memory/urgent' into staging
Anthony Liguori [Thu, 1 Mar 2012 21:26:55 +0000 (15:26 -0600)]
Merge remote-tracking branch 'qemu-kvm/memory/urgent' into staging

* qemu-kvm/memory/urgent:
  kvm: fix unaligned slots

12 years agoMerge remote-tracking branch 'qemu-kvm/memory/core' into staging
Anthony Liguori [Thu, 1 Mar 2012 21:26:25 +0000 (15:26 -0600)]
Merge remote-tracking branch 'qemu-kvm/memory/core' into staging

* qemu-kvm/memory/core: (30 commits)
  memory: allow phys_map tree paths to terminate early
  memory: unify PhysPageEntry::node and ::leaf
  memory: change phys_page_set() to set multiple pages
  memory: switch phys_page_set() to a recursive implementation
  memory: replace phys_page_find_alloc() with phys_page_set()
  memory: simplify multipage/subpage registration
  memory: give phys_page_find() its own tree search loop
  memory: make phys_page_find() return a MemoryRegionSection
  memory: move tlb flush to MemoryListener commit callback
  memory: unify the two branches of cpu_register_physical_memory_log()
  memory: fix RAM subpages in newly initialized pages
  memory: compress phys_map node pointers to 16 bits
  memory: store MemoryRegionSection pointers in phys_map
  memory: unify phys_map last level with intermediate levels
  memory: remove first level of l1_phys_map
  memory: change memory registration to rebuild the memory map on each change
  memory: support stateless memory listeners
  memory: split memory listener for the two address spaces
  xen: ignore I/O memory regions
  memory: allow MemoryListeners to observe a specific address space
  ...

12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Thu, 1 Mar 2012 21:26:01 +0000 (15:26 -0600)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  pc-bios: update kvmvapic.bin
  kvmvapic: Use optionrom helpers
  optionsrom: Reserve space for checksum
  kvmvapic: Simplify mp/up_set_tpr
  kvmvapic: Introduce TPR access optimization for Windows guests
  kvmvapic: Add option ROM
  target-i386: Add infrastructure for reporting TPR MMIO accesses
  Allow to use pause_all_vcpus from VCPU context
  Process pending work while waiting for initial kick-off in TCG mode
  Remove useless casts from cpu iterators
  kvm: Set cpu_single_env only once
  kvm: Synchronize cpu state in kvm_arch_stop_on_emulation_error()

12 years agokvm: fix unaligned slots
Avi Kivity [Wed, 29 Feb 2012 11:22:12 +0000 (13:22 +0200)]
kvm: fix unaligned slots

kvm_set_phys_mem() may be passed sections that are not aligned to a page
boundary.  The current code simply brute-forces the alignment which leads
to an inconsistency and an abort().

Fix by aligning the start and the end of the section correctly, discarding
and unaligned head or tail.

This was triggered by a guest sizing a 64-bit BAR that is smaller than a page
with PCI_COMMAND_MEMORY enabled and the upper dword clear.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agopc-bios: update kvmvapic.bin
Avi Kivity [Thu, 1 Mar 2012 10:58:46 +0000 (12:58 +0200)]
pc-bios: update kvmvapic.bin

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Wed, 29 Feb 2012 18:57:28 +0000 (12:57 -0600)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (27 commits)
  qemu-img: fix segment fault when the image format is qed
  qemu-io: fix segment fault when the image format is qed
  qemu-tool: revert cpu_get_clock() abort(3)
  qemu-iotests: Test rebase with short backing file
  qemu-iotests: 026: Reduce output changes for cache=none qcow2
  qemu-iotests: Filter out DOS line endings
  test: add image streaming tests
  qemu-iotests: add iotests Python module
  qemu-iotests: export TEST_DIR for non-bash tests
  QMP: Add qmp command for blockdev-group-snapshot-sync
  qapi: Introduce blockdev-group-snapshot-sync command
  qcow2: Reject too large header extensions
  qcow2: Fix offset in qcow2_read_extensions
  block: drop aio_multiwrite in BlockDriver
  block: remove unused fields in BlockDriverState
  qcow2: Fix build with DEBUG_EXT enabled
  ide: fail I/O to empty disk
  fdc: DIR (Digital Input Register) should return status of current drive...
  fdc: fix seek command, which shouldn't check tracks
  fdc: check if media rate is correct before doing any transfer
  ...

12 years agoMerge remote-tracking branch 'spice/spice.v49' into staging
Anthony Liguori [Wed, 29 Feb 2012 18:54:08 +0000 (12:54 -0600)]
Merge remote-tracking branch 'spice/spice.v49' into staging

* spice/spice.v49:
  qxl: properly handle upright and non-shared surfaces
  Error out when tls-channel option is used without TLS
  spice: use error_report to report errors
  qxl: add optinal 64bit vram bar
  qxl: make qxl_render_update async
  qxl: introduce QXLCookie
  qxl: remove flipped
  qxl: require spice >= 0.8.2
  qxl: drop qxl_spice_update_area_async definition
  sdl: remove NULL check, g_malloc0 can't fail
  qxl: fix spice+sdl no cursor regression

12 years agoMerge remote-tracking branch 'kraxel/usb.39' into staging
Anthony Liguori [Wed, 29 Feb 2012 15:11:00 +0000 (09:11 -0600)]
Merge remote-tracking branch 'kraxel/usb.39' into staging

* kraxel/usb.39: (21 commits)
  usb: Resolve warnings about unassigned bus on usb device creation
  usb-redir: Return USB_RET_NAK when we've no data for an interrupt endpoint
  usb-redir: Limit return values returned by iso packets
  usb-redir: Let the usb-host know about our device filtering
  usb-redir: Always clear device state on filter reject
  usb-redir: Fix printing of device version
  ehci: drop old stuff
  usb-ehci: Handle ISO packets failing with an error other then NAK
  libcacard: fix reported ATR length
  usb-ccid: advertise SELF_POWERED
  libcacard: link with glib for g_strndup
  usb-desc: fix user trigerrable segfaults (!config)
  usb-ehci: sanity-check iso xfers
  usb: add tracepoint for usb packet state changes.
  usb-xhci: enable packet queuing
  usb-uhci: implement packet queuing
  usb-uhci: process uhci_handle_td return code via switch.
  usb-uhci: add UHCIQueue
  usb-uhci: cleanup UHCIAsync allocation & initialization.
  usb-ehci: fix reset
  ...

12 years agoqemu-img: fix segment fault when the image format is qed
Zhi Yong Wu [Sun, 19 Feb 2012 14:24:35 +0000 (22:24 +0800)]
qemu-img: fix segment fault when the image format is qed

[root@f15 qemu]# qemu-img info /home/zwu/work/misc/rh6.img
image: /home/zwu/work/misc/rh6.img
file format: qed
virtual size: 4.0G (4294967296 bytes)
disk size: 1.2G
cluster_size: 65536
Segmentation fault (core dumped)

Today when i were fixing another issue, i found this issue; After simple
investigation, i found that the required clock vm_clock is not created
for qemu tool.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-io: fix segment fault when the image format is qed
Zhi Yong Wu [Sun, 19 Feb 2012 14:24:59 +0000 (22:24 +0800)]
qemu-io: fix segment fault when the image format is qed

[root@f15 qemu]# qemu-io -c info /home/zwu/work/misc/rh6.img
format name: qed
cluster size: 64 KiB
vm state offset: 0.000000 bytes
Segmentation fault (core dumped)

This reason is same as the former patch

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-tool: revert cpu_get_clock() abort(3)
Stefan Hajnoczi [Wed, 29 Feb 2012 14:41:32 +0000 (14:41 +0000)]
qemu-tool: revert cpu_get_clock() abort(3)

Despite the fact that the qemu-tool environment has no guest running and
vm_clock therefore does not make sense, there is code that gets the
vm_clock time even in qemu-tool.  Therefore, revert the abort(3) call
and just return 0 like we used to.  This unbreaks qemu-img/qemu-io with
QED and Kevin has also expressed interest in this for qcow2.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: Test rebase with short backing file
Kevin Wolf [Wed, 15 Feb 2012 14:03:25 +0000 (15:03 +0100)]
qemu-iotests: Test rebase with short backing file

This tests that qemu-img rebase doesn't assume that the backing file has
the same size as the image, but considers that it can be smaller.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqemu-iotests: 026: Reduce output changes for cache=none qcow2
Kevin Wolf [Fri, 29 Apr 2011 13:32:55 +0000 (15:32 +0200)]
qemu-iotests: 026: Reduce output changes for cache=none qcow2

qemu-iotests supports the -nocache option which makes the tests run with
cache=none. For blkdebug tests with qcow2 this means that we may see
test results that differ from cache=writethrough. This patch makes the
diff a bit smaller and therefore easier to review.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqemu-iotests: Filter out DOS line endings
Kevin Wolf [Fri, 29 Apr 2011 13:30:25 +0000 (15:30 +0200)]
qemu-iotests: Filter out DOS line endings

This one makes it possible to run qemu-iotests on a Windows build using Wine
and get somewhat meaningful results.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotest: add image streaming tests
Stefan Hajnoczi [Wed, 29 Feb 2012 13:25:22 +0000 (13:25 +0000)]
test: add image streaming tests

This patch adds a test suite for the image streaming feature.  It
exercises the 'block_stream', 'block_job_cancel', 'block_job_set_speed',
and 'query-block-jobs' QMP commands.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: add iotests Python module
Stefan Hajnoczi [Wed, 29 Feb 2012 13:25:21 +0000 (13:25 +0000)]
qemu-iotests: add iotests Python module

Block layer tests that involve QMP commands rather than qemu-img or
qemu-io are not well-suited for shell scripting.  This patch adds a
Python module which allows tests to be written in Python instead.

The basic API is:

  VM          - class for launching and interacting with a VM
  QMPTestCase - abstract base class for tests that use QMP
  qemu_img()  - wrapper function for invoking qemu-img
  qemu_io()   - wrapper function for invoking qemu-io
  imgfmt      - the image format under test (e.g. qcow2, qed)
  test_dir    - scratch directory path for temporary files
  main()      - entry point for running tests

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: export TEST_DIR for non-bash tests
Stefan Hajnoczi [Wed, 29 Feb 2012 13:25:20 +0000 (13:25 +0000)]
qemu-iotests: export TEST_DIR for non-bash tests

Since qemu-iotests may need to create large image files it is possible
to specify the test directory.  The TEST_DIR variable needs to be
exported so non-bash tests can make use of it.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoQMP: Add qmp command for blockdev-group-snapshot-sync
Jeff Cody [Tue, 28 Feb 2012 20:54:07 +0000 (15:54 -0500)]
QMP: Add qmp command for blockdev-group-snapshot-sync

This adds the QMP command for blockdev-group-snapshot-sync. It
takes an array in as the input, for the argument devlist.  The
array consists of the following elements:

    + device:        device to snapshot. e.g. "ide-hd0", "virtio0"
    + snapshot-file: path & file for the snapshot image. e.g. "/tmp/file.img"
    + format:        snapshot format. e.g., "qcow2". Optional

There is no HMP equivalent for the command.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqapi: Introduce blockdev-group-snapshot-sync command
Jeff Cody [Tue, 28 Feb 2012 20:54:06 +0000 (15:54 -0500)]
qapi: Introduce blockdev-group-snapshot-sync command

This is a QAPI/QMP only command to take a snapshot of a group of
devices. This is similar to the blockdev-snapshot-sync command, except
blockdev-group-snapshot-sync accepts a list devices, filenames, and
formats.

It is attempted to keep the snapshot of the group atomic; if the
creation or open of any of the new snapshots fails, then all of
the new snapshots are abandoned, and the name of the snapshot image
that failed is returned.  The failure case should not interrupt
any operations.

Rather than use bdrv_close() along with a subsequent bdrv_open() to
perform the pivot, the original image is never closed and the new
image is placed 'in front' of the original image via manipulation
of the BlockDriverState fields.  Thus, once the new snapshot image
has been successfully created, there are no more failure points
before pivoting to the new snapshot.

This allows the group of disks to remain consistent with each other,
even across snapshot failures.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Reject too large header extensions
Kevin Wolf [Wed, 22 Feb 2012 11:37:13 +0000 (12:37 +0100)]
qcow2: Reject too large header extensions

Image files that make qemu-img info read several gigabytes into the
unknown header extensions list are bad. Just fail opening the image
if an extension claims to be larger than the header extension area.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqcow2: Fix offset in qcow2_read_extensions
Kevin Wolf [Wed, 22 Feb 2012 11:31:47 +0000 (12:31 +0100)]
qcow2: Fix offset in qcow2_read_extensions

The spec says that the length of extensions is padded to 8 bytes, not
the offset. Currently this is the same because the header size is a
multiple of 8, so this is only about compatibility with future changes
to the header size.

While touching it, move the calculation to a common place instead of
duplicating it for each header extension type.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoblock: drop aio_multiwrite in BlockDriver
Paolo Bonzini [Tue, 21 Feb 2012 15:43:52 +0000 (16:43 +0100)]
block: drop aio_multiwrite in BlockDriver

These were never used.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: remove unused fields in BlockDriverState
Paolo Bonzini [Mon, 20 Feb 2012 16:58:34 +0000 (17:58 +0100)]
block: remove unused fields in BlockDriverState

sync_aiocb is unused since commit ce1a14d (Dynamically allocate AIO
Completion Blocks., 2006-08-07).

private is unused since commit 56a1493 (drive cleanup fixes., 2009-09-25).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Fix build with DEBUG_EXT enabled
Kevin Wolf [Fri, 17 Feb 2012 17:45:33 +0000 (18:45 +0100)]
qcow2: Fix build with DEBUG_EXT enabled

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide: fail I/O to empty disk
Paolo Bonzini [Wed, 15 Feb 2012 10:46:11 +0000 (11:46 +0100)]
ide: fail I/O to empty disk

Requesting a read or a write operation on an empty disk can lead
to QEMU dumping core.

Also fix a few braces here and there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: DIR (Digital Input Register) should return status of current drive...
Hervé Poussineau [Mon, 6 Feb 2012 21:29:12 +0000 (22:29 +0100)]
fdc: DIR (Digital Input Register) should return status of current drive...

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix seek command, which shouldn't check tracks
Hervé Poussineau [Mon, 6 Feb 2012 21:29:11 +0000 (22:29 +0100)]
fdc: fix seek command, which shouldn't check tracks

The seek command just sends step pulses to the drive and doesn't care if
there is a medium inserted of if it is banging the head against the drive.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: check if media rate is correct before doing any transfer
Hervé Poussineau [Mon, 6 Feb 2012 21:29:10 +0000 (22:29 +0100)]
fdc: check if media rate is correct before doing any transfer

The programmed rate has to be the same as the required rate for the
floppy format ; if that's not the case, the transfer should abort.
This check can be disabled by using the 'check_media_rate' property.

Save media rate value only if media rate check is enabled.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: add a 'check media rate' property. Not used yet
Hervé Poussineau [Mon, 6 Feb 2012 21:29:09 +0000 (22:29 +0100)]
fdc: add a 'check media rate' property. Not used yet

Set it to true for current Qemu versions, and false for previous ones

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: add a transfer rate for floppy types
Hervé Poussineau [Mon, 6 Feb 2012 21:29:07 +0000 (22:29 +0100)]
block: add a transfer rate for floppy types

Floppies must be read at a specific transfer rate, depending of its own format.
Update floppy description table to include required transfer rate.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: add CCR (Configuration Control Register) write register
Hervé Poussineau [Mon, 6 Feb 2012 21:29:06 +0000 (22:29 +0100)]
fdc: add CCR (Configuration Control Register) write register

DIR and CCR registers share the same address ; DIR is read-only
while CCR is write-only

CCR register is used to change media transfer rate, which will be
checked in following changes.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: handle read-only floppies (abort early on write commands)
Hervé Poussineau [Mon, 6 Feb 2012 21:29:05 +0000 (22:29 +0100)]
fdc: handle read-only floppies (abort early on write commands)

A real floppy doesn't attempt to write to read-only media either.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: most control commands do not generate interrupts
Hervé Poussineau [Mon, 6 Feb 2012 21:29:04 +0000 (22:29 +0100)]
fdc: most control commands do not generate interrupts

In fact, only three control commands generate an interrupt:
read_id, recalibrate and seek

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: set busy bit when starting a command
Hervé Poussineau [Mon, 6 Feb 2012 21:29:03 +0000 (22:29 +0100)]
fdc: set busy bit when starting a command

This bit must be active while a command is currently executed.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: take side count into account
Hervé Poussineau [Mon, 6 Feb 2012 21:29:02 +0000 (22:29 +0100)]
fdc: take side count into account

Floppies can be simple or double-sided. However, current code
was only taking the common case into account (ie 2 sides).

This repairs single-sided floppies, which where totally broken
before this patch : for track > 0, wrong sector number was
calculated, and data was read/written at wrong place on
underlying device.

Fortunately, only some 360 kB floppies are single-sided, so
this bug was probably not seen much.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agomemory: allow phys_map tree paths to terminate early
Avi Kivity [Mon, 13 Feb 2012 18:45:32 +0000 (20:45 +0200)]
memory: allow phys_map tree paths to terminate early

When storing large contiguous ranges in phys_map, all values tend to
be the same pointers to a single MemoryRegionSection.  Collapse them
by marking nodes with level > 0 as leaves.  This reduces tree memory
usage dramatically.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: unify PhysPageEntry::node and ::leaf
Avi Kivity [Mon, 13 Feb 2012 18:25:31 +0000 (20:25 +0200)]
memory: unify PhysPageEntry::node and ::leaf

They have the same type, unify them.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: change phys_page_set() to set multiple pages
Avi Kivity [Mon, 13 Feb 2012 18:21:20 +0000 (20:21 +0200)]
memory: change phys_page_set() to set multiple pages

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: switch phys_page_set() to a recursive implementation
Avi Kivity [Mon, 13 Feb 2012 18:12:05 +0000 (20:12 +0200)]
memory: switch phys_page_set() to a recursive implementation

Setting multiple pages at once requires backtracking to previous
nodes; easiest to achieve via recursion.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: replace phys_page_find_alloc() with phys_page_set()
Avi Kivity [Mon, 13 Feb 2012 15:19:30 +0000 (17:19 +0200)]
memory: replace phys_page_find_alloc() with phys_page_set()

By giving the function the value we want to set, we make it
more flexible for the next patch.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: simplify multipage/subpage registration
Avi Kivity [Mon, 13 Feb 2012 15:14:32 +0000 (17:14 +0200)]
memory: simplify multipage/subpage registration

Instead of considering subpage on a per-page basis, split each section
into a subpage head, multipage body, and subpage tail, and register
each separately.  This simplifies the registration functions.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: give phys_page_find() its own tree search loop
Avi Kivity [Mon, 13 Feb 2012 14:44:19 +0000 (16:44 +0200)]
memory: give phys_page_find() its own tree search loop

We'll change phys_page_find_alloc() soon, but phys_page_find()
doesn't need to bear the consequences.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: make phys_page_find() return a MemoryRegionSection
Avi Kivity [Mon, 13 Feb 2012 14:11:22 +0000 (16:11 +0200)]
memory: make phys_page_find() return a MemoryRegionSection

We no longer describe memory in terms of individual pages; use sections
throughout instead.

PhysPageDesc no longer used - remove.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: move tlb flush to MemoryListener commit callback
Avi Kivity [Sun, 12 Feb 2012 19:23:17 +0000 (21:23 +0200)]
memory: move tlb flush to MemoryListener commit callback

This way, if we have several changes in a single transaction, we flush just
once.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: unify the two branches of cpu_register_physical_memory_log()
Avi Kivity [Sun, 12 Feb 2012 19:21:21 +0000 (21:21 +0200)]
memory: unify the two branches of cpu_register_physical_memory_log()

Identical except that the second branch knows its not modifying an existing
subpage.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: fix RAM subpages in newly initialized pages
Avi Kivity [Sun, 12 Feb 2012 19:10:50 +0000 (21:10 +0200)]
memory: fix RAM subpages in newly initialized pages

If the first subpage installed in a page is RAM, then we install it as
a full page, instead of a subpage.  Fix by not special casing RAM.

The issue dates to commit db7b5426a4b4242, which introduced subpages.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: compress phys_map node pointers to 16 bits
Avi Kivity [Sun, 12 Feb 2012 18:12:49 +0000 (20:12 +0200)]
memory: compress phys_map node pointers to 16 bits

Use an expanding vector to store nodes.  Allocation is baroque to g_renew()
potentially invalidating pointers; this will be addressed later.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: store MemoryRegionSection pointers in phys_map
Avi Kivity [Sun, 12 Feb 2012 16:32:55 +0000 (18:32 +0200)]
memory: store MemoryRegionSection pointers in phys_map

Instead of storing PhysPageDesc, store pointers to MemoryRegionSections.
The various offsets (phys_offset & ~TARGET_PAGE_MASK,
PHYS_OFFSET & TARGET_PAGE_MASK, region_offset) can all be synthesized
from the information in a MemoryRegionSection.  Adjust phys_page_find()
to synthesize a PhysPageDesc.

The upshot is that phys_map now contains uniform values, so it's easier
to generate and compress.

The end result is somewhat clumsy but this will be improved as we we
propagate MemoryRegionSections throughout the code instead of transforming
them to PhysPageDesc.

The MemoryRegionSection pointers are stored as uint16_t offsets in an
array.  This saves space (when we also compress node pointers) and is
more cache friendly.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: unify phys_map last level with intermediate levels
Avi Kivity [Fri, 10 Feb 2012 15:00:01 +0000 (17:00 +0200)]
memory: unify phys_map last level with intermediate levels

This lays the groundwork for storing leaf data in intermediate levels,
saving space.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: remove first level of l1_phys_map
Avi Kivity [Fri, 10 Feb 2012 12:57:31 +0000 (14:57 +0200)]
memory: remove first level of l1_phys_map

L1 and the lower levels in l1_phys_map are equivalent, except that L1 has
a different size, and is always allocated.  Simplify the code by removing
L1.  This leaves us with a tree composed solely of L2 tables, but that
problem can be renamed away later.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: change memory registration to rebuild the memory map on each change
Avi Kivity [Thu, 9 Feb 2012 15:34:32 +0000 (17:34 +0200)]
memory: change memory registration to rebuild the memory map on each change

Instead of incrementally building the memory map, rebuild it every time.
This allows later simplification, since the code need not consider overlaying
a previous mapping.  It is also RCU friendly.

With large memory guests this can get expensive, since the operation is
O(mem size), but this will be optimized later.

As a side effect subpage and L2 leaks are fixed here.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: support stateless memory listeners
Avi Kivity [Wed, 8 Feb 2012 19:36:02 +0000 (21:36 +0200)]
memory: support stateless memory listeners

Current memory listeners are incremental; that is, they are expected to
maintain their own state, and receive callbacks for changes to that state.

This patch adds support for stateless listeners; these work by receiving
a ->begin() callback (which tells them that new state is coming), a
sequence of ->region_add() and ->region_nop() callbacks, and then a
->commit() callback which signifies the end of the new state.  They should
ignore ->region_del() callbacks.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: split memory listener for the two address spaces
Avi Kivity [Wed, 8 Feb 2012 19:16:05 +0000 (21:16 +0200)]
memory: split memory listener for the two address spaces

The memory and I/O address spaces do different things, so split them into
two memory listeners.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoxen: ignore I/O memory regions
Avi Kivity [Wed, 8 Feb 2012 19:10:42 +0000 (21:10 +0200)]
xen: ignore I/O memory regions

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: allow MemoryListeners to observe a specific address space
Avi Kivity [Wed, 8 Feb 2012 19:05:17 +0000 (21:05 +0200)]
memory: allow MemoryListeners to observe a specific address space

Ignore any regions not belonging to a specified address space.

Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomemory: drop AddressSpaceOps
Avi Kivity [Wed, 8 Feb 2012 15:19:46 +0000 (17:19 +0200)]
memory: drop AddressSpaceOps

All functionality has been moved to various MemoryListeners.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agomemory: use a MemoryListener for core memory map updates too
Avi Kivity [Wed, 8 Feb 2012 14:54:16 +0000 (16:54 +0200)]
memory: use a MemoryListener for core memory map updates too

This transforms memory.c into a library which can then be unit tested
easily, by feeding it inputs and listening to its outputs.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agomemory: don't pass ->readable attribute to cpu_register_physical_memory_log
Avi Kivity [Wed, 8 Feb 2012 15:07:26 +0000 (17:07 +0200)]
memory: don't pass ->readable attribute to cpu_register_physical_memory_log

It can be derived from the MemoryRegion itself (which is why it is not
used there).

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agomemory: add a readonly attribute to MemoryRegionSection
Avi Kivity [Wed, 8 Feb 2012 15:01:23 +0000 (17:01 +0200)]
memory: add a readonly attribute to MemoryRegionSection

.readonly cannot be obtained from the MemoryRegion, since it is
inherited from aliases (so you can have a MemoryRegion mapped RW
at one address and RO at another).  Record it in a MemoryRegionSection
for listeners.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agomemory: move ioeventfd ops to MemoryListener
Avi Kivity [Wed, 8 Feb 2012 14:39:06 +0000 (16:39 +0200)]
memory: move ioeventfd ops to MemoryListener

This way the accelerator (kvm) can handle them directly.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agomemory: code motion: move MEMORY_LISTENER_CALL()
Avi Kivity [Wed, 8 Feb 2012 14:39:45 +0000 (16:39 +0200)]
memory: code motion: move MEMORY_LISTENER_CALL()

So it can be used in earlier code.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agomemory: switch memory listeners to a QTAILQ
Avi Kivity [Wed, 8 Feb 2012 13:05:50 +0000 (15:05 +0200)]
memory: switch memory listeners to a QTAILQ

This allows reverse iteration, which in turns allows consistent ordering
among multiple listeners:

  l1->add
  l2->add
  l2->del
  l1->del

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agomemory: add shorthand for invoking a callback on all listeners
Avi Kivity [Wed, 8 Feb 2012 11:58:44 +0000 (13:58 +0200)]
memory: add shorthand for invoking a callback on all listeners

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agomemory: remove memory_region_set_offset()
Avi Kivity [Sun, 8 Jan 2012 17:51:35 +0000 (19:51 +0200)]
memory: remove memory_region_set_offset()

memory_region_set_offset() complicates the API, and has been deprecated
since its introduction.  Now that it is no longer used, remove it.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agoioport: change portio_list not to use memory_region_set_offset()
Avi Kivity [Sun, 8 Jan 2012 17:46:17 +0000 (19:46 +0200)]
ioport: change portio_list not to use memory_region_set_offset()

memory_region_set_offset() will be going away soon, so don't use it.
Use an alias instead.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
12 years agoMove definition of HOST_LONG_BITS to qemu-common.h
Stefan Weil [Wed, 1 Feb 2012 20:04:13 +0000 (21:04 +0100)]
Move definition of HOST_LONG_BITS to qemu-common.h

Like the related macro TCG_TARGET_LONG, HOST_LONG_BITS can be determined
by the C preprocessor. It is also not used in Makefiles.

So there is no need to calculate it in configure, and it can be defined
in qemu-common.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotarget-xtensa: Clean includes
Stefan Weil [Thu, 2 Feb 2012 20:48:08 +0000 (21:48 +0100)]
target-xtensa: Clean includes

Remove some include statements which are not needed.

Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotarget-unicore32: Clean includes
Stefan Weil [Thu, 2 Feb 2012 20:47:01 +0000 (21:47 +0100)]
target-unicore32: Clean includes

The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotarget-sh4: Clean includes
Stefan Weil [Thu, 2 Feb 2012 20:44:38 +0000 (21:44 +0100)]
target-sh4: Clean includes

Remove some include statements which are not needed.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotarget-s390x: Clean includes
Stefan Weil [Wed, 1 Feb 2012 19:56:52 +0000 (20:56 +0100)]
target-s390x: Clean includes

The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>