]> xenbits.xensource.com Git - xen.git/log
xen.git
15 years agominios: support secondary guest consoles.
Keir Fraser [Wed, 17 Jun 2009 06:22:18 +0000 (07:22 +0100)]
minios: support secondary guest consoles.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoIntroduce mechanism to check standard conformance of headers
Keir Fraser [Wed, 17 Jun 2009 06:21:03 +0000 (07:21 +0100)]
Introduce mechanism to check standard conformance of headers

While pretty simplistic, it appears to serve the purpose at the moment
(i.e. it spotted two places where a GNU extension was used withou
proper preprocessor conditionals). The "simplistic" here includes that
the checking gets only done for native builds, and ia64 gets excluded
due to its arch-specific header intentionally (for whatever reason)
checking that anonymous struct/unions can be used.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agotmem: fix 32-on-64 support
Keir Fraser [Wed, 17 Jun 2009 06:14:02 +0000 (07:14 +0100)]
tmem: fix 32-on-64 support

This implicitly required coverting the tmem_op structure from
anonymous to standard struct/union sub-fields, and extending the
get-fields.sh helper script to deal with typedef-ed guest handles used
as types of translated compound type fields.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: fix s3 resume on AMD CPUs
Keir Fraser [Tue, 16 Jun 2009 13:19:34 +0000 (14:19 +0100)]
x86: fix s3 resume on AMD CPUs

Avoid longjmp as it has different semantics than on Intel CPUs in long
mode. Also add a few comments and remove a pointless reload of DS.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
15 years agox86: Allow guests to allocate up to 2MB (superpage) memory extents.
Keir Fraser [Tue, 16 Jun 2009 13:04:15 +0000 (14:04 +0100)]
x86: Allow guests to allocate up to 2MB (superpage) memory extents.

Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
15 years agox86: improve output resulting from sending '0' over serial
Keir Fraser [Tue, 16 Jun 2009 12:57:18 +0000 (13:57 +0100)]
x86: improve output resulting from sending '0' over serial

While the original logic already implied that the kernel part of the
guest's address space is identical on all vCPU-s (i.e. for all guest
processes), it didn't fully leverage the potential here: As long as
the top page table currently active is owned by the subject domain
(currently only Dom0), the stack dump can be done without extra
effort.

For x86-64, additionally add page table traversal so that the stack
can be dumped in all cases (unless it's invalid or user space).

I left the 32-bit variant of do_page_walk() unimplemented for the
moment as I couldn't convince myself using map_domain_page() there is
a good idea, and didn't want to introduce new fixmap entries either.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86/hvm: don't pass through port 0x80 in a few special cases
Keir Fraser [Tue, 16 Jun 2009 12:52:13 +0000 (13:52 +0100)]
x86/hvm: don't pass through port 0x80 in a few special cases

In a recent commit (99f85a28a78e96d28907fe036e1671a218fee597), KVM
disabled the passthrough of this port due to known problems on certain
HP laptops (see
http://lkml.indiana.edu/hypermail/linux/kernel/0712.3/0872.html
and http://lkml.indiana.edu/hypermail/linux/kernel/0801.0/2388.html).

For Xen, don't do this globally, but rather based on a DMI black list.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agovtd: ats and queued invalidation cleanup
Keir Fraser [Tue, 16 Jun 2009 12:41:17 +0000 (13:41 +0100)]
vtd: ats and queued invalidation cleanup

Use iommu_qinval in place of qinval_enabled flag.  Use
ecap_queued_inval() for determining whether queued invalidation is
available on this vt-d engine or not.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
15 years agox86, hvm: set vcpu->is_initialised after restore/migration
Keir Fraser [Tue, 16 Jun 2009 12:39:00 +0000 (13:39 +0100)]
x86, hvm: set vcpu->is_initialised after restore/migration

After restore/migration, the xenctx command for auxiliary vcpus
fails with a message "xc_vcpu_getcontext: No data available".

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
15 years agox86, hvm: fix a domain_lock leak
Keir Fraser [Tue, 16 Jun 2009 12:33:12 +0000 (13:33 +0100)]
x86, hvm: fix a domain_lock leak
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
15 years agoxend: support for older pciutils without -vmm option, and improve
Keir Fraser [Tue, 16 Jun 2009 10:53:47 +0000 (11:53 +0100)]
xend: support for older pciutils without -vmm option, and improve
error handling in get_info_from_lspci().

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
15 years agotmem: cleanups
Keir Fraser [Tue, 16 Jun 2009 10:47:09 +0000 (11:47 +0100)]
tmem: cleanups

- don't mis-use guest handle for passing an MFN value
- eliminate unnecessary (and misplaced) use of XEN_GUEST_HANDLE_64
- use copy_from_guest() instead of __copy_from_guest() for loading the
  argument structure

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoxend: pass-through: Use common parsing code in preprocess_pci()
Keir Fraser [Tue, 16 Jun 2009 10:41:31 +0000 (11:41 +0100)]
xend: pass-through: Use common parsing code in preprocess_pci()

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: Use PCIDevice as the parameter for the constructor for PCIQuirk
Keir Fraser [Tue, 16 Jun 2009 10:39:02 +0000 (11:39 +0100)]
xend: pass-through: Use PCIDevice as the parameter for the constructor for PCIQuirk

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: Remove PciDeviceNotFoundError, it is never used
Keir Fraser [Tue, 16 Jun 2009 10:38:33 +0000 (11:38 +0100)]
xend: pass-through: Remove PciDeviceNotFoundError, it is never used

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: sxp.merge() cant deal with values being a list
Keir Fraser [Tue, 16 Jun 2009 10:37:41 +0000 (11:37 +0100)]
xend: pass-through: sxp.merge() cant deal with values being a list

sxp.merge() can't deal with values being a list so instead
of storing pci options as:

[ 'opts', [ 'key1' 'value1'], [ 'key2', 'value2'], ...]

store them as:

[ 'opts', [ 'key1' 'value1'], ['opts', [ 'key2', 'value2']], ...

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: cleanupDevice: move and remove recently added vslot entry
Keir Fraser [Tue, 16 Jun 2009 10:36:40 +0000 (11:36 +0100)]
xend: pass-through: cleanupDevice: move and remove recently added vslot entry

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: tidy up PciController()
Keir Fraser [Tue, 16 Jun 2009 10:36:03 +0000 (11:36 +0100)]
xend: pass-through: tidy up PciController()

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: fix typo: spx -> sxp
Keir Fraser [Tue, 16 Jun 2009 10:35:16 +0000 (11:35 +0100)]
xend: pass-through: fix typo: spx -> sxp

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: Only call setupOneDevice() once per device
Keir Fraser [Tue, 16 Jun 2009 10:33:23 +0000 (11:33 +0100)]
xend: pass-through: Only call setupOneDevice() once per device

As observed by Dexuan Cui, when PCI devices are passed through at
domain-creation-time setupOneDevice() will be called twice.

Once via setupDevice() and once via econfigureDevice() which
is called in pci_device_configure().

This patch removes the first of these.

Cc: Dexuan Cui <dexuan.cui@intel.com>
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agovtd: Clean up lock for VT-d register writes
Keir Fraser [Tue, 16 Jun 2009 10:31:20 +0000 (11:31 +0100)]
vtd: Clean up lock for VT-d register writes

It should get lock to write VT-d registers. Currently there are some
register writes without lock. This patch complements register_lock for
those writes.

Signed-off-by: Weidong Han <weidong.han@intel.com>
15 years agovtd: Fix flush for SRTP and SIRTP set
Keir Fraser [Tue, 16 Jun 2009 10:30:45 +0000 (11:30 +0100)]
vtd: Fix flush for SRTP and SIRTP set

SRTP (Set Root Table Pointer) operation must be set before enable or
re-enable DMA remapping. And after set it, software must globally
invalidate the context-cache and then globally invalidate the
IOTLB. This is required to ensure hardware uses only the remapping
structures referenced by the new root-table pointer, and not stale
cached entries. Similarly, SIRTP (Set Interrupt Remap Table Pointer)
operation must be set before enable or re-enable Interrupt
remapping, and after set it, software must globally invalidate the
interrupt entry cache. This patch adds global context and iotlb
flush after set root entry, and globally flushs interrupt entry
cache before enabling Interrupt remapping. And remove the
iommu_flush_all in iommu_resume becuase it becomes redundant after
adds flush for SRTP in init_vtd_hw.

Signed-off-by: Weidong Han <weidong.han@intel.com>
15 years agoxend: support multiple consoles per domain
Keir Fraser [Tue, 16 Jun 2009 10:25:37 +0000 (11:25 +0100)]
xend: support multiple consoles per domain

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoxenconsole: support for multiple consoles per domain
Keir Fraser [Tue, 16 Jun 2009 10:24:58 +0000 (11:24 +0100)]
xenconsole: support for multiple consoles per domain

This patch adds a new command line argument to xenconsole to specify
to which console to connect to in case a domain has more than one.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agotmem: fix minor accounting error
Keir Fraser [Tue, 16 Jun 2009 10:18:32 +0000 (11:18 +0100)]
tmem: fix minor accounting error

Reset a counter when all tmem pages are released.  This
only affects status reporting (as displayed by xm tmem-list
or the just patched xenballoon-monitor) but the incorrectly
reported result is misleading.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agotools/xenballoond: add tmem capability to directed/self-ballooning
Keir Fraser [Tue, 16 Jun 2009 10:17:28 +0000 (11:17 +0100)]
tools/xenballoond: add tmem capability to directed/self-ballooning
and monitor tool

This patch adds tmem support to the largely unknown/unused
xenballoond scripts that implement both self-ballooning and
a foundation for directed-ballooning.  Tmem and automated
ballooning are highly complementary in that, when ballooning
is over-aggressive, paging and swapping can increase noticably.
Precache preserves evicted pages that may be needed again soon
(thus eliminating disk reads) and preswap provides memory-based
swapping that occurs if ballooning is insufficiently responsive
to a sudden increase in activity and memory demand (thus
eliminating disk writes and reads).

There are two changes in this patch:

1) The xenballoond service is a convenient place to implement
   userland "preswap shrinking".**
2) The xenballoon-monitor script is a convenient place to
   report (and view with "watch -d") the frequent memory
   rebalancing that results from tmem usage on a busy system.

Note that for best results (and for the monitor script to
work), the xenstore-* tools should be installed on each guest.

(** In a disk-based swap device, stale pages are often left
  on-disk even after they are no longer needed or valid; they
  are simply overwritten if/when the disk blocks are needed
  again, which may be a very long time.  Preswap behaves
  much like a disk, but uses precious pages of memory that
  count against a guest's memory allocation; thus stale
  pages are very undesirable.  Preswap shrinking periodically
  attempts to remove stale pages from preswap by using a
  sysfs interface created by the linux-side tmem patch.)

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agox86: Switch to using pvops kernel by default for Linux
Keir Fraser [Tue, 16 Jun 2009 10:15:48 +0000 (11:15 +0100)]
x86: Switch to using pvops kernel by default for Linux

Keave ia64 on 2.6.18 since it currently has no dom0 support in pvops

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
15 years agoRemove bogus link from COPYING file.
Keir Fraser [Tue, 16 Jun 2009 10:11:59 +0000 (11:11 +0100)]
Remove bogus link from COPYING file.

Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
15 years agoFix dependencies in tools/include/xen-foreign/Makefile
Keir Fraser [Tue, 16 Jun 2009 10:01:17 +0000 (11:01 +0100)]
Fix dependencies in tools/include/xen-foreign/Makefile

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoxend: allow config file compatibility with new tap syntax
Keir Fraser [Tue, 16 Jun 2009 10:00:29 +0000 (11:00 +0100)]
xend: allow config file compatibility with new tap syntax

Recently the format of the tap syntax in the config file changed to
using a 4 part specifier (tap:tapdisk:<format>:<filename>) instead
of the old 3-part one (tap:<qcow>:<filename>).
This breaks compatibility with existing config files: a guest start
will throw a Python exception and will be aborted.
AFAICS currently tap:tapdisk is redundant, so the attached patch
simply catches the above mentioned exception and tries to parse the
old format in this case.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
15 years agox86 mca: Support MCA recovery actions for latest Intel platforms
Keir Fraser [Tue, 16 Jun 2009 09:58:56 +0000 (10:58 +0100)]
x86 mca: Support MCA recovery actions for latest Intel platforms

When an UC = 1 PCC = 0 MCE happens, there're more types of software
recoverable error defined on on latest Intel Platform. For identifying
those new errors, some new bit (S/AR bit) is defined in MCi_STATUS
register. Also we need MCACOD help's to judge the detailed
error. Combined with the OVER bit, different recovery policies are
required for containing those new errors.

SRAO error  is an software recoverable MCA error, no recovery action
required. while SRAR  is an software recoverable MCA error, recovery
action is required.

Signed-off-by: Liping Ke <liping.ke@intel.com>
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
15 years agoxend: Show "bootable" information only once in 'xm list --long'
Keir Fraser [Tue, 16 Jun 2009 09:55:36 +0000 (10:55 +0100)]
xend: Show "bootable" information only once in 'xm list --long'

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
15 years agoblktap2/vhd, daemon: serialize subdirs-all and subdirs-install
Keir Fraser [Tue, 16 Jun 2009 09:54:10 +0000 (10:54 +0100)]
blktap2/vhd, daemon: serialize subdirs-all and subdirs-install

make install in vhd and daemon, subdirs-all and subdirs-install
are invoked parallel causing nasty error.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
15 years agoUpdate QEMU_TAG to e0bb6b8df60863bca0163a1688baf4854e931e55
Keir Fraser [Mon, 8 Jun 2009 17:23:57 +0000 (18:23 +0100)]
Update QEMU_TAG to e0bb6b8df60863bca0163a1688baf4854e931e55

15 years agoxend: pci: fix extract_the_exact_pci_names()
Keir Fraser [Mon, 8 Jun 2009 11:24:14 +0000 (12:24 +0100)]
xend: pci: fix extract_the_exact_pci_names()

Changeset 19726: d8b7b51f482b neglects the case pci_names could be
types.ListType.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agox86 hvm: move dirty_vram into struct hvm_domain
Keir Fraser [Fri, 5 Jun 2009 13:04:03 +0000 (14:04 +0100)]
x86 hvm: move dirty_vram into struct hvm_domain

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agovmx: Change xen macro name for Intel vmexit reason 41
Keir Fraser [Fri, 5 Jun 2009 08:32:03 +0000 (09:32 +0100)]
vmx: Change xen macro name for Intel vmexit reason 41

This VMEXIT (reason 41) indicates MCE during a VMENTRY, the old macro
definition is misleading us.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
15 years agoblktap2: README updates
Keir Fraser [Fri, 5 Jun 2009 08:31:23 +0000 (09:31 +0100)]
blktap2: README updates

As promised, this brings the long out-of-sync documentation up to
date, and adds some getting started information about tapdisk driver
development - I get the occasional email on this latter subject.

Signed-off-by: Dutch Meyer <dmeyer@cs.ubc.ca>
15 years agoxend: Convert the type of superpages to integer to fix a TypeError.
Keir Fraser [Fri, 5 Jun 2009 08:30:36 +0000 (09:30 +0100)]
xend: Convert the type of superpages to integer to fix a TypeError.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
15 years agoVT-d: correct way to submit command to GCMD register
Keir Fraser [Fri, 5 Jun 2009 08:29:42 +0000 (09:29 +0100)]
VT-d: correct way to submit command to GCMD register

Per VT-d spec, software should submit only one "incremental" command
at a time to Global Command reigster. Current implementation uses a
variable (gcmd) to record the state of Global Status register. It's
error prone.

Signed-off-by: Weidong Han <weidong.han@intel.com>
15 years agoVT-d: define a macro for waiting hardare completion
Keir Fraser [Fri, 5 Jun 2009 08:27:18 +0000 (09:27 +0100)]
VT-d: define a macro for waiting hardare completion

When set some registers of VT-d, it must wait for hardware
completion. There are lots of duplicated code to do that. This patch
defines a macro for it, thus it is much cleaner.

Signed-off-by: Weidong Han <weidong.han@intel.com>
15 years agoVT-d: remove useless variables
Keir Fraser [Fri, 5 Jun 2009 08:26:39 +0000 (09:26 +0100)]
VT-d: remove useless variables

This patch removes global variable "vtd_enabled", which is
redundant. "iommu_enabled" is enough. And also removes useless global
variables qi_ctrl and ir_ctrl, which are not used at all.

Signed-off-by: Weidong Han <weidong.han@intel.com>
15 years agoIntel VT-d: fix Stoakley boot issue with iommu=1
Keir Fraser [Fri, 5 Jun 2009 08:25:50 +0000 (09:25 +0100)]
Intel VT-d: fix Stoakley boot issue with iommu=1

Signed-off-by: Weidong Han <Weidong.han@intel.com>
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
15 years agodocs: Note that changelog is not up to date for Xen 3.4+
Keir Fraser [Thu, 4 Jun 2009 21:26:38 +0000 (22:26 +0100)]
docs: Note that changelog is not up to date for Xen 3.4+
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: hap dirty vram tracking
Keir Fraser [Thu, 4 Jun 2009 21:25:10 +0000 (22:25 +0100)]
x86: hap dirty vram tracking

Currently HAP systems suffer a significant performance loss when a vnc
client is connect or the sdl interface is used, because HAP is lacking
an implementation of track_dirty_vram.
As a consequence qemu always tries to update the whole screen because
it does not know which areas of the screen have been updated by the
guest.

This patch implements track_dirty_vram for HAP enabling the logdirty
mechanism only in a specific gfn range and adding a
paging_log_dirty_range function that returns the log dirty bitmap in a
requested range.

Paging_log_dirty_range is different from paging_log_dirty_op because
operates on a range and also because it does not pause the domain. In
order not to lose any update I moved clean_dirty_bitmap at the
beginning of the function before evaluating the logdirty bitmap.
The bitmap is still safe because it is protected by the logdirty lock.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoxm: Remove redundant os.waitpid() call from do_console()
Keir Fraser [Thu, 4 Jun 2009 09:57:39 +0000 (10:57 +0100)]
xm: Remove redundant os.waitpid() call from do_console()
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agovtd: ia64 fix of intremap.c
Keir Fraser [Thu, 4 Jun 2009 09:48:45 +0000 (10:48 +0100)]
vtd: ia64 fix of intremap.c

19707:07cf79dfb59c caused compilation error on ia64.
This patch fixes it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
15 years agoxend: pci: only extract the exact pci BDFs
Keir Fraser [Thu, 4 Jun 2009 09:47:56 +0000 (10:47 +0100)]
xend: pci: only extract the exact pci BDFs

On some hosts:
[root@localhost ~]# ls /sys/bus/pci/devices/0000:00:05.0/
0000:00:05.0:pcie00  0000:05:00.0          class   driver  local_cpus
resource          subsystem_vendor
0000:00:05.0:pcie01  broken_parity_status  config  enable  modalias
subsystem         uevent
0000:00:05.0:pcie02  bus                   device  irq     power
subsystem_device  vendor

Here we should only get 0000:05:00.0, but we also get 0000:00:05.0
unexpectedly. With this patch, xend only extracts the exact BDF(s).

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agoxm: Don't die when trying to conect the console to short-lived domains
Keir Fraser [Thu, 4 Jun 2009 09:46:13 +0000 (10:46 +0100)]
xm: Don't die when trying to conect the console to short-lived domains

As observed by Mick Joran, if short-lived domain exits cleanly
then os.waitpid() will throw the following exception. This appears
to be because the child process that is used to start the domain
has detached from its parent.

OSError: [Errno 10] No child processes

Cc: Mick Jordan <Mick.Jordan@sun.com>
Signed-off-by: Simon Horman <horms@verge.ent.au>
15 years agoblktap2: fix parallel Make.
Keir Fraser [Thu, 4 Jun 2009 09:45:24 +0000 (10:45 +0100)]
blktap2: fix parallel Make.

sub make in tools/blktap2/daemon/lib and tools/lvd/lib
can be triggered many times at the same time which results in
weired link error because one target is linking a library while
another target is trying to recreate the library.

This patch makes it invoke submake only once.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
15 years agoxm: pass-through: sort the output of xm pci-list
Keir Fraser [Thu, 4 Jun 2009 09:43:44 +0000 (10:43 +0100)]
xm: pass-through: sort the output of xm pci-list

Other than being arguably more human readable,
this patch reconciles the output differences between
using Xen API and xmlrpc to manipulate domains.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: Use AUTO_PHP_SLOT as unknown vslot
Keir Fraser [Thu, 4 Jun 2009 09:43:20 +0000 (10:43 +0100)]
xend: pass-through: Use AUTO_PHP_SLOT as unknown vslot

This fixes a few cases where 0 is still used for an known vslot.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxm: xen-api, pass-through: create: Use vslot for hotplug_slot
Keir Fraser [Thu, 4 Jun 2009 09:41:50 +0000 (10:41 +0100)]
xm: xen-api, pass-through: create: Use vslot for hotplug_slot

Using func for hotplug_slot is not correct, although func is often
zero, previously zero meant please pick a vslot and asking xend to
pick a vslot was the only method available.

This resolves the following error when using Xen API:
$ xm create hvm.conf
...
Internal error: Timed out waiting for device model action.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: xen-api, pass-through: Add create_dpci_from_sxp()
Keir Fraser [Thu, 4 Jun 2009 09:41:13 +0000 (10:41 +0100)]
xend: xen-api, pass-through: Add create_dpci_from_sxp()

Move some duplicated code into create_dpci_from_sxp()

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxm, xend: xen-api: DPCI.get_hotplug_slot() returns a decimal
Keir Fraser [Thu, 4 Jun 2009 09:40:24 +0000 (10:40 +0100)]
xm, xend: xen-api: DPCI.get_hotplug_slot() returns a decimal

xm uses the following code to read pci information using Xen API:

    ppci_ref =3D server.xenapi.DPCI.get_PPCI(dpci_ref)
    ppci_record =3D server.xenapi.PPCI.get_record(ppci_ref)
    dev =3D {
        "domain":   int(ppci_record["domain"]),
        "bus":      int(ppci_record["bus"]),
        "slot":     int(ppci_record["slot"]),
        "func":     int(ppci_record["func"]),
        "vslot":    int(server.xenapi.DPCI.get_hotplug_slot(dpci_ref))
    }

As the domain, bus, slot and func values are returned as string
representations of decimal, it makes sense for get_hotplug_slot() to
also return string representations of decimal.

As it is, the int() conversion will break cause xm to fail with
an error if the vslot is in the range 0xa-0xf or 0x1a-0x1f.

$ xm pci-list debian
Error: Invalid argument.

And the int() conversion will return the wrong value if
the vslot is in the range 0x10-0x19.

This patch also alters XendDPCI to store hotplug_vslot as an integer
rather than a string. This is consitent with the way other
values are stored inside XendDPCI.

get_hotplug_slot() returning a string is not consistent
with other calls inside XendDPCI, which return integers.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: prefix vslot with 0x in device configration
Keir Fraser [Thu, 4 Jun 2009 09:39:32 +0000 (10:39 +0100)]
xend: pass-through: prefix vslot with 0x in device configration

I don't know of the historical reasons for this, but by convention
hex values are stored without a leading '0x' in the backend and
with a leading '0x' in the device configuration.

This patch also removes handling of the case where vslot is missing
from the backend, should never occur.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxm: xen-api, pass-through: Dont pass empty opts
Keir Fraser [Thu, 4 Jun 2009 09:39:03 +0000 (10:39 +0100)]
xm: xen-api, pass-through: Dont pass empty opts

Internally xend doesn't know how to handle empty opts.
This code ensures that opts is only included in the sxpr
if its value will be non-empty.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxm: xen-api: Install create.dtd in SHAREDIR
Keir Fraser [Thu, 4 Jun 2009 09:38:13 +0000 (10:38 +0100)]
xm: xen-api: Install create.dtd in SHAREDIR

* Install create.dtd in SHAREDIR
* Use SHAREDIR/create.dtd
* import os.path.join into xenapi_create.py,
  it already seems to be used many times

Resolves the following error when using XenAPI:

$ xm create hvm.conf
Couldn't open resource '/usr/share/xen/create.dtd' at
/usr/share/xen/create.dtd:1:0

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: pass-through: report attach errors from device model
Keir Fraser [Thu, 4 Jun 2009 09:37:39 +0000 (10:37 +0100)]
xend: pass-through: report attach errors from device model

Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Cc: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agolibxc: fix link error on ia64
Keir Fraser [Thu, 4 Jun 2009 09:36:36 +0000 (10:36 +0100)]
libxc: fix link error on ia64

On ia64, xen-unstable 19698:f72d26c00002 cannot be built:
../../tools/libxc/libxenguest.so: undefined reference to
`xc_core_arch_map_p2m_writable'
../../tools/libxc/libxenguest.so: undefined reference to `xc_map_m2p'

Because xc_offline_page.c requires xc_map_m2p() in xc_domain_save.c,
xc_offline_page.c must be compiled only if CONFIG_MIGRATE=3Dy.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agorombios: compute checksum for roms bigger than a segment
Keir Fraser [Thu, 4 Jun 2009 09:36:01 +0000 (10:36 +0100)]
rombios: compute checksum for roms bigger than a segment

From: Glauber Costa <glommer@redhat.com>
From: "Sebastian Herbszt" <herbszt@gmx.de>
Ported by: Akio Takebe <takebe_akio@jp.fujitsu.com>

15 years agominios: Introduce BSD license COPYING file
Keir Fraser [Thu, 4 Jun 2009 09:35:03 +0000 (10:35 +0100)]
minios: Introduce BSD license COPYING file
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agominios: Clean up and remove Linux remnants from x86_64.S
Keir Fraser [Wed, 3 Jun 2009 17:27:05 +0000 (18:27 +0100)]
minios: Clean up and remove Linux remnants from x86_64.S

Sigend-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoUpdate QEMU_TAG to c9c1a645fcfdba8c4a15a56e29d5ea7b7bcd7aa6
Keir Fraser [Wed, 3 Jun 2009 15:20:28 +0000 (16:20 +0100)]
Update QEMU_TAG to c9c1a645fcfdba8c4a15a56e29d5ea7b7bcd7aa6

15 years agohvmloader: Scan for gpxe-capable NICs until one is found.
Keir Fraser [Wed, 3 Jun 2009 15:12:34 +0000 (16:12 +0100)]
hvmloader: Scan for gpxe-capable NICs until one is found.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: Clean up get_page_from_l1e() to correctly distinguish between
Keir Fraser [Wed, 3 Jun 2009 13:40:34 +0000 (14:40 +0100)]
x86: Clean up get_page_from_l1e() to correctly distinguish between
owner-of-pte and owner-of-data-page in all cases.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agovtd: Fix apic pin to interrupt remapping table index
Keir Fraser [Wed, 3 Jun 2009 11:59:44 +0000 (12:59 +0100)]
vtd: Fix apic pin to interrupt remapping table index

Originally, it calls xmalloc to set index in
ioapic_rte_to_remap_entry(). When make with debug=y, it may trigger
spinlock BUG_ON because allocate memory with interrupt disabled.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: pin_2_irq[].pin should be initialised to -1.
Keir Fraser [Wed, 3 Jun 2009 11:35:25 +0000 (12:35 +0100)]
x86: pin_2_irq[].pin should be initialised to -1.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agotypo: occured -> occurred
Keir Fraser [Wed, 3 Jun 2009 10:20:38 +0000 (11:20 +0100)]
typo: occured -> occurred

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
15 years agoxend: requested_vslots is no longer needed
Keir Fraser [Wed, 3 Jun 2009 10:19:51 +0000 (11:19 +0100)]
xend: requested_vslots is no longer needed

...following removal of the boot-time pci passthru protocol.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agox86: Fix XENPF_getidletime to correctly modify cpumask.
Keir Fraser [Wed, 3 Jun 2009 10:17:00 +0000 (11:17 +0100)]
x86: Fix XENPF_getidletime to correctly modify cpumask.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoblktap: fix empty QCOW images (bug 1430 part 2)
Keir Fraser [Wed, 3 Jun 2009 10:11:50 +0000 (11:11 +0100)]
blktap: fix empty QCOW images (bug 1430 part 2)

Empty QCOW images consist of only the L1 table, this results in a
file size which is not sector-aligned. Since blktap uses O_DIRECT, the
block aligned read of the L1 table will go beyond the end of file and
thus returns the actual file size and not the expected length.
This patch checks whether at least the L1 table has been read.

This should fix bug 1430.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
15 years agoblktap: fix and use ROUNDUP macro (bug 1430 part 1)
Keir Fraser [Wed, 3 Jun 2009 10:11:04 +0000 (11:11 +0100)]
blktap: fix and use ROUNDUP macro (bug 1430 part 1)

As pointed out in Xen Bugzilla 1430 in the blktap QCOW driver the
rounding function is wrong in line 824 of block-qcow.c.
This patch replaces this (and other roundings) with the already
existing ROUNDUP macro (and fixes the usual macro pitfall).

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
15 years agoblktap2: human readable output for tapdisk2 creation problems
Keir Fraser [Wed, 3 Jun 2009 10:10:07 +0000 (11:10 +0100)]
blktap2: human readable output for tapdisk2 creation problems

This patch fixes the "file object has no attribute find" failure
we've been seeing when starting blktap2 devices and adds more
meaningful error output to conditions where the tapdisk2 process is
unable to create a blktap2 device.

Signed-off-by: Dutch Meyer <dmeyer@cs.ubc.ca>
15 years agominios: refactor xenbus state machine
Keir Fraser [Wed, 3 Jun 2009 10:09:14 +0000 (11:09 +0100)]
minios: refactor xenbus state machine

Implement xenbus_wait_for_state_change and xenbus_switch_state and
change the various frontends to use the two functions and do proper
error checking.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
15 years agoxend: pci: improve the assignability checking
Keir Fraser [Tue, 2 Jun 2009 10:50:16 +0000 (11:50 +0100)]
xend: pci: improve the assignability checking

1) fix some small typos in util/pci.py;
2) find_all_the_multi_functions(): BDFs of a multi-function PCIe
device could be different in all the 3 fields (bus, device, function),
so we need self.find_parent() and list all t
he BDFs below the parent;
3) to assign a device of the must-be-co-assigned devices, we require
all the related devices should be owned by pciback;
4) detect and disallow duplicate pci string specified in guest config
file due to carelessness.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
15 years agoEnable pci mmcfg and ATS for x86_64
Keir Fraser [Tue, 2 Jun 2009 10:49:34 +0000 (11:49 +0100)]
Enable pci mmcfg and ATS for x86_64

This patch enables PCI MMCONFIG in xen and turns on hooks for ATS.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
15 years agotmem: shared ephemeral (SE) pool (clustering) fixes
Keir Fraser [Mon, 1 Jun 2009 17:37:27 +0000 (18:37 +0100)]
tmem: shared ephemeral (SE) pool (clustering) fixes

Tmem can share clean page cache pages for Linux domains
in a virtual cluster (currently only the ocfs2 filesystem
has a patch on the Linux side).  So when one domain
"puts" (evicts) a page, any domain in the cluster can
"get" it, thus saving disk reads.  This functionality
is already present; these are only bug fixes.

- fix bugs when an SE pool is destroyed
- fixes in parsing tool for xm tmem-list output for SE pools
- incorrect locking in one case for destroying an SE pool
- clearer verbosity for transfer when an SE pool is destroyed
- minor cleanup: merge routines that are mostly duplicate

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agolibxc: Implement stub xc_gnttab_map_table() for non-linux.
Keir Fraser [Mon, 1 Jun 2009 14:52:19 +0000 (15:52 +0100)]
libxc: Implement stub xc_gnttab_map_table() for non-linux.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoRevert 19658:28a197617286 "Fix up the synchronisation around grant
Keir Fraser [Mon, 1 Jun 2009 13:55:32 +0000 (14:55 +0100)]
Revert 19658:28a197617286 "Fix up the synchronisation around grant
table map track handles".

There is no race since the hypercall takes the
domain-lock. Furthermore removing locking from get_maptrack_handle()
races gnttab_setup_table().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agominios: Remove Linux attribution for mktime() as it's not true since c/s 19638.
Keir Fraser [Mon, 1 Jun 2009 13:39:25 +0000 (14:39 +0100)]
minios: Remove Linux attribution for mktime() as it's not true since c/s 19638.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoUpdate QEMU_TAG: 5beedb58147cbb04e206a71429198b6316217cfc
Keir Fraser [Mon, 1 Jun 2009 13:18:44 +0000 (14:18 +0100)]
Update QEMU_TAG: 5beedb58147cbb04e206a71429198b6316217cfc

15 years agolibxc: Exchange a page for PV guest
Keir Fraser [Mon, 1 Jun 2009 13:15:48 +0000 (14:15 +0100)]
libxc: Exchange a page for PV guest

This patch support exchange a page for a suspended PV guest from user
space.

The basic idea to offline a page is:
1) mark a page offline pending
2) If the page is owned by a HVM domain, user have to live migrate it.
    In future, with stub-domain support, we can also exchange the page
    without migration.
3) If the page is owned by a PV domain, we will try to exchange the
offline pending page to a new one and free the old page.

This patch achieves item 3.

The method to exchange the offline pending page for PV domain is:

1) Suspend the guest.
2) If the page is being granted out, return with offline pending.
3) Get a copy for the content
4) Scan all page table page to see if any reference to the offending
page, if yes, make the entry to be non-present to reduce the reference
count.
5) After update all page tables, user space tools will try to exchange
the old page. If the new mfn has no reference anymore (i.e.
count_info & count_mask =3D 1), the exchange will allocate a new page,
update the m2p and return success, otherwise it will return fail.
6) If step 5 is success, user space tools will update the content of
the new page  change the p2m table, and change all entries scaned in
step 4 to point to new entry.
if step failed, it will try to undo step 4 to revert page table.
7) Resume the guest.

Please refer to thread in
http://www.mailinglistarchive.com/xen-devel@lists.xensource.com/msg63084.html
for more information.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agolibxc: Export xc_core_arch_map_p2m_writable()
Keir Fraser [Mon, 1 Jun 2009 13:13:53 +0000 (14:13 +0100)]
libxc: Export xc_core_arch_map_p2m_writable()

This patch firstly change the xc_core_arch_map_p2m() to map the p2m to
be writable, then it export this function.
One notice for this patch is, caller should make sure change the p2m
in flight will not cause trouble.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agolibxc: Add a function to map a domain's grant table.
Keir Fraser [Mon, 1 Jun 2009 13:13:20 +0000 (14:13 +0100)]
libxc: Add a function to map a domain's grant table.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agolibxc: export xc_map_m2p() so that it can be called outside.
Keir Fraser [Mon, 1 Jun 2009 13:12:53 +0000 (14:12 +0100)]
libxc: export xc_map_m2p() so that it can be called outside.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agoExport page offline hypercalls to user space tools.
Keir Fraser [Mon, 1 Jun 2009 13:08:58 +0000 (14:08 +0100)]
Export page offline hypercalls to user space tools.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agotmem: fix corner case crash on forcible domain destruction
Keir Fraser [Mon, 1 Jun 2009 13:07:46 +0000 (14:07 +0100)]
tmem: fix corner case crash on forcible domain destruction

When a tmem-enabled domain is destroyed, if the domain was
using a persistent pool, the domain destruction process
to scrubs page races tmem's attempts to gracefully dismantle
data structures.  Move tmem_destroy earlier in the domain
destruction process.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoblktap: Revert parts of c/s 19349.
Keir Fraser [Mon, 1 Jun 2009 13:02:26 +0000 (14:02 +0100)]
blktap: Revert parts of c/s 19349.

Caused blktapctrl pipes to be created with uninitialised variable in name.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxend: Fix HVM domain restore (undefined HVM_ImageHandler.superpages).
Keir Fraser [Sat, 30 May 2009 12:25:32 +0000 (13:25 +0100)]
xend: Fix HVM domain restore (undefined HVM_ImageHandler.superpages).
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoRevert 19657:9ff5c79b0ceb
Keir Fraser [Sat, 30 May 2009 12:21:08 +0000 (13:21 +0100)]
Revert 19657:9ff5c79b0ceb

Breaks automated localhost migration tests:
    for xx in x:
    TypeError: iteration over non-sequence

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agopassthrough: Fix test_and_clear_bit() caller to clear bitmap, not bitmap pointer
Keir Fraser [Sat, 30 May 2009 09:24:21 +0000 (10:24 +0100)]
passthrough: Fix test_and_clear_bit() caller to clear bitmap, not bitmap pointer

Latent bug triggered by '19650: eliminate hard-coded NR_IRQS'

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoxend: Add serialise_pci_opts() and split_pci_opts()
Keir Fraser [Fri, 29 May 2009 08:33:06 +0000 (09:33 +0100)]
xend: Add serialise_pci_opts() and split_pci_opts()

This centralises some code.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: Fix check for request to detach non-existent device
Keir Fraser [Fri, 29 May 2009 08:32:40 +0000 (09:32 +0100)]
xend: Fix check for request to detach non-existent device

This fixes the check for a request to detatch a non-existent device
in pci_device_configure. The previous check was bogus because the
format of AUTO_PHP_SLOT_STR is not the same as that of x['vslot'].

However, it works in a slightly non-obvious way, checking that vslot
hasn't been altered from its initial value AUTO_PHP_SLOT_STR. To
make this shceme a little clearer, use an empty string as the inital
value.

Formting issues asside, neither AUTO_PHP_SLOT_STR nor the empty
string are valid values for x['vslot']. In the event
of invalid data (indicating a bug), it should be caught by
self.hvm_destroyPCIDevice.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: hot-plug PCI devices at boot-time
Keir Fraser [Fri, 29 May 2009 08:32:02 +0000 (09:32 +0100)]
xend: hot-plug PCI devices at boot-time

Currently there are two interfaces to pass-through PCI devices:
1. A method driven through per-device xenstore entries that is used at
boot-time
2. An event-based method used for hot-plug.

This seems somewhat redundant and makes extending the code cumbersome
and prone to error - often the change needs to be made twice, in
two different ways.

This patch unifies PCI pass-through by using the existing event-based
method at boot-time.

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoxend: use popen2 module instead of subprocess for Python 2.3
Keir Fraser [Fri, 29 May 2009 08:29:58 +0000 (09:29 +0100)]
xend: use popen2 module instead of subprocess for Python 2.3

On Python 2.3, xend cannot started:
    File
    "usr/lib/python2.3/site-packages/xen/xend/server/BlktapController.=
py", line 3, in ?
      import subprocess
  ImportError: No module named subprocess

This patch uses `popen2' instead of `subprocess' for Python 2.3.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agoblktap2: fix a compilation error (missing PATH_MAX)
Keir Fraser [Fri, 29 May 2009 08:28:15 +0000 (09:28 +0100)]
blktap2: fix a compilation error (missing PATH_MAX)

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agoxm: Unify the output of pci-list
Keir Fraser [Fri, 29 May 2009 08:27:31 +0000 (09:27 +0100)]
xm: Unify the output of pci-list

This is another attempt at having pci-list produce consistent output.
Without this change there differences in the output of both vslots
and domain occur for domains that have never been started and domains
that have been started.

In order to address this I have taken the approach of
using integers where possible and explicitly formating them,
rather than relying on string representations that are present in
data structures.

I have also re-used the common part of the format, to try
and mitigate. the possibility of future inconsistencies there.

This patch also:
* Removes trailing whitespace
* Removes unnecessary brackets and whitespace from print invocations
* Prints the header outside of the loop to avoid having
  to maintain a state variable

Signed-off-by: Simon Horman <horms@verge.net.au>
15 years agoFree pirq_array/pirq_to_evtchn in complete_domain_destroy().
Keir Fraser [Fri, 29 May 2009 08:26:49 +0000 (09:26 +0100)]
Free pirq_array/pirq_to_evtchn in complete_domain_destroy().

Also rejig code slightly in domain_create().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoRevert 19661:326b24bfa9f9 "Free pirq_to_evtchn/pirq_mask..."
Keir Fraser [Fri, 29 May 2009 08:22:50 +0000 (09:22 +0100)]
Revert 19661:326b24bfa9f9 "Free pirq_to_evtchn/pirq_mask..."

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>