]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Tue, 3 Sep 2013 17:31:07 +0000 (12:31 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

pc,pci,virtio fixes and cleanups

This includes pc and pci cleanups and enhancements,
and a virtio bugfix for level interrupts.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Sun 01 Sep 2013 03:15:36 AM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Michael S. Tsirkin (3) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  virtio_pci: fix level interrupts with irqfd
  pc: reduce duplication, fix PIIX descriptions
  hw: Clean up bogus default boot order
  pci: add config space access traces
  pc: fix regression for 64 bit PCI memory
  pci: Introduce helper to retrieve a PCI device's DMA address space

Message-id: 1378023590-11109-1-git-send-email-mst@redhat.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
10 years agoMerge remote-tracking branch 'afaerber/tags/qom-devices-for-anthony' into staging
Anthony Liguori [Tue, 3 Sep 2013 17:30:51 +0000 (12:30 -0500)]
Merge remote-tracking branch 'afaerber/tags/qom-devices-for-anthony' into staging

QOM device refactorings

* Fix QOM and ISA documentation errors
* Extend object_initialize() et al. to check the instance size

# gpg: Signature made Fri 30 Aug 2013 02:19:48 PM CDT using RSA key ID 3E7E013F
# gpg: Can't check signature: public key not found

# By Andreas Färber (14) and others
# Via Andreas Färber
* afaerber/tags/qom-devices-for-anthony:
  isa: Fix documentation of isa_register_portio_list()
  qom: Assert instance size in object_initialize_with_type()
  qom: Pass available size to object_initialize()
  qdev: Pass size to qbus_create_inplace()
  virtio-mmio: Pass size to virtio_mmio_bus_new()
  virtio-ccw: Pass size to virtio_ccw_bus_new()
  s390-virtio-bus: Pass size to virtio_s390_bus_new()
  virtio-pci: Pass size to virtio_pci_bus_new()
  usb: Pass size to usb_bus_new()
  scsi: Pass size to scsi_bus_new()
  pci: Pass size to pci_bus_new_inplace()
  ide: Pass size to ide_bus_new()
  ipack: Pass size to ipack_bus_new_inplace()
  intel-hda: Pass size to hda_codec_bus_init()
  qom: Fix object_initialize_with_type() argument name in documentation
  virtio: Remove unnecessary OBJECT() casts
  object: Fix typo in qom/object.h

10 years agoMerge branch 'tcg-next' of git://github.com/rth7680/qemu
Aurelien Jarno [Mon, 2 Sep 2013 23:35:43 +0000 (01:35 +0200)]
Merge branch 'tcg-next' of git://github.com/rth7680/qemu

* 'tcg-next' of git://github.com/rth7680/qemu: (29 commits)
  tcg-i386: Make use of zero-extended memory helper routines
  tcg: Introduce zero and sign-extended versions of load helpers
  exec: Split softmmu_defs.h
  target: Include softmmu_exec.h where forgotten
  exec: Rename USUFFIX to LSUFFIX
  tcg-i386: Don't perform GETPC adjustment in TCG code
  exec: Reorganize the GETRA/GETPC macros
  configure: Allow x32 as a host
  tcg-i386: Adjust tcg_out_tlb_load for x32
  tcg-i386: Use intptr_t appropriately
  tcg: Fix jit debug for x32
  tcg: Use appropriate types in tcg_reg_alloc_call
  tcg: Change tcg_out_ld/st offset to intptr_t
  tcg: Change tcg_gen_exit_tb argument to uintptr_t
  tcg: Use uintptr_t in TCGHelperInfo
  tcg: Change relocation offsets to intptr_t
  tcg: Change memory offsets to intptr_t
  tcg: Change frame pointer offsets to intptr_t
  tcg: Define TCG_ptr properly
  tcg: Define TCG_TYPE_PTR properly
  ...

10 years agoMerge branch 'ppc-for-upstream' of git://github.com/agraf/qemu
Aurelien Jarno [Mon, 2 Sep 2013 23:35:25 +0000 (01:35 +0200)]
Merge branch 'ppc-for-upstream' of git://github.com/agraf/qemu

* 'ppc-for-upstream' of git://github.com/agraf/qemu:
  PPC: spapr: iommu: rework traces
  spapr: add "stop-self" RTAS call required to support hot CPU unplug
  PPC: KVM: Compile fix for qemu_notify_event
  pseries: Add H_SET_MODE hcall to change guest exception endianness
  xics: move registration of global state to realize()
  spapr-pci: rework MSI/MSIX
  target-ppc: Use #define instead of opencoding SLB valid bit
  spapr-pci: fix config space access to support bridges
  target-ppc: fix bit extraction for FPBF and FPL
  ppc405_boards: Don't enforce presence of firmware for qtest
  ppc405_uc: Disable debug output
  ppc405_boards: Disable debug output
  ppc: virtex_ml507: QEMU_OPTION_dtb support for this machine.
  disas/ppc.c: Fix little endian disassembly
  target-ppc: POWER7 supports the MSR_LE bit
  target-ppc: USE LPCR_ILE to control exception endian on POWER7
  pseries: Fix stalls on hypervisor virtual console
  PPC: E500: Generate device tree on reset

10 years agotcg/mips: only enable ext8s/ext16s ops on MIPS32R2
Aurelien Jarno [Thu, 15 Aug 2013 15:57:59 +0000 (17:57 +0200)]
tcg/mips: only enable ext8s/ext16s ops on MIPS32R2

On MIPS ext8s and ext16s ops are implemented with a dedicated
instruction only on MIPS32R2, otherwise the same kind of implementation
than at TCG level (shift left followed by shift right) is used.

Change that by only implementing the ext8s and ext16s ops on MIPS32R2 so
that optimizations can be done by the optimizer. Use an inline version to
avoid having to test again for MIPS32R2 instructions. Keep the shift
implementation for the ld/st routines.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agotcg/mips: inline bswap16/bswap32 ops
Aurelien Jarno [Wed, 28 Aug 2013 11:51:40 +0000 (13:51 +0200)]
tcg/mips: inline bswap16/bswap32 ops

Use an inline version for the bswap16 and bswap32 ops to avoid
testing for MIPS32R2 instructions availability, as these ops are
only available in that case.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agotcg/mips: detect available host instructions at runtime
Aurelien Jarno [Thu, 15 Aug 2013 15:57:59 +0000 (17:57 +0200)]
tcg/mips: detect available host instructions at runtime

Now that TCG supports enabling and disabling ops at runtime, it's
possible to detect the available host instructions at runtime, and
enable the corresponding ops accordingly.

Unfortunately it's not easy to probe for available instructions on
MIPS, the information is partially available in /proc/cpuinfo, and
not available in AUXV. This patch therefore probes for the instructions
by trying to execute them and by catching a possible SIGILL signal.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agotcg-i386: Make use of zero-extended memory helper routines
Richard Henderson [Thu, 29 Aug 2013 22:00:16 +0000 (15:00 -0700)]
tcg-i386: Make use of zero-extended memory helper routines

For 8 and 16-bit unsigned loads, rely on the zero-extension
from the helper and use a smaller 32-bit move insn.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Introduce zero and sign-extended versions of load helpers
Richard Henderson [Tue, 27 Aug 2013 21:09:14 +0000 (14:09 -0700)]
tcg: Introduce zero and sign-extended versions of load helpers

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoexec: Split softmmu_defs.h
Richard Henderson [Tue, 27 Aug 2013 20:13:44 +0000 (13:13 -0700)]
exec: Split softmmu_defs.h

The _cmmu helpers can be moved to exec-all.h.  The helpers that are
used from TCG will shortly need access to tcg_target_long so move
their declarations into tcg.h.

This requires minor include adjustments to all TCG backends.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotarget: Include softmmu_exec.h where forgotten
Richard Henderson [Tue, 27 Aug 2013 20:03:27 +0000 (13:03 -0700)]
target: Include softmmu_exec.h where forgotten

Several targets forgot to include softmmu_exec.h, which would
break them with a header cleanup to follow.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoexec: Rename USUFFIX to LSUFFIX
Richard Henderson [Tue, 27 Aug 2013 18:31:48 +0000 (11:31 -0700)]
exec: Rename USUFFIX to LSUFFIX

In a following patch, there will be confusion between multiple "unsigned"
suffixes; rename this one so as to imply "load".

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Don't perform GETPC adjustment in TCG code
Richard Henderson [Tue, 27 Aug 2013 17:47:49 +0000 (10:47 -0700)]
tcg-i386: Don't perform GETPC adjustment in TCG code

Since we now perform it inside the helper, no need to do it here.
This also lets us perform a tail-call from the store slow path to
the helper.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoexec: Reorganize the GETRA/GETPC macros
Richard Henderson [Tue, 27 Aug 2013 17:22:54 +0000 (10:22 -0700)]
exec: Reorganize the GETRA/GETPC macros

Always define GETRA; use __builtin_extract_return_addr, rather than
having a special case for s390.  Split GETPC_ADJ out of GETPC; use 2
universally, rather than having a special case for arm.

Rename GETPC_LDST to GETRA_LDST to indicate that it does not
contain the GETPC_ADJ value.  Likewise with GETPC_EXT to GETRA_EXT.

Perform the GETPC_ADJ adjustment inside helper_ret_ld/st.  This will
allow backends to pass along the "true" return address rather than
the massaged GETPC value.  In the meantime, double application of
GETPC_ADJ does not hurt, since the call insn in all ISAs is at least
4 bytes long.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoconfigure: Allow x32 as a host
Richard Henderson [Tue, 20 Aug 2013 19:20:05 +0000 (12:20 -0700)]
configure: Allow x32 as a host

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Adjust tcg_out_tlb_load for x32
Richard Henderson [Tue, 20 Aug 2013 23:50:38 +0000 (16:50 -0700)]
tcg-i386: Adjust tcg_out_tlb_load for x32

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Use intptr_t appropriately
Richard Henderson [Tue, 20 Aug 2013 22:37:16 +0000 (15:37 -0700)]
tcg-i386: Use intptr_t appropriately

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Fix jit debug for x32
Richard Henderson [Wed, 21 Aug 2013 00:20:30 +0000 (17:20 -0700)]
tcg: Fix jit debug for x32

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Use appropriate types in tcg_reg_alloc_call
Richard Henderson [Wed, 21 Aug 2013 00:12:38 +0000 (17:12 -0700)]
tcg: Use appropriate types in tcg_reg_alloc_call

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Change tcg_out_ld/st offset to intptr_t
Richard Henderson [Wed, 21 Aug 2013 00:07:26 +0000 (17:07 -0700)]
tcg: Change tcg_out_ld/st offset to intptr_t

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Change tcg_gen_exit_tb argument to uintptr_t
Richard Henderson [Tue, 20 Aug 2013 22:53:10 +0000 (15:53 -0700)]
tcg: Change tcg_gen_exit_tb argument to uintptr_t

And update all users.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Use uintptr_t in TCGHelperInfo
Richard Henderson [Tue, 20 Aug 2013 22:38:41 +0000 (15:38 -0700)]
tcg: Use uintptr_t in TCGHelperInfo

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Change relocation offsets to intptr_t
Richard Henderson [Tue, 20 Aug 2013 22:30:10 +0000 (15:30 -0700)]
tcg: Change relocation offsets to intptr_t

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Change memory offsets to intptr_t
Richard Henderson [Tue, 20 Aug 2013 22:17:25 +0000 (15:17 -0700)]
tcg: Change memory offsets to intptr_t

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Change frame pointer offsets to intptr_t
Richard Henderson [Tue, 20 Aug 2013 22:12:31 +0000 (15:12 -0700)]
tcg: Change frame pointer offsets to intptr_t

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Define TCG_ptr properly
Richard Henderson [Tue, 20 Aug 2013 22:07:08 +0000 (15:07 -0700)]
tcg: Define TCG_ptr properly

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Define TCG_TYPE_PTR properly
Richard Henderson [Tue, 20 Aug 2013 21:48:46 +0000 (14:48 -0700)]
tcg: Define TCG_TYPE_PTR properly

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Allow TCG_TARGET_REG_BITS to be specified independantly
Richard Henderson [Tue, 20 Aug 2013 21:41:29 +0000 (14:41 -0700)]
tcg: Allow TCG_TARGET_REG_BITS to be specified independantly

There are several hosts for which it would be useful to use the
available 64-bit registers in a 32-bit pointer environment.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Fix next_tb type in cpu_exec
Richard Henderson [Tue, 20 Aug 2013 21:40:25 +0000 (14:40 -0700)]
tcg: Fix next_tb type in cpu_exec

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Change tcg_qemu_tb_exec return to uintptr_t
Richard Henderson [Tue, 20 Aug 2013 21:35:34 +0000 (14:35 -0700)]
tcg: Change tcg_qemu_tb_exec return to uintptr_t

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Change flush_icache_range arguments to uintptr_t
Richard Henderson [Tue, 20 Aug 2013 21:22:50 +0000 (14:22 -0700)]
tcg: Change flush_icache_range arguments to uintptr_t

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoqtest: Fix FMT_timeval vs time_t
Richard Henderson [Tue, 20 Aug 2013 20:53:25 +0000 (13:53 -0700)]
qtest: Fix FMT_timeval vs time_t

Since FMT_timeval unconditionally uses %ld for both tv_sec and tv_usec,
and already casts tv_usec to long, also cast tv_sec to long.

Cc: Andreas Färber <afaerber@suse.de>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Constant fold div, rem
Richard Henderson [Wed, 14 Aug 2013 22:22:46 +0000 (15:22 -0700)]
tcg: Constant fold div, rem

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Implement muluh, mulsh
Richard Henderson [Wed, 14 Aug 2013 21:46:08 +0000 (14:46 -0700)]
tcg-ppc64: Implement muluh, mulsh

Using these instead of mulu2 and muls2 lets us avoid having to argument
overlap analysis in the backend.  Normal register allocation will DTRT.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Implement mulsh, muluh
Richard Henderson [Wed, 14 Aug 2013 21:41:43 +0000 (14:41 -0700)]
tcg-mips: Implement mulsh, muluh

With the optimization in tcg_liveness_analysis,
we can avoid the MFLO when it is unused.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Add muluh and mulsh opcodes
Richard Henderson [Wed, 14 Aug 2013 21:35:56 +0000 (14:35 -0700)]
tcg: Add muluh and mulsh opcodes

Use them in places where mulu2 and muls2 are used.
Optimize mulx2 with dead low part to mulxh.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoPPC: spapr: iommu: rework traces
Alexey Kardashevskiy [Thu, 29 Aug 2013 08:05:00 +0000 (18:05 +1000)]
PPC: spapr: iommu: rework traces

This converts old style fprintf to traces.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
[agraf: change patch subject]
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr: add "stop-self" RTAS call required to support hot CPU unplug
Alexey Kardashevskiy [Fri, 30 Aug 2013 06:11:56 +0000 (16:11 +1000)]
spapr: add "stop-self" RTAS call required to support hot CPU unplug

PAPR+ requires two RTAS calls to be supported by the hypervisor in
order to allow hotplugging VCPUs from the guest. The "start-cpu" RTAS
call was already there but "stop-self" was not.

This adds the "stop-self" RTAS call.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoPPC: KVM: Compile fix for qemu_notify_event
Alexander Graf [Thu, 29 Aug 2013 00:00:16 +0000 (02:00 +0200)]
PPC: KVM: Compile fix for qemu_notify_event

The function qemu_notify_event is defined by a header that we don't
include in the PPC KVM code. Include it to get the code building
again.

  target-ppc/kvm_ppc.c: In function 'kvmppc_timer_hack':
  target-ppc/kvm_ppc.c:26:5: error: implicit declaration of function 'qemu_notify_event' [-Werror=implicit-function-declaration]
  target-ppc/kvm_ppc.c:26:5: error: nested extern declaration of 'qemu_notify_event' [-Werror=nested-externs]

Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agopseries: Add H_SET_MODE hcall to change guest exception endianness
Anton Blanchard [Mon, 19 Aug 2013 11:04:20 +0000 (21:04 +1000)]
pseries: Add H_SET_MODE hcall to change guest exception endianness

H_SET_MODE is used for controlling various partition settings. One
of these settings is the endianness a guest takes its exceptions in.

Signed-off-by: Anton Blanchard <anton@samba.org>
[agraf: fix whitespace]
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoxics: move registration of global state to realize()
Alexey Kardashevskiy [Mon, 19 Aug 2013 05:55:21 +0000 (15:55 +1000)]
xics: move registration of global state to realize()

Registration of global state belongs into realize so move it there.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr-pci: rework MSI/MSIX
Alexey Kardashevskiy [Fri, 12 Jul 2013 07:38:24 +0000 (17:38 +1000)]
spapr-pci: rework MSI/MSIX

On the sPAPR platform a guest allocates MSI/MSIX vectors via RTAS
hypercalls which return global IRQ numbers to a guest so it only
operates with those and never touches MSIMessage.

Therefore MSIMessage handling is completely hidden in QEMU.

Previously every sPAPR PCI host bridge implemented its own MSI window
to catch msi_notify()/msix_notify() calls from QEMU devices (virtio-pci
or vfio) and route them to the guest via qemu_pulse_irq().
MSIMessage used to be encoded as:
.addr - address within the PHB MSI window;
.data - the device index on PHB plus vector number.
The MSI MR write function translated this MSIMessage to a global IRQ
number and called qemu_pulse_irq().

However the total number of IRQs is not really big (at the moment it is
1024 IRQs starting from 4096) and even 16bit data field of MSIMessage
seems to be enough to store an IRQ number there.

This simplifies MSI handling in sPAPR PHB. Specifically, this does:
1. remove a MSI window from a PHB;
2. add a single memory region for all MSIs to sPAPREnvironment
and spapr_pci_msi_init() to initialize it;
3. encode MSIMessage as:
    * .addr - a fixed address of SPAPR_PCI_MSI_WINDOW==0x40000000000ULL;
    * .data as an IRQ number.
4. change IRQ allocator to align first IRQ number in a block for MSI.
MSI uses lower bits to specify the vector number so the first IRQ has to
be aligned. MSIX does not need any special allocator though.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: Use #define instead of opencoding SLB valid bit
Aneesh Kumar K.V [Tue, 20 Aug 2013 10:49:24 +0000 (16:19 +0530)]
target-ppc: Use #define instead of opencoding SLB valid bit

Use SLB_ESID_V instead of (1 << 27) in the code

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agospapr-pci: fix config space access to support bridges
Alexey Kardashevskiy [Wed, 21 Aug 2013 06:02:15 +0000 (16:02 +1000)]
spapr-pci: fix config space access to support bridges

spapr-pci config space accessors use find_dev() to find a PCI device.
However find_dev() only searched on a primary bus and did not do
recursive search through secondary buses so config space access was not
possible for devices other that on a primary bus.

This fixed find_dev() by using the PCI API pci_find_device() function.
This effectively enabled pci bridges on spapr.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: fix bit extraction for FPBF and FPL
Aurelien Jarno [Thu, 15 Aug 2013 11:32:38 +0000 (13:32 +0200)]
target-ppc: fix bit extraction for FPBF and FPL

Bit extraction for the FP BF and L field of the MTFSFI and MTFSF
instructions is wrong and doesn't match the reference manual (which
explain the bit number in big endian format). It has been broken in
commit 7d08d85645def18eac2a9d672c1868a35e0bcf79.

This patch fixes this, which in turn fixes the problem reported by
Khem Raj about the floor() function of libm.

Reported-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
CC: qemu-stable@nongnu.org (1.6)
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoppc405_boards: Don't enforce presence of firmware for qtest
Andreas Färber [Mon, 5 Aug 2013 13:27:23 +0000 (15:27 +0200)]
ppc405_boards: Don't enforce presence of firmware for qtest

Adopt error_report() while at it.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoppc405_uc: Disable debug output
Andreas Färber [Mon, 5 Aug 2013 13:27:22 +0000 (15:27 +0200)]
ppc405_uc: Disable debug output

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoppc405_boards: Disable debug output
Andreas Färber [Mon, 5 Aug 2013 13:27:21 +0000 (15:27 +0200)]
ppc405_boards: Disable debug output

Also move one stray debug output into an #ifdef.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoppc: virtex_ml507: QEMU_OPTION_dtb support for this machine.
Efimov Vasily [Wed, 14 Aug 2013 13:26:08 +0000 (17:26 +0400)]
ppc: virtex_ml507: QEMU_OPTION_dtb support for this machine.

QEMU has 'dtb' option for specifing the device tree file for the kernel.
The patch adds support for this option to the 'virtex_ml507' machine
implementation.

Signed-off-by: Efimov Vasily <real@ispras.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agodisas/ppc.c: Fix little endian disassembly
Anton Blanchard [Wed, 7 Aug 2013 00:47:03 +0000 (10:47 +1000)]
disas/ppc.c: Fix little endian disassembly

Use info->endian to select the endian of the instruction to
be disassembled.

Signed-off-by: Anton Blanchard <anton@samba.org>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: POWER7 supports the MSR_LE bit
Anton Blanchard [Wed, 7 Aug 2013 00:47:00 +0000 (10:47 +1000)]
target-ppc: POWER7 supports the MSR_LE bit

Add MSR_LE to the msr_mask for POWER7.

Signed-off-by: Anton Blanchard <anton@samba.org>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agotarget-ppc: USE LPCR_ILE to control exception endian on POWER7
Anton Blanchard [Wed, 7 Aug 2013 00:47:01 +0000 (10:47 +1000)]
target-ppc: USE LPCR_ILE to control exception endian on POWER7

On POWER7, LPCR_ILE is used to control what endian guests take
their exceptions in so use it instead of MSR_ILE.

Signed-off-by: Anton Blanchard <anton@samba.org>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agopseries: Fix stalls on hypervisor virtual console
Anton Blanchard [Tue, 13 Aug 2013 04:10:04 +0000 (14:10 +1000)]
pseries: Fix stalls on hypervisor virtual console

A number of users are reporting stalls when using the pseries
hypervisor virtual console.

A simple test case is to paste 15 or 17 characters at a time
into the console. Pasting 15 characters at a time works fine
but pasting 17 characters hangs for a random amount of time.
Other activity (network, qemu monitor etc) unblocks it.

If qemu-char tries to send more than 16 characters at once,
vty_can_receive returns false. At this point we have to
wait for the guest to consume that output. Everything is good
so far.

The problem occurs when the the guest does consume the output.
We need to signal back to the qemu-char layer that we are
ready for more input. Without this we block until something
else kicks us (eg network activity).

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agoPPC: E500: Generate device tree on reset
Alexander Graf [Fri, 19 Jul 2013 10:56:24 +0000 (12:56 +0200)]
PPC: E500: Generate device tree on reset

Today we generate the device tree once on machine initialization and then
store the finalized blob in memory to reload it on reset.

This is bad for 2 reasons. First we potentially waste a bunch of RAM for no
good reason, as we have all information required to regenerate the device
tree available anyways.

The second reason is even more important. On machine init when we generate
the device tree for the first time, we don't have all of the devices fully
initialized yet. But the device tree needs to potentially walk devices to
put information about them into the device tree.

Move the generation into a reset function. That way we just generate it new
every time we reset, solving both of the above issues.

Signed-off-by: Alexander Graf <agraf@suse.de>
10 years agovirtio_pci: fix level interrupts with irqfd
Michael S. Tsirkin [Sun, 1 Sep 2013 08:03:45 +0000 (11:03 +0300)]
virtio_pci: fix level interrupts with irqfd

commit 62c96360ae7f2c7a8b029277fbb7cb082fdef7fd
    virtio-pci: fix level interrupts
only helps systems without irqfd: on systems with irqfd support we
passed in flag requesting irqfd even when msix is disabled.

As a result, for level interrupts we didn't install an fd handler so
unmasking an fd had no effect.

Fix this up.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc: reduce duplication, fix PIIX descriptions
Michael S. Tsirkin [Tue, 27 Aug 2013 06:48:06 +0000 (09:48 +0300)]
pc: reduce duplication, fix PIIX descriptions

We have a lot of code duplication between machine types,
this increases with each new machine type
and each new field.

This has already introduced a minor bug: description
for pc-1.3 says "Standard PC" while description for
pc-1.4 is "Standard PC (i440FX + PIIX, 1996)"
which makes you think 1.3 is somehow more standard,
or newer, while in fact it's a revision of the same PC.

This patch addresses this issue by using macros, along
the lines used by PC_COMPAT_X_X - only for
non-property options.

The approach can extend to non-PC machine types.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoisa: Fix documentation of isa_register_portio_list()
Hervé Poussineau [Tue, 13 Aug 2013 10:38:34 +0000 (12:38 +0200)]
isa: Fix documentation of isa_register_portio_list()

Commit b40acf9 (ioport: Switch dispatching to memory core layer,
2013-06-24) removed all instances of old_portio.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoqom: Assert instance size in object_initialize_with_type()
Andreas Färber [Fri, 30 Aug 2013 16:28:37 +0000 (18:28 +0200)]
qom: Assert instance size in object_initialize_with_type()

This catches objects initializing beyond allocated memory, e.g.,
when subtypes get extended with instance state of their own.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoqom: Pass available size to object_initialize()
Andreas Färber [Fri, 23 Aug 2013 17:37:12 +0000 (19:37 +0200)]
qom: Pass available size to object_initialize()

To be passed on to object_initialize_with_type().

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> (virtio-ccw)
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoqdev: Pass size to qbus_create_inplace()
Andreas Färber [Fri, 23 Aug 2013 22:02:27 +0000 (00:02 +0200)]
qdev: Pass size to qbus_create_inplace()

To be passed to object_initialize().

Since commit 39355c3826f5d9a2eb1ce3dc9b4cdd68893769d6 the argument is
void*, so drop some superfluous (BusState *) casts or direct parent
field usages.

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agovirtio-mmio: Pass size to virtio_mmio_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:33:55 +0000 (20:33 +0200)]
virtio-mmio: Pass size to virtio_mmio_bus_new()

To be passed to qbus_create_initialize().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agovirtio-ccw: Pass size to virtio_ccw_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:27:30 +0000 (20:27 +0200)]
virtio-ccw: Pass size to virtio_ccw_bus_new()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agos390-virtio-bus: Pass size to virtio_s390_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:25:57 +0000 (20:25 +0200)]
s390-virtio-bus: Pass size to virtio_s390_bus_new()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agovirtio-pci: Pass size to virtio_pci_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:35:18 +0000 (20:35 +0200)]
virtio-pci: Pass size to virtio_pci_bus_new()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agousb: Pass size to usb_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:32:04 +0000 (20:32 +0200)]
usb: Pass size to usb_bus_new()

To be passed to qbus_create_inplace().

Use DEVICE() cast to avoid a direct parent field access.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoscsi: Pass size to scsi_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:30:03 +0000 (20:30 +0200)]
scsi: Pass size to scsi_bus_new()

To be passed to qbus_create_inplace().

Use DEVICE() casts instead of direct parent field access.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agopci: Pass size to pci_bus_new_inplace()
Andreas Färber [Fri, 23 Aug 2013 18:23:55 +0000 (20:23 +0200)]
pci: Pass size to pci_bus_new_inplace()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoide: Pass size to ide_bus_new()
Andreas Färber [Fri, 23 Aug 2013 18:18:50 +0000 (20:18 +0200)]
ide: Pass size to ide_bus_new()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoipack: Pass size to ipack_bus_new_inplace()
Andreas Färber [Fri, 23 Aug 2013 18:07:28 +0000 (20:07 +0200)]
ipack: Pass size to ipack_bus_new_inplace()

To be passed to qbus_create_inplace().

Simplify DEVICE() cast to avoid parent field access.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agointel-hda: Pass size to hda_codec_bus_init()
Andreas Färber [Fri, 23 Aug 2013 18:05:16 +0000 (20:05 +0200)]
intel-hda: Pass size to hda_codec_bus_init()

To be passed to qbus_create_inplace().

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoqom: Fix object_initialize_with_type() argument name in documentation
Andreas Färber [Fri, 23 Aug 2013 23:12:33 +0000 (01:12 +0200)]
qom: Fix object_initialize_with_type() argument name in documentation

@obj -> @data.

Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agovirtio: Remove unnecessary OBJECT() casts
Peter Maydell [Fri, 23 Aug 2013 13:38:55 +0000 (14:38 +0100)]
virtio: Remove unnecessary OBJECT() casts

There's no need to cast the first argument of object_initialize()
to Object. Remove these unnecessary casts.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoobject: Fix typo in qom/object.h
Peter Chubb [Wed, 7 Aug 2013 02:31:55 +0000 (12:31 +1000)]
object: Fix typo in qom/object.h

There's been a cut-and-paste error, it looks like, in the documentation
in qom/object.h.

Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Fri, 30 Aug 2013 17:26:04 +0000 (12:26 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Wenchao Xia (15) and Stefan Weil (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  monitor: improve auto complete of "help" for single command in sub group
  monitor: allow "help" show message for single command in sub group
  monitor: support sub command in auto completion
  monitor: refine monitor_find_completion()
  monitor: support sub command in help
  monitor: refine parse_cmdline()
  monitor: code move for parse_cmdline()
  monitor: avoid direct use of global variable *mon_cmds
  monitor: split off monitor_data_init()
  monitor: call sortcmdlist() only one time
  monitor: avoid use of global *cur_mon in readline_completion()
  monitor: avoid use of global *cur_mon in monitor_find_completion()
  monitor: avoid use of global *cur_mon in block_completion_it()
  monitor: avoid use of global *cur_mon in file_completion()
  monitor: avoid use of global *cur_mon in cmd_completion()
  monitor: Add missing attributes to local function

Message-id: 1377865357-6742-1-git-send-email-lcapitulino@redhat.com

10 years agoMerge remote-tracking branch 'borntraeger/tags/kdump' into staging
Anthony Liguori [Fri, 30 Aug 2013 17:25:56 +0000 (12:25 -0500)]
Merge remote-tracking branch 'borntraeger/tags/kdump' into staging

This is a set of patches dealing with kdump support for s390x/kvm.
kdump on s390x uses subcode 1 of diagnose 0x308 to put the hardware
in a defined state. This is different from a full reset, since it
does not touch all CPU registers.
These patches define the cpu resets, the subsystem reset a load
function and also wires up the "nmi" command to issue a RESTART
interrupt as defined in the z/Architecture principles of operation.

This allows recent guest kernels with properly setup userspace
to trigger kdump:
- via guest crash
- via nmi from the host

# gpg: Signature made Fri 30 Aug 2013 07:19:18 AM CDT using RSA key ID B5A61C7C
# gpg: Can't check signature: public key not found

# By Christian Borntraeger (5) and Eugene (jno) Dvurechenski (2)
# Via Christian Borntraeger
* borntraeger/tags/kdump:
  s390: wire up nmi command to raise a RESTART interrupt on S390
  s390: Implement load normal reset
  s390/cpu: split CPU reset into architectured functions
  s390: provide a cpu load normal function
  s390: provide I/O subsystem reset
  s390/kvm: basic implementation of diagnose 308 subcode 6
  s390x/kvm: Fix switch/case indentation for handle_diag

Message-id: 1377810649-47484-1-git-send-email-borntraeger@de.ibm.com

10 years agos390: wire up nmi command to raise a RESTART interrupt on S390
Eugene (jno) Dvurechenski [Wed, 5 Dec 2012 14:50:07 +0000 (15:50 +0100)]
s390: wire up nmi command to raise a RESTART interrupt on S390

There is the 'nmi' command that is used to trigger a guest dump via kdump feature on x86.
s390 uses RESTART interrupt to trigger kdump.
So, this patch provides a mean to use 'nmi' command on s390 to raise RESTART interrupt.

The CPU to receive the RESTART interrupt is the "default" one.

There is an infrastructure to select the "default" CPU using 'cpu' command.
The 'info cpus' command can be used to see which one is the "default".

In order to wire up the RESTART to 'nmi' command we had to:
1. implement the kvm_s390_cpu_restart function by exporting the existing code
2. implement s390_cpu_restart function as kvm-aware wrapper
3. modify the qmp_inject_nmi function to enable (for s390) the scan for
   "default" CPU and call s390_cpu_restart for it;
3. fix some messages.

Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
10 years agos390: Implement load normal reset
Christian Borntraeger [Thu, 25 Jul 2013 14:57:45 +0000 (16:57 +0200)]
s390: Implement load normal reset

kdump on s390 uses a load normal reset to bring the system in a defined
state by doing a subsystem reset. The issuing CPUs will have an initial
CPU reset, all other CPUs will have a CPU reset as defined in POP (no
register content will change).

Implement this as architectured.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agos390/cpu: split CPU reset into architectured functions
Christian Borntraeger [Fri, 28 Jun 2013 08:51:09 +0000 (10:51 +0200)]
s390/cpu: split CPU reset into architectured functions

s390 provides several CPU resets:
- CPU reset, clears interrupts, stop processing, clears TLB, but does
  not touch registers
- initial CPU reset, like CPU reset, but also clears PSW, prefix, FPC,
  timer and control registers. It does not touch gprs, fprs and acrs (!)
- Power on reset: the full monty

wire up CPUClass reset to the full monty, but provide the lesser resets
as part of S390CPUClass.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agomonitor: improve auto complete of "help" for single command in sub group
Wenchao Xia [Tue, 27 Aug 2013 12:38:27 +0000 (20:38 +0800)]
monitor: improve auto complete of "help" for single command in sub group

Now special case "help *" in auto completion can work with sub commands,
such as "help info u*".

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: allow "help" show message for single command in sub group
Wenchao Xia [Tue, 27 Aug 2013 12:38:26 +0000 (20:38 +0800)]
monitor: allow "help" show message for single command in sub group

A new parameter type 'S' is introduced to allow user input any string.
"help info block" works normal now.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: support sub command in auto completion
Wenchao Xia [Tue, 27 Aug 2013 12:38:25 +0000 (20:38 +0800)]
monitor: support sub command in auto completion

This patch allows auto completion work normal for sub command case,
"info block [DEVICE]" can auto complete now, by re-enter the completion
function. In original code "info" is treated as a special case, now it
is treated as a sub command group, global variable info_cmds is not used
any more.

"help" command is still treated as a special case, since it is not a sub
command group but want to auto complete command in root command table.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: refine monitor_find_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:24 +0000 (20:38 +0800)]
monitor: refine monitor_find_completion()

In order to support sub command in auto completion, a reentrant function
is needed, so monitor_find_completion() is split into two parts. The
first part does parsing of user input which need to be done only once,
the second part does the auto completion job according to the parsing
result, which contains the necessary code to support sub command and
works as the reentrant function. The global "info_cmds" is still used
in second part, which will be replaced by sub command code later.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: support sub command in help
Wenchao Xia [Tue, 27 Aug 2013 12:38:23 +0000 (20:38 +0800)]
monitor: support sub command in help

The old code in help_cmd() uses global 'info_cmds' and treats it as a
special case. Actually 'info_cmds' is a sub command group of 'mon_cmds',
in order to avoid direct use of it, help_cmd() needs to change its work
mechanism to support sub command and not treat it as a special case
any more.

To support sub command, help_cmd() will first parse the input and then call
help_cmd_dump(), which works as a reentrant function. When it meets a sub
command, it simply enters the function again. Since help dumping needs to
know whole input to printf full help message include prefix, for example,
"help info block" need to printf prefix "info", so help_cmd_dump() takes all
args from input and extra parameter arg_index to identify the progress.
Another function help_cmd_dump_one() is introduced to printf the prefix
and command's help message.

Now help supports sub command, so later if another sub command group is
added in any depth, help will automatically work for it. Still "help info
block" will show error since command parser reject additional parameter,
which can be improved later. "log" is still treated as a special case.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: refine parse_cmdline()
Wenchao Xia [Tue, 27 Aug 2013 12:38:22 +0000 (20:38 +0800)]
monitor: refine parse_cmdline()

Since this function will be used by help_cmd() later, so improve
it to make it more generic and easier to use. free_cmdline_args()
is added too as paired function to free the result.

One change of this function is that, when the valid args in input
exceed the limit of MAX_ARGS, it fails now, instead of return with
MAX_ARGS of parsed args in old code. This should not impact much
since it is rare that user input many args in monitor's "help" and
auto complete scenario.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: code move for parse_cmdline()
Wenchao Xia [Tue, 27 Aug 2013 12:38:21 +0000 (20:38 +0800)]
monitor: code move for parse_cmdline()

help_cmd() need this function later, so move it. get_str() is called by
parse_cmdline() so it is moved also. Some code style error reported by
check script, is also fixed.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid direct use of global variable *mon_cmds
Wenchao Xia [Tue, 27 Aug 2013 12:38:20 +0000 (20:38 +0800)]
monitor: avoid direct use of global variable *mon_cmds

New member *cmd_table is added in structure Monitor to avoid direct usage of
*mon_cmds. Now monitor have an associated command table, when global variable
*info_cmds is also discarded, structure Monitor would gain full control about
how to deal with user input.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: split off monitor_data_init()
Wenchao Xia [Tue, 27 Aug 2013 12:38:19 +0000 (20:38 +0800)]
monitor: split off monitor_data_init()

In qmp_human_monitor_command(), the monitor need to initialized for
basic functionalities, and later more init code will be added, so
split off this function. Note that it is different with QMP mode
monitor which accept json string from monitor's input,
qmp_human_monitor_command() retrieve the human style command from
QMP input, then send the command to a normal mode monitor.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: call sortcmdlist() only one time
Wenchao Xia [Tue, 27 Aug 2013 12:38:18 +0000 (20:38 +0800)]
monitor: call sortcmdlist() only one time

It doesn't need to be done for every monitor, so change it.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in readline_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:17 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in readline_completion()

Now all completion functions do not use *cur_mon any more, instead
they use rs->mon. In short, structure ReadLineState decide where
the complete action would be taken now.

Tested with the case that qemu have two telnet monitors, auto
completion function works normal.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in monitor_find_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:16 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in monitor_find_completion()

Parameter *mon is added, and local variable *mon added in previous patch
is removed. The caller readline_completion(), pass rs->mon as value, which
should be initialized in readline_init() called by monitor_init().

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in block_completion_it()
Wenchao Xia [Tue, 27 Aug 2013 12:38:15 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in block_completion_it()

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in file_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:14 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in file_completion()

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: avoid use of global *cur_mon in cmd_completion()
Wenchao Xia [Tue, 27 Aug 2013 12:38:13 +0000 (20:38 +0800)]
monitor: avoid use of global *cur_mon in cmd_completion()

A new local variable *mon is added in monitor_find_completion()
to make compile pass, which will be removed later in
conversion patch for monitor_find_completion().

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: Add missing attributes to local function
Stefan Weil [Thu, 22 Aug 2013 19:30:09 +0000 (21:30 +0200)]
monitor: Add missing attributes to local function

Function expr_error gets a format string and variable arguments like printf.
It also never returns. Add the necessary attributes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agos390: provide a cpu load normal function
Christian Borntraeger [Thu, 25 Jul 2013 14:45:51 +0000 (16:45 +0200)]
s390: provide a cpu load normal function

Some code needs to perform an IPL-like bootup that mimics the
ESA (31bit) restart. Provide a cpu class method that does so.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
10 years agos390: provide I/O subsystem reset
Christian Borntraeger [Thu, 25 Jul 2013 14:37:37 +0000 (16:37 +0200)]
s390: provide I/O subsystem reset

Provide a function that resets the I/O subsystem.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
10 years agos390/kvm: basic implementation of diagnose 308 subcode 6
Eugene (jno) Dvurechenski [Wed, 19 Jun 2013 15:27:15 +0000 (17:27 +0200)]
s390/kvm: basic implementation of diagnose 308 subcode 6

Linux uses a check for subcode 6 to decide if other subcodes are
available. Provide a minimal implementation for subcode 6, as well
as for subcode 5.

Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[Move code from kvm.c into misc_helper.c]

10 years agos390x/kvm: Fix switch/case indentation for handle_diag
Christian Borntraeger [Fri, 30 Aug 2013 09:06:56 +0000 (11:06 +0200)]
s390x/kvm: Fix switch/case indentation for handle_diag

This alignes case statements to switch statements in the handle_diag
function as mandated by coding style.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
10 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5
Anthony Liguori [Thu, 29 Aug 2013 22:21:51 +0000 (17:21 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5

* qemu-kvm/uq/master:
  kvm-stub: fix compilation
  kvm: shorten the parameter list for get_real_device()
  kvm: i386: fix LAPIC TSC deadline timer save/restore
  kvm-all.c: max_cpus should not exceed KVM vcpu limit
  kvm: Simplify kvm_handle_io
  kvm: x86: fix setting IA32_FEATURE_CONTROL with nested VMX disabled
  kvm: add KVM_IRQFD_FLAG_RESAMPLE support
  kvm: migrate vPMU state
  target-i386: remove tabs from target-i386/cpu.h
  Initialize IA32_FEATURE_CONTROL MSR in reset and migration

Conflicts:
target-i386/cpu.h
target-i386/kvm.c

aliguori: fixup trivial conflicts due to whitespace and added cpu
          argument

Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
10 years agoMerge remote-tracking branch 'sweil/mingw' into stable-1.5
Anthony Liguori [Thu, 29 Aug 2013 22:20:17 +0000 (17:20 -0500)]
Merge remote-tracking branch 'sweil/mingw' into stable-1.5

# By Stefan Weil
# Via Stefan Weil
* sweil/mingw:
  gtk: Remove unused include statements which are not portable
  w32: Add an icon resource
  w32: Fix broken out-of-tree builds (missing version.o)

Message-id: 1377607132-21336-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>