Commit Graph
20087 Commits
Author SHA1 Message Date
Keir Fraser bad456af01 xen-hvmctx: don't compile for ia64.
xen-hvmctx is a x86 specific tool so that it shouldn't compile for ia64.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-08-19 14:22:15 +01:00
Keir Fraser 2645f93a9a [IA64] define BYTES_PER_LONG to fix compilation error.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-08-19 14:21:56 +01:00
Keir Fraser e03ad58f0b x86 hvm: Clean up vlapic/vioapic/vmsi delivery.
In particular, avoid intermediate delivery bitmaps which restrict
number of vcpus supported.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-19 14:13:52 +01:00
Keir Fraser 6b55ec4079 xen pm trace utility cleanup
xenpm trace utility gtraceview cleanup

- add gtraceview help info on how to get raw data by xentrace
- make trace_exit_reason compiled in non-debug mode. trace_exit_reason
  can be enable/disabled by xentrace at runtime, so no need to disable
  it at build time.

Signed-off-by: Yu Ke <ke.yu@intel.com>
2009-08-19 13:17:41 +01:00
Keir Fraser 5ae9d73d93 x86 hvm: Remove vendor-specific feature masking of 0x1:ECX.
Vendors are respecting each others bits.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2009-08-19 13:16:50 +01:00
Keir Fraser 39b4fc5972 xend: passthrough: check if a device is behind PCIe switch that lacks ACS
Imagine a PCIe switch, which doesn't support ACS (Access Control
Services), has 2 downstream ports: A and B, according to PCIe spec,
the PCIe switch should directly route the transaction that is from A
and to a device under B -- the Root Complex and IOMMU engine are
bypassed -- this doesn't work at all in the case of hvm guest and can
even incur potential security issue, so we should not allow such kind
of device assignment.

If all the intermediate PCIe swiches between a device and Root Complex
support and enable ACS, we can safely asssign the device to guest.

Cc: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-08-19 13:12:16 +01:00
Keir Fraser b6cd10140c hotplug scripts: better same_vm checks
currently the function same_vm in block-common.sh is the one
responsible for detecting if two block devices can be used at the same
time by two VMs. This can be allowed in few specific cases: when the
two VMs are actually the same VM and when the two VMs are the guest
and its stubdomain. We need to expand these exceptions to handle
properly save restore issues: this patch adds to the exceptions the
case when two VMs are the same VM because of save\restore races, and
when two VMs are the guest and the stubdomain of the previous guest,
again during save\restore.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-08-19 13:11:33 +01:00
Keir Fraser c88b1e06d5 x86: miscellaneous emulator adjustments
Defer fail_if()-s as much as possible (in favor of possibly generating
exceptions), and avoid generating exceptions when not strictly
necessary.

Avoid fail_if()-s for simple return code checks (making the code that
used them consistent with other, longer existing code).

Eliminate redundant generate_exception_if()-s checking lock_prefix
(which is already covered by the general check prior to decoding
operands).

Also fix the testing code to add PROT_EXEC for the mapping that is
intended to have instruction executed from.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-19 13:02:31 +01:00
Keir Fraser b2c296e1c5 x86-64: adjust emulation of control transfers
While Intel and AMD implementations differ in various respects when
it comes to non-default operand sizes of control transfer instructions
and segment register loads (lfs, lgs, lss), it seems to make senss to
(a) match their behavior if they agree and (b) prefer the more
permissive behavior if they don't agree:

- honor operand size overrides on near brances (AMD does, Intel
  doesn't)
- honor operand size overrides on far branches (both Intel and AMD do)
- honor REX.W on far branches (Intel does, AMD doesn't except on far
  returns)
- honor REX.W on lfs, lgs, and lss (Intel does, AMD doesn't)

Also, do not permit emulation of pushing/popping segment registers
other than fs and gs as well as that of les and lds (the latter are
particularly important due to the re-use of the respective opcodes as
VEX prefixes in AVX).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-19 13:02:04 +01:00
Keir Fraser cf8b52ff53 x86: extend runstate area updates
In order to give guests a hint at whether their vCPU-s are currently
scheduled (so they can e.g. adapt their behavior in spin loops),
update
the run state area (if registered) also when de-scheduling a vCPU.

Also fix an oversight in the compat mode implementation of
VCPUOP_register_runstate_memory_area.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-19 13:01:41 +01:00
Keir Fraser 95fe89367e x86: Fix max_gsi calculation on systems with discontiguous GSI space.
From: Steven Smith <steven.smith@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-19 12:58:15 +01:00
Keir Fraser 276e535eba xm,xend: Remove tab indents
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-08-19 12:55:15 +01:00
Keir Fraser 9e212a4e9a x86: Only allocate vpid for initialised vcpus.
Currently, 32 vpids are allocated for each
domain statically, it blocks to support more
vcpus for HVM domain, so remove the limit and
only allocate vpid for intilized vcpus. In this
way, vpid can be non-contiguous for vcpus of one
single domain.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-19 12:54:43 +01:00
Keir Fraser 487a1cffd7 x86: Implement per-cpu vector for xen hypervisor
Since Xen and Linux has big differece in code base, it
is very hard to port Linux's patch and apply it to Xen
directly, so this patch only adopts core logic of Linux,
and make it work for Xen.

Key changes:
1. vector allocation algorithm
2. all IRQ chips' set_affinity logic
3. IRQ migration when cpu hot remove.
4. Break assumptions which depend on global vector policy.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-19 12:53:46 +01:00
Keir Fraser b07b22f961 x86: Change Xen hypervisor's interrupt infrastructure
from vector-based to IRQ-based.

In per-cpu vector environment, vector space changes to
multi-demension resource, so vector number is not appropriate
to index irq_desc which stands for unique interrupt source. As
Linux does, irq number is chosen to index irq_desc. This patch
changes vector-based interrupt infrastructure to irq-based one.
Mostly, it follows upstream linux's changes, and some parts are
adapted for Xen.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-19 12:53:04 +01:00
Keir Fraser d6e849eda1 x86: Change nr_irqs to nr_irqs_gsi.
Currently, nr_irqs is only used for GSI irqs, change
the name to make its meaning more precise. And, also
this is the initial step to support irq allocation for
MSI interrupt source.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-19 12:52:38 +01:00
Keir Fraser 4134aa330d gdbstub: Remove noisy message on every gdbstub entry.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-16 08:46:08 +01:00
Keir Fraser 5d9367d059 stubdoms: parse bridge informations
Currently the stubdom-dm script doesn't read the bridge of a vif
on xenstore, therefore all the vifs assigned to the stubdom always
belong to default bridge. This patch changes the behavior reading the
bridge from xenstore and adding the bridge to the stubdom config
file.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-08-16 08:45:04 +01:00
Keir Fraser c3fcb0fd91 Revert 20066:135b350496fb 2009-08-16 08:43:50 +01:00
Keir Fraser b5eb2dabf5 xen-hvmctx: a tool to print the HVM state of a running domain
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-14 17:26:23 +01:00
Keir Fraser 2ca1b6fff7 xend: VBD QoS policy bits
Add the ability to define VBD QoS policy in the xend layer.

Consider the following vbd entry:

vbd = [
   'phy:/dev/server/virtualmachine1-disk,xvda1,w,credit=3D5000/s@50ms',
]

This means that a VM may perform 5000 I/O operations per second, with
credit being replenished every 50 milliseconds.

The 'credit' xenstore value is by the blkback driver to ratelimit I/O
operations for the specific device.

Signed-off-by: William Pitcock <nenolod@dereferenced.org>
2009-08-14 17:10:11 +01:00
Keir Fraser 0cd32f209e x86 mce: move mce quirks into separate files
Quirk handling is designed to easily add more quirks when needed
w/o messing around in the normal mce code.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-08-14 17:09:39 +01:00
Keir Fraser 052af7a90b xsm/flask: Fix AVC audit message format
Fix formatting of Flask AVC audit messages so that existing
policy tools can parse them.  After applying,
'xm dmesg | audit2allow' yields the expected result.

Signed-off-by: Stephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
2009-08-14 17:08:38 +01:00
Keir Fraser 97a99fda19 xsm/flask: Fix sidtab locking bug
We do not need to use the _irqsave/irqrestore forms of spin locking
within the sidtab in Xen's XSM Flask module, and doing so triggers a
BUG_ON() within check_lock() when we subsequently call xmalloc().
This was preventing Xen from booting with XSM/Flask enabled if built
with debug=y. It appears that this broke upon the changes to xmalloc
in changeset 18379:14a9a1629590.

Signed-off-by: Stephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
2009-08-14 17:08:12 +01:00
Keir Fraser 9823a3d98c AMD IOMMU: Destroy passthru guests when IO pagetable allocation fails
Signed-off-by: Wei Wang <wei.wang2@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
2009-08-14 17:07:23 +01:00
Keir Fraser fe3d9dce10 x86: cleanup rdmsr/wrmsr
Use a 64bit value instead of extracting/merging two 32bit values.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-14 12:26:35 +01:00
Keir Fraser bb78251301 x86 mce: make debug messages less noisy
On guest MCE read only print debug code when
a non-zero value has been read. Xen is too
noisy, otherwise.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-08-14 10:59:13 +01:00
Keir Fraser a569ec6147 VMX: issue an NMI rather than just calling the NMI handler
when the VMEXIT code indicates that an NMI has been raised.
Otherwise we might hit a real NMI while in the handler.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-08-14 10:58:32 +01:00
Keir Fraser 3ad8ef6026 hvm: handle access to MSR_AMD64_NB_CFG
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-08-14 10:57:24 +01:00
Keir Fraser e49d3624a1 x86: Remove EF_* duplicate defs for X86_EFLAGS_*.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-14 08:36:12 +01:00
Keir Fraser f2bb9f1b6e x86: Do not clear EF.TF in crash-debug mode.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-14 08:22:34 +01:00
Keir Fraser dfa275f7d9 gdbstub: Fix the build and make a few cleanups.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-13 08:40:39 +01:00
Keir Fraser 91c2518a67 gdbstub: Small fixes.
* Correctly handly EFLAGS.TF in the hypervisor
 * Register value sent with 'P' command is in native byte order.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-12 14:27:52 +01:00
Keir Fraser 2606d3eec6 x86 numa: fix nodes' memory parsing when SRAT table includes future-hotplug memory range
A node's future-hotplug memory range starts from very high end
normally, e.g. 1TB, and is not continuous with its current existing
memory range. It should not be covered by the global variable 'nodes'
as it assumes the node's memory is continuous. Otherwise it can make
nodes' memory ranges become very big and overlapped, and
populate_memnodemap() fails.

We can ignore future-hotplug memory range for now. Physical memory
hotplug support in future will handle it.

Signed-off-by: Yang Xiaowei <xiaowei.yang@intel.com>
2009-08-12 14:16:09 +01:00
Keir Fraser 6ebb9d5ec8 x86 svm: Fix PAT MSR handling when using Nested Paging.
Accesses to the MSR should not be intercepted.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-12 14:13:54 +01:00
Keir Fraser c68a76632a x86 svm: Fix the build: vlapic_get_reg() takes two arguments.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-12 14:13:00 +01:00
Keir Fraser 99e7db68f3 tmem: one-liner correcting stat parsing ordering
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-08-12 14:06:30 +01:00
Keir Fraser ed53f19568 x86 svm: Fix checked builds of Windows running on AMD SVM
Checked builds of Windows will, after every modification of the TPR,
read it back again and assert that the value read back matches with
the value written, including the priority sub-class.  Make sure that
we correctly preserve it on vmexit.

As far as I can tell from reading the documentation, the sub-class
doesn't actually do anything, so this should be pretty harmless.

Signed-off-by: Steven Smith <steven.smith@eu.citrix.com>
2009-08-12 14:06:01 +01:00
Keir Fraser 87b8f65a96 xentrace: fix "%016x" format
xentrace_format cannot use "0x016x" format as we expect.
It show only %(N) as "0x016x" format, not as "%(N+1)08x%(N)08x".
So I fixed tools/xentrace/formats by using "%(N+1)08x%(N)08x" format.
Also I added some TRC_PV entries.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
2009-08-11 07:36:26 +01:00
Keir Fraser 7784c384a0 libxc: Include private Xen headers in stubdom libxc build
The headers libelf.h and elfstructs.h were removed from
xen/include/public in 19011:7df072566b8c.  But this broke the stubdom
build because parts of libxc depend on them.  This patch adds
$(XEN_ROOT)/xen/include/xen to the stubdom -I path.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-08-11 07:34:55 +01:00
Keir Fraser 8adf4754dd Update QEMU_TAG to a83d119cfcc20bc7edb427992d6e31b3e99430be 2009-08-10 18:15:19 +01:00
Keir Fraser c89a659a35 Revert alloc_idle_vcpu() to support multiple idle domains where max
vcpus is less than max pcpus (e.g., can happen on i386).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-10 13:51:28 +01:00
Keir Fraser 4d60f70295 x86: make mce debug output more verbose
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-08-10 13:33:01 +01:00
Keir Fraser 6865a2d6b6 x86: Remove cpumask.h inclusion from mm.h
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-10 13:32:02 +01:00
Keir Fraser f78a13d5e9 pygrub: Remove bogus log.debug line.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-10 13:30:50 +01:00
Keir Fraser 81d70f1a53 tmem: expose freeable memory
Expose tmem "freeable" memory for use by management tools.

Management tools looking for a machine with available
memory often look at free_memory to determine if there
is enough physical memory to house a new or migrating
guest.  Since tmem absorbs much or all free memory,
and since "ephemeral" tmem memory can be synchronously
freed, management tools need more data -- not only how
much memory is "free" but also how much memory is
"freeable" by tmem if tmem is told (via an already
existing tmem hypercall) to relinquish freeable memory.
This patch provides that extra piece of data (in MB).

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-08-10 13:27:54 +01:00
Keir Fraser 37541c4165 tools: Fix iptables failure test in vif-common.sh
In changset 19540 a bug was introduced in the fib_iptable function in
vif-common.sh that incorrectly checks the exit status of iptables --
it always believes iptables has failed even when it hasn't.

The attached patch fixes that.  It's also bug 1490.

Signed-off-by: John Haxby <john.haxby@oracle.com>
2009-08-07 17:31:27 +01:00
Keir Fraser bd53bc404f x86: replace PAT initialisation magic value with a #define
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-08-07 17:30:33 +01:00
Keir Fraser b37f409100 x86: Increase default max CPUs to 64.
Also remove compile-time limit of 32 for i386. It is no longer
required, since a cpumask was moved out of struct page_info.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-07 17:29:50 +01:00
Keir Fraser c805aed275 x86 p2m: use common p2m ops in common p2m code path
We found recently there was an assertion failure when EPT mode is
enabled on 32PAE host when debug=y is used. The patch attached fixes
that. It uses the common p2m ops in the
common p2m code path p2m_remove_page rather than calling
p2m_gfn_to_mfn() for only shadow mode.

Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com>
2009-08-07 17:23:11 +01:00