ia64/xen-unstable

changeset 8548:d3a4485a41fc

Cleanups.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Jan 10 17:27:16 2006 +0100 (2006-01-10)
parents 991ccc24bf2e
children f5f703ec5223
files linux-2.6-xen-sparse/arch/xen/i386/kernel/io_apic.c linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c linux-2.6-xen-sparse/arch/xen/i386/mm/init.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/e820.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/io_apic.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/irq.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smp.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/io_apic.c	Tue Jan 10 15:05:05 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/io_apic.c	Tue Jan 10 17:27:16 2006 +0100
     1.3 @@ -622,9 +622,11 @@ static int balanced_irq(void *unused)
     1.4  		try_to_freeze(PF_FREEZE);
     1.5  		if (time_after(jiffies,
     1.6  				prev_balance_time+balanced_irq_interval)) {
     1.7 +			preempt_disable();
     1.8  			do_irq_balance();
     1.9  			prev_balance_time = jiffies;
    1.10  			time_remaining = balanced_irq_interval;
    1.11 +			preempt_enable();
    1.12  		}
    1.13  	}
    1.14  	return 0;
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Tue Jan 10 15:05:05 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c	Tue Jan 10 17:27:16 2006 +0100
     2.3 @@ -648,12 +648,6 @@ fastcall void do_int3(struct pt_regs *re
     2.4  }
     2.5  #endif
     2.6  
     2.7 -static inline void conditional_sti(struct pt_regs *regs)
     2.8 -{
     2.9 -	if (regs->eflags & (X86_EFLAGS_IF|VM_MASK))
    2.10 -		local_irq_enable();
    2.11 -}
    2.12 -
    2.13  /*
    2.14   * Our handling of the processor debug registers is non-trivial.
    2.15   * We do not clear them on entry and exit from the kernel. Therefore
    2.16 @@ -686,9 +680,9 @@ fastcall void do_debug(struct pt_regs * 
    2.17  	if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
    2.18  					SIGTRAP) == NOTIFY_STOP)
    2.19  		return;
    2.20 -
    2.21  	/* It's safe to allow irq's after DR6 has been saved */
    2.22 -	conditional_sti(regs);
    2.23 +	if (regs->eflags & X86_EFLAGS_IF)
    2.24 +		local_irq_enable();
    2.25  
    2.26  	/* Mask out spurious debug traps due to lazy DR7 setting */
    2.27  	if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Tue Jan 10 15:05:05 2006 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Tue Jan 10 17:27:16 2006 +0100
     3.3 @@ -65,7 +65,7 @@ static pmd_t * __init one_md_table_init(
     3.4  {
     3.5  	pud_t *pud;
     3.6  	pmd_t *pmd_table;
     3.7 -
     3.8 +		
     3.9  #ifdef CONFIG_X86_PAE
    3.10  	pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
    3.11  	make_lowmem_page_readonly(pmd_table);
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/e820.c	Tue Jan 10 15:05:05 2006 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/e820.c	Tue Jan 10 17:27:16 2006 +0100
     4.3 @@ -526,7 +526,7 @@ extern union xen_start_info_union xen_st
     4.4  
     4.5  unsigned long __init e820_end_of_ram(void)
     4.6  {
     4.7 -        unsigned long max_end_pfn;
     4.8 +	unsigned long max_end_pfn;
     4.9  
    4.10  	if (xen_override_max_pfn == 0) {
    4.11  		max_end_pfn = xen_start_info->nr_pages;
    4.12 @@ -612,7 +612,7 @@ void __init parse_memopt(char *p, char *
    4.13  { 
    4.14  	end_user_pfn = memparse(p, from);
    4.15  	end_user_pfn >>= PAGE_SHIFT;	
    4.16 -        xen_override_max_pfn = (unsigned long) end_user_pfn;
    4.17 +	xen_override_max_pfn = (unsigned long) end_user_pfn;
    4.18  } 
    4.19  
    4.20  /*
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S	Tue Jan 10 15:05:05 2006 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S	Tue Jan 10 17:27:16 2006 +0100
     5.3 @@ -57,7 +57,7 @@
     5.4  #ifndef CONFIG_PREEMPT
     5.5  #define retint_kernel retint_restore_args
     5.6  #endif	
     5.7 -
     5.8 +	
     5.9  /*
    5.10   * C code is not supposed to know about undefined top of stack. Every time 
    5.11   * a C function with an pt_regs argument is called from the SYSCALL based 
    5.12 @@ -65,7 +65,7 @@
    5.13   * RESTORE_TOP_OF_STACK syncs the syscall state after any possible ptregs
    5.14   * manipulation.
    5.15   */        	
    5.16 -
    5.17 +		
    5.18  	/* %rsp:at FRAMEEND */ 
    5.19  	.macro FIXUP_TOP_OF_STACK tmp
    5.20  	movq    $__USER_CS,CS(%rsp)
    5.21 @@ -418,7 +418,6 @@ ENTRY(stub_rt_sigreturn)
    5.22  	jmp int_ret_from_sys_call
    5.23  	CFI_ENDPROC
    5.24  
    5.25 -
    5.26  /* 
    5.27   * Interrupt entry/exit.
    5.28   *
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c	Tue Jan 10 15:05:05 2006 +0000
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c	Tue Jan 10 17:27:16 2006 +0100
     6.3 @@ -68,13 +68,13 @@ static void __init copy_bootdata(char *r
     6.4  
     6.5  static void __init setup_boot_cpu_data(void)
     6.6  {
     6.7 -	int dummy, eax;
     6.8 +	unsigned int dummy, eax;
     6.9  
    6.10  	/* get vendor info */
    6.11 -	cpuid(0, &boot_cpu_data.cpuid_level,
    6.12 -	      (int *)&boot_cpu_data.x86_vendor_id[0],
    6.13 -	      (int *)&boot_cpu_data.x86_vendor_id[8],
    6.14 -	      (int *)&boot_cpu_data.x86_vendor_id[4]);
    6.15 +	cpuid(0, (unsigned int *)&boot_cpu_data.cpuid_level,
    6.16 +	      (unsigned int *)&boot_cpu_data.x86_vendor_id[0],
    6.17 +	      (unsigned int *)&boot_cpu_data.x86_vendor_id[8],
    6.18 +	      (unsigned int *)&boot_cpu_data.x86_vendor_id[4]);
    6.19  
    6.20  	/* get cpu type */
    6.21  	cpuid(1, &eax, &dummy, &dummy,
    6.22 @@ -109,7 +109,6 @@ void __init x86_64_start_kernel(char * r
    6.23  	if (s != NULL)
    6.24  		setup_early_printk(s);
    6.25  #endif
    6.26 -
    6.27  #ifdef CONFIG_DISCONTIGMEM
    6.28  	s = strstr(saved_command_line, "numa=");
    6.29  	if (s != NULL)
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/io_apic.c	Tue Jan 10 15:05:05 2006 +0000
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/io_apic.c	Tue Jan 10 17:27:16 2006 +0100
     7.3 @@ -255,11 +255,9 @@ static int __init enable_ioapic_setup(ch
     7.4  	return 1;
     7.5  }
     7.6  
     7.7 -
     7.8  __setup("noapic", disable_ioapic_setup);
     7.9  __setup("apic", enable_ioapic_setup);
    7.10  
    7.11 -
    7.12  #include <asm/pci-direct.h>
    7.13  #include <linux/pci_ids.h>
    7.14  #include <linux/pci.h>
    7.15 @@ -1146,6 +1144,7 @@ void __apicdebuginit print_PIC(void)
    7.16  	v = inb(0x4d1) << 8 | inb(0x4d0);
    7.17  	printk(KERN_DEBUG "... PIC ELCR: %04x\n", v);
    7.18  }
    7.19 +
    7.20  #endif  /*  0  */
    7.21  
    7.22  #else
    7.23 @@ -1191,6 +1190,7 @@ void disable_IO_APIC(void)
    7.24  	 * Clear the IO-APIC before rebooting:
    7.25  	 */
    7.26  	clear_IO_APIC();
    7.27 +
    7.28  #ifndef CONFIG_XEN
    7.29  	disconnect_bsp_APIC();
    7.30  #endif
    7.31 @@ -1202,6 +1202,7 @@ void disable_IO_APIC(void)
    7.32   *
    7.33   * by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999
    7.34   */
    7.35 +
    7.36  #ifndef CONFIG_XEN
    7.37  static void __init setup_ioapic_ids_from_mpc (void)
    7.38  {
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/irq.c	Tue Jan 10 15:05:05 2006 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/irq.c	Tue Jan 10 17:27:16 2006 +0100
     8.3 @@ -9,18 +9,15 @@
     8.4   * x86_64-specific irq controller code. (e.g. i8259.c and
     8.5   * io_apic.c.)
     8.6   */
     8.7 -#include <asm/uaccess.h>
     8.8 -#include <linux/module.h>
     8.9 -#include <linux/seq_file.h>
    8.10 -#include <linux/interrupt.h>
    8.11 +
    8.12  #include <linux/kernel_stat.h>
    8.13 -
    8.14 -/*
    8.15 - * Interrupt statistics:
    8.16 - */
    8.17 +#include <linux/interrupt.h>
    8.18 +#include <linux/seq_file.h>
    8.19 +#include <linux/module.h>
    8.20 +#include <asm/uaccess.h>
    8.21 +#include <asm/io_apic.h>
    8.22  
    8.23  atomic_t irq_err_count;
    8.24 -
    8.25  #ifdef CONFIG_X86_IO_APIC
    8.26  #ifdef APIC_MISMATCH_DEBUG
    8.27  atomic_t irq_mis_count;
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c	Tue Jan 10 15:05:05 2006 +0000
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c	Tue Jan 10 17:27:16 2006 +0100
     9.3 @@ -62,6 +62,7 @@ static int alloc_ldt(mm_context_t *pc, u
     9.4  	if (reload) {
     9.5  #ifdef CONFIG_SMP
     9.6  		cpumask_t mask;
     9.7 +
     9.8  		preempt_disable();
     9.9  #endif
    9.10  		make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
    9.11 @@ -201,6 +202,7 @@ static int write_ldt(void __user * ptr, 
    9.12  	struct user_desc ldt_info;
    9.13  
    9.14  	error = -EINVAL;
    9.15 +
    9.16  	if (bytecount != sizeof(ldt_info))
    9.17  		goto out;
    9.18  	error = -EFAULT; 	
    10.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Tue Jan 10 15:05:05 2006 +0000
    10.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Tue Jan 10 17:27:16 2006 +0100
    10.3 @@ -304,7 +304,6 @@ static void __init probe_roms(void)
    10.4  }
    10.5  #endif
    10.6  
    10.7 -
    10.8  static __init void parse_cmdline_early (char ** cmdline_p)
    10.9  {
   10.10  	char c = ' ', *to = command_line, *from = COMMAND_LINE;
   10.11 @@ -379,6 +378,7 @@ static __init void parse_cmdline_early (
   10.12  			acpi_skip_timer_override = 1;
   10.13  #endif
   10.14  #endif
   10.15 +
   10.16  #ifndef CONFIG_XEN
   10.17  		if (!memcmp(from, "nolapic", 7) ||
   10.18  		    !memcmp(from, "disableapic", 11))
   10.19 @@ -391,7 +391,8 @@ static __init void parse_cmdline_early (
   10.20  			skip_ioapic_setup = 0;
   10.21  			ioapic_force = 1;
   10.22  		}
   10.23 -#endif			
   10.24 +#endif
   10.25 +			
   10.26  		if (!memcmp(from, "mem=", 4))
   10.27  			parse_memopt(from+4, &from); 
   10.28  
   10.29 @@ -588,7 +589,7 @@ void __init setup_arch(char **cmdline_p)
   10.30  	HYPERVISOR_vm_assist(VMASST_CMD_enable,
   10.31  			     VMASST_TYPE_writable_pagetables);
   10.32  
   10.33 -        ARCH_SETUP
   10.34 +	ARCH_SETUP
   10.35  #else
   10.36   	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
   10.37   	drive_info = DRIVE_INFO;
   10.38 @@ -612,7 +613,7 @@ void __init setup_arch(char **cmdline_p)
   10.39  	init_mm.end_code = (unsigned long) &_etext;
   10.40  	init_mm.end_data = (unsigned long) &_edata;
   10.41  #ifdef CONFIG_XEN
   10.42 -        init_mm.brk = start_pfn << PAGE_SHIFT;
   10.43 +	init_mm.brk = start_pfn << PAGE_SHIFT;
   10.44  #else
   10.45  	init_mm.brk = (unsigned long) &_end;	
   10.46  
   10.47 @@ -668,7 +669,6 @@ void __init setup_arch(char **cmdline_p)
   10.48  	reserve_ebda_region();
   10.49  #endif
   10.50  
   10.51 -
   10.52  #ifdef CONFIG_SMP
   10.53  	/*
   10.54  	 * But first pinch a few for the stack/trampoline stuff
   10.55 @@ -790,8 +790,6 @@ void __init setup_arch(char **cmdline_p)
   10.56  
   10.57  	}
   10.58  
   10.59 -
   10.60 -
   10.61  	if ( ! (xen_start_info->flags & SIF_INITDOMAIN))
   10.62  	{
   10.63  		acpi_disabled = 1;
   10.64 @@ -835,7 +833,7 @@ void __init setup_arch(char **cmdline_p)
   10.65  	 * and also for regions reported as reserved by the e820.
   10.66  	 */
   10.67  	probe_roms();
   10.68 -	e820_reserve_resources();
   10.69 +	e820_reserve_resources(); 
   10.70  #endif
   10.71  
   10.72  	request_resource(&iomem_resource, &video_ram_resource);
    11.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c	Tue Jan 10 15:05:05 2006 +0000
    11.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c	Tue Jan 10 17:27:16 2006 +0100
    11.3 @@ -33,6 +33,7 @@
    11.4  #ifdef CONFIG_XEN
    11.5  #include <asm/hypervisor.h>
    11.6  #endif
    11.7 +
    11.8  char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
    11.9  
   11.10  cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
   11.11 @@ -165,7 +166,6 @@ void __init cpu_gdt_init(struct desc_ptr
   11.12  }
   11.13  #endif
   11.14  
   11.15 -
   11.16  void pda_init(int cpu)
   11.17  { 
   11.18  	struct x8664_pda *pda = &cpu_pda[cpu];
   11.19 @@ -175,9 +175,10 @@ void pda_init(int cpu)
   11.20  #ifndef CONFIG_XEN
   11.21  	wrmsrl(MSR_GS_BASE, cpu_pda + cpu);
   11.22  #else
   11.23 -        HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL, 
   11.24 -                                    (unsigned long)(cpu_pda + cpu));
   11.25 +	HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL, 
   11.26 +				    (unsigned long)(cpu_pda + cpu));
   11.27  #endif
   11.28 +
   11.29  	pda->me = pda;
   11.30  	pda->cpunumber = cpu; 
   11.31  	pda->irqcount = -1;
   11.32 @@ -201,6 +202,7 @@ void pda_init(int cpu)
   11.33  	}
   11.34  
   11.35  	switch_pt();
   11.36 +
   11.37  	pda->irqstackptr += IRQSTACKSIZE-64;
   11.38  } 
   11.39  
    12.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smp.c	Tue Jan 10 15:05:05 2006 +0000
    12.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smp.c	Tue Jan 10 17:27:16 2006 +0100
    12.3 @@ -30,8 +30,9 @@
    12.4  #include <asm/apicdef.h>
    12.5  #ifdef CONFIG_XEN
    12.6  #include <asm-xen/evtchn.h>
    12.7 +#endif
    12.8  
    12.9 -#else
   12.10 +#ifndef CONFIG_XEN
   12.11  /*
   12.12   *	Smarter SMP flushing macros. 
   12.13   *		c/o Linus Torvalds.
    13.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c	Tue Jan 10 15:05:05 2006 +0000
    13.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c	Tue Jan 10 17:27:16 2006 +0100
    13.3 @@ -890,7 +890,6 @@ asmlinkage void __attribute__((weak)) sm
    13.4  asmlinkage void math_state_restore(void)
    13.5  {
    13.6  	struct task_struct *me = current;
    13.7 -        
    13.8          /* clts(); */ /* 'clts' is done for us by Xen during virtual trap. */
    13.9  
   13.10  	if (!used_math())
    14.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Tue Jan 10 15:05:05 2006 +0000
    14.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Tue Jan 10 17:27:16 2006 +0100
    14.3 @@ -153,7 +153,6 @@ void dump_pagetable(unsigned long addres
    14.4  	pgd = (pgd_t *)per_cpu(cur_pgd, smp_processor_id());
    14.5  	preempt_enable();
    14.6  	pgd += pgd_index(address);
    14.7 -
    14.8  	printk("PGD %lx ", pgd_val(*pgd));
    14.9  	if (bad_address(pgd)) goto bad;
   14.10  	if (!pgd_present(*pgd)) goto ret; 
   14.11 @@ -258,7 +257,6 @@ static int vmalloc_fault(unsigned long a
   14.12  	pgd = (pgd_t *)per_cpu(cur_pgd, smp_processor_id());
   14.13  	preempt_enable();
   14.14  	pgd += pgd_index(address);
   14.15 -
   14.16  	pgd_ref = pgd_offset_k(address);
   14.17  	if (pgd_none(*pgd_ref))
   14.18  		return -1;
    15.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Tue Jan 10 15:05:05 2006 +0000
    15.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Tue Jan 10 17:27:16 2006 +0100
    15.3 @@ -40,16 +40,16 @@
    15.4  #include <asm/proto.h>
    15.5  #include <asm/smp.h>
    15.6  
    15.7 +#ifndef Dprintk
    15.8 +#define Dprintk(x...)
    15.9 +#endif
   15.10 +
   15.11  extern unsigned long *contiguous_bitmap;
   15.12  
   15.13  #if defined(CONFIG_SWIOTLB)
   15.14  extern void swiotlb_init(void);
   15.15  #endif
   15.16  
   15.17 -#ifndef Dprintk
   15.18 -#define Dprintk(x...)
   15.19 -#endif
   15.20 -
   15.21  extern char _stext[];
   15.22  
   15.23  DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
   15.24 @@ -200,9 +200,9 @@ static void *spp_getpage(void)
   15.25  
   15.26  static inline pud_t *pud_offset_u(unsigned long address)
   15.27  {
   15.28 -        pud_t *pud = level3_user_pgt;
   15.29 +	pud_t *pud = level3_user_pgt;
   15.30  
   15.31 -        return pud + pud_index(address);
   15.32 +	return pud + pud_index(address);
   15.33  }
   15.34  
   15.35  static void set_pte_phys(unsigned long vaddr,
   15.36 @@ -215,34 +215,27 @@ static void set_pte_phys(unsigned long v
   15.37  
   15.38  	Dprintk("set_pte_phys %lx to %lx\n", vaddr, phys);
   15.39  
   15.40 -        pgd = (user_mode ? pgd_offset_u(vaddr) : pgd_offset_k(vaddr));
   15.41 -
   15.42 +	pgd = (user_mode ? pgd_offset_u(vaddr) : pgd_offset_k(vaddr));
   15.43  	if (pgd_none(*pgd)) {
   15.44  		printk("PGD FIXMAP MISSING, it should be setup in head.S!\n");
   15.45  		return;
   15.46  	}
   15.47 -        
   15.48 -        pud = (user_mode ? pud_offset_u(vaddr) : pud_offset(pgd, vaddr));
   15.49 -
   15.50 +	pud = (user_mode ? pud_offset_u(vaddr) : pud_offset(pgd, vaddr));
   15.51  	if (pud_none(*pud)) {
   15.52  		pmd = (pmd_t *) spp_getpage(); 
   15.53 -
   15.54 -                make_page_readonly(pmd);
   15.55 -                xen_pmd_pin(__pa(pmd));
   15.56 +		make_page_readonly(pmd);
   15.57 +		xen_pmd_pin(__pa(pmd));
   15.58  		set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER));
   15.59  		if (pmd != pmd_offset(pud, 0)) {
   15.60  			printk("PAGETABLE BUG #01! %p <-> %p\n", pmd, pmd_offset(pud,0));
   15.61  			return;
   15.62  		}
   15.63  	}
   15.64 -
   15.65  	pmd = pmd_offset(pud, vaddr);
   15.66 -
   15.67  	if (pmd_none(*pmd)) {
   15.68  		pte = (pte_t *) spp_getpage();
   15.69 -                make_page_readonly(pte);
   15.70 -
   15.71 -                xen_pte_pin(__pa(pte));
   15.72 +		make_page_readonly(pte);
   15.73 +		xen_pte_pin(__pa(pte));
   15.74  		set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER));
   15.75  		if (pte != pte_offset_kernel(pmd, 0)) {
   15.76  			printk("PAGETABLE BUG #02!\n");
   15.77 @@ -252,11 +245,10 @@ static void set_pte_phys(unsigned long v
   15.78  	new_pte = pfn_pte(phys >> PAGE_SHIFT, prot);
   15.79  
   15.80  	pte = pte_offset_kernel(pmd, vaddr);
   15.81 -
   15.82  	if (!pte_none(*pte) &&
   15.83  	    pte_val(*pte) != (pte_val(new_pte) & __supported_pte_mask))
   15.84  		pte_ERROR(*pte);
   15.85 -        set_pte(pte, new_pte);
   15.86 +	set_pte(pte, new_pte);
   15.87  
   15.88  	/*
   15.89  	 * It's enough to flush this one mapping.
   15.90 @@ -284,11 +276,11 @@ static void set_pte_phys_ma(unsigned lon
   15.91  	if (pud_none(*pud)) {
   15.92  
   15.93  		pmd = (pmd_t *) spp_getpage(); 
   15.94 -                make_page_readonly(pmd);
   15.95 -                xen_pmd_pin(__pa(pmd));
   15.96 +		make_page_readonly(pmd);
   15.97 +		xen_pmd_pin(__pa(pmd));
   15.98  
   15.99  		set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE | _PAGE_USER));
  15.100 -         
  15.101 +
  15.102  		if (pmd != pmd_offset(pud, 0)) {
  15.103  			printk("PAGETABLE BUG #01! %p <-> %p\n", pmd, pmd_offset(pud,0));
  15.104  			return;
  15.105 @@ -298,8 +290,8 @@ static void set_pte_phys_ma(unsigned lon
  15.106  
  15.107  	if (pmd_none(*pmd)) {
  15.108  		pte = (pte_t *) spp_getpage();
  15.109 -                make_page_readonly(pte);  
  15.110 -                xen_pte_pin(__pa(pte));
  15.111 +		make_page_readonly(pte);  
  15.112 +		xen_pte_pin(__pa(pte));
  15.113  
  15.114  		set_pmd(pmd, __pmd(__pa(pte) | _KERNPG_TABLE | _PAGE_USER));
  15.115  		if (pte != pte_offset_kernel(pmd, 0)) {
  15.116 @@ -311,12 +303,12 @@ static void set_pte_phys_ma(unsigned lon
  15.117  	new_pte = pfn_pte_ma(phys >> PAGE_SHIFT, prot);
  15.118  	pte = pte_offset_kernel(pmd, vaddr);
  15.119  
  15.120 -        /* 
  15.121 -         * Note that the pte page is already RO, thus we want to use
  15.122 -         * xen_l1_entry_update(), not set_pte().
  15.123 -         */
  15.124 -        xen_l1_entry_update(pte, 
  15.125 -                            pfn_pte_ma(phys >> PAGE_SHIFT, prot));
  15.126 +	/* 
  15.127 +	 * Note that the pte page is already RO, thus we want to use
  15.128 +	 * xen_l1_entry_update(), not set_pte().
  15.129 +	 */
  15.130 +	xen_l1_entry_update(pte, 
  15.131 +			    pfn_pte_ma(phys >> PAGE_SHIFT, prot));
  15.132  
  15.133  	/*
  15.134  	 * It's enough to flush this one mapping.
  15.135 @@ -347,7 +339,6 @@ void __set_fixmap (enum fixed_addresses 
  15.136  	}
  15.137  }
  15.138  
  15.139 -
  15.140  /*
  15.141   * At this point it only supports vsyscall area.
  15.142   */
  15.143 @@ -360,18 +351,18 @@ void __set_fixmap_user (enum fixed_addre
  15.144  		return;
  15.145  	}
  15.146  
  15.147 -        set_pte_phys(address, phys, prot, SET_FIXMAP_USER); 
  15.148 +	set_pte_phys(address, phys, prot, SET_FIXMAP_USER); 
  15.149  }
  15.150  
  15.151  unsigned long __initdata table_start, tables_space; 
  15.152  
  15.153  unsigned long get_machine_pfn(unsigned long addr)
  15.154  {
  15.155 -        pud_t* pud = pud_offset_k(addr);
  15.156 -        pmd_t* pmd = pmd_offset(pud, addr);
  15.157 -        pte_t *pte = pte_offset_kernel(pmd, addr);
  15.158 -        
  15.159 -        return pte_mfn(*pte);
  15.160 +	pud_t* pud = pud_offset_k(addr);
  15.161 +	pmd_t* pmd = pmd_offset(pud, addr);
  15.162 +	pte_t *pte = pte_offset_kernel(pmd, addr);
  15.163 +
  15.164 +	return pte_mfn(*pte);
  15.165  } 
  15.166  
  15.167  static __init void *alloc_static_page(unsigned long *phys)
  15.168 @@ -411,12 +402,11 @@ static inline int make_readonly(unsigned
  15.169  
  15.170  static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
  15.171  { 
  15.172 -        long i, j, k; 
  15.173 -        unsigned long paddr;
  15.174 +	long i, j, k; 
  15.175 +	unsigned long paddr;
  15.176  
  15.177  	i = pud_index(address);
  15.178  	pud = pud + i;
  15.179 -
  15.180  	for (; i < PTRS_PER_PUD; pud++, i++) {
  15.181  		unsigned long pmd_phys;
  15.182  		pmd_t *pmd;
  15.183 @@ -429,38 +419,37 @@ static void __init phys_pud_init(pud_t *
  15.184  		} 
  15.185  
  15.186  		pmd = alloc_static_page(&pmd_phys);
  15.187 -                early_make_page_readonly(pmd);
  15.188 -                xen_pmd_pin(pmd_phys);
  15.189 +		early_make_page_readonly(pmd);
  15.190 +		xen_pmd_pin(pmd_phys);
  15.191  		set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
  15.192 -
  15.193        		for (j = 0; j < PTRS_PER_PMD; pmd++, j++) {
  15.194 -                        unsigned long pte_phys;
  15.195 -                        pte_t *pte, *pte_save;
  15.196 +			unsigned long pte_phys;
  15.197 +			pte_t *pte, *pte_save;
  15.198  
  15.199  			if (paddr >= end) { 
  15.200  				for (; j < PTRS_PER_PMD; j++, pmd++)
  15.201  					set_pmd(pmd,  __pmd(0)); 
  15.202  				break;
  15.203  			}
  15.204 -                        pte = alloc_static_page(&pte_phys);
  15.205 -                        pte_save = pte;
  15.206 -                        for (k = 0; k < PTRS_PER_PTE; pte++, k++, paddr += PTE_SIZE) {
  15.207 -                                if ((paddr >= end) ||
  15.208 -                                    ((paddr >> PAGE_SHIFT) >=
  15.209 -                                     xen_start_info->nr_pages)) { 
  15.210 -                                        __set_pte(pte, __pte(0)); 
  15.211 -                                        continue;
  15.212 -                                }
  15.213 -                                if (make_readonly(paddr)) {
  15.214 -                                        __set_pte(pte, 
  15.215 -                                                __pte(paddr | (_KERNPG_TABLE & ~_PAGE_RW)));
  15.216 -                                        continue;
  15.217 -                                }
  15.218 -                                __set_pte(pte, __pte(paddr | _KERNPG_TABLE));
  15.219 -                        }
  15.220 -                        pte = pte_save;
  15.221 -                        early_make_page_readonly(pte);  
  15.222 -                        xen_pte_pin(pte_phys);
  15.223 +			pte = alloc_static_page(&pte_phys);
  15.224 +			pte_save = pte;
  15.225 +			for (k = 0; k < PTRS_PER_PTE; pte++, k++, paddr += PTE_SIZE) {
  15.226 +				if ((paddr >= end) ||
  15.227 +				    ((paddr >> PAGE_SHIFT) >=
  15.228 +				     xen_start_info->nr_pages)) { 
  15.229 +					__set_pte(pte, __pte(0)); 
  15.230 +					continue;
  15.231 +				}
  15.232 +				if (make_readonly(paddr)) {
  15.233 +					__set_pte(pte, 
  15.234 +						__pte(paddr | (_KERNPG_TABLE & ~_PAGE_RW)));
  15.235 +					continue;
  15.236 +				}
  15.237 +				__set_pte(pte, __pte(paddr | _KERNPG_TABLE));
  15.238 +			}
  15.239 +			pte = pte_save;
  15.240 +			early_make_page_readonly(pte);  
  15.241 +			xen_pte_pin(pte_phys);
  15.242  			set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE));
  15.243  		}
  15.244  	}
  15.245 @@ -506,7 +495,7 @@ void __init xen_init_pt(void)
  15.246  	level3_kernel_pgt[pud_index(__START_KERNEL_map)] = 
  15.247  		__pud(__pa_symbol(level2_kernel_pgt) |
  15.248  		      _KERNPG_TABLE | _PAGE_USER);
  15.249 -        memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
  15.250 +	memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
  15.251  
  15.252  	early_make_page_readonly(init_level4_pgt);
  15.253  	early_make_page_readonly(init_level4_user_pgt);
  15.254 @@ -618,7 +607,7 @@ extern struct x8664_pda cpu_pda[NR_CPUS]
  15.255  
  15.256  void zap_low_mappings(void)
  15.257  {
  15.258 -        /* this is not required for Xen */
  15.259 +	/* this is not required for Xen */
  15.260  #if 0
  15.261  	swap_low_mappings();
  15.262  #endif
  15.263 @@ -629,11 +618,11 @@ void __init paging_init(void)
  15.264  {
  15.265  	{
  15.266  		unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
  15.267 -                /*	unsigned int max_dma; */
  15.268 -                /* max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; */
  15.269 -                /* if (end_pfn < max_dma) */
  15.270 +		/*	unsigned int max_dma; */
  15.271 +		/* max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; */
  15.272 +		/* if (end_pfn < max_dma) */
  15.273  			zones_size[ZONE_DMA] = end_pfn;
  15.274 -#if 0                
  15.275 +#if 0
  15.276  		else {
  15.277  			zones_size[ZONE_DMA] = max_dma;
  15.278  			zones_size[ZONE_NORMAL] = end_pfn - max_dma;
  15.279 @@ -642,16 +631,16 @@ void __init paging_init(void)
  15.280  		free_area_init(zones_size);
  15.281  	}
  15.282  
  15.283 -        set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
  15.284 -        HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
  15.285 +	set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
  15.286 +	HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
  15.287  
  15.288 -        memset(empty_zero_page, 0, sizeof(empty_zero_page));
  15.289 +	memset(empty_zero_page, 0, sizeof(empty_zero_page));
  15.290  	init_mm.context.pinned = 1;
  15.291  
  15.292  #ifdef CONFIG_XEN_PHYSDEV_ACCESS
  15.293  	{
  15.294  		int i;
  15.295 -        /* Setup mapping of lower 1st MB */
  15.296 +		/* Setup mapping of lower 1st MB */
  15.297  		for (i = 0; i < NR_FIX_ISAMAPS; i++)
  15.298  			if (xen_start_info->flags & SIF_PRIVILEGED)
  15.299  				set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
  15.300 @@ -701,7 +690,7 @@ void __init clear_kernel_mapping(unsigne
  15.301  
  15.302  static inline int page_is_ram (unsigned long pagenr)
  15.303  {
  15.304 -        return 1;
  15.305 +	return 1;
  15.306  }
  15.307  
  15.308  static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
  15.309 @@ -790,10 +779,10 @@ extern char __initdata_begin[], __initda
  15.310  void free_initmem(void)
  15.311  {
  15.312  #ifdef __DO_LATER__
  15.313 -        /*
  15.314 -         * Some pages can be pinned, but some are not. Unpinning such pages 
  15.315 -         * triggers BUG(). 
  15.316 -         */
  15.317 +	/*
  15.318 +	 * Some pages can be pinned, but some are not. Unpinning such pages 
  15.319 +	 * triggers BUG(). 
  15.320 +	 */
  15.321  	unsigned long addr;
  15.322  
  15.323  	addr = (unsigned long)(&__init_begin);
  15.324 @@ -801,12 +790,12 @@ void free_initmem(void)
  15.325  		ClearPageReserved(virt_to_page(addr));
  15.326  		set_page_count(virt_to_page(addr), 1);
  15.327  		memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE); 
  15.328 -                xen_pte_unpin(__pa(addr));
  15.329 -                make_page_writable(__va(__pa(addr)));
  15.330 -                /*
  15.331 -                 * Make pages from __PAGE_OFFSET address as well
  15.332 -                 */
  15.333 -                make_page_writable((void *)addr);
  15.334 +		xen_pte_unpin(__pa(addr));
  15.335 +		make_page_writable(__va(__pa(addr)));
  15.336 +		/*
  15.337 +		 * Make pages from __PAGE_OFFSET address as well
  15.338 +		 */
  15.339 +		make_page_writable((void *)addr);
  15.340  		free_page(addr);
  15.341  		totalram_pages++;
  15.342  	}
  15.343 @@ -856,7 +845,7 @@ int kern_addr_valid(unsigned long addr)
  15.344  	if (pgd_none(*pgd))
  15.345  		return 0;
  15.346  
  15.347 -        pud = pud_offset_k(addr);
  15.348 +	pud = pud_offset_k(addr);
  15.349  	if (pud_none(*pud))
  15.350  		return 0; 
  15.351