xen.git
17 years agox86: Fix 32-bit build.
Keir Fraser [Fri, 27 Jun 2008 16:54:27 +0000 (17:54 +0100)]
x86: Fix 32-bit build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Emulation of LMSW must only affect CR0 bits 0-3.
Keir Fraser [Fri, 27 Jun 2008 16:24:54 +0000 (17:24 +0100)]
x86: Emulation of LMSW must only affect CR0 bits 0-3.
Emulation of SMSW is only restricted to 16-bit operation on memory
operands.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agohvm: Fix lmsw handling
Keir Fraser [Fri, 27 Jun 2008 15:20:59 +0000 (16:20 +0100)]
hvm: Fix lmsw handling

The lmsw instruction can be used to set CR0_PE, but can never clear
it, once set.

Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
17 years agox86: Add cpufreq logic to S3 suspend/resume
Keir Fraser [Fri, 27 Jun 2008 15:16:47 +0000 (16:16 +0100)]
x86: Add cpufreq logic to S3 suspend/resume

When suspend to S3, stop the cpufreq dbs governor. When resume from
S3, firstly sync cpu state and freq at the 1st dbs timer; from 2nd dbs
timer on, cpufreq dbs governor control cpu px transfer according to
its workload algorithm. Px statistic is also handled.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
17 years agoUpdate changelog for xvd blkdev naming extensions.
Keir Fraser [Fri, 27 Jun 2008 15:12:14 +0000 (16:12 +0100)]
Update changelog for xvd blkdev naming extensions.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
17 years agotools/python: blkdev_name_to_number fixes
Keir Fraser [Fri, 27 Jun 2008 15:09:58 +0000 (16:09 +0100)]
tools/python: blkdev_name_to_number fixes

Rework blkdev_name_to_number to allow the tools to attach xvd disks
beyond xvdp.

 1.  Adds the handling for the /dev/xvd[q-z] and /dev/xvd[a-i][a-z]
     extended devices

 2.  Changes blkdev_name_to_number() to return a tuple of (xenbus,
     devnum), and then deals with the resulting fallout.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
17 years agoblktap: Extend userland busid to 32 bits
Keir Fraser [Fri, 27 Jun 2008 15:08:56 +0000 (16:08 +0100)]
blktap: Extend userland busid to 32 bits

Signed-off-by: Chris Lalancette <clalance@redhat.com>
17 years agohvm rombios: Move function calls out of 'post' function section
Keir Fraser [Fri, 27 Jun 2008 13:43:29 +0000 (14:43 +0100)]
hvm rombios: Move function calls out of 'post' function section

Through recent additions to the rombios the code section of the post
function has filled up considerably. When I enable the BX_TCGBIOS
compile time option the BIOS crashes since the post section code
(starts at $e05b) spills over into the nmi entry point (starts at
$e2c3). as86 doesn't cause an error when building.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
17 years agovt-d: Clean up variable types and remove useless variables
Keir Fraser [Fri, 27 Jun 2008 13:40:47 +0000 (14:40 +0100)]
vt-d: Clean up variable types and remove useless variables

Signed-off-by: Weidong Han <weidong.han@intel.com>
17 years agoshadow: Re-initialise page_info's lock field when freeing shadow pages.
Keir Fraser [Fri, 27 Jun 2008 13:38:41 +0000 (14:38 +0100)]
shadow: Re-initialise page_info's lock field when freeing shadow pages.

Fixes boot failure of xenU after destroying a HVM guest.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoioemu: Clean up after cset 17646:e3b13e1ecf6c
Keir Fraser [Fri, 27 Jun 2008 13:16:53 +0000 (14:16 +0100)]
ioemu: Clean up after cset 17646:e3b13e1ecf6c

Remove redundant code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
17 years agohvmloader: Set up any Intel ICH for legacy IDE.
Keir Fraser [Fri, 27 Jun 2008 13:15:11 +0000 (14:15 +0100)]
hvmloader: Set up any Intel ICH for legacy IDE.
Signed-off-by: Li Zhang <li.zhang@intel.com>
17 years agovt-d: Minor fixing of interrupt remapping
Keir Fraser [Fri, 27 Jun 2008 13:11:41 +0000 (14:11 +0100)]
vt-d: Minor fixing of interrupt remapping
When ir_ctrl->iremap_index == -1, it means there is no remap
entry. So it needn't to convert from remap format to normal ioapic
format.

Signed-off-by: Weidong Han <weidong.han@intel.com>
17 years agotapdisk: Fix qcow2 for images > 2 GB
Keir Fraser [Fri, 27 Jun 2008 13:03:52 +0000 (14:03 +0100)]
tapdisk: Fix qcow2 for images > 2 GB

Signed-off-by: Kevin Wolf <kwolf@suse.de>
17 years agox86, shadow: Fix OOS bug on domain teardown.
Keir Fraser [Fri, 27 Jun 2008 12:45:55 +0000 (13:45 +0100)]
x86, shadow: Fix OOS bug on domain teardown.
Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
17 years agoPV-GRUB: fix reiserfs 64bit support
Keir Fraser [Fri, 20 Jun 2008 17:42:45 +0000 (18:42 +0100)]
PV-GRUB: fix reiserfs 64bit support

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agoOut-of-sync L1 shadows: always unsync pages on guest writes.
Keir Fraser [Fri, 20 Jun 2008 17:41:50 +0000 (18:41 +0100)]
Out-of-sync L1 shadows: always unsync pages on guest writes.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
17 years agoOut-of-sync L1 shadows: OOS snapshot.
Keir Fraser [Fri, 20 Jun 2008 17:41:09 +0000 (18:41 +0100)]
Out-of-sync L1 shadows: OOS snapshot.

Make snapshots of guest pages on unsync to allow faster revalidation
of OOS pages.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
17 years agoOut-of-sync L1 shadows: Fixup Tables
Keir Fraser [Fri, 20 Jun 2008 17:40:32 +0000 (18:40 +0100)]
Out-of-sync L1 shadows: Fixup Tables

This patch implement a very simple non complete reverse map for OOS
pages writable mappings to avoid shadow brute-force search on resyncs.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
17 years agoOut-of-sync L1 shadows: OOS base
Keir Fraser [Fri, 20 Jun 2008 17:39:45 +0000 (18:39 +0100)]
Out-of-sync L1 shadows: OOS base

This patch implements the basic mechanisms to get pagetables out of
sync and back in sync again.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
Signed-off-by: Tim Deegan <tim.deegan@eu.citrix.com>
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
17 years agoPV-GRUB: compilation fix caused by 17880
Keir Fraser [Fri, 20 Jun 2008 17:37:29 +0000 (18:37 +0100)]
PV-GRUB: compilation fix caused by 17880

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agoAMD PowerNow! in Xen
Keir Fraser [Fri, 20 Jun 2008 17:02:46 +0000 (18:02 +0100)]
AMD PowerNow! in Xen

This patch set moves support for AMD's PowerNow! technology from
dom0 into the hypervisor, now that there is support for
transferring ACPI data to the hypervisor.  It will only work for
AMD processors that support the architectural P-state driver,
such as 3rd generation Opterons, Phenoms, and Turion Ultras.

This patch creates the Architectural P-state driver inside
of the Xen hypervisor and hooks it into the Xen code.  It
has been tested at AMD with a variety of para- and fully-
virtualized guests for a week without regressions.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Acked-by: Conny Seidel <conny.seidel@amd.com>
17 years agominios: fix add_id_to_freelist(0)
Keir Fraser [Fri, 20 Jun 2008 16:45:23 +0000 (17:45 +0100)]
minios: fix add_id_to_freelist(0)

add_id_to_freelist(0) would make get_id_from_freelist() always return 0.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agominios: do not systematically free the page under shared info, as the
Keir Fraser [Fri, 20 Jun 2008 16:44:50 +0000 (17:44 +0100)]
minios: do not systematically free the page under shared info, as the
guest booted by PV-GRUB will need it.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agoClean up domain_create() interface.
Keir Fraser [Fri, 20 Jun 2008 14:21:26 +0000 (15:21 +0100)]
Clean up domain_create() interface.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86 acpi: Clean up output tracing. Ensure it is synced to serial line
Keir Fraser [Fri, 20 Jun 2008 14:21:04 +0000 (15:21 +0100)]
x86 acpi: Clean up output tracing. Ensure it is synced to serial line
before entering Sx state.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years ago[IA64] compilation fix caused by 17880:d3a87899985d
Keir Fraser [Fri, 20 Jun 2008 11:26:23 +0000 (12:26 +0100)]
[IA64] compilation fix caused by 17880:d3a87899985d

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agoCompilation fix for x86_64 caused by 17880:d3a87899985d.
Keir Fraser [Fri, 20 Jun 2008 11:18:10 +0000 (12:18 +0100)]
Compilation fix for x86_64 caused by 17880:d3a87899985d.
Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
17 years agolibxc: The following patch replace the libxc interface to use
Keir Fraser [Thu, 19 Jun 2008 15:15:05 +0000 (16:15 +0100)]
libxc: The following patch replace the libxc interface to use
vcpu_guest_context_any_t (which is both 32 and 64 bits) instead of
vcpu_guest_context_t.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
17 years agovmx: Clean up and fix guest MSR load/save handling:
Keir Fraser [Thu, 19 Jun 2008 10:09:10 +0000 (11:09 +0100)]
vmx: Clean up and fix guest MSR load/save handling:
 1. msr_bitmap/msr_area/msr_host_area must be freed when a vcpu is
    destroyed
 2. vmx_create_vmcs()/vmx_destroy_vmcs() are only ever called once,
    and can hence be simplified slightly
 3. Change vmx_*_msr() interfaces to make it crystal clear that they
    operate only on current (hence safe against vmwrite() and also
    against concurrency races).
 4. Change vmx_add_*_msr() implementation to make it crystal clear
    that msr_area is not dereferenced before it is allocated.

Only (1) is a bug fix. (2)-(4) are for code clarity.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Must use a softirq to defer dom0 NMI
Keir Fraser [Wed, 18 Jun 2008 13:17:10 +0000 (14:17 +0100)]
x86: Must use a softirq to defer dom0 NMI
notification. tasklet_schedule() contains a spinlock and is unsafe in
NMI context.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoioemu: Fix usbdevice parameter to encode vbd type.
Keir Fraser [Wed, 18 Jun 2008 10:55:34 +0000 (11:55 +0100)]
ioemu: Fix usbdevice parameter to encode vbd type.

   usbdevice = "disk:<filename>"
expect a raw device (as this probably is the most usual case) and
   usbdevice = "disk-qcow:<filename>"
expect a COW image (autodetected, probably qcow2).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agox86: Intel wants the TSS busy flag set when we do a vmentry.
Keir Fraser [Wed, 18 Jun 2008 08:46:36 +0000 (09:46 +0100)]
x86: Intel wants the TSS busy flag set when we do a vmentry.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoioemu: generic PCI device config-space emulation
Keir Fraser [Wed, 18 Jun 2008 08:40:39 +0000 (09:40 +0100)]
ioemu: generic PCI device config-space emulation

This patch is an extension for qemu-dm to enable emulation of generic
PCI devices. The information for the PCI devices can be passed by
command line parameter.

The command line parameter is "-pciemulation" followed by the
information which contains a label and hex value of the configuration
registers separated by ":".

The configuration registers for each PCI device are below.
vendorid
deviceid
command
status
revision
classcode
headertype
subvendorid
subsystemid
interruputline
interruptpin

This is an example of command line parameter.

 -pciemulation hba1:1240:0780:0002:0:0:010000:0:10b5:0777:05:1

Signed-off-by: Shinji Matsumoto <smatsumoto@marathontechnologies.com>
17 years agoioemu: Disable format auto-probing in monitor command change
Keir Fraser [Wed, 18 Jun 2008 08:39:14 +0000 (09:39 +0100)]
ioemu: Disable format auto-probing in monitor command change

Format auto-probing of writable images is a security hole.  The last
known remaining instance is monitor command change.  Disable probing
there and use raw.  This breaks change for images in all other
formats.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
17 years agominios: fix gnttab allocation boundary
Keir Fraser [Wed, 18 Jun 2008 08:38:11 +0000 (09:38 +0100)]
minios: fix gnttab allocation boundary

The gnttab_sem is already fed during initialization's put_free_entry
loop.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agodoc: Describes a generic 686 via the cpuid configure.
Keir Fraser [Wed, 18 Jun 2008 08:37:40 +0000 (09:37 +0100)]
doc: Describes a generic 686 via the cpuid configure.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
17 years agoAdd PV-GRUB
Keir Fraser [Wed, 18 Jun 2008 08:36:47 +0000 (09:36 +0100)]
Add PV-GRUB

This fetches GRUB1 sources, applies the {graphical, print function,
save default, and ext3_256byte} patches from debian, and applies a
patch to make it work on x86_64 and port it to Mini-OS.  By using
libxc, PV-GRUB can then "kexec" the loaded kernel from inside the
domain itself, hence permitting to avoid the security-concerned
pygrub.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agominios: fix declaration after code
Keir Fraser [Wed, 18 Jun 2008 08:35:06 +0000 (09:35 +0100)]
minios: fix declaration after code

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agomm.c: use local variable domain pointer
Keir Fraser [Wed, 18 Jun 2008 08:34:26 +0000 (09:34 +0100)]
mm.c: use local variable domain pointer
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years agostubdom: fix using minios frontends directly when libc is actived
Keir Fraser [Wed, 18 Jun 2008 08:32:50 +0000 (09:32 +0100)]
stubdom: fix using minios frontends directly when libc is actived

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agominios,stubdom: Add OBJ_DIR parameter to compile outside sources,
Keir Fraser [Tue, 17 Jun 2008 08:36:25 +0000 (09:36 +0100)]
minios,stubdom: Add OBJ_DIR parameter to compile outside sources,
which permits to easily compile mini-os in various flavors. Also clean
some parts of stubdom build.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agoioemu: move xenfb frontend (used by stubdom) to its own file, since it
Keir Fraser [Tue, 17 Jun 2008 08:35:36 +0000 (09:35 +0100)]
ioemu: move xenfb frontend (used by stubdom) to its own file, since it
does not really belong to hw/, but to /, like sdl.c and vnc.c.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years ago[IA64] trivial compilation fix caused by c/s 17847:8a0415fac759.
Keir Fraser [Mon, 16 Jun 2008 15:35:17 +0000 (16:35 +0100)]
[IA64] trivial compilation fix caused by c/s 17847:8a0415fac759.

This patch fixes the following compilation error caused
by c/s 17847:8a0415fac759.

machine_kexec.c: In function 'arch_crash_save_vmcoreinfo':
machine_kexec.c:201: error: 'frametable_pg_dir' undeclared (first use in this function)
machine_kexec.c:201: error: (Each undeclared identifier is reported only once
machine_kexec.c:201: error: for each function it appears in.)

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agovmx: Allow restore of context from a non-Intel processor. In
Keir Fraser [Mon, 16 Jun 2008 14:22:41 +0000 (15:22 +0100)]
vmx: Allow restore of context from a non-Intel processor. In
particular, VMX requires segment 'granularity' to be set correctly, so
we force it if need be in vmx_set_segment_register().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoamd svm: Do not touch (non-existent) attr and selector fields for GDTR
Keir Fraser [Mon, 16 Jun 2008 14:21:49 +0000 (15:21 +0100)]
amd svm: Do not touch (non-existent) attr and selector fields for GDTR
and IDTR in the VMCB in svm_set_segment_register(). This is just for
clarity of code and to prevent any issues in the future.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovt-d: Quieten down overzealous logging.
Keir Fraser [Mon, 16 Jun 2008 10:49:15 +0000 (11:49 +0100)]
vt-d: Quieten down overzealous logging.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86_emulate: Fix the segment-load function
Keir Fraser [Mon, 16 Jun 2008 10:24:17 +0000 (11:24 +0100)]
x86_emulate: Fix the segment-load function

Fix the non-conforming type check and uses the consistent method to
fetch the cpl value as function get_cpl().

Also make sure vm86 mode is properly handled when determining whether
in real mode or protected mode -- in various respects vm86 mode can
act like both.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years ago32-on-64: Fix compat-access macros to use correct underlying HVM accessors.
Keir Fraser [Fri, 13 Jun 2008 15:10:50 +0000 (16:10 +0100)]
32-on-64: Fix compat-access macros to use correct underlying HVM accessors.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agopv-on-hvm: Fix panic-handler code to work on wider range of kernels.
Keir Fraser [Fri, 13 Jun 2008 14:31:35 +0000 (15:31 +0100)]
pv-on-hvm: Fix panic-handler code to work on wider range of kernels.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoBring back console_start_log_everything() as a milder alternative to
Keir Fraser [Fri, 13 Jun 2008 13:15:00 +0000 (14:15 +0100)]
Bring back console_start_log_everything() as a milder alternative to
console_start_sync(). Revert keyhandler logic to use it. The
difference now is that serial logic is updated to not drop characters
if inb a log_everything region. Still this is milder than a sync
region since the async buffer must be filled before we start to
busy-wait on each character.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years ago[ACM] Pass uuid to created policy
Keir Fraser [Fri, 13 Jun 2008 12:55:50 +0000 (13:55 +0100)]
[ACM] Pass uuid to created policy

A UUID needs to be passed to the created policy.

Signed-off-by: stefan Berger <stefanb@us.ibm.com>
17 years ago[ACM] Enable labeling of resources as inaccessible
Keir Fraser [Fri, 13 Jun 2008 12:55:19 +0000 (13:55 +0100)]
[ACM] Enable labeling of resources as inaccessible

Enable the labeling of (disk-type) resources with the special label
__INACCESSIBLE__ to prevent unlabeled domains from accessing them.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
17 years agohvm, 32-on-64: Allow a 32-bit x86 hvm guest access to any memory_op().
Keir Fraser [Fri, 13 Jun 2008 12:50:23 +0000 (13:50 +0100)]
hvm, 32-on-64: Allow a 32-bit x86 hvm guest access to any memory_op().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoIntroduce guest_handle_subrange_okay() for checking sub-sections of an
Keir Fraser [Fri, 13 Jun 2008 12:49:56 +0000 (13:49 +0100)]
Introduce guest_handle_subrange_okay() for checking sub-sections of an
argument array. Needed where a compat shim is splitting up a 32-bit
guest's larger argument array, and only the currently-active part of
the translated array is contained within the compat_arg_xlat_area.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years ago32-on-64: Fix is_compat_arg_xlat_range().
Keir Fraser [Fri, 13 Jun 2008 12:48:13 +0000 (13:48 +0100)]
32-on-64: Fix is_compat_arg_xlat_range().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years ago32-on-64: Fix error handling for XENMEM_decrease_reservation.
Keir Fraser [Fri, 13 Jun 2008 12:47:28 +0000 (13:47 +0100)]
32-on-64: Fix error handling for XENMEM_decrease_reservation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoImprove serial output when dropping characters to drop them in big
Keir Fraser [Fri, 13 Jun 2008 10:39:42 +0000 (11:39 +0100)]
Improve serial output when dropping characters to drop them in big
batches. Printing one character in one thousand is not useful!

Also make debug handlers all print synchronously.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agokexec: Fix the 32-bit build.
Keir Fraser [Fri, 13 Jun 2008 10:21:58 +0000 (11:21 +0100)]
kexec: Fix the 32-bit build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agohvm: Fix the realmode live migration issue with Intel EPT
Keir Fraser [Fri, 13 Jun 2008 09:13:25 +0000 (10:13 +0100)]
hvm: Fix the realmode live migration issue with Intel EPT

The patch save/restore the HVM_PARAM_IDENT_PT parameter, then the live
migration during real mode with EPT may work fine.

Signed-off-by: Xiaohui Xin <Xiaohui.xin@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agohvm: Fix max_mapped_pfn when using 2MB super pages.
Keir Fraser [Fri, 13 Jun 2008 08:56:49 +0000 (09:56 +0100)]
hvm: Fix max_mapped_pfn when using 2MB super pages.

Fixes booting Linux guest allocated more than 4G memory.
  - The p2m table will track the max_mapped_pfn, and while doing
    p2m_gfn_to_mfn(), if the gfn is higher than max_mapped_pfn, the
    function will return _mfn(INVALID_MFN). This makes the Linux guest
    kernel panic.

Signed-off-by: Xu Dongxiao <dongxiao.xu@intel.com>
17 years agoextract vmcoreinfo from /proc/vmcore for Xen
Keir Fraser [Fri, 13 Jun 2008 08:54:03 +0000 (09:54 +0100)]
extract vmcoreinfo from /proc/vmcore for Xen

- the machine address and the size of the vmcoreinfo area is returned
  via the kexec_op(get_range) hypercall
- fill the vmcoreinfo data when the kexec_op(crash load) hypercall
  is called

Signed-off-by: Itsuro Oda <oda@valinux.co.jp>
17 years agox86: remove use of per-domain lock from page table entry handling
Keir Fraser [Thu, 12 Jun 2008 17:14:00 +0000 (18:14 +0100)]
x86: remove use of per-domain lock from page table entry handling

This change results in a 5% performance improvement for kernel builds
on dual-socket quad-core systems (which is what I used for reference
for both 32- and 64-bit). Along with that, the amount of time reported
as spent in the kernel gets reduced by almost 25% (the fraction of
time spent in the kernel is generally reported significantly higher
under Xen than with a native kernel).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Reduce page->shadow_flags to 32 bits so we can steal space for a
Keir Fraser [Thu, 12 Jun 2008 16:57:03 +0000 (17:57 +0100)]
x86: Reduce page->shadow_flags to 32 bits so we can steal space for a
spinlock_t (on 64-bit Xen) without expanding the page_info struct.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Do not use HPET in Cx state management since dom0 may need RTC
Keir Fraser [Thu, 12 Jun 2008 16:17:44 +0000 (17:17 +0100)]
x86: Do not use HPET in Cx state management since dom0 may need RTC
IRQ routing. This makes C3 unusable for now.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxend: detect and report qemu-dm failure
Keir Fraser [Thu, 12 Jun 2008 16:01:31 +0000 (17:01 +0100)]
xend: detect and report qemu-dm failure

Currently, when qemu-dm fails, typically its exit status is lost and
xend doesn't notice.  In the patch below I use a fifo (named pipe) to
detect qemu-dm's termination and report the exit status to the
logfile, if possible.  (If xend has been restarted since the domain
was created, this isn't possible but we can still know that it failed
and report that fact.)

It would be better to have a failure of qemu crash the domain, by
calling the SCHEDOP_shutdown hypercall with SHUTDOWN_crash.  However
if you have on_crash=restart and the configuration is broken in some
way that causes qemu-dm to bomb out straight away this causes xend to
spin endlessly restarting the doomed domain.  This is a general
problem with on_*=restart and ought to be fixed separately.  When it
is fixed, we can safely arrange for domains whose dm has crashed to be
themselves forcibly crashed.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agodom0 state dump
Keir Fraser [Thu, 12 Jun 2008 15:55:09 +0000 (16:55 +0100)]
dom0 state dump

Since xenctx cannot (for obvious reasons) display the context of
dom0's vCPU-s, here are the beginnings of a console based mechanism to
achieve the same (useful if dom0 hangs with one or more de-scheduled
vCPU-s). The stack handling obviously needs improvement, but the
register context should come out fine in all cases.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agokeyhandler: When dumping all-CPU register state, wnter console sync
Keir Fraser [Thu, 12 Jun 2008 15:34:25 +0000 (16:34 +0100)]
keyhandler: When dumping all-CPU register state, wnter console sync
mode so we do not drop any critical debug data.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: don't print dom0 initrd information twice
Keir Fraser [Thu, 12 Jun 2008 15:18:31 +0000 (16:18 +0100)]
x86: don't print dom0 initrd information twice
Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: minor adjustment to asm constraint in get_page()
Keir Fraser [Thu, 12 Jun 2008 15:17:19 +0000 (16:17 +0100)]
x86: minor adjustment to asm constraint in get_page()

While not wrong, avoiding the unnecessary output allows the compiler a
little more freedom.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: add perf counter for pointless updates of writable pages through a hypercall
Keir Fraser [Thu, 12 Jun 2008 15:11:39 +0000 (16:11 +0100)]
x86: add perf counter for pointless updates of writable pages through a hypercall
Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: machine_halt() forcibly re-enables IRQs as it may be called from
Keir Fraser [Thu, 12 Jun 2008 15:09:08 +0000 (16:09 +0100)]
x86: machine_halt() forcibly re-enables IRQs as it may be called from
panic() which itself may be called in an IRQ-safe critical section.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86/32on64: fix physical address restriction
Keir Fraser [Thu, 12 Jun 2008 15:05:35 +0000 (16:05 +0100)]
x86/32on64: fix physical address restriction

The allocation bit size setting wasn't working anymore after the
recent fix to properly use PAGE_SHIFT instead of PAGE_SIZE. This was
because the bit size implies a power-of-two range that's accessible,
but if all memory is accessible anyway (and its upper boundary is not
a power of two), the domain would either be needlessly restricted or
wouldn't be able to allocate as much memory as was intended for it
(specifically the case for Dom0 without dom0_mem= boot
parameter). Consequently, don't restrict the bit width if all memory
can be accessed.

To avoid needing to adjust this code in two places in the future (it
may need further touching when memory hotplug gets supported), fold
the logic into a function.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: simplify domain memory cleanup
Keir Fraser [Thu, 12 Jun 2008 14:47:45 +0000 (15:47 +0100)]
x86: simplify domain memory cleanup

Page table pages cannot come from the Xen heap, so there's no need to
special-case these during cleanup.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years ago[IA64] re-add efi support to acpi_os_get_root_pointer()
Keir Fraser [Thu, 12 Jun 2008 14:44:21 +0000 (15:44 +0100)]
[IA64] re-add efi support to acpi_os_get_root_pointer()

On ia64 RSDP address is obtained from efi table instead of
memory scan. Otherwise it may use wrong table to fail to find
tables.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years ago[IA64] compilation fix caused by 17814:9af7a535225f
Keir Fraser [Thu, 12 Jun 2008 14:42:09 +0000 (15:42 +0100)]
[IA64] compilation fix caused by 17814:9af7a535225f

ia64 compliation fix caused by 17814:9af7a535225f.
- generate_acpi_checksum() is replaced by acpi_tb_checksum()
- move dump_execution_state() definitions from asm-ia64/xenprocessor.h
  to asm-ia64/bug.h

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agotools: replace sprintf with snprintf where applicable
Keir Fraser [Thu, 12 Jun 2008 14:41:15 +0000 (15:41 +0100)]
tools: replace sprintf with snprintf where applicable

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years ago32-on-64: Clean up and unify compat_arg_xlat_area handling.
Keir Fraser [Thu, 12 Jun 2008 14:22:35 +0000 (15:22 +0100)]
32-on-64: Clean up and unify compat_arg_xlat_area handling.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agominios can cope with >4G CR3 since it never uses it
Keir Fraser [Thu, 12 Jun 2008 08:24:35 +0000 (09:24 +0100)]
minios can cope with >4G CR3 since it never uses it

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agoMSI: Handle MSI EOI for amd systems
Keir Fraser [Wed, 11 Jun 2008 15:38:02 +0000 (16:38 +0100)]
MSI: Handle MSI EOI for amd systems
Signed-off-by: Wei Wang <wei.wang2@amd.com>
17 years agoMSI: Fix msi delivery for hvm guest
Keir Fraser [Wed, 11 Jun 2008 14:19:42 +0000 (15:19 +0100)]
MSI: Fix msi delivery for hvm guest

Some parameters like "dest_mode",  "delivery_mode" and "trig_mode"
seem to have been miscalculated before delivering MSI interrupt into
hvm passthru guest. This will cause guest driver to roll back to
legacy interrupt mode.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
17 years agoAMD IOMMU: Enable MSI for hvm guest
Keir Fraser [Wed, 11 Jun 2008 14:18:26 +0000 (15:18 +0100)]
AMD IOMMU: Enable MSI for hvm guest
Signed-off-by: Wei Wang <wei.wang2@amd.com>
17 years agox86: cpuid configuration for PV guest
Keir Fraser [Wed, 11 Jun 2008 10:35:35 +0000 (11:35 +0100)]
x86: cpuid configuration for PV guest

Add pv guest support for the cpuid configuration and checking. That
feature only works for cpuid request which are coming from the guest's
kernel, a process could still call the cpuid directly.

A new policy for pv guest has been created in libxc. dom0 cpuid
emulation is left hardcoded in Xen.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoPush python-related make variable definitions into tools/misc.
Keir Fraser [Wed, 11 Jun 2008 08:44:42 +0000 (09:44 +0100)]
Push python-related make variable definitions into tools/misc.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoHave `make install' write the Python version number in the #!
Keir Fraser [Wed, 11 Jun 2008 08:36:23 +0000 (09:36 +0100)]
Have `make install' write the Python version number in the #!

The Xen tools contain a number of Python extensions written in C.  The
C API to Python, used by these extensions, is not stable from one
version of Python to the next.

Our build system uses whatever version of Python is the default on the
build system at that time to build these extensions.  However, the
actual scripts such as `xm' use  #!/usr/bin/env python  which uses
whichever version of Python is the default on the deployment system at
the time of invocation.

If for any reason these two versions of Python are not the same (eg,
because the system is built on one computer and executed on another,
or because the system's gains a more recent Python installation
alongside the original which changes the previous default), warnings
and failures occur.

In this patch I arrange for Python scripts to be installed via a
special wrapper around `install', which determines the build-time
Python version and path and then writes that into the #! line at the
point of `make install' (or `make dist').  (It can also be overridden
by setting PYTHON_PATH.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agominios: Fix >4GB machine addresses
Keir Fraser [Tue, 10 Jun 2008 15:59:24 +0000 (16:59 +0100)]
minios: Fix >4GB machine addresses

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
17 years agox86/64: Fix build.
Keir Fraser [Tue, 10 Jun 2008 14:30:50 +0000 (15:30 +0100)]
x86/64: Fix build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxend: minor ballooning cleanup
Keir Fraser [Tue, 10 Jun 2008 13:53:01 +0000 (14:53 +0100)]
xend: minor ballooning cleanup

In xend/balloon.py, there's only one place where dom0_start_alloc_mb
is used. Move its initialization to right before its usage.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years agox86: Default ACPI reboot method.
Keir Fraser [Tue, 10 Jun 2008 13:51:00 +0000 (14:51 +0100)]
x86: Default ACPI reboot method.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxenstore: Fix error path broken by c/s 17816
Keir Fraser [Tue, 10 Jun 2008 13:17:20 +0000 (14:17 +0100)]
xenstore: Fix error path broken by c/s 17816

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years agoxenstat: some cleanups
Keir Fraser [Tue, 10 Jun 2008 13:15:53 +0000 (14:15 +0100)]
xenstat: some cleanups
 sprintf -> snprintf
 malloc(n * m) -> calloc(n, m)
 get rid of a cast

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years agoxm on xenapi: Add PVFB support in xenapi_create.py.
Keir Fraser [Tue, 10 Jun 2008 12:50:31 +0000 (13:50 +0100)]
xm on xenapi: Add PVFB support in xenapi_create.py.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
17 years agoxenstore: cleanups
Keir Fraser [Tue, 10 Jun 2008 12:49:54 +0000 (13:49 +0100)]
xenstore: cleanups

Attached patch uses calloc() for hash allocation.
This makes sure, the allocated memory is always initialized.
Also cleanup error handling a bit.

On *BSD avoid conflicts with BSD list macros.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years agolibxc: Update for NetBSD
Keir Fraser [Tue, 10 Jun 2008 12:49:02 +0000 (13:49 +0100)]
libxc: Update for NetBSD

returns hypercall return value when ioctl was successful.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years agoPull in ACPI table parsing code from Linux 2.6.26-rc4.
Keir Fraser [Tue, 10 Jun 2008 12:45:29 +0000 (13:45 +0100)]
Pull in ACPI table parsing code from Linux 2.6.26-rc4.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agolibxenstat: Fix statistics for blktap disks on linux
Keir Fraser [Tue, 10 Jun 2008 08:27:01 +0000 (09:27 +0100)]
libxenstat: Fix statistics for blktap disks on linux

Overview: update xenstat vbd statistics parsing from
/sys/devices/xen-backend to process blktap disks

Reason:
        -blktap devices (now referenced as tap rather than vbd in
        /sys) have statistics counters
        (e.g.,  rd_req, wr_req, oo_req) prepended by tap_
        -xenstat behavior did not previously account for this
        behavior, which resulted in 0 disks
        visible and similarly impacted disk statistics

To reproduce these conditions, make a domain with tap:aio backed disks
on 3.2.x, run xentop, and press B to view VBD stats (nothing will
appear for the domain using tap:aio)

Signed-off-by: steve.maresca@gmail.com
17 years agoFix the build with perfc=y.
Keir Fraser [Tue, 10 Jun 2008 08:25:47 +0000 (09:25 +0100)]
Fix the build with perfc=y.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
17 years agox86: Fix the build after HVMTRACE changes.
Keir Fraser [Tue, 10 Jun 2008 08:24:47 +0000 (09:24 +0100)]
x86: Fix the build after HVMTRACE changes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agotools/python/xen/lowlevel: some cleanups
Keir Fraser [Tue, 10 Jun 2008 08:17:55 +0000 (09:17 +0100)]
tools/python/xen/lowlevel: some cleanups

Mainly:
 malloc(n * m) -> calloc(n, m)
 sprintf -> snprintf

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years agoAllow older PAE Linux guests to access entire compat m2p.
Keir Fraser [Mon, 9 Jun 2008 16:18:27 +0000 (17:18 +0100)]
Allow older PAE Linux guests to access entire compat m2p.

Older PAE guests (prior to xen-unstable.hg 8924:229c602a075a, Feb
2006, this includes some vendor's kernel in the field) use a limit of
0xf6800000 on their code and data segments (i.e. up to the end of the
read-only m2p table).

Newer kernels use a limit of 4G and rely on the hypervisor to clamp to
the actual maximum allowed. 32on64 mode takes advantage of this to
allow a larger m2p than would fit in the PAEonPAE sized hole.

This means that PAE guests with the hardcoded low limit cannot run on
top of a 64 bit hypervisor on a host machine which has more than 16G
of RAM. Fix this by extending any code or data segment which ends
above the start of the hypervisor hole for that guest.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>