Keir Fraser [Tue, 4 Dec 2007 11:04:57 +0000 (11:04 +0000)]
x86: clean up mm.c and cache 'current' where appropriate.
Attached patch caches current vcpu and current->domain where
appropriate. Make mod_l4_entry() definition matching with
mod_l?_entry(). Since current->domain was always passed to it, this
has no functional change.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Keir Fraser [Tue, 4 Dec 2007 10:50:28 +0000 (10:50 +0000)]
blkif interface: Add BLKIF_OP_FLUSH_DISKCACHE.
This disk operation, implemented on Solaris only so far, asks a
backend to flush the disk caches of the underlying storage if
possible, and is contigent upon the 'feature-flush-cache' xenstore
flag (although currently Solaris will always attempt to flush
anyway).
Keir Fraser [Tue, 4 Dec 2007 10:47:10 +0000 (10:47 +0000)]
tboot, xen: Update for Trusted Boot v20071128.
This patch updates the Xen to work with the latest version (20071128)
of Trusted Boot (tboot). This version of tboot now resides at 16MB
(instead of the previous <1MB), in addition to several other
enhancements. By residing at 16MB, this version of tboot will be
protected from access by dom0.
This patch allows Xen to correctly map the tboot shutdown code that it
must trampoline into for a clean shutdown (without this patch Xen will
fault on shutdown). This patch will also work with the previous
version of tboot.
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Keir Fraser [Tue, 4 Dec 2007 10:40:48 +0000 (10:40 +0000)]
Fix xenmon.py to work on Solaris
The xenmon.py script does not work on Solaris because of (1) its
assumption that xenbaked is in the users path and, (2) the use of the
killall command. Changed xenmon.py to use pkill instead and provided
the path to xenbaked on Solaris.
Keir Fraser [Tue, 4 Dec 2007 10:17:32 +0000 (10:17 +0000)]
xentrace: Don't append trace on existing file.
When you run "xentrace -e <mask> trace.output" the first time, all is
fine. When you run it a second time, then the data is appended which
makes you reading old data with xentrace_format and you interprete it
as new data. This usually happens when you automated tracing guests
with xentrace and xentrace_format with a script.
Therefore, attached patch makes xentrace to truncate the file to zero
bytes before writing any data.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Keir Fraser [Tue, 4 Dec 2007 09:56:10 +0000 (09:56 +0000)]
x86: Move get_page/put_page out of header file, and only print on
get_page() failure if the domain is not dying. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Alex Williamson [Thu, 29 Nov 2007 19:15:43 +0000 (12:15 -0700)]
[IA64] Implement guest_os_type for ia64
This makes use of the domain config option guest_os_type for
ia64 and removes the backing for the previous ACPI based
mechanism used previously. A user wanting optimal performance
for a specific type of OS guest running in an HVM domain should
make use of this new option. See updated xmexmaple.vti for
available options. All supported OSes should always work using
the default option or leaving the option unspecified. Originally
based on patch from Zhang Xin.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Alex Williamson [Thu, 29 Nov 2007 18:54:31 +0000 (11:54 -0700)]
[IA64] Create common guest_os_type domain config option
This is an optional domain config entry that may be used by
architecture specific builder code to setup various optimizations
based on the guest OS intended to run in the domain. Based on
patch from Zhang Xin.
Signed-off-by: Alex Williamson <alex.williamson@hp.com> Acked-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Wed, 28 Nov 2007 22:36:33 +0000 (22:36 +0000)]
vmx: Better tracing in vmcs_dump_vcpu() -- grab RIP/RSP/RFLAGS from
cpu_user_regs structure as well as VMCS. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Alex Williamson [Wed, 28 Nov 2007 19:32:28 +0000 (12:32 -0700)]
[IA64] vcpu_setcontext: only set cr_irr if VGCF_SET_CR_IRR flag is set.
cr_irr can be modified even when a vcpu is blocked (by itv handler).
Unconditionally setting cr_irr can trouble debugger as it may clear a bit
of cr_irr and thus miss an interrupt. This can be very annoying if the
interrupt is itv and the vcpu is inside PAL_HALT_LIGHT (the vcpu stays
blocked forever).
Keir Fraser [Wed, 28 Nov 2007 13:36:56 +0000 (13:36 +0000)]
domctl: Fix handling of size parameter in ext_vcpucontext domctl commands.
Original patch by Stefan Berger. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Wed, 28 Nov 2007 13:13:51 +0000 (13:13 +0000)]
hvm: Fix 2 type mismatches in vlapic.h and hpet.c for 32-bit build Xen
For 32-bit build of Xen:
1) the first mismatch (in hpet_read(), length is 4) makes guest think
the HPET DM is buggy (we return 0 for HPET_CFG.COUNTER_CLK_PERIOD to
guest), so guest wouldn't use HPET at all.
2) the second one: if tmict is 62500000 and timer_divisor is 16
(Fedoar7's installer uses the values at some time), 10 * 62500000 * 16
= 0x2540BE400 -- it's too big to be held in uint32_t.
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>=20
Keir Fraser [Wed, 28 Nov 2007 13:04:47 +0000 (13:04 +0000)]
hvm: Inject #UD for un-emulated instructions rather than crash guest
The CrashMe stress test (a process repeatedly forks child processes, and
the child processes initialize a buffer with random numbers, then treat
the buffer as code, and execute it) can crash 32-bit HVM RHEL5.1 guest
easily; this is because we haven't emulated all the instructions in
handle_mmio() yet.
The CrashMe process runs with root rights, and can access MMIO space in
an unknown way ("strace -f" shows the random codes running at CPL=3D3
don't call mmap(), and don't open any special files in /dev/ "); the gpa
may look like 0xa**** or 0xb****, or 0xfee0****. =20
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Wed, 28 Nov 2007 12:34:11 +0000 (12:34 +0000)]
vt-d: Some fixes and cleanup of Intel iommu
This patch modifies domain id in __iommu_flush_context() and
__iommu_flush_iotlb() to be consistent consist with domain id set by
context_set_domain_id(), avoids setting NULL to address space root
and corrects macro cap_ndoms.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Mon, 26 Nov 2007 22:20:21 +0000 (22:20 +0000)]
vmx realmode: When returning to protected mode we have to massage the
segment state to pass VMENTER's stringent 'sanity checks'. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
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>