Keir Fraser [Fri, 1 Feb 2008 11:16:37 +0000 (11:16 +0000)]
Direct Linux boot: Support booting non-relocatable Linux kernels.
This patch introduces a hack to make non-relocatable kernels
bootable too. Non-relocatable kernels absolutely want to run
at 0x100000 and are not at all happy about being at 0x200000.
Fortunately, thanks to crazy programs like LOADLIN, Linux has
a couple of hooks in its boot process which can be used to
play games. The 'code32_switch' hook is executed immediately
following the switch to protected mode.
So, this patch installs a hook at 0x200000+kernel_size. The hook
is hand crafted assembly which sets up all the segments as needed,
then essentially does memmove(0x100000,0x200000,kernel_size) and
finally does an unconditional jmp to 0x100000.
Amazingly this actually really does work. It has been successfully
tested with RHEL-2.1 and Fedora Core 6 install kernels on i386, and
Fedora Core 6 and 7 kernels on x86_64.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Keir Fraser [Fri, 1 Feb 2008 11:14:53 +0000 (11:14 +0000)]
Direct Linux boot: Support booting relocatable Linux kernels.
This patch introduces the basic infrastructure for direct kernel
boot in the ioemu copy of QEMU. The current #ifdef disabled
code is actually obsolete wrt to upstream QEMU code. So this
is removed entirely. In its place I have imported the latest
upstream QEMU code. The QEMU code assumes that the guest RAM
is directly mapped into the QEMU process, so there were some
changes neccessary. Instead of strcpy/memcpy'ing the args
and kernel header into guest RAM, cpu_physical_memory_rw is
used. Intead of fread() the initrd and kernel into guest RAM
a helper function is used fread2guest which reads into a small
buffer and then uses cpu_physical_memory_rw.
NB in reading the following, Documentation/i386/boot.txt is
a useful reference for what's going on.
Next, instead of loading the kernel at 0x100000, this code
loads it at 0x200000. This is far enough away that there's
no risk of it overlapping with the HVM firmware image. If the
Linux kernel boot protocol is 0x205 or later, and the flag
at offset 0x234 in the kernel header is 1, then the guest
kernel was built with CONFIG_RELOCATABLE=y.
In this scenario we merely need to tell the kernel what address
it has been relocated to by writing 0x200000 into the kernel
header at offset 0x214. When switching from real mode into
protected mode the kernel will immediately start executing at
0x200000 and be happy with life. This should work for 2.6.20 or
later on i386, and 2.6.22 or later on x86_64.
This has been verified with Fedora 7 and Fedora 8 bare metal kernels
on i386 and x86_64 from the $TREE/images/pxeboot of the install trees.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Keir Fraser [Thu, 31 Jan 2008 09:43:05 +0000 (09:43 +0000)]
Fix xm shutdown/reboot for HVM domain of IA64
xc.domain_destroy_hook() is called twice when we execute
xm shutdown/reboot command to an HVM domain without PV drivers.
The first calling is from shutdown() in XendDomainInfo.py.
The second calling is from destroyDomain() in XendDomainInfo.py.
The first calling is not necessary, so this patch removes it.
A discussion about this patch is as follows.
http://lists.xensource.com/archives/html/xen-ia64-devel/2008-01/msg00232.html
Keir Fraser [Thu, 31 Jan 2008 09:38:34 +0000 (09:38 +0000)]
build: Make PREFIX work by fixing LIBDIR
In the current tree, setting PREFIX does not work very well. This is
because of confusion about the meaning of LIBDIR. In some places it
is the pathname tail of directories containing libraries (lib, lib64
or lib/amd64). But in other places it is a destination pathname
(implicitly, including any PREFIX). This can result in PREFIX or /usr
being added the wrong number of times.
This patch splits LIBDIR into two variables, LIBLEAFDIR and
LIBDIR. LIBDIR is the directory into which Xen libraries and other
similar code is to be placed, and includes any PREFIX. LIBLEAFDIR is
just the library tail and can be appended to various different
prefixes; for example, to construct the X11 library directory for -L.
Neither variable contains the value of DESTDIR, which is of course
used only to redirect the results of `make install' when desired.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Thu, 31 Jan 2008 09:11:21 +0000 (09:11 +0000)]
ioemu: Stop PV guest from parsing xenstore and opening block devices.
PV guests are now using QEMU for a vncserver. During initialization
of QEMU xenstore_parse_config() is being called causing PV guests to
open block devices. This patch makes a new function,
xenstore_daemon_open(), so that the vnc password functions have an
open xenstore handle and moves xenstore_parse_config() into the FV
machine specific init function.
Ian Jackson [Wed, 30 Jan 2008 18:39:04 +0000 (18:39 +0000)]
Build etherboot ROM from source.
We now include the source for Etherboot (5.4.2, obtained from git)
rather than a pre-built ROM. This gives better traceability and GPL
licence compliance. See tools/firmware/etherboot/README for details.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Keir Fraser [Tue, 29 Jan 2008 15:18:27 +0000 (15:18 +0000)]
minios: Fix bug when blkfront reading into zero-mapped buffer
by just poking the page.
No need to use virtual_to_mfn() for the ring since that is a real page.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 29 Jan 2008 11:19:04 +0000 (11:19 +0000)]
x86: Fix XENPF_change_freq hypercall to not dereference a non-existent
stack variable. Also sanity check (slightly) the frequency argument to
cpu_frequency_change(). Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Tue, 29 Jan 2008 09:36:37 +0000 (09:36 +0000)]
x86: Fix 16889:60bb765b25b5 in a couple of respects:
1. Leave bottom-most 1MB permanently mapped.
2. ACPI-table mapping code shoudl be aware that mappings above 1MB of
non-RAM are not permanent. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Mon, 28 Jan 2008 11:28:55 +0000 (11:28 +0000)]
vmx realmode: Multiple I/O reads to qemu in an instruction is not
allowed. But we do allow, for example, a read followed by a write
(e.g., MOVS within video RAM). Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Mon, 28 Jan 2008 10:17:05 +0000 (10:17 +0000)]
x86-64: use 1GB pages in 1:1 mapping if available
At once adjust the 2/4Mb page handling slightly in a few places (to
match the newly added code):
- when re-creating a large page mapping after finding that all small
page mappings in the respective area are using identical flags and
suitable MFNs, the virtual address was already incremented pas the
area to be dealt with, which needs to be accounted for in the
invocation of flush_area() in that path
- don't or-in/and-out _PAGE_PSE on non-present pages
- when comparing flags, try minimse the number of l1f_to_lNf()/
lNf_to_l1f() instances used
- instead of skipping a single page when encountering a big page
mapping equalling to what a small page mapping would establish, skip
to the next larger page boundary
Keir Fraser [Sun, 27 Jan 2008 17:03:35 +0000 (17:03 +0000)]
libxc: Push parallel build of libraries down to a new phony target, as
'build' is already loaded with library dependencies on ia64. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sat, 26 Jan 2008 11:29:29 +0000 (11:29 +0000)]
x86: When Xen is notified that CPU frequency has changed, do not trust
the current TSC-extrapolated time when we re-sync. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Sat, 26 Jan 2008 11:25:48 +0000 (11:25 +0000)]
Inroduce new vcpu_lock_affinity() and vcpu_unlock_affinity() helper
functions for use by x86's continue_hypercall_on_cpu().
This has two advantages:
1. We can lock out ordinary vcpu_set_affinity() commands from dom0.
2. We avoid the (in this case bogus) check for dom0_vcpus_pin.
Keir Fraser [Fri, 25 Jan 2008 16:02:20 +0000 (16:02 +0000)]
x86: First 1MB of memory should be mapped with 4kB mappings to avoid
conflict with fixed-range MTRRs. While there, we now map the VGA hole
as uncacheable. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
When setting e.g. 'on_crash=rename-restart' option in domain config
and crashing guest OS running in the domain, the new domain is
restarted with same name as renamed domain.
jfehlig4: # xm li
Name ID Mem VCPUs State Time(s)
Domain-0 0 1233 4 r----- 937.9
Domain-e64b12a0-0493-44d7-afde-55c776513426 21 384 1 ---c- 14.3
Domain-e64b12a0-0493-44d7-afde-55c776513426 22 384 1 r----- 7.3
This patch copies the domain info prior to setting new name and uuid
in the crashed domain info and uses the copied domain info to
construct the restarted domain.
Keir Fraser [Fri, 25 Jan 2008 13:26:38 +0000 (13:26 +0000)]
x86: Fix host S3.
Time zone info just needs to be calculated in S3 suspend procedure.
However, time_suspend() is also called on AP. That wasteful
get_cmos_time() on AP may break __cpu_die() assumption since
get_cmos_time() can take up to one second. This fix just limits it to
running on the BSP.
Keir Fraser [Fri, 25 Jan 2008 13:22:52 +0000 (13:22 +0000)]
Fix losetup -r flag when we specify 'w!' for the disk mode.
From: Zhigang Wang <zhigang.x.wang@oracle.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Thu, 24 Jan 2008 14:40:35 +0000 (14:40 +0000)]
x86, hvm: MTRR can't cover all the memery ranges
MTRR can't cover all the memery ranges, due to guest E820 is changed
by CS:16728 with current method. Signed-off-by: Disheng Su <disheng.su@intel.com>
Keir Fraser [Thu, 24 Jan 2008 14:39:38 +0000 (14:39 +0000)]
vt-d: Do FLR of assigned devices with VT-d
Currently there is a pdev_flr() function to do FLR before device
assignment in qemu, but most of devices don't have FLR capability.
What's more, should do FLR before assignment and deassignment for
keeping correct device status. If the device doesn't have FLR
capablility, this patch implemented to enter D3hot and return to D0 to
do FLR. And exposed pdev_flr() in VT-d utils, then it can be invoked
by assignment and deassignment functions.
Signed-off-by: Weidong Han <weidong.han@intel.com> Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Keir Fraser [Thu, 24 Jan 2008 14:29:13 +0000 (14:29 +0000)]
vmx realmode: Restructure code for clarity and better treatment of
VM_ENTRY_INTR_INFO. Also add more sanity checking. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Keir Fraser [Wed, 23 Jan 2008 18:12:37 +0000 (18:12 +0000)]
ioemu: handle empty vnc passwd
Have xenstore_read_vncpasswd return -1 when it is unable to read the
passwd from XenStore (and store an empty password). However, don't
exit in such case since it may just mean that the use didn't set a
passwd. If he really did, xend would have given the passwd flag in the
-vnc option, and the empty passwd would make the vnc authentication
reject any password anyway.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> Acked-by: Daniel P. Berrange <berrange@redhat.com>