Keir Fraser [Mon, 26 Nov 2007 16:57:57 +0000 (16:57 +0000)]
x86 emulate: Emulate atomic read-modify-write instructions as a
straightforward write. Hopefully multiprocessor synchronisation is not
relied upon in real mode! Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Mon, 26 Nov 2007 16:47:10 +0000 (16:47 +0000)]
vmx realmode: Fix emulation of exception delivery (stack pointer must
be adjusted for FLAGS push), and fix up vmx_realmode() exit protocol
now that it is called from asm stub context. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Mon, 26 Nov 2007 15:32:54 +0000 (15:32 +0000)]
x86_emulate: Emulate CPUID and HLT.
vmx realmode: Fix decode & emulate loop, add hooks for CPUID, HLT and
WBINVD. Also do not hook realmode entry off of vmentry failure any
more. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sun, 25 Nov 2007 21:24:48 +0000 (21:24 +0000)]
vmx realmode: Detect and correctly plumb mmio accesses from emulated
realmode. Also correctly handle debug output to I/O port 0xe9. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sun, 25 Nov 2007 11:45:02 +0000 (11:45 +0000)]
vmx realmode: Support privileged EFLAGS updates in emulated realmode.
Also tweak debug tracing to be much less noisy. We can emulates tens
of thousands of instructions in rombios now. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sat, 24 Nov 2007 22:19:03 +0000 (22:19 +0000)]
Revert 16450:5e8e82e80. Instead remove all arch-specific handling of
memcmp() and hence always use common/lib.c version. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sat, 24 Nov 2007 21:46:14 +0000 (21:46 +0000)]
vmx: Initial framework for real-mode emulation (disabled by default).
Still plenty to do:
- i/o emulation
- more instructions
- interrupt/exception delivery
- vm86 fast path
At this stage we can get three instructions into the rombios. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sat, 24 Nov 2007 13:40:23 +0000 (13:40 +0000)]
vt-d: Some fixes of Intel iommu
This patch removes a wrong if condition judgement to setup rmrr
identify mapping for guests, and passes page count rather than address
size to iommu_flush_iotlb_psi().
Signed-off-by: Weidong Han <weidong.han@intel.com> Signed-off-by: Anthony Xu <Anthony.xu@intel.com>
Keir Fraser [Sat, 24 Nov 2007 13:37:26 +0000 (13:37 +0000)]
Fix non-optimized compilation of Xen's memcmp
Even when using __builtin_memcmp, gcc may emit external references to
memcmp (when not optimizing for instance), so this #define does not
always provide a completely suitable memcmp().
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sat, 24 Nov 2007 13:31:39 +0000 (13:31 +0000)]
[Mini-OS] Fix domain blocking race
A callback which wakes a thread may happen between the moment
schedule() gives hand to the idle thread and the latter blocks the
domain. Idle hence needs to atomically check that no thread is
running and block, else awoken threads may have to wait up to 10
seconds.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Keir Fraser [Sat, 24 Nov 2007 13:23:22 +0000 (13:23 +0000)]
x86, hvm: Config option to allow vmxassist to be disabled.
hvmloader is modified to dynamically detect this, allowing possibility
of optional full vmxassist replacement in 3.2 stable branch in future.
Currently 'vmxassist=y' is not much use since no replacement is
implemented.
Keir Fraser [Fri, 23 Nov 2007 16:39:45 +0000 (16:39 +0000)]
vt-d: Fix ISA IRQ alias issue
When assign multiple devices to guest which uses PIC, ISA IRQ alias
may occur. This patch splits ISA IRQ and GSI eoi function. In ISA IRQ
eoi function, searches all assigned mirqs and does eoi for the
corresponding mirqs which match the eoi ISA IRQ. Therefore fix ISA IRQ
alias issue.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Fri, 23 Nov 2007 16:23:28 +0000 (16:23 +0000)]
[Mini-OS] Fix x86 arch_switch_thread
Fix x86 arch_switch_thread by making it pure assembly.
There were missing general register clobbers for x86_64, and BP should
theorically be clobbered too, but gcc does not believe that, so the
only simple safe solution is to use pure assembly.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Keir Fraser [Fri, 23 Nov 2007 16:22:36 +0000 (16:22 +0000)]
[Mini-OS] Fix stack closures
So as to make backtracing tools happy, correctly close x86 stacks for
new threads as well as on callback in the x86_32 case since there is
no unwind marker.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Keir Fraser [Fri, 23 Nov 2007 16:22:13 +0000 (16:22 +0000)]
[Mini-OS] Fix x86 initial stack alignment
This fixes the initial stack alignment for x86, which is required for
current to return a fine NULL instead of a random value or possibly
crash during initialization.
Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk> Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Keir Fraser [Thu, 22 Nov 2007 19:23:40 +0000 (19:23 +0000)]
x86: emulate I/O port access breakpoints
Emulate the trapping on I/O port accesses when emulating IN/OUT.
Also allow 8-byte breakpoints on x86-64 (and on i686 if the hardware
supports them), and tighten the condition for loading debug registers
during context switch.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
Keir Fraser [Thu, 22 Nov 2007 10:33:10 +0000 (10:33 +0000)]
hvm: Clean up CPUID 0x80000001 emulation. Filter out RDTSCP feature
and emulate with #UD on AMD. Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
Keir Fraser [Wed, 21 Nov 2007 14:36:07 +0000 (14:36 +0000)]
x86: rmb() can be weakened according to new Intel spec.
Both Intel and AMD agree that, from a programmer's viewpoint:
Loads cannot be reordered relative to other loads.
Stores cannot be reordered relative to other stores.
Intel64 Architecture Memory Ordering White Paper
<http://developer.intel.com/products/processor/manuals/318147.pdf>
AMD64 Architecture Programmer's Manual, Volume 2: System Programming
<http://www.amd.com/us-en/assets/content_type/\
white_papers_and_tech_docs/24593.pdf>
Keir Fraser [Wed, 21 Nov 2007 11:38:51 +0000 (11:38 +0000)]
x86: Make IDT/GDT/LDT updates safe.
This involves either determining that the entry will not be
read/written while the update takes place, or atomically making the
entry 'present', or doing the entire write atomically, as appropriate.
This issue raised, and original patch provided, by Jan Beulich.
Keir Fraser [Wed, 21 Nov 2007 09:49:09 +0000 (09:49 +0000)]
hvm: Do not crash guest if it does an unaligned access to an HPET
register. Some CrashMe test apaprently does this and we don't want
that to crash the domain it runs in.
From: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
Keir Fraser [Tue, 20 Nov 2007 15:34:25 +0000 (15:34 +0000)]
x86, 32-on-64: Improve checking in vcpu_destroy_pagetables(). It *is*
possible for 64-bit guest to have matching guest_table and
guest_table_user.
Original patch by John Levon <levon@movementarian.org> Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
Keir Fraser [Tue, 20 Nov 2007 15:05:36 +0000 (15:05 +0000)]
svm: Fix __update_guest_eip() to clear interrupt shadow.
Get rid of assertions about return value of get_instruction_length()
-- instead test in __update_guest_eip() and crash the domain.
Cache value of 'current' in svm_do_hlt().
The mismanagement of the interrupt shadow was found by Christoph
Egger of AMD.
Keir Fraser [Tue, 20 Nov 2007 14:35:36 +0000 (14:35 +0000)]
xen: Domain0 builder should set start_info magic string to
'xen-3.0-...' just like user-space builder for domUs. Signed-off-by: Keir Fraser <keir@xensource.com>
Keir Fraser [Fri, 16 Nov 2007 20:06:15 +0000 (20:06 +0000)]
Log dirty radix tree code cleanup. Also do not deference non-existent
pointer in paging_new_log_dirty_*() functions if allocation fails. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Fri, 16 Nov 2007 19:07:46 +0000 (19:07 +0000)]
hvm: RTC emulation - RTC_UIE/RTC_SET fix
This patch fixes a bug in the RTC code which appears to originate in
having written the emuated device following an incorrect
specification. VMware has (or had, at least, at the time we were still
testing on both VMWare and Xen) the same issue. In the current code,
when RTC_SET is set, RTC_UIE is cleared. This does not match the
behavior of real hardware, where the case is simply that no update
ended interrupts are sent as long as RTC_SET is set, but the UE ints
will resume as soon as RTC_SET is cleared and the clock update is
done. This little patch fixes this issue. In practicality, this means
OS/2 can now set the time without having the clock stop. I don't know
if any other guests have been affected by this issue.
Keir Fraser [Fri, 16 Nov 2007 18:33:24 +0000 (18:33 +0000)]
hvm: make dirty logging stop requiring physical pages of order > 0
This patch re-implements the (x86) hypervisor dirty page log with a
simple four-level radix tree whose nodes are all single pages, thus
making migration require only order-0 pages (where before it required
at least an order-5 page).
Unlike the p2m radix tree implementation, the interior nodes of this
tree are NOT page table nodes. I chose a lazy-allocation and -mapping
approach because most pages are not marked dirty while dirty-logging is
enabled. There are doubtless situations (the 'stream' benchmark, for
example) where a more complex p2m-like approach is faster, but I'm not
sure they're worth the effort.
Signed-off-by: Dave Lively <dlively@virtualiron.com>
Keir Fraser [Fri, 16 Nov 2007 17:59:34 +0000 (17:59 +0000)]
x86: Clean up some files of inline asm, and fix
__copy_{to,from}_user_ll() for gcc 3.4 (asm output constraints all
need to be '=&').
Based on a patch by Jan Beulich. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Fri, 16 Nov 2007 17:08:05 +0000 (17:08 +0000)]
xentrace: make xentrace and xenmon work on Solaris and *BSD.
- Use getopt() to get rid of argp dependency which does not exist
on Solaris and *BSD. Done by Tariq Magdon-Ismail.
- Minor modifications by me (Christoph) to make it also work on *BSD.
- Tested on Linux by me (Christoph). No functional change on Linux.
- Tariq ok'd BSD modifications for Solaris
- Tariq ok'd submission by me :)
Signed-off-by: Tariq Magdon-Ismail <tariqmi@sun.com> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Keir Fraser [Fri, 16 Nov 2007 16:36:38 +0000 (16:36 +0000)]
vmx: wbinvd optimization for pass-through domain.
Optimise wbinvd exit emulation for pass-through domains to avoid
"always wbinvd" when a VCPU is migrated. Instead, do host wbinvd on
all host CPUs when wbinvd exit.
Keir Fraser [Fri, 16 Nov 2007 14:45:35 +0000 (14:45 +0000)]
xend, xenapi: Strip characters from logs that XMLRPC layer cannot handle.
From: Ian Jackson <ian.jackson@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Tue, 13 Nov 2007 19:05:27 +0000 (19:05 +0000)]
vmx: Restore correct host SYSENTER parameters on vmexit.
Also simplify vmx_set_host_env().
HOST_GDT_BASE does not have to change when we shift CPU. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>