Provide emulation for all FPU instructions except fsave/frstore &
fnstenv/fldenv.
While the main purpose of the patch is to avoid current and future
"gotchas" on FPU intructions used by various OS boot-loaders, it is
complete enough to run DOS realmode FPU applications and benchmarks,
but don't expect to set any speed records.
Keir Fraser [Mon, 30 Jun 2008 13:19:09 +0000 (14:19 +0100)]
x86_emulate: read/write/insn_fetch emulation hooks now all take a
pointer to emulator data buffer, and an arbitrary byte count (up to
the size of a page of memory).
Keir Fraser [Mon, 30 Jun 2008 09:00:53 +0000 (10:00 +0100)]
blktap: link against libgcrypt rather than libcrypto
tapdisk, part of blktap, links against libcrypto. tapdisk includes
GPLv2 (tapaio.c) and other licensed code (block-qcow.c). The license
of OpenSSL is considered incompatible with the GPL by many
people. This patch changes them to link against libgcrypt, which is
LGPL.
Keir Fraser [Mon, 30 Jun 2008 08:57:27 +0000 (09:57 +0100)]
stubdom: add live migration support by having ioemu just notify the
hypervisor about memory changes.
The impact on disk performance is typically making it from 71.5MBps
down to 70.5Mbps during the live migration. The impact on network
performance is actually even hard to measure.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Fri, 27 Jun 2008 15:16:47 +0000 (16:16 +0100)]
x86: Add cpufreq logic to S3 suspend/resume
When suspend to S3, stop the cpufreq dbs governor. When resume from
S3, firstly sync cpu state and freq at the 1st dbs timer; from 2nd dbs
timer on, cpufreq dbs governor control cpu px transfer according to
its workload algorithm. Px statistic is also handled.
Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Keir Fraser [Fri, 27 Jun 2008 13:43:29 +0000 (14:43 +0100)]
hvm rombios: Move function calls out of 'post' function section
Through recent additions to the rombios the code section of the post
function has filled up considerably. When I enable the BX_TCGBIOS
compile time option the BIOS crashes since the post section code
(starts at $e05b) spills over into the nmi entry point (starts at
$e2c3). as86 doesn't cause an error when building.
Keir Fraser [Fri, 27 Jun 2008 13:11:41 +0000 (14:11 +0100)]
vt-d: Minor fixing of interrupt remapping
When ir_ctrl->iremap_index == -1, it means there is no remap
entry. So it needn't to convert from remap format to normal ioapic
format.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Fri, 20 Jun 2008 17:02:46 +0000 (18:02 +0100)]
AMD PowerNow! in Xen
This patch set moves support for AMD's PowerNow! technology from
dom0 into the hypervisor, now that there is support for
transferring ACPI data to the hypervisor. It will only work for
AMD processors that support the architectural P-state driver,
such as 3rd generation Opterons, Phenoms, and Turion Ultras.
This patch creates the Architectural P-state driver inside
of the Xen hypervisor and hooks it into the Xen code. It
has been tested at AMD with a variety of para- and fully-
virtualized guests for a week without regressions.
Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com> Acked-by: Conny Seidel <conny.seidel@amd.com>
Keir Fraser [Thu, 19 Jun 2008 10:09:10 +0000 (11:09 +0100)]
vmx: Clean up and fix guest MSR load/save handling:
1. msr_bitmap/msr_area/msr_host_area must be freed when a vcpu is
destroyed
2. vmx_create_vmcs()/vmx_destroy_vmcs() are only ever called once,
and can hence be simplified slightly
3. Change vmx_*_msr() interfaces to make it crystal clear that they
operate only on current (hence safe against vmwrite() and also
against concurrency races).
4. Change vmx_add_*_msr() implementation to make it crystal clear
that msr_area is not dereferenced before it is allocated.
Only (1) is a bug fix. (2)-(4) are for code clarity.
Keir Fraser [Wed, 18 Jun 2008 10:55:34 +0000 (11:55 +0100)]
ioemu: Fix usbdevice parameter to encode vbd type.
usbdevice = "disk:<filename>"
expect a raw device (as this probably is the most usual case) and
usbdevice = "disk-qcow:<filename>"
expect a COW image (autodetected, probably qcow2).
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Wed, 18 Jun 2008 08:40:39 +0000 (09:40 +0100)]
ioemu: generic PCI device config-space emulation
This patch is an extension for qemu-dm to enable emulation of generic
PCI devices. The information for the PCI devices can be passed by
command line parameter.
The command line parameter is "-pciemulation" followed by the
information which contains a label and hex value of the configuration
registers separated by ":".
The configuration registers for each PCI device are below.
vendorid
deviceid
command
status
revision
classcode
headertype
subvendorid
subsystemid
interruputline
interruptpin
Keir Fraser [Wed, 18 Jun 2008 08:39:14 +0000 (09:39 +0100)]
ioemu: Disable format auto-probing in monitor command change
Format auto-probing of writable images is a security hole. The last
known remaining instance is monitor command change. Disable probing
there and use raw. This breaks change for images in all other
formats.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Keir Fraser [Wed, 18 Jun 2008 08:36:47 +0000 (09:36 +0100)]
Add PV-GRUB
This fetches GRUB1 sources, applies the {graphical, print function,
save default, and ext3_256byte} patches from debian, and applies a
patch to make it work on x86_64 and port it to Mini-OS. By using
libxc, PV-GRUB can then "kexec" the loaded kernel from inside the
domain itself, hence permitting to avoid the security-concerned
pygrub.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 17 Jun 2008 08:36:25 +0000 (09:36 +0100)]
minios,stubdom: Add OBJ_DIR parameter to compile outside sources,
which permits to easily compile mini-os in various flavors. Also clean
some parts of stubdom build.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Mon, 16 Jun 2008 15:35:17 +0000 (16:35 +0100)]
[IA64] trivial compilation fix caused by c/s 17847:8a0415fac759.
This patch fixes the following compilation error caused
by c/s 17847:8a0415fac759.
machine_kexec.c: In function 'arch_crash_save_vmcoreinfo':
machine_kexec.c:201: error: 'frametable_pg_dir' undeclared (first use in this function)
machine_kexec.c:201: error: (Each undeclared identifier is reported only once
machine_kexec.c:201: error: for each function it appears in.)
Keir Fraser [Mon, 16 Jun 2008 14:22:41 +0000 (15:22 +0100)]
vmx: Allow restore of context from a non-Intel processor. In
particular, VMX requires segment 'granularity' to be set correctly, so
we force it if need be in vmx_set_segment_register().
Keir Fraser [Mon, 16 Jun 2008 14:21:49 +0000 (15:21 +0100)]
amd svm: Do not touch (non-existent) attr and selector fields for GDTR
and IDTR in the VMCB in svm_set_segment_register(). This is just for
clarity of code and to prevent any issues in the future.
Keir Fraser [Mon, 16 Jun 2008 10:24:17 +0000 (11:24 +0100)]
x86_emulate: Fix the segment-load function
Fix the non-conforming type check and uses the consistent method to
fetch the cpl value as function get_cpl().
Also make sure vm86 mode is properly handled when determining whether
in real mode or protected mode -- in various respects vm86 mode can
act like both.
Keir Fraser [Fri, 13 Jun 2008 13:15:00 +0000 (14:15 +0100)]
Bring back console_start_log_everything() as a milder alternative to
console_start_sync(). Revert keyhandler logic to use it. The
difference now is that serial logic is updated to not drop characters
if inb a log_everything region. Still this is milder than a sync
region since the async buffer must be filled before we start to
busy-wait on each character.
Keir Fraser [Fri, 13 Jun 2008 12:49:56 +0000 (13:49 +0100)]
Introduce guest_handle_subrange_okay() for checking sub-sections of an
argument array. Needed where a compat shim is splitting up a 32-bit
guest's larger argument array, and only the currently-active part of
the translated array is contained within the compat_arg_xlat_area.
Keir Fraser [Fri, 13 Jun 2008 08:56:49 +0000 (09:56 +0100)]
hvm: Fix max_mapped_pfn when using 2MB super pages.
Fixes booting Linux guest allocated more than 4G memory.
- The p2m table will track the max_mapped_pfn, and while doing
p2m_gfn_to_mfn(), if the gfn is higher than max_mapped_pfn, the
function will return _mfn(INVALID_MFN). This makes the Linux guest
kernel panic.
Keir Fraser [Fri, 13 Jun 2008 08:54:03 +0000 (09:54 +0100)]
extract vmcoreinfo from /proc/vmcore for Xen
- the machine address and the size of the vmcoreinfo area is returned
via the kexec_op(get_range) hypercall
- fill the vmcoreinfo data when the kexec_op(crash load) hypercall
is called
Keir Fraser [Thu, 12 Jun 2008 17:14:00 +0000 (18:14 +0100)]
x86: remove use of per-domain lock from page table entry handling
This change results in a 5% performance improvement for kernel builds
on dual-socket quad-core systems (which is what I used for reference
for both 32- and 64-bit). Along with that, the amount of time reported
as spent in the kernel gets reduced by almost 25% (the fraction of
time spent in the kernel is generally reported significantly higher
under Xen than with a native kernel).
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Thu, 12 Jun 2008 16:01:31 +0000 (17:01 +0100)]
xend: detect and report qemu-dm failure
Currently, when qemu-dm fails, typically its exit status is lost and
xend doesn't notice. In the patch below I use a fifo (named pipe) to
detect qemu-dm's termination and report the exit status to the
logfile, if possible. (If xend has been restarted since the domain
was created, this isn't possible but we can still know that it failed
and report that fact.)
It would be better to have a failure of qemu crash the domain, by
calling the SCHEDOP_shutdown hypercall with SHUTDOWN_crash. However
if you have on_crash=restart and the configuration is broken in some
way that causes qemu-dm to bomb out straight away this causes xend to
spin endlessly restarting the doomed domain. This is a general
problem with on_*=restart and ought to be fixed separately. When it
is fixed, we can safely arrange for domains whose dm has crashed to be
themselves forcibly crashed.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Thu, 12 Jun 2008 15:55:09 +0000 (16:55 +0100)]
dom0 state dump
Since xenctx cannot (for obvious reasons) display the context of
dom0's vCPU-s, here are the beginnings of a console based mechanism to
achieve the same (useful if dom0 hangs with one or more de-scheduled
vCPU-s). The stack handling obviously needs improvement, but the
register context should come out fine in all cases.
Keir Fraser [Thu, 12 Jun 2008 15:34:25 +0000 (16:34 +0100)]
keyhandler: When dumping all-CPU register state, wnter console sync
mode so we do not drop any critical debug data. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Thu, 12 Jun 2008 15:09:08 +0000 (16:09 +0100)]
x86: machine_halt() forcibly re-enables IRQs as it may be called from
panic() which itself may be called in an IRQ-safe critical section. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Thu, 12 Jun 2008 15:05:35 +0000 (16:05 +0100)]
x86/32on64: fix physical address restriction
The allocation bit size setting wasn't working anymore after the
recent fix to properly use PAGE_SHIFT instead of PAGE_SIZE. This was
because the bit size implies a power-of-two range that's accessible,
but if all memory is accessible anyway (and its upper boundary is not
a power of two), the domain would either be needlessly restricted or
wouldn't be able to allocate as much memory as was intended for it
(specifically the case for Dom0 without dom0_mem= boot
parameter). Consequently, don't restrict the bit width if all memory
can be accessed.
To avoid needing to adjust this code in two places in the future (it
may need further touching when memory hotplug gets supported), fold
the logic into a function.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Thu, 12 Jun 2008 14:42:09 +0000 (15:42 +0100)]
[IA64] compilation fix caused by 17814:9af7a535225f
ia64 compliation fix caused by 17814:9af7a535225f.
- generate_acpi_checksum() is replaced by acpi_tb_checksum()
- move dump_execution_state() definitions from asm-ia64/xenprocessor.h
to asm-ia64/bug.h
Keir Fraser [Wed, 11 Jun 2008 14:19:42 +0000 (15:19 +0100)]
MSI: Fix msi delivery for hvm guest
Some parameters like "dest_mode", "delivery_mode" and "trig_mode"
seem to have been miscalculated before delivering MSI interrupt into
hvm passthru guest. This will cause guest driver to roll back to
legacy interrupt mode.
Keir Fraser [Wed, 11 Jun 2008 10:35:35 +0000 (11:35 +0100)]
x86: cpuid configuration for PV guest
Add pv guest support for the cpuid configuration and checking. That
feature only works for cpuid request which are coming from the guest's
kernel, a process could still call the cpuid directly.
A new policy for pv guest has been created in libxc. dom0 cpuid
emulation is left hardcoded in Xen.
Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>