sdk/emulator/qemu.git
10 years agokvm: initialize qemu_host_page_size
Alexey Kardashevskiy [Fri, 17 Jan 2014 18:12:07 +0000 (11:12 -0700)]
kvm: initialize qemu_host_page_size

There is a HOST_PAGE_ALIGN macro which makes sense for KVM accelerator
but it uses qemu_host_page_size/qemu_host_page_mask which initialized
for TCG only.

This moves qemu_host_page_size/qemu_host_page_mask initialization from
TCG's page_init() and adds a call for it from kvm_init().

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agovfio-pci: Fail initfn on DMA mapping errors
Alex Williamson [Thu, 16 Jan 2014 16:22:07 +0000 (09:22 -0700)]
vfio-pci: Fail initfn on DMA mapping errors

The vfio-pci initfn will currently succeed even if DMA mappings fail.
A typical reason for failure is if the user does not have sufficient
privilege to lock all the memory for the guest.  In this case, the
device gets attached, but can only access a portion of guest memory
and is extremely unlikely to work.

DMA mappings are done via a MemoryListener, which provides no direct
error return path.  We therefore stuff the errno into our container
structure and check for error after registration completes.  We can
also test for mapping errors during runtime, but our only option for
resolution at that point is to kill the guest with a hw_error.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agovfio: Filter out bogus mappings
Alex Williamson [Thu, 16 Jan 2014 16:22:07 +0000 (09:22 -0700)]
vfio: Filter out bogus mappings

Since 57271d63 we now see spurious mappings with the upper bits set
if 64bit PCI BARs are sized while enabled.  The guest writes a mask
of 0xffffffff to the lower BAR to size it, then restores it, then
writes the same mask to the upper BAR resulting in a spurious BAR
mapping into the last 4G of the 64bit address space.  Most
architectures do not support or make use of the full 64bits address
space for PCI BARs, so we filter out mappings with the high bit set.
Long term, we probably need to think about vfio telling us the
address width limitations of the IOMMU.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovfio: Do not reattempt a failed rom read
Bandan Das [Wed, 15 Jan 2014 17:11:52 +0000 (10:11 -0700)]
vfio: Do not reattempt a failed rom read

During lazy rom loading, if rom read fails, and the
guest attempts a read again, vfio will again attempt it.
Add a boolean to prevent this. There could be a case where
a failed rom read might succeed the next time because of
a device reset or such, but it's best to exclude unpredictable
behavior

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agovfio: warn if host device rom can't be read
Bandan Das [Wed, 15 Jan 2014 17:11:06 +0000 (10:11 -0700)]
vfio: warn if host device rom can't be read

If the device rom can't be read, report an error to the
user. This alerts the user that the device has a bad
state that is causing rom read failure or option rom
loading has been disabled from the device boot menu
(among other reasons).

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agovfio: Destroy memory regions
Alex Williamson [Wed, 15 Jan 2014 17:07:26 +0000 (10:07 -0700)]
vfio: Destroy memory regions

Somehow this has been lurking for a while; we remove our subregions
from the base BAR and VGA region mappings, but we don't destroy them,
creating a leak and more serious problems when we try to migrate after
removing these devices.  Add the trivial bit of final cleanup to
remove these entirely.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
10 years agoSPARC: Fix LEON3 power down instruction
Sebastian Huber [Wed, 27 Nov 2013 07:50:11 +0000 (08:50 +0100)]
SPARC: Fix LEON3 power down instruction

Synchronize the program counter before the power down helper call
otherwise interrupts will return to the wrong context.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoerror: Don't use error_report() for assertion msgs.
Peter Crosthwaite [Wed, 15 Jan 2014 03:37:09 +0000 (19:37 -0800)]
error: Don't use error_report() for assertion msgs.

Use fprintf(stderr instead. This removes dependency of libqemuutil.a
on the monitor.

We can further justify this change, in that this code path should only
trigger under a fatal error condition. fprintf-stderr is probably the
appropriate medium as under a fatal error conidition the monitor itself
may be down and out for the count. So assertion failure messages should
go lowest common denominator - straight to stderr.

Fixes the build as reported by Kevin Wolf. Issue debugged and change
suggested by Luiz Capitulino. Issue introduced by
5d24ee70bcbcf578614193526bcd5ed30a8eb16c.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoMerge remote branch 'luiz/queue/qmp' into qmpq
Edgar E. Iglesias [Tue, 14 Jan 2014 02:09:59 +0000 (12:09 +1000)]
Merge remote branch 'luiz/queue/qmp' into qmpq

* luiz/queue/qmp:
  migration: qmp_migrate(): keep working after syntax error
  qerror: Remove assert_no_error()
  qemu-option: Remove qemu_opts_create_nofail
  target-i386: Remove assert_no_error usage
  hw: Remove assert_no_error usages
  qdev: Delete dead code
  error: Add error_abort
  monitor: add object-add (QMP) and object_add (HMP) command
  monitor: add object-del (QMP) and object_del (HMP) command
  qom: catch errors in object_property_add_child
  qom: fix leak for objects created with -object
  rng: initialize file descriptor to -1
  qemu-monitor: HMP cpu-add wrapper
  vl: add missing transition debug->finish_migrate

Message-Id: 1389045795-18706-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoMicroblaze: Convert Microblaze-pic handling to GPIOs
Alistair Francis [Mon, 13 Jan 2014 03:35:26 +0000 (13:35 +1000)]
Microblaze: Convert Microblaze-pic handling to GPIOs

This patch uses inbound GPIO lines (IRQ and FIR) for
interrupts instead of using the old pic_cpu method,
which doesn't correspond to real hardware.

This creates the CPU's inbound IRQ and FIR GPIO lines and
updates the Microblaze boards to use this new method.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Suggested-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reveiwed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agotarget-arm: Switch ARMCPUInfo arrays to use terminator entries
Peter Maydell [Mon, 13 Jan 2014 10:26:16 +0000 (10:26 +0000)]
target-arm: Switch ARMCPUInfo arrays to use terminator entries

Switch the ARMCPUInfo arrays in cpu.c and cpu64.c to use a terminator
entry rather than looping based on ARRAY_SIZE. The latter causes
compile warnings on some versions of gcc if the configure options
happen to result in an empty array.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10 years agoMerge remote-tracking branch 'quintela/tags/migration/20140113' into staging
Anthony Liguori [Mon, 13 Jan 2014 21:20:49 +0000 (13:20 -0800)]
Merge remote-tracking branch 'quintela/tags/migration/20140113' into staging

migration.next for 20140113

# gpg: Signature made Mon 13 Jan 2014 09:38:27 AM PST using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* quintela/tags/migration/20140113: (49 commits)
  migration: synchronize memory bitmap 64bits at a time
  ram: split function that synchronizes a range
  memory: syncronize kvm bitmap using bitmaps operations
  memory: move bitmap synchronization to its own function
  kvm: refactor start address calculation
  kvm: use directly cpu_physical_memory_* api for tracking dirty pages
  memory: unfold memory_region_test_and_clear()
  memory: split cpu_physical_memory_* functions to its own include
  memory: cpu_physical_memory_set_dirty_tracking() should return void
  memory: make cpu_physical_memory_reset_dirty() take a length parameter
  memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
  memory: cpu_physical_memory_clear_dirty_range() now uses bitmap operations
  memory: cpu_physical_memory_set_dirty_range() now uses bitmap operations
  memory: use find_next_bit() to find dirty bits
  memory: s/mask/clear/ cpu_physical_memory_mask_dirty_range
  memory: cpu_physical_memory_get_dirty() is used as returning a bool
  memory: make cpu_physical_memory_get_dirty() the main function
  memory: unfold cpu_physical_memory_set_dirty_flag()
  memory: unfold cpu_physical_memory_set_dirty() in its only user
  memory: unfold cpu_physical_memory_clear_dirty_flag() in its only user
  ...

Message-id: 1389634834-24181-1-git-send-email-quintela@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agomigration: synchronize memory bitmap 64bits at a time
Juan Quintela [Wed, 6 Nov 2013 10:33:05 +0000 (11:33 +0100)]
migration: synchronize memory bitmap 64bits at a time

We use the old code if the bitmaps are not aligned

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agoram: split function that synchronizes a range
Juan Quintela [Tue, 5 Nov 2013 15:47:20 +0000 (16:47 +0100)]
ram: split function that synchronizes a range

This function is the only bit where we care about speed.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: syncronize kvm bitmap using bitmaps operations
Juan Quintela [Tue, 5 Nov 2013 15:46:26 +0000 (16:46 +0100)]
memory: syncronize kvm bitmap using bitmaps operations

If bitmaps are aligned properly, use bitmap operations.  If they are
not, just use old bit at a time code.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: move bitmap synchronization to its own function
Juan Quintela [Tue, 5 Nov 2013 14:52:54 +0000 (15:52 +0100)]
memory: move bitmap synchronization to its own function

We want to have all the functions that handle directly the dirty
bitmap near.  We will change it later.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agokvm: refactor start address calculation
Juan Quintela [Tue, 5 Nov 2013 14:45:46 +0000 (15:45 +0100)]
kvm: refactor start address calculation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agokvm: use directly cpu_physical_memory_* api for tracking dirty pages
Juan Quintela [Mon, 4 Nov 2013 11:59:02 +0000 (12:59 +0100)]
kvm: use directly cpu_physical_memory_* api for tracking dirty pages

Performance is important in this function, and we want to optimize even further.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: unfold memory_region_test_and_clear()
Juan Quintela [Mon, 14 Oct 2013 15:14:47 +0000 (17:14 +0200)]
memory: unfold memory_region_test_and_clear()

We are going to update the bitmap directly

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: split cpu_physical_memory_* functions to its own include
Juan Quintela [Mon, 14 Oct 2013 15:13:59 +0000 (17:13 +0200)]
memory: split cpu_physical_memory_* functions to its own include

All the functions that use ram_addr_t should be here.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: cpu_physical_memory_set_dirty_tracking() should return void
Juan Quintela [Thu, 10 Oct 2013 09:54:09 +0000 (11:54 +0200)]
memory: cpu_physical_memory_set_dirty_tracking() should return void

Result was always 0, and not used anywhere.  Once there, use bool type
for the parameter.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: make cpu_physical_memory_reset_dirty() take a length parameter
Juan Quintela [Thu, 10 Oct 2013 09:49:53 +0000 (11:49 +0200)]
memory: make cpu_physical_memory_reset_dirty() take a length parameter

We have an end parameter in all the callers, and this make it coherent
with the rest of cpu_physical_memory_* functions, that also take a
length parameter.

Once here, move the start/end calculation to
tlb_reset_dirty_range_all() as we don't need it here anymore.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
Juan Quintela [Thu, 10 Oct 2013 09:20:22 +0000 (11:20 +0200)]
memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()

All uses except one really want the other meaning.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: cpu_physical_memory_clear_dirty_range() now uses bitmap operations
Juan Quintela [Wed, 9 Oct 2013 10:30:35 +0000 (12:30 +0200)]
memory: cpu_physical_memory_clear_dirty_range() now uses bitmap operations

We were clearing a range of bits, so use bitmap_clear().

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: cpu_physical_memory_set_dirty_range() now uses bitmap operations
Juan Quintela [Wed, 9 Oct 2013 10:26:23 +0000 (12:26 +0200)]
memory: cpu_physical_memory_set_dirty_range() now uses bitmap operations

We were setting a range of bits, so use bitmap_set().

Note: xen has always been wrong, and should have used start instead
of addr from the beginning.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: use find_next_bit() to find dirty bits
Juan Quintela [Wed, 9 Oct 2013 10:15:06 +0000 (12:15 +0200)]
memory: use find_next_bit() to find dirty bits

This operation is way faster than doing it bit by bit.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: s/mask/clear/ cpu_physical_memory_mask_dirty_range
Juan Quintela [Wed, 9 Oct 2013 08:36:56 +0000 (10:36 +0200)]
memory: s/mask/clear/ cpu_physical_memory_mask_dirty_range

Now all functions use the same wording that bitops/bitmap operations

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: cpu_physical_memory_get_dirty() is used as returning a bool
Juan Quintela [Tue, 8 Oct 2013 18:40:55 +0000 (20:40 +0200)]
memory: cpu_physical_memory_get_dirty() is used as returning a bool

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: make cpu_physical_memory_get_dirty() the main function
Juan Quintela [Tue, 8 Oct 2013 18:35:39 +0000 (20:35 +0200)]
memory: make cpu_physical_memory_get_dirty() the main function

And make cpu_physical_memory_get_dirty_flag() to use it.  It used to
be the other way around.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: unfold cpu_physical_memory_set_dirty_flag()
Juan Quintela [Tue, 8 Oct 2013 18:27:58 +0000 (20:27 +0200)]
memory: unfold cpu_physical_memory_set_dirty_flag()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: unfold cpu_physical_memory_set_dirty() in its only user
Juan Quintela [Tue, 8 Oct 2013 18:25:16 +0000 (20:25 +0200)]
memory: unfold cpu_physical_memory_set_dirty() in its only user

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: unfold cpu_physical_memory_clear_dirty_flag() in its only user
Juan Quintela [Tue, 8 Oct 2013 18:21:10 +0000 (20:21 +0200)]
memory: unfold cpu_physical_memory_clear_dirty_flag() in its only user

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: split dirty bitmap into three
Juan Quintela [Tue, 8 Oct 2013 14:14:39 +0000 (16:14 +0200)]
memory: split dirty bitmap into three

After all the previous patches, spliting the bitmap gets direct.

Note: For some reason, I have to move DIRTY_MEMORY_* definitions to
the beginning of memory.h to make compilation work.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agobitmap: Add bitmap_zero_extend operation
Juan Quintela [Tue, 8 Oct 2013 14:12:17 +0000 (16:12 +0200)]
bitmap: Add bitmap_zero_extend operation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: cpu_physical_memory_clear_dirty_flag() result is never used
Juan Quintela [Tue, 8 Oct 2013 13:50:55 +0000 (15:50 +0200)]
memory: cpu_physical_memory_clear_dirty_flag() result is never used

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: only resize dirty bitmap when memory size increases
Juan Quintela [Tue, 8 Oct 2013 11:52:02 +0000 (13:52 +0200)]
memory: only resize dirty bitmap when memory size increases

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: make sure that client is always inside range
Juan Quintela [Tue, 8 Oct 2013 11:29:11 +0000 (13:29 +0200)]
memory: make sure that client is always inside range

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: use bit 2 for migration
Juan Quintela [Tue, 8 Oct 2013 11:26:29 +0000 (13:26 +0200)]
memory: use bit 2 for migration

For historical reasons it was bit 3.  Once there, create a constant to
know the number of clients.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: cpu_physical_memory_mask_dirty_range() always clears a single flag
Juan Quintela [Tue, 8 Oct 2013 10:44:04 +0000 (12:44 +0200)]
memory: cpu_physical_memory_mask_dirty_range() always clears a single flag

Document it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: cpu_physical_memory_set_dirty_range() always dirty all flags
Juan Quintela [Tue, 8 Oct 2013 10:31:54 +0000 (12:31 +0200)]
memory: cpu_physical_memory_set_dirty_range() always dirty all flags

So remove the flag argument and do it directly.  After this change,
there is nothing else using cpu_physical_memory_set_dirty_flags() so
remove it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: set single dirty flags when possible
Juan Quintela [Tue, 8 Oct 2013 10:25:25 +0000 (12:25 +0200)]
memory: set single dirty flags when possible

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: all users of cpu_physical_memory_get_dirty used only one flag
Juan Quintela [Tue, 8 Oct 2013 10:17:12 +0000 (12:17 +0200)]
memory: all users of cpu_physical_memory_get_dirty used only one flag

So cpu_physical_memory_get_dirty_flags is not needed anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: make cpu_physical_memory_is_dirty return bool
Juan Quintela [Tue, 8 Oct 2013 10:01:01 +0000 (12:01 +0200)]
memory: make cpu_physical_memory_is_dirty return bool

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agoexec: create function to get a single dirty bit
Juan Quintela [Tue, 8 Oct 2013 09:57:21 +0000 (11:57 +0200)]
exec: create function to get a single dirty bit

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agomemory: create function to set a single dirty bit
Juan Quintela [Tue, 8 Oct 2013 09:53:46 +0000 (11:53 +0200)]
memory: create function to set a single dirty bit

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoexec: use accessor function to know if memory is dirty
Juan Quintela [Tue, 8 Oct 2013 09:50:04 +0000 (11:50 +0200)]
exec: use accessor function to know if memory is dirty

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agomemory: cpu_physical_memory_set_dirty_range() return void
Juan Quintela [Wed, 2 Oct 2013 12:30:02 +0000 (14:30 +0200)]
memory: cpu_physical_memory_set_dirty_range() return void

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agomemory: cpu_physical_memory_set_dirty_flags() result is never used
Juan Quintela [Wed, 2 Oct 2013 12:04:19 +0000 (14:04 +0200)]
memory: cpu_physical_memory_set_dirty_flags() result is never used

So return void.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agobitmap: use long as index
Juan Quintela [Tue, 17 Dec 2013 11:12:24 +0000 (12:12 +0100)]
bitmap: use long as index

Move index and size fields from int to long.  We need that for
migration.  long is 64 bits on sane architectures, and 32bits should
be enough on all the 32bits architectures.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
10 years agotests: Some unit tests for vmstate.c
Eduardo Habkost [Thu, 28 Nov 2013 14:01:18 +0000 (12:01 -0200)]
tests: Some unit tests for vmstate.c

 * Basic load/save tests
 * Tests for loading older versions
 * Tests for .field_exists() handling

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agosavevm: Small comment about why timer QEMUFile/VMState code is in savevm.c
Eduardo Habkost [Fri, 29 Nov 2013 14:26:02 +0000 (12:26 -0200)]
savevm: Small comment about why timer QEMUFile/VMState code is in savevm.c

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoqemu-file: Move QEMUFile code to qemu-file.c
Eduardo Habkost [Thu, 28 Nov 2013 14:01:16 +0000 (12:01 -0200)]
qemu-file: Move QEMUFile code to qemu-file.c

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agovmstate: Move VMState code to vmstate.c
Eduardo Habkost [Thu, 28 Nov 2013 14:01:15 +0000 (12:01 -0200)]
vmstate: Move VMState code to vmstate.c

This will allow unit tests to be written for VMState code without
pulling dependencies from the savevm code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agosavevm.c: Coding style fix
Eduardo Habkost [Thu, 28 Nov 2013 14:01:14 +0000 (12:01 -0200)]
savevm.c: Coding style fix

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agosavevm.c: Coding style fixes
Eduardo Habkost [Thu, 28 Nov 2013 14:01:13 +0000 (12:01 -0200)]
savevm.c: Coding style fixes

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agosavevm: Convert all tabs to spaces
Eduardo Habkost [Thu, 28 Nov 2013 14:01:12 +0000 (12:01 -0200)]
savevm: Convert all tabs to spaces

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agomigration: Move QEMU_VM_* defines to migration/migration.h
Eduardo Habkost [Thu, 28 Nov 2013 14:01:11 +0000 (12:01 -0200)]
migration: Move QEMU_VM_* defines to migration/migration.h

The VMState code will be moved to vmstate.c and it uses some of the
QEMU_VM_* constants, so move it to a header.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoqemu-file: Make a few functions non-static
Eduardo Habkost [Thu, 28 Nov 2013 14:01:10 +0000 (12:01 -0200)]
qemu-file: Make a few functions non-static

The QEMUFile code will be moved to qemu-file.c. This will require making
the following functions non-static because they are used by the savevm.c
code:

 * qemu_peek_byte()
 * qemu_peek_buffer()
 * qemu_file_skip()
 * qemu_file_set_error()

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agomigration: Fix rate limit
Matthew Garrett [Mon, 25 Nov 2013 19:42:43 +0000 (14:42 -0500)]
migration: Fix rate limit

The migration thread appears to want to allow writeout to occur at full
speed rather than being rate limited during completion of state saving,
but sets the limit to INT_MAX when xfer_limit is INT64_MAX. This causes
problems if there's more than 2GB of state left to save at this point. It
probably ought to just be INT64_MAX instead.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agointroduce MIG_STATE_CANCELLING state
Zhanghaoyu (A) [Thu, 7 Nov 2013 11:01:15 +0000 (11:01 +0000)]
introduce MIG_STATE_CANCELLING state

Introduce MIG_STATE_CANCELLING state to avoid starting a new migration task while the previous one still exist.

Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoavoid a bogus COMPLETED->CANCELLED transition
Zhanghaoyu (A) [Thu, 7 Nov 2013 08:21:23 +0000 (08:21 +0000)]
avoid a bogus COMPLETED->CANCELLED transition

Avoid a bogus COMPLETED->CANCELLED transition.
There is a period of time from the timing of setting COMPLETED state to that of migration thread exits, so during which it's problematic in COMPLETED->CANCELLED transition.

Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoMerge remote-tracking branch 'pmaydell/tags/pull-cocoa-20140112' into staging
Anthony Liguori [Mon, 13 Jan 2014 01:50:52 +0000 (17:50 -0800)]
Merge remote-tracking branch 'pmaydell/tags/pull-cocoa-20140112' into staging

cocoa queue:
 * pass command key to guest when VM has mousegrab
 * add .qcow2 to extension list for image load dialog
 * fix bugs in code for starting QEMU via image load dialog
 * fix resize/redraw interaction
 * draw window black if guest hasn't sent anything to screen
 * minor style/typo fixes
 * add myself as cocoa co-maintainer

# gpg: Signature made Sun 12 Jan 2014 02:45:52 PM PST using RSA key ID 14360CDE
# gpg: Can't check signature: public key not found

* pmaydell/tags/pull-cocoa-20140112:
  MAINTAINERS: add myself as cocoa UI co-maintainer
  ui/cocoa: Remove stray tabs
  ui/cocoa: Draw black rectangle if we have no data yet
  ui/cocoa: Redraw at correct size when switching surface
  ui/cocoa: Fix code for starting QEMU via image file load dialog
  ui/cocoa: Add ".qcow2" to extension list for image load dialog
  ui/cocoa: Send warning message to stderr, not stdout
  ui/cocoa: Correct typos in comments and variable names
  ui/cocoa: Pass command key through to guest when VM has mousegrab

Message-id: 1389567158-31066-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'pmaydell/tags/pull-target-arm-20140112' into staging
Anthony Liguori [Mon, 13 Jan 2014 01:50:43 +0000 (17:50 -0800)]
Merge remote-tracking branch 'pmaydell/tags/pull-target-arm-20140112' into staging

target-arm queue:
 * build fix for bigendian hosts

# gpg: Signature made Sun 12 Jan 2014 01:38:22 PM PST using RSA key ID 14360CDE
# gpg: Can't check signature: public key not found

* pmaydell/tags/pull-target-arm-20140112:
  arm: fix compile on bigendian host

Message-id: 1389562970-30944-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMAINTAINERS: add myself as cocoa UI co-maintainer
Peter Maydell [Mon, 16 Dec 2013 15:17:55 +0000 (15:17 +0000)]
MAINTAINERS: add myself as cocoa UI co-maintainer

Add myself to the maintainers list for the cocoa UI; status
remains "Odd Fixes".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <andreas.faerber@web.de>
Message-id: 1387207075-10280-1-git-send-email-peter.maydell@linaro.org

10 years agoui/cocoa: Remove stray tabs
Peter Maydell [Tue, 24 Dec 2013 11:54:12 +0000 (11:54 +0000)]
ui/cocoa: Remove stray tabs

The ui/cocoa.m file has just three lines with hardcoded tabs; fix them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1387886052-27067-1-git-send-email-peter.maydell@linaro.org

10 years agoui/cocoa: Draw black rectangle if we have no data yet
Peter Maydell [Tue, 24 Dec 2013 02:51:47 +0000 (02:51 +0000)]
ui/cocoa: Draw black rectangle if we have no data yet

If our redraw method is called before we have any data from the guest,
then draw a black rectangle rather than leaving the window empty.
This mostly only matters when the guest machine has no framebuffer
device, but it is more in line with the behaviour of other QEMU UIs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1387853507-26298-3-git-send-email-peter.maydell@linaro.org

10 years agoui/cocoa: Redraw at correct size when switching surface
Peter Maydell [Tue, 24 Dec 2013 02:51:46 +0000 (02:51 +0000)]
ui/cocoa: Redraw at correct size when switching surface

If the surface switch involved a resize, we were doing the redraw
at the old size rather than the new, because the update of
screen.width and screen.height was being done after the setFrame
method calls which triggered a redraw. Normally this isn't very
noticeable because typically after the guest triggers the window
resize it also draws something to it, which will in turn cause
us to redraw. However, the combination of a guest which never
draws to the display and a command line setting of a screen size
larger than the default can reveal odd effects.

Move most of the handling of resizes to the top of the method,
and guard it with a check that the surface size actually changed,
to avoid unnecessary operations (including some user visible ones
like "recenter the window on the screen") if the surface is the
same size as the old one.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1387853507-26298-2-git-send-email-peter.maydell@linaro.org

10 years agoui/cocoa: Fix code for starting QEMU via image file load dialog
Peter Maydell [Sun, 8 Dec 2013 22:59:06 +0000 (22:59 +0000)]
ui/cocoa: Fix code for starting QEMU via image file load dialog

Fix a number of bugs in the code for starting QEMU via the image
file load dialog:
 * use the actual argv[0] rather than "qemu": this avoids failures to
   find BIOS image files caused by not looking in the correct directory
   relative to the executable path
 * allocate a large enough argv array to NULL terminate it
 * use g_strdup(X) rather than g_strdup_printf("%s", X) or
   g_strdup_printf(X)
 * disable the printing of the simulated command line argument
   (which is presumably intended for debug only)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-6-git-send-email-peter.maydell@linaro.org

10 years agoui/cocoa: Add ".qcow2" to extension list for image load dialog
Peter Maydell [Sun, 8 Dec 2013 22:59:05 +0000 (22:59 +0000)]
ui/cocoa: Add ".qcow2" to extension list for image load dialog

Add ".qcow2" to the list of file extensions which are accepted
by the initial disk image load dialog which is displayed if the
user runs QEMU without any command line arguments.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-5-git-send-email-peter.maydell@linaro.org

10 years agoui/cocoa: Send warning message to stderr, not stdout
Peter Maydell [Sun, 8 Dec 2013 22:59:04 +0000 (22:59 +0000)]
ui/cocoa: Send warning message to stderr, not stdout

Bring a warning message into line with the others in this file by
sending it to stderr, not stdout.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-4-git-send-email-peter.maydell@linaro.org

10 years agoui/cocoa: Correct typos in comments and variable names
Peter Maydell [Sun, 8 Dec 2013 22:59:03 +0000 (22:59 +0000)]
ui/cocoa: Correct typos in comments and variable names

Fix various non-user-visible typos in comments and variable names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1386543546-31919-3-git-send-email-peter.maydell@linaro.org

10 years agoui/cocoa: Pass command key through to guest when VM has mousegrab
Peter Maydell [Sun, 8 Dec 2013 22:59:02 +0000 (22:59 +0000)]
ui/cocoa: Pass command key through to guest when VM has mousegrab

The guest might want to be able to use the command key for its won
purposes (as command if it is MacOS X, or for the Windows key if
it is a PC guest, for instance). In line with other UI frontends,
pass it through if the guest has mousegrab, and only use it for UI
menu accelerators if not grabbed.

Thanks to John Arbuckle for reporting this problem, helping
us work through what the best solution would be and providing
a patch which was the initial inspiration for this one.

Reported-by: John Arbuckle <programmingkidx@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-2-git-send-email-peter.maydell@linaro.org

10 years agoarm: fix compile on bigendian host
Alexey Kardashevskiy [Sun, 12 Jan 2014 21:37:37 +0000 (21:37 +0000)]
arm: fix compile on bigendian host

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Fri, 10 Jan 2014 19:05:17 +0000 (11:05 -0800)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  scsi-disk: add UNMAP limits to block limits VPD page
  block/iscsi: use a bh to schedule co reentrance

Message-id: 1387720926-11421-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Fri, 10 Jan 2014 19:05:05 +0000 (11:05 -0800)]
Merge remote-tracking branch 'stefanha/block' into staging

* stefanha/block:
  commit: Remove unused check
  qemu-iotests: Update test cases for commit active
  commit: Support commit active layer
  block: Add commit_active_start()
  mirror: Move base to MirrorBlockJob
  mirror: Don't close target
  qemu-iotests: drop duplicate virtio-blk initialization failure
  vmdk: Allow vmdk_create to work with protocol
  vmdk: Check VMFS extent line field number
  docs: updated qemu-img man page and qemu-doc to reflect VHDX support.
  block: vhdx - improve error message, and .bdrv_check implementation
  block/iscsi: Fix compilation for libiscsi 1.4.0 (API change)
  qapi-schema: fix QEMU 1.8 references
  dataplane: replace hostmem with memory_region_find
  dataplane: change vring API to use VirtQueueElement
  vring: factor common code for error exits
  vring: create a common function to parse descriptors
  sheepdog: fix dynamic grow for running qcow2 format

Message-id: 1387554416-5837-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Fri, 10 Jan 2014 19:04:48 +0000 (11:04 -0800)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

acpi,pci,pc,fedora,virtio fixes and enhancements

This includes some Preparatory patches for cpu hotplug for q25 and memory
hotplug by Igor, tests and memory mapping change
by Laszlo and pci reset cleanup by Paolo.
There are also some fixes for fedora and virtio:
included here since they are test blockers for me.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 23 Dec 2013 08:07:18 AM PST using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

* mst/tags/for_anthony:
  target-arm: fix build with gcc 4.8.2
  virtio: add back call to virtio_bus_device_unplugged
  piix: fix 32bit pci hole
  qdev: switch reset to post-order
  qdev: allow both pre- and post-order vists in qdev walking functions
  pci: clean up resetting of IRQs
  pci: do not export pci_bus_reset
  ACPI/DSDT-CPU: cleanup bogus comment
  ACPI: Q35 DSDT: fix CPU hotplug GPE0.2 handler
  acpi: ich9: allow guest to clear SCI rised by GPE
  acpi: factor out common pm_update_sci() into acpi core
  acpi: piix4: remove not needed GPE0 mask
  i440fx-test: verify firmware under 4G and 1M, both -bios and -pflash
  i440fx-test: generate temporary firmware blob
  i440fx-test: give each GTest case its own qtest
  i440fx-test: qtest_start() should be paired with qtest_end()
  hw/i386/pc_sysfw: support two flash drives
  pc_piix: document gigabyte_align
  piix: gigabyte alignment for ram

Message-id: 1387815007-1272-1-git-send-email-mst@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
Anthony Liguori [Fri, 10 Jan 2014 19:04:31 +0000 (11:04 -0800)]
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging

QOM CPUState refactorings / X86CPU

* TLB invalidation optimizations
* X86CPU initialization cleanups
* Preparations for X86CPU hot-unplug

# gpg: Signature made Tue 24 Dec 2013 04:51:52 AM PST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 174F 0347 1BCC 221A 6175  6F96 FA2E D12D 3E7E 013F

* afaerber/tags/qom-cpu-for-anthony:
  target-i386: Cleanup 'foo=val' feature handling
  target-i386: Cleanup 'foo' feature handling
  target-i386: Convert 'check' and 'enforce' to static properties
  target-i386: Convert 'hv_spinlocks' to static property
  target-i386: Convert 'hv_vapic' to static property
  target-i386: Convert 'hv_relaxed' to static property
  cpu-exec: Optimize X86CPU usage in cpu_exec()
  target-i386: Move apic_state field from CPUX86State to X86CPU
  cputlb: Tidy memset() of arrays
  cputlb: Use memset() when flushing entries

10 years agoMerge remote-tracking branch 'pmaydell/tags/pull-target-arm-20140107' into staging
Anthony Liguori [Fri, 10 Jan 2014 18:48:46 +0000 (10:48 -0800)]
Merge remote-tracking branch 'pmaydell/tags/pull-target-arm-20140107' into staging

target-arm queue:
 * further A64 decoder patches, including enabling the aarch64-linux-user
   target; this includes full floating point support. Neon is not yet
   supported.
 * cadence UART model fixes.
 * some minor bug fixes and cleanups.
 * all the softfloat fixes required by the new A64 instructions;
   several of these will also be used by PPC.

* pmaydell/tags/pull-target-arm-20140107: (61 commits)
  target-arm: A64: Add support for FCVT between half, single and double
  target-arm: A64: Add 1-source 32-to-32 and 64-to-64 FP instructions
  target-arm: A64: Add floating-point<->integer conversion instructions
  target-arm: A64: Add floating-point<->fixed-point instructions
  target-arm: A64: Add extra VFP fixed point conversion helpers
  target-arm: Ignore most exceptions from scalbn when doing fixpoint conversion
  target-arm: Rename A32 VFP conversion helpers
  target-arm: Prepare VFP_CONV_FIX helpers for A64 uses
  softfloat: Add support for ties-away rounding
  softfloat: Refactor code handling various rounding modes
  softfloat: Add float16 <=> float64 conversion functions
  softfloat: Factor out RoundAndPackFloat16 and NormalizeFloat16Subnormal
  softfloat: Provide complete set of accessors for fp state
  softfloat: Fix float64_to_uint32_round_to_zero
  softfloat: Fix float64_to_uint32
  softfloat: Fix float64_to_uint64_round_to_zero
  softfloat: Add float32_to_uint64()
  softfloat: Fix factor 2 error for scalbn on denormal inputs
  softfloat: Only raise Invalid when conversions to int are out of range
  softfloat: Fix float64_to_uint64
  ...

Conflicts:
target-arm/cpu.h

aliguori: resolved trivial conflict

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Fri, 10 Jan 2014 18:47:30 +0000 (10:47 -0800)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

* riku/linux-user-for-upstream:
  linux-user: Remove regs parameter of load_elf_binary and load_flt_binary
  linux-user: Support the accept4 socketcall

Message-id: 1389364137-23287-1-git-send-email-riku.voipio@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agolinux-user: Remove regs parameter of load_elf_binary and load_flt_binary
Will Newton [Thu, 9 Jan 2014 09:10:50 +0000 (09:10 +0000)]
linux-user: Remove regs parameter of load_elf_binary and load_flt_binary

The regs parameter is not used anywhere, so remove it.

Signed-off-by: Will Newton <will.newton@linaro.org>
Reviewed-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agolinux-user: Support the accept4 socketcall
André Hentschel [Mon, 6 Jan 2014 19:18:52 +0000 (20:18 +0100)]
linux-user: Support the accept4 socketcall

Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
10 years agoMerge remote-tracking branch 'otubo/seccomp' into staging
Anthony Liguori [Thu, 9 Jan 2014 21:56:27 +0000 (13:56 -0800)]
Merge remote-tracking branch 'otubo/seccomp' into staging

* otubo/seccomp:
  seccomp: exit if seccomp_init() fails

Message-id: 1387565447-24241-1-git-send-email-otubo@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'rth/ldst-i386-2' into staging
Anthony Liguori [Thu, 9 Jan 2014 21:44:00 +0000 (13:44 -0800)]
Merge remote-tracking branch 'rth/ldst-i386-2' into staging

* rth/ldst-i386-2: (49 commits)
  target-i386: Tidy ljmp
  target-i386: Rename gen_op_jmp_T0 to gen_op_jmp_v
  target-i386: Tidy some size computation
  target-i386: Remove gen_op_mov_reg_A0
  target-i386: Remove gen_op_mov_TN_reg
  target-i386: Remove gen_op_addl_T0_T1
  target-i386: Remove gen_op_mov_reg_T1
  target-i386: Remove gen_op_mov_reg_T0
  target-i386: Tidy cpu_regs initialization
  target_i386: Clean up gen_pop_T0
  target-i386: Combine gen_push_T* into gen_push_v
  target-i386: Tidy addr16 code in gen_lea_modrm
  target-i386: Change dflag to TCGMemOp
  target-i386: Change gen_op_mov_reg_A0 size parameter to TCGMemOp
  target-i386: Change aflag to TCGMemOp
  target-i386: Change gen_op_j*z_ecx size parameter to TCGMemOp
  target-i386: Change gen_op_add_reg_* size parameter to TCGMemOp
  target-i386: Use TCGMemOp for 'ot' variables
  target-i386: Remove gen_op_andl_A0_ffff
  target-i386: Remove gen_op_movl_T0_T1
  ...

Message-id: 1389128439-10067-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'afaerber/tags/qom-devices-for-anthony' into staging
Anthony Liguori [Thu, 9 Jan 2014 19:24:48 +0000 (11:24 -0800)]
Merge remote-tracking branch 'afaerber/tags/qom-devices-for-anthony' into staging

QOM infrastructure fixes and device conversions

* QOM interface fixes and unit test
* Device no_user sanitization and documentation
* Device error reporting improvement
* Conversion of APIC, ICC, IOAPIC to QOM realization model

# gpg: Signature made Tue 24 Dec 2013 09:04:05 AM PST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 174F 0347 1BCC 221A 6175  6F96 FA2E D12D 3E7E 013F

* afaerber/tags/qom-devices-for-anthony: (24 commits)
  qdev-monitor: Improve error message for -device nonexistant
  ioapic: QOM'ify ioapic
  ioapic: Cleanup for QOM'ification
  icc_bus: QOM'ify ICC
  apic: QOM'ify APIC
  apic: Cleanup for QOM'ification
  qdev: Drop misleading qbus_free() function
  qom: Detect bad reentrance during object_class_foreach()
  tests: Test QOM interface casting
  qom: Do not register interface "types" in the type table and fix names
  qom: Split out object and class caches
  qdev: Document that pointer properties kill device_add
  hw: cannot_instantiate_with_device_add_yet due to pointer props
  qdev-monitor: Avoid device_add crashing on non-device driver name
  qdev: Do not let the user try to device_add when it cannot work
  isa: Clean up use of cannot_instantiate_with_device_add_yet
  vt82c686: Clean up use of cannot_instantiate_with_device_add_yet
  piix3 piix4: Clean up use of cannot_instantiate_with_device_add_yet
  ich9: Document why cannot_instantiate_with_device_add_yet
  pci-host: Consistently set cannot_instantiate_with_device_add_yet
  ...

10 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Thu, 9 Jan 2014 19:24:12 +0000 (11:24 -0800)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

* mjt/trivial-patches:
  acpi unit-test: Remove temporary disk after test
  mainstone: Fix duplicate array values for key 'space'
  pxa27x: Add 'const' attribute to keyboard maps
  pxa27x: Reduce size of keyboard matrix mapping
  doc: Mention chardev:id in available devices for -serial
  configure: Python tests must be done before help message
  configure: Rewrite code for help message
  fix -boot strict regressed in commit 6ef4716
  vl: make boot_strict variable static (not used outside vl.c)
  x86: only allow real mode to access 32bit without LMA
  linux-user: Use macro TARGET_NSIG_WORDS where possible
  exynos4210: Use macro ARRAY_SIZE where possible
  ui/cocoa: Use macro ARRAY_SIZE where possible
  misc: Use macro ARRAY_SIZE where possible
  openrisc: Fix spelling in comment (transaltion -> translation)
  hw/arm/highbank: Simplify code (memory region in device state)

Message-id: 1388182050-10270-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agoMerge remote-tracking branch 'pmaydell/tags/pull-target-arm-20140108' into staging
Anthony Liguori [Thu, 9 Jan 2014 19:23:49 +0000 (11:23 -0800)]
Merge remote-tracking branch 'pmaydell/tags/pull-target-arm-20140108' into staging

target-arm queue:
 * further A64 decoder patches, including enabling the aarch64-linux-user
   target; this includes full floating point support. Neon is not yet
   supported.
 * cadence UART model fixes.
 * some minor bug fixes and cleanups.
 * all the softfloat fixes required by the new A64 instructions;
   several of these will also be used by PPC.

# gpg: Signature made Wed 08 Jan 2014 11:25:12 AM PST using RSA key ID 14360CDE
# gpg: Can't check signature: public key not found

* pmaydell/tags/pull-target-arm-20140108: (76 commits)
  target-arm: A64: Add support for FCVT between half, single and double
  target-arm: A64: Add 1-source 32-to-32 and 64-to-64 FP instructions
  target-arm: A64: Add floating-point<->integer conversion instructions
  target-arm: A64: Add floating-point<->fixed-point instructions
  target-arm: A64: Add extra VFP fixed point conversion helpers
  target-arm: Ignore most exceptions from scalbn when doing fixpoint conversion
  target-arm: Rename A32 VFP conversion helpers
  target-arm: Prepare VFP_CONV_FIX helpers for A64 uses
  softfloat: Add support for ties-away rounding
  softfloat: Refactor code handling various rounding modes
  softfloat: Add float16 <=> float64 conversion functions
  softfloat: Factor out RoundAndPackFloat16 and NormalizeFloat16Subnormal
  softfloat: Provide complete set of accessors for fp state
  softfloat: Fix float64_to_uint32_round_to_zero
  softfloat: Fix float64_to_uint32
  softfloat: Fix float64_to_uint64_round_to_zero
  softfloat: Add float32_to_uint64()
  softfloat: Fix factor 2 error for scalbn on denormal inputs
  softfloat: Only raise Invalid when conversions to int are out of range
  softfloat: Fix float64_to_uint64
  ...

Message-id: 1389209439-25448-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
10 years agotarget-arm: A64: Add support for FCVT between half, single and double
Peter Maydell [Tue, 7 Jan 2014 17:19:15 +0000 (17:19 +0000)]
target-arm: A64: Add support for FCVT between half, single and double

Add support for FCVT between half, single and double precision.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-arm: A64: Add 1-source 32-to-32 and 64-to-64 FP instructions
Peter Maydell [Tue, 7 Jan 2014 17:19:14 +0000 (17:19 +0000)]
target-arm: A64: Add 1-source 32-to-32 and 64-to-64 FP instructions

This patch adds support for those instructions in the  "Floating-point
data-processing (1 source)" group which are simple 32-bit-to-32-bit
or 64-bit-to-64-bit operations (ie everything except FCVT between
single/double/half precision).

We put the new round-to-int helpers in helper.c because they will
also be used by the new ARMv8 A32/T32 rounding instructions.

Signed-off-by: Alexander Graf <agraf@suse.de>
[WN: Commit message tweak, merged single and double precision patches,
 updated to new infrastructure.]
Signed-off-by: Will Newton <will.newton@linaro.org>
[PMM: reworked decode, split FCVT out into their own patch]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-arm: A64: Add floating-point<->integer conversion instructions
Will Newton [Tue, 7 Jan 2014 17:19:14 +0000 (17:19 +0000)]
target-arm: A64: Add floating-point<->integer conversion instructions

Add support for the AArch64 floating-point <-> integer conversion
instructions to disas_fpintconv. In the process we can rearrange
and simplify the detection of unallocated encodings a little.
We also correct a typo in the instruction encoding diagram for this
instruction group: bit 21 is 1, not 0.

Signed-off-by: Will Newton <will.newton@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-arm: A64: Add floating-point<->fixed-point instructions
Alexander Graf [Tue, 7 Jan 2014 17:19:14 +0000 (17:19 +0000)]
target-arm: A64: Add floating-point<->fixed-point instructions

This patch adds emulation for the instruction group labeled
"Floating-point <-> fixed-point conversions" in the ARM ARM.

Namely this includes the instructions SCVTF, UCVTF, FCVTZS, FCVTZU
(scalar, fixed-point).

Signed-off-by: Alexander Graf <agraf@suse.de>
[WN: Commit message tweak, rebased, updated to new infrastructure.
 Applied bug fixes from Michael Matz and Janne Grunau.]
Signed-off-by: Will Newton <will.newton@linaro.org>
[PMM: significant cleanup]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-arm: A64: Add extra VFP fixed point conversion helpers
Will Newton [Tue, 7 Jan 2014 17:19:14 +0000 (17:19 +0000)]
target-arm: A64: Add extra VFP fixed point conversion helpers

Define the full set of floating point to fixed point conversion
helpers required to support AArch64.

Signed-off-by: Will Newton <will.newton@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-arm: Ignore most exceptions from scalbn when doing fixpoint conversion
Peter Maydell [Tue, 7 Jan 2014 17:19:13 +0000 (17:19 +0000)]
target-arm: Ignore most exceptions from scalbn when doing fixpoint conversion

The VFP fixed point conversion helpers first call float_scalbn and
then convert the result to an integer. This scalbn operation may
set floating point exception flags for:
 * overflow & inexact (if it overflows to infinity)
 * input denormal squashed to zero
 * output denormal squashed to zero
Of these, we only care about the input-denormal flag, since
the output of the whole scale-and-convert operation will be
an integer (so squashed-output-denormal and overflow don't
apply). Suppress the others by saving the pre-scalb exception
flags and only copying across a potential input-denormal flag.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-arm: Rename A32 VFP conversion helpers
Will Newton [Tue, 7 Jan 2014 17:19:13 +0000 (17:19 +0000)]
target-arm: Rename A32 VFP conversion helpers

The VFP conversion helpers for A32 round to zero as this is the only
rounding mode supported. Rename these helpers to make it clear that
they round to zero and are not suitable for use in the AArch64 code.

Signed-off-by: Will Newton <will.newton@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agotarget-arm: Prepare VFP_CONV_FIX helpers for A64 uses
Will Newton [Tue, 7 Jan 2014 17:19:13 +0000 (17:19 +0000)]
target-arm: Prepare VFP_CONV_FIX helpers for A64 uses

Make the VFP_CONV_FIX helpers a little more flexible in
preparation for the A64 uses. This requires two changes:
 * use the correct softfloat conversion function based on itype
   rather than always the int32 one; this is possible now that
   softfloat provides int16 versions and necessary for the
   future conversion-to-int64 A64 variants. This also allows
   us to drop the awkward 'sign' macro argument.
 * split the 'fsz' argument which currently controls both
   width of the input float type and width of the output
   integer type into two; this will allow us to specify the
   A64 64-bit-int-to-single conversion function, where the
   two widths are different.

We can also drop the (itype##_t) cast now that softfloat
guarantees that all the itype##_to_float* functions take
an integer argument of exactly the correct type.

Signed-off-by: Will Newton <will.newton@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agosoftfloat: Add support for ties-away rounding
Peter Maydell [Tue, 7 Jan 2014 17:19:12 +0000 (17:19 +0000)]
softfloat: Add support for ties-away rounding

IEEE754-2008 specifies a new rounding mode:

"roundTiesToAway: the floating-point number nearest to the infinitely
precise result shall be delivered; if the two nearest floating-point
numbers bracketing an unrepresentable infinitely precise result are
equally near, the one with larger magnitude shall be delivered."

Implement this new mode (it is needed for ARM). The general principle
is that the required code is exactly like the ties-to-even code,
except that we do not need to do the "in case of exact tie clear LSB
to round-to-even", because the rounding operation naturally causes
the exact tie to round up in magnitude.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agosoftfloat: Refactor code handling various rounding modes
Peter Maydell [Tue, 7 Jan 2014 17:19:12 +0000 (17:19 +0000)]
softfloat: Refactor code handling various rounding modes

Refactor the code in various functions which calculates rounding
increments given the current rounding mode, so that instead of a
set of nested if statements we have a simple switch statement.
This will give us a clean place to add the case for the new
tiesAway rounding mode.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agosoftfloat: Add float16 <=> float64 conversion functions
Peter Maydell [Tue, 7 Jan 2014 17:19:12 +0000 (17:19 +0000)]
softfloat: Add float16 <=> float64 conversion functions

Add the conversion functions float16_to_float64() and
float64_to_float16(), which will be needed for the ARM
A64 instruction set.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agosoftfloat: Factor out RoundAndPackFloat16 and NormalizeFloat16Subnormal
Peter Maydell [Tue, 7 Jan 2014 17:19:11 +0000 (17:19 +0000)]
softfloat: Factor out RoundAndPackFloat16 and NormalizeFloat16Subnormal

In preparation for adding conversions between float16 and float64,
factor out code currently done inline in the float16<=>float32
conversion functions into functions RoundAndPackFloat16 and
NormalizeFloat16Subnormal along the lines of the existing versions
for the other float types.

Note that we change the handling of zExp from the inline code
to match the API of the other RoundAndPackFloat functions; however
we leave the positioning of the binary point between bits 22 and 23
rather than shifting it up to the high end of the word.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agosoftfloat: Provide complete set of accessors for fp state
Peter Maydell [Tue, 7 Jan 2014 17:19:11 +0000 (17:19 +0000)]
softfloat: Provide complete set of accessors for fp state

Tidy up the get/set accessors for the fp state to add missing ones
and make them all inline in softfloat.h rather than some inline and
some not.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
10 years agosoftfloat: Fix float64_to_uint32_round_to_zero
Tom Musta [Tue, 7 Jan 2014 17:17:51 +0000 (17:17 +0000)]
softfloat: Fix float64_to_uint32_round_to_zero

The float64_to_uint32_round_to_zero routine is incorrect.

For example, the following test pattern:

    425F81378DC0CD1F / 0x1.f81378dc0cd1fp+38

will erroneously set the inexact flag.

This patch re-implements the routine to use the float64_to_uint64_round_to_zero
routine.  If saturation occurs we ignore any flags set by the
conversion function and raise only Invalid.

This contribution can be licensed under either the softfloat-2a or -2b
license.

Signed-off-by: Tom Musta <tommusta@gmail.com>
Message-id: 1387397961-4894-6-git-send-email-tommusta@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>