# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 9f09cbe84629ca378d9012d786ba2c2d5bad077c
# Parent 2fc3392d0889684c80675b29f9bde0f63cfc3cb9
# Parent 4d2ae322ef0294df2e3361179b48cb4c339a555f
Merge with xen-ia64-unstable.hg
---
linux-2.6-xen-sparse/drivers/xen/fbfront/xenfb.c | 28 +----
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 4
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c | 2
tools/Makefile | 6 -
tools/check/check_crypto_lib | 17 +--
tools/check/check_openssl_devel | 17 +--
tools/check/check_python | 5
tools/check/check_python_devel | 13 +-
tools/check/check_python_xml | 8 +
tools/check/check_udev | 39 +++++--
tools/check/check_x11_devel | 18 +--
tools/ioemu/target-i386-dm/exec-dm.c | 2
tools/python/xen/xm/main.py | 2
xen/arch/x86/crash.c | 19 +--
xen/arch/x86/domain.c | 4
xen/arch/x86/hvm/hvm.c | 1
xen/arch/x86/hvm/i8254.c | 41 +++++--
xen/arch/x86/traps.c | 30 ++---
xen/common/kexec.c | 94 +++++++----------
xen/common/page_alloc.c | 50 +++++----
xen/drivers/char/console.c | 2
xen/include/asm-x86/hvm/vpt.h | 2
xen/include/xen/kexec.h | 8 -
23 files changed, 238 insertions(+), 174 deletions(-)
diff -r 2fc3392d0889 -r 9f09cbe84629
linux-2.6-xen-sparse/drivers/xen/fbfront/xenfb.c
--- a/linux-2.6-xen-sparse/drivers/xen/fbfront/xenfb.c Thu Dec 14 09:56:41
2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/fbfront/xenfb.c Thu Dec 14 18:22:58
2006 +0000
@@ -105,7 +105,6 @@ static int xenfb_queue_full(struct xenfb
static void xenfb_update_screen(struct xenfb_info *info)
{
- unsigned long flags;
int y1, y2, x1, x2;
struct xenfb_mapping *map;
@@ -114,7 +113,7 @@ static void xenfb_update_screen(struct x
if (xenfb_queue_full(info))
return;
- spin_lock_irqsave(&info->mm_lock, flags);
+ spin_lock(&info->mm_lock);
y1 = info->y1;
y2 = info->y2;
@@ -131,7 +130,7 @@ static void xenfb_update_screen(struct x
map->faults = 0;
}
- spin_unlock_irqrestore(&info->mm_lock, flags);
+ spin_unlock(&info->mm_lock);
xenfb_do_update(info, x1, y1, x2 - x1, y2 - y1);
}
@@ -214,11 +213,9 @@ static void xenfb_refresh(struct xenfb_i
static void xenfb_refresh(struct xenfb_info *info,
int x1, int y1, int w, int h)
{
- unsigned long flags;
-
- spin_lock_irqsave(&info->mm_lock, flags);
+ spin_lock(&info->mm_lock);
__xenfb_refresh(info, x1, y1, w, h);
- spin_unlock_irqrestore(&info->mm_lock, flags);
+ spin_unlock(&info->mm_lock);
}
static void xenfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
@@ -255,14 +252,13 @@ static void xenfb_vm_close(struct vm_are
{
struct xenfb_mapping *map = vma->vm_private_data;
struct xenfb_info *info = map->info;
- unsigned long flags;
-
- spin_lock_irqsave(&info->mm_lock, flags);
+
+ spin_lock(&info->mm_lock);
if (atomic_dec_and_test(&map->map_refs)) {
list_del(&map->link);
kfree(map);
}
- spin_unlock_irqrestore(&info->mm_lock, flags);
+ spin_unlock(&info->mm_lock);
}
static struct page *xenfb_vm_nopage(struct vm_area_struct *vma,
@@ -271,14 +267,13 @@ static struct page *xenfb_vm_nopage(stru
struct xenfb_mapping *map = vma->vm_private_data;
struct xenfb_info *info = map->info;
int pgnr = (vaddr - vma->vm_start) >> PAGE_SHIFT;
- unsigned long flags;
struct page *page;
int y1, y2;
if (pgnr >= info->nr_pages)
return NOPAGE_SIGBUS;
- spin_lock_irqsave(&info->mm_lock, flags);
+ spin_lock(&info->mm_lock);
page = info->pages[pgnr];
get_page(page);
map->faults++;
@@ -288,7 +283,7 @@ static struct page *xenfb_vm_nopage(stru
if (y2 > info->fb_info->var.yres)
y2 = info->fb_info->var.yres;
__xenfb_refresh(info, 0, y1, info->fb_info->var.xres, y2 - y1);
- spin_unlock_irqrestore(&info->mm_lock, flags);
+ spin_unlock(&info->mm_lock);
if (type)
*type = VM_FAULT_MINOR;
@@ -305,7 +300,6 @@ static int xenfb_mmap(struct fb_info *fb
static int xenfb_mmap(struct fb_info *fb_info, struct vm_area_struct *vma)
{
struct xenfb_info *info = fb_info->par;
- unsigned long flags;
struct xenfb_mapping *map;
int map_pages;
@@ -329,9 +323,9 @@ static int xenfb_mmap(struct fb_info *fb
map->info = info;
atomic_set(&map->map_refs, 1);
- spin_lock_irqsave(&info->mm_lock, flags);
+ spin_lock(&info->mm_lock);
list_add(&map->link, &info->mappings);
- spin_unlock_irqrestore(&info->mm_lock, flags);
+ spin_unlock(&info->mm_lock);
vma->vm_ops = &xenfb_vm_ops;
vma->vm_flags |= (VM_DONTEXPAND | VM_RESERVED);
diff -r 2fc3392d0889 -r 9f09cbe84629
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu Dec 14
09:56:41 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu Dec 14
18:22:58 2006 +0000
@@ -525,6 +525,8 @@ static void backend_changed(struct xenbu
break;
case XenbusStateInitWait:
+ if (dev->state != XenbusStateInitialising)
+ break;
if (network_connect(netdev) != 0)
break;
xenbus_switch_state(dev, XenbusStateConnected);
@@ -532,6 +534,8 @@ static void backend_changed(struct xenbu
break;
case XenbusStateClosing:
+ if (dev->state == XenbusStateClosed)
+ break;
netfront_closing(dev);
break;
}
diff -r 2fc3392d0889 -r 9f09cbe84629
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Thu Dec 14
09:56:41 2006 -0700
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Thu Dec 14
18:22:58 2006 +0000
@@ -487,6 +487,8 @@ int xenbus_probe_node(struct xen_bus_typ
if (!xendev)
return -ENOMEM;
+ xendev->state = XenbusStateInitialising;
+
/* Copy the strings into the extra space. */
tmpstring = (char *)(xendev + 1);
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/Makefile
--- a/tools/Makefile Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/Makefile Thu Dec 14 18:22:58 2006 +0000
@@ -36,7 +36,7 @@ all: check
$(MAKE) ioemu
.PHONY: install
-install: check
+install: check_install
@set -e; for subdir in $(SUBDIRS-y); do \
$(MAKE) -C $$subdir $@; \
done
@@ -58,6 +58,10 @@ check:
check:
$(MAKE) -C check
+.PHONY: check_install
+check_install: check
+ $(MAKE) -C check install
+
.PHONY: check_clean
check_clean:
$(MAKE) -C check clean
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/check/check_crypto_lib
--- a/tools/check/check_crypto_lib Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/check/check_crypto_lib Thu Dec 14 18:22:58 2006 +0000
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
-function error {
- echo
- echo " *** Check for crypto library FAILED"
- exit 1
-}
+RC=0
set -e
-ldconfig -p | grep -q libcrypto.so || error
+ldconfig -v 2>&1 | grep -q libcrypto.so || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for crypto library FAILED"
+fi
+
+exit ${RC}
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/check/check_openssl_devel
--- a/tools/check/check_openssl_devel Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/check/check_openssl_devel Thu Dec 14 18:22:58 2006 +0000
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
-function error {
- echo
- echo " *** Check for openssl headers FAILED"
- exit 1
-}
+RC=0
set -e
-[ -e /usr/include/openssl/md5.h ] || error
+test -r /usr/include/openssl/md5.h || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for openssl headers FAILED"
+fi
+
+exit ${RC}
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/check/check_python
--- a/tools/check/check_python Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/check/check_python Thu Dec 14 18:22:58 2006 +0000
@@ -3,7 +3,10 @@
RC=0
-python -V 2>&1 | cut -d ' ' -f 2 | grep -q '^2.[2345]' || RC=1
+python -c '
+import sys
+sys.exit(sys.version_info[0] < 2 or sys.version_info[1] < 2)
+' || RC=1
if test ${RC} -ne 0; then
echo
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/check/check_python_devel
--- a/tools/check/check_python_devel Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/check/check_python_devel Thu Dec 14 18:22:58 2006 +0000
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
function error {
@@ -7,10 +7,19 @@ function error {
exit 1
}
+RC=0
+
python -c '
import os.path, sys
for p in sys.path:
if os.path.exists(p + "/config/Makefile"):
sys.exit(0)
sys.exit(1)
-' || error
+' || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for python development environment FAILED"
+fi
+
+exit ${RC}
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/check/check_udev
--- a/tools/check/check_udev Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/check/check_udev Thu Dec 14 18:22:58 2006 +0000
@@ -1,16 +1,33 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
-function error {
- echo
- echo ' *** Check for udev/hotplug FAILED'
- exit 1
-}
-[ -x "$(which udevinfo)" ] && \
- UDEV_VERSION=$(udevinfo -V | sed -e 's/^[^0-9]*
\([0-9]\{1,\}\)[^0-9]\{0,\}/\1/')
+RC=0
-if [ -n "$UDEV_VERSION" ] && [ $UDEV_VERSION -ge 059 ]; then
- exit 0
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ TOOL="vnconfig"
+ which ${TOOL} 1>/dev/null 2>&1 || RC=1
+ ;;
+Linux)
+ TOOL="udevinfo"
+ test -x "$(which ${TOOL})" && \
+ UDEV_VERSION=$(${TOOL} -V | sed -e 's/^[^0-9]*
\([0-9]\{1,\}\)[^0-9]\{0,\}/\1/')
+ if test -n "${UDEV_VERSION}" -a ${UDEV_VERSION} -ge 059; then
+ RC=0
+ else
+ TOOL="hotplug"
+ which ${TOOL} 1>/dev/null 2>&1 || RC=1
+ fi
+ ;;
+*)
+ TOOL=""
+ echo "Unknown OS" && RC=1
+ ;;
+esac
+
+if test ${RC} -ne 0; then
+ echo
+ echo ' *** Check for ${TOOL} FAILED'
fi
-which hotplug 1>/dev/null 2>&1 || error
+exit ${RC}
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/check/check_x11_devel
--- a/tools/check/check_x11_devel Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/check/check_x11_devel Thu Dec 14 18:22:58 2006 +0000
@@ -1,11 +1,15 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
-function error {
- echo
- echo " *** Check for x11 headers FAILED"
- exit 1
-}
+RC=0
set -e
-[ -e /usr/include/X11/keysymdef.h ] || error
+test -r /usr/include/X11/keysymdef.h || \
+test -r /usr/X11R6/include/X11/keysymdef.h || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for x11 headers FAILED"
+fi
+
+exit ${RC}
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/ioemu/target-i386-dm/exec-dm.c
--- a/tools/ioemu/target-i386-dm/exec-dm.c Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/ioemu/target-i386-dm/exec-dm.c Thu Dec 14 18:22:58 2006 +0000
@@ -441,7 +441,7 @@ void cpu_physical_memory_rw(target_phys_
uint32_t val;
#if defined(__i386__) || defined(__x86_64__)
- static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ static pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
pthread_mutex_lock(&mutex);
#endif
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Thu Dec 14 09:56:41 2006 -0700
+++ b/tools/python/xen/xm/main.py Thu Dec 14 18:22:58 2006 +0000
@@ -709,7 +709,7 @@ def xm_vcpu_list(args):
dominfo = map(server.xend.domain.getVCPUInfo, doms)
print '%-32s %3s %5s %5s %5s %9s %s' % \
- ('Name', 'ID', 'VCPUs', 'CPU', 'State', 'Time(s)', 'CPU Affinity')
+ ('Name', 'ID', 'VCPU', 'CPU', 'State', 'Time(s)', 'CPU Affinity')
format = '%(name)-32s %(domid)3d %(number)5d %(c)5s %(s)5s ' \
' %(cpu_time)8.1f %(cpumap)s'
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/arch/x86/crash.c Thu Dec 14 18:22:58 2006 +0000
@@ -28,6 +28,7 @@
#include <asm/hvm/hvm.h>
static atomic_t waiting_for_crash_ipi;
+static unsigned int crashing_cpu;
static int crash_nmi_callback(struct cpu_user_regs *regs, int cpu)
{
@@ -39,7 +40,7 @@ static int crash_nmi_callback(struct cpu
return 1;
local_irq_disable();
- machine_crash_save_cpu();
+ kexec_crash_save_cpu();
disable_local_APIC();
atomic_dec(&waiting_for_crash_ipi);
hvm_disable();
@@ -67,6 +68,8 @@ static void nmi_shootdown_cpus(void)
{
unsigned long msecs;
+ crashing_cpu = smp_processor_id();
+
atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
/* Would it be better to replace the trap vector here? */
set_nmi_callback(crash_nmi_callback);
@@ -86,18 +89,10 @@ static void nmi_shootdown_cpus(void)
disable_local_APIC();
}
-static void crash_save_xen_notes(void)
+void machine_crash_shutdown(void)
{
crash_xen_info_t *info;
- info = machine_crash_save_info();
-
- info->dom0_pfn_to_mfn_frame_list_list = \
- dom0->shared_info->arch.pfn_to_mfn_frame_list_list;
-}
-
-void machine_crash_shutdown(void)
-{
local_irq_disable();
nmi_shootdown_cpus();
@@ -106,7 +101,9 @@ void machine_crash_shutdown(void)
hvm_disable();
- crash_save_xen_notes();
+ info = kexec_crash_save_info();
+ info->dom0_pfn_to_mfn_frame_list_list =
+ dom0->shared_info->arch.pfn_to_mfn_frame_list_list;
}
/*
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/arch/x86/domain.c Thu Dec 14 18:22:58 2006 +0000
@@ -136,6 +136,10 @@ int vcpu_initialise(struct vcpu *v)
pae_l3_cache_init(&v->arch.pae_l3_cache);
+ /* This should move to arch_domain_create(). */
+ if ( !is_idle_domain(d) && (v->vcpu_id == 0) )
+ pit_init(v, cpu_khz);
+
if ( is_hvm_domain(d) )
{
if ( (rc = hvm_vcpu_initialise(v)) != 0 )
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/arch/x86/hvm/hvm.c Thu Dec 14 18:22:58 2006 +0000
@@ -222,7 +222,6 @@ int hvm_vcpu_initialise(struct vcpu *v)
init_timer(&platform->pl_time.periodic_tm.timer,
pt_timer_fn, v, v->processor);
- pit_init(v, cpu_khz);
rtc_init(v, RTC_PORT(0), RTC_IRQ);
pmtimer_init(v, ACPI_PM_TMR_BLK_ADDRESS);
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/arch/x86/hvm/i8254.c
--- a/xen/arch/x86/hvm/i8254.c Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/arch/x86/hvm/i8254.c Thu Dec 14 18:22:58 2006 +0000
@@ -184,12 +184,18 @@ void pit_time_fired(struct vcpu *v, void
static inline void pit_load_count(PITChannelState *s, int val)
{
- u32 period;
+ u32 period;
+ PITChannelState *ch0 =
+ ¤t->domain->arch.hvm_domain.pl_time.vpit.channels[0];
+
if (val == 0)
val = 0x10000;
s->count_load_time = hvm_get_clock(s->vcpu);
s->count = val;
period = DIV_ROUND((val * 1000000000ULL), PIT_FREQ);
+
+ if (s != ch0)
+ return;
#ifdef DEBUG_PIT
printk("HVM_PIT: pit-load-counter(%p), count=0x%x, period=%uns mode=%d,
load_time=%lld\n",
@@ -419,13 +425,12 @@ static void speaker_ioport_write(void *o
static uint32_t speaker_ioport_read(void *opaque, uint32_t addr)
{
- int out;
- PITState *pit = opaque;
- out = pit_get_out(pit, 2, hvm_get_clock(pit->channels[2].vcpu));
- pit->dummy_refresh_clock ^= 1;
-
- return (pit->speaker_data_on << 1) | pit_get_gate(pit, 2) | (out << 5) |
- (pit->dummy_refresh_clock << 4);
+ PITState *pit = opaque;
+ int out = pit_get_out(pit, 2, hvm_get_clock(pit->channels[2].vcpu));
+ /* Refresh clock toggles at about 15us. We approximate as 2^14ns. */
+ unsigned int refresh_clock = ((unsigned int)NOW() >> 14) & 1;
+ return ((pit->speaker_data_on << 1) | pit_get_gate(pit, 2) |
+ (out << 5) | refresh_clock << 4);
}
static int handle_speaker_io(ioreq_t *p)
@@ -439,7 +444,7 @@ static int handle_speaker_io(ioreq_t *p)
printk("HVM_SPEAKER:wrong SPEAKER IO!\n");
return 1;
}
-
+
if (p->dir == 0) {/* write */
speaker_ioport_write(vpit, p->addr, p->data);
} else if (p->dir == 1) {/* read */
@@ -448,3 +453,21 @@ static int handle_speaker_io(ioreq_t *p)
return 1;
}
+
+int pv_pit_handler(int port, int data, int write)
+{
+ ioreq_t ioreq = {
+ .size = 1,
+ .type = IOREQ_TYPE_PIO,
+ .addr = port,
+ .dir = write ? 0 : 1,
+ .data = write ? data : 0,
+ };
+
+ if (port == 0x61)
+ handle_speaker_io(&ioreq);
+ else
+ handle_pit_io(&ioreq);
+
+ return !write ? ioreq.data : 0;
+}
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/arch/x86/traps.c Thu Dec 14 18:22:58 2006 +0000
@@ -59,6 +59,7 @@
#include <asm/debugger.h>
#include <asm/msr.h>
#include <asm/x86_emulate.h>
+#include <asm/hvm/vpt.h>
/*
* opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
@@ -1035,18 +1036,7 @@ static inline int admin_io_okay(
return ioports_access_permitted(v->domain, port, port + bytes - 1);
}
-static inline int guest_inb_okay(
- unsigned int port, struct vcpu *v, struct cpu_user_regs *regs)
-{
- /*
- * Allow read access to port 0x61. Bit 4 oscillates with period 30us, and
- * so it is often used for timing loops in BIOS code. This hack can go
- * away when we have separate read/write permission rangesets.
- * Note that we could emulate bit 4 instead of directly reading port 0x61,
- * but there's not really a good reason to do so.
- */
- return (admin_io_okay(port, 1, v, regs) || (port == 0x61));
-}
+#define guest_inb_okay(_p, _d, _r) admin_io_okay(_p, 1, _d, _r)
#define guest_inw_okay(_p, _d, _r) admin_io_okay(_p, 2, _d, _r)
#define guest_inl_okay(_p, _d, _r) admin_io_okay(_p, 4, _d, _r)
#define guest_outb_okay(_p, _d, _r) admin_io_okay(_p, 1, _d, _r)
@@ -1141,7 +1131,10 @@ static int emulate_privileged_op(struct
switch ( op_bytes )
{
case 1:
- data = (u8)(guest_inb_okay(port, v, regs) ? inb(port) : ~0);
+ /* emulate PIT counter 2 */
+ data = (u8)(guest_inb_okay(port, v, regs) ? inb(port) :
+ ((port == 0x42 || port == 0x43 || port == 0x61) ?
+ pv_pit_handler(port, 0, 0) : ~0));
break;
case 2:
data = (u16)(guest_inw_okay(port, v, regs) ? inw(port) : ~0);
@@ -1176,6 +1169,8 @@ static int emulate_privileged_op(struct
case 1:
if ( guest_outb_okay(port, v, regs) )
outb((u8)data, port);
+ else if ( port == 0x42 || port == 0x43 || port == 0x61 )
+ pv_pit_handler(port, data, 1);
break;
case 2:
if ( guest_outw_okay(port, v, regs) )
@@ -1240,6 +1235,11 @@ static int emulate_privileged_op(struct
case 1:
if ( guest_inb_okay(port, v, regs) )
io_emul(regs);
+ else if ( port == 0x42 || port == 0x43 || port == 0x61 )
+ {
+ regs->eax &= ~0xffUL;
+ regs->eax |= pv_pit_handler(port, 0, 0);
+ }
else
regs->eax |= (u8)~0;
break;
@@ -1277,6 +1277,8 @@ static int emulate_privileged_op(struct
case 1:
if ( guest_outb_okay(port, v, regs) )
io_emul(regs);
+ else if ( port == 0x42 || port == 0x43 || port == 0x61 )
+ pv_pit_handler(port, regs->eax, 1);
break;
case 2:
if ( guest_outw_okay(port, v, regs) )
@@ -1665,7 +1667,7 @@ static void unknown_nmi_error(unsigned c
printk("Uhhuh. NMI received for unknown reason %02x.\n", reason);
printk("Dazed and confused, but trying to continue\n");
printk("Do you have a strange power saving mode enabled?\n");
- machine_crash_kexec();
+ kexec_crash();
}
}
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/common/kexec.c
--- a/xen/common/kexec.c Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/common/kexec.c Thu Dec 14 18:22:58 2006 +0000
@@ -24,7 +24,6 @@
DEFINE_PER_CPU (crash_note_t, crash_notes);
cpumask_t crash_saved_cpus;
-int crashing_cpu;
xen_kexec_image_t kexec_image[KEXEC_IMAGE_NR];
@@ -58,38 +57,34 @@ custom_param("crashkernel", parse_crashk
static void one_cpu_only(void)
{
- /* Only allow the first cpu to continue - force other cpus to spin */
+ /* Only allow the first cpu to continue - force other cpus to spin */
if ( test_and_set_bit(KEXEC_FLAG_IN_PROGRESS, &kexec_flags) )
- {
- while (1);
- }
-}
-
-/* Save the registers in the per-cpu crash note buffer */
-
-void machine_crash_save_cpu(void)
+ for ( ; ; ) ;
+}
+
+/* Save the registers in the per-cpu crash note buffer. */
+void kexec_crash_save_cpu(void)
{
int cpu = smp_processor_id();
crash_note_t *cntp;
- if ( !cpu_test_and_set(cpu, crash_saved_cpus) )
- {
- cntp = &per_cpu(crash_notes, cpu);
- elf_core_save_regs(&cntp->core.desc.desc.pr_reg,
- &cntp->xen_regs.desc.desc);
-
- /* setup crash "CORE" note */
- setup_crash_note(cntp, core, CORE_STR, CORE_STR_LEN, NT_PRSTATUS);
-
- /* setup crash note "Xen", XEN_ELFNOTE_CRASH_REGS */
- setup_crash_note(cntp, xen_regs, XEN_STR, XEN_STR_LEN,
- XEN_ELFNOTE_CRASH_REGS);
- }
-}
-
-/* Setup the single Xen specific info crash note */
-
-crash_xen_info_t *machine_crash_save_info(void)
+ if ( cpu_test_and_set(cpu, crash_saved_cpus) )
+ return;
+
+ cntp = &per_cpu(crash_notes, cpu);
+ elf_core_save_regs(&cntp->core.desc.desc.pr_reg,
+ &cntp->xen_regs.desc.desc);
+
+ /* Set up crash "CORE" note. */
+ setup_crash_note(cntp, core, CORE_STR, CORE_STR_LEN, NT_PRSTATUS);
+
+ /* Set up crash note "Xen", XEN_ELFNOTE_CRASH_REGS. */
+ setup_crash_note(cntp, xen_regs, XEN_STR, XEN_STR_LEN,
+ XEN_ELFNOTE_CRASH_REGS);
+}
+
+/* Set up the single Xen-specific-info crash note. */
+crash_xen_info_t *kexec_crash_save_info(void)
{
int cpu = smp_processor_id();
crash_note_t *cntp;
@@ -99,7 +94,7 @@ crash_xen_info_t *machine_crash_save_inf
cntp = &per_cpu(crash_notes, cpu);
- /* setup crash note "Xen", XEN_ELFNOTE_CRASH_INFO */
+ /* Set up crash note "Xen", XEN_ELFNOTE_CRASH_INFO. */
setup_crash_note(cntp, xen_info, XEN_STR, XEN_STR_LEN,
XEN_ELFNOTE_CRASH_INFO);
@@ -117,45 +112,34 @@ crash_xen_info_t *machine_crash_save_inf
return info;
}
-void machine_crash_kexec(void)
+void kexec_crash(void)
{
int pos;
- xen_kexec_image_t *image;
+
+ pos = (test_bit(KEXEC_FLAG_CRASH_POS, &kexec_flags) != 0);
+ if ( !test_bit(KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) )
+ return;
one_cpu_only();
-
- machine_crash_save_cpu();
- crashing_cpu = smp_processor_id();
-
+ kexec_crash_save_cpu();
machine_crash_shutdown();
- pos = (test_bit(KEXEC_FLAG_CRASH_POS, &kexec_flags) != 0);
-
- if ( test_bit(KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) )
- {
- image = &kexec_image[KEXEC_IMAGE_CRASH_BASE + pos];
- machine_kexec(image); /* Does not return */
- }
+ machine_kexec(&kexec_image[KEXEC_IMAGE_CRASH_BASE + pos]);
+
+ BUG();
}
static void do_crashdump_trigger(unsigned char key)
{
- int pos = (test_bit(KEXEC_FLAG_CRASH_POS, &kexec_flags) != 0);
- if ( test_bit(KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) )
- {
- printk("'%c' pressed -> triggering crashdump\n", key);
- machine_crash_kexec();
- }
- else
- {
- printk("'%c' pressed -> no crash kernel loaded -- not triggering
crashdump\n", key);
- }
+ printk("'%c' pressed -> triggering crashdump\n", key);
+ kexec_crash();
+ printk(" * no crash kernel loaded!\n");
}
static __init int register_crashdump_trigger(void)
{
- register_keyhandler('C', do_crashdump_trigger, "trigger a crashdump");
- return 0;
+ register_keyhandler('C', do_crashdump_trigger, "trigger a crashdump");
+ return 0;
}
__initcall(register_crashdump_trigger);
@@ -303,7 +287,7 @@ static int kexec_exec(XEN_GUEST_HANDLE(v
machine_reboot_kexec(image); /* Does not return */
break;
case KEXEC_TYPE_CRASH:
- machine_crash_kexec(); /* Does not return */
+ kexec_crash(); /* Does not return */
break;
}
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/common/page_alloc.c Thu Dec 14 18:22:58 2006 +0000
@@ -136,7 +136,6 @@ static void map_alloc(unsigned long firs
}
}
-
static void map_free(unsigned long first_page, unsigned long nr_pages)
{
unsigned long start_off, end_off, curr_idx, end_idx;
@@ -170,6 +169,8 @@ static void map_free(unsigned long first
/*************************
* BOOT-TIME ALLOCATOR
*/
+
+static unsigned long first_valid_mfn = ~0UL;
/* Initialise allocator to handle up to @max_page pages. */
paddr_t init_boot_allocator(paddr_t bitmap_start)
@@ -203,6 +204,8 @@ void init_boot_pages(paddr_t ps, paddr_t
if ( pe <= ps )
return;
+ first_valid_mfn = min_t(unsigned long, ps >> PAGE_SHIFT, first_valid_mfn);
+
map_free(ps >> PAGE_SHIFT, (pe - ps) >> PAGE_SHIFT);
/* Check new pages against the bad-page list. */
@@ -256,16 +259,17 @@ unsigned long alloc_boot_pages_at(unsign
unsigned long alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align)
{
- unsigned long pg, i = 0;
-
- for ( pg = 0; (pg + nr_pfns) < max_page; pg += pfn_align )
- {
- i = alloc_boot_pages_at(nr_pfns, pg);
- if (i != 0)
+ unsigned long pg;
+
+ pg = first_valid_mfn & ~(pfn_align-1);
+ while ( (pg + nr_pfns) < max_page )
+ {
+ if ( alloc_boot_pages_at(nr_pfns, pg) != 0 )
break;
- }
-
- return i;
+ pg += pfn_align;
+ }
+
+ return pg;
}
@@ -291,7 +295,7 @@ void end_boot_allocator(void)
void end_boot_allocator(void)
{
unsigned long i, j, k;
- int curr_free = 0, next_free = 0;
+ int curr_free, next_free;
memset(avail, 0, sizeof(avail));
@@ -301,7 +305,9 @@ void end_boot_allocator(void)
INIT_LIST_HEAD(&heap[i][j][k]);
/* Pages that are free now go to the domain sub-allocator. */
- for ( i = 0; i < max_page; i++ )
+ if ( (curr_free = next_free = !allocated_in_map(first_valid_mfn)) )
+ map_alloc(first_valid_mfn, 1);
+ for ( i = first_valid_mfn; i < max_page; i++ )
{
curr_free = next_free;
next_free = !allocated_in_map(i+1);
@@ -324,7 +330,7 @@ void init_heap_pages(
void init_heap_pages(
unsigned int zone, struct page_info *pg, unsigned long nr_pages)
{
- unsigned int nid_curr,nid_prev;
+ unsigned int nid_curr, nid_prev;
unsigned long i;
ASSERT(zone < NR_ZONES);
@@ -478,37 +484,37 @@ void scrub_heap_pages(void)
void scrub_heap_pages(void)
{
void *p;
- unsigned long pfn;
+ unsigned long mfn;
printk("Scrubbing Free RAM: ");
- for ( pfn = 0; pfn < max_page; pfn++ )
+ for ( mfn = first_valid_mfn; mfn < max_page; mfn++ )
{
/* Every 100MB, print a progress dot. */
- if ( (pfn % ((100*1024*1024)/PAGE_SIZE)) == 0 )
+ if ( (mfn % ((100*1024*1024)/PAGE_SIZE)) == 0 )
printk(".");
process_pending_timers();
/* Quick lock-free check. */
- if ( allocated_in_map(pfn) )
+ if ( allocated_in_map(mfn) )
continue;
spin_lock_irq(&heap_lock);
/* Re-check page status with lock held. */
- if ( !allocated_in_map(pfn) )
- {
- if ( IS_XEN_HEAP_FRAME(mfn_to_page(pfn)) )
+ if ( !allocated_in_map(mfn) )
+ {
+ if ( IS_XEN_HEAP_FRAME(mfn_to_page(mfn)) )
{
- p = page_to_virt(mfn_to_page(pfn));
+ p = page_to_virt(mfn_to_page(mfn));
memguard_unguard_range(p, PAGE_SIZE);
clear_page(p);
memguard_guard_range(p, PAGE_SIZE);
}
else
{
- p = map_domain_page(pfn);
+ p = map_domain_page(mfn);
clear_page(p);
unmap_domain_page(p);
}
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/drivers/char/console.c Thu Dec 14 18:22:58 2006 +0000
@@ -866,7 +866,7 @@ void panic(const char *fmt, ...)
debugger_trap_immediate();
- machine_crash_kexec();
+ kexec_crash();
if ( opt_noreboot )
{
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/include/asm-x86/hvm/vpt.h
--- a/xen/include/asm-x86/hvm/vpt.h Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/include/asm-x86/hvm/vpt.h Thu Dec 14 18:22:58 2006 +0000
@@ -54,7 +54,6 @@ typedef struct PITState {
typedef struct PITState {
PITChannelState channels[3];
int speaker_data_on;
- int dummy_refresh_clock;
} PITState;
#define RTC_SIZE 14
@@ -125,6 +124,7 @@ extern struct periodic_time *create_peri
extern struct periodic_time *create_periodic_time(
u32 period, char irq, char one_shot, time_cb *cb, void *data);
extern void destroy_periodic_time(struct periodic_time *pt);
+int pv_pit_handler(int port, int data, int write);
void pit_init(struct vcpu *v, unsigned long cpu_khz);
void rtc_init(struct vcpu *v, int base, int irq);
void rtc_deinit(struct domain *d);
diff -r 2fc3392d0889 -r 9f09cbe84629 xen/include/xen/kexec.h
--- a/xen/include/xen/kexec.h Thu Dec 14 09:56:41 2006 -0700
+++ b/xen/include/xen/kexec.h Thu Dec 14 18:22:58 2006 +0000
@@ -4,8 +4,6 @@
#include <public/kexec.h>
#include <asm/percpu.h>
#include <xen/elfcore.h>
-
-extern int crashing_cpu;
typedef struct xen_kexec_reserve {
unsigned long size;
@@ -27,9 +25,9 @@ void machine_kexec_unload(int type, int
void machine_kexec_unload(int type, int slot, xen_kexec_image_t *image);
void machine_kexec_reserved(xen_kexec_reserve_t *reservation);
void machine_reboot_kexec(xen_kexec_image_t *image);
-void machine_crash_kexec(void);
-void machine_crash_save_cpu(void);
-crash_xen_info_t *machine_crash_save_info(void);
+void kexec_crash(void);
+void kexec_crash_save_cpu(void);
+crash_xen_info_t *kexec_crash_save_info(void);
void machine_crash_shutdown(void);
#endif /* __XEN_KEXEC_H__ */
diff -r 2fc3392d0889 -r 9f09cbe84629 tools/check/check_python_xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/check/check_python_xml Thu Dec 14 18:22:58 2006 +0000
@@ -0,0 +1,8 @@
+#!/bin/sh
+# CHECK-INSTALL
+
+python -c 'import xml.dom.minidom' 2>/dev/null || {
+ echo
+ echo " *** Check for python-xml package FAILED"
+ exit 1
+}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|