Keir Fraser [Mon, 24 Nov 2008 11:17:44 +0000 (11:17 +0000)]
hvmloader: Relocate the etherboot ROM to be near the end of VGA
BIOS. Current Xen hard coded VGA ROM at 0xC0000 and etherboot ROM
at 0xD0000. This makes the space in [0xC0000 - 0xDFFFF] to be
fragments, which makes it hard to find enough space to hold another
Option ROM.
Keir Fraser [Mon, 24 Nov 2008 11:11:20 +0000 (11:11 +0000)]
pv-on-hvm drivers: build fixes for Linux 2.6.27+
Make the drivers build properly in a 2.6.27 environment as well as
against a kernel with pv-ops Xen configured on (in the latter case
more work would be needed to also make the drivers work, as there's a
large number of duplicate exports).
Portions from Charles Arnold <carnold@novell.com>.
Keir Fraser [Mon, 24 Nov 2008 11:06:16 +0000 (11:06 +0000)]
PCI interface changes for PCIE-AER enabling
This patch reflects some pci interface changes in pciif.h in XEN head
file. And also add domain shutdown support in xend for shutting domain
from DOM0 kernel when non-recoverable uncorrected pci error happens.
Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com> Signed-off-by: Ke Liping <liping.ke@intel.com>
Keir Fraser [Thu, 20 Nov 2008 14:23:59 +0000 (14:23 +0000)]
x86: make NR_IRQS build-time configurable
While keeping the NR_IRQS default at 256 here, I think it would be a
good thing to set it to a higher value to make sure no new mixing of
irq and vector spaces slip in.
Keir Fraser [Thu, 20 Nov 2008 14:22:54 +0000 (14:22 +0000)]
Properly distinguish irq and vector spaces
This makes sure that there are no assumptions about NR_IRQS==NR_VECTORS
anymore, and it also renames various variables to properly reflect
what they represent.
While coded correctly, I wonder whether dump_irqs() shouldn't iterate
over the vector space rather than the irq space, so that MSI entries
are also processed.
Keir Fraser [Thu, 20 Nov 2008 14:17:09 +0000 (14:17 +0000)]
xend: Make _setCPUAffinity() errors nonfatal on domain resume
This patch allows domains to be resumed on different number of CPUs. After
c/s 18764, a domain cannot be resumed when _setCPUAffinity() fails, which
happens when affinity should be set to a non-existent CPU. This patch
makes _setCPUAffinity() errors nonfatal.
Keir Fraser [Wed, 19 Nov 2008 13:17:31 +0000 (13:17 +0000)]
x86, s3: Sync platform stamps at time suspend.
platform_timer_stamp and stime_platform_stamp are synced
to platform timer in time calibration (1s interval), and
thus doesn't reflect the latest value. If they're not
synced at time suspend, the offset can be lost after S3
resume. Average 0.8s lag-behind is observed for each S3
action, which accumulates to TOD inaccuracy.
Keir Fraser [Tue, 18 Nov 2008 15:59:26 +0000 (15:59 +0000)]
x86, hvm: Fix domain restore bug with Intel VLAPIC acceleration.
r18383 mark video memory as ram, and make all valid pages migrated,
including vlapic page (0xFEE00), and share page(0xFFFFF).
An extra memory population for lapic page would override previous
mapping then cause HVM guest with vlapic acceleration hang.
Keir Fraser [Tue, 18 Nov 2008 11:16:36 +0000 (11:16 +0000)]
x86, hvm: Implement interrupt routing to least priority processor.
Instead of round robin the vcpu with the lowest processor
priority is selected for the interrupt. If multiple vcpus
share the same low priority then interrupts are distributed between
those round robin.
Keir Fraser [Thu, 13 Nov 2008 16:31:08 +0000 (16:31 +0000)]
x86: don't disable MSI in order to mask an IRQ
... as that's not really correct, and there are devices which can't
even cope with that. Instead, check whether an MSI IRQ can be masked,
and if it can't, treat it just like a level triggered IO-APIC IRQ.
There's one other bug fix in here, correcting an off-by-one error on
the entry_nr range check in __pci_enable_msix().
Keir Fraser [Thu, 13 Nov 2008 13:03:16 +0000 (13:03 +0000)]
x86: Use the shadow-code PT walker from the HAP functions
Replace the guts of the HAP pagetable walker with a call to the
newly-commonified walker from the shadow code. This reduces
duplication, and gives HAP guests proper access control and A/D-bit
setting for memory accesses from the emulator
Keir Fraser [Wed, 12 Nov 2008 12:04:15 +0000 (12:04 +0000)]
x86: add SSE-based copy_page()
In top of the highmem asstance hypercalls added earlier, this provides
a performance improvement of another 12% (measured on Xeon E5345) for
the page copying case.
Keir Fraser [Tue, 11 Nov 2008 11:03:58 +0000 (11:03 +0000)]
minios: add a barebone net/if.h
net/if.h is a standard header but unfortunately lwip doesn't provide
it for any target but linux. Therefore I am adding a net/if.h, with an
empty implementation of the declared functions.
Keir Fraser [Mon, 10 Nov 2008 10:41:41 +0000 (10:41 +0000)]
vtd: fix interrupt remapping to handle SMI RTE's with uninitialized
reserved fields
Some BIOS does not zero out reserve fields in IOAPIC RTE's.
clear_IO_APIC() zeroes out all RTE's except for RTE with MSI delivery
type. This is a problem when the host OS converts SMI delivery type
to some other type but leaving the reserved field uninitialized. This
can cause interrupt remapping table out of bound error if "format"
field is 1 and the uninitialized "index" field has a value that that
is larger than the maximum index of interrupt remapping table.
Keir Fraser [Wed, 5 Nov 2008 10:57:21 +0000 (10:57 +0000)]
x86: PV support for hugepages
Hugepage support must be enabled via the hypervisor command line
option "allowhugepage". There is currently no support in the tools for
saving/restoring/migrating guests who use hugepages.
Signed-off-by: Dave McCracken <dave.mccracken@oracle.com>
Keir Fraser [Wed, 5 Nov 2008 10:23:26 +0000 (10:23 +0000)]
xend, security: Prevent changing of the policy while VMs are migrating
The net changes of this patch are that the reader-side lock is put
into the path of the migration code and the writer lock into the path
of the code that handles the changing of the policy. Simultaneous
migrations of multiple hosts still work after this lock has been added.
Keir Fraser [Wed, 5 Nov 2008 10:22:19 +0000 (10:22 +0000)]
xend: Add a multi-reader-single-writer lock implementation
This patch adds a reader-writer lock primitive to xend since python
does not provide it by default. The implementation is based on a
condition variable. Some test code is appended at the end of the file.
Keir Fraser [Tue, 4 Nov 2008 11:46:00 +0000 (11:46 +0000)]
x86: allow grant table originating ptes to have their guest available
bits set.
In order to allow 2.6.27's get_user_pages_fast() to correctly detect
granted pages (so they would be passed to get_user_pages()), it must
be possible to tell the grant table code in Xen to set the three
available bits in the pte-s it creates.
Keir Fraser [Mon, 3 Nov 2008 10:32:54 +0000 (10:32 +0000)]
x86: Fix GRANT_PTE_FLAGS.
Since page table entries created through e.g. GNTTABOP_map_grant_ref
are being passed through adjust_guest_l1e(), they must not generally
get _PAGE_USER set - this will be taken care of by adjust_guest_l1e(),
and it will ensure that these don't get _PAGE_GLOBAL set
inadvertently.
Due to the implied security aspect here (_PAGE_GLOBAL getting set on
kernel pages for x86-64), I'd like to ask that this also be applied to
older maintained branches.
At the same time, set _PAGE_NX for pte-s created for grants (as long
as hardware supports it), since it should be only data pages that remote
domains are being given access to.
Keir Fraser [Mon, 3 Nov 2008 10:32:02 +0000 (10:32 +0000)]
x86: simplify page reference handling for partially (in-)validated pages
Simplify general page reference management for preempted (partially
[in-]validated) pages: Reserve on reference that can be acquired
without the risk of overflowing the reference count, thus allowing to
have a simplified get_page() equivalent that cannot fail (but must be
used with care).
Doing this conversion pointed out a latent issue in the changes done
previously in this area: The extra reference must be acquired before
the 'normal' reference gets dropped, so the patch fixes this at once
in both the alloc_page_type() and free_page_type() paths (it's really
only the latter that failed to work with the change described above).
Keir Fraser [Mon, 3 Nov 2008 10:24:17 +0000 (10:24 +0000)]
Cpufreq: Enhance hypervisor px sanity check
This patch enhances hypervisor px sanity check in 2 level:
Firstly, move per-cpu-level px sanity check from each cpufreq driver
to common point (@ hypercall path). Secondly, add per-domain-level px
sanity check to common point (@ cpufreq_add_cpu).
Signed-off-by: Jinsong Liu <jinsong.liu@intel.com>
Keir Fraser [Fri, 31 Oct 2008 14:02:39 +0000 (14:02 +0000)]
Change timer implementation to allow variable 'slop' in how late
timers are fired. The default continues to be 50us, but this can be
configured on Xen's command line.
Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Wei Gang <gang.wei@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Thu, 30 Oct 2008 15:04:27 +0000 (15:04 +0000)]
x86: Use the right error code when testing for spurious pagefaults
Shadowed PV domains may take pagefaults with PFEC_reserved_bit bit
set, which are then turned into page-not-present faults by the shadow
code. Since that changes the error code in the regs structure, we need
to remember the old error code when we later check for spurious page
faults or we'll get false positives.
Keir Fraser [Thu, 30 Oct 2008 14:53:24 +0000 (14:53 +0000)]
x86: fix preemptable page type handling
- retain a page reference when PGT_partial is set on a page (and drop
it when clearing that flag)
- don't drop a page reference never acquired when freeing the page
type
of a page where the allocation of the type got preempted (and never
completed)
- don't acquire a page reference when allocating the page type of a
page where freeing the type got preempted (and never completed, and
hence didn't drop the respective reference)
Keir Fraser [Wed, 29 Oct 2008 16:58:05 +0000 (16:58 +0000)]
cpufreq.c: shut up compiler about cpufreq_dom
Some versions of GCC are too stupid to figure out that cpufreq_dom is
only used if !!domexist and always set in that case, and complain that
it may be used uninitialised.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Mon, 27 Oct 2008 18:51:52 +0000 (18:51 +0000)]
minios: do not expose #define current to applications
Currently the minios headers do this:
#define current get_current()
Obviously when porting general code to this environment, this can
cause problems !
The attached patch arranges for this only to be done if
#define __MINIOS__
is declared, which is set up by the makefile in extras/mini-os.
Suppressing the namespace pollution is necessary to get recent
upstream qemu's to compile, since they (quite properly) use `current'
as an ordinary identifier.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Mon, 27 Oct 2008 13:29:35 +0000 (13:29 +0000)]
x86: highmem handling assistance hypercalls
While looking at the origin of very frequently executed hypercalls I
realized that the high page accessor functions in Linux would be good
candidates to handle in the hypervisor - clearing or copying to/from
a high page is a pretty frequent operation (provided there's enough
memory in the domain). While prior to the first submission I only
measured kernel builds (where the results are not hinting at a
meaningful improvement), I now found time to do a more specific
analysis: page clearing is being improved by about 20%, page copying
doesn't seem to significantly benefit (though that may be an effect of
the simplistic copy_page() implementation Xen currently uses) -
nevertheless I would think that if one function is supported by the
hypervisor, then the other should also be.
Keir Fraser [Mon, 27 Oct 2008 13:22:43 +0000 (13:22 +0000)]
x86: fix domain cleanup
The preemptable page type handling changes modified free_page_type()
behavior without adjusting the call site in relinquish_memory(): Any
type reference left pending when leaving hypercall handlers is
associated with a page reference, and when successful free_page_type()
decrements the type refcount - hence relinquish_memory() must now also
drop the page reference.
Also, the recursion avoidance during domain shutdown somehow (probably
by me when I merged the patch up to a newer snapshot) got screwed up:
The avoidance logic in mm.c should short circuit levels below the top
one currently being processed, rather than the top one itself.
Keir Fraser [Mon, 27 Oct 2008 13:20:52 +0000 (13:20 +0000)]
x86/powernow: fix machine shutdown
cpufreq_del_cpu() calls cpufreq_driver->exit() without checking
whether an exit() handler is present, and by adding an exit() handler
to powernow we can at once close the potential memory leak.
Keir Fraser [Mon, 27 Oct 2008 10:08:48 +0000 (10:08 +0000)]
x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests
A 32on64 guest cannot copy an existing pinned L3 entry to use as a new
L3 because COMPAT_L3_DISALLOW_MASK contains bits which are added to L3
entries by adjust_guest_l3e (U/S & R/W) or by the hardware (A & D).
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>