Commit Graph
20117 Commits
Author SHA1 Message Date
Keir Fraser 552cd79c66 libxc: More LZMA/BZIP fixes.
- Fix an error message in xc_try_bzip2_decode()
 - Check library installation on demand using a Makefile function,
   rather than generating a dependency file. Cleaner and avoids a race
   on generating the dep file.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-24 08:27:30 +01:00
Keir Fraser b0ae5f8bd1 vtpm: Upgrade to using tpm_emulator-0.5.1
The newer version of the emulator contains several bug fixes, one that
we were seeing in our use of vtpm.

This patch also defines TPM_STRONG_PERSISTENCE for the new emulator.

A couple of important notes about this patch:
-This has only been tested on PVM domU's. In theory it should work for
HVM but I have not tried it at all and can guarantee nothing.
-All the relevant changes in tools/vtpm/vtpm.patch have been ported
to tpm_emulator-0.5.1.
-None of the changes in tpm_emulator.patch have been ported. In
particular this means the BUILD_EMULATOR option, which as I understand
lets you use the tpm_emulator in dom0 for a machine that does
not have a real hardware TPM does not work. This functionality should
be easy to add though because the new emulator already comes with a
kernel module interface.
-No considerations were made for the VTPM_MULTI_VM feature (which is
supposedly unfinished). This patch may or may not break any progress
made on that feature.

Signed-off-by: Matt Fioravante <Matthew.Fioravante@jhuapl.edu>
2009-08-24 08:08:52 +01:00
Keir Fraser 2ac9ced4cb xend: Allow vtpm instance uuid to be specified on domain creation
Right now xen will create a new vtpm instance everytime you start up a
domU, even if you specify the instance parameter in your config file.
Each vtpm instance is then given a uuid and the vtpm.db file maps
instance numbers to uuid numbers.

This patch is a hack that lets you explicitly set the uuid of your
vtpm instance. Everytime you boot up your domU now the vtpm will get
that uuid and thus it will always get the same vtpm instance number
instead of being generated a new one.

So for example, in your config file you would do something like this
vtpm = [ 'backend=0,uuid=dcdb124b-9fed-4040-b149-dd2dfd8d094c' ]

Signed-off-by: Matt Fioravante <Matthew.Fioravante@jhuapl.edu>
2009-08-24 08:05:46 +01:00
Keir Fraser 63afd80f48 vtpm: Fix hashed-memory file writing.
There is a bug in the vtpm_manager that has to do with hashing and
saving the NVM memory files (vtpm_dm_%d.data). The file is not
truncated when it is written and this results in the hash becoming
invalid because of the extra bits at the end of the file.

This patch adds O_TRUNC to the flags when opening the file.

More details on this issue are in the bug report on bugzilla=20
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=3D1488

Signed-off-by: Matt Fioravante <Matthew.Fioravante@jhuapl.edu>
2009-08-24 08:03:46 +01:00
Keir Fraser 0810208cf1 x86: run timers when populating Dom0's P2M table
When booting Dom0 with huge amounts of memory, and/or memory accesses
being sufficiently slow (due to NUMA effects), and the ACPI PM timer
or a high frequency HPET being used, the time it takes to populate the
M2P table may significantly exceed the overflow time of the platform
timer, screwing up time management to the point where Dom0 boot fails.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-08-24 08:02:08 +01:00
Keir Fraser 2db97700d4 x86: Ensure irq is disabled before taking vector_lock.
Fixed debug lock issue for taking vector lock.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-21 17:14:35 +01:00
Keir Fraser 9731b3ca8b ia64: Fix ia64 build issue introduced by per-cpu vector changes.
ia64 has no per-cpu vector support, so change the related APIs back
through defining macros.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-21 17:13:54 +01:00
Keir Fraser f6b66ffe92 Update .hgignore for tools/libxc/.zlib.deps 2009-08-21 17:13:17 +01:00
Keir Fraser 130a5a403b docs/misc: Update XSM Flask documentation
Update the XSM Flask documentation to reflect the support for
policy.24, the updated policy and policy build infrastructure, and how
to enable the optional MLS policy.

Signed-off-by:  Stephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
2009-08-21 17:12:13 +01:00
Keir Fraser 8fac45ee6e pygrub: Fix elilo handling after password patch.
Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-08-21 17:11:40 +01:00
Keir Fraser a8f634b0a3 Revert 20105:979fd420311b 2009-08-21 17:00:01 +01:00
Keir Fraser ee316d2f8c libxc: Remove minios-specific hack for generating .zlib.deps file
It's not needed if one relative path is replaced.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-21 11:10:49 +01:00
Keir Fraser 4a22a4ce1e libxenguest: Fix libbz2/liblzma dependency computation.
1. Create an empty dep file if neither lib is installed
 2. Forcibly disable support for libs if building minios

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 22:26:16 +01:00
Keir Fraser d7c9674faa domain builder: Implement bzip2 and LZMA loaders
Recent upstream kernels can be compressed using either gzip,
bzip2, or LZMA.  However, the PV kernel loader in Xen currently only
understands gzip, and will fail on the other two types.  The attached
patch implements kernel decompression for gzip, bzip2, and LZMA so
that kernels compressed with any of these methods can be launched.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 22:12:25 +01:00
Keir Fraser ce2fb297a8 tools/flask/policy: Updates to policy and policy build infrastructure
The original xen policy infrastructure was based off of an early
version of refpolicy. Because of this there was a lot of cruft that
does not apply to building a policy for xen. This patch does several
things. First it cleans up the makefile as to remove many unnecessary
build targets. Second it fixes an issue that the policy build process
wasn't handling interface files properly. Third it pulls in the MLS
suppport functions from current ref policy and makes use of
them. Finally it updates the xen policy with new rules to address
changes in xen since the policy was last worked on, and provides
several new abstractions for creating domains.

Signed-off-by: David P. Quigley <dpquigl@tycho.nsa.gov>
2009-08-20 21:15:24 +01:00
Keir Fraser 6d4af7fc29 x86_64 hvm: Adjust COMPAT_VIRT_START for 32-bit HVM guests.
The PV limit should not apply as there is no M2P table mapped into an
HVM guest's virtual address space.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 18:27:31 +01:00
Keir Fraser d453aec3e0 xm-test: Fix testcase '11_block_attach_shared_dom0' for up-to date
linux kernels

New kernels have ext2 disabled by default.  This fix uses ext3 for
testcase 11_block_attach_shared_dom0.

Signed-off-by: Andreas Florath <xen@flonatel.org>
2009-08-20 16:19:01 +01:00
Keir Fraser fee98528ea pygrub: Add password support
It basically checks for the presence of password line in grub.conf
of the guest image and if this line is present, it supports both clear
text and md5 versions of the password. Editing the grub entries and
command-line are disabled when some password is set in domain's
grub.conf file but the password was not entered yet. Also, new option
to press 'p' in interactive pygrub has been added to allow entering
the grub password. It's been tested on x86_64 with PV guests and was
working fine. Also, the countdown has been stopped after key was
pressed, ie. the user is probably editing the boot configuration.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-08-20 16:17:16 +01:00
Keir Fraser 43639f12e8 x86: shadow_alloc_p2m_page() should call shadow_prealloc() before shadow_alloc()
shadow_alloc_p2m_page() fails to call shadow_prealloc() before calling
shadow_alloc().  In certain conditions, notably when PoD is being
exercised, this may cause shadow_alloc() to fail, crashing Xen.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-08-20 16:15:52 +01:00
Keir Fraser 21fc28f0df x86 vmx: Update EIP when appropriate during task switch
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 13:32:31 +01:00
Keir Fraser f0321cbffa Fix xapi xm-tests.
There were a couple of small bugs in the xapi xm-test:
o outdated XenAPI calls were removed from testcase
  (02_xapi-vbd_basic)
o minor problem with XendLocalStorageRepository
  is fixed (missed list_images() function - which
  is moved from the XenQCoWStroageRepo to the common
  base class XendStorageRepository)
  which was detected running 02_xapi-vbd_basic.
o XenAPI session handling and connecting is fixed.
o 03_xapi-network_pos was rewritten and now uses
  XenAPI.

Signed-off-by: Andreas Florath <xen@flonatel.org>
2009-08-20 10:30:53 +01:00
Keir Fraser 1ef2f79d04 xm-test: Add status section to xm-test/README
The resport functionality is not removed because there is the hope
that somebody sets up the server side infrastructure.

Signed-off-by: Andreas Florath <xen@flonatel.org>
2009-08-20 10:27:37 +01:00
Keir Fraser 6a30c4f8f6 x86: Remove global percpu_mm_info structure, to make dataflow through
mm code clearer.

The FOREIGNDOM method was just confusing and pointless. The deferred
TLB flushing is of questionable value now that much automatic flushing has to be
synchronous to avoid guest SMP races.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 10:16:58 +01:00
Keir Fraser bb4b42c9cf x86: teardown_msi_irq is not needed.
teardown_msi_irq logic is covered in destroy_irq,
so remove it to avoid freeing msi resource twice.

Signed-off-by: Xiantao Zhang<xiantao.zhang@intel.com>
2009-08-20 08:26:51 +01:00
Keir Fraser e0c21e9a94 x86: calculate nr_irqs_gsi correctly.
Should be a typo, this issue is introduced by Cset20076,
and it may break VT-d device assignment.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-08-20 08:26:16 +01:00
Keir Fraser 89164e3f7b xend: Fix error caused by VT-d ACS patch.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
2009-08-20 08:25:41 +01:00
Keir Fraser be7c3e95bc pygrub: Revert 19322:3118041f2259, as it breaks timeout=0 behaviour
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 08:23:33 +01:00
Keir Fraser 361c982639 x86: Fix arch/x86/xen.lds dependencies.
gcc can get the dependency target name wrong (appends .o).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-19 17:00:26 +01:00
Keir Fraser fc865b3912 AMD IOMMU: support "passthrough" and "no-intremap" parameters.
Signed-off-by: Wei Wang <wei.wang2@amd.com>
2009-08-19 14:23:30 +01:00
Keir Fraser bd3b5ffb3b Update Xen Flask module to policy.24.
This is a back-port of the latest SELinux code to Xen, adjusted
for Xen coding style and interfaces.  Unneeded functionality such
as most object context config data, handle_unknown, MLS field
defaulting, etc has been omitted.

Signed-off-by:  Stephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
2009-08-19 14:22:52 +01:00
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