xen.git
16 years agoImprove vcpu_migration_delay handling.
Keir Fraser [Wed, 11 Mar 2009 10:12:14 +0000 (10:12 +0000)]
Improve vcpu_migration_delay handling.

Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
16 years agoxend: Test tap devices in testDeviceComplete()
Keir Fraser [Wed, 11 Mar 2009 10:10:15 +0000 (10:10 +0000)]
xend: Test tap devices in testDeviceComplete()

XendDomainInfo.testDeviceComplete() should check block devices have
shutdown correctly but it only considers vbd class devices and ignores
tap devices. The attached patch changes testDeviceComplete() to wait
for both vbd and tap devices to be shutdown correctly.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
16 years agopassthrough: fix some spinlock issues in vmsi
Keir Fraser [Wed, 11 Mar 2009 10:09:21 +0000 (10:09 +0000)]
passthrough: fix some spinlock issues in vmsi

Apart from efficiency, I hasten to fix the assertion failure.

- acquire pcidevs_lock before calling pt_irq_xxx_bind_vtd
- allocate msixtbl_entry beforehand
- check return value from domain_spin_lock_irq_desc()
- typo: spin_unlock(&irq_desc->lock) ->
- spin_unlock_irq(&irq_desc->lock)
- acquire msixtbl_list_lock with irq_disabled

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agoxenconsole: Compile fixes for console code on Solaris
Keir Fraser [Wed, 11 Mar 2009 10:08:31 +0000 (10:08 +0000)]
xenconsole: Compile fixes for console code on Solaris

Signed-off-by: John Levon <john.levon@sun.com>
16 years agoxentrace: TRC_SCHED_DOM_REM is defined, but never used. Use it.
Keir Fraser [Wed, 11 Mar 2009 10:07:06 +0000 (10:07 +0000)]
xentrace: TRC_SCHED_DOM_REM is defined, but never used. Use it.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
16 years agopassthrough: allow pass-through devices to share virtual GSI
Keir Fraser [Wed, 11 Mar 2009 10:05:00 +0000 (10:05 +0000)]
passthrough: allow pass-through devices to share virtual GSI

Allow multiple pass-through devices to use the same guest_gsi.

The motivation for this is:

* Allow multi-function devices to be passed through as multi-function
  devices
* Allow more than two pass-through devices.
  - This will place more contention on the GSI-space, and allocation
    becomes a lot simpler if GSI sharing is allowed.

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agopassthrough: pt_irq_time_out() should act on all machine_irq
Keir Fraser [Wed, 11 Mar 2009 10:03:54 +0000 (10:03 +0000)]
passthrough: pt_irq_time_out() should act on all machine_irq

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoxentrace: trace when we continue with the same task
Keir Fraser [Mon, 9 Mar 2009 15:01:34 +0000 (15:01 +0000)]
xentrace: trace when we continue with the same task

Trace when the scheduler decides to continue running the same process.
This lets us see that this is happening for one; it also lets us see
domains in a trace which are actively running on pcpu but never
scheduled out.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
16 years agoFix the perfc=y build.
Keir Fraser [Mon, 9 Mar 2009 13:52:59 +0000 (13:52 +0000)]
Fix the perfc=y build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvm/vpt: Check that an irq is not blocked before waking the vcpu
Keir Fraser [Mon, 9 Mar 2009 13:50:45 +0000 (13:50 +0000)]
hvm/vpt: Check that an irq is not blocked before waking the vcpu

Currently, when a timer fires for a vpt interrupt, the interrupt
handler calls vcpu_kick() without checking to see if the IRQ is
blocked.  This causes the vcpu to wake up out of a halt when it
shouldn't.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
16 years ago[DOC] Add boot option vcpu_migration_delay in user.tex
Keir Fraser [Mon, 9 Mar 2009 13:35:47 +0000 (13:35 +0000)]
[DOC] Add boot option vcpu_migration_delay in user.tex

Signed-off-by: Atsushi SAKAI <sakaia@jp.fujitsu.com>
16 years agoscheduler: Use perf_counter subsystem for stats
Keir Fraser [Mon, 9 Mar 2009 10:32:24 +0000 (10:32 +0000)]
scheduler: Use perf_counter subsystem for stats

Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoAvoid deadlock in tasklet_schedule() after console_force_unlock().
Keir Fraser [Mon, 9 Mar 2009 09:56:16 +0000 (09:56 +0000)]
Avoid deadlock in tasklet_schedule() after console_force_unlock().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agopvscsi: Some fixes for xm scsi-attach
Keir Fraser [Mon, 9 Mar 2009 09:49:50 +0000 (09:49 +0000)]
pvscsi: Some fixes for xm scsi-attach

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agoblktap: Fix compile warnings in block-qcow2.c
Keir Fraser [Mon, 9 Mar 2009 09:48:45 +0000 (09:48 +0000)]
blktap: Fix compile warnings in block-qcow2.c

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
16 years agoAdd vcpu_migration_delay=<microsecs> boot option to scheduler
Keir Fraser [Mon, 9 Mar 2009 09:37:52 +0000 (09:37 +0000)]
Add vcpu_migration_delay=<microsecs> boot option to scheduler

The idea is borrowed from Linux kernel: if the vCPU is just
scheduled out and put to run-queue, it's likely cache-hot on its
current pCPU, and it may be scheduled in in a short period of time;
however, if vCPU is migrated to another pCPU, it need to re-warm the
cache.

The patch introduces an option vcpu_migration_delay to avoid
aggressive vCPU migration (actually we really see migration frequency
is very high most of the time.), while in the meantime keeping load
balancing over slightly longer time scales.

Linux kernel uses 0.5ms by default. Considering the cost may be
higher (e.g. VMCS impact) than in native, vcpu_migration_delay=1000 is
chosen for our tests, which are performed on a 4x 6-core Dunnington
platform. In 24-VM case, there is ~2% stable performance gain for
enterprise workloads like SPECjbb and sysbench. If HVM is with
stubdom, the gain is more: 4% for the same workloads.

Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years ago[IA64] fix compilation error caused by 19286:dd489125a2e7
Keir Fraser [Mon, 9 Mar 2009 09:19:42 +0000 (09:19 +0000)]
[IA64] fix compilation error caused by 19286:dd489125a2e7

This patch fixes compilation error caused by 19286:dd489125a2e7

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agopygrub: Enable domU boot without xen specific arg
Keir Fraser [Mon, 9 Mar 2009 09:19:10 +0000 (09:19 +0000)]
pygrub: Enable domU boot without xen specific arg

This patch makes domUs bring up without xen specific args to guest
kernels. A domU should be bootable without args parameter because
tools/examples/xmexample1 doesn't have one.

Signed-off-by: INAKOSHI Hiroya <inakoshi.hiroya@jp.fujitsu.com>
16 years ago[IA64] fix issue of can not find the qemu-dm in ia64
Keir Fraser [Mon, 9 Mar 2009 09:18:08 +0000 (09:18 +0000)]
[IA64] fix issue of  can not find the qemu-dm in ia64

IA64 uses the /usr/lib/ for xen. We do not=20
need to check the arch_libdir in ia64. It will
return the wrong value to arch_libdir. And guest
can not boot.

Signed-off-by: Yang Zhang <yang.zhang@intel.com>
16 years agohvmloader acpi: Describe PIRQ routing for all 32 PCI devices on bus 0.
Keir Fraser [Mon, 9 Mar 2009 09:13:50 +0000 (09:13 +0000)]
hvmloader acpi: Describe PIRQ routing for all 32 PCI devices on bus 0.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: Mask X86_FEATURE_XSAVE in cpuid leaf 1, ecx, as we don't allow
Keir Fraser [Mon, 9 Mar 2009 08:54:19 +0000 (08:54 +0000)]
x86: Mask X86_FEATURE_XSAVE in cpuid leaf 1, ecx, as we don't allow
guests to use it (by setting cr4.OSXSAVE).

This prevents crashes in pvops kernels, as new versions of Linux
try to use this feature.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agominios: Fix 18874 memory clipping
Keir Fraser [Mon, 9 Mar 2009 08:43:11 +0000 (08:43 +0000)]
minios: Fix 18874 memory clipping

Fix 18874's memory clipping: there are three page-sized holes between
direct mapping, demand mapping, heap pages and the end of memory.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
16 years agoPage offline support in Xen side
Keir Fraser [Fri, 6 Mar 2009 19:18:39 +0000 (19:18 +0000)]
Page offline support in Xen side

This patch add support to offline a page. The basical idea is, when a
page is assigned, it will be marked offline pending and be moved out of
buddy when freed, when a page is free, it will be moved out of buddy directly.

One notice after this change is, now the page->count_info is not
always 0, especially for shadow page, since the PGC_offlining bit may be set.

Signed-off-by: Wang, Shane <shane.wang@intel.com>
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
16 years agox86/mm: Do not set page's count_info directly
Keir Fraser [Fri, 6 Mar 2009 19:14:50 +0000 (19:14 +0000)]
x86/mm: Do not set page's count_info directly

Page offline patch add several flag to page_info->count_info. However,
currently some code will try to set count_info after alloc_domheap_pages
without using "&" or "|" operation, this may cause the new flags lost, since
there are no protection. This patch try to make sure all write to
count_info will only impact specific field.

Also currently shadow code assume count_info is 0 for shadow page,
however, this is invalid after the new flags. Change some assert in
shadow code.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
16 years agoxend: allow VM configuration with both sdl=1 and vnc=1
Keir Fraser [Fri, 6 Mar 2009 19:13:23 +0000 (19:13 +0000)]
xend: allow VM configuration with both sdl=1 and vnc=1

In the stubdom case you can now specify sdl=1 and vnc=1 (again, both
can be selected at the same time) in the vfb configuration.
So instead of:

vfb = [ 'type=vnc' ]

now you have:

vfb = [ 'vnc=1,sdl=1' ]

the former configuration option is deprecated but still supported for
backward compatibility.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agotboot: Fix return code for S3 integrity
Keir Fraser [Fri, 6 Mar 2009 19:10:29 +0000 (19:10 +0000)]
tboot: Fix return code for S3 integrity

The original patch left in a debug return value from one of the memory
integrity checks.  This patch returns the correct error code in case of a
failure.  This was re-tested to ensure that it still passes for the
expected case.

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
16 years agoi386: Build fix.
Keir Fraser [Fri, 6 Mar 2009 19:07:15 +0000 (19:07 +0000)]
i386: Build fix.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoClean xen/crypto on make clean.
Keir Fraser [Fri, 6 Mar 2009 19:07:00 +0000 (19:07 +0000)]
Clean xen/crypto on make clean.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agovt-d: Better restrict memory ranges considered to be in Xen
Keir Fraser [Fri, 6 Mar 2009 19:06:30 +0000 (19:06 +0000)]
vt-d: Better restrict memory ranges considered to be in Xen

The current implementation of xen_in_range() misses several memory
ranges that are used by the hypervisor and thus shouldn't get mapped
into dom0's VT-d tables.  This patch should make the check complete.

This patch is only against x86 because I'm not familiar enough with
IA64 to know how much, if any, of these checks apply there.

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
16 years agotool: make management of PCI D-states by guest optional
Keir Fraser [Fri, 6 Mar 2009 18:58:41 +0000 (18:58 +0000)]
tool: make management of PCI D-states by guest optional

D3hot state in some PCI devices causes the failure of domain
creation/destruction.

The default is "pci_power_mgmt=3D0" which disables the guest OS from
managing D-states because it would be better to avoid the trouble than
advantage of low power consumption.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agoxm-test: Identifying the network env specified in xend config fails,
Keir Fraser [Fri, 6 Mar 2009 18:56:28 +0000 (18:56 +0000)]
xm-test: Identifying the network env specified in xend config fails,
if an additional parameter is given for the network-bridge
(e.g. netdev=eth1) The patch splits the network command into the
command name and its parameters to determine the netenv (bridge,
route, nat)

Signed-off-by: juergen.gross@fujitsu-siemens.com
16 years agoPanic rather than BUG if an error is encountered decompressing a bzImage
Keir Fraser [Fri, 6 Mar 2009 18:55:05 +0000 (18:55 +0000)]
Panic rather than BUG if an error is encountered decompressing a bzImage

This gives a more useful error message without an unnecessary stack dump.

Noticed by Jeremy Fitzhardinge.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
16 years agoFix cpu selection at the time vCPU allocation
Keir Fraser [Fri, 6 Mar 2009 18:54:09 +0000 (18:54 +0000)]
Fix cpu selection at the time vCPU allocation

After cpu_[online/offline], set bits in cpu_online_map could be not
continuous. Use cycle_cpu() to pick the next one.

Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
16 years agoDo not deadlock in scheduler when sending VIRQ_CON_RING.
Keir Fraser [Fri, 6 Mar 2009 14:28:27 +0000 (14:28 +0000)]
Do not deadlock in scheduler when sending VIRQ_CON_RING.
Instead defer the virq notification to tasklet context.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: Handle missing s3_integrity value, default to zero.
Keir Fraser [Thu, 5 Mar 2009 17:50:05 +0000 (17:50 +0000)]
xend: Handle missing s3_integrity value, default to zero.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: blkif hda regexp fix
Keir Fraser [Thu, 5 Mar 2009 15:10:17 +0000 (15:10 +0000)]
xend: blkif hda regexp fix
Signed-off-by: Michal Novotny <minovotn@redhat.com>
16 years agoinit script: Enable to run xend stop when dom0 shutdown
Keir Fraser [Thu, 5 Mar 2009 15:06:06 +0000 (15:06 +0000)]
init script: Enable to run xend stop when dom0 shutdown
Signed-off-by: Kazuhiro Suzuki <kaz@jp.fujitsu.com>
16 years agox86: Enable THERM_CONTROL_MSR write for dom0 even when cpufreq=xen
Keir Fraser [Thu, 5 Mar 2009 15:02:02 +0000 (15:02 +0000)]
x86: Enable THERM_CONTROL_MSR write for dom0 even when cpufreq=xen

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agovtd: Fix iommu_inclusive_mapping to map all under 4GB.
Keir Fraser [Thu, 5 Mar 2009 14:55:24 +0000 (14:55 +0000)]
vtd: Fix iommu_inclusive_mapping to map all under 4GB.

Signed-off-by: Ross Philipson <ross.philipson@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years ago[IA64] Remove compilation warning and typo caused by 19268:4b7d638a8b89
Keir Fraser [Thu, 5 Mar 2009 09:32:37 +0000 (09:32 +0000)]
[IA64] Remove compilation warning and typo caused by 19268:4b7d638a8b89

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agoBe careful with page_get_owner() now that owner field can be clobbered
Keir Fraser [Wed, 4 Mar 2009 14:28:50 +0000 (14:28 +0000)]
Be careful with page_get_owner() now that owner field can be clobbered
by some users. Introduce get_page_owner_and_reference() where that can
be more useful.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoblktap: Allow creation of qcow2 files.
Keir Fraser [Tue, 3 Mar 2009 13:22:28 +0000 (13:22 +0000)]
blktap: Allow creation of qcow2 files.

Signed-off-by: Yang Zhang <yang.zhang@intel.com>
16 years agox86: Fix event-channel access for 32-bit HVM guests.
Keir Fraser [Tue, 3 Mar 2009 13:17:05 +0000 (13:17 +0000)]
x86: Fix event-channel access for 32-bit HVM guests.

Based on a patch by Joe Jin <joe.jin@oracle.com>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotxt: perform per-domain (and frametable and xenheap) MAC on entry into
Keir Fraser [Tue, 3 Mar 2009 12:48:16 +0000 (12:48 +0000)]
txt: perform per-domain (and frametable and xenheap) MAC on entry into
S3 and verification on resume.

The MAC algorithm is called VMAC and was developed by Ted Krovetz and
Wei Dai (more details are in the files).  It is based on a universal hash
function.  The universal hash is passed through a pseudo-random function,
implemented using AES.  More details can be found at
http://fastcrypto.org/vmac/. =
 The AES code comes from the OpenBSD implementation (which is derived
 from the implementation referenced in VMAC site).

As Xen does not have a good source of entropy to generate its own key
(for the keyed hash), it uses the key that tboot passes in.

Although the code attempts to MAC all of a domain's pages (code/data,
VT-d tables) based on its s3_integrity flag, some of a domain's memory may
always be MAC'ed, e.g. shadow page tables.  Only xenheap pages that are in
use are MAC'ed.  We believe that the memory MAC'ed by the Xen code and the
ranges passed to tboot to MAC cover all of the memory whose integrity needs
to be protected on S3.  Any suggestions or ranges that we missed are
welcome.

Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
16 years agotxt: Xen per-domain S3 integrity config
Keir Fraser [Tue, 3 Mar 2009 11:52:44 +0000 (11:52 +0000)]
txt: Xen per-domain S3 integrity config

This patch adds a per-domain flag to specify whether a domain will be
S3 integrity protected when Xen is launched using tboot/TXT.

The tools now support an integer domain configuration parameter called
's3_integrity', which defaults to 1, to enable S3 integrity protection.

The struct arch_domain structure has been extended to have an
's3_integrity' field that represents this setting.

Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
16 years agohvm: passthrough MSI-X: fix ia64 link and MSI-X clean up
Keir Fraser [Tue, 3 Mar 2009 11:46:52 +0000 (11:46 +0000)]
hvm: passthrough MSI-X: fix ia64 link and MSI-X clean up

This patch fixes the ia64 link error and some clean up of MSI-X code.
- add ia64 dummy function to link
- fix unmatched prototype
- add error check

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agolibxen: fix a problem preventing use of xen_event_register().
Keir Fraser [Tue, 3 Mar 2009 11:41:15 +0000 (11:41 +0000)]
libxen: fix a problem preventing use of xen_event_register().

The conversion of input parameter xen_string_set to XML format creates
a XML "struct" tag instead of "array". The patch sets the XML tag for
SET now to "array".

Signed-off-by: Lutz Dube <Lutz.Dube@fujitsu-siemens.com>
16 years agoxend: Make /var/lib/xen if not already present.
Keir Fraser [Tue, 3 Mar 2009 11:37:31 +0000 (11:37 +0000)]
xend: Make /var/lib/xen if not already present.
Signed-off-by: Christoph Egger <christoph.egger@amd.com>
16 years agoia64: fix build.
Keir Fraser [Mon, 2 Mar 2009 16:24:50 +0000 (16:24 +0000)]
ia64: fix build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoWhen a domain crashes, ignore shutdown deferrals.
Keir Fraser [Mon, 2 Mar 2009 14:09:21 +0000 (14:09 +0000)]
When a domain crashes, ignore shutdown deferrals.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: Minimize the TSC drift between pCPUs
Keir Fraser [Mon, 2 Mar 2009 13:56:47 +0000 (13:56 +0000)]
x86: Minimize the TSC drift between pCPUs
Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
16 years agovtd: boolean boot parameter to allow inclusive mapping of all memory below 4GB
Keir Fraser [Mon, 2 Mar 2009 11:23:23 +0000 (11:23 +0000)]
vtd: boolean boot parameter to allow inclusive mapping of all memory below 4GB

Signed-off-by: Ross Philipson <ross.philipson@citrix.com>
16 years agox86: Make offlined CPU enter deepest C state
Keir Fraser [Mon, 2 Mar 2009 11:11:19 +0000 (11:11 +0000)]
x86: Make offlined CPU enter deepest C state

Before cpuidle is introduced, offlined CPU only enter C1 (by HLT
instruction). This is not optimal since C2/C3 can bring more power
saving. Since now cpuidle is introduced, it is time for offlined CPU
to enter more deeper C state.

This patch add the logic to make offlined CPU enter deepest C state,
if cpuidle is enabled.

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Tian Kevin <kevin.tian@intel.com>
16 years agoxmexample: portability fix
Keir Fraser [Mon, 2 Mar 2009 11:04:43 +0000 (11:04 +0000)]
xmexample: portability fix

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoxen, pci: Fix the definition of PCI_PM_CTRL_NO_SOFT_RESET.
Keir Fraser [Mon, 2 Mar 2009 11:01:06 +0000 (11:01 +0000)]
xen, pci: Fix the definition of PCI_PM_CTRL_NO_SOFT_RESET.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agominios: general cleanup of mm.c
Keir Fraser [Mon, 2 Mar 2009 10:52:07 +0000 (10:52 +0000)]
minios: general cleanup of mm.c

Major clean up of mm.c. Added comments, fixed coding style, more
sensible variable names, mark some local functions static etc.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@netronome.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
16 years agominios: cleanup events.c
Keir Fraser [Mon, 2 Mar 2009 10:51:34 +0000 (10:51 +0000)]
minios: cleanup events.c

Don't throw away hypercall error codes. They might be useful. Also
some minor coding style cleanups.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@netronome.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
16 years agominios: add ioremap/iounmap
Keir Fraser [Mon, 2 Mar 2009 10:50:59 +0000 (10:50 +0000)]
minios: add ioremap/iounmap

Add ioremap and iounmap functions to minios. Also move some unmapping
code from and clean up mem_test.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@netronome.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
16 years agoxend: Fix removing /vm/UUID/device paths when device cannot be disconnected
Keir Fraser [Mon, 2 Mar 2009 10:34:37 +0000 (10:34 +0000)]
xend: Fix removing /vm/UUID/device paths when device cannot be disconnected

Change deviceDestroy behavior to remove /vm/UUID/device/...
path only when force was used (as it already does so for both frontend
and backend) and do the removing from xen-hotplug-cleanup script when we
are sure the device is really not attached to the guest any more.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
16 years agox86: Small fix for gpf when writing 1s to MCi_STATUS MSRs.
Keir Fraser [Mon, 2 Mar 2009 10:32:32 +0000 (10:32 +0000)]
x86: Small fix for gpf when writing 1s to MCi_STATUS MSRs.

According to spec, only 0s is allowed to be written. This error is
found when do cpu-offline, cmci happens.
For avoiding missing future cmci after changing cmci owner, we need to
process pending cmci errors to clear MCi_STATUS MSRs.

Signed-off-by: Ke Liping <liping.ke@intel.com>
Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
16 years agoacm: Return a valid buffer
Keir Fraser [Mon, 2 Mar 2009 10:31:16 +0000 (10:31 +0000)]
acm: Return a valid buffer

This patch reverts a previous patch trying to fix a memory, even
though I don't think there was any. Now return a valid buffer. All
functions calling this function do free the buffer.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
16 years agohvmloader: Make build fail if packages required to build hvmloader not present
Keir Fraser [Mon, 2 Mar 2009 10:30:15 +0000 (10:30 +0000)]
hvmloader: Make build fail if packages required to build hvmloader not present

Also, corrected the message generated by the makefile which says what
packages are required.

Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agohvm: passthrough MSI-X mask bit acceleration
Keir Fraser [Mon, 2 Mar 2009 10:26:37 +0000 (10:26 +0000)]
hvm: passthrough MSI-X mask bit acceleration

Add a new parameter to DOMCTL_bind_pt_irq to allow Xen to know the
guest physical address of MSI-X table. Also add a new MMIO intercept
handler to intercept that gpa in order to handle MSI-X vector mask
bit operation in the hypervisor. This reduces the load of device model
considerably if the guest does mask and unmask frequently

Signed-off-by: Qing He <qing.he@intel.com>
16 years agoxend: Fix some mistakes in tools/python/xend/util/pci.py
Keir Fraser [Mon, 2 Mar 2009 10:23:50 +0000 (10:23 +0000)]
xend: Fix some mistakes in tools/python/xend/util/pci.py

1) PCI_PM_CTRL_NO_SOFT_RESET: this is bit3 of PMCSR(Power Management
Control/Status). It should be 8. This bit means a device's capability
of not doing an internal reset across D3hot/D0.
If the bit is 1, there shall be no reset across D3hot/D0, so we should
not use it as a method to reset device.
2) When performing reset using standard FLR methods, we should sleep
at least 100ms; in current code, it's incorrect somewhere we sleep
0.2s and somewhere 0.01s.
3) In detect_dev_info(), fix a typo: PCI_EXP_TYPE_PCI_BRIDG ->
PCI_EXP_FLAGS_TYPE.
4) fix a small typo in the comment of transform_list().

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: Don't forget backend domain definitions for pvSCSI
Keir Fraser [Mon, 2 Mar 2009 10:22:23 +0000 (10:22 +0000)]
xend: Don't forget backend domain definitions for pvSCSI

Backend domain definitions for pvSCSI are forgotten.
This patch correctly handles them.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agox86, hvm: gcc44 build fix.
Keir Fraser [Sun, 1 Mar 2009 14:58:07 +0000 (14:58 +0000)]
x86, hvm: gcc44 build fix.

Broken constrain in inline asm.  Bytewise access works with a, b, c, d
registers only, thus "r" is wrong, it must be "q".  gcc 4.4 tries to
use the si register, which doesn't work and thus fails the build.

From: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxenstored: fix use-after free bug
Keir Fraser [Sun, 1 Mar 2009 14:50:04 +0000 (14:50 +0000)]
xenstored: fix use-after free bug

Problem:  Handling requests for one connection can not only zap the
connection itself, due to socket disconnects for example.  It can also
zap *other* connections, due to domain release requests.  Especially
it can zap the connection we have saved a pointer to in the "next"
variable.

From: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: Relax spinlock checks during shutdown or S3.
Keir Fraser [Sun, 1 Mar 2009 14:35:57 +0000 (14:35 +0000)]
x86: Relax spinlock checks during shutdown or S3.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86, time: fix S3 suspend error
Keir Fraser [Sun, 1 Mar 2009 14:30:35 +0000 (14:30 +0000)]
x86, time: fix S3 suspend error

platform_time_calibration() is invoked in S3 when irq is disabled,
which causes ASSERT() error in spin_lock_irq(). spin_lock_irqsave()
saves us.

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
16 years agox86, ioapic: Fix S3 suspend error.
Keir Fraser [Sun, 1 Mar 2009 14:17:08 +0000 (14:17 +0000)]
x86, ioapic: Fix S3 suspend error.

Invoke ioapic_pm_state_alloc() earlier,
thus avoiding check_lock() BUG_ON() in spin_lock().

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
16 years agoxenconsole: Fix pty handling
Keir Fraser [Fri, 20 Feb 2009 17:02:36 +0000 (17:02 +0000)]
xenconsole: Fix pty handling

I printed the terminal attributes after openpty() and they were
garbage on the first console, valid on the second etc.
openpty() gets garbage in (uninitialized attributes MODIFIED by
cfmakeraw()). It sets the slave to the attributes requested. Using
uninitialized data for cfmakeraw->openpty results in pty attributes
that may even have the receiver disabled. Closing the slave just hides
the bug as these attributes disappear and hope the slave will be
reopened and initialized.

From: Juergen Hannken-Illjes <hannken@netbsd.org>
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoxenconsoled: make guest console visible on NetBSD dom0
Keir Fraser [Fri, 20 Feb 2009 11:13:11 +0000 (11:13 +0000)]
xenconsoled: make guest console visible on NetBSD dom0

After openpty(), slave_fd must be closed or guest console output goes
to the slave while select() in xen console client listens on the
master.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years ago[VTD] Utilise the snoop control capability in shadow with VT-d code
Keir Fraser [Fri, 20 Feb 2009 11:11:40 +0000 (11:11 +0000)]
[VTD] Utilise the snoop control capability in shadow with VT-d code

We compute the shadow PAT index in leaf page entries now as:
1) No VT-d assigned: let shadow PAT index as WB, handled already
in shadow code before.
2) direct assigned MMIO area: let shadow code compute the shadow
PAT with gMTRR=UC and gPAT value.
3) Snoop control enable: let shadow PAT index as WB.
4) Snoop control disable:  let shadow code compute the shadow
PAT with gMTRR and gPAT, handled already in shadow code before

Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com>
16 years agolibxc: xc_ptrace cleanup
Keir Fraser [Fri, 20 Feb 2009 11:09:46 +0000 (11:09 +0000)]
libxc: xc_ptrace cleanup

There are some bugs in PTRACE_PEEK/POKE.
- can't track 2MB pages in 32bit pae mode.
- leakage of mmap/munmap.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agopygrub: parse xen module option in grub
Keir Fraser [Fri, 20 Feb 2009 11:08:31 +0000 (11:08 +0000)]
pygrub: parse xen module option in grub

Add function for GrubConf to parse xen module option in grub.
Pygrub should pass args as domUloader did.

Signed-off-by: Wei Kong <weikong.cn@gmail.com>
16 years agoAMD IOMMU: clean up spinlock usage to satisfy check_lock().
Keir Fraser [Fri, 20 Feb 2009 11:05:17 +0000 (11:05 +0000)]
AMD IOMMU: clean up spinlock usage to satisfy check_lock().

Signed-off-by: Wei Wang <wei.wang2@amd.com>
16 years agoxend: Fix exception in pci_convert_sxp_to_dict()
Keir Fraser [Thu, 19 Feb 2009 11:07:33 +0000 (11:07 +0000)]
xend: Fix exception in pci_convert_sxp_to_dict()

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
16 years agoxm: Some fixes for pvSCSI
Keir Fraser [Thu, 19 Feb 2009 11:01:15 +0000 (11:01 +0000)]
xm: Some fixes for pvSCSI

For xm create and xm new, an error may not occur even if wrong
vscsi configuration is given.

e.g.
  vscsi = [ '0:0:0:0,0:0:0:0', '0:0:0:0,1:0:0:0' ]

  # xm create vm1
  Using config file "/etc/xen/vm1".
  Started domain vm1 (id=8)
  # xm scsi-list vm1
  Idx BE  state host  phy-hctl   phy   vir-hctl   devstate
  0   0   1     0     0:0:0:0    sda   0:0:0:0    None
  1   0   1     0     0:0:0:0    sda   1:0:0:0    None

This patch fixes some problems such as the above.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agovt-d: workaround for Mobile Series 4 Chipset
Keir Fraser [Thu, 19 Feb 2009 10:59:43 +0000 (10:59 +0000)]
vt-d: workaround for Mobile Series 4 Chipset

Incorporated VT-d workaround for a sighting on Intel Mobile Series 4
chipset found in Linux iommu.  The sighting is the chipset is not
reporting write buffer flush capability correctly.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
16 years agopygrub: fix for NetBSD
Keir Fraser [Thu, 19 Feb 2009 10:53:46 +0000 (10:53 +0000)]
pygrub: fix for NetBSD

Signed-off-by: Frank van der Linden <frank.vanderlinden@sun.com>
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agox86: Fix xen panic when offlining a CPU.
Keir Fraser [Wed, 18 Feb 2009 08:59:26 +0000 (08:59 +0000)]
x86: Fix xen panic when offlining a CPU.

Also, fix a typo in a message. 'irq' => 'vector'

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agovtd: fix/cleanup minor issues with multi-page qinval support
Keir Fraser [Wed, 18 Feb 2009 08:57:56 +0000 (08:57 +0000)]
vtd: fix/cleanup minor issues with multi-page qinval support

Remove MAX_QINVAL_PAGES.  Rely on whoever changes NUM_QINVAL_PAGES to
change corresponding IQA_REG_QS value also.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
16 years agovtd, x86: Fix dom0 boot crash
Keir Fraser [Wed, 18 Feb 2009 08:56:31 +0000 (08:56 +0000)]
vtd, x86: Fix dom0 boot crash

Signed-off-by: Allen Kay allen.m.kay@intel.com
16 years agoia64: Fix the missing msi.h by accident, and enhance the check
Keir Fraser [Wed, 18 Feb 2009 08:53:52 +0000 (08:53 +0000)]
ia64: Fix the missing msi.h by accident, and enhance the check
for one BUG_ON.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
16 years agoAdd missing pv_ops Linux buildconfig file.
Keir Fraser [Tue, 17 Feb 2009 11:20:18 +0000 (11:20 +0000)]
Add missing pv_ops Linux buildconfig file.

16 years agopvSCSI, xend: add new device assignment mode
Keir Fraser [Tue, 17 Feb 2009 11:19:55 +0000 (11:19 +0000)]
pvSCSI, xend: add new device assignment mode

You can use "host" mode by specifying keyword "host" as virtual scsi
device. Following is usage example.

    xm scsi-attach 1 2:0:3:4 host

In this case, all LUNs under host=2 are attached to guest domain 1.
The channel=0, target=3 and lun=4 are ignored.

Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Signed-off-by: Jun Kamada <kama@jp.fujitsu.com>
16 years agoxend: Update VCPUs_live
Keir Fraser [Tue, 17 Feb 2009 11:13:34 +0000 (11:13 +0000)]
xend: Update VCPUs_live

XendConfig.py said about VCPUs_live as follows.

 -- the number of VCPUs currently up, as reported by Xen.

But the value of VCPUs_live always is 1 till xm vcpu-set get
executed.  This patch updates VCPUs_live by using online_vcpus.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agoxend: Improve information-gathering processing of SCSI devices by using lsscsi
Keir Fraser [Tue, 17 Feb 2009 11:12:50 +0000 (11:12 +0000)]
xend: Improve information-gathering processing of SCSI devices by using lsscsi

In the case of xm scsi-attach, when the SCSI devices are specified in
HCTL form or device name form, the processing is faster.

If lsscsi command is not installed, the processing works by using
information of /sys as before.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agoBUILD: Add option to build the Xen pvops git tree.
Keir Fraser [Tue, 17 Feb 2009 11:11:17 +0000 (11:11 +0000)]
BUILD: Add option to build the Xen pvops git tree.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
16 years agoia64: Enhance vt-d support for ia64.
Keir Fraser [Tue, 17 Feb 2009 11:10:00 +0000 (11:10 +0000)]
ia64: Enhance vt-d support for ia64.

This patch targets for enhancing vt-d support for ia64.
1. reserve enough memory for building dom0 vt-d page table.
2. build 1:1 vt-d page table according to system's mem map.
3. enable vt-d interrupt support for ia64.

Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agoxenpm tool: add average C state residency
Keir Fraser [Tue, 17 Feb 2009 11:08:31 +0000 (11:08 +0000)]
xenpm tool: add average C state residency

Signed-off-by: Yu Ke <ke.yu@intel.com>
16 years agovtd: clean up of __iommu_flush_iec()
Keir Fraser [Tue, 17 Feb 2009 11:07:29 +0000 (11:07 +0000)]
vtd: clean up of __iommu_flush_iec()

remove bogus global variable to make it local variable.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agopassthrough: fix MSI-X table fixmap allocation
Keir Fraser [Tue, 17 Feb 2009 11:06:16 +0000 (11:06 +0000)]
passthrough: fix MSI-X table fixmap allocation

Currently, msix table pages are allocated a fixmap page per vector,
the available fixmap pages will be depleted when assigning devices
with large number of vectors.  This patch fixes it, and a bug that
prevents cross-page MSI-X table from working properly

It now allocates msix table fixmap pages per device, if the table
entries of two msix vectors share the same page, it will only be
mapped to fixmap once. A ref count is maintained so that it can
be unmapped when all the vectors are freed.

Also changes the meaning of msi_desc->mask_base from the va of msix
table start to the va of the target entry. The former one is currently
buggy (it always maps the first page but msix can support up to 2048
entries) and can't handle separately allocated pages.

Signed-off-by: Qing He <qing.he@intel.com>
16 years agoFix typos in xendomains script.
Keir Fraser [Tue, 17 Feb 2009 11:04:08 +0000 (11:04 +0000)]
Fix typos in xendomains script.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agoMerge with ext/ia64/xen-unstable.hg
Keir Fraser [Tue, 17 Feb 2009 11:01:05 +0000 (11:01 +0000)]
Merge with ext/ia64/xen-unstable.hg

16 years ago[IA64] remove a warning.
Isaku Yamahata [Fri, 13 Feb 2009 10:11:38 +0000 (19:11 +0900)]
[IA64] remove a warning.

This patch remove the following warning.

mca.c:1928: warning: unused variable 'irq'

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years ago[IA64] remove the warning.
Isaku Yamahata [Fri, 13 Feb 2009 10:07:17 +0000 (19:07 +0900)]
[IA64] remove the warning.

iommu.c:891: warning: implicit declaration of function 'free_irq_vector'

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years ago[IA64] fix relinquish_memory()
Isaku Yamahata [Fri, 13 Feb 2009 10:03:37 +0000 (19:03 +0900)]
[IA64] fix relinquish_memory()

This patch fixes the following panic.

(XEN) Assertion 'entry->prev->next == entry' failed, line 170, file xen-unstable.hg/xen/include/xen/list.h
(XEN) Xen BUG at xen-unstable.hg/xen/include/xen/list.h:170
(XEN) FIXME: implement ia64 dump_execution_state()
(XEN)
(XEN) Call Trace:
(XEN)  [<f400000004104670>] show_stack+0x90/0xb0
(XEN)                                 sp=f0000002f64cfbf0 bsp=f0000002f64c9918
(XEN)  [<f400000004105180>] dump_stack+0x30/0x50
(XEN)                                 sp=f0000002f64cfdc0 bsp=f0000002f64c98f8
(XEN)  [<f400000004064ac0>] __bug+0x70/0xa0
(XEN)                                 sp=f0000002f64cfdc0 bsp=f0000002f64c98c8
(XEN)  [<f400000004031290>] free_domheap_pages+0x380/0x700
(XEN)                                 sp=f0000002f64cfdc0 bsp=f0000002f64c9868
(XEN)  [<f4000000040ac470>] domain_page_flush_and_put+0x1c0/0x550
(XEN)                                 sp=f0000002f64cfdc0 bsp=f0000002f64c9820
(XEN)  [<f4000000040ac990>] domain_put_page+0x190/0x530
(XEN)                                 sp=f0000002f64cfdd0 bsp=f0000002f64c97b0
(XEN)  [<f4000000040ad060>] zap_domain_page_one+0x330/0x530
(XEN)                                 sp=f0000002f64cfde0 bsp=f0000002f64c9710
(XEN)  [<f4000000040ad570>] dom0vp_zap_physmap+0x70/0xe0
(XEN)                                 sp=f0000002f64cfdf0 bsp=f0000002f64c96d8
(XEN)  [<f4000000040838f0>] do_dom0vp_op+0x320/0x7b0
(XEN)                                 sp=f0000002f64cfdf0 bsp=f0000002f64c9690
(XEN)  [<f400000004002e60>] fast_hypercall+0x170/0x310
(XEN)                                 sp=f0000002f64cfe00 bsp=f0000002f64c9690
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 2:
(XEN) Xen BUG at xen-unstable.hg/xen/include/xen/list.h:170
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...
(XEN) Debugging connection not set up.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agox86: Clean up vpt-align patch.
Keir Fraser [Fri, 13 Feb 2009 09:48:56 +0000 (09:48 +0000)]
x86: Clean up vpt-align patch.

Also disable by default if not specified in domain config. Otherwise
the feature would be incorrectly enabled for old saved domain images.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvm: Align periodic vpts.
Keir Fraser [Fri, 13 Feb 2009 09:43:06 +0000 (09:43 +0000)]
hvm: Align periodic vpts.

Aligned periodic vpts can improve the HVM guest power consumption a
lot, especially while the guest using high HZ such as 1000HZ.

Signed-off-by: Wei Gang <gang.wei@intel.com>