xen.git
17 years agoRe-enable MSI support
Keir Fraser [Thu, 11 Dec 2008 11:48:19 +0000 (11:48 +0000)]
Re-enable MSI support

Currently the MSI is disabled because of some lock issue. This patch
tries to clean up the locking related to MSI lock.

Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
17 years agox86: fix the potential of encountering panic "IO-APIC + timer doesn't work! ..."
Keir Fraser [Thu, 11 Dec 2008 11:40:10 +0000 (11:40 +0000)]
x86: fix the potential of encountering panic "IO-APIC + timer doesn't work! ..."

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Linux commit:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=4aae07025265151e3f7041dfbf0f529e122de1d8

x86: fix "Kernel panic - not syncing: IO-APIC + timer doesn't work!"

Under rare circumstances we found we could have an IRQ0 entry while we
are in the middle of setting up the local APIC, the i8259A and the
PIT. That is certainly not how it's supposed to work! check_timer()
was supposed to be called with irqs turned off - but this eroded away
sometime in the past. This code would still work most of the time
because this code runs very quickly, but just the right timing
conditions are present and IRQ0 hits in this small, ~30 usecs window,
timer irqs stop and the system does not boot up. Also, given how early
this is during bootup, the hang is very deterministic - but it would
only occur on certain machines (and certain configs).

The fix was quite simple: disable/restore interrupts properly in this
function. With that in place the test-system now boots up just fine.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: unify local_irq_XXX()
Keir Fraser [Thu, 11 Dec 2008 11:36:00 +0000 (11:36 +0000)]
x86: unify local_irq_XXX()

This also removes an inconsistency in that x86-64's __save_flags() had
a memory clobber, while x86_32's didn't.

It further adds type checking since blindly using {pop,push}{l,q} on a
memory operand of unknown size bares the risk of corrupting other
data.

Finally, it eliminates the redundant (with local_irq_restore())
__restore_flags() macro and renames __save_flags() to
local_save_flags(), making the naming consistent with Linux (again?).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agorombios: fix rom_scan (ja->jmp)
Keir Fraser [Thu, 11 Dec 2008 11:32:39 +0000 (11:32 +0000)]
rombios: fix rom_scan (ja->jmp)

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
17 years agoFix a typo caused by 18898.
Keir Fraser [Thu, 11 Dec 2008 11:30:13 +0000 (11:30 +0000)]
Fix a typo caused by 18898.

new state is updated too early.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
17 years agocpufreq: Short path avoiding IPI in critical fast path.
Keir Fraser [Thu, 11 Dec 2008 11:27:49 +0000 (11:27 +0000)]
cpufreq: Short path avoiding IPI in critical fast path.
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agolibxc: Fix xc_pm.c build by avoiding bogus header includes.
Keir Fraser [Thu, 11 Dec 2008 11:19:27 +0000 (11:19 +0000)]
libxc: Fix xc_pm.c build by avoiding bogus header includes.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoFix BUILD_BUG_ON()
Keir Fraser [Thu, 11 Dec 2008 11:19:01 +0000 (11:19 +0000)]
Fix BUILD_BUG_ON()

As was noticed on the Linux side, using an array here isn't appropriate
if the condition is not a compile time constant - gcc allows such
arrays, and hence the intended effect of producing a compiler error is
not achieved in that case. Bit field widths do not know similar
language extensions, and hence always produce a compiler error.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoAvoid negative runstate pieces.
Keir Fraser [Wed, 10 Dec 2008 14:05:41 +0000 (14:05 +0000)]
Avoid negative runstate pieces.

Also consolidate all places to get cpu idle time.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoInitialize state_entry_time to zero for all idle vcpus
Keir Fraser [Wed, 10 Dec 2008 13:41:34 +0000 (13:41 +0000)]
Initialize state_entry_time to zero for all idle vcpus

NOW() is not usable since xen time sub-system hasn't
been initialized yet. On my box, it gives a initial
stamp ~60s due to local tsc stamp as zero and TSC
count is started from power on. Then a negative value
is added to runstate of that idle vcpu at schedule
point. The net effect is for some tool like xenpm
to show a big idle time gap between BSP and other APs.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Make MCE panic message more obvious
Keir Fraser [Wed, 10 Dec 2008 13:30:10 +0000 (13:30 +0000)]
x86: Make MCE panic message more obvious

Make it more obvious to the untrained user that machine check reboots
are hardware faults, rather then just saying "CPU context corrupt".

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agogdbserver: Fix build failure.
Keir Fraser [Wed, 10 Dec 2008 13:28:58 +0000 (13:28 +0000)]
gdbserver: Fix build failure.

From: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoAdd user PM control interface
Keir Fraser [Wed, 10 Dec 2008 13:27:41 +0000 (13:27 +0000)]
Add user PM control interface

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agoAdd cpufreq governors: performance, powersave, userspace
Keir Fraser [Wed, 10 Dec 2008 13:27:14 +0000 (13:27 +0000)]
Add cpufreq governors: performance, powersave, userspace

This patch add 3 more governors beside original running ondemand
cpufreq governor.
performance governor is with best performance, keeping cpu always
running at highest freq;
powersave governor is with best power save effect, keeping cpu always
running at lowest freq;
userspace governor provide user setting freq ability;

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agolibxc: Fix memory leak in zlib usage
Keir Fraser [Wed, 10 Dec 2008 13:14:13 +0000 (13:14 +0000)]
libxc: Fix memory leak in zlib usage

Any call to inflate() must be followed by inflateEnd(), otherwise the
internal zlib state is leaked.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
17 years agoUse virtual 8086 mode for VMX guests with CR0.PE == 0
Keir Fraser [Tue, 9 Dec 2008 16:28:02 +0000 (16:28 +0000)]
Use virtual 8086 mode for VMX guests with CR0.PE == 0

When a VMX guest tries to enter real mode, put it in virtual 8086 mode
instead, if that's possible.  Handle all errors and corner cases by
falling back to the real-mode emulator.

This is similar to the old VMXASSIST system except it uses Xen's
x86_emulate emulator instead of having a partial emulator in the guest
firmware.  It more than doubles the speed of real-mode operation on
VMX.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agovga: Fix screen clear at end of Xen bootstrap.
Keir Fraser [Tue, 9 Dec 2008 13:23:15 +0000 (13:23 +0000)]
vga: Fix screen clear at end of Xen bootstrap.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agopv-on-hvm: add pvSCSI frontend
Keir Fraser [Tue, 9 Dec 2008 13:06:19 +0000 (13:06 +0000)]
pv-on-hvm: add pvSCSI frontend

Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Jun Kamada <kama@jp.fujitsu.com>
17 years agopv-on-hvm: fix for Centos 5.2
Keir Fraser [Tue, 9 Dec 2008 13:00:52 +0000 (13:00 +0000)]
pv-on-hvm: fix for Centos 5.2

From: Yoshisato YANAGISAWA <yanagisawa.yoshisato@lab.ntt.co.jp>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoVT-d: check return value of pirq_guest_bind()
Keir Fraser [Tue, 9 Dec 2008 12:55:29 +0000 (12:55 +0000)]
VT-d: check return value of pirq_guest_bind()

The eliminates a hypervisor crash when the respective domain dies or
gets the device hot removed.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Reviewed-by: Weidong Han <weidong.han@intel.com>
17 years agotools: Fix a few error-path memory leaks.
Keir Fraser [Tue, 9 Dec 2008 12:53:19 +0000 (12:53 +0000)]
tools: Fix a few error-path memory leaks.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxend: Remember bootable flag for vbds in xenstore
Keir Fraser [Tue, 9 Dec 2008 12:45:45 +0000 (12:45 +0000)]
xend: Remember bootable flag for vbds in xenstore

When xend is restarted, bootable flags of all disk devices are lost
and then the first disk is marked as bootable by a "compatibility
hack". When a guest domain is created with a mixture of several vbd
and tap devices, the compatibility hack may fail to choose the right
bootable device. Thus preventing the guest to be restarted. This patch
fixes this behavior by remembering bootable flag for each disk device
in xenstore database.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
17 years agoxend: Fix memory allocation bug after hvm reboot in numa system
Keir Fraser [Tue, 9 Dec 2008 12:44:32 +0000 (12:44 +0000)]
xend: Fix memory allocation bug after hvm reboot in numa system

Recently we find a bug on Nahelem machine (totally with two nodes, 6G
memory (3G in each node):
- Start a HVM guest with its all VCPUS pinned to node1, so all its
memory is allocated from node1.
- Reboot the HVM.
- There will be some memory allocated from node0 even there is enough
free memory on node1.

Reason: For security issues, xen will not put all the pages of a dying
hvm to domheap directly, but put them in scrub list and wait for handled
by page_scrub_softirq(). If the dying hvm have a lot of memory,
page_scrub_softirq() will not handle all of them before the start the
hvm. There are some pages belong to node1 still in scrub list, new hvm
can't use pages in it. So this hvm will get different memory
distribution than before. Before changeset 18304, page_scrub_softirq()
can be excuted parallel between all the cpus. Changeset 18305
serialise page_scrub_softirq() and Changeset 18307 serialise
page_scrub_softirq() with a new lock to avoid holding up acquiring
page_scrub_lock in free_domheap_pages(). Those changeset slow the ability
to handle pages in scrub list. So the bug becomes more obvious after.

Patch: This patch modifiers balloon.free to avoid this bug. After
patch, balloon.free will check whether current machine is a numa
system and the new created hvm has all its vcpus in the same node. If
all the conditions above fit, we will wait until all the pages in
scrub list are freed (if waiting time go beyond 20s, we will stop
waiting it.).

This seems to be too restricted at the first glance. We used to only
wait for the free memory size of pinned node is bigger than
required. But as we know HVM memory alloction granularity is 2M. Even
the former condition is satisfied, we still may not find enough
2M-size memory on that node.

Signed-off-by: Ting Zhou <ting.g.zhou@intel.com>
Signed-off-by: Xiaowei Yang <Xiaowei.yang@intel.com>
17 years agolibxc: Fix gcc 4.3 build failure
Keir Fraser [Tue, 9 Dec 2008 12:42:18 +0000 (12:42 +0000)]
libxc: Fix gcc 4.3 build failure

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
17 years agorombios: support BCV
Keir Fraser [Tue, 9 Dec 2008 12:41:12 +0000 (12:41 +0000)]
rombios: support BCV

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
17 years agoFix domain save when guest is in S3.
Keir Fraser [Fri, 5 Dec 2008 15:54:22 +0000 (15:54 +0000)]
Fix domain save when guest is in S3.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: make an error message more precise
Keir Fraser [Fri, 5 Dec 2008 15:24:12 +0000 (15:24 +0000)]
x86: make an error message more precise

... allowing to distinguish whether the to be added or the already
existing PIRQ binding is causing the failure.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agocpufreq: allow customization of some parameters
Keir Fraser [Fri, 5 Dec 2008 15:23:32 +0000 (15:23 +0000)]
cpufreq: allow customization of some parameters

Short of having a way for powersaved to dynamically adjust these
values, at least allow specifying them on the command line. In
particular, always running at an up-threshold of 80% is perhaps nice
for laptop use, but certainly not desirable on servers. On shell
scripts invoking large numbers of short-lived processes I noticed a
50% performance degradation on a dual-socket quad-core Barcelona just
because of the load of an individual core never crossing the 80%
boundary that would have resulted in increasing the frequency.

(Powersaved on SLE10 sets this on native kernels to 60% or 80%,
depending on whether performance or power reduction is preferred,
*divided* by the number of CPUs, but capped at the lower limit of
20%.)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86/cpufreq: reduce verbosity
Keir Fraser [Fri, 5 Dec 2008 15:22:43 +0000 (15:22 +0000)]
x86/cpufreq: reduce verbosity

These messages don't exist in powernow's equivalent code, and are
pretty useless anyway, hence just cluttering the logs.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agopowernow: implement struct cpufreq_driver.verify
Keir Fraser [Fri, 5 Dec 2008 15:22:21 +0000 (15:22 +0000)]
powernow: implement struct cpufreq_driver.verify

Without this, under rare conditions hypervisor crashes are possible
due to this method being called without checking against NULL.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86/32on64: adjust address when converting syscall to fault
Keir Fraser [Fri, 5 Dec 2008 15:21:59 +0000 (15:21 +0000)]
x86/32on64: adjust address when converting syscall to fault

The faulting address is at the start of the syscall instruction rather
than at the following one.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86, time: Fix scale_reciprocal().
Keir Fraser [Fri, 5 Dec 2008 14:46:38 +0000 (14:46 +0000)]
x86, time: Fix scale_reciprocal().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agominios: Clip memory not usable by Mini-OS (above 1GB)
Keir Fraser [Fri, 5 Dec 2008 13:06:57 +0000 (13:06 +0000)]
minios: Clip memory not usable by Mini-OS (above 1GB)

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 years agocpuidle: revise tsc-save/restore to reduce tsc skew between cpus
Keir Fraser [Fri, 5 Dec 2008 13:03:44 +0000 (13:03 +0000)]
cpuidle: revise tsc-save/restore to reduce tsc skew between cpus

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovga: Clear the screen when relinquishing VGA to dom0.
Keir Fraser [Fri, 5 Dec 2008 11:37:20 +0000 (11:37 +0000)]
vga: Clear the screen when relinquishing VGA to dom0.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxentrace: trace interrupt window
Keir Fraser [Fri, 5 Dec 2008 11:05:45 +0000 (11:05 +0000)]
xentrace: trace interrupt window

Make a specific interrupt-window trace, with information about why the
interrupt in question can't be delivered.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
17 years agoVT-d code cleanup
Keir Fraser [Fri, 5 Dec 2008 10:59:41 +0000 (10:59 +0000)]
VT-d code cleanup

This patch narrow context caching flush range from the
domain-selective to the device-selective, when unmapping a device.

Signed-off-by: Yu Zhao <yu.zhao@intel.com>
17 years agomerge with xen-unstable.hg
Isaku Yamahata [Fri, 5 Dec 2008 06:47:19 +0000 (15:47 +0900)]
merge with xen-unstable.hg

17 years agoIA64: implement PHYSDEVOP_pirq_eoi_gmfn and related stuff.
Isaku Yamahata [Fri, 5 Dec 2008 06:43:08 +0000 (15:43 +0900)]
IA64: implement PHYSDEVOP_pirq_eoi_gmfn and related stuff.

This patch is ia64 counter part of 18844:c820bf73a914.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agoIA64: eliminate NR_IRQ_VECTORS. ia64 part.
Isaku Yamahata [Fri, 5 Dec 2008 06:43:06 +0000 (15:43 +0900)]
IA64: eliminate NR_IRQ_VECTORS. ia64 part.

This is ia64 counter part of 18802:935bd48f096a which eliminates
NR_IRQ_VECTORS.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agodocs: Add description of BUILD_BUG_ON().
Keir Fraser [Thu, 4 Dec 2008 16:36:43 +0000 (16:36 +0000)]
docs: Add description of BUILD_BUG_ON().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoFix one timer range issue
Keir Fraser [Thu, 4 Dec 2008 14:12:08 +0000 (14:12 +0000)]
Fix one timer range issue

According to the timer sematic, the timer can be executed at any timer
within [expires, expires_end], however, current implementation only allow
timer to be executed after expires_end, which is not conform to the timer
semantics.

This patch fix the the SPECpower score regression (~5% downgrade)
introduced by changeset 18744 "Change timer implementation to allow
variable 'slop'"

Signed-off-by: Yu Ke <ke.yu@intel.com>
17 years agoNew document on error handling in Xen.
Keir Fraser [Thu, 4 Dec 2008 12:35:22 +0000 (12:35 +0000)]
New document on error handling in Xen.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoFix existence check for MMIO-mapped 16550 UARTs
Keir Fraser [Thu, 4 Dec 2008 11:36:18 +0000 (11:36 +0000)]
Fix existence check for MMIO-mapped 16550 UARTs

Changeset 982e6fce0e47 added an existence test for UARTs.
Unfortunately, the existence test happens before MMIO UARTs are
ioremapped, therefore it may not be probing where it thinks it's
probing.  Rather than moving more code around, I think it's probably
safe to assume the arch code knows what it's doing if it passes in an
MMIO UART.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
17 years agoxm: Fix xm block-list for inactive managed domains
Keir Fraser [Thu, 4 Dec 2008 11:32:43 +0000 (11:32 +0000)]
xm: Fix xm block-list for inactive managed domains

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agoxend: Remember bootloader settings in xenstore
Keir Fraser [Thu, 4 Dec 2008 11:31:37 +0000 (11:31 +0000)]
xend: Remember bootloader settings in xenstore

When xend is restarted, bootloader settings of all running domains are
lost. The attached patches fixes this by saving bootloader and
bootloader_args to xenstore database.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
17 years agomerge with xen-unstable.hg
Isaku Yamahata [Thu, 4 Dec 2008 02:01:53 +0000 (11:01 +0900)]
merge with xen-unstable.hg

17 years agoxentop: Fix xentop for blktap
Keir Fraser [Wed, 3 Dec 2008 15:58:23 +0000 (15:58 +0000)]
xentop: Fix xentop for blktap

Blktap devices information isn't shown by xentop currently.

xen-unstable c/s 17813 said "blktap devices have statistics
counters (e.g., rd_req, wr_req, oo_req) prepended by tap_".
In fact, it is as follows.

# ls -l /sys/devices/xen-backend/tap-1-769/statistics/
total 0
-r--r--r-- 1 root root 4096 Dec  3 20:37 oo_req
-r--r--r-- 1 root root 4096 Dec  3 20:37 rd_req
-r--r--r-- 1 root root 4096 Dec  3 20:37 rd_sect
-r--r--r-- 1 root root 4096 Dec  3 20:37 wr_req
-r--r--r-- 1 root root 4096 Dec  3 20:37 wr_sect

The statistics counters haven't had "tap_" because it was removed
by linux-2.6.18-xen c/s 34.

This patch reverts xen-unstable c/s 17813, then we can get the
blktap devices information by using xentop.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agoAMD IOMMU: Invalidate all pages on domain destruction
Keir Fraser [Wed, 3 Dec 2008 15:56:33 +0000 (15:56 +0000)]
AMD IOMMU: Invalidate all pages on domain destruction

Attached patch adds support to invalidate all pages associated with
the same domain ID on domain destruction.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
17 years agoAMD IOMMU: Propagate HyperTransport settings from IVHD table to control register
Keir Fraser [Wed, 3 Dec 2008 15:56:05 +0000 (15:56 +0000)]
AMD IOMMU: Propagate HyperTransport settings from IVHD table to control register

Attached patch propagate HyperTransport settings suggested by IVHD
table to iommu control register(MMIO offset 0018h).

Signed-off-by: Wei Wang <wei.wang2@amd.com>
17 years agoAMD IOMMU: Fix event log interrupt handling
Keir Fraser [Wed, 3 Dec 2008 15:55:32 +0000 (15:55 +0000)]
AMD IOMMU: Fix event log interrupt handling

Reset EventLogInt bit in iommu status register(MMIO offset 2020h) in
event log interrupt handler, to show software has handled the
interrupt. Completion wait interrupt is disabled.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
17 years agoFix the HVM save hypercall to avoid freeing an uninitalised pointer.
Keir Fraser [Wed, 3 Dec 2008 15:54:24 +0000 (15:54 +0000)]
Fix the HVM save hypercall to avoid freeing an uninitalised pointer.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
17 years agoDo not request domain shutdown if in S3 state during domain save.
Keir Fraser [Wed, 3 Dec 2008 15:12:19 +0000 (15:12 +0000)]
Do not request domain shutdown if in S3 state during domain save.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agophysdev: make PHYSDEVOP_pirq_eoi_mfn use of gmfn instead of mfn.
Keir Fraser [Wed, 3 Dec 2008 11:44:47 +0000 (11:44 +0000)]
physdev: make PHYSDEVOP_pirq_eoi_mfn use of gmfn instead of mfn.

To pass a page from a guest to hypervisor, gmfn should be used
instead of mfn like grant table and other hypercalls. It's more
consistent. So make use of gmfn instead of mfn for
PHYSDEVOP_pirq_eoi_mfn hypercall.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix mfn_to_virt() to cast MFN to address size.
Keir Fraser [Wed, 3 Dec 2008 11:38:36 +0000 (11:38 +0000)]
x86: Fix mfn_to_virt() to cast MFN to address size.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: No need for short jmp before long hjmp when setting CR0.PE
Keir Fraser [Wed, 3 Dec 2008 11:21:34 +0000 (11:21 +0000)]
x86: No need for short jmp before long hjmp when setting CR0.PE
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoIA64: Rationalize VMM mode alignment checking
Isaku Yamahata [Wed, 3 Dec 2008 02:43:54 +0000 (11:43 +0900)]
IA64: Rationalize VMM mode alignment checking

This is the xen port of ia64 linux chageset of
b704882e70d87d7f56db5ff17e2253f3fa90e4f3

    [IA64] Rationalize kernel mode alignment checking

    Itanium processors can handle some misaligned data accesses. They
    also provide a mode where all such accesses are forced to trap. The
    kernel was schizophrenic about use of this mode:

    * Base kernel code ran in permissive mode where the only traps
      generated were from those cases that the h/w could not handle.
    * Interrupt, syscall and trap code ran in strict mode where all
      unaligned accesses caused traps to the 0x5a00 unaligned reference
      vector.

    Use strict alignment checking throughout the kernel, but make
    sure that we continue to let user mode use more relaxed mode
    as the default.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agoxenpmd: Adjust strncat() length to avoid static buffer overflow.
Keir Fraser [Tue, 2 Dec 2008 22:17:22 +0000 (22:17 +0000)]
xenpmd: Adjust strncat() length to avoid static buffer overflow.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoFix Xen panic with oprofile
Keir Fraser [Tue, 2 Dec 2008 11:53:24 +0000 (11:53 +0000)]
Fix Xen panic with oprofile

The attached patch fixes a Xen panic when a domain is shutdown before
oprofile is stopped. Without this patch, free_xenoprof_pages() is
called before the domain is destroyed and that, in turn, prevents
oprofile from cleaning up pages shared with guests. Shutting down a
domain without terminating oprofile therefore causes a Xen panic at a
later point in time.

Signed-off-by: Niraj Tolia <niraj.tolia@hp.com>
17 years agopvgrub: value returned by getrtsecs should be BCD
Keir Fraser [Mon, 1 Dec 2008 13:45:46 +0000 (13:45 +0000)]
pvgrub: value returned by getrtsecs should be BCD

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix PHYSDEVOP_pirq_eoi_mfn, which I modified and broke.
Keir Fraser [Sat, 29 Nov 2008 09:07:52 +0000 (09:07 +0000)]
x86: Fix PHYSDEVOP_pirq_eoi_mfn, which I modified and broke.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: remove unused parameter/arguments from flush_ready_eoi()
Keir Fraser [Fri, 28 Nov 2008 13:28:16 +0000 (13:28 +0000)]
x86: remove unused parameter/arguments from flush_ready_eoi()

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: add a shared page indicating the need for an EOI notification
Keir Fraser [Fri, 28 Nov 2008 13:27:32 +0000 (13:27 +0000)]
x86: add a shared page indicating the need for an EOI notification

To simplify the interface for the guest, when a guest uses this new
(sub-)hypercall, PHYSDEVOP_eoi behavior changes to unmask the
corresponding event channel at once, avoiding the eventual need for a
second hypercall from the guest.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxend: Fix device release for tap devices
Keir Fraser [Fri, 28 Nov 2008 13:05:58 +0000 (13:05 +0000)]
xend: Fix device release for tap devices

I saw an error message when I shut down a domain.  The error
message showed that release of device(vbd/51712) failed.  But the
device was tap, was not vbd.  I think that a cause of the error message is
because _releaseDevices() calls destroyDevice() by wrong device class.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
17 years agoxm: Relax the sanity check on guest configuration with XSM-ACM addlabel
Keir Fraser [Fri, 28 Nov 2008 13:04:30 +0000 (13:04 +0000)]
xm: Relax the sanity check on guest configuration with XSM-ACM addlabel

The attached patch relaxes the sanity check on guest configuration
when assigning a acm label to the guest. This patch makes a guest
configuration accept a bootloader parameter. This is common for
paravirtualized guests to boot them by using pygrub.

Signed-off-by: INAKOSHI Hiroya <inakoshi.hiroya@jp.fujitsu.com>
17 years agoshadow: fix the fix for promotion/resync race.
Keir Fraser [Fri, 28 Nov 2008 12:02:43 +0000 (12:02 +0000)]
shadow: fix the fix for promotion/resync race.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
17 years agox86_emulate: Fix for test harness and simplify some opcodes.
Keir Fraser [Thu, 27 Nov 2008 16:22:14 +0000 (16:22 +0000)]
x86_emulate: Fix for test harness and simplify some opcodes.

 - Need to use EFLG_DF rather than EF_DF
 - No need to force EAX destination for many opcodes, as this will be
   the default behaviour for DstReg with no ModRM.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoAvoid warn_unused_result build failure on fgets().
Keir Fraser [Thu, 27 Nov 2008 12:43:25 +0000 (12:43 +0000)]
Avoid warn_unused_result build failure on fgets().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, hpet: check hpet existence
Keir Fraser [Thu, 27 Nov 2008 11:24:52 +0000 (11:24 +0000)]
x86, hpet: check hpet existence

Add check on hpet existence which is removed accidentally
in previous changeset (18790). Or else BAD PERIOD error can be seen.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
17 years agoVT-d code cleanup
Keir Fraser [Thu, 27 Nov 2008 11:22:38 +0000 (11:22 +0000)]
VT-d code cleanup

- remove a printk line. This printk may be output too many on some
  platforms, thus result in hang during dom0 booting.
- add write buffer flush in domain_context_unmap_one()
- when map/unmap context, if context is not flushed, needn't to flush
  iotlb

Signed-off-by: Weidong Han <weidong.han@intel.com>
17 years agoshadow: set fast_emul to zero when emulating to an out-of-sync page.
Keir Fraser [Thu, 27 Nov 2008 11:21:19 +0000 (11:21 +0000)]
shadow: set fast_emul to zero when emulating to an out-of-sync page.

A small missing thing on the original out of sync patch.
No real bug, but it's better to correctly specify the path.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
17 years agoMerge with ia64 tree.
Keir Fraser [Wed, 26 Nov 2008 11:14:26 +0000 (11:14 +0000)]
Merge with ia64 tree.

17 years agotimer: Print timer fn when dump timer queue
Keir Fraser [Wed, 26 Nov 2008 11:11:26 +0000 (11:11 +0000)]
timer: Print timer fn when dump timer queue

Print timer fn when dump timer queue, which would be
useful to understand type of the timer.

Signed-off-by Kevin Tian <kevin.tian@intel.com>

17 years agovtd: cleanups
Keir Fraser [Wed, 26 Nov 2008 11:08:45 +0000 (11:08 +0000)]
vtd: cleanups

 - potential issues in vtd_page_fault() handler
 - wrong print messages
 - existing ATS code in dmar.c.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
17 years agoxen: Fix gcc 4.3 build failure.
Keir Fraser [Wed, 26 Nov 2008 11:07:44 +0000 (11:07 +0000)]
xen: Fix gcc 4.3 build failure.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agomerge with xen-unstable.hg
Isaku Yamahata [Wed, 26 Nov 2008 01:23:49 +0000 (10:23 +0900)]
merge with xen-unstable.hg

17 years agoFix PSE PAT handling in guest walk.
Keir Fraser [Tue, 25 Nov 2008 11:17:57 +0000 (11:17 +0000)]
Fix PSE PAT handling in guest walk.

Guest walk was currently checking for _PAGE_PSE_PAT flag in
guest_l2e_get_flags(). The problem is that this function only checks
for the first 12 bits of the PDE, while _PAGE_PSE_PAT is actually on bit
12 (that is the 13th bit). This caused _PAGE_PAT bit to never been set on
splintered L1s.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
17 years agomerge with xen-unstable.hg
Isaku Yamahata [Tue, 25 Nov 2008 05:21:24 +0000 (14:21 +0900)]
merge with xen-unstable.hg

17 years agohvmloader: Pass BDF to PCI option ROMs.
Keir Fraser [Mon, 24 Nov 2008 13:57:48 +0000 (13:57 +0000)]
hvmloader: Pass BDF to PCI option ROMs.

Signed-off-by: Shan Haitao <Haitao.shan@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agohvmloader: Load physical PCI option ROMs where available.
Keir Fraser [Mon, 24 Nov 2008 13:43:28 +0000 (13:43 +0000)]
hvmloader: Load physical PCI option ROMs where available.

Signed-off-by: Shan Haitao <Haitao.shan@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agohvmloader: Relocate the etherboot ROM to be near the end of VGA
Keir Fraser [Mon, 24 Nov 2008 11:17:44 +0000 (11:17 +0000)]
hvmloader: Relocate the etherboot ROM to be near the end of VGA
BIOS. Current Xen hard coded VGA ROM at 0xC0000 and etherboot ROM
at 0xD0000. This makes the space in [0xC0000 - 0xDFFFF] to be
fragments, which makes it hard to find enough space to hold another
Option ROM.

Signed-off-by: Shan Haitao <haitao.shan@intel.com>
17 years agoshadow: fix race between resync and page promotion.
Keir Fraser [Mon, 24 Nov 2008 11:12:20 +0000 (11:12 +0000)]
shadow: fix race between resync and page promotion.

This patch fixes a (hopefully) rare-occurring problem causing memory
corruption in 64 bit guests (and assertion failures in debug build
xen).

On a pagefault, set_l{3,4}e's resync_all was able to give write access
to a page in the guest still not shadowed.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
17 years agopv-on-hvm drivers: build fixes for Linux 2.6.27+
Keir Fraser [Mon, 24 Nov 2008 11:11:20 +0000 (11:11 +0000)]
pv-on-hvm drivers: build fixes for Linux 2.6.27+

Make the drivers build properly in a 2.6.27 environment as well as
against a kernel with pv-ops Xen configured on (in the latter case
more work would be needed to also make the drivers work, as there's a
large number of duplicate exports).

Portions from Charles Arnold <carnold@novell.com>.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoPCI interface changes for PCIE-AER enabling
Keir Fraser [Mon, 24 Nov 2008 11:06:16 +0000 (11:06 +0000)]
PCI interface changes for PCIE-AER enabling

This patch reflects some pci interface changes in pciif.h in XEN head
file. And also add domain shutdown support in xend for shutting domain
from DOM0 kernel when non-recoverable uncorrected pci error happens.

Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Ke Liping <liping.ke@intel.com>
17 years agox86: make NR_IRQS build-time configurable
Keir Fraser [Thu, 20 Nov 2008 14:23:59 +0000 (14:23 +0000)]
x86: make NR_IRQS build-time configurable

While keeping the NR_IRQS default at 256 here, I think it would be a
good thing to set it to a higher value to make sure no new mixing of
irq and vector spaces slip in.

Tested with NR_IRQS forced to 1024.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoEliminate NR_IRQ_VECTORS
Keir Fraser [Thu, 20 Nov 2008 14:23:33 +0000 (14:23 +0000)]
Eliminate NR_IRQ_VECTORS

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoProperly distinguish irq and vector spaces
Keir Fraser [Thu, 20 Nov 2008 14:22:54 +0000 (14:22 +0000)]
Properly distinguish irq and vector spaces

This makes sure that there are no assumptions about NR_IRQS==NR_VECTORS
anymore, and it also renames various variables to properly reflect
what they represent.

While coded correctly, I wonder whether dump_irqs() shouldn't iterate
over the vector space rather than the irq space, so that MSI entries
are also processed.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: freeze non-current vCPUs of dom0 before entering S5
Keir Fraser [Thu, 20 Nov 2008 14:21:17 +0000 (14:21 +0000)]
x86: freeze non-current vCPUs of dom0 before entering S5

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoxend: Make _setCPUAffinity() errors nonfatal on domain resume
Keir Fraser [Thu, 20 Nov 2008 14:17:09 +0000 (14:17 +0000)]
xend: Make _setCPUAffinity() errors nonfatal on domain resume

This patch allows domains to be resumed on different number of CPUs. After
c/s 18764, a domain cannot be resumed when _setCPUAffinity() fails, which
happens when affinity should be set to a non-existent CPU. This patch
makes _setCPUAffinity() errors nonfatal.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
17 years agox86, hpet: Fix initialisation of secondary timers.
Keir Fraser [Thu, 20 Nov 2008 14:15:50 +0000 (14:15 +0000)]
x86, hpet: Fix initialisation of secondary timers.

Each channel may have different settings, and in the original
implementation, other Tn configuration will accidently overwrite T0
configuration.

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
17 years agoxenapi: fix valid_object typo
Keir Fraser [Thu, 20 Nov 2008 14:14:20 +0000 (14:14 +0000)]
xenapi: fix valid_object typo

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
17 years agox86: Fix build for some versions of gcc.
Keir Fraser [Wed, 19 Nov 2008 19:13:22 +0000 (19:13 +0000)]
x86: Fix build for some versions of gcc.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: secure ioapic_guest_write() against FREE_TO_ASSIGN irq values
Keir Fraser [Wed, 19 Nov 2008 16:11:39 +0000 (16:11 +0000)]
x86: secure ioapic_guest_write() against FREE_TO_ASSIGN irq values

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: support CPUID hypervisor feature bit
Keir Fraser [Wed, 19 Nov 2008 16:10:39 +0000 (16:10 +0000)]
x86: support CPUID hypervisor feature bit

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, s3: Sync platform stamps at time suspend.
Keir Fraser [Wed, 19 Nov 2008 13:17:31 +0000 (13:17 +0000)]
x86, s3: Sync platform stamps at time suspend.

platform_timer_stamp and stime_platform_stamp are synced
to platform timer in time calibration (1s interval), and
thus doesn't reflect the latest value. If they're not
synced at time suspend, the offset can be lost after S3
resume. Average 0.8s lag-behind is observed for each S3
action, which accumulates to TOD inaccuracy.

Signed-off-by Kevin Tian <kevin.tian@intel.com>

17 years agoRemove Xen-private definitions from kexec public header.
Keir Fraser [Wed, 19 Nov 2008 13:13:39 +0000 (13:13 +0000)]
Remove Xen-private definitions from kexec public header.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxen s3, No need to check idle vcpu before update_vcpu_system_time().
Keir Fraser [Wed, 19 Nov 2008 12:52:03 +0000 (12:52 +0000)]
xen s3, No need to check idle vcpu before update_vcpu_system_time().

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
17 years agox86, hpet: Avoud double initialisation on boot or after S3.
Keir Fraser [Wed, 19 Nov 2008 12:48:31 +0000 (12:48 +0000)]
x86, hpet: Avoud double initialisation on boot or after S3.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix the clocksource= boot parameter after c/s 18786.
Keir Fraser [Wed, 19 Nov 2008 12:40:23 +0000 (12:40 +0000)]
x86: Fix the clocksource= boot parameter after c/s 18786.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86, hvm: Fix domain restore bug with Intel VLAPIC acceleration.
Keir Fraser [Tue, 18 Nov 2008 15:59:26 +0000 (15:59 +0000)]
x86, hvm: Fix domain restore bug with Intel VLAPIC acceleration.

r18383 mark video memory as ram, and make all valid pages migrated,
including vlapic page (0xFEE00), and share page(0xFFFFF).
An extra memory population for lapic page would override previous
mapping then cause HVM guest with vlapic acceleration hang.

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