Commit graph

10899 commits

Author SHA1 Message Date
Anthony Liguori 724c689357 Merge remote branch 'qemu-kvm/uq/master' into staging 2010-02-22 16:16:22 -06:00
john cooper b5ec5ce0e3 Add cpu model configuration support..
This is a reimplementation of prior versions which adds
the ability to define cpu models for contemporary processors.
The added models are likewise selected via -cpu <name>,
and are intended to displace the existing convention
of "-cpu qemu64" augmented with a series of feature flags.

A primary motivation was determination of a least common
denominator within a given processor class to simplify guest
migration.  It is still possible to modify an arbitrary model
via additional feature flags however the goal here was to
make doing so unnecessary in typical usage.  The other
consideration was providing models names reflective of
current processors.  Both AMD and Intel have reviewed the
models in terms of balancing generality of migration vs.
excessive feature downgrade relative to released silicon.

This version of the patch replaces the prior hard wired
definitions with a configuration file approach for new
models.  Existing models are thus far left as-is but may
easily be transitioned to (or may be overridden by) the
configuration file representation.

Proposed new model definitions are provided here for current
AMD and Intel processors.  Each model consists of a name
used to select it on the command line (-cpu <name>), and a
model_id which corresponds to a least common denominator
commercial instance of the processor class.

A table of names/model_ids may be queried via "-cpu ?model":

        :
    x86       Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)
    x86       Opteron_G2  AMD Opteron 22xx (Gen 2 Class Opteron)
    x86       Opteron_G1  AMD Opteron 240 (Gen 1 Class Opteron)
    x86          Nehalem  Intel Core i7 9xx (Nehalem Class Core i7)
    x86           Penryn  Intel Core 2 Duo P9xxx (Penryn Class Core 2)
    x86           Conroe  Intel Celeron_4x0 (Conroe/Merom Class Core 2)
        :

Also added is "-cpu ?dump" which exhaustively outputs all config
data for all defined models, and "-cpu ?cpuid" which enumerates
all qemu recognized CPUID feature flags.

The pseudo cpuid flag 'check' when added to the feature flag list
will warn when feature flags (either implicit in a cpu model or
explicit on the command line) would have otherwise been quietly
unavailable to a guest:

    # qemu-system-x86_64 ... -cpu Nehalem,check
    warning: host cpuid 0000_0001 lacks requested flag 'sse4.2|sse4_2' [0x00100000]
    warning: host cpuid 0000_0001 lacks requested flag 'popcnt' [0x00800000]

A similar 'enforce' pseudo flag exists which in addition
to the above causes qemu to error exit if requested flags are
unavailable.

Configuration data for a cpu model resides in the target config
file which by default will be installed as:

    /usr/local/etc/qemu/target-<arch>.conf

The format of this file should be self explanatory given the
definitions for the above six models and essentially mimics
the structure of the static x86_def_t x86_defs.

Encoding of cpuid flags names now allows aliases for both the
configuration file and the command line which reconciles some
Intel/AMD/Linux/Qemu naming differences.

This patch was tested relative to qemu.git.

Signed-off-by: john cooper <john.cooper@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-22 16:16:17 -06:00
David Ahern 4266a13471 add close callback for tty-based char device
v1 -> v2  coding style changes

Add a tty close callback. Right now if a guest device that is connected
to a tty-based chardev in the host is removed, the tty is not closed.
With this patch it is closed.

Example use case is connecting an emulated USB serial cable in the guest
to ttyS0 of the host using the monitor command:

usb_add serial::/dev/ttyS0

and then removing the device with:

usb_del serial::/dev/ttyS0

Signed-off-by: David Ahern <daahern@cisco.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-22 16:16:17 -06:00
Justin T. Gibbs 71e605f803 Fix lost serial TX interrupts. Report receive overruns.
o Implement receive overrun status.  The FreeBSD uart driver
   relies on this status in it's probe routine to determine the size
   of the FIFO supported.
 o As per the 16550 spec, do not overwrite the RX FIFO on an RX overrun.
 o Do not allow TX or RX FIFO overruns to increment the data valid count
   beyond the size of the FIFO.
 o For reads of the IIR register, only clear the "TX holding register
   emtpy interrupt" if the read reports this interrupt.  This is required
   by the specification and avoids losing TX interrupts when other,
   higher priority interrupts (usually RX) are reported first.

Signed-off-by: Justin T. Gibbs <gibbs@FreeBSD.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-22 16:16:16 -06:00
malc 98b8d951dc tcg/ppc: Fix typo
Signed-off-by: malc <av1474@comtv.ru>
2010-02-23 00:50:03 +03:00
Michael S. Tsirkin 63e6f31d1b apc_pci: simplify using rwhandler
Use rwhandler to simplify apb_pci.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-22 21:23:11 +00:00
Michael S. Tsirkin 8414f45cb0 apb_pci: minor cleanup
pci_data_write ignores high 8 bit in address,
so there seems to be no need to set them
in apb_pci.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-22 21:02:46 +00:00
Blue Swirl 23ef988cb3 Update OpenBIOS images to r683
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-22 20:42:56 +00:00
Blue Swirl f21126df5f Fix arm-softmmu compile
cc1: warnings being treated as errors
/src/qemu/hw/pl181.c: In function 'pl181_fifo_run':
/src/qemu/hw/pl181.c:185: error: 'value' may be used uninitialized in this function

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-22 20:42:51 +00:00
malc d34f4bafa6 tcg/ppc64: Use C90 style comments
Signed-off-by: malc <av1474@comtv.ru>
2010-02-22 21:56:35 +03:00
malc 65fe043eb4 tcg/ppc: Implement some of the optional ops
Signed-off-by: malc <av1474@comtv.ru>
2010-02-22 21:50:01 +03:00
Marcelo Tosatti 85199474d0 kvm-all.c: define smp_wmb and use it for coalesced mmio
Acked-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-22 19:04:13 +02:00
Jay Foad 30c0c76ce0 tcg: fix build on 32-bit hppa, ppc and sparc hosts
The qemu_ld32s op is only defined if TCG_TARGET_REG_BITS == 64.

Signed-off-by: Jay Foad <jay.foad@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-02-22 19:38:52 +03:00
Paul Brook bc3b26f535 PL181 write fix
The PL181 data transfer loop incorrectly terminates after the last FIFO
word is popped, discarding the last 3 bytes of data on a write transfer.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-02-22 15:33:59 +00:00
Marcelo Tosatti 6312b92853 kvm: remove pre-entry exit_request check with iothread enabled
With SIG_IPI blocked vcpu loop exit notification happens via -EAGAIN
from KVM_RUN.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-22 10:58:33 +02:00
Marcelo Tosatti cc84de9570 kvm: consume internal signal with sigtimedwait
Change the way the internal qemu signal, used for communication between
iothread and vcpus, is handled.

Block and consume it with sigtimedwait on the outer vcpu loop, which
allows more precise timing control.

Change from standard signal (SIGUSR1) to real-time one, so multiple
signals are not collapsed.

Set the signal number on KVM's in-kernel allowed sigmask.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-22 10:58:33 +02:00
Marcelo Tosatti fed6c3444c kvm specific wait_io_event
In KVM mode the global mutex is released when vcpus are executing,
which means acquiring the fairness mutex is not required.

Also for KVM there is one thread per vcpu, so tcg_has_work is meaningless.

Add a new qemu_wait_io_event_common function to hold common code
between TCG/KVM.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-22 10:58:33 +02:00
Marcelo Tosatti adc8c965c4 block SIGCHLD in vcpu thread(s)
Otherwise a vcpu thread can run the sigchild handler causing
waitpid() from iothread to fail.

Signed-off-by: Marcelo Tosatti <mtosa...@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-22 10:58:33 +02:00
Blue Swirl 238431a9d8 Allow const QemuOptDesc
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-21 16:01:30 +00:00
Jes Sorensen 62f734a0d5 kvm: Kill CR3_CACHE feature references
Remove all references to KVM_CR3_CACHE as it was never implemented.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-21 11:41:07 +02:00
Jan Kiszka 14dcc3e2ac kvm: Fix eflags corruption in kvm mode
This should explain a lot of the weird breakages of upstream KVM we've
seen recently (actually we should have seen it much earlier):

Stop translating eflags into TCG format when in kvm mode as we never
translate it back and rather sync this broken state into the kernel.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2010-02-21 11:12:37 +02:00
Edgar E. Iglesias 4a0b59fe3b cris: Add CRISv10 gdbstub support.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-02-20 19:51:56 +01:00
Edgar E. Iglesias 4ffb9ae2e1 cris: Mask interrupts on dslots for CRISv10.
CRISv10 cores (unlike v32) do not take any interrupts while delayed
jumps are pending (delay slots).

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-02-20 19:17:29 +01:00
Edgar E. Iglesias ff21f70afd microblaze: Improve brk emulation.
brk insns while in user mode raise priv insn exceptions.
This commit makes gdbserver work on linux guests.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-02-20 14:04:01 +01:00
Edgar E. Iglesias e1aa325409 microblaze: Dont segfault when singlestepping first insn.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2010-02-20 14:03:14 +01:00
Jay Foad b551ec04ca target-sparc: fix --enable-debug build
Use 32-bit arithmetic for the address offset calculation to fix a
build failure on 32-bit hosts.

Signed-off-by: Jay Foad <jay.foad@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 13:09:57 +02:00
Jay Foad 2c92d62ebb tcg: fix assertion with --enable-debug
On 32-bit hosts op_qemu_ld32s is unused. Remove it to fix the
following assertion failure:

qemu-alpha: tcg/tcg.c:1055:
tcg_add_target_add_op_defs: Assertion `tcg_op_defs[op].used' failed.

Signed-off-by: Jay Foad <jay.foad@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 12:26:14 +02:00
Blue Swirl 51464fafdf Don't compile rwhandler.c for user targets
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 09:27:38 +00:00
Richard Henderson 3682825669 tcg: Add comments for all optional instructions not implemented.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:35:12 +00:00
Richard Henderson 18c8f7a35d tcg-sparc: Implement ORC.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:34:42 +00:00
Richard Henderson dc69960dd6 tcg-sparc: Implement ANDC.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:34:18 +00:00
Richard Henderson 791d1262e2 tcg: Optional target implementation of ORC.
Previously ORC was always implemented by tcg-op.h with
an explicit NOT opcode.  Allow a target implementation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:33:52 +00:00
Richard Henderson 241cbed4a9 tcg: Optional target implementation of ANDC.
Previously ANDC was always implemented by tcg-op.h with
an explicit NOT opcode.  Allow a target implementation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:33:31 +00:00
Richard Henderson be6551b1e7 tcg-sparc: Implement not.
The fallback implementation of "ret = arg1 ^ -1" isn't ideal
because of the extra tcg op to load the minus one.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:32:35 +00:00
Richard Henderson 4b5a85c175 tcg-sparc: Implement neg.
The fallback implementation of "ret = 0 - arg1" isn't ideal,
first because of the extra tcg op to load the zero, and second
because we fail to handle zero as %g0 for arg1 of the sub.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:31:50 +00:00
Blue Swirl 4fc8d6711a Fix warning on mingw32
/src/qemu/hw/ide/core.c: In function 'ide_drive_pre_save':
/src/qemu/hw/ide/core.c:2740: warning: comparison is always false due to limited range of data type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:29:17 +00:00
Blue Swirl 64e69d50a3 Fix warning on OpenBSD
/src/qemu/net.c: In function `net_check_clients':
/src/qemu/net.c:1287: warning: `has_nic' might be used uninitialized in this function
/src/qemu/net.c:1287: warning: `has_host_dev' might be used uninitialized in this function

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-20 08:20:18 +00:00
malc 6ec8523603 tcg/ppc: Consistently use calling convention selection macros
Signed-off-by: malc <av1474@comtv.ru>
2010-02-20 01:47:35 +03:00
Juergen Lock 5da79c86a3 Use ppc host calling convention definitions to set TCG_TARGET_CALL_{ALIGN_ARGS,STACK_OFFSET}.
New version after malc's comments.  (This avoids having to do
  #if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__
for the third case.)

Submitted by: Andreas Tobler <andreast@fgznet.ch>  (original version)

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: malc <av1474@comtv.ru>
2010-02-20 01:37:33 +03:00
Juergen Lock 58d9b1e0ed Add FreeBSD/ppc host ucontext definitions.
Submitted by: Andreas Tobler <andreast@fgznet.ch>

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: malc <av1474@comtv.ru>
2010-02-20 01:37:33 +03:00
Juergen Lock e4ee916d3f Add FreeBSD/ppc host ppc_init_cacheline_sizes() implementation.
New version after malc's comments.  (Added error handling.)

Submitted by: Andreas Tobler <andreast@fgznet.ch>

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: malc <av1474@comtv.ru>
2010-02-20 01:37:33 +03:00
Kevin Wolf 584771e6b6 qemu-img: Fix error message
When qemu-img can't open the new backing file for a rebase, it prints an error
message which contains the file name of the old backing file. This is wrong,
obviously.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:53:54 -06:00
Kevin Wolf 60b1bd4fc5 qemu-img: Fix segfault during rebase
This fixes a possible read beyond the end of the temporary buffers used for
comparing data in the old and the new backing file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:53:54 -06:00
Kevin Wolf 4805bb6696 qcow2: Fix access after end of array
If a write requests crosses a L2 table boundary and all clusters until the
end of the L2 table are usable for the request, we must not look at the next
L2 entry because we already have arrived at the end of the array.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:53:54 -06:00
Kevin Wolf 0f853a3867 qdev: Free opts on failed do_device_add
If the device can't be created, don't leak the QemuOpts and release the id of
the device that should have been added by the failed device_add.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:53:54 -06:00
Jes Sorensen 4c5b10b7b6 QEMU e820 reservation patch
Hi,

Kevin and I have agreed on the approach for this one now. So here is
the latest version of the patch for QEMU, submitting e820 reservation
entries via fw_cfg.

Cheers,
Jes

Use qemu-cfg to provide the BIOS with an optional table of e820 entries.

Notify the BIOS of the location of the TSS+EPT range to by reserving
it via the e820 table.

This matches a corresponding patch for Seabios, however older versions
of Seabios will default to the hardcoded address range and stay
compatible with current QEMU.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:53:54 -06:00
Marcelo Tosatti ed487bb1d6 ide save/restore pio/atapi cmd transfer fields and io buffer
Save/restore information necessary to continue in progress PIO/ATAPI CMD
transfers.

This includes the IO buffer.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:33:13 -06:00
Amit Shah 7b665b668a virtio-serial: pci: Allow MSI to be disabled
Michael noted we don't allow disabling of MSI for the virtio-serial-pci
device. Fix that.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:32:16 -06:00
Michael S. Tsirkin ee4d45be0d virtio-serial: don't set MULTIPORT for 1 port dev
Since commit 98b19252cf, all
serial devices declare MULTIPORT feature.
To allow 0.12 compatibility, we should clear this when
max_nr_ports is 1.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:32:16 -06:00
Amit Shah 8bfbde6d35 pc: Add backward compatibility options for virtio-serial
virtio-serial-pci can support multiple ports in the current development
version that will become 0.13. Add compatibility options for the 0.12
and 0.11 pc machine types.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19 15:32:16 -06:00