Tim Deegan [Wed, 24 Nov 2010 10:20:03 +0000 (10:20 +0000)]
x86/mm: remove incorrect BUG_ON.
This BUG_ON tests a property of an effectively random PFN in the guest,
and is explicitly _not_ seeing the MFN that's known to be owned.
Ian Jackson [Tue, 23 Nov 2010 19:36:14 +0000 (19:36 +0000)]
tools/xl: show shutdown reason code, improve xl list heading
Previously, xl list would not reveal the shutdown reason code unless
it was SHUTDOWN_crashed. This is unfortunate; it makes it hard for
scripts which use xl to tell what's going on.
In this patch:
* xl list shows the reason code as a single letter if it is
any of the defined values from sched.h:
- poweroff or domain not shut down
r reboot
s suspend
c crashed
w watchdog
This is not 100% backward-compatible with xm but I think it's a
justifiable improvement. It would be nice to make the same change
to xm.
* xl list -v shows the full numeric reason code in hex, or "-" if the
domain is not shut down.
* xl list -v has column headings for the UUID and numeric reason
code. The heading for the reason code overlaps with the UUID a bit.
These headings are intended for human readers; scripts can parse
the output by breaking on whitespace.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tim Deegan [Tue, 23 Nov 2010 19:31:29 +0000 (19:31 +0000)]
tools/xl: VMs that are started paused shouldn't reboot paused too.
Otherwise a VM that's been migrated won't ever reboot cleanly again.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tim Deegan [Tue, 23 Nov 2010 19:30:27 +0000 (19:30 +0000)]
tools/xl: make it explicit that we migrate from stdin.
No semantic changes, just makes things a bit less confusing.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Tue, 23 Nov 2010 19:29:13 +0000 (19:29 +0000)]
tools: fetch remote changesets when force refetching/resetting qemu
This makes "make tools/ioemu-dir-force-update" usable for picking up
an entirely new QEMU_TAG.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Campbell [Tue, 23 Nov 2010 19:28:03 +0000 (19:28 +0000)]
ocaml: install built modules
Previously the install target was having no effect because it ended up
calling the default target in the subdir Makefile instead of the
install target.
Resolve this by tying the tools/ocaml Makefiles into the generic
handling done by tools/Rules.mk.
Other changes arising in one way or another from this:
- Add libs/xl/META.in
- Update .hgignore for META files
- Create leading directories
- Remove existing module before installation in install targer
(worksaround what appears to be a quirk of "ocamlfind install")
- Use the globally defined $(DESTDIR)
- Move "ocamlfind printfconf destdir" to a common variable,
repurposing exising unused OCAMLDESTDIR, incorporating $(DESTDIR) at
the same time.
- Drop a few unused variabe definitions (mainly to avoid deciding if
$(DESTDIR) made sense for them or not.
- Pass -destdir to ocamlfind in uninstall target for symmetry with
install target.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
libxl, xl: Account for shadow memory for PV guests too
We need to account for the memory needed by shadow pagetables even for PV
guests, because in that case shadow pagetables are used during live
migration.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Jan Beulich [Tue, 23 Nov 2010 16:43:38 +0000 (16:43 +0000)]
qemu-xen: build adjustments to support out-of-tree builds
QEMU by itself can be built outside of its source directory. With the
qemu repository being separate from the hypervisor/tools one it seems
to make sense to make use of this feature, but doing so requires a
couple of adjustments to the Xen changes to it. Basically, if
CONFIG_QEMU is found to indicate an existing directory, this directory
will be used rather than cloning the git repo into the build tree.
[ This changeset is the xen-unstable part of the patch but also
includes the QEMU_TAG update to pull in the qemu part. -iwj ]
Signed-off-by: Jan Beulich <jbeulich@novell.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Jan Beulich [Fri, 19 Nov 2010 18:39:33 +0000 (18:39 +0000)]
stubdom: allow building with read-only sources
Signed-off-by: Jan Beulich <jbeulich@novell.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Andre Przywara [Fri, 19 Nov 2010 18:15:14 +0000 (18:15 +0000)]
libxc: fix tracing (broken with hypercall buffers)
the attached patch makes Xen tracing work again, after the introduction
of the hypercall buffers broke it. Just a missing line.
Thanks to Uwe Dannowski for reporting this.
Signed-off-by: Andre Przywara <andre.przywara@amd.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Fri, 19 Nov 2010 13:45:08 +0000 (13:45 +0000)]
Introduce PHYSDEVOP_get_free_pirq
Introduce a new physdev_op called PHYSDEVOP_get_free_pirq to allow a
guest to get a free pirq number from Xen; the hypervisor would keep
that pirq free for the guest to use in a mapping.
Keir Fraser [Fri, 19 Nov 2010 13:43:24 +0000 (13:43 +0000)]
Interrupt remapping to PIRQs in HVM guests
This patch allows HVM guests to remap interrupts and MSIs into pirqs;
once the mapping is in place the guest will receive the interrupt (or
the MSI) as an event. The interrupt to be remapped can either be an
interrupt of an emulated device or an interrupt of a passthrough
device and we keep track of that.
Keir Fraser [Fri, 19 Nov 2010 13:24:00 +0000 (13:24 +0000)]
x86-64: one more adjustment for Fam10 MMCONF enabling
The BASE_VALID() macro needs adjustment to match the other changes
done to the original Linux code (which are all queued to be merged
into Linus' tree), plus per Hypertransport specification the range
0xff00000000-0xffffffffff also needs to be excluded.
Keir Fraser [Fri, 19 Nov 2010 13:21:09 +0000 (13:21 +0000)]
x86/mm: Allocate log-dirty bitmaps from shadow/HAP memory.
Move the p2m alloc and free functions back into the per-domain paging
assistance structure and allow them to be called from the log-dirty
code. This makes it less likely that log-dirty code will run out of
memory populating the log-dirty bitmap.
Keir Fraser [Thu, 18 Nov 2010 12:28:31 +0000 (12:28 +0000)]
x86 hvm: Refuse to perform __hvm_copy() work in atomic context.
Soon we will properly handle paged out memory in this function by
sleeping in hypervisor context. This will require that all callers can
sleep.
If this check is too strong, we can reduce it to only applying to
guests with paging enabled (which also currently implies only guests
using Intel EPT). However my brief testing seems to indicate it works
okay.
Keir Fraser [Thu, 18 Nov 2010 12:26:27 +0000 (12:26 +0000)]
rcu_lock(current->domain) does not need to disable preemption.
If the guest sleeps in hypervisor context, it should not be destroyed
until execution reaches a safe point (i.e., guest context). This is
not implemented yet. :-) But the next patch will rely on it, to allow
an HVM guest to execute hypercalls that indirectly invoke __hvm_copy()
within an rcu_lock_current_domain() region.
Keir Fraser [Wed, 17 Nov 2010 17:28:17 +0000 (17:28 +0000)]
x86/hvm/pmtimer: improving scalability of virtual time update
Mitigate the heavy contention on handle_pmt_io when running a HVM
configured with many cores (e.g., 32 cores). As the virtual time of a
domain must be fresh, there should be someone updating it,
periodically. But it is not necessary to let a VCPU update the virtual
time when another one has been updating it. Thus the update can be
skipped when the VCPU finds someone else is updating the virtual time.
So every time a VCPU invoke handle_pmt_io to update the current
domain's virtual time, it will first try to acquire the pmtimer lock.
If it succeeds, it will update the virtual time. Otherwise, it can
skip the update, waits for the pmtimer lock holder to finish updating
the virtual time and returns the updated time.
Signed-off-by: Xiang Song <xiangsong@fudan.edu.cn> Signed-off-by: Keir Fraser <keir@xen.org>
Keir Fraser [Mon, 15 Nov 2010 09:31:38 +0000 (09:31 +0000)]
x2apic: Remove a panic condition in enabling x2APIC
Currently Xen triggers a panic if user disables VT-d by command line
while not disable x2APIC. This requires users to specify both
"iommu=0" and "x2apic=0" to disable VT-d if the platform supports
x2APIC. It's not user friendly. This patch removes the panic
condition. That's to say, don't require user to specify "x2apic=0"
when specify "iommu=0". As long as VT-d is not enabled (disabled in
BIOS or in command line), x2APIC won't be enabled naturally (x2APIC
depends on VT-d Interrupt remapping).
Signed-off-by: Weidong Han <weidong.han@intel.com>
tools/hotplug/Linux: supply --physdev-is-bridged in iptables runes
With newer (pvops) kernels logs get flooded with this iptables
warning: physdev match: using --physdev-out in the OUTPUT, FORWARD and
POSTROUTING chains for non-bridged traffic is not supported anymore
Using the --physdev-is-bridged option prevents this.
See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571634#10
Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Wed, 10 Nov 2010 13:58:16 +0000 (13:58 +0000)]
hvmloader: fix off-by-one-bit error when initialising PCI devices
hvmloader is responsible for - amoungst other things - initialising
the PCI device BARs prior to loading the guest BIOS. The previous
code only probed for devfn up to 128. The lower 3 bits are function
IDs so this meant that only devices in slots 0-15 were actually being
initialized.
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Acked-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Ian Campbell [Tue, 9 Nov 2010 18:15:25 +0000 (18:15 +0000)]
tools: provide explicit target for refetching/resetting qemu
This patch adds an explicit update mechanism:
make tools/ioemu-dir-force-update
This isn't brilliant but is better than doing "cd tools/ioemu-remote
&& git reset --hard <sha1...>" by hand.
Note that invoking this target will destroy all working tree changes
made to qemu-xen.
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Anthony Perard [Tue, 9 Nov 2010 18:03:55 +0000 (18:03 +0000)]
firmware, qemu: Change ACPI IO values to match QEMU BIOS
As part of the QEMU/Xen merge, this patch comes to change the value of
sleep states and add some information in the PCI registers to match the
implementation of the BIOS of QEMU.
It also does a hypercall (HVM_PARAM_ACPI_IOPORTS_LOCATION) that tell the
Xen to use the new Port I/O instead of the old one.
[ Also, in this patch, update QEMU_TAG to the qemu-xen revision
with the corresponding qemu change. -iwj ]
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools: libxl: fix cpuid compilation errors for ia64
ia64 does not have cpuid. So break out cpuid-related functions into a
separate file, with stubs for ia64.
Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Tue, 9 Nov 2010 11:50:14 +0000 (11:50 +0000)]
x86: allow passing initrd to kernel without exposing it through the initial mapping
The (Dom0 only for now) kernel can indicate that it doesn't need its
initrd mapped through a newly added ELF note - it gets passed the PFN
of the initrd in this case instead of the virtual address.
Even for kernels not making use of the new feature, the initrd will
no longer get copied into the initial mapping, but the memory it lives
in will get assigned to and mapped for the guest instead.
Keir Fraser [Tue, 9 Nov 2010 11:49:49 +0000 (11:49 +0000)]
x86: do away with the boot time low-memory 1:1 mapping
By doing so, we're no longer restricted to be able to place all boot
loader modules into the low 1Gb/4Gb (32-/64-bit) of memory, nor is
there a dependency anymore on where the boot loader places the
modules.
We're also no longer restricted to copy the modules into a place below
4Gb, nor to put them all together into a single piece of memory.
Further it allows even the 32-bit Dom0 kernel to be loaded anywhere in
physical memory (except if it doesn't support PAE-above-4G).
Anthony Perard [Mon, 8 Nov 2010 17:25:54 +0000 (17:25 +0000)]
libxc: Save the HVM_PARAM_ACPI_IOPORTS_LOCATION
This will save the acpi_ioport_location hvm_param in the checkpoint file
and set the parameter in Xen at restore.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Mon, 8 Nov 2010 17:05:14 +0000 (17:05 +0000)]
tools: xl: more const-correctness
The implementation of xl was lacking a lot of consts on its char*s.
In this patch we improve matters. It doesn't fix everything. In
particular:
* I only changed char*s and not other structs that ought to be const.
* libxl_send_debug_keys should take a const char* but the pointer
ends up getting sent to DECLARE_HYPERCALL_BOUNCE from xc_private.h
and that won't take a const char*. I wasn't sure what to do so
I have left it.
* There is a great deal of in-place string tokenisation (both
ad-hoc, and using strtok_r). I haven't changed any of that.
* I haven't changed any of the occurrences of char **argv because of
the castless assignment incompatibility between const char** and
char **.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen84: # virsh create ./win2k8r2.xml
error: Failed to create domain from ./win2k8r2.xml
error: POST operation failed: xend_post: error from xen daemon:
(xend.err "Error creating domain: 'key'")
The PCI device config maintained by xend includes a 'key' field, which is
initialized by xm client when using that tool and traditional xen config
file. libvirt, which uses xend's sexpr-over-http interface (is that the
proper name for that interface??), does not initialize this field - and
shouldn't be expected to do so IMO. Clients should not be bothered with
xend's internal representation of a PCI device.
This patch populates the 'key' field within xend if it is uninitialized,
similar to current initialization of 'uuid' field. The 'vdevfn' field
suffers a similar problem if not (optionally) specified by user.
AFAICT, the xm client initializes 'vdevfn' to 0x100 if not specified so
I've done the same here.
Signed-off-by: Jim Fehlig <jfehlig@novell.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Mon, 8 Nov 2010 15:44:02 +0000 (15:44 +0000)]
x86: xsave save/restore support for both PV and HVM guests (version 2)
I have tested the patch in the following senarios:
1> Non-xsave platform
2> Xsave-capable platform, guest does not support xsave, xen support xsave
3> Xsave-capable platform, guest does support xsave, xen supports xsave
4> Guest (non-xsave) saved on platform without xsave, restored on a
Xsave-capable system.
All passed.
Signed-off-by: Shan Haitao <haitao.shan@intel.com> Signed-off-by: Han Weidong <weidong.han@intel.com>
Keir Fraser [Mon, 8 Nov 2010 15:32:05 +0000 (15:32 +0000)]
x86-64: more fixes for Fam10 MMCONF enabling
Unfortunately it turned out the original Linux code had more issues:
We want to place the region above 4G in any case (even if TOM2 isn't
enabled or invalid), and the base mask definition was improperly typed
(thus causing shifts by FAM10H_MMIO_CONF_BASE_SHIFT to produce other
than the intended result). Fixing this in turn allowed simplifying the
MMIO region detection code, as regions ending below TOM2 now aren't of
interest anymore.
Keir Fraser [Thu, 4 Nov 2010 16:37:29 +0000 (16:37 +0000)]
libelf: move to init text/data when built for the hypervisor
Rather than annotating each and every function and data object (and
then still missing some compiler generated ones, plus getting into
ugliness due to the code also being built from tools/libxc/), use
objcopy to rename all relevant sections.
Keir Fraser [Thu, 4 Nov 2010 16:36:37 +0000 (16:36 +0000)]
x86: clean up AMD Fam10 xenoprof IBS code
Arrange for (almost) no code to be generated for x86-32, where the
functionality is disabled anyway. Properly __init-annotate the code.
Remove some pointless bits.
Keir Fraser [Thu, 4 Nov 2010 16:35:58 +0000 (16:35 +0000)]
x86-64: enable MMCONFIG on AMD Fam10 systems even if the BIOS didn't
Code for this has been in Linux since 2.6.26, and since Xen itself
wants to use the MMCONFIG access method when possible, clone it
(fixing some rather obvious bugs in that code at once).
This patch fixes compilation errors by 22275:e95dc0eb152d:
ia64/xc_ia64_linux_save.c:797: error: too few arguments to function 'callbacks->switch_qemu_logdirty'
and applies 22285:36a317494429 to ia64.
Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Juergen Gross [Wed, 3 Nov 2010 12:10:46 +0000 (12:10 +0000)]
tools: change cpumaps to uint8_t
Cpumap types in tools (libxc and libxl) are changed to be based on bytes like
in the interface to the hypervisor.
To make handling easier the size of used cpumaps is always based on the
number of physical cpus supported by the hypervisor. This eliminates the need
to keep track of the cpumap size in external interfaces.
In libxl a macro for cycling through a cpumap is added (libxl_for_each_cpu).
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Wed, 3 Nov 2010 08:18:51 +0000 (08:18 +0000)]
VT-d: fix device assignment failure (regression from Xen c/s 19805:2f1fa2215e60)
If the device at <secbus>:00.0 is the device the mapping operation was
initiated for, trying to map it a second time will fail, and hence
this second mapping attempt must be prevented (as was done prior to
said c/s).
While at it, simplify the code a little, too.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Acked-by: Weidong Han <weidong.han@intel.com>
Keir Fraser [Tue, 2 Nov 2010 07:35:52 +0000 (07:35 +0000)]
Fix ia64 tools build
22066:eccfdeb41b80 replaced tools/libxc/ia64/aclinux.h with
xen/include/acpi/platform/aclinux.h.
Because both are incompatible, tools cannot be built on ia64.
This patch fixes compilation errors by defining identifiers at
ac_ia64_tools.h.
Primarily fix up register names in public header file for
compatibility with old unmodified versions of virtual firmware and
qemu-dm. Also fixes a bug in the read case of handle_evt_io().
Keir Fraser [Fri, 29 Oct 2010 09:40:14 +0000 (10:40 +0100)]
X86: Prefer TSC-deadline timer in Xen
The new TSC Deadline Timer offers system software a low overhead
per-logical-thread deadline timer in TSC units.
The timer is implemented via a new architectural 64-bit register,
IA32_TSC_DEADLINE_MSR. Reads and writes of this MSR occur in program
order, but are non-serializing.
The support for this feature is indicated by
CPUID.01H:ECX.TSC_Deadline[bit 24] =3D 1 as documented in the Intel
Architecture Software Developer's Manual.
The LOCAL APIC on new processors has a mode where its underlying
hardware timer can now be accessed via the non-serializing
IA32_TSC_DEADLINE_MSR in TSC tick units.
If this mode is present, prefer it over the traditional LAPIC timer
mode. KERN_DEBUG dmesg will print "TSC deadline timer enabled" when
TDT is used.
Bootparam "tdt=off" is available to revert to LAPIC timer mode.
This patch is based on original work by Len Brown for Linux kernel.
cc: Len Brown <len.brown@intel.com> Signed-off-by: Wei Gang <gang.wei@intel.com> Signed-off-by: Keir Fraser <keir@xen.org>
Keir Fraser [Fri, 29 Oct 2010 09:29:14 +0000 (10:29 +0100)]
vtd: consolidate VT-d quirks into a single file quirks.c
Consolidate VT-d quirks into a single file - quirks.c. This includes
quirks to workaround OEM BIOS issue with VT-d enabling in IGD, Cantiga
VT-d buffer flush issue, Cantiga IGD Vt-d low power related errata,
and a quirk to workaround issues related to wifi direct assignment.
Signed-off-by: Allen Kay <allen.m.kay@intel.com> Reviewed-by: Jan Beulich <JBeulich@novell.com>