qubes-linux-kernel/patches.xen/xen3-patch-2.6.18
2011-04-19 22:09:59 +02:00

592 lines
18 KiB
Plaintext

From: www.kernel.org
Subject: Linux 2.6.18
Patch-mainline: 2.6.18
Automatically created from "patches.kernel.org/patch-2.6.18" by xen-port-patches.py
Acked-by: jbeulich@novell.com
--- head-2011-03-17.orig/arch/x86/Kconfig 2011-01-31 17:01:38.000000000 +0100
+++ head-2011-03-17/arch/x86/Kconfig 2011-01-31 17:02:29.000000000 +0100
@@ -83,7 +83,6 @@ config ARCH_DEFCONFIG
config GENERIC_CMOS_UPDATE
def_bool y
- depends on !X86_XEN
config CLOCKSOURCE_WATCHDOG
def_bool y
@@ -1609,7 +1608,7 @@ config KEXEC_JUMP
code in physical address mode via KEXEC
config PHYSICAL_START
- hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
+ hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP || XEN)
default "0x1000000"
---help---
This gives the physical address where the kernel is loaded.
--- head-2011-03-17.orig/arch/x86/kernel/Makefile 2011-01-31 14:53:50.000000000 +0100
+++ head-2011-03-17/arch/x86/kernel/Makefile 2011-01-31 17:02:29.000000000 +0100
@@ -129,5 +129,5 @@ ifeq ($(CONFIG_X86_64),y)
pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o
endif
-disabled-obj-$(CONFIG_XEN) := i8259_$(BITS).o reboot.o smpboot_$(BITS).o
+disabled-obj-$(CONFIG_XEN) := i8253.o i8259_$(BITS).o reboot.o smpboot_$(BITS).o tsc_$(BITS).o
%/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) :=
--- head-2011-03-17.orig/arch/x86/kernel/process_64-xen.c 2008-08-07 12:44:36.000000000 +0200
+++ head-2011-03-17/arch/x86/kernel/process_64-xen.c 2011-02-02 08:28:34.000000000 +0100
@@ -50,7 +50,6 @@
#include <asm/pda.h>
#include <asm/prctl.h>
#include <asm/kdebug.h>
-#include <xen/interface/platform.h>
#include <xen/interface/physdev.h>
#include <xen/interface/vcpu.h>
#include <asm/desc.h>
--- head-2011-03-17.orig/arch/x86/kernel/setup64-xen.c 2008-01-28 12:24:19.000000000 +0100
+++ head-2011-03-17/arch/x86/kernel/setup64-xen.c 2011-01-31 17:02:29.000000000 +0100
@@ -363,5 +363,7 @@ void __cpuinit cpu_init (void)
fpu_init();
- raw_local_save_flags(kernel_eflags);
+ asm ("pushfq; popq %0" : "=rm" (kernel_eflags));
+ if (raw_irqs_disabled())
+ kernel_eflags &= ~X86_EFLAGS_IF;
}
--- head-2011-03-17.orig/arch/x86/kernel/time-xen.c 2010-08-31 09:24:21.000000000 +0200
+++ head-2011-03-17/arch/x86/kernel/time-xen.c 2011-01-31 17:02:29.000000000 +0100
@@ -45,7 +45,6 @@
#include <linux/sysdev.h>
#include <linux/bcd.h>
#include <linux/efi.h>
-#include <linux/mca.h>
#include <linux/sysctl.h>
#include <linux/percpu.h>
#include <linux/kernel_stat.h>
@@ -76,8 +75,13 @@
#if defined (__i386__)
#include <asm/i8259.h>
+#include <asm/i8253.h>
+DEFINE_SPINLOCK(i8253_lock);
+EXPORT_SYMBOL(i8253_lock);
#endif
+#define XEN_SHIFT 22
+
int pit_latch_buggy; /* extern */
#if defined(__x86_64__)
@@ -97,10 +101,6 @@ extern unsigned long wall_jiffies;
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL(rtc_lock);
-extern struct init_timer_opts timer_tsc_init;
-extern struct timer_opts timer_tsc;
-#define timer_none timer_tsc
-
/* These are peridically updated in shared_info, and then copied here. */
struct shadow_time_info {
u64 tsc_timestamp; /* TSC at last update of time vals. */
@@ -172,24 +172,6 @@ static int __init __permitted_clock_jitt
}
__setup("permitted_clock_jitter=", __permitted_clock_jitter);
-#if 0
-static void delay_tsc(unsigned long loops)
-{
- unsigned long bclock, now;
-
- rdtscl(bclock);
- do {
- rep_nop();
- rdtscl(now);
- } while ((now - bclock) < loops);
-}
-
-struct timer_opts timer_tsc = {
- .name = "tsc",
- .delay = delay_tsc,
-};
-#endif
-
/*
* Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
* yielding a 64-bit result.
@@ -226,14 +208,6 @@ static inline u64 scale_delta(u64 delta,
return product;
}
-#if 0 /* defined (__i386__) */
-int read_current_timer(unsigned long *timer_val)
-{
- rdtscl(*timer_val);
- return 0;
-}
-#endif
-
void init_cpu_khz(void)
{
u64 __cpu_khz = 1000000ULL << 32;
@@ -253,6 +227,7 @@ static u64 get_nsec_offset(struct shadow
return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift);
}
+#ifdef CONFIG_X86_64
static unsigned long get_usec_offset(struct shadow_time_info *shadow)
{
u64 now, delta;
@@ -260,6 +235,7 @@ static unsigned long get_usec_offset(str
delta = now - shadow->tsc_timestamp;
return scale_delta(delta, shadow->tsc_to_usec_mul, shadow->tsc_shift);
}
+#endif
static void __update_wallclock(time_t sec, long nsec)
{
@@ -374,6 +350,8 @@ void rtc_cmos_write(unsigned char val, u
}
EXPORT_SYMBOL(rtc_cmos_write);
+#ifdef CONFIG_X86_64
+
static struct {
spinlock_t lock;
struct timeval tv;
@@ -530,6 +508,8 @@ int do_settimeofday(struct timespec *tv)
EXPORT_SYMBOL(do_settimeofday);
+#endif
+
static void sync_xen_wallclock(unsigned long dummy);
static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0);
static void sync_xen_wallclock(unsigned long dummy)
@@ -581,11 +561,15 @@ static int set_rtc_mmss(unsigned long no
return retval;
}
+#ifdef CONFIG_X86_64
/* monotonic_clock(): returns # of nanoseconds passed since time_init()
* Note: This function is required to return accurate
* time even in the absence of multiple timer ticks.
*/
unsigned long long monotonic_clock(void)
+#else
+unsigned long long sched_clock(void)
+#endif
{
unsigned int cpu = get_cpu();
struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu);
@@ -605,9 +589,9 @@ unsigned long long monotonic_clock(void)
return time;
}
+#ifdef CONFIG_X86_64
EXPORT_SYMBOL(monotonic_clock);
-#ifdef __x86_64__
unsigned long long sched_clock(void)
{
return monotonic_clock();
@@ -780,6 +764,89 @@ irqreturn_t timer_interrupt(int irq, voi
return IRQ_HANDLED;
}
+#ifndef CONFIG_X86_64
+
+void tsc_init(void)
+{
+ init_cpu_khz();
+ printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
+ cpu_khz / 1000, cpu_khz % 1000);
+
+ use_tsc_delay();
+}
+
+#include <linux/clocksource.h>
+
+void mark_tsc_unstable(void)
+{
+#ifndef CONFIG_XEN /* XXX Should tell the hypervisor about this fact. */
+ tsc_unstable = 1;
+#endif
+}
+EXPORT_SYMBOL_GPL(mark_tsc_unstable);
+
+static cycle_t xen_clocksource_read(void)
+{
+#ifdef CONFIG_SMP
+ static cycle_t last_ret;
+#ifndef CONFIG_64BIT
+ cycle_t last = cmpxchg64(&last_ret, 0, 0);
+#else
+ cycle_t last = last_ret;
+#define cmpxchg64 cmpxchg
+#endif
+ cycle_t ret = sched_clock();
+
+ if (unlikely((s64)(ret - last) < 0)) {
+ if (last - ret > permitted_clock_jitter
+ && printk_ratelimit()) {
+ unsigned int cpu = get_cpu();
+ struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu);
+
+ printk(KERN_WARNING "clocksource/%u: "
+ "Time went backwards: "
+ "ret=%Lx delta=%Ld shadow=%Lx offset=%Lx\n",
+ cpu, ret, ret - last, shadow->system_timestamp,
+ get_nsec_offset(shadow));
+ put_cpu();
+ }
+ return last;
+ }
+
+ for (;;) {
+ cycle_t cur = cmpxchg64(&last_ret, last, ret);
+
+ if (cur == last || (s64)(ret - cur) < 0)
+ return ret;
+ last = cur;
+ }
+#else
+ return sched_clock();
+#endif
+}
+
+static struct clocksource clocksource_xen = {
+ .name = "xen",
+ .rating = 400,
+ .read = xen_clocksource_read,
+ .mask = CLOCKSOURCE_MASK(64),
+ .mult = 1 << XEN_SHIFT, /* time directly in nanoseconds */
+ .shift = XEN_SHIFT,
+ .is_continuous = 1,
+};
+
+static int __init init_xen_clocksource(void)
+{
+ clocksource_xen.mult = clocksource_khz2mult(cpu_khz,
+ clocksource_xen.shift);
+
+ return clocksource_register(&clocksource_xen);
+}
+
+module_init(init_xen_clocksource);
+
+#endif
+
static void init_missing_ticks_accounting(unsigned int cpu)
{
struct vcpu_register_runstate_memory_area area;
@@ -926,7 +993,7 @@ static void setup_cpu0_timer_irq(void)
VIRQ_TIMER,
0,
timer_interrupt,
- SA_INTERRUPT,
+ IRQF_DISABLED|IRQF_TIMER,
"timer0",
NULL);
BUG_ON(per_cpu(timer_irq, 0) < 0);
@@ -968,11 +1035,11 @@ void __init time_init(void)
update_wallclock();
+#ifdef CONFIG_X86_64
init_cpu_khz();
printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n",
cpu_khz / 1000, cpu_khz % 1000);
-#if defined(__x86_64__)
vxtime.mode = VXTIME_TSC;
vxtime.quot = (1000000L << 32) / vxtime_hz;
vxtime.tsc_quot = (1000L << 32) / cpu_khz;
@@ -1147,7 +1214,7 @@ int __cpuinit local_setup_timer(unsigned
irq = bind_virq_to_irqhandler(VIRQ_TIMER,
cpu,
timer_interrupt,
- SA_INTERRUPT,
+ IRQF_DISABLED|IRQF_TIMER,
timer_name[cpu],
NULL);
if (irq < 0)
--- head-2011-03-17.orig/arch/x86/mm/ioremap-xen.c 2010-09-16 13:31:46.000000000 +0200
+++ head-2011-03-17/arch/x86/mm/ioremap-xen.c 2011-02-07 15:31:26.000000000 +0100
@@ -154,21 +154,6 @@ int create_lookup_pte_addr(struct mm_str
EXPORT_SYMBOL(create_lookup_pte_addr);
-static int noop_fn(
- pte_t *pte, struct page *pmd_page, unsigned long addr, void *data)
-{
- return 0;
-}
-
-int touch_pte_range(struct mm_struct *mm,
- unsigned long address,
- unsigned long size)
-{
- return apply_to_page_range(mm, address, size, noop_fn, NULL);
-}
-
-EXPORT_SYMBOL(touch_pte_range);
-
/*
* Does @address reside within a non-highmem page that is local to this virtual
* machine (i.e., not an I/O page, nor a memory page belonging to another VM).
--- head-2011-03-17.orig/drivers/acpi/processor_perflib.c 2011-01-31 14:53:38.000000000 +0100
+++ head-2011-03-17/drivers/acpi/processor_perflib.c 2011-01-31 17:02:29.000000000 +0100
@@ -578,6 +578,8 @@ end:
return result;
}
+#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL
+
int acpi_processor_preregister_performance(
struct acpi_processor_performance __percpu *performance)
{
@@ -793,3 +795,5 @@ acpi_processor_unregister_performance(st
}
EXPORT_SYMBOL(acpi_processor_unregister_performance);
+
+#endif /* !CONFIG_PROCESSOR_EXTERNAL_CONTROL */
--- head-2011-03-17.orig/drivers/char/agp/intel-gtt.c 2011-03-11 10:51:50.000000000 +0100
+++ head-2011-03-17/drivers/char/agp/intel-gtt.c 2011-03-11 10:53:08.000000000 +0100
@@ -156,6 +156,10 @@ static struct page *i8xx_alloc_pages(voi
if (set_pages_uc(page, 4) < 0) {
set_pages_wb(page, 4);
+#ifdef CONFIG_XEN
+ xen_destroy_contiguous_region((unsigned long)page_address(page),
+ 2);
+#endif
__free_pages(page, 2);
return NULL;
}
--- head-2011-03-17.orig/drivers/xen/blkback/interface.c 2010-09-23 15:39:04.000000000 +0200
+++ head-2011-03-17/drivers/xen/blkback/interface.c 2011-01-31 17:02:29.000000000 +0100
@@ -41,11 +41,10 @@ blkif_t *blkif_alloc(domid_t domid)
{
blkif_t *blkif;
- blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL);
+ blkif = kmem_cache_zalloc(blkif_cachep, GFP_KERNEL);
if (!blkif)
return ERR_PTR(-ENOMEM);
- memset(blkif, 0, sizeof(*blkif));
blkif->domid = domid;
spin_lock_init(&blkif->blk_ring_lock);
atomic_set(&blkif->refcnt, 1);
--- head-2011-03-17.orig/drivers/xen/blktap/interface.c 2010-09-23 15:39:04.000000000 +0200
+++ head-2011-03-17/drivers/xen/blktap/interface.c 2011-01-31 17:02:29.000000000 +0100
@@ -41,11 +41,10 @@ blkif_t *tap_alloc_blkif(domid_t domid)
{
blkif_t *blkif;
- blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL);
+ blkif = kmem_cache_zalloc(blkif_cachep, GFP_KERNEL);
if (!blkif)
return ERR_PTR(-ENOMEM);
- memset(blkif, 0, sizeof(*blkif));
blkif->domid = domid;
spin_lock_init(&blkif->blk_ring_lock);
atomic_set(&blkif->refcnt, 1);
--- head-2011-03-17.orig/drivers/xen/blktap2/control.c 2010-04-29 09:34:47.000000000 +0200
+++ head-2011-03-17/drivers/xen/blktap2/control.c 2011-02-24 15:15:38.000000000 +0100
@@ -145,7 +145,7 @@ blktap_control_ioctl(struct inode *inode
return -ENOIOCTLCMD;
}
-static struct file_operations blktap_control_file_operations = {
+static const struct file_operations blktap_control_file_operations = {
.owner = THIS_MODULE,
.ioctl = blktap_control_ioctl,
};
--- head-2011-03-17.orig/drivers/xen/blktap2/ring.c 2010-08-31 09:24:21.000000000 +0200
+++ head-2011-03-17/drivers/xen/blktap2/ring.c 2011-02-24 15:15:44.000000000 +0100
@@ -479,7 +479,7 @@ static unsigned int blktap_ring_poll(str
return 0;
}
-static struct file_operations blktap_ring_file_operations = {
+static const struct file_operations blktap_ring_file_operations = {
.owner = THIS_MODULE,
.open = blktap_ring_open,
.release = blktap_ring_release,
--- head-2011-03-17.orig/drivers/xen/console/console.c 2009-03-18 10:39:31.000000000 +0100
+++ head-2011-03-17/drivers/xen/console/console.c 2011-01-31 17:02:29.000000000 +0100
@@ -94,7 +94,6 @@ static int __init xencons_setup(char *st
{
char *q;
int n;
- extern int console_use_vt;
console_use_vt = 1;
if (!strncmp(str, "ttyS", 4)) {
--- head-2011-03-17.orig/drivers/xen/netback/common.h 2011-02-17 09:58:10.000000000 +0100
+++ head-2011-03-17/drivers/xen/netback/common.h 2011-03-01 11:33:08.000000000 +0100
@@ -100,7 +100,7 @@ typedef struct netif_st {
struct timer_list tx_queue_timeout;
/* Statistics */
- int nr_copied_skbs;
+ unsigned long nr_copied_skbs;
/* Miscellaneous private stuff. */
struct list_head list; /* scheduling list */
--- head-2011-03-17.orig/drivers/xen/netback/interface.c 2011-02-17 09:58:10.000000000 +0100
+++ head-2011-03-17/drivers/xen/netback/interface.c 2011-03-17 14:10:30.000000000 +0100
@@ -169,7 +169,7 @@ static const struct netif_stat {
char name[ETH_GSTRING_LEN];
u16 offset;
} netbk_stats[] = {
- { "copied_skbs", offsetof(netif_t, nr_copied_skbs) },
+ { "copied_skbs", offsetof(netif_t, nr_copied_skbs) / sizeof(long) },
};
static int netbk_get_stats_count(struct net_device *dev)
@@ -180,11 +180,11 @@ static int netbk_get_stats_count(struct
static void netbk_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 * data)
{
- void *netif = netdev_priv(dev);
+ unsigned long *np = netdev_priv(dev);
int i;
for (i = 0; i < ARRAY_SIZE(netbk_stats); i++)
- data[i] = *(int *)(netif + netbk_stats[i].offset);
+ data[i] = np[netbk_stats[i].offset];
}
static void netbk_get_strings(struct net_device *dev, u32 stringset, u8 * data)
--- head-2011-03-17.orig/drivers/xen/scsiback/interface.c 2010-09-23 15:39:04.000000000 +0200
+++ head-2011-03-17/drivers/xen/scsiback/interface.c 2011-01-31 17:02:29.000000000 +0100
@@ -46,11 +46,10 @@ struct vscsibk_info *vscsibk_info_alloc(
{
struct vscsibk_info *info;
- info = kmem_cache_alloc(scsiback_cachep, GFP_KERNEL);
+ info = kmem_cache_zalloc(scsiback_cachep, GFP_KERNEL);
if (!info)
return ERR_PTR(-ENOMEM);
- memset(info, 0, sizeof(*info));
info->domid = domid;
spin_lock_init(&info->ring_lock);
atomic_set(&info->nr_unreplied_reqs, 0);
--- head-2011-03-17.orig/drivers/xen/tpmback/interface.c 2010-09-23 15:39:04.000000000 +0200
+++ head-2011-03-17/drivers/xen/tpmback/interface.c 2011-01-31 17:02:29.000000000 +0100
@@ -25,11 +25,10 @@ static tpmif_t *alloc_tpmif(domid_t domi
{
tpmif_t *tpmif;
- tpmif = kmem_cache_alloc(tpmif_cachep, GFP_KERNEL);
+ tpmif = kmem_cache_zalloc(tpmif_cachep, GFP_KERNEL);
if (tpmif == NULL)
goto out_of_memory;
- memset(tpmif, 0, sizeof (*tpmif));
tpmif->domid = domid;
tpmif->status = DISCONNECTED;
tpmif->bi = bi;
--- head-2011-03-17.orig/arch/x86/include/mach-xen/asm/pgtable_32.h 2009-03-18 10:39:32.000000000 +0100
+++ head-2011-03-17/arch/x86/include/mach-xen/asm/pgtable_32.h 2011-02-07 15:33:33.000000000 +0100
@@ -521,9 +521,6 @@ int direct_kernel_remap_pfn_range(unsign
int create_lookup_pte_addr(struct mm_struct *mm,
unsigned long address,
uint64_t *ptep);
-int touch_pte_range(struct mm_struct *mm,
- unsigned long address,
- unsigned long size);
int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd,
unsigned long addr, unsigned long end, pgprot_t newprot);
--- head-2011-03-17.orig/arch/x86/include/mach-xen/asm/pgtable_64.h 2009-06-23 09:28:21.000000000 +0200
+++ head-2011-03-17/arch/x86/include/mach-xen/asm/pgtable_64.h 2011-02-07 15:33:42.000000000 +0100
@@ -394,7 +394,6 @@ static inline int pmd_large(pmd_t pte) {
/*
* Level 4 access.
- * Never use these in the common code.
*/
#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK))
#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
@@ -543,10 +542,6 @@ int create_lookup_pte_addr(struct mm_str
unsigned long address,
uint64_t *ptep);
-int touch_pte_range(struct mm_struct *mm,
- unsigned long address,
- unsigned long size);
-
int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd,
unsigned long addr, unsigned long end, pgprot_t newprot);
--- head-2011-03-17.orig/arch/x86/include/mach-xen/asm/processor_32.h 2008-01-28 12:24:19.000000000 +0100
+++ head-2011-03-17/arch/x86/include/mach-xen/asm/processor_32.h 2011-01-31 17:02:29.000000000 +0100
@@ -23,7 +23,7 @@
#include <xen/interface/physdev.h>
/* flag for disabling the tsc */
-extern int tsc_disable;
+#define tsc_disable 0
struct desc_struct {
unsigned long a,b;
--- head-2011-03-17.orig/arch/x86/include/asm/thread_info.h 2011-03-17 13:45:28.000000000 +0100
+++ head-2011-03-17/arch/x86/include/asm/thread_info.h 2011-01-31 17:02:29.000000000 +0100
@@ -144,11 +144,15 @@ struct thread_info {
_TIF_USER_RETURN_NOTIFY)
/* flags to check in __switch_to() */
+#ifndef CONFIG_XEN
#define _TIF_WORK_CTXSW \
(_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP)
#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
+#else
+#define _TIF_WORK_CTXSW _TIF_DEBUG
+#endif
#define PREEMPT_ACTIVE 0x10000000
--- head-2011-03-17.orig/arch/x86/kernel/quirks.c 2011-03-17 13:45:28.000000000 +0100
+++ head-2011-03-17/arch/x86/kernel/quirks.c 2011-02-28 15:04:15.000000000 +0100
@@ -6,7 +6,7 @@
#include <asm/hpet.h>
-#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
+#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_SMP) || defined(CONFIG_XEN)) && defined(CONFIG_PCI)
static void __devinit quirk_intel_irqbalance(struct pci_dev *dev)
{
@@ -35,10 +35,21 @@ static void __devinit quirk_intel_irqbal
if (!(word & (1 << 13))) {
dev_info(&dev->dev, "Intel E7520/7320/7525 detected; "
"disabling irq balancing and affinity\n");
+#ifndef CONFIG_XEN
noirqdebug_setup("");
#ifdef CONFIG_PROC_FS
no_irq_affinity = 1;
#endif
+#else
+ {
+ struct xen_platform_op op = {
+ .cmd = XENPF_platform_quirk,
+ .u.platform_quirk.quirk_id = QUIRK_NOIRQBALANCING
+ };
+
+ WARN_ON(HYPERVISOR_platform_op(&op));
+ }
+#endif
}
/* put back the original value for config space*/