OSDN Git Service

qmiga/qemu.git
8 years agotarget-ppc: Rework ppc_store_slb
David Gibson [Wed, 27 Jan 2016 00:07:29 +0000 (11:07 +1100)]
target-ppc: Rework ppc_store_slb

ppc_store_slb updates the SLB for PPC cpus with 64-bit hash MMUs.
Currently it takes two parameters, which contain values encoded as the
register arguments to the slbmte instruction, one register contains the
ESID portion of the SLBE and also the slot number, the other contains the
VSID portion of the SLBE.

We're shortly going to want to do some SLB updates from other code where
it is more convenient to supply the slot number and ESID separately, so
rework this function and its callers to work this way.

As a bonus, this slightly simplifies the emulation of segment registers for
when running a 32-bit OS on a 64-bit CPU.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Alexander Graf <agraf@suse.de>
8 years agotarget-ppc: Convert mmu-hash{32,64}.[ch] from CPUPPCState to PowerPCCPU
David Gibson [Thu, 14 Jan 2016 04:33:27 +0000 (15:33 +1100)]
target-ppc: Convert mmu-hash{32,64}.[ch] from CPUPPCState to PowerPCCPU

Like a lot of places these files include a mixture of functions taking
both the older CPUPPCState *env and newer PowerPCCPU *cpu.  Move a step
closer to cleaning this up by standardizing on PowerPCCPU, except for the
helper_* functions which are called with the CPUPPCState * from tcg.

Callers and some related functions are updated as well, the boundaries of
what's changed here are a bit arbitrary.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
8 years agotarget-ppc: Remove unused kvmppc_read_segment_page_sizes() stub
David Gibson [Wed, 13 Jan 2016 01:15:22 +0000 (12:15 +1100)]
target-ppc: Remove unused kvmppc_read_segment_page_sizes() stub

This stub function is in the !KVM ifdef in target-ppc/kvm_ppc.h.  However
no such function exists on the KVM side, or is ever used.

I think this originally referenced a function which read host page size
information from /proc, for we we now use the KVM GET_SMMU_INFO extension
instead.

In any case, it has no function now, so remove it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
8 years agouninorth.c: add support for UniNorth kMacRISCPCIAddressSelect (0x48) register
Programmingkid [Fri, 22 Jan 2016 16:09:23 +0000 (11:09 -0500)]
uninorth.c: add support for UniNorth kMacRISCPCIAddressSelect (0x48) register

Darwin/OS X use the undocumented kMacRISCPCIAddressSelect (0x48) to
configure PCI memory space size for mac99 machines. Without this
register, warnings similar to below are emitted to the console during boot:

AppleMacRiscPCI: bad range 2(80000000:01000000)
AppleMacRiscPCI: bad range 2(81000000:00001000)
AppleMacRiscPCI: bad range 2(81080000:00080000)

Based upon the algorithm in Darwin's AppleMacRiscPCI.cpp driver, set the
kMacRISCPCIAddressSelect register so that Darwin considers the PCI
memory space to be at 0x80000000 (size 0x10000000) which matches that
currently used by QEMU and OpenBIOS.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
[commit message and comment revised as suggested by Mark Cave-Ayland]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda.c: return error for unknown commands
Alyssa Milburn [Fri, 22 Jan 2016 23:07:24 +0000 (23:07 +0000)]
cuda.c: return error for unknown commands

This avoids MacsBug hanging at startup in the absence of ADB mouse
input, by replying with an error (which is also what MOL does) when
it sends an unknown command (0x1c).

Signed-off-by: Alyssa Milburn <fuzzie@fuzzie.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agopseries: Allow TCG h_enter to work with hotplugged memory
David Gibson [Thu, 21 Jan 2016 03:48:43 +0000 (14:48 +1100)]
pseries: Allow TCG h_enter to work with hotplugged memory

The implementation of the H_ENTER hypercall for PAPR guests needs to
enforce correct access attributes on the inserted HPTE.  This means
determining if the HPTE's real address is a regular RAM address (which
requires attributes for coherent access) or an IO address (which requires
attributes for cache-inhibited access).

At the moment this check is implemented with (raddr < machine->ram_size),
but that only handles addresses in the base RAM area, not any hotplugged
RAM.

This patch corrects the problem with a new helper.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agotarget-ppc: gdbstub: Add VSX support
Anton Blanchard [Fri, 15 Jan 2016 15:00:51 +0000 (16:00 +0100)]
target-ppc: gdbstub: Add VSX support

Add the XML and functions to get and set VSX registers.

Signed-off-by: Anton Blanchard <anton@samba.org>
(fixed little-endian guests)
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: gdbstub: fix spe registers for little-endian guests
Greg Kurz [Fri, 15 Jan 2016 15:00:44 +0000 (16:00 +0100)]
target-ppc: gdbstub: fix spe registers for little-endian guests

Let's reuse the ppc_maybe_bswap_register() helper, like we already do
with the general registers.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: gdbstub: fix altivec registers for little-endian guests
Greg Kurz [Fri, 15 Jan 2016 15:00:38 +0000 (16:00 +0100)]
target-ppc: gdbstub: fix altivec registers for little-endian guests

Altivec registers are 128-bit wide. They are stored in memory as two
64-bit values that must be byteswapped when the guest is little-endian.
Let's reuse the ppc_maybe_bswap_register() helper for this.

We also need to fix the ordering of the 64-bit elements according to
the target endianness, for both system and user mode.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: gdbstub: introduce avr_need_swap()
Greg Kurz [Fri, 15 Jan 2016 15:00:31 +0000 (16:00 +0100)]
target-ppc: gdbstub: introduce avr_need_swap()

This helper will be used to support Altivec registers in little-endian guests.
This patch does not change functionnality.

Note: I had to put the helper some lines away from the gdb_*_avr_reg()
routines to get a more readable patch.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: gdbstub: fix float registers for little-endian guests
Greg Kurz [Fri, 15 Jan 2016 15:00:25 +0000 (16:00 +0100)]
target-ppc: gdbstub: fix float registers for little-endian guests

Let's reuse the ppc_maybe_bswap_register() helper, like we already do
with the general registers.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: rename and export maybe_bswap_register()
Greg Kurz [Fri, 15 Jan 2016 15:00:18 +0000 (16:00 +0100)]
target-ppc: rename and export maybe_bswap_register()

This helper will be used to support FP, Altivec and VSX registers when
the guest is little-endian.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: kvm: fix floating point registers sync on little-endian hosts
Greg Kurz [Fri, 15 Jan 2016 15:00:12 +0000 (16:00 +0100)]
target-ppc: kvm: fix floating point registers sync on little-endian hosts

On VSX capable CPUs, the 32 FP registers are mapped to the high-bits
of the 32 first VSX registers. So if you have:

VSR31 = (uint128) 0x0102030405060708090a0b0c0d0e0f00

then

FPR31 = (uint64) 0x0102030405060708

The kernel stores the VSX registers in the fp_state struct following the
host endian element ordering.

On big-endian:

fp_state.fpr[31][0] = 0x0102030405060708
fp_state.fpr[31][1] = 0x090a0b0c0d0e0f00

On little-endian:

fp_state.fpr[31][0] = 0x090a0b0c0d0e0f00
fp_state.fpr[31][1] = 0x0102030405060708

The KVM_GET_ONE_REG and KVM_SET_ONE_REG ioctls preserve this ordering, but
QEMU considers it as big-endian and always copies element [0] to the
fpr[] array and element [1] to the vsr[] array. This does not work with
little-endian hosts, and you will get:

(qemu) p $f31
0x90a0b0c0d0e0f00

instead of:

(qemu) p $f31
0x102030405060708

This patch fixes the element ordering for little-endian hosts.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agopseries: Clean up error reporting in htab migration functions
David Gibson [Wed, 20 Jan 2016 01:59:05 +0000 (12:59 +1100)]
pseries: Clean up error reporting in htab migration functions

The functions for migrating the hash page table on pseries machine type
(htab_save_setup() and htab_load()) can report some errors with an
explicit fprintf() before returning an appropriate error code.  Change some
of these to use error_report() instead. htab_save_setup() is omitted for
now to avoid conflicts with some other in-progress work.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
8 years agopseries: Clean up error reporting in ppc_spapr_init()
David Gibson [Wed, 20 Jan 2016 01:58:55 +0000 (12:58 +1100)]
pseries: Clean up error reporting in ppc_spapr_init()

This function includes a number of explicit fprintf()s for errors.
Change these to use error_report() instead.

Also replace the single exit(EXIT_FAILURE) with an explicit exit(1), since
the latter is the more usual idiom in qemu by a large margin.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
8 years agopseries: Clean up error handling in xics_system_init()
David Gibson [Wed, 20 Jan 2016 01:58:48 +0000 (12:58 +1100)]
pseries: Clean up error handling in xics_system_init()

Use the error handling infrastructure to pass an error out from
try_create_xics() instead of assuming &error_abort - the caller is in a
better position to decide on error handling policy.

Also change the error handling from an &error_abort to &error_fatal, since
this occurs during the initial machine construction and could be triggered
by bad configuration rather than a program error.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
8 years agopseries: Clean up error handling in spapr_rtas_register()
David Gibson [Wed, 20 Jan 2016 01:58:44 +0000 (12:58 +1100)]
pseries: Clean up error handling in spapr_rtas_register()

The errors detected in this function necessarily indicate bugs in the rest
of the qemu code, rather than an external or configuration problem.

So, a simple assert() is more appropriate than any more complex error
reporting.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
8 years agopseries: Clean up error handling in spapr_vga_init()
David Gibson [Wed, 20 Jan 2016 01:58:39 +0000 (12:58 +1100)]
pseries: Clean up error handling in spapr_vga_init()

Use error_setg() to return an error rather than an explicit exit().
Previously it was an exit(0) instead of a non-zero exit code, which was
simply a bug.  Also improve the error message.

While we're at it change the type of spapr_vga_init() to bool since that's
how we're using it anyway.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
8 years agopseries: Clean up error handling in spapr_validate_node_memory()
David Gibson [Mon, 25 Jan 2016 11:46:47 +0000 (22:46 +1100)]
pseries: Clean up error handling in spapr_validate_node_memory()

Use error_setg() and return an error, rather than using an explicit exit().

Also improve messages, and be more explicit about which constraint failed.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
8 years agopseries: Clean up error handling of spapr_cpu_init()
David Gibson [Wed, 20 Jan 2016 01:58:21 +0000 (12:58 +1100)]
pseries: Clean up error handling of spapr_cpu_init()

Currently spapr_cpu_init() is hardcoded to handle any errors as fatal.
That works for now, since it's only called from initial setup where an
error here means we really can't proceed.

However, we'll want to handle this more flexibly for cpu hotplug in future
so generalize this using the error reporting infrastructure.  While we're
at it make a small cleanup in a related part of ppc_spapr_init() to use
error_report() instead of an old-style explicit fprintf().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
8 years agoppc: Clean up error handling in ppc_set_compat()
David Gibson [Wed, 20 Jan 2016 01:58:07 +0000 (12:58 +1100)]
ppc: Clean up error handling in ppc_set_compat()

Current ppc_set_compat() returns -1 for errors, and also (unconditionally)
reports an error message.  The caller in h_client_architecture_support()
may then report it again using an outdated fprintf().

Clean this up by using the modern error reporting mechanisms.  Also add
strerror(errno) to the error message.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
8 years agospapr: Don't create ibm,dynamic-reconfiguration-memory w/o DR LMBs
Bharata B Rao [Tue, 19 Jan 2016 04:39:21 +0000 (10:09 +0530)]
spapr: Don't create ibm,dynamic-reconfiguration-memory w/o DR LMBs

If guest doesn't have any dynamically reconfigurable (DR) logical memory
blocks (LMB), then we shouldn't create ibm,dynamic-reconfiguration-memory
device tree node.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agospapr: Remove abuse of rtas_ld() in h_client_architecture_support
David Gibson [Tue, 19 Jan 2016 04:57:59 +0000 (15:57 +1100)]
spapr: Remove abuse of rtas_ld() in h_client_architecture_support

h_client_architecture_support() uses rtas_ld() for general purpose memory
access, despite the fact that it's not an RTAS routine at all and rtas_ld
makes things more awkward.

Clean this up by replacing rtas_ld() calls with appropriate ldXX_phys()
calls.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agospapr: Remove rtas_st_buffer_direct()
David Gibson [Tue, 19 Jan 2016 04:57:54 +0000 (15:57 +1100)]
spapr: Remove rtas_st_buffer_direct()

rtas_st_buffer_direct() is a not particularly useful wrapper around
cpu_physical_memory_write().  All the callers are in
rtas_ibm_configure_connector, where it's better handled by local helper.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agospapr: Small fixes to rtas_ibm_get_system_parameter, remove rtas_st_buffer
David Gibson [Tue, 19 Jan 2016 04:57:42 +0000 (15:57 +1100)]
spapr: Small fixes to rtas_ibm_get_system_parameter, remove rtas_st_buffer

rtas_st_buffer() appears in spapr.h as though it were a widely used helper,
but in fact it is only used for saving data in a format used by
rtas_ibm_get_system_parameter().  This changes it to a local helper more
specifically for that function.

While we're there fix a couple of small defects in
rtas_ibm_get_system_parameter:
  - For the string value SPLPAR_CHARACTERISTICS, it wasn't including the
    terminating \0 in the length which it should according to LoPAPR
    7.3.16.1
  - It now checks that the supplied buffer has at least enough space for
    the length of the returned data, and returns an error if it does not.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agocuda: add missing fields to VMStateDescription
Mark Cave-Ayland [Wed, 6 Jan 2016 20:37:26 +0000 (20:37 +0000)]
cuda: add missing fields to VMStateDescription

Include some fields missed from the previous VMState conversion to the
migration stream, as well as the new SR_INT delay timer.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agomac_dbdma: add DBDMA controller state to VMStateDescription
Mark Cave-Ayland [Wed, 6 Jan 2016 20:37:25 +0000 (20:37 +0000)]
mac_dbdma: add DBDMA controller state to VMStateDescription

Make sure that we include the DBDMA controller state in the migration
stream.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agomacio: add dma_active to VMStateDescription
Mark Cave-Ayland [Wed, 6 Jan 2016 20:37:24 +0000 (20:37 +0000)]
macio: add dma_active to VMStateDescription

Make sure that we include the value of dma_active in the migration stream.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: John Snow <jsnow@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agomacio: use the existing IDEDMA aiocb to hold the active DMA aiocb
Mark Cave-Ayland [Sat, 30 Jan 2016 12:36:52 +0000 (23:36 +1100)]
macio: use the existing IDEDMA aiocb to hold the active DMA aiocb

Currently the aiocb is held within MACIOIDEState, however the IDE core code
assumes that the current actvie DMA aiocb is held in aiocb in a few places,
e.g. ide_bus_reset() and ide_reset().

Switch over to using IDEDMA aiocb to store the aiocb for the current active
DMA request so that bus resets and restarts are handled correctly. As a
consequence we can now use ide_set_inactive() rather than handling its
functionality ourselves.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: use cpu_write_xer() helper in cpu_post_load
Mark Cave-Ayland [Wed, 6 Jan 2016 18:22:11 +0000 (18:22 +0000)]
target-ppc: use cpu_write_xer() helper in cpu_post_load

Otherwise some internal xer variables fail to get set post-migration.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: Use sensible POWER8/POWER8E versions
Benjamin Herrenschmidt [Wed, 11 Nov 2015 00:15:46 +0000 (11:15 +1100)]
target-ppc: Use sensible POWER8/POWER8E versions

We never released anything older than POWER8 DD2.0 and POWER8E DD2.1,
so let's use these versions, without that some firmware or Linux code
might fail to use some HW features that were non functional in earlier
internal only spins of the chip.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agohw: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:30 +0000 (18:17 +0000)]
hw: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-38-git-send-email-peter.maydell@linaro.org

8 years agohw/core: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:29 +0000 (18:17 +0000)]
hw/core: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-37-git-send-email-peter.maydell@linaro.org

8 years agoarm devices: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:28 +0000 (18:17 +0000)]
arm devices: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-36-git-send-email-peter.maydell@linaro.org

8 years agotilegx: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:27 +0000 (18:17 +0000)]
tilegx: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-35-git-send-email-peter.maydell@linaro.org

8 years agotricore: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:26 +0000 (18:17 +0000)]
tricore: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-34-git-send-email-peter.maydell@linaro.org

8 years agomoxie: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:25 +0000 (18:17 +0000)]
moxie: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-33-git-send-email-peter.maydell@linaro.org

8 years agocris: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:24 +0000 (18:17 +0000)]
cris: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-32-git-send-email-peter.maydell@linaro.org

8 years agom68k: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:23 +0000 (18:17 +0000)]
m68k: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-31-git-send-email-peter.maydell@linaro.org

8 years agoopenrisc: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:22 +0000 (18:17 +0000)]
openrisc: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-30-git-send-email-peter.maydell@linaro.org

8 years agoxtensa: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:21 +0000 (18:17 +0000)]
xtensa: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-29-git-send-email-peter.maydell@linaro.org

8 years agosh4: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:20 +0000 (18:17 +0000)]
sh4: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-28-git-send-email-peter.maydell@linaro.org

8 years agohw/intc: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:19 +0000 (18:17 +0000)]
hw/intc: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-27-git-send-email-peter.maydell@linaro.org

8 years agohw/timer: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:18 +0000 (18:17 +0000)]
hw/timer: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-26-git-send-email-peter.maydell@linaro.org

8 years agohw/misc: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:17 +0000 (18:17 +0000)]
hw/misc: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-25-git-send-email-peter.maydell@linaro.org

8 years agohw/scsi: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:16 +0000 (18:17 +0000)]
hw/scsi: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-24-git-send-email-peter.maydell@linaro.org

8 years agopci: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:15 +0000 (18:17 +0000)]
pci: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-23-git-send-email-peter.maydell@linaro.org

8 years agohw/vfio: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:14 +0000 (18:17 +0000)]
hw/vfio: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-22-git-send-email-peter.maydell@linaro.org

8 years agohw/display: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:13 +0000 (18:17 +0000)]
hw/display: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-21-git-send-email-peter.maydell@linaro.org

8 years agousb: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:12 +0000 (18:17 +0000)]
usb: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-20-git-send-email-peter.maydell@linaro.org

8 years agohw/net: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:11 +0000 (18:17 +0000)]
hw/net: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-19-git-send-email-peter.maydell@linaro.org

8 years ago9pfs: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:10 +0000 (18:17 +0000)]
9pfs: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-18-git-send-email-peter.maydell@linaro.org

8 years agoide: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:09 +0000 (18:17 +0000)]
ide: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-17-git-send-email-peter.maydell@linaro.org

8 years agotcg: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:08 +0000 (18:17 +0000)]
tcg: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-16-git-send-email-peter.maydell@linaro.org

8 years agovirtio: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:07 +0000 (18:17 +0000)]
virtio: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-15-git-send-email-peter.maydell@linaro.org

8 years agoxen: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:06 +0000 (18:17 +0000)]
xen: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-14-git-send-email-peter.maydell@linaro.org

8 years agoarm: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:05 +0000 (18:17 +0000)]
arm: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-13-git-send-email-peter.maydell@linaro.org

8 years agoalpha: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:04 +0000 (18:17 +0000)]
alpha: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-12-git-send-email-peter.maydell@linaro.org

8 years agox86: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:03 +0000 (18:17 +0000)]
x86: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-11-git-send-email-peter.maydell@linaro.org

8 years agolinux-user: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:02 +0000 (18:17 +0000)]
linux-user: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-10-git-send-email-peter.maydell@linaro.org

8 years agounicore: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:01 +0000 (18:17 +0000)]
unicore: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-9-git-send-email-peter.maydell@linaro.org

8 years agos390: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:17:00 +0000 (18:17 +0000)]
s390: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1453832250-766-8-git-send-email-peter.maydell@linaro.org

8 years agosparc: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:16:59 +0000 (18:16 +0000)]
sparc: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453832250-766-7-git-send-email-peter.maydell@linaro.org

8 years agoppc: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:16:58 +0000 (18:16 +0000)]
ppc: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

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

8 years agolm32: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:16:57 +0000 (18:16 +0000)]
lm32: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

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

8 years agoexec: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:16:56 +0000 (18:16 +0000)]
exec: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

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

8 years agocrypto: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:16:55 +0000 (18:16 +0000)]
crypto: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

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

8 years agomigration: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:16:54 +0000 (18:16 +0000)]
migration: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

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

8 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20160128' into staging
Peter Maydell [Thu, 28 Jan 2016 11:46:33 +0000 (11:46 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160128' into staging

Mostly bugfixes and small improvements; and the gdb target.xml
patch.

# gpg: Signature made Thu 28 Jan 2016 11:02:14 GMT using RSA key ID C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"

* remotes/cohuck/tags/s390x-20160128:
  s390x: s390_cpu_get_phys_page_debug has to return -1
  gdb: provide the name of the architecture in the target.xml
  s390x/css: fix control flags during csch
  watchdog/diag288: don't reset for action=none|debug|pause
  watchdog: introduction of get_watchdog_action
  s390x: fix generation of event information crw
  s390x/ioinst: set type and len for SEI response
  s390x/sclp: add device to the sysbus in sclp_realize
  s390x/machine: make addon register fields static
  s390x/skeys: Fix instance and class size

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agomicroblaze: Clean up includes
Peter Maydell [Tue, 26 Jan 2016 18:05:31 +0000 (18:05 +0000)]
microblaze: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1453831531-667-3-git-send-email-peter.maydell@linaro.org

8 years agodisas/microblaze.c: Don't define TRUE or FALSE
Peter Maydell [Tue, 26 Jan 2016 18:05:30 +0000 (18:05 +0000)]
disas/microblaze.c: Don't define TRUE or FALSE

Don't define TRUE and FALSE locally or manually include stdio.h;
instead use osdep.h which provides them.

This is a necessary prerequisite for moving to "everywhere includes
osdep.h", because otherwise there is a compile error due to the
redefinition of TRUE and FALSE.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1453831531-667-2-git-send-email-peter.maydell@linaro.org

8 years agos390x: s390_cpu_get_phys_page_debug has to return -1
David Hildenbrand [Wed, 9 Dec 2015 15:36:42 +0000 (16:36 +0100)]
s390x: s390_cpu_get_phys_page_debug has to return -1

If translation fails, we have to return -1. For now, we
would simply return the value last stored to raddr (if any).

This way, reading invalid memory via gdb will return values, although it
shouldn't.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agogdb: provide the name of the architecture in the target.xml
David Hildenbrand [Thu, 3 Dec 2015 12:14:41 +0000 (13:14 +0100)]
gdb: provide the name of the architecture in the target.xml

This patch provides the name of the architecture in the target.xml
if available.

This allows the remote gdb to detect the target architecture on its
own - so there is no need to specify it manually (e.g. if gdb is
started without a binary) using "set arch *arch_name*".

The name of the architecture is provided by a callback that can
be implemented by all architectures. The arm implementation has
special handling for iwmmxt and returns arm otherwise. This can
be extended if necessary.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[rework to use a callback]
Message-Id: <1449144881-130935-1-git-send-email-borntraeger@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/css: fix control flags during csch
Halil Pasic [Wed, 20 Jan 2016 18:51:30 +0000 (19:51 +0100)]
s390x/css: fix control flags during csch

From the beginning, css support contained an error in csch handling:
instead of setting the clear bit in the function control bits twice, we
need to set the clear pending bit in the activity control bits. Let's
fix this.

Cc: qemu-stable@nongnu.org
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agowatchdog/diag288: don't reset for action=none|debug|pause
Bo Tu [Tue, 19 Jan 2016 07:45:19 +0000 (08:45 +0100)]
watchdog/diag288: don't reset for action=none|debug|pause

If the watchdog expires and the guest is not notified (NONE, DEBUG, PAUSE),
we must not reset the watchdog device, otherwise watchdog_ping() and
watchdog_stop() will fail when triggered by the guest. This reset behavior
matches to the z/VM behavior when a custom command is to be executed
on expiry.

Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Bo Tu <tubo@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agowatchdog: introduction of get_watchdog_action
Bo Tu [Tue, 19 Jan 2016 07:34:41 +0000 (08:34 +0100)]
watchdog: introduction of get_watchdog_action

Add get_watchdog_action(void) to allow access to the configured action.

Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Bo Tu <tubo@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x: fix generation of event information crw
Song Shan Gong [Tue, 19 Jan 2016 01:55:00 +0000 (02:55 +0100)]
s390x: fix generation of event information crw

Only one channel report word (crw) may be pending if there is
event-information pending.

This patch introduces a bool-type field 'sei_pending' for the
channel subsystem, which indicates whether there are pending events.
It is set when event information is made pending and the crw
generated, and cleared after the guest has collected all pending
event information. A crw is not generated if this flag had already
been set.

Signed-off-by: Song Shan Gong <gongss@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/ioinst: set type and len for SEI response
Pierre Morel [Thu, 14 Jan 2016 12:29:53 +0000 (13:29 +0100)]
s390x/ioinst: set type and len for SEI response

If no event information is pending, the return code
is set to 0x0005 and the length of the response is
set to 8 bytes.

Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Song Shan Gong <gongss@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/sclp: add device to the sysbus in sclp_realize
David Hildenbrand [Mon, 23 Nov 2015 12:03:08 +0000 (13:03 +0100)]
s390x/sclp: add device to the sysbus in sclp_realize

The init of a device should have no side effects. Therefore move
registering of the event facility into the realize function, so
multiple instances of the SCLP device can be created e.g. for
introspection.

Add some more detail as to why we have to add it to the sysbus
at all.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/machine: make addon register fields static
Christian Borntraeger [Tue, 8 Dec 2015 08:22:52 +0000 (09:22 +0100)]
s390x/machine: make addon register fields static

No need to have them as global symbol.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/skeys: Fix instance and class size
Christian Borntraeger [Tue, 8 Dec 2015 08:16:27 +0000 (09:16 +0100)]
s390x/skeys: Fix instance and class size

fix a typo that messes up instance and class size.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/xen-20160126-2' into staging
Peter Maydell [Tue, 26 Jan 2016 17:25:11 +0000 (17:25 +0000)]
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20160126-2' into staging

Xen 2016/01/26 with Signed-off-by lines.

# gpg: Signature made Tue 26 Jan 2016 17:20:12 GMT using RSA key ID 70E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"

* remotes/sstabellini/tags/xen-20160126-2:
  xen: make it possible to build without the Xen PV domain builder
  xen: domainbuild: reopen libxenctrl interface after forking for domain watcher.
  xen: Use stable library interfaces when they are available.
  xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API.
  xen: Switch uses of xc_map_foreign_range into xc_map_foreign_pages
  xen: Switch to libxengnttab interface for compat shims.
  xen: Switch to libxenevtchn interface for compat shims.
  xen_console: correctly cleanup primary console on teardown.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoxen: make it possible to build without the Xen PV domain builder
Ian Campbell [Fri, 15 Jan 2016 13:23:44 +0000 (13:23 +0000)]
xen: make it possible to build without the Xen PV domain builder

Until the previous patch this relied on xc_fd(), which was only
implemented for Xen 4.0 and earlier.

Given this wasn't working since Xen 4.0 I have marked this as disabled
by default.

Removing this support drops the use of a bunch of symbols from
libxenctrl, specifically:

  - xc_domain_create
  - xc_domain_destroy
  - xc_domain_getinfo
  - xc_domain_max_vcpus
  - xc_domain_setmaxmem
  - xc_domain_unpause
  - xc_evtchn_alloc_unbound
  - xc_linux_build

This is another step towards only using Xen libraries which provide a
stable inteface.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoxen: domainbuild: reopen libxenctrl interface after forking for domain watcher.
Ian Campbell [Fri, 15 Jan 2016 13:23:43 +0000 (13:23 +0000)]
xen: domainbuild: reopen libxenctrl interface after forking for domain watcher.

Using an existing libxenctrl handle after a fork was never
particularly safe (especially if foreign mappings existed at the time
of the fork) and the xc fd has been unavailable for many releases.

Reopen the handle after fork and therefore do away with xc_fd().

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoxen: Use stable library interfaces when they are available.
Ian Campbell [Fri, 15 Jan 2016 13:23:42 +0000 (13:23 +0000)]
xen: Use stable library interfaces when they are available.

In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.

Specifically libxenevtchn, libxengnttab and libxenforeignmemory.

Previous patches have already laid the groundwork for using these by
switching the existing compatibility shims to reflect the intefaces to
these libraries.

So all which remains is to update configure to detect the libraries
and enable their use. Although they are notionally independent we take
an all or nothing approach to the three libraries since they were
added at the same time.

The only non-obvious bit is that we now open a proper xenforeignmemory
handle for xen_fmem instead of reusing the xen_xc handle.

Build tested with 4.0 .. 4.6 (inclusive) and the patches targetting
4.7 which adds these libraries.

This uses CONFIG_XEN_CTRL_INTERFACE_VERSION == 471 to cover the
introduction of these new interfaces.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoxen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API.
Ian Campbell [Fri, 15 Jan 2016 13:23:41 +0000 (13:23 +0000)]
xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API.

In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.

One such library will be libxenforeignmemory which provides access to
privileged foreign mappings and which will provide an interface
equivalent to xc_map_foreign_{pages,bulk}.

The new xenforeignmemory_map() function behaves like
xc_map_foreign_pages() when the err argument is NULL and like
xc_map_foreign_bulk() when err is non-NULL, which maps into the shim
here onto checking err == NULL and calling the appropriate old
function.

Note that xenforeignmemory_map() takes the number of pages before the
arrays themselves, in order to support potentially future use of
variable-length-arrays in the prototype (in the future, when Xen's
baseline toolchain requirements are new enough to ensure VLAs are
supported).

In preparation for adding support for libxenforeignmemory add support
to the <=4.0 and <=4.6 compat code in xen_common.h to allow us to
switch to using the new API. These shims will disappear for versions
of Xen which include libxenforeignmemory.

Since libxenforeignmemory will have its own handle type but for <= 4.6
the functionality is provided by using a libxenctrl handle we
introduce a new global xen_fmem alongside the existing xen_xc. In fact
we make xen_fmem a pointer to the existing xen_xc, which then works
correctly with both <=4.0 (xc handle is an int) and <=4.6 (xc handle
is a pointer). In the latter case xen_fmem is actually a double
indirect pointer, but it all falls out in the wash.

Unlike libxenctrl libxenforeignmemory has an explicit unmap function,
rather than just specifying that munmap should be used, so the unmap
paths are updated to use xenforeignmemory_unmap, which is a shim for
munmap on these versions of xen. The mappings in xen-hvm.c do not
appear to be unmapped (which makes sense for a qemu-dm process)

In fb_disconnect this results in a change from simply mmap over the
existing mapping (with an implicit munmap) to expliclty unmapping with
xenforeignmemory_unmap and then mapping the required anonymous memory
in the same hole. I don't think this is a problem since any other
thread which was racily touching this region would already be running
the risk of hitting the mapping halfway through the call. If this is
thought to be a problem then we could consider adding an extra API to
the libxenforeignmemory interface to replace a foreign mapping with
anonymous shared memory, but I'd prefer not to.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoxen: Switch uses of xc_map_foreign_range into xc_map_foreign_pages
Ian Campbell [Fri, 15 Jan 2016 13:23:40 +0000 (13:23 +0000)]
xen: Switch uses of xc_map_foreign_range into xc_map_foreign_pages

In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.

One such library will be libxenforeignmemory which provides access to
privileged foreign mappings and which will provide an interface
equivalent to xc_map_foreign_{pages,bulk}.

In preparation for this switch all uses of xc_map_foreign_range to
xc_map_foreign_pages. This is trivial because size was always
XC_PAGE_SIZE so the necessary adjustments are trivial:

  * Pass &mfn (an array of length 1) instead of mfn. The function
    takes a pointer to const, so there is no possibily of mfn changing
    due to this change.
  * Pass nr_pages=1 instead of size=XC_PAGE_SIZE

There is one wrinkle in xen_console.c:con_initialise() where
con->ring_ref is an int but can in some code paths (when !xendev->dev)
be treated as an mfn. I think this is an existing latent truncation
hazard on platforms where xen_pfn_t is 64-bit and int is 32-bit (e.g.
amd64, both arm* variants). I'm unsure under what circumstances
xendev->dev can be NULL or if anything elsewhere ensures the value
fits into an int. For now I just use a temporary xen_pfn_t to in
effect upcast the pointer from int* to xen_pfn_t*.

In xenfb.c:common_bind we now explicitly launder the mfn into a
xen_pfn_t, so it has the correct type to be passed to
xc_map_foreign_pages and doesn't provoke warnings on 32-bit x86.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoxen: Switch to libxengnttab interface for compat shims.
Ian Campbell [Fri, 15 Jan 2016 13:23:39 +0000 (13:23 +0000)]
xen: Switch to libxengnttab interface for compat shims.

In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.

One such library will be libxengnttab which provides access to grant
tables.

In preparation for this switch the compatibility layer in xen_common.h
(which support building with older versions of Xen) to use what will
be the new library API. This means that the gnttab shim will disappear
for versions of Xen which include libxengnttab.

To simplify things for the <= 4.0.0 support we wrap the int fd in a
malloc(sizeof int) such that the handle is always a pointer. This
leads to less typedef headaches and the need for
XC_HANDLER_INITIAL_VALUE etc for these interfaces.

Note that this patch does not add any support for actually using
libxengnttab, it just adjusts the existing shims.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoxen: Switch to libxenevtchn interface for compat shims.
Ian Campbell [Fri, 15 Jan 2016 13:23:38 +0000 (13:23 +0000)]
xen: Switch to libxenevtchn interface for compat shims.

In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.

One such library will be libxenevtchn which provides access to event
channels.

In preparation for this switch the compatibility layer in xen_common.h
(which support building with older versions of Xen) to use what will
be the new library API. This means that the evtchn shim will disappear
for versions of Xen which include libxenevtchn.

To simplify things for the <= 4.0.0 support we wrap the int fd in a
malloc(sizeof int) such that the handle is always a pointer. This
leads to less typedef headaches and the need for
XC_HANDLER_INITIAL_VALUE etc for these interfaces.

Note that this patch does not add any support for actually using
libxenevtchn, it just adjusts the existing shims.

Note that xc_evtchn_alloc_unbound functionality remains in libxenctrl,
since that functionality is not exposed by /dev/xen/evtchn.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoxen_console: correctly cleanup primary console on teardown.
Ian Campbell [Fri, 15 Jan 2016 13:23:37 +0000 (13:23 +0000)]
xen_console: correctly cleanup primary console on teardown.

All of the work in con_disconnect applies to the primary console case
(when xendev->dev is NULL). Therefore remove the early check and bail
and allow it to fall through. All of the existing code is correctly
conditional already.

The ->dev and ->gnttabdev handles are either both set or neither. For
consistency with con_initialise() with to the former here too.

With this con_initialise and con_disconnect now mirror each other.

Fix up a hard tab in the function while editing.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Tue, 26 Jan 2016 15:09:13 +0000 (15:09 +0000)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* chardev support for TLS and leak fix
* NBD fix from Denis
* condvar fix from Dave
* kvm_stat and dump-guest-memory almost rewrite
* mem-prealloc fix from Luiz
* manpage style improvement

# gpg: Signature made Tue 26 Jan 2016 14:58:18 GMT using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"

* remotes/bonzini/tags/for-upstream: (49 commits)
  scripts/dump-guest-memory.py: Fix module docstring
  scripts/dump-guest-memory.py: Introduce multi-arch support
  scripts/dump-guest-memory.py: Cleanup functions
  scripts/dump-guest-memory.py: Improve python 3 compatibility
  scripts/dump-guest-memory.py: Make methods functions
  scripts/dump-guest-memory.py: Move constants to the top
  nbd: add missed aio_context_acquire in nbd_export_new
  memory: exit when hugepage allocation fails if mem-prealloc
  cpus: use broadcast on qemu_pause_cond
  scripts/kvm/kvm_stat: Add optparse description
  scripts/kvm/kvm_stat: Add interactive filtering
  scripts/kvm/kvm_stat: Fixup filtering
  scripts/kvm/kvm_stat: Fix rlimit for unprivileged users
  scripts/kvm/kvm_stat: Read event values as u64
  scripts/kvm/kvm_stat: Cleanup and pre-init perf_event_attr
  scripts/kvm/kvm_stat: Fix output formatting
  scripts/kvm/kvm_stat: Make tui function a class
  scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS
  scripts/kvm/kvm_stat: Group arch specific data
  scripts/kvm/kvm_stat: Cleanup of Event class
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoscripts/dump-guest-memory.py: Fix module docstring
Janosch Frank [Fri, 22 Jan 2016 12:08:40 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Fix module docstring

The module docstring is changed into a multi-line comment to comply
with pep 257.

The comment about the docstring that gets used by gdb to print the
help is moved to the location of the docstring.

Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1453464520-3882-7-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscripts/dump-guest-memory.py: Introduce multi-arch support
Janosch Frank [Fri, 22 Jan 2016 12:08:39 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Introduce multi-arch support

By modelling the ELF with ctypes we not only gain full python 3
support but can also create dumps for different architectures more easily.

Tested-by: Andrew Jones <drjones@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1453464520-3882-6-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscripts/dump-guest-memory.py: Cleanup functions
Janosch Frank [Fri, 22 Jan 2016 12:08:38 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Cleanup functions

Increase readability by adding newlines and comments, as well as
removing wrong whitespaces and C style braces around conditionals and
loops.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1453464520-3882-5-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscripts/dump-guest-memory.py: Improve python 3 compatibility
Janosch Frank [Fri, 22 Jan 2016 12:08:37 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Improve python 3 compatibility

This commit does not make the script python 3 compatible, it is a
preparation that fixes the easy and common incompatibilities.

Print is a function in python 3 and therefore needs braces around its
arguments.

Range does not cast a gdb.Value object to int in python 3, we have to
do it ourselves.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1453464520-3882-4-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscripts/dump-guest-memory.py: Make methods functions
Janosch Frank [Fri, 22 Jan 2016 12:08:36 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Make methods functions

The functions dealing with qemu components rarely used parts of the
class, so they were moved out of the class.

As the uintptr_t variable is needed both within and outside the class,
it was made a constant and moved to the top.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1453464520-3882-3-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscripts/dump-guest-memory.py: Move constants to the top
Janosch Frank [Fri, 22 Jan 2016 12:08:35 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Move constants to the top

The constants bloated the class definition and were therefore moved to
the top.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1453464520-3882-2-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: add missed aio_context_acquire in nbd_export_new
Denis V. Lunev [Wed, 20 Jan 2016 07:12:20 +0000 (10:12 +0300)]
nbd: add missed aio_context_acquire in nbd_export_new

blk_invalidate_cache() can call qcow2_invalidate_cache which performs
IO inside.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1453273940-15382-3-git-send-email-den@openvz.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomemory: exit when hugepage allocation fails if mem-prealloc
Luiz Capitulino [Fri, 22 Jan 2016 14:15:01 +0000 (09:15 -0500)]
memory: exit when hugepage allocation fails if mem-prealloc

When -mem-prealloc is passed on the command-line, the expected
behavior is to exit if the hugepage allocation fails.  However,
this behavior is broken since commit cc57501dee which made
hugepage allocation fall back to regular ram in case of faliure.

This commit restores the expected behavior for -mem-prealloc.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Message-Id: <20160122091501.75bbd42a@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agocpus: use broadcast on qemu_pause_cond
Dr. David Alan Gilbert [Mon, 25 Jan 2016 10:08:18 +0000 (10:08 +0000)]
cpus: use broadcast on qemu_pause_cond

Jiri saw a hang on pause_all_vcpus called from postcopy_start,
where the cpus are all apparently stopped ('stopped' flag set)
but pause_all_vcpus is still stuck on a cond_wait on qemu_paused_cond.
We suspect this is happening if a qmp_stop is called at about the
same time as the postcopy code calls that pause_all_vcpus;
although they both should have the main lock held, Paolo spotted
the cond_wait unlocks the global lock so perhaps they both
could end up waiting at the same time?

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reported-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <1453716498-27238-1-git-send-email-dgilbert@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>