Commit Graph
20367 Commits
Author SHA1 Message Date
Keir Fraser 02a4e58f0b shadow dirty-VRAM: avoid multiple remove_all_mappings calls.
sh_remove_all_mappings() will walk roughly half of the shadow L1
tables for each MFN it's called with; calling it for every MFN in a
guest's framebuffer can be _very_ expensive, especially with the
shadow lock held across the whole operation.  Avoid that by just
blowing away all the shadows.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
2009-10-26 12:18:50 +00:00
Keir Fraser def87a2cbf x86: Enable TSC_RELIABLE for AMD servers
Except for a published BIOS errata on family 11h processors,
all AMD servers that have the Invariant TSC bit set have
a reliable TSC so Xen should not write to the TSC.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Acked-by: Mark Langsdorf <mark.langsdorf@amd.com>
2009-10-23 10:15:17 +01:00
Keir Fraser d6d3c05250 x86 ept: ignore guest writes to read only memory regions or memory
holes in EPT.

This patch prevents domain crash when running memtest86 with EPT.

Signed-off-by: Xin Li <xin.li@intel.com>
2009-10-23 10:13:52 +01:00
Keir Fraser e3d7f1dd25 vtd: interrupt remapping fix
Fix the error of translation from int remapping table entry(IRTE) to
MSI msg. This error may write wrong IRTE back to the VTd hardware, and
block physical interrupts.

Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
2009-10-23 10:13:22 +01:00
Keir Fraser cd5cf5efb2 xsm: Corrected check in io_has_perm()
Fix the check in io_has_perm() to correctly check the start and end
of I/O Memory.

Signed-off-by : George Coker <gscoker@alpha.ncsc.mil>
Signed-off-by : Paul Nuzzi <pjnuzzi@tycho.ncsc.mil>
2009-10-23 10:12:52 +01:00
Keir Fraser 2220131142 x86: Fix RevF detection in powernow.c
The PowerNow! driver does not support RevF and earlier parts.
The current code checks for RevF processors in a function that
is not called.  Change the code path so that RevF processors
are detected and the driver fails registration.

Also fix cpufreq_add_cpu() to handle unsuccessful registration.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
2009-10-23 10:11:52 +01:00
Keir Fraser 5856aed296 blktap2: Fix sysfs handling of blktap2
The pause and unpause paths are currently broken due to a missing
slash. I took advantage of the opportunity to remove code repetition,
repeated strings that should point to the proper constants, etc

From: Andres Lagar Cavilla <andreslc@cs.toronto.edu>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-23 10:09:37 +01:00
Keir Fraser 0dba100da6 xsm: Add getenforce and setenforce functionality to tools
This patch exposes the getenforce and setenforce functionality for the
Flask XSM module.

Signed-off-by : Machon Gregory <mbgrego@tycho.ncsc.mil>
Signed-off-by : George S. Coker, II <gscoker@alpha.ncsc.mil>
2009-10-23 10:05:15 +01:00
Keir Fraser 545a227dfc passthrough/stubdom: clean up hypercall privilege checking
This patch adds securty checks for pci passthrough related hypercalls
to enforce that the current domain owns the resources that it is about
to remap. It also adds a call to xc_assign_device to xend and removes
the PRIVILEGED_STUBDOMS flags.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-23 10:04:03 +01:00
Keir Fraser 5dc1050805 blktap: Fix check_sharing() in blktapctrl
check_sharing() in blktapctrl does not work.
 - It accesses to xenstore by using wrong paths.
 - It compares image paths including image types.
 - It misjudges a return value of strcmp().

This patch fixes those mistakes.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-10-23 10:02:09 +01:00
Keir Fraser 7de68b1611 libxc: fix a few memory leaks
running qemu with valgrind I found I couple of small memory leaks in
libxc, this patch fixes them.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-23 10:00:22 +01:00
Keir Fraser bee72b5893 minios: Optimize mmap(open("/dev/mem"))
Set map_frames_ex's stride parameter to 0 and increment to 1 to avoid
building an explicit list of mfns.

Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
2009-10-23 09:59:45 +01:00
Keir Fraser 05ec439680 stubdom: mmap on /dev/mem support
This patch adds support for mmap on /dev/mem in a stubdom; it is
secure because it only works for memory areas that have been
explicitly allowed by the toolstack (xc_domain_iomem_permission).
Incidentally this is all that is needed to make MSI-X passthrough work
with stubdoms.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-21 16:08:28 +01:00
Keir Fraser 9cd9340a83 x86: Initialize the affinity field after assigning the vector.
To avoid strange output from debug-key "i", desc->affinity should
be the subset of the cfg->domain basically, so copy cfg->domain to
desc->affinity after assigning vector for the irq..

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-10-21 16:07:37 +01:00
Keir Fraser 1e06ab536d Update QEMU_TAG to a3285ff385d2568f0226f15fee2b9808ec3b6deb 2009-10-21 16:06:30 +01:00
Keir Fraser 131e05c790 Remove unused XEN_DOMINF_cpu{mask,shift} definitions.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-21 16:05:05 +01:00
Keir Fraser 6d1d7ac48c xend: bootable flag of VBD not always of type int
1. Calling VDB.set_bootable(True) results in string 'True' in managed
   config file. After xend restart, conversion int(bootable) in
   server/blkif.py fails.
2. selection of bootable disks in XendDomainInfo.py requires
   type(bootable) == int not str, otherwise all disks are taken as
   bootable.

This patch converts the bootable flag always to int.

Signed-off-by: Lutz Dube <Lutz.Dube@ts.fujitsu.com>
2009-10-21 09:23:10 +01:00
Keir Fraser ba0d6cfc6b xmalloc_tlsf: Fall back to xmalloc_whole_pages() if xmem_pool_alloc() fails.
This was happening for xmalloc request sizes between 3921 and 3951
bytes. The reason being that xmem_pool_alloc() may add extra padding
to the requested size, making the total block size greater than a
page.

Rather than add yet more smarts about TLSF to _xmalloc(), we just
dumbly attempt any request smaller than a page via xmem_pool_alloc()
first, then fall back on xmalloc_whole_pages() if this fails.

Based on bug diagnosis and initial patch by John Byrne <john.l.byrne@hp.com>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-21 09:21:01 +01:00
Keir Fraser 2a03afa74d stubdom: implement pci coldplug
This patch fixes the circular dependency problem in the toolstack that
prevented pci coldplug from working with stubdoms: after creating the
stubdom we wait for it to be properly initialized before going
further. We release the domain lock while we wait.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-21 08:51:10 +01:00
Keir Fraser d9e4801c02 x86: MSI: Mask/unmask msi irq during the window which programs msi.
When program msi, it has to mask it first, otherwise, it
may generate inconsistent interrupts. According to spec,
if not masked, the interrupt generation behaviour is undefined.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-10-21 08:50:23 +01:00
Keir Fraser 9266eb0ef8 Obtain Linux kernel via git protocol by default (GIT_HTTP=y overrides)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-20 14:36:01 +01:00
Keir Fraser 1eb8140e5b Fix nomigrate option implementation so that Xen builds.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-20 10:23:28 +01:00
Keir Fraser 87cb99a6dd Add nomigrate config option to disable migration/restore
The new nomigrate option can be set to non-zero in vm.cfg
(for both hvm and pvm) to disallow a guest from being
migrated or restored.  (Save is still allowed for the purpose
of checkpointing.)  The option persists into a save file
and is also communicated into the hypervisor, the latter
for the purposes of a to-be-added hypercall for communicating
to guests that migration is disallowed (which will be
used initially for userland TSC-related sensing, but may
find other uses).

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-10-20 08:45:12 +01:00
Keir Fraser 5cee2dafd8 xend: Cast oos flag to int before arithmetic.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-20 08:43:27 +01:00
Keir Fraser 6f8b0338a4 vtd: Disable VT-d if no DRHD units are probed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-19 16:50:14 +01:00
Keir Fraser 0353ecb9b9 vtd: A few cleanups to avoid dereferencing NULL drhd pointers.
In most cases I simply remove the reference since it is never actually
used.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-19 13:31:21 +01:00
Keir Fraser c45937b714 Revert 20338:5f28661bb2bb
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-19 13:03:03 +01:00
Keir Fraser a5d39947cb Allow guests to register secondary vcpu_time_info
Allow a guest to register a second location for the VCPU time info
structure for each vcpu.  This is intended to allow the guest kernel
to map this information into a usermode accessible page, so that
usermode can efficiently calculate system time from the TSC without
having to make a syscall.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-19 11:58:36 +01:00
Keir Fraser 980aa0a42f vt-d: do not enable VT-d on acpi=off
This reverts changeset 20323: 2370e16ab6d3 and adds a small
check to iommu_setup() which should more correctly cover all cases.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-10-19 10:57:58 +01:00
Keir Fraser 89329d832a x86 shadow: Update cr3 in PAE mode when guest walk succeed but shadow walk fails
When running in PAE mode, Windows 7 (apparently) will occasionally
switch cr3 with one of the L3 entries invalid, make it valid, and then
expect the hardware to load the new value.  (This behavior is
explicitly not promised in the hardware manuals.)  This leads to a
situation where on a shadow fault, the guest walk succeeds but the
shadow walk fails.  The code assumes this can only happen when the
domain is dying, and makes an ASSERT() to that effect.  So currently,
in debug mode, this will cause the host to crash; in non-debug mode,
this will cause a page-fault loop.

This patch solves the problem by calling update_cr3() in that path
when the guest is in PAE mode, and only ASSERT()ing when the guest is
not in PAE mode.  The guest will get one spurious page fault, but
subsequent accesses will succeed.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
2009-10-19 10:56:58 +01:00
Keir Fraser 90abd2437a Per-domain switch to disable oos shadow page tables
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
2009-10-19 10:55:46 +01:00
Keir Fraser ed71370de1 [IOMMU] clean interrupt remapping and queued invalidation
This patch enlarges interrupt remapping table to fix the out-of range
table access when using many multiple-function PCI devices.
Invalidation queue is also expanded.

Signed-Off-By: Zhai Edwin <edwin.zhai@intel.com>
Signed-Off-By: Cui Dexuan <dexuan.cui@intel.com>
2009-10-19 10:54:35 +01:00
Keir Fraser 88cc4a0fc5 x86: vMSI: Fix msi irq affinity issue for hvm guest.
There is a race between guest setting new vector and doing EOI on old
vector.  Once guest sets new vector before its doing EOI on vector,
when guest does eoi, hypervisor may fail to find the related pirq, and
hypervisor may miss to EOI real vector and leads to system hang.  We
may need to add a timer for each pirq interrupt source to avoid host
hang, but this is another topic, and will be addressed later.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-10-19 10:50:46 +01:00
Keir Fraser 70829c3d48 gdbsx: malloc extra bye for null char
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
2009-10-19 10:49:23 +01:00
Keir Fraser d1c22b7f83 xm,xend: Add commands to hotplug usb devices to hvm guests
Signed-off-by: James Song Wei <jsong@novell.com>
2009-10-19 10:48:47 +01:00
Keir Fraser c288a6ff89 xm: Fix xm network2-{attach,detach}
"xm help" is aborted due to a missing comma.
Some fixes in passing.
- less help message.
- typo.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2009-10-19 10:47:09 +01:00
Keir Fraser 27759c390c xend: Implement VBD.media_change
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-10-16 09:04:53 +01:00
Keir Fraser 5a0730a435 xm: Use 'vifname' config option to construct a qemu tap name.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
2009-10-16 08:36:22 +01:00
Keir Fraser dea1048d11 xend: Check no VBDs attached on VDI.destroy
We can destroy a VDI by VDI.destroy even if the VDI is being used
to VBDs. This patch checks that the VDI is not used to VBDs.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-10-16 08:35:21 +01:00
Keir Fraser 81a8a749f5 x86: document tsc_native configuration option in xmexample.hvm.
Set the default value to 1

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-10-16 08:34:49 +01:00
Keir Fraser 106c81c683 xm,xend: A few fixes for changeset 20314
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-10-16 08:32:34 +01:00
Keir Fraser 555a0408d2 x86: Update powernow.c to latest cpufreq code
The general cpufreq infrastructure has been improved over the
last year.  Update the AMD PowerNow! driver powernow.c to
take advantage of those improvements.

Specifically, addresses Novell bugzilla # 530035.

Signed-of-by: Mark Langsdorf <mark.langsdorf@amd.com>
2009-10-16 08:31:39 +01:00
Keir Fraser 6edd9aaf78 xend: passthrough: do not check non-page-aligned MMIO BAR if not strict-check
When the option pci-passthrough-strict-check of
/etc/xen/xend-config.sxp is set to 'no', we don't check the
non-page-aligned MMIO BAR.  This could be useful in some cases, e.g.,
when there is only 1 device in the range of the page and we try to
assign the device to pv guest.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-10-16 08:30:13 +01:00
Keir Fraser 4cf3febf20 vt-d: Fixpanic in msi_msg_read_remap_rte with acpi=off
Xen panics when "acpi=off noacpi" is set. Problem is caused by
dereferencing NULL pointer in drhd after calling
acpi_find_matched_drhd_unit. As acpi_find_matched_drhd_unit can
return NULL, checks has to be done before returned value is used.

From: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
2009-10-16 08:28:47 +01:00
Keir Fraser c5ff46d8d4 x86: Fix ept and vt-d co-existence issue.
For vt-d's mmio address ranges, once ept enables, they should
be added to ept page tables with p2m lock held, and then guest can
access these ranges like conventional ram, but to change the ept
entries, it should take the p2m lock first.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-10-16 08:25:17 +01:00
Keir Fraser 242a16c3d1 xend: add a description config item for each guest.
Add a new option "description=" to each VM to increase the
manageability of VM, which could be accessed via "xm list -l
MACHINE".e.g add "description='(name, james),(priority 5), (owner
james.song@company.com)'" to configure file, User can get the VM's
attribute easily by "xm list -l Machine" or some tools.

Signed-off-by: James Song<jsong@novell.com>
2009-10-16 08:24:47 +01:00
Keir Fraser 94140f9757 Remove bogus call to get_domain_by_id() in do_domctl().
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
2009-10-15 16:49:21 +01:00
Keir Fraser 61f2a44029 gdbsx: a gdbserver stub for xen.
It should be run on dom0 on gdbsx enabled hypervisor. For details,
please see tools/debugger/gdbsx/README

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-15 09:36:40 +01:00
Keir Fraser f8e61527db xm: Reuse VDI if location is same
In XenAPI mode, when we start a VM by using xm create command, VDIs
are always automatically created for VBDs.  Once we shut down the
VM, then start the VM again, then VDIs are newly created.  As a
result, a vdi.xml file continues to expand.

This patch reuses VDIs if location of the VDIs is same.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-10-15 08:31:08 +01:00
Keir Fraser 89b6b19a22 x86: Remove unused temporay variable 'old_gvec'.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
2009-10-15 08:30:31 +01:00