diff options
Diffstat (limited to 'arch/ia64/kernel')
59 files changed, 1055 insertions, 2379 deletions
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile index 395c2f216dd..20678a9ed11 100644 --- a/arch/ia64/kernel/Makefile +++ b/arch/ia64/kernel/Makefile @@ -23,7 +23,6 @@ obj-$(CONFIG_SMP)		+= smp.o smpboot.o  obj-$(CONFIG_NUMA)		+= numa.o  obj-$(CONFIG_PERFMON)		+= perfmon_default_smpl.o  obj-$(CONFIG_IA64_CYCLONE)	+= cyclone.o -obj-$(CONFIG_CPU_FREQ)		+= cpufreq/  obj-$(CONFIG_IA64_MCA_RECOVERY)	+= mca_recovery.o  obj-$(CONFIG_KPROBES)		+= kprobes.o jprobes.o  obj-$(CONFIG_DYNAMIC_FTRACE)	+= ftrace.o @@ -43,7 +42,7 @@ obj-$(CONFIG_IA64_ESI)		+= esi.o  ifneq ($(CONFIG_IA64_ESI),)  obj-y				+= esi_stub.o	# must be in kernel proper  endif -obj-$(CONFIG_DMAR)		+= pci-dma.o +obj-$(CONFIG_INTEL_IOMMU)	+= pci-dma.o  obj-$(CONFIG_SWIOTLB)		+= pci-swiotlb.o  obj-$(CONFIG_BINFMT_ELF)	+= elfcore.o diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index c6c90f39f4d..615ef81def4 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -50,19 +50,13 @@  #include <asm/iosapic.h>  #include <asm/machvec.h>  #include <asm/page.h> -#include <asm/system.h>  #include <asm/numa.h>  #include <asm/sal.h>  #include <asm/cyclone.h> -#include <asm/xen/hypervisor.h> - -#define BAD_MADT_ENTRY(entry, end) (                                        \ -		(!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \ -		((struct acpi_subtable_header *)entry)->length < sizeof(*entry))  #define PREFIX			"ACPI: " -u32 acpi_rsdt_forced; +int acpi_lapic;  unsigned int acpi_cpei_override;  unsigned int acpi_cpei_phys_cpuid; @@ -88,7 +82,7 @@ acpi_get_sysname(void)  	struct acpi_table_rsdp *rsdp;  	struct acpi_table_xsdt *xsdt;  	struct acpi_table_header *hdr; -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU  	u64 i, nentries;  #endif @@ -121,11 +115,9 @@ acpi_get_sysname(void)  			return "uv";  		else  			return "sn2"; -	} else if (xen_pv_domain() && !strcmp(hdr->oem_id, "XEN")) { -		return "xen";  	} -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU  	/* Look for Intel IOMMU */  	nentries = (hdr->length - sizeof(*hdr)) /  			 sizeof(xsdt->table_offset_entry[0]); @@ -349,11 +341,11 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header,  	iosapic_override_isa_irq(p->source_irq, p->global_irq,  				 ((p->inti_flags & ACPI_MADT_POLARITY_MASK) == -				  ACPI_MADT_POLARITY_ACTIVE_HIGH) ? -				 IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, +				  ACPI_MADT_POLARITY_ACTIVE_LOW) ? +				 IOSAPIC_POL_LOW : IOSAPIC_POL_HIGH,  				 ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) == -				 ACPI_MADT_TRIGGER_EDGE) ? -				 IOSAPIC_EDGE : IOSAPIC_LEVEL); +				 ACPI_MADT_TRIGGER_LEVEL) ? +				 IOSAPIC_LEVEL : IOSAPIC_EDGE);  	return 0;  } @@ -423,28 +415,30 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)  #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)  static int __initdata srat_num_cpus;	/* number of cpus */ -static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; +static u32 pxm_flag[PXM_FLAG_LEN];  #define pxm_bit_set(bit)	(set_bit(bit,(void *)pxm_flag))  #define pxm_bit_test(bit)	(test_bit(bit,(void *)pxm_flag))  static struct acpi_table_slit __initdata *slit_table;  cpumask_t early_cpu_possible_map = CPU_MASK_NONE; -static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa) +static int __init +get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)  {  	int pxm;  	pxm = pa->proximity_domain_lo; -	if (ia64_platform_is("sn2")) +	if (ia64_platform_is("sn2") || acpi_srat_revision >= 2)  		pxm += pa->proximity_domain_hi[0] << 8;  	return pxm;  } -static int get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma) +static int __init +get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)  {  	int pxm;  	pxm = ma->proximity_domain; -	if (!ia64_platform_is("sn2")) +	if (!ia64_platform_is("sn2") && acpi_srat_revision <= 1)  		pxm &= 0xff;  	return pxm; @@ -477,6 +471,12 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)  	if (!(pa->flags & ACPI_SRAT_CPU_ENABLED))  		return; +	if (srat_num_cpus >= ARRAY_SIZE(node_cpuid)) { +		printk_once(KERN_WARNING +			    "node_cpuid[%ld] is too small, may not be able to use all cpus\n", +			    ARRAY_SIZE(node_cpuid)); +		return; +	}  	pxm = get_processor_proximity_domain(pa);  	/* record this node in proximity bitmap */ @@ -490,7 +490,7 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)  	srat_num_cpus++;  } -void __init +int __init  acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)  {  	unsigned long paddr, size; @@ -505,7 +505,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)  	/* Ignore disabled entries */  	if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) -		return; +		return -1;  	/* record this node in proximity bitmap */  	pxm_bit_set(pxm); @@ -524,6 +524,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)  	p->size = size;  	p->nid = pxm;  	num_node_memblks++; +	return 0;  }  void __init acpi_numa_arch_fixup(void) @@ -625,6 +626,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)  				      ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :  				     IOSAPIC_LEVEL);  } +EXPORT_SYMBOL_GPL(acpi_register_gsi);  void acpi_unregister_gsi(u32 gsi)  { @@ -636,6 +638,7 @@ void acpi_unregister_gsi(u32 gsi)  	iosapic_unregister_intr(gsi);  } +EXPORT_SYMBOL_GPL(acpi_unregister_gsi);  static int __init acpi_parse_fadt(struct acpi_table_header *table)  { @@ -674,6 +677,8 @@ int __init early_acpi_boot_init(void)  	if (ret < 1)  		printk(KERN_ERR PREFIX  		       "Error parsing MADT - no LAPIC entries\n"); +	else +		acpi_lapic = 1;  #ifdef CONFIG_SMP  	if (available_cpus == 0) { @@ -797,14 +802,9 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)   *  ACPI based hotplug CPU support   */  #ifdef CONFIG_ACPI_HOTPLUG_CPU -static -int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) +static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)  {  #ifdef CONFIG_ACPI_NUMA -	int pxm_id; -	int nid; - -	pxm_id = acpi_get_pxm(handle);  	/*  	 * We don't have cpu-only-node hotadd. But if the system equips  	 * SRAT table, pxm is already found and node is ready. @@ -812,11 +812,10 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)  	 * This code here is for the system which doesn't have full SRAT    	 * table for possible cpus.  	 */ -	nid = acpi_map_pxm_to_node(pxm_id);  	node_cpuid[cpu].phys_id = physid; -	node_cpuid[cpu].nid = nid; +	node_cpuid[cpu].nid = acpi_get_node(handle);  #endif -	return (0); +	return 0;  }  int additional_cpus __initdata = -1; @@ -832,11 +831,11 @@ static __init int setup_additional_cpus(char *s)  early_param("additional_cpus", setup_additional_cpus);  /* - * cpu_possible_map should be static, it cannot change as CPUs + * cpu_possible_mask should be static, it cannot change as CPUs   * are onlined, or offlined. The reason is per-cpu data-structures   * are allocated by some modules at init time, and dont expect to   * do this dynamically on cpu arrival/departure. - * cpu_present_map on the other hand can change dynamically. + * cpu_present_mask on the other hand can change dynamically.   * In case when cpu_hotplug is not compiled, then we resort to current   * behaviour, which is cpu_possible == cpu_present.   * - Ashok Raj @@ -872,40 +871,10 @@ __init void prefill_possible_map(void)  		set_cpu_possible(i, true);  } -int acpi_map_lsapic(acpi_handle handle, int *pcpu) +static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)  { -	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; -	union acpi_object *obj; -	struct acpi_madt_local_sapic *lsapic;  	cpumask_t tmp_map; -	int cpu, physid; - -	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) -		return -EINVAL; - -	if (!buffer.length || !buffer.pointer) -		return -EINVAL; - -	obj = buffer.pointer; -	if (obj->type != ACPI_TYPE_BUFFER) -	{ -		kfree(buffer.pointer); -		return -EINVAL; -	} - -	lsapic = (struct acpi_madt_local_sapic *)obj->buffer.pointer; - -	if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) || -	    (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))) { -		kfree(buffer.pointer); -		return -EINVAL; -	} - -	physid = ((lsapic->id << 8) | (lsapic->eid)); - -	kfree(buffer.pointer); -	buffer.length = ACPI_ALLOCATE_BUFFER; -	buffer.pointer = NULL; +	int cpu;  	cpumask_complement(&tmp_map, cpu_present_mask);  	cpu = cpumask_first(&tmp_map); @@ -914,7 +883,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)  	acpi_map_cpu2node(handle, cpu, physid); -	cpu_set(cpu, cpu_present_map); +	set_cpu_present(cpu, true);  	ia64_cpu_to_sapicid[cpu] = physid;  	acpi_processor_set_pdc(handle); @@ -923,12 +892,17 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)  	return (0);  } +/* wrapper to silence section mismatch warning */ +int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) +{ +	return _acpi_map_lsapic(handle, physid, pcpu); +}  EXPORT_SYMBOL(acpi_map_lsapic);  int acpi_unmap_lsapic(int cpu)  {  	ia64_cpu_to_sapicid[cpu] = -1; -	cpu_clear(cpu, cpu_present_map); +	set_cpu_present(cpu, false);  #ifdef CONFIG_ACPI_NUMA  	/* NUMA specific cleanup's */ @@ -941,14 +915,14 @@ EXPORT_SYMBOL(acpi_unmap_lsapic);  #endif				/* CONFIG_ACPI_HOTPLUG_CPU */  #ifdef CONFIG_ACPI_NUMA -static acpi_status __devinit -acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) +static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth, +				    void *context, void **ret)  {  	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };  	union acpi_object *obj;  	struct acpi_madt_io_sapic *iosapic;  	unsigned int gsi_base; -	int pxm, node; +	int node;  	/* Only care about objects w/ a method that returns the MADT */  	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) @@ -975,17 +949,9 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)  	kfree(buffer.pointer); -	/* -	 * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell -	 * us which node to associate this with. -	 */ -	pxm = acpi_get_pxm(handle); -	if (pxm < 0) -		return AE_OK; - -	node = pxm_to_node(pxm); - -	if (node >= MAX_NUMNODES || !node_online(node) || +	/* OK, it's an IOSAPIC MADT entry; associate it with a node */ +	node = acpi_get_node(handle); +	if (node == NUMA_NO_NODE || !node_online(node) ||  	    cpumask_empty(cpumask_of_node(node)))  		return AE_OK; @@ -1028,18 +994,8 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)  EXPORT_SYMBOL(acpi_unregister_ioapic);  /* - * acpi_save_state_mem() - save kernel state + * acpi_suspend_lowlevel() - save kernel state and suspend.   *   * TBD when when IA64 starts to support suspend...   */ -int acpi_save_state_mem(void) { return 0; }  - -/* - * acpi_restore_state() - */ -void acpi_restore_state_mem(void) {} - -/* - * do_suspend_lowlevel() - */ -void do_suspend_lowlevel(void) {} +int acpi_suspend_lowlevel(void) { return 0; } diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c index af565016904..60ef83e6db7 100644 --- a/arch/ia64/kernel/asm-offsets.c +++ b/arch/ia64/kernel/asm-offsets.c @@ -16,9 +16,6 @@  #include <asm/sigcontext.h>  #include <asm/mca.h> -#include <asm/xen/interface.h> -#include <asm/xen/hypervisor.h> -  #include "../kernel/sigframe.h"  #include "../kernel/fsyscall_gtod_data.h" @@ -41,7 +38,7 @@ void foo(void)  	DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));  	DEFINE(TI_CPU, offsetof(struct thread_info, cpu));  	DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count)); -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	DEFINE(TI_AC_STAMP, offsetof(struct thread_info, ac_stamp));  	DEFINE(TI_AC_LEAVE, offsetof(struct thread_info, ac_leave));  	DEFINE(TI_AC_STIME, offsetof(struct thread_info, ac_stime)); @@ -269,8 +266,8 @@ void foo(void)  	BLANK();  	/* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */ -	DEFINE(IA64_GTOD_LOCK_OFFSET, -		offsetof (struct fsyscall_gtod_data_t, lock)); +	DEFINE(IA64_GTOD_SEQ_OFFSET, +	       offsetof (struct fsyscall_gtod_data_t, seq));  	DEFINE(IA64_GTOD_WALL_TIME_OFFSET,  		offsetof (struct fsyscall_gtod_data_t, wall_time));  	DEFINE(IA64_GTOD_MONO_TIME_OFFSET, @@ -290,33 +287,4 @@ void foo(void)  	DEFINE(IA64_ITC_LASTCYCLE_OFFSET,  		offsetof (struct itc_jitter_data_t, itc_lastcycle)); -#ifdef CONFIG_XEN -	BLANK(); - -	DEFINE(XEN_NATIVE_ASM, XEN_NATIVE); -	DEFINE(XEN_PV_DOMAIN_ASM, XEN_PV_DOMAIN); - -#define DEFINE_MAPPED_REG_OFS(sym, field) \ -	DEFINE(sym, (XMAPPEDREGS_OFS + offsetof(struct mapped_regs, field))) - -	DEFINE_MAPPED_REG_OFS(XSI_PSR_I_ADDR_OFS, interrupt_mask_addr); -	DEFINE_MAPPED_REG_OFS(XSI_IPSR_OFS, ipsr); -	DEFINE_MAPPED_REG_OFS(XSI_IIP_OFS, iip); -	DEFINE_MAPPED_REG_OFS(XSI_IFS_OFS, ifs); -	DEFINE_MAPPED_REG_OFS(XSI_PRECOVER_IFS_OFS, precover_ifs); -	DEFINE_MAPPED_REG_OFS(XSI_ISR_OFS, isr); -	DEFINE_MAPPED_REG_OFS(XSI_IFA_OFS, ifa); -	DEFINE_MAPPED_REG_OFS(XSI_IIPA_OFS, iipa); -	DEFINE_MAPPED_REG_OFS(XSI_IIM_OFS, iim); -	DEFINE_MAPPED_REG_OFS(XSI_IHA_OFS, iha); -	DEFINE_MAPPED_REG_OFS(XSI_ITIR_OFS, itir); -	DEFINE_MAPPED_REG_OFS(XSI_PSR_IC_OFS, interrupt_collection_enabled); -	DEFINE_MAPPED_REG_OFS(XSI_BANKNUM_OFS, banknum); -	DEFINE_MAPPED_REG_OFS(XSI_BANK0_R16_OFS, bank0_regs[0]); -	DEFINE_MAPPED_REG_OFS(XSI_BANK1_R16_OFS, bank1_regs[0]); -	DEFINE_MAPPED_REG_OFS(XSI_B0NATS_OFS, vbnat); -	DEFINE_MAPPED_REG_OFS(XSI_B1NATS_OFS, vnat); -	DEFINE_MAPPED_REG_OFS(XSI_ITC_OFFSET_OFS, itc_offset); -	DEFINE_MAPPED_REG_OFS(XSI_ITC_LAST_OFS, itc_last); -#endif /* CONFIG_XEN */  } diff --git a/arch/ia64/kernel/cpufreq/Kconfig b/arch/ia64/kernel/cpufreq/Kconfig deleted file mode 100644 index 2d9d5279b98..00000000000 --- a/arch/ia64/kernel/cpufreq/Kconfig +++ /dev/null @@ -1,29 +0,0 @@ - -# -# CPU Frequency scaling -# - -menu "CPU Frequency scaling" - -source "drivers/cpufreq/Kconfig" - -if CPU_FREQ - -comment "CPUFreq processor drivers" - -config IA64_ACPI_CPUFREQ -	tristate "ACPI Processor P-States driver" -	select CPU_FREQ_TABLE -	depends on ACPI_PROCESSOR -	help -	This driver adds a CPUFreq driver which utilizes the ACPI -	Processor Performance States. - -	For details, take a look at <file:Documentation/cpu-freq/>. - -	If in doubt, say N. - -endif   # CPU_FREQ - -endmenu - diff --git a/arch/ia64/kernel/cpufreq/Makefile b/arch/ia64/kernel/cpufreq/Makefile deleted file mode 100644 index 4838f2a57c7..00000000000 --- a/arch/ia64/kernel/cpufreq/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -obj-$(CONFIG_IA64_ACPI_CPUFREQ)		+= acpi-cpufreq.o - diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c deleted file mode 100644 index 22f61526a8e..00000000000 --- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - * arch/ia64/kernel/cpufreq/acpi-cpufreq.c - * This file provides the ACPI based P-state support. This - * module works with generic cpufreq infrastructure. Most of - * the code is based on i386 version - * (arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c) - * - * Copyright (C) 2005 Intel Corp - *      Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> - */ - -#include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/module.h> -#include <linux/init.h> -#include <linux/cpufreq.h> -#include <linux/proc_fs.h> -#include <linux/seq_file.h> -#include <asm/io.h> -#include <asm/uaccess.h> -#include <asm/pal.h> - -#include <linux/acpi.h> -#include <acpi/processor.h> - -#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) - -MODULE_AUTHOR("Venkatesh Pallipadi"); -MODULE_DESCRIPTION("ACPI Processor P-States Driver"); -MODULE_LICENSE("GPL"); - - -struct cpufreq_acpi_io { -	struct acpi_processor_performance	acpi_data; -	struct cpufreq_frequency_table		*freq_table; -	unsigned int				resume; -}; - -static struct cpufreq_acpi_io	*acpi_io_data[NR_CPUS]; - -static struct cpufreq_driver acpi_cpufreq_driver; - - -static int -processor_set_pstate ( -	u32	value) -{ -	s64 retval; - -	dprintk("processor_set_pstate\n"); - -	retval = ia64_pal_set_pstate((u64)value); - -	if (retval) { -		dprintk("Failed to set freq to 0x%x, with error 0x%lx\n", -		        value, retval); -		return -ENODEV; -	} -	return (int)retval; -} - - -static int -processor_get_pstate ( -	u32	*value) -{ -	u64	pstate_index = 0; -	s64 	retval; - -	dprintk("processor_get_pstate\n"); - -	retval = ia64_pal_get_pstate(&pstate_index, -	                             PAL_GET_PSTATE_TYPE_INSTANT); -	*value = (u32) pstate_index; - -	if (retval) -		dprintk("Failed to get current freq with " -			"error 0x%lx, idx 0x%x\n", retval, *value); - -	return (int)retval; -} - - -/* To be used only after data->acpi_data is initialized */ -static unsigned -extract_clock ( -	struct cpufreq_acpi_io *data, -	unsigned value, -	unsigned int cpu) -{ -	unsigned long i; - -	dprintk("extract_clock\n"); - -	for (i = 0; i < data->acpi_data.state_count; i++) { -		if (value == data->acpi_data.states[i].status) -			return data->acpi_data.states[i].core_frequency; -	} -	return data->acpi_data.states[i-1].core_frequency; -} - - -static unsigned int -processor_get_freq ( -	struct cpufreq_acpi_io	*data, -	unsigned int		cpu) -{ -	int			ret = 0; -	u32			value = 0; -	cpumask_t		saved_mask; -	unsigned long 		clock_freq; - -	dprintk("processor_get_freq\n"); - -	saved_mask = current->cpus_allowed; -	set_cpus_allowed_ptr(current, cpumask_of(cpu)); -	if (smp_processor_id() != cpu) -		goto migrate_end; - -	/* processor_get_pstate gets the instantaneous frequency */ -	ret = processor_get_pstate(&value); - -	if (ret) { -		set_cpus_allowed_ptr(current, &saved_mask); -		printk(KERN_WARNING "get performance failed with error %d\n", -		       ret); -		ret = 0; -		goto migrate_end; -	} -	clock_freq = extract_clock(data, value, cpu); -	ret = (clock_freq*1000); - -migrate_end: -	set_cpus_allowed_ptr(current, &saved_mask); -	return ret; -} - - -static int -processor_set_freq ( -	struct cpufreq_acpi_io	*data, -	unsigned int		cpu, -	int			state) -{ -	int			ret = 0; -	u32			value = 0; -	struct cpufreq_freqs    cpufreq_freqs; -	cpumask_t		saved_mask; -	int			retval; - -	dprintk("processor_set_freq\n"); - -	saved_mask = current->cpus_allowed; -	set_cpus_allowed_ptr(current, cpumask_of(cpu)); -	if (smp_processor_id() != cpu) { -		retval = -EAGAIN; -		goto migrate_end; -	} - -	if (state == data->acpi_data.state) { -		if (unlikely(data->resume)) { -			dprintk("Called after resume, resetting to P%d\n", state); -			data->resume = 0; -		} else { -			dprintk("Already at target state (P%d)\n", state); -			retval = 0; -			goto migrate_end; -		} -	} - -	dprintk("Transitioning from P%d to P%d\n", -		data->acpi_data.state, state); - -	/* cpufreq frequency struct */ -	cpufreq_freqs.cpu = cpu; -	cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency; -	cpufreq_freqs.new = data->freq_table[state].frequency; - -	/* notify cpufreq */ -	cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); - -	/* -	 * First we write the target state's 'control' value to the -	 * control_register. -	 */ - -	value = (u32) data->acpi_data.states[state].control; - -	dprintk("Transitioning to state: 0x%08x\n", value); - -	ret = processor_set_pstate(value); -	if (ret) { -		unsigned int tmp = cpufreq_freqs.new; -		cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); -		cpufreq_freqs.new = cpufreq_freqs.old; -		cpufreq_freqs.old = tmp; -		cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); -		cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); -		printk(KERN_WARNING "Transition failed with error %d\n", ret); -		retval = -ENODEV; -		goto migrate_end; -	} - -	cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); - -	data->acpi_data.state = state; - -	retval = 0; - -migrate_end: -	set_cpus_allowed_ptr(current, &saved_mask); -	return (retval); -} - - -static unsigned int -acpi_cpufreq_get ( -	unsigned int		cpu) -{ -	struct cpufreq_acpi_io *data = acpi_io_data[cpu]; - -	dprintk("acpi_cpufreq_get\n"); - -	return processor_get_freq(data, cpu); -} - - -static int -acpi_cpufreq_target ( -	struct cpufreq_policy   *policy, -	unsigned int target_freq, -	unsigned int relation) -{ -	struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; -	unsigned int next_state = 0; -	unsigned int result = 0; - -	dprintk("acpi_cpufreq_setpolicy\n"); - -	result = cpufreq_frequency_table_target(policy, -			data->freq_table, target_freq, relation, &next_state); -	if (result) -		return (result); - -	result = processor_set_freq(data, policy->cpu, next_state); - -	return (result); -} - - -static int -acpi_cpufreq_verify ( -	struct cpufreq_policy   *policy) -{ -	unsigned int result = 0; -	struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; - -	dprintk("acpi_cpufreq_verify\n"); - -	result = cpufreq_frequency_table_verify(policy, -			data->freq_table); - -	return (result); -} - - -static int -acpi_cpufreq_cpu_init ( -	struct cpufreq_policy   *policy) -{ -	unsigned int		i; -	unsigned int		cpu = policy->cpu; -	struct cpufreq_acpi_io	*data; -	unsigned int		result = 0; - -	dprintk("acpi_cpufreq_cpu_init\n"); - -	data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); -	if (!data) -		return (-ENOMEM); - -	acpi_io_data[cpu] = data; - -	result = acpi_processor_register_performance(&data->acpi_data, cpu); - -	if (result) -		goto err_free; - -	/* capability check */ -	if (data->acpi_data.state_count <= 1) { -		dprintk("No P-States\n"); -		result = -ENODEV; -		goto err_unreg; -	} - -	if ((data->acpi_data.control_register.space_id != -					ACPI_ADR_SPACE_FIXED_HARDWARE) || -	    (data->acpi_data.status_register.space_id != -					ACPI_ADR_SPACE_FIXED_HARDWARE)) { -		dprintk("Unsupported address space [%d, %d]\n", -			(u32) (data->acpi_data.control_register.space_id), -			(u32) (data->acpi_data.status_register.space_id)); -		result = -ENODEV; -		goto err_unreg; -	} - -	/* alloc freq_table */ -	data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * -	                           (data->acpi_data.state_count + 1), -	                           GFP_KERNEL); -	if (!data->freq_table) { -		result = -ENOMEM; -		goto err_unreg; -	} - -	/* detect transition latency */ -	policy->cpuinfo.transition_latency = 0; -	for (i=0; i<data->acpi_data.state_count; i++) { -		if ((data->acpi_data.states[i].transition_latency * 1000) > -		    policy->cpuinfo.transition_latency) { -			policy->cpuinfo.transition_latency = -			    data->acpi_data.states[i].transition_latency * 1000; -		} -	} -	policy->cur = processor_get_freq(data, policy->cpu); - -	/* table init */ -	for (i = 0; i <= data->acpi_data.state_count; i++) -	{ -		data->freq_table[i].index = i; -		if (i < data->acpi_data.state_count) { -			data->freq_table[i].frequency = -			      data->acpi_data.states[i].core_frequency * 1000; -		} else { -			data->freq_table[i].frequency = CPUFREQ_TABLE_END; -		} -	} - -	result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); -	if (result) { -		goto err_freqfree; -	} - -	/* notify BIOS that we exist */ -	acpi_processor_notify_smm(THIS_MODULE); - -	printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management " -	       "activated.\n", cpu); - -	for (i = 0; i < data->acpi_data.state_count; i++) -		dprintk("     %cP%d: %d MHz, %d mW, %d uS, %d uS, 0x%x 0x%x\n", -			(i == data->acpi_data.state?'*':' '), i, -			(u32) data->acpi_data.states[i].core_frequency, -			(u32) data->acpi_data.states[i].power, -			(u32) data->acpi_data.states[i].transition_latency, -			(u32) data->acpi_data.states[i].bus_master_latency, -			(u32) data->acpi_data.states[i].status, -			(u32) data->acpi_data.states[i].control); - -	cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); - -	/* the first call to ->target() should result in us actually -	 * writing something to the appropriate registers. */ -	data->resume = 1; - -	return (result); - - err_freqfree: -	kfree(data->freq_table); - err_unreg: -	acpi_processor_unregister_performance(&data->acpi_data, cpu); - err_free: -	kfree(data); -	acpi_io_data[cpu] = NULL; - -	return (result); -} - - -static int -acpi_cpufreq_cpu_exit ( -	struct cpufreq_policy   *policy) -{ -	struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; - -	dprintk("acpi_cpufreq_cpu_exit\n"); - -	if (data) { -		cpufreq_frequency_table_put_attr(policy->cpu); -		acpi_io_data[policy->cpu] = NULL; -		acpi_processor_unregister_performance(&data->acpi_data, -		                                      policy->cpu); -		kfree(data); -	} - -	return (0); -} - - -static struct freq_attr* acpi_cpufreq_attr[] = { -	&cpufreq_freq_attr_scaling_available_freqs, -	NULL, -}; - - -static struct cpufreq_driver acpi_cpufreq_driver = { -	.verify 	= acpi_cpufreq_verify, -	.target 	= acpi_cpufreq_target, -	.get 		= acpi_cpufreq_get, -	.init		= acpi_cpufreq_cpu_init, -	.exit		= acpi_cpufreq_cpu_exit, -	.name		= "acpi-cpufreq", -	.owner		= THIS_MODULE, -	.attr           = acpi_cpufreq_attr, -}; - - -static int __init -acpi_cpufreq_init (void) -{ -	dprintk("acpi_cpufreq_init\n"); - - 	return cpufreq_register_driver(&acpi_cpufreq_driver); -} - - -static void __exit -acpi_cpufreq_exit (void) -{ -	dprintk("acpi_cpufreq_exit\n"); - -	cpufreq_unregister_driver(&acpi_cpufreq_driver); -	return; -} - - -late_initcall(acpi_cpufreq_init); -module_exit(acpi_cpufreq_exit); - diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c index b942f4032d7..2955f359e2a 100644 --- a/arch/ia64/kernel/crash.c +++ b/arch/ia64/kernel/crash.c @@ -237,7 +237,7 @@ kdump_init_notifier(struct notifier_block *self, unsigned long val, void *data)  }  #ifdef CONFIG_SYSCTL -static ctl_table kdump_ctl_table[] = { +static struct ctl_table kdump_ctl_table[] = {  	{  		.procname = "kdump_on_init",  		.data = &kdump_on_init, @@ -255,7 +255,7 @@ static ctl_table kdump_ctl_table[] = {  	{ }  }; -static ctl_table sys_table[] = { +static struct ctl_table sys_table[] = {  	{  	  .procname = "kernel",  	  .mode = 0555, diff --git a/arch/ia64/kernel/crash_dump.c b/arch/ia64/kernel/crash_dump.c index 23e91290e41..c8c9298666f 100644 --- a/arch/ia64/kernel/crash_dump.c +++ b/arch/ia64/kernel/crash_dump.c @@ -13,9 +13,6 @@  #include <asm/page.h>  #include <asm/uaccess.h> -/* Stores the physical address of elf header of crash image. */ -unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; -  /**   * copy_oldmem_page - copy one page from "oldmem"   * @pfn: page frame number to be copied diff --git a/arch/ia64/kernel/cyclone.c b/arch/ia64/kernel/cyclone.c index d52f1f78eff..4826ff957a3 100644 --- a/arch/ia64/kernel/cyclone.c +++ b/arch/ia64/kernel/cyclone.c @@ -31,8 +31,6 @@ static struct clocksource clocksource_cyclone = {          .rating         = 300,          .read           = read_cyclone,          .mask           = (1LL << 40) - 1, -        .mult           = 0, /*to be caluclated*/ -        .shift          = 16,          .flags          = CLOCK_SOURCE_IS_CONTINUOUS,  }; @@ -117,10 +115,8 @@ int __init init_cyclone_clock(void)  	}  	/* initialize last tick */  	cyclone_mc = cyclone_timer; -	clocksource_cyclone.fsys_mmio = cyclone_timer; -	clocksource_cyclone.mult = clocksource_hz2mult(CYCLONE_TIMER_FREQ, -						clocksource_cyclone.shift); -	clocksource_register(&clocksource_cyclone); +	clocksource_cyclone.archdata.fsys_mmio = cyclone_timer; +	clocksource_register_hz(&clocksource_cyclone, CYCLONE_TIMER_FREQ);  	return 0;  } diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c index f2c1600da09..7f791623820 100644 --- a/arch/ia64/kernel/dma-mapping.c +++ b/arch/ia64/kernel/dma-mapping.c @@ -1,4 +1,5 @@  #include <linux/dma-mapping.h> +#include <linux/export.h>  /* Set this to 1 if there is a HW IOMMU in the system */  int iommu_detected __read_mostly; diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index a0f00192850..741b99c1a0b 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c @@ -23,6 +23,7 @@   */  #include <linux/module.h>  #include <linux/bootmem.h> +#include <linux/crash_dump.h>  #include <linux/kernel.h>  #include <linux/init.h>  #include <linux/types.h> @@ -38,14 +39,20 @@  #include <asm/pgtable.h>  #include <asm/processor.h>  #include <asm/mca.h> +#include <asm/setup.h>  #include <asm/tlbflush.h>  #define EFI_DEBUG	0 +static __initdata unsigned long palo_phys; + +static __initdata efi_config_table_type_t arch_tables[] = { +	{PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID, "PALO", &palo_phys}, +	{NULL_GUID, NULL, 0}, +}; +  extern efi_status_t efi_call_phys (void *, ...); -struct efi efi; -EXPORT_SYMBOL(efi);  static efi_runtime_services_t *runtime;  static u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL; @@ -155,7 +162,7 @@ prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name,      \  #define STUB_SET_VARIABLE(prefix, adjust_arg)				       \  static efi_status_t							       \  prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor,		       \ -		       unsigned long attr, unsigned long data_size,	       \ +		       u32 attr, unsigned long data_size,		       \  		       void *data)					       \  {									       \  	struct ia64_fpreg fr[6];					       \ @@ -421,9 +428,9 @@ static u8 __init palo_checksum(u8 *buffer, u32 length)   * Parse and handle PALO table which is published at:   * http://www.dig64.org/home/DIG64_PALO_R1_0.pdf   */ -static void __init handle_palo(unsigned long palo_phys) +static void __init handle_palo(unsigned long phys_addr)  { -	struct palo_table *palo = __va(palo_phys); +	struct palo_table *palo = __va(phys_addr);  	u8  checksum;  	if (strncmp(palo->signature, PALO_SIG, sizeof(PALO_SIG) - 1)) { @@ -465,12 +472,13 @@ void __init  efi_init (void)  {  	void *efi_map_start, *efi_map_end; -	efi_config_table_t *config_tables;  	efi_char16_t *c16;  	u64 efi_desc_size;  	char *cp, vendor[100] = "unknown";  	int i; -	unsigned long palo_phys; + +	set_bit(EFI_BOOT, &efi.flags); +	set_bit(EFI_64BIT, &efi.flags);  	/*  	 * It's too early to be able to use the standard kernel command line @@ -512,8 +520,6 @@ efi_init (void)  		       efi.systab->hdr.revision >> 16,  		       efi.systab->hdr.revision & 0xffff); -	config_tables = __va(efi.systab->tables); -  	/* Show what we know for posterity */  	c16 = __va(efi.systab->fw_vendor);  	if (c16) { @@ -526,43 +532,12 @@ efi_init (void)  	       efi.systab->hdr.revision >> 16,  	       efi.systab->hdr.revision & 0xffff, vendor); -	efi.mps        = EFI_INVALID_TABLE_ADDR; -	efi.acpi       = EFI_INVALID_TABLE_ADDR; -	efi.acpi20     = EFI_INVALID_TABLE_ADDR; -	efi.smbios     = EFI_INVALID_TABLE_ADDR; -	efi.sal_systab = EFI_INVALID_TABLE_ADDR; -	efi.boot_info  = EFI_INVALID_TABLE_ADDR; -	efi.hcdp       = EFI_INVALID_TABLE_ADDR; -	efi.uga        = EFI_INVALID_TABLE_ADDR; +	set_bit(EFI_SYSTEM_TABLES, &efi.flags);  	palo_phys      = EFI_INVALID_TABLE_ADDR; -	for (i = 0; i < (int) efi.systab->nr_tables; i++) { -		if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) { -			efi.mps = config_tables[i].table; -			printk(" MPS=0x%lx", config_tables[i].table); -		} else if (efi_guidcmp(config_tables[i].guid, ACPI_20_TABLE_GUID) == 0) { -			efi.acpi20 = config_tables[i].table; -			printk(" ACPI 2.0=0x%lx", config_tables[i].table); -		} else if (efi_guidcmp(config_tables[i].guid, ACPI_TABLE_GUID) == 0) { -			efi.acpi = config_tables[i].table; -			printk(" ACPI=0x%lx", config_tables[i].table); -		} else if (efi_guidcmp(config_tables[i].guid, SMBIOS_TABLE_GUID) == 0) { -			efi.smbios = config_tables[i].table; -			printk(" SMBIOS=0x%lx", config_tables[i].table); -		} else if (efi_guidcmp(config_tables[i].guid, SAL_SYSTEM_TABLE_GUID) == 0) { -			efi.sal_systab = config_tables[i].table; -			printk(" SALsystab=0x%lx", config_tables[i].table); -		} else if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) { -			efi.hcdp = config_tables[i].table; -			printk(" HCDP=0x%lx", config_tables[i].table); -		} else if (efi_guidcmp(config_tables[i].guid, -			 PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID) == 0) { -			palo_phys = config_tables[i].table; -			printk(" PALO=0x%lx", config_tables[i].table); -		} -	} -	printk("\n"); +	if (efi_config_init(arch_tables) != 0) +		return;  	if (palo_phys != EFI_INVALID_TABLE_ADDR)  		handle_palo(palo_phys); @@ -687,6 +662,8 @@ efi_enter_virtual_mode (void)  		return;  	} +	set_bit(EFI_RUNTIME_SERVICES, &efi.flags); +  	/*  	 * Now that EFI is in virtual mode, we call the EFI functions more  	 * efficiently: @@ -868,7 +845,7 @@ kern_mem_attribute (unsigned long phys_addr, unsigned long size)  EXPORT_SYMBOL(kern_mem_attribute);  int -valid_phys_addr_range (unsigned long phys_addr, unsigned long size) +valid_phys_addr_range (phys_addr_t phys_addr, unsigned long size)  {  	u64 attr; @@ -1114,11 +1091,6 @@ efi_memmap_init(u64 *s, u64 *e)  		if (!is_memory_available(md))  			continue; -#ifdef CONFIG_CRASH_DUMP -		/* saved_max_pfn should ignore max_addr= command line arg */ -		if (saved_max_pfn < (efi_md_end(md) >> PAGE_SHIFT)) -			saved_max_pfn = (efi_md_end(md) >> PAGE_SHIFT); -#endif  		/*  		 * Round ends inward to granule boundaries  		 * Give trimmings to uncached allocator diff --git a/arch/ia64/kernel/elfcore.c b/arch/ia64/kernel/elfcore.c index bac1639bc32..04bc8fd5f89 100644 --- a/arch/ia64/kernel/elfcore.c +++ b/arch/ia64/kernel/elfcore.c @@ -11,8 +11,7 @@ Elf64_Half elf_core_extra_phdrs(void)  	return GATE_EHDR->e_phnum;  } -int elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size, -			       unsigned long limit) +int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)  {  	const struct elf_phdr *const gate_phdrs =  		(const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); @@ -35,15 +34,13 @@ int elf_core_write_extra_phdrs(struct file *file, loff_t offset, size_t *size,  			phdr.p_offset += ofs;  		}  		phdr.p_paddr = 0; /* match other core phdrs */ -		*size += sizeof(phdr); -		if (*size > limit || !dump_write(file, &phdr, sizeof(phdr))) +		if (!dump_emit(cprm, &phdr, sizeof(phdr)))  			return 0;  	}  	return 1;  } -int elf_core_write_extra_data(struct file *file, size_t *size, -			      unsigned long limit) +int elf_core_write_extra_data(struct coredump_params *cprm)  {  	const struct elf_phdr *const gate_phdrs =  		(const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); @@ -54,8 +51,7 @@ int elf_core_write_extra_data(struct file *file, size_t *size,  			void *addr = (void *)gate_phdrs[i].p_vaddr;  			size_t memsz = PAGE_ALIGN(gate_phdrs[i].p_memsz); -			*size += memsz; -			if (*size > limit || !dump_write(file, addr, memsz)) +			if (!dump_emit(cprm, addr, memsz))  				return 0;  			break;  		} diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 244704a174d..ba3d03503e8 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S @@ -61,14 +61,13 @@ ENTRY(ia64_execve)  	 * Allocate 8 input registers since ptrace() may clobber them  	 */  	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8) -	alloc loc1=ar.pfs,8,2,4,0 +	alloc loc1=ar.pfs,8,2,3,0  	mov loc0=rp  	.body  	mov out0=in0			// filename  	;;				// stop bit between alloc and call  	mov out1=in1			// argv  	mov out2=in2			// envp -	add out3=16,sp			// regs  	br.call.sptk.many rp=sys_execve  .ret0:  	cmp4.ge p6,p7=r8,r0 @@ -76,7 +75,6 @@ ENTRY(ia64_execve)  	sxt4 r8=r8			// return 64-bit result  	;;  	stf.spill [sp]=f0 -(p6)	cmp.ne pKStk,pUStk=r0,r0	// a successful execve() lands us in user-mode...  	mov rp=loc0  (p6)	mov ar.pfs=r0			// clear ar.pfs on success  (p7)	br.ret.sptk.many rp @@ -118,13 +116,12 @@ GLOBAL_ENTRY(sys_clone2)  	mov loc1=r16				// save ar.pfs across do_fork  	.body  	mov out1=in1 -	mov out3=in2 +	mov out2=in2  	tbit.nz p6,p0=in0,CLONE_SETTLS_BIT -	mov out4=in3	// parent_tidptr: valid only w/CLONE_PARENT_SETTID +	mov out3=in3	// parent_tidptr: valid only w/CLONE_PARENT_SETTID  	;;  (p6)	st8 [r2]=in5				// store TLS in r16 for copy_thread() -	mov out5=in4	// child_tidptr:  valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID -	adds out2=IA64_SWITCH_STACK_SIZE+16,sp	// out2 = ®s +	mov out4=in4	// child_tidptr:  valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID  	mov out0=in0				// out0 = clone_flags  	br.call.sptk.many rp=do_fork  .ret1:	.restore sp @@ -150,13 +147,12 @@ GLOBAL_ENTRY(sys_clone)  	mov loc1=r16				// save ar.pfs across do_fork  	.body  	mov out1=in1 -	mov out3=16				// stacksize (compensates for 16-byte scratch area) +	mov out2=16				// stacksize (compensates for 16-byte scratch area)  	tbit.nz p6,p0=in0,CLONE_SETTLS_BIT -	mov out4=in2	// parent_tidptr: valid only w/CLONE_PARENT_SETTID +	mov out3=in2	// parent_tidptr: valid only w/CLONE_PARENT_SETTID  	;;  (p6)	st8 [r2]=in4				// store TLS in r13 (tp) -	mov out5=in3	// child_tidptr:  valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID -	adds out2=IA64_SWITCH_STACK_SIZE+16,sp	// out2 = ®s +	mov out4=in3	// child_tidptr:  valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID  	mov out0=in0				// out0 = clone_flags  	br.call.sptk.many rp=do_fork  .ret2:	.restore sp @@ -484,19 +480,6 @@ GLOBAL_ENTRY(prefetch_stack)  	br.ret.sptk.many rp  END(prefetch_stack) -GLOBAL_ENTRY(kernel_execve) -	rum psr.ac -	mov r15=__NR_execve			// put syscall number in place -	break __BREAK_SYSCALL -	br.ret.sptk.many rp -END(kernel_execve) - -GLOBAL_ENTRY(clone) -	mov r15=__NR_clone			// put syscall number in place -	break __BREAK_SYSCALL -	br.ret.sptk.many rp -END(clone) -  	/*  	 * Invoke a system call, but do some tracing before and after the call.  	 * We MUST preserve the current register frame throughout this routine @@ -600,6 +583,27 @@ GLOBAL_ENTRY(ia64_strace_leave_kernel)  .ret4:	br.cond.sptk ia64_leave_kernel  END(ia64_strace_leave_kernel) +ENTRY(call_payload) +	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(0) +	/* call the kernel_thread payload; fn is in r4, arg - in r5 */ +	alloc loc1=ar.pfs,0,3,1,0 +	mov loc0=rp +	mov loc2=gp +	mov out0=r5		// arg +	ld8 r14 = [r4], 8	// fn.address +	;; +	mov b6 = r14 +	ld8 gp = [r4]		// fn.gp +	;; +	br.call.sptk.many rp=b6	// fn(arg) +.ret12:	mov gp=loc2 +	mov rp=loc0 +	mov ar.pfs=loc1 +	/* ... and if it has returned, we are going to userland */ +	cmp.ne pKStk,pUStk=r0,r0 +	br.ret.sptk.many rp +END(call_payload) +  GLOBAL_ENTRY(ia64_ret_from_clone)  	PT_REGS_UNWIND_INFO(0)  {	/* @@ -616,6 +620,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)  	br.call.sptk.many rp=ia64_invoke_schedule_tail  }  .ret8: +(pKStk)	br.call.sptk.many rp=call_payload  	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13  	;;  	ld4 r2=[r2] @@ -719,7 +724,7 @@ GLOBAL_ENTRY(__paravirt_leave_syscall)  #endif  .global __paravirt_work_processed_syscall;  __paravirt_work_processed_syscall: -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	adds r2=PT(LOADRS)+16,r12  	MOV_FROM_ITC(pUStk, p9, r22, r19)	// fetch time at leave  	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13 @@ -757,7 +762,7 @@ __paravirt_work_processed_syscall:  	ld8 r29=[r2],16		// M0|1 load cr.ipsr  	ld8 r28=[r3],16		// M0|1 load cr.iip -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  (pUStk) add r14=TI_AC_LEAVE+IA64_TASK_SIZE,r13  	;;  	ld8 r30=[r2],16		// M0|1 load cr.ifs @@ -788,7 +793,7 @@ __paravirt_work_processed_syscall:  	ld8.fill r1=[r3],16			// M0|1 load r1  (pUStk) mov r17=1				// A  	;; -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  (pUStk) st1 [r15]=r17				// M2|3  #else  (pUStk) st1 [r14]=r17				// M2|3 @@ -808,7 +813,7 @@ __paravirt_work_processed_syscall:  	shr.u r18=r19,16		// I0|1 get byte size of existing "dirty" partition  	COVER				// B    add current frame into dirty partition & set cr.ifs  	;; -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	mov r19=ar.bsp			// M2   get new backing store pointer  	st8 [r14]=r22			// M	save time at leave  	mov f10=f0			// F    clear f10 @@ -943,7 +948,7 @@ GLOBAL_ENTRY(__paravirt_leave_kernel)  	adds r16=PT(CR_IPSR)+16,r12  	adds r17=PT(CR_IIP)+16,r12 -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	.pred.rel.mutex pUStk,pKStk  	MOV_FROM_PSR(pKStk, r22, r29)	// M2 read PSR now that interrupts are disabled  	MOV_FROM_ITC(pUStk, p9, r22, r29)	// M  fetch time at leave @@ -976,7 +981,7 @@ GLOBAL_ENTRY(__paravirt_leave_kernel)  	;;  	ld8.fill r12=[r16],16  	ld8.fill r13=[r17],16 -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  (pUStk)	adds r3=TI_AC_LEAVE+IA64_TASK_SIZE,r18  #else  (pUStk)	adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18 @@ -984,7 +989,7 @@ GLOBAL_ENTRY(__paravirt_leave_kernel)  	;;  	ld8 r20=[r16],16	// ar.fpsr  	ld8.fill r15=[r17],16 -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  (pUStk)	adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18	// deferred  #endif  	;; @@ -992,7 +997,7 @@ GLOBAL_ENTRY(__paravirt_leave_kernel)  	ld8.fill r2=[r17]  (pUStk)	mov r17=1  	;; -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	//  mmi_ :  ld8 st1 shr;;         mmi_ : st8 st1 shr;;  	//  mib  :  mov add br        ->  mib  : ld8 add br  	//  bbb_ :  br  nop cover;;       mbb_ : mov br  cover;; @@ -1164,21 +1169,8 @@ skip_rbs_switch:  .work_pending:  	tbit.z p6,p0=r31,TIF_NEED_RESCHED	// is resched not needed?  (p6)	br.cond.sptk.few .notify -#ifdef CONFIG_PREEMPT -(pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1 -	;; -(pKStk) st4 [r20]=r21 -#endif -	SSM_PSR_I(p0, p6, r2)	// enable interrupts -	br.call.spnt.many rp=schedule +	br.call.spnt.many rp=preempt_schedule_irq  .ret9:	cmp.eq p6,p0=r0,r0	// p6 <- 1 (re-check) -	RSM_PSR_I(p0, r2, r20)	// disable interrupts -	;; -#ifdef CONFIG_PREEMPT -(pKStk)	adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13 -	;; -(pKStk)	st4 [r20]=r0		// preempt_count() <- 0 -#endif  (pLvSys)br.cond.sptk.few  __paravirt_pending_syscall_end  	br.cond.sptk.many .work_processed_kernel @@ -1614,7 +1606,7 @@ sys_call_table:  	data8 sys_sched_get_priority_min  	data8 sys_sched_rr_get_interval  	data8 sys_nanosleep -	data8 sys_nfsservctl +	data8 sys_ni_syscall			// old nfsservctl  	data8 sys_prctl				// 1170  	data8 sys_getpagesize  	data8 sys_mmap2 @@ -1771,6 +1763,19 @@ sys_call_table:  	data8 sys_fanotify_init  	data8 sys_fanotify_mark  	data8 sys_prlimit64			// 1325 +	data8 sys_name_to_handle_at +	data8 sys_open_by_handle_at +	data8 sys_clock_adjtime +	data8 sys_syncfs +	data8 sys_setns				// 1330 +	data8 sys_sendmmsg +	data8 sys_process_vm_readv +	data8 sys_process_vm_writev +	data8 sys_accept4 +	data8 sys_finit_module			// 1335 +	data8 sys_sched_setattr +	data8 sys_sched_getattr +	data8 sys_renameat2  	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls  #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c index c539c689493..0c161ed6d18 100644 --- a/arch/ia64/kernel/err_inject.c +++ b/arch/ia64/kernel/err_inject.c @@ -24,7 +24,7 @@   * Copyright (C) 2006, Intel Corp.  All rights reserved.   *   */ -#include <linux/sysdev.h> +#include <linux/device.h>  #include <linux/init.h>  #include <linux/mm.h>  #include <linux/cpu.h> @@ -35,10 +35,10 @@  #define ERR_DATA_BUFFER_SIZE 3 		// Three 8-byte;  #define define_one_ro(name) 						\ -static SYSDEV_ATTR(name, 0444, show_##name, NULL) +static DEVICE_ATTR(name, 0444, show_##name, NULL)  #define define_one_rw(name) 						\ -static SYSDEV_ATTR(name, 0644, show_##name, store_##name) +static DEVICE_ATTR(name, 0644, show_##name, store_##name)  static u64 call_start[NR_CPUS];  static u64 phys_addr[NR_CPUS]; @@ -55,7 +55,7 @@ static u64 resources[NR_CPUS];  #define show(name) 							\  static ssize_t 								\ -show_##name(struct sys_device *dev, struct sysdev_attribute *attr,	\ +show_##name(struct device *dev, struct device_attribute *attr,	\  		char *buf)						\  {									\  	u32 cpu=dev->id;						\ @@ -64,7 +64,7 @@ show_##name(struct sys_device *dev, struct sysdev_attribute *attr,	\  #define store(name)							\  static ssize_t 								\ -store_##name(struct sys_device *dev, struct sysdev_attribute *attr,	\ +store_##name(struct device *dev, struct device_attribute *attr,	\  					const char *buf, size_t size)	\  {									\  	unsigned int cpu=dev->id;					\ @@ -78,7 +78,7 @@ show(call_start)   * processor. The cpu number in driver is only used for storing data.   */  static ssize_t -store_call_start(struct sys_device *dev, struct sysdev_attribute *attr, +store_call_start(struct device *dev, struct device_attribute *attr,  		const char *buf, size_t size)  {  	unsigned int cpu=dev->id; @@ -127,7 +127,7 @@ show(err_type_info)  store(err_type_info)  static ssize_t -show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, +show_virtual_to_phys(struct device *dev, struct device_attribute *attr,  			char *buf)  {  	unsigned int cpu=dev->id; @@ -135,7 +135,7 @@ show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr,  }  static ssize_t -store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, +store_virtual_to_phys(struct device *dev, struct device_attribute *attr,  			const char *buf, size_t size)  {  	unsigned int cpu=dev->id; @@ -159,8 +159,8 @@ show(err_struct_info)  store(err_struct_info)  static ssize_t -show_err_data_buffer(struct sys_device *dev, -			struct sysdev_attribute *attr, char *buf) +show_err_data_buffer(struct device *dev, +			struct device_attribute *attr, char *buf)  {  	unsigned int cpu=dev->id; @@ -171,8 +171,8 @@ show_err_data_buffer(struct sys_device *dev,  }  static ssize_t -store_err_data_buffer(struct sys_device *dev, -			struct sysdev_attribute *attr, +store_err_data_buffer(struct device *dev, +			struct device_attribute *attr,  			const char *buf, size_t size)  {  	unsigned int cpu=dev->id; @@ -209,14 +209,14 @@ define_one_ro(capabilities);  define_one_ro(resources);  static struct attribute *default_attrs[] = { -	&attr_call_start.attr, -	&attr_virtual_to_phys.attr, -	&attr_err_type_info.attr, -	&attr_err_struct_info.attr, -	&attr_err_data_buffer.attr, -	&attr_status.attr, -	&attr_capabilities.attr, -	&attr_resources.attr, +	&dev_attr_call_start.attr, +	&dev_attr_virtual_to_phys.attr, +	&dev_attr_err_type_info.attr, +	&dev_attr_err_struct_info.attr, +	&dev_attr_err_data_buffer.attr, +	&dev_attr_status.attr, +	&dev_attr_capabilities.attr, +	&dev_attr_resources.attr,  	NULL  }; @@ -225,23 +225,23 @@ static struct attribute_group err_inject_attr_group = {  	.name = "err_inject"  };  /* Add/Remove err_inject interface for CPU device */ -static int __cpuinit err_inject_add_dev(struct sys_device * sys_dev) +static int err_inject_add_dev(struct device *sys_dev)  {  	return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group);  } -static int __cpuinit err_inject_remove_dev(struct sys_device * sys_dev) +static int err_inject_remove_dev(struct device *sys_dev)  {  	sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);  	return 0;  } -static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb, +static int err_inject_cpu_callback(struct notifier_block *nfb,  		unsigned long action, void *hcpu)  {  	unsigned int cpu = (unsigned long)hcpu; -	struct sys_device *sys_dev; +	struct device *sys_dev; -	sys_dev = get_cpu_sysdev(cpu); +	sys_dev = get_cpu_device(cpu);  	switch (action) {  	case CPU_ONLINE:  	case CPU_ONLINE_FROZEN: @@ -256,7 +256,7 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb,  	return NOTIFY_OK;  } -static struct notifier_block __cpuinitdata err_inject_cpu_notifier = +static struct notifier_block err_inject_cpu_notifier =  {  	.notifier_call = err_inject_cpu_callback,  }; @@ -269,12 +269,17 @@ err_inject_init(void)  #ifdef ERR_INJ_DEBUG  	printk(KERN_INFO "Enter error injection driver.\n");  #endif + +	cpu_notifier_register_begin(); +  	for_each_online_cpu(i) {  		err_inject_cpu_callback(&err_inject_cpu_notifier, CPU_ONLINE,  				(void *)(long)i);  	} -	register_hotcpu_notifier(&err_inject_cpu_notifier); +	__register_hotcpu_notifier(&err_inject_cpu_notifier); + +	cpu_notifier_register_done();  	return 0;  } @@ -283,16 +288,22 @@ static void __exit  err_inject_exit(void)  {  	int i; -	struct sys_device *sys_dev; +	struct device *sys_dev;  #ifdef ERR_INJ_DEBUG  	printk(KERN_INFO "Exit error injection driver.\n");  #endif + +	cpu_notifier_register_begin(); +  	for_each_online_cpu(i) { -		sys_dev = get_cpu_sysdev(i); +		sys_dev = get_cpu_device(i);  		sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);  	} -	unregister_hotcpu_notifier(&err_inject_cpu_notifier); + +	__unregister_hotcpu_notifier(&err_inject_cpu_notifier); + +	cpu_notifier_register_done();  }  module_init(err_inject_init); diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index 331d42bda77..abc6dee3799 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S @@ -21,7 +21,6 @@  #include <asm/thread_info.h>  #include <asm/sal.h>  #include <asm/signal.h> -#include <asm/system.h>  #include <asm/unistd.h>  #include "entry.h" @@ -91,53 +90,6 @@ ENTRY(fsys_getpid)  	FSYS_RETURN  END(fsys_getpid) -ENTRY(fsys_getppid) -	.prologue -	.altrp b6 -	.body -	add r17=IA64_TASK_GROUP_LEADER_OFFSET,r16 -	;; -	ld8 r17=[r17]				// r17 = current->group_leader -	add r9=TI_FLAGS+IA64_TASK_SIZE,r16 -	;; - -	ld4 r9=[r9] -	add r17=IA64_TASK_REAL_PARENT_OFFSET,r17 // r17 = ¤t->group_leader->real_parent -	;; -	and r9=TIF_ALLWORK_MASK,r9 - -1:	ld8 r18=[r17]				// r18 = current->group_leader->real_parent -	;; -	cmp.ne p8,p0=0,r9 -	add r8=IA64_TASK_TGID_OFFSET,r18	// r8 = ¤t->group_leader->real_parent->tgid -	;; - -	/* -	 * The .acq is needed to ensure that the read of tgid has returned its data before -	 * we re-check "real_parent". -	 */ -	ld4.acq r8=[r8]				// r8 = current->group_leader->real_parent->tgid -#ifdef CONFIG_SMP -	/* -	 * Re-read current->group_leader->real_parent. -	 */ -	ld8 r19=[r17]				// r19 = current->group_leader->real_parent -(p8)	br.spnt.many fsys_fallback_syscall -	;; -	cmp.ne p6,p0=r18,r19			// did real_parent change? -	mov r19=0			// i must not leak kernel bits... -(p6)	br.cond.spnt.few 1b			// yes -> redo the read of tgid and the check -	;; -	mov r17=0			// i must not leak kernel bits... -	mov r18=0			// i must not leak kernel bits... -#else -	mov r17=0			// i must not leak kernel bits... -	mov r18=0			// i must not leak kernel bits... -	mov r19=0			// i must not leak kernel bits... -#endif -	FSYS_RETURN -END(fsys_getppid) -  ENTRY(fsys_set_tid_address)  	.prologue  	.altrp b6 @@ -174,7 +126,7 @@ ENTRY(fsys_set_tid_address)  	FSYS_RETURN  END(fsys_set_tid_address) -#if IA64_GTOD_LOCK_OFFSET !=0 +#if IA64_GTOD_SEQ_OFFSET !=0  #error fsys_gettimeofday incompatible with changes to struct fsyscall_gtod_data_t  #endif  #if IA64_ITC_JITTER_OFFSET !=0 @@ -373,175 +325,6 @@ ENTRY(fsys_clock_gettime)  END(fsys_clock_gettime)  /* - * long fsys_rt_sigprocmask (int how, sigset_t *set, sigset_t *oset, size_t sigsetsize). - */ -#if _NSIG_WORDS != 1 -# error Sorry, fsys_rt_sigprocmask() needs to be updated for _NSIG_WORDS != 1. -#endif -ENTRY(fsys_rt_sigprocmask) -	.prologue -	.altrp b6 -	.body - -	add r2=IA64_TASK_BLOCKED_OFFSET,r16 -	add r9=TI_FLAGS+IA64_TASK_SIZE,r16 -	cmp4.ltu p6,p0=SIG_SETMASK,r32 - -	cmp.ne p15,p0=r0,r34			// oset != NULL? -	tnat.nz p8,p0=r34 -	add r31=IA64_TASK_SIGHAND_OFFSET,r16 -	;; -	ld8 r3=[r2]				// read/prefetch current->blocked -	ld4 r9=[r9] -	tnat.nz.or p6,p0=r35 - -	cmp.ne.or p6,p0=_NSIG_WORDS*8,r35 -	tnat.nz.or p6,p0=r32 -(p6)	br.spnt.few .fail_einval		// fail with EINVAL -	;; -#ifdef CONFIG_SMP -	ld8 r31=[r31]				// r31 <- current->sighand -#endif -	and r9=TIF_ALLWORK_MASK,r9 -	tnat.nz.or p8,p0=r33 -	;; -	cmp.ne p7,p0=0,r9 -	cmp.eq p6,p0=r0,r33			// set == NULL? -	add r31=IA64_SIGHAND_SIGLOCK_OFFSET,r31	// r31 <- current->sighand->siglock -(p8)	br.spnt.few .fail_efault		// fail with EFAULT -(p7)	br.spnt.many fsys_fallback_syscall	// got pending kernel work... -(p6)	br.dpnt.many .store_mask		// -> short-circuit to just reading the signal mask - -	/* Argh, we actually have to do some work and _update_ the signal mask: */ - -EX(.fail_efault, probe.r.fault r33, 3)		// verify user has read-access to *set -EX(.fail_efault, ld8 r14=[r33])			// r14 <- *set -	mov r17=(1 << (SIGKILL - 1)) | (1 << (SIGSTOP - 1)) -	;; - -	RSM_PSR_I(p0, r18, r19)			// mask interrupt delivery -	andcm r14=r14,r17			// filter out SIGKILL & SIGSTOP -	mov r8=EINVAL			// default to EINVAL - -#ifdef CONFIG_SMP -	// __ticket_spin_trylock(r31) -	ld4 r17=[r31] -	;; -	mov.m ar.ccv=r17 -	extr.u r9=r17,17,15 -	adds r19=1,r17 -	extr.u r18=r17,0,15 -	;; -	cmp.eq p6,p7=r9,r18 -	;; -(p6)	cmpxchg4.acq r9=[r31],r19,ar.ccv -(p6)	dep.z r20=r19,1,15		// next serving ticket for unlock -(p7)	br.cond.spnt.many .lock_contention -	;; -	cmp4.eq p0,p7=r9,r17 -	adds r31=2,r31 -(p7)	br.cond.spnt.many .lock_contention -	ld8 r3=[r2]			// re-read current->blocked now that we hold the lock -	;; -#else -	ld8 r3=[r2]			// re-read current->blocked now that we hold the lock -#endif -	add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16 -	add r19=IA64_TASK_SIGNAL_OFFSET,r16 -	cmp4.eq p6,p0=SIG_BLOCK,r32 -	;; -	ld8 r19=[r19]			// r19 <- current->signal -	cmp4.eq p7,p0=SIG_UNBLOCK,r32 -	cmp4.eq p8,p0=SIG_SETMASK,r32 -	;; -	ld8 r18=[r18]			// r18 <- current->pending.signal -	.pred.rel.mutex p6,p7,p8 -(p6)	or r14=r3,r14			// SIG_BLOCK -(p7)	andcm r14=r3,r14		// SIG_UNBLOCK - -(p8)	mov r14=r14			// SIG_SETMASK -(p6)	mov r8=0			// clear error code -	// recalc_sigpending() -	add r17=IA64_SIGNAL_GROUP_STOP_COUNT_OFFSET,r19 - -	add r19=IA64_SIGNAL_SHARED_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r19 -	;; -	ld4 r17=[r17]		// r17 <- current->signal->group_stop_count -(p7)	mov r8=0		// clear error code - -	ld8 r19=[r19]		// r19 <- current->signal->shared_pending -	;; -	cmp4.gt p6,p7=r17,r0	// p6/p7 <- (current->signal->group_stop_count > 0)? -(p8)	mov r8=0		// clear error code - -	or r18=r18,r19		// r18 <- current->pending | current->signal->shared_pending -	;; -	// r18 <- (current->pending | current->signal->shared_pending) & ~current->blocked: -	andcm r18=r18,r14 -	add r9=TI_FLAGS+IA64_TASK_SIZE,r16 -	;; - -(p7)	cmp.ne.or.andcm p6,p7=r18,r0		// p6/p7 <- signal pending -	mov r19=0					// i must not leak kernel bits... -(p6)	br.cond.dpnt.many .sig_pending -	;; - -1:	ld4 r17=[r9]				// r17 <- current->thread_info->flags -	;; -	mov ar.ccv=r17 -	and r18=~_TIF_SIGPENDING,r17		// r18 <- r17 & ~(1 << TIF_SIGPENDING) -	;; - -	st8 [r2]=r14				// update current->blocked with new mask -	cmpxchg4.acq r8=[r9],r18,ar.ccv		// current->thread_info->flags <- r18 -	;; -	cmp.ne p6,p0=r17,r8			// update failed? -(p6)	br.cond.spnt.few 1b			// yes -> retry - -#ifdef CONFIG_SMP -	// __ticket_spin_unlock(r31) -	st2.rel [r31]=r20 -	mov r20=0					// i must not leak kernel bits... -#endif -	SSM_PSR_I(p0, p9, r31) -	;; - -	srlz.d					// ensure psr.i is set again -	mov r18=0					// i must not leak kernel bits... - -.store_mask: -EX(.fail_efault, (p15) probe.w.fault r34, 3)	// verify user has write-access to *oset -EX(.fail_efault, (p15) st8 [r34]=r3) -	mov r2=0					// i must not leak kernel bits... -	mov r3=0					// i must not leak kernel bits... -	mov r8=0				// return 0 -	mov r9=0					// i must not leak kernel bits... -	mov r14=0					// i must not leak kernel bits... -	mov r17=0					// i must not leak kernel bits... -	mov r31=0					// i must not leak kernel bits... -	FSYS_RETURN - -.sig_pending: -#ifdef CONFIG_SMP -	// __ticket_spin_unlock(r31) -	st2.rel [r31]=r20			// release the lock -#endif -	SSM_PSR_I(p0, p9, r17) -	;; -	srlz.d -	br.sptk.many fsys_fallback_syscall	// with signal pending, do the heavy-weight syscall - -#ifdef CONFIG_SMP -.lock_contention: -	/* Rather than spinning here, fall back on doing a heavy-weight syscall.  */ -	SSM_PSR_I(p0, p9, r17) -	;; -	srlz.d -	br.sptk.many fsys_fallback_syscall -#endif -END(fsys_rt_sigprocmask) - -/*   * fsys_getcpu doesn't use the third parameter in this implementation. It reads   * current_thread_info()->cpu and corresponding node in cpu_to_node_map.   */ @@ -560,11 +343,15 @@ ENTRY(fsys_getcpu)  	;;  	tnat.nz p7,p0 = r33			// I guard against NaT argument  (p7)    br.cond.spnt.few .fail_einval		// B +	;; +	cmp.ne p6,p0=r32,r0 +	cmp.ne p7,p0=r33,r0 +	;;  #ifdef CONFIG_NUMA  	movl r17=cpu_to_node_map  	;; -EX(.fail_efault, probe.w.fault r32, 3)		// M This takes 5 cycles -EX(.fail_efault, probe.w.fault r33, 3)		// M This takes 5 cycles +EX(.fail_efault, (p6) probe.w.fault r32, 3)		// M This takes 5 cycles +EX(.fail_efault, (p7) probe.w.fault r33, 3)		// M This takes 5 cycles  	shladd r18=r3,1,r17  	;;  	ld2 r20=[r18]				// r20 = cpu_to_node_map[cpu] @@ -574,20 +361,20 @@ EX(.fail_efault, probe.w.fault r33, 3)		// M This takes 5 cycles  (p8)	br.spnt.many fsys_fallback_syscall  	;;  	;; -EX(.fail_efault, st4 [r32] = r3) -EX(.fail_efault, st2 [r33] = r20) +EX(.fail_efault, (p6) st4 [r32] = r3) +EX(.fail_efault, (p7) st2 [r33] = r20)  	mov r8=0  	;;  #else -EX(.fail_efault, probe.w.fault r32, 3)		// M This takes 5 cycles -EX(.fail_efault, probe.w.fault r33, 3)		// M This takes 5 cycles +EX(.fail_efault, (p6) probe.w.fault r32, 3)		// M This takes 5 cycles +EX(.fail_efault, (p7) probe.w.fault r33, 3)		// M This takes 5 cycles  	and r2 = TIF_ALLWORK_MASK,r2  	;;  	cmp.ne p8,p0=0,r2  (p8)	br.spnt.many fsys_fallback_syscall  	;; -EX(.fail_efault, st4 [r32] = r3) -EX(.fail_efault, st2 [r33] = r0) +EX(.fail_efault, (p6) st4 [r32] = r3) +EX(.fail_efault, (p7) st2 [r33] = r0)  	mov r8=0  	;;  #endif @@ -695,7 +482,7 @@ GLOBAL_ENTRY(paravirt_fsys_bubble_down)  	nop.i 0  	;;  	mov ar.rsc=0				// M2   set enforced lazy mode, pl 0, LE, loadrs=0 -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	MOV_FROM_ITC(p0, p6, r30, r23)		// M    get cycle for accounting  #else  	nop.m 0 @@ -721,7 +508,7 @@ GLOBAL_ENTRY(paravirt_fsys_bubble_down)  	cmp.ne pKStk,pUStk=r0,r0		// A    set pKStk <- 0, pUStk <- 1  	br.call.sptk.many b7=ia64_syscall_setup	// B  	;; -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	// mov.m r30=ar.itc is called in advance  	add r16=TI_AC_STAMP+IA64_TASK_SIZE,r2  	add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r2 @@ -780,7 +567,7 @@ paravirt_fsyscall_table:  	data8 0				// chown  	data8 0				// lseek		// 1040  	data8 fsys_getpid		// getpid -	data8 fsys_getppid		// getppid +	data8 0				// getppid  	data8 0				// mount  	data8 0				// umount  	data8 0				// setuid		// 1045 @@ -917,7 +704,7 @@ paravirt_fsyscall_table:  	data8 0				// sigaltstack  	data8 0				// rt_sigaction  	data8 0				// rt_sigpending -	data8 fsys_rt_sigprocmask	// rt_sigprocmask +	data8 0				// rt_sigprocmask  	data8 0				// rt_sigqueueinfo	// 1180  	data8 0				// rt_sigreturn  	data8 0				// rt_sigsuspend diff --git a/arch/ia64/kernel/fsyscall_gtod_data.h b/arch/ia64/kernel/fsyscall_gtod_data.h index 57d2ee6c83e..146b15b5fec 100644 --- a/arch/ia64/kernel/fsyscall_gtod_data.h +++ b/arch/ia64/kernel/fsyscall_gtod_data.h @@ -6,7 +6,7 @@   */  struct fsyscall_gtod_data_t { -	seqlock_t	lock; +	seqcount_t	seq;  	struct timespec	wall_time;  	struct timespec monotonic_time;  	cycle_t		clk_mask; diff --git a/arch/ia64/kernel/ftrace.c b/arch/ia64/kernel/ftrace.c index 7fc8c961b1f..3b0c2aa0785 100644 --- a/arch/ia64/kernel/ftrace.c +++ b/arch/ia64/kernel/ftrace.c @@ -198,9 +198,7 @@ int ftrace_update_ftrace_func(ftrace_func_t func)  }  /* run from kstop_machine */ -int __init ftrace_dyn_arch_init(void *data) +int __init ftrace_dyn_arch_init(void)  { -	*(unsigned long *)data = 0; -  	return 0;  } diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S index 245d3e1ec7e..b5f8bdd8618 100644 --- a/arch/ia64/kernel/gate.S +++ b/arch/ia64/kernel/gate.S @@ -11,8 +11,9 @@  #include <asm/errno.h>  #include <asm/asm-offsets.h>  #include <asm/sigcontext.h> -#include <asm/system.h>  #include <asm/unistd.h> +#include <asm/kregs.h> +#include <asm/page.h>  #include "paravirt_inst.h"  /* diff --git a/arch/ia64/kernel/gate.lds.S b/arch/ia64/kernel/gate.lds.S index d32b0855110..e518f7902af 100644 --- a/arch/ia64/kernel/gate.lds.S +++ b/arch/ia64/kernel/gate.lds.S @@ -5,8 +5,7 @@   * its layout.   */ - -#include <asm/system.h> +#include <asm/page.h>  #include "paravirt_patchlist.h"  SECTIONS diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S index 17a9fba3893..a4acddad0c7 100644 --- a/arch/ia64/kernel/head.S +++ b/arch/ia64/kernel/head.S @@ -30,7 +30,6 @@  #include <asm/pgtable.h>  #include <asm/processor.h>  #include <asm/ptrace.h> -#include <asm/system.h>  #include <asm/mca_asm.h>  #include <linux/init.h>  #include <linux/linkage.h> @@ -260,7 +259,7 @@ start_ap:  	 * Switch into virtual mode:  	 */  	movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \ -		  |IA64_PSR_DI|IA64_PSR_AC) +		  |IA64_PSR_DI)  	;;  	mov cr.ipsr=r16  	movl r17=1f @@ -417,8 +416,6 @@ start_ap:  default_setup_hook = 0		// Currently nothing needs to be done. -	.weak xen_setup_hook -  	.global hypervisor_type  hypervisor_type:  	data8		PARAVIRT_HYPERVISOR_TYPE_DEFAULT @@ -427,7 +424,6 @@ hypervisor_type:  hypervisor_setup_hooks:  	data8		default_setup_hook -	data8		xen_setup_hook  num_hypervisor_hooks = (. - hypervisor_setup_hooks) / 8  	.previous @@ -1036,7 +1032,7 @@ END(ia64_delay_loop)   * Return a CPU-local timestamp in nano-seconds.  This timestamp is   * NOT synchronized across CPUs its return value must never be   * compared against the values returned on another CPU.  The usage in - * kernel/sched.c ensures that. + * kernel/sched/core.c ensures that.   *   * The return-value of sched_clock() is NOT supposed to wrap-around.   * If it did, it would cause some scheduling hiccups (at the worst). @@ -1074,7 +1070,7 @@ END(ia64_native_sched_clock)  sched_clock = ia64_native_sched_clock  #endif -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  GLOBAL_ENTRY(cycle_to_cputime)  	alloc r16=ar.pfs,1,0,0,0  	addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 @@ -1092,20 +1088,7 @@ GLOBAL_ENTRY(cycle_to_cputime)  	shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT  	br.ret.sptk.many rp  END(cycle_to_cputime) -#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ - -GLOBAL_ENTRY(start_kernel_thread) -	.prologue -	.save rp, r0				// this is the end of the call-chain -	.body -	alloc r2 = ar.pfs, 0, 0, 2, 0 -	mov out0 = r9 -	mov out1 = r11;; -	br.call.sptk.many rp = kernel_thread_helper;; -	mov out0 = r8 -	br.call.sptk.many rp = sys_exit;; -1:	br.sptk.few 1b				// not reached -END(start_kernel_thread) +#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */  #ifdef CONFIG_IA64_BRL_EMU diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c index 7f4a0ed2415..5b7791dd396 100644 --- a/arch/ia64/kernel/ia64_ksyms.c +++ b/arch/ia64/kernel/ia64_ksyms.c @@ -12,7 +12,7 @@ EXPORT_SYMBOL(memset);  EXPORT_SYMBOL(memcpy);  EXPORT_SYMBOL(strlen); -#include<asm/pgtable.h> +#include <asm/pgtable.h>  EXPORT_SYMBOL_GPL(empty_zero_page);  #include <asm/checksum.h> diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index 22c38404f53..cd44a57c73b 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c @@ -76,7 +76,7 @@   *	PCI pin -> global system interrupt (GSI) -> IA-64 vector <-> IRQ   *   * Note: The term "IRQ" is loosely used everywhere in Linux kernel to - * describeinterrupts.  Now we use "IRQ" only for Linux IRQ's.  ISA IRQ + * describe interrupts.  Now we use "IRQ" only for Linux IRQ's.  ISA IRQ   * (isa_irq) is the only exception in this source code.   */ @@ -98,7 +98,6 @@  #include <asm/machvec.h>  #include <asm/processor.h>  #include <asm/ptrace.h> -#include <asm/system.h>  #undef DEBUG_INTERRUPT_ROUTING @@ -148,7 +147,7 @@ static struct iosapic_intr_info {  	unsigned char	trigger	: 1;	/* trigger mode (see iosapic.h) */  } iosapic_intr_info[NR_IRQS]; -static unsigned char pcat_compat __devinitdata;	/* 8259 compatibility flag */ +static unsigned char pcat_compat;	/* 8259 compatibility flag */  static inline void  iosapic_write(struct iosapic *iosapic, unsigned int reg, u32 val) @@ -257,7 +256,7 @@ set_rte (unsigned int gsi, unsigned int irq, unsigned int dest, int mask)  }  static void -nop (unsigned int irq) +nop (struct irq_data *data)  {  	/* do nothing... */  } @@ -287,8 +286,9 @@ kexec_disable_iosapic(void)  #endif  static void -mask_irq (unsigned int irq) +mask_irq (struct irq_data *data)  { +	unsigned int irq = data->irq;  	u32 low32;  	int rte_index;  	struct iosapic_rte_info *rte; @@ -305,8 +305,9 @@ mask_irq (unsigned int irq)  }  static void -unmask_irq (unsigned int irq) +unmask_irq (struct irq_data *data)  { +	unsigned int irq = data->irq;  	u32 low32;  	int rte_index;  	struct iosapic_rte_info *rte; @@ -323,9 +324,11 @@ unmask_irq (unsigned int irq)  static int -iosapic_set_affinity(unsigned int irq, const struct cpumask *mask) +iosapic_set_affinity(struct irq_data *data, const struct cpumask *mask, +		     bool force)  {  #ifdef CONFIG_SMP +	unsigned int irq = data->irq;  	u32 high32, low32;  	int cpu, dest, rte_index;  	int redir = (irq & IA64_IRQ_REDIRECTED) ? 1 : 0; @@ -379,32 +382,33 @@ iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)   */  static unsigned int -iosapic_startup_level_irq (unsigned int irq) +iosapic_startup_level_irq (struct irq_data *data)  { -	unmask_irq(irq); +	unmask_irq(data);  	return 0;  }  static void -iosapic_unmask_level_irq (unsigned int irq) +iosapic_unmask_level_irq (struct irq_data *data)  { +	unsigned int irq = data->irq;  	ia64_vector vec = irq_to_vector(irq);  	struct iosapic_rte_info *rte;  	int do_unmask_irq = 0;  	irq_complete_move(irq); -	if (unlikely(irq_desc[irq].status & IRQ_MOVE_PENDING)) { +	if (unlikely(irqd_is_setaffinity_pending(data))) {  		do_unmask_irq = 1; -		mask_irq(irq); +		mask_irq(data);  	} else -		unmask_irq(irq); +		unmask_irq(data);  	list_for_each_entry(rte, &iosapic_intr_info[irq].rtes, rte_list)  		iosapic_eoi(rte->iosapic->addr, vec);  	if (unlikely(do_unmask_irq)) { -		move_masked_irq(irq); -		unmask_irq(irq); +		irq_move_masked_irq(data); +		unmask_irq(data);  	}  } @@ -414,15 +418,15 @@ iosapic_unmask_level_irq (unsigned int irq)  #define iosapic_ack_level_irq		nop  static struct irq_chip irq_type_iosapic_level = { -	.name =		"IO-SAPIC-level", -	.startup =	iosapic_startup_level_irq, -	.shutdown =	iosapic_shutdown_level_irq, -	.enable =	iosapic_enable_level_irq, -	.disable =	iosapic_disable_level_irq, -	.ack =		iosapic_ack_level_irq, -	.mask =		mask_irq, -	.unmask =	iosapic_unmask_level_irq, -	.set_affinity =	iosapic_set_affinity +	.name =			"IO-SAPIC-level", +	.irq_startup =		iosapic_startup_level_irq, +	.irq_shutdown =		iosapic_shutdown_level_irq, +	.irq_enable =		iosapic_enable_level_irq, +	.irq_disable =		iosapic_disable_level_irq, +	.irq_ack =		iosapic_ack_level_irq, +	.irq_mask =		mask_irq, +	.irq_unmask =		iosapic_unmask_level_irq, +	.irq_set_affinity =	iosapic_set_affinity  };  /* @@ -430,9 +434,9 @@ static struct irq_chip irq_type_iosapic_level = {   */  static unsigned int -iosapic_startup_edge_irq (unsigned int irq) +iosapic_startup_edge_irq (struct irq_data *data)  { -	unmask_irq(irq); +	unmask_irq(data);  	/*  	 * IOSAPIC simply drops interrupts pended while the  	 * corresponding pin was masked, so we can't know if an @@ -442,37 +446,25 @@ iosapic_startup_edge_irq (unsigned int irq)  }  static void -iosapic_ack_edge_irq (unsigned int irq) +iosapic_ack_edge_irq (struct irq_data *data)  { -	struct irq_desc *idesc = irq_desc + irq; - -	irq_complete_move(irq); -	move_native_irq(irq); -	/* -	 * Once we have recorded IRQ_PENDING already, we can mask the -	 * interrupt for real. This prevents IRQ storms from unhandled -	 * devices. -	 */ -	if ((idesc->status & (IRQ_PENDING|IRQ_DISABLED)) == -	    (IRQ_PENDING|IRQ_DISABLED)) -		mask_irq(irq); +	irq_complete_move(data->irq); +	irq_move_irq(data);  }  #define iosapic_enable_edge_irq		unmask_irq  #define iosapic_disable_edge_irq	nop -#define iosapic_end_edge_irq		nop  static struct irq_chip irq_type_iosapic_edge = { -	.name =		"IO-SAPIC-edge", -	.startup =	iosapic_startup_edge_irq, -	.shutdown =	iosapic_disable_edge_irq, -	.enable =	iosapic_enable_edge_irq, -	.disable =	iosapic_disable_edge_irq, -	.ack =		iosapic_ack_edge_irq, -	.end =		iosapic_end_edge_irq, -	.mask =		mask_irq, -	.unmask =	unmask_irq, -	.set_affinity =	iosapic_set_affinity +	.name =			"IO-SAPIC-edge", +	.irq_startup =		iosapic_startup_edge_irq, +	.irq_shutdown =		iosapic_disable_edge_irq, +	.irq_enable =		iosapic_enable_edge_irq, +	.irq_disable =		iosapic_disable_edge_irq, +	.irq_ack =		iosapic_ack_edge_irq, +	.irq_mask =		mask_irq, +	.irq_unmask =		unmask_irq, +	.irq_set_affinity =	iosapic_set_affinity  };  static unsigned int @@ -562,8 +554,7 @@ static int  register_intr (unsigned int gsi, int irq, unsigned char delivery,  	       unsigned long polarity, unsigned long trigger)  { -	struct irq_desc *idesc; -	struct irq_chip *irq_type; +	struct irq_chip *chip, *irq_type;  	int index;  	struct iosapic_rte_info *rte; @@ -610,19 +601,18 @@ register_intr (unsigned int gsi, int irq, unsigned char delivery,  	irq_type = iosapic_get_irq_chip(trigger); -	idesc = irq_desc + irq; -	if (irq_type != NULL && idesc->chip != irq_type) { -		if (idesc->chip != &no_irq_chip) +	chip = irq_get_chip(irq); +	if (irq_type != NULL && chip != irq_type) { +		if (chip != &no_irq_chip)  			printk(KERN_WARNING  			       "%s: changing vector %d from %s to %s\n",  			       __func__, irq_to_vector(irq), -			       idesc->chip->name, irq_type->name); -		idesc->chip = irq_type; +			       chip->name, irq_type->name); +		chip = irq_type;  	} -	if (trigger == IOSAPIC_EDGE) -		__set_irq_handler_unlocked(irq, handle_edge_irq); -	else -		__set_irq_handler_unlocked(irq, handle_level_irq); +	__irq_set_chip_handler_name_locked(irq, chip, trigger == IOSAPIC_EDGE ? +					   handle_edge_irq : handle_level_irq, +					   NULL);  	return 0;  } @@ -732,6 +722,7 @@ iosapic_register_intr (unsigned int gsi,  	struct iosapic_rte_info *rte;  	u32 low32;  	unsigned char dmode; +	struct irq_desc *desc;  	/*  	 * If this GSI has already been registered (i.e., it's a @@ -744,7 +735,7 @@ iosapic_register_intr (unsigned int gsi,  		rte = find_rte(irq, gsi);  		if(iosapic_intr_info[irq].count == 0) {  			assign_irq_vector(irq); -			dynamic_irq_init(irq); +			irq_init_desc(irq);  		} else if (rte->refcnt != NO_REF_RTE) {  			rte->refcnt++;  			goto unlock_iosapic_lock; @@ -759,12 +750,13 @@ iosapic_register_intr (unsigned int gsi,  			goto unlock_iosapic_lock;  	} -	raw_spin_lock(&irq_desc[irq].lock); +	desc = irq_to_desc(irq); +	raw_spin_lock(&desc->lock);  	dest = get_target_cpu(gsi, irq);  	dmode = choose_dmode();  	err = register_intr(gsi, irq, dmode, polarity, trigger);  	if (err < 0) { -		raw_spin_unlock(&irq_desc[irq].lock); +		raw_spin_unlock(&desc->lock);  		irq = err;  		goto unlock_iosapic_lock;  	} @@ -783,7 +775,7 @@ iosapic_register_intr (unsigned int gsi,  	       (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),  	       cpu_logical_id(dest), dest, irq_to_vector(irq)); -	raw_spin_unlock(&irq_desc[irq].lock); +	raw_spin_unlock(&desc->lock);   unlock_iosapic_lock:  	spin_unlock_irqrestore(&iosapic_lock, flags);  	return irq; @@ -794,7 +786,6 @@ iosapic_unregister_intr (unsigned int gsi)  {  	unsigned long flags;  	int irq, index; -	struct irq_desc *idesc;  	u32 low32;  	unsigned long trigger, polarity;  	unsigned int dest; @@ -824,7 +815,6 @@ iosapic_unregister_intr (unsigned int gsi)  	if (--rte->refcnt > 0)  		goto out; -	idesc = irq_desc + irq;  	rte->refcnt = NO_REF_RTE;  	/* Mask the interrupt */ @@ -848,7 +838,7 @@ iosapic_unregister_intr (unsigned int gsi)  	if (iosapic_intr_info[irq].count == 0) {  #ifdef CONFIG_SMP  		/* Clear affinity */ -		cpumask_setall(idesc->affinity); +		cpumask_setall(irq_get_irq_data(irq)->affinity);  #endif  		/* Clear the interrupt information */  		iosapic_intr_info[irq].dest = 0; @@ -924,10 +914,8 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi,  /*   * ACPI calls this when it finds an entry for a legacy ISA IRQ override.   */ -void __devinit -iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, -			  unsigned long polarity, -			  unsigned long trigger) +void iosapic_override_isa_irq(unsigned int isa_irq, unsigned int gsi, +			      unsigned long polarity, unsigned long trigger)  {  	int vector, irq;  	unsigned int dest = cpu_physical_id(smp_processor_id()); @@ -1022,8 +1010,27 @@ iosapic_check_gsi_range (unsigned int gsi_base, unsigned int ver)  	return 0;  } -int __devinit -iosapic_init (unsigned long phys_addr, unsigned int gsi_base) +static int +iosapic_delete_rte(unsigned int irq, unsigned int gsi) +{ +	struct iosapic_rte_info *rte, *temp; + +	list_for_each_entry_safe(rte, temp, &iosapic_intr_info[irq].rtes, +								rte_list) { +		if (rte->iosapic->gsi_base + rte->rte_index == gsi) { +			if (rte->refcnt) +				return -EBUSY; + +			list_del(&rte->rte_list); +			kfree(rte); +			return 0; +		} +	} + +	return -EINVAL; +} + +int iosapic_init(unsigned long phys_addr, unsigned int gsi_base)  {  	int num_rte, err, index;  	unsigned int isa_irq, ver; @@ -1080,11 +1087,9 @@ iosapic_init (unsigned long phys_addr, unsigned int gsi_base)  	return 0;  } -#ifdef CONFIG_HOTPLUG -int -iosapic_remove (unsigned int gsi_base) +int iosapic_remove(unsigned int gsi_base)  { -	int index, err = 0; +	int i, irq, index, err = 0;  	unsigned long flags;  	spin_lock_irqsave(&iosapic_lock, flags); @@ -1102,17 +1107,25 @@ iosapic_remove (unsigned int gsi_base)  		goto out;  	} +	for (i = gsi_base; i < gsi_base + iosapic_lists[index].num_rte; i++) { +		irq = __gsi_to_irq(i); +		if (irq < 0) +			continue; + +		err = iosapic_delete_rte(irq, i); +		if (err) +			goto out; +	} +  	iounmap(iosapic_lists[index].addr);  	iosapic_free(index);   out:  	spin_unlock_irqrestore(&iosapic_lock, flags);  	return err;  } -#endif /* CONFIG_HOTPLUG */  #ifdef CONFIG_NUMA -void __devinit -map_iosapic_to_node(unsigned int gsi_base, int node) +void map_iosapic_to_node(unsigned int gsi_base, int node)  {  	int index; diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c index 94ee9d067cb..f2c41828113 100644 --- a/arch/ia64/kernel/irq.c +++ b/arch/ia64/kernel/irq.c @@ -23,6 +23,8 @@  #include <linux/interrupt.h>  #include <linux/kernel_stat.h> +#include <asm/mca.h> +  /*   * 'what should we do if we get a hw irq event on an illegal vector'.   * each architecture has to answer this themselves. @@ -53,47 +55,9 @@ atomic_t irq_err_count;  /*   * /proc/interrupts printing:   */ - -int show_interrupts(struct seq_file *p, void *v) +int arch_show_interrupts(struct seq_file *p, int prec)  { -	int i = *(loff_t *) v, j; -	struct irqaction * action; -	unsigned long flags; - -	if (i == 0) { -		char cpuname[16]; -		seq_printf(p, "     "); -		for_each_online_cpu(j) { -			snprintf(cpuname, 10, "CPU%d", j); -			seq_printf(p, "%10s ", cpuname); -		} -		seq_putc(p, '\n'); -	} - -	if (i < NR_IRQS) { -		raw_spin_lock_irqsave(&irq_desc[i].lock, flags); -		action = irq_desc[i].action; -		if (!action) -			goto skip; -		seq_printf(p, "%3d: ",i); -#ifndef CONFIG_SMP -		seq_printf(p, "%10u ", kstat_irqs(i)); -#else -		for_each_online_cpu(j) { -			seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); -		} -#endif -		seq_printf(p, " %14s", irq_desc[i].chip->name); -		seq_printf(p, "  %s", action->name); - -		for (action=action->next; action; action = action->next) -			seq_printf(p, ", %s", action->name); - -		seq_putc(p, '\n'); -skip: -		raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags); -	} else if (i == NR_IRQS) -		seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); +	seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));  	return 0;  } @@ -103,7 +67,7 @@ static char irq_redir [NR_IRQS]; // = { [0 ... NR_IRQS-1] = 1 };  void set_irq_affinity_info (unsigned int irq, int hwid, int redir)  {  	if (irq < NR_IRQS) { -		cpumask_copy(irq_desc[irq].affinity, +		cpumask_copy(irq_get_irq_data(irq)->affinity,  			     cpumask_of(cpu_logical_id(hwid)));  		irq_redir[irq] = (char) (redir & 0xff);  	} @@ -121,6 +85,12 @@ bool is_affinity_mask_valid(const struct cpumask *cpumask)  #endif /* CONFIG_SMP */ +int __init arch_early_irq_init(void) +{ +	ia64_mca_irq_init(); +	return 0; +} +  #ifdef CONFIG_HOTPLUG_CPU  unsigned int vectors_in_migration[NR_IRQS]; @@ -130,13 +100,14 @@ unsigned int vectors_in_migration[NR_IRQS];   */  static void migrate_irqs(void)  { -	struct irq_desc *desc;  	int 		irq, new_cpu;  	for (irq=0; irq < NR_IRQS; irq++) { -		desc = irq_desc + irq; +		struct irq_desc *desc = irq_to_desc(irq); +		struct irq_data *data = irq_desc_get_irq_data(desc); +		struct irq_chip *chip = irq_data_get_irq_chip(data); -		if (desc->status == IRQ_DISABLED) +		if (irqd_irq_disabled(data))  			continue;  		/* @@ -145,10 +116,10 @@ static void migrate_irqs(void)  		 * tell CPU not to respond to these local intr sources.  		 * such as ITV,CPEI,MCA etc.  		 */ -		if (desc->status == IRQ_PER_CPU) +		if (irqd_is_per_cpu(data))  			continue; -		if (cpumask_any_and(irq_desc[irq].affinity, cpu_online_mask) +		if (cpumask_any_and(data->affinity, cpu_online_mask)  		    >= nr_cpu_ids) {  			/*  			 * Save it for phase 2 processing @@ -160,16 +131,16 @@ static void migrate_irqs(void)  			/*  			 * Al three are essential, currently WARN_ON.. maybe panic?  			 */ -			if (desc->chip && desc->chip->disable && -				desc->chip->enable && desc->chip->set_affinity) { -				desc->chip->disable(irq); -				desc->chip->set_affinity(irq, -							 cpumask_of(new_cpu)); -				desc->chip->enable(irq); +			if (chip && chip->irq_disable && +				chip->irq_enable && chip->irq_set_affinity) { +				chip->irq_disable(data); +				chip->irq_set_affinity(data, +						       cpumask_of(new_cpu), false); +				chip->irq_enable(data);  			} else { -				WARN_ON((!(desc->chip) || !(desc->chip->disable) || -						!(desc->chip->enable) || -						!(desc->chip->set_affinity))); +				WARN_ON((!chip || !chip->irq_disable || +					 !chip->irq_enable || +					 !chip->irq_set_affinity));  			}  		}  	} diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c index 9a26015c3e5..03ea78ed64a 100644 --- a/arch/ia64/kernel/irq_ia64.c +++ b/arch/ia64/kernel/irq_ia64.c @@ -23,7 +23,6 @@  #include <linux/ioport.h>  #include <linux/kernel_stat.h>  #include <linux/ptrace.h> -#include <linux/random.h>	/* for rand_initialize_irq() */  #include <linux/signal.h>  #include <linux/smp.h>  #include <linux/threads.h> @@ -31,6 +30,7 @@  #include <linux/irq.h>  #include <linux/ratelimit.h>  #include <linux/acpi.h> +#include <linux/sched.h>  #include <asm/delay.h>  #include <asm/intrinsics.h> @@ -38,7 +38,6 @@  #include <asm/hw_irq.h>  #include <asm/machvec.h>  #include <asm/pgtable.h> -#include <asm/system.h>  #include <asm/tlbflush.h>  #ifdef CONFIG_PERFMON @@ -94,14 +93,6 @@ static int irq_status[NR_IRQS] = {  	[0 ... NR_IRQS -1] = IRQ_UNUSED  }; -int check_irq_used(int irq) -{ -	if (irq_status[irq] == IRQ_USED) -		return 1; - -	return -1; -} -  static inline int find_unassigned_irq(void)  {  	int irq; @@ -117,7 +108,7 @@ static inline int find_unassigned_vector(cpumask_t domain)  	cpumask_t mask;  	int pos, vector; -	cpus_and(mask, domain, cpu_online_map); +	cpumask_and(&mask, &domain, cpu_online_mask);  	if (cpus_empty(mask))  		return -EINVAL; @@ -140,7 +131,7 @@ static int __bind_irq_vector(int irq, int vector, cpumask_t domain)  	BUG_ON((unsigned)irq >= NR_IRQS);  	BUG_ON((unsigned)vector >= IA64_NUM_VECTORS); -	cpus_and(mask, domain, cpu_online_map); +	cpumask_and(&mask, &domain, cpu_online_mask);  	if (cpus_empty(mask))  		return -EINVAL;  	if ((cfg->vector == vector) && cpus_equal(cfg->domain, domain)) @@ -178,7 +169,7 @@ static void __clear_irq_vector(int irq)  	BUG_ON(cfg->vector == IRQ_VECTOR_UNASSIGNED);  	vector = cfg->vector;  	domain = cfg->domain; -	cpus_and(mask, cfg->domain, cpu_online_map); +	cpumask_and(&mask, &cfg->domain, cpu_online_mask);  	for_each_cpu_mask(cpu, mask)  		per_cpu(vector_irq, cpu)[vector] = -1;  	cfg->vector = IRQ_VECTOR_UNASSIGNED; @@ -321,7 +312,7 @@ void irq_complete_move(unsigned irq)  	if (unlikely(cpu_isset(smp_processor_id(), cfg->old_domain)))  		return; -	cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); +	cpumask_and(&cleanup_mask, &cfg->old_domain, cpu_online_mask);  	cfg->move_cleanup_count = cpus_weight(cleanup_mask);  	for_each_cpu_mask(i, cleanup_mask)  		platform_send_ipi(i, IA64_IRQ_MOVE_VECTOR, IA64_IPI_DM_INT, 0); @@ -343,7 +334,7 @@ static irqreturn_t smp_irq_move_cleanup_interrupt(int irq, void *dev_id)  		if (irq < 0)  			continue; -		desc = irq_desc + irq; +		desc = irq_to_desc(irq);  		cfg = irq_cfg + irq;  		raw_spin_lock(&desc->lock);  		if (!cfg->move_cleanup_count) @@ -365,7 +356,6 @@ static irqreturn_t smp_irq_move_cleanup_interrupt(int irq, void *dev_id)  static struct irqaction irq_move_irqaction = {  	.handler =	smp_irq_move_cleanup_interrupt, -	.flags =	IRQF_DISABLED,  	.name =		"irq_move"  }; @@ -392,8 +382,7 @@ void destroy_and_reserve_irq(unsigned int irq)  {  	unsigned long flags; -	dynamic_irq_cleanup(irq); - +	irq_init_desc(irq);  	spin_lock_irqsave(&vector_lock, flags);  	__clear_irq_vector(irq);  	irq_status[irq] = IRQ_RSVD; @@ -426,13 +415,13 @@ int create_irq(void)   out:  	spin_unlock_irqrestore(&vector_lock, flags);  	if (irq >= 0) -		dynamic_irq_init(irq); +		irq_init_desc(irq);  	return irq;  }  void destroy_irq(unsigned int irq)  { -	dynamic_irq_cleanup(irq); +	irq_init_desc(irq);  	clear_irq_vector(irq);  } @@ -490,13 +479,13 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)  	ia64_srlz_d();  	while (vector != IA64_SPURIOUS_INT_VECTOR) {  		int irq = local_vector_to_irq(vector); -		struct irq_desc *desc = irq_to_desc(irq);  		if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {  			smp_local_flush_tlb(); -			kstat_incr_irqs_this_cpu(irq, desc); +			kstat_incr_irq_this_cpu(irq);  		} else if (unlikely(IS_RESCHEDULE(vector))) { -			kstat_incr_irqs_this_cpu(irq, desc); +			scheduler_ipi(); +			kstat_incr_irq_this_cpu(irq);  		} else {  			ia64_setreg(_IA64_REG_CR_TPR, vector);  			ia64_srlz_d(); @@ -549,13 +538,12 @@ void ia64_process_pending_intr(void)  	  */  	while (vector != IA64_SPURIOUS_INT_VECTOR) {  		int irq = local_vector_to_irq(vector); -		struct irq_desc *desc = irq_to_desc(irq);  		if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {  			smp_local_flush_tlb(); -			kstat_incr_irqs_this_cpu(irq, desc); +			kstat_incr_irq_this_cpu(irq);  		} else if (unlikely(IS_RESCHEDULE(vector))) { -			kstat_incr_irqs_this_cpu(irq, desc); +			kstat_incr_irq_this_cpu(irq);  		} else {  			struct pt_regs *old_regs = set_irq_regs(NULL); @@ -602,7 +590,6 @@ static irqreturn_t dummy_handler (int irq, void *dev_id)  static struct irqaction ipi_irqaction = {  	.handler =	handle_IPI, -	.flags =	IRQF_DISABLED,  	.name =		"IPI"  }; @@ -611,13 +598,11 @@ static struct irqaction ipi_irqaction = {   */  static struct irqaction resched_irqaction = {  	.handler =	dummy_handler, -	.flags =	IRQF_DISABLED,  	.name =		"resched"  };  static struct irqaction tlb_irqaction = {  	.handler =	dummy_handler, -	.flags =	IRQF_DISABLED,  	.name =		"tlb_flush"  }; @@ -626,17 +611,15 @@ static struct irqaction tlb_irqaction = {  void  ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action)  { -	struct irq_desc *desc;  	unsigned int irq;  	irq = vec;  	BUG_ON(bind_irq_vector(irq, vec, CPU_MASK_ALL)); -	desc = irq_desc + irq; -	desc->status |= IRQ_PER_CPU; -	desc->chip = &irq_type_ia64_lsapic; +	irq_set_status_flags(irq, IRQ_PER_CPU); +	irq_set_chip(irq, &irq_type_ia64_lsapic);  	if (action)  		setup_irq(irq, action); -	set_irq_handler(irq, handle_percpu_irq); +	irq_set_handler(irq, handle_percpu_irq);  }  void __init diff --git a/arch/ia64/kernel/irq_lsapic.c b/arch/ia64/kernel/irq_lsapic.c index fc1549d4564..1b3a776e516 100644 --- a/arch/ia64/kernel/irq_lsapic.c +++ b/arch/ia64/kernel/irq_lsapic.c @@ -15,31 +15,30 @@  #include <linux/irq.h>  static unsigned int -lsapic_noop_startup (unsigned int irq) +lsapic_noop_startup (struct irq_data *data)  {  	return 0;  }  static void -lsapic_noop (unsigned int irq) +lsapic_noop (struct irq_data *data)  {  	/* nothing to do... */  } -static int lsapic_retrigger(unsigned int irq) +static int lsapic_retrigger(struct irq_data *data)  { -	ia64_resend_irq(irq); +	ia64_resend_irq(data->irq);  	return 1;  }  struct irq_chip irq_type_ia64_lsapic = { -	.name =		"LSAPIC", -	.startup =	lsapic_noop_startup, -	.shutdown =	lsapic_noop, -	.enable =	lsapic_noop, -	.disable =	lsapic_noop, -	.ack =		lsapic_noop, -	.end =		lsapic_noop, -	.retrigger =	lsapic_retrigger, +	.name =			"LSAPIC", +	.irq_startup =		lsapic_noop_startup, +	.irq_shutdown =		lsapic_noop, +	.irq_enable =		lsapic_noop, +	.irq_disable =		lsapic_noop, +	.irq_ack =		lsapic_noop, +	.irq_retrigger =	lsapic_retrigger,  }; diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S index d93e396bf59..18e794a5724 100644 --- a/arch/ia64/kernel/ivt.S +++ b/arch/ia64/kernel/ivt.S @@ -54,12 +54,11 @@  #include <asm/pgtable.h>  #include <asm/processor.h>  #include <asm/ptrace.h> -#include <asm/system.h>  #include <asm/thread_info.h>  #include <asm/unistd.h>  #include <asm/errno.h> -#if 1 +#if 0  # define PSR_DEFAULT_BITS	psr.ac  #else  # define PSR_DEFAULT_BITS	0 @@ -785,7 +784,7 @@ ENTRY(break_fault)  (p8)	adds r28=16,r28				// A    switch cr.iip to next bundle  (p9)	adds r8=1,r8				// A    increment ei to next slot -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	;;  	mov b6=r30				// I0   setup syscall handler branch reg early  #else @@ -802,7 +801,7 @@ ENTRY(break_fault)  	//  ///////////////////////////////////////////////////////////////////////  	st1 [r16]=r0				// M2|3 clear current->thread.on_ustack flag -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	MOV_FROM_ITC(p0, p14, r30, r18)		// M    get cycle for accounting  #else  	mov b6=r30				// I0   setup syscall handler branch reg early @@ -818,7 +817,7 @@ ENTRY(break_fault)  	cmp.eq p14,p0=r9,r0			// A    are syscalls being traced/audited?  	br.call.sptk.many b7=ia64_syscall_setup	// B  1: -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	// mov.m r30=ar.itc is called in advance, and r13 is current  	add r16=TI_AC_STAMP+IA64_TASK_SIZE,r13	// A  	add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r13	// A @@ -1044,7 +1043,7 @@ END(ia64_syscall_setup)  	DBG_FAULT(16)  	FAULT(16) -#if defined(CONFIG_VIRT_CPU_ACCOUNTING) && defined(__IA64_ASM_PARAVIRTUALIZED_NATIVE) +#if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) && defined(__IA64_ASM_PARAVIRTUALIZED_NATIVE)  	/*  	 * There is no particular reason for this code to be here, other than  	 * that there happens to be space here that would go unused otherwise. diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 7026b29e277..074fde49c9e 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c @@ -423,7 +423,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)  {  	struct kretprobe_instance *ri = NULL;  	struct hlist_head *head, empty_rp; -	struct hlist_node *node, *tmp; +	struct hlist_node *tmp;  	unsigned long flags, orig_ret_address = 0;  	unsigned long trampoline_address =  		((struct fnptr *)kretprobe_trampoline)->ip; @@ -444,7 +444,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)  	 *       real return address, and all the rest will point to  	 *       kretprobe_trampoline  	 */ -	hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { +	hlist_for_each_entry_safe(ri, tmp, head, hlist) {  		if (ri->task != current)  			/* another task is sharing our hash bucket */  			continue; @@ -461,7 +461,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)  	regs->cr_iip = orig_ret_address; -	hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { +	hlist_for_each_entry_safe(ri, tmp, head, hlist) {  		if (ri->task != current)  			/* another task is sharing our hash bucket */  			continue; @@ -487,7 +487,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)  	kretprobe_hash_unlock(current, &flags);  	preempt_enable_no_resched(); -	hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { +	hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {  		hlist_del(&ri->hlist);  		kfree(ri);  	} @@ -947,7 +947,7 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)  	case KPROBE_HIT_SSDONE:  		/*  		 * We increment the nmissed count for accounting, -		 * we can also use npre/npostfault count for accouting +		 * we can also use npre/npostfault count for accounting  		 * these specific fault cases.  		 */  		kprobes_inc_nmissed_count(cur); diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c index 3d3aeef4694..5151a649c96 100644 --- a/arch/ia64/kernel/machine_kexec.c +++ b/arch/ia64/kernel/machine_kexec.c @@ -27,11 +27,11 @@  #include <asm/sal.h>  #include <asm/mca.h> -typedef NORET_TYPE void (*relocate_new_kernel_t)( +typedef void (*relocate_new_kernel_t)(  					unsigned long indirection_page,  					unsigned long start_address,  					struct ia64_boot_param *boot_param, -					unsigned long pal_addr) ATTRIB_NORET; +					unsigned long pal_addr) __noreturn;  struct kimage *ia64_kimage; @@ -85,12 +85,13 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)  	struct kimage *image = arg;  	relocate_new_kernel_t rnk;  	void *pal_addr = efi_get_pal_addr(); -	unsigned long code_addr = (unsigned long)page_address(image->control_code_page); +	unsigned long code_addr;  	int ii;  	u64 fp, gp;  	ia64_fptr_t *init_handler = (ia64_fptr_t *)ia64_os_init_on_kdump;  	BUG_ON(!image); +	code_addr = (unsigned long)page_address(image->control_code_page);  	if (image->type == KEXEC_TYPE_CRASH) {  		crash_save_this_cpu();  		current->thread.ksp = (__u64)info->sw - 16; @@ -157,7 +158,7 @@ void arch_crash_save_vmcoreinfo(void)  #endif  #ifdef CONFIG_PGTABLE_3  	VMCOREINFO_CONFIG(PGTABLE_3); -#elif  CONFIG_PGTABLE_4 +#elif defined(CONFIG_PGTABLE_4)  	VMCOREINFO_CONFIG(PGTABLE_4);  #endif  } diff --git a/arch/ia64/kernel/machvec.c b/arch/ia64/kernel/machvec.c index d41a40ef80c..f5a1e5246b3 100644 --- a/arch/ia64/kernel/machvec.c +++ b/arch/ia64/kernel/machvec.c @@ -1,7 +1,6 @@  #include <linux/module.h>  #include <linux/dma-mapping.h>  #include <asm/machvec.h> -#include <asm/system.h>  #ifdef CONFIG_IA64_GENERIC diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c index 1753f6a30d5..db7b36bb068 100644 --- a/arch/ia64/kernel/mca.c +++ b/arch/ia64/kernel/mca.c @@ -92,7 +92,6 @@  #include <asm/meminit.h>  #include <asm/page.h>  #include <asm/ptrace.h> -#include <asm/system.h>  #include <asm/sal.h>  #include <asm/mca.h>  #include <asm/kexec.h> @@ -218,7 +217,7 @@ void ia64_mca_printk(const char *fmt, ...)  	/* Copy the output into mlogbuf */  	if (oops_in_progress) {  		/* mlogbuf was abandoned, use printk directly instead. */ -		printk(temp_buf); +		printk("%s", temp_buf);  	} else {  		spin_lock(&mlogbuf_wlock);  		for (p = temp_buf; *p; p++) { @@ -269,7 +268,7 @@ void ia64_mlogbuf_dump(void)  		}  		*p = '\0';  		if (temp_buf[0]) -			printk(temp_buf); +			printk("%s", temp_buf);  		mlogbuf_start = index;  		mlogbuf_timestamp = 0; @@ -582,6 +581,8 @@ out:  	/* Get the CPE error record and log it */  	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CPE); +	local_irq_disable(); +  	return IRQ_HANDLED;  } @@ -630,7 +631,7 @@ ia64_mca_register_cpev (int cpev)   * Outputs   *	None   */ -void __cpuinit +void  ia64_mca_cmc_vector_setup (void)  {  	cmcv_reg_t	cmcv; @@ -1445,6 +1446,8 @@ out:  	/* Get the CMC error record and log it */  	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC); +	local_irq_disable(); +  	return IRQ_HANDLED;  } @@ -1511,7 +1514,8 @@ static void  ia64_mca_cmc_poll (unsigned long dummy)  {  	/* Trigger a CMC interrupt cascade  */ -	platform_send_ipi(first_cpu(cpu_online_map), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0); +	platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CMCP_VECTOR, +							IA64_IPI_DM_INT, 0);  }  /* @@ -1587,7 +1591,8 @@ static void  ia64_mca_cpe_poll (unsigned long dummy)  {  	/* Trigger a CPE interrupt cascade  */ -	platform_send_ipi(first_cpu(cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0); +	platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CPEP_VECTOR, +							IA64_IPI_DM_INT, 0);  }  #endif /* CONFIG_ACPI */ @@ -1767,38 +1772,32 @@ __setup("disable_cpe_poll", ia64_mca_disable_cpe_polling);  static struct irqaction cmci_irqaction = {  	.handler =	ia64_mca_cmc_int_handler, -	.flags =	IRQF_DISABLED,  	.name =		"cmc_hndlr"  };  static struct irqaction cmcp_irqaction = {  	.handler =	ia64_mca_cmc_int_caller, -	.flags =	IRQF_DISABLED,  	.name =		"cmc_poll"  };  static struct irqaction mca_rdzv_irqaction = {  	.handler =	ia64_mca_rendez_int_handler, -	.flags =	IRQF_DISABLED,  	.name =		"mca_rdzv"  };  static struct irqaction mca_wkup_irqaction = {  	.handler =	ia64_mca_wakeup_int_handler, -	.flags =	IRQF_DISABLED,  	.name =		"mca_wkup"  };  #ifdef CONFIG_ACPI  static struct irqaction mca_cpe_irqaction = {  	.handler =	ia64_mca_cpe_int_handler, -	.flags =	IRQF_DISABLED,  	.name =		"cpe_hndlr"  };  static struct irqaction mca_cpep_irqaction = {  	.handler =	ia64_mca_cpe_int_caller, -	.flags =	IRQF_DISABLED,  	.name =		"cpe_poll"  };  #endif /* CONFIG_ACPI */ @@ -1809,7 +1808,7 @@ static struct irqaction mca_cpep_irqaction = {   * format most of the fields.   */ -static void __cpuinit +static void  format_mca_init_stack(void *mca_data, unsigned long offset,  		const char *type, int cpu)  { @@ -1839,7 +1838,7 @@ static void * __init_refok mca_bootmem(void)  }  /* Do per-CPU MCA-related initialization.  */ -void __cpuinit +void  ia64_mca_cpu_init(void *cpu_data)  {  	void *pal_vaddr; @@ -1859,7 +1858,8 @@ ia64_mca_cpu_init(void *cpu_data)  			data = mca_bootmem();  			first_time = 0;  		} else -			data = __get_free_pages(GFP_KERNEL, get_order(sz)); +			data = (void *)__get_free_pages(GFP_KERNEL, +							get_order(sz));  		if (!data)  			panic("Could not allocate MCA memory for cpu %d\n",  					cpu); @@ -1890,7 +1890,7 @@ ia64_mca_cpu_init(void *cpu_data)  							      PAGE_KERNEL));  } -static void __cpuinit ia64_mca_cmc_vector_adjust(void *dummy) +static void ia64_mca_cmc_vector_adjust(void *dummy)  {  	unsigned long flags; @@ -1900,7 +1900,7 @@ static void __cpuinit ia64_mca_cmc_vector_adjust(void *dummy)  	local_irq_restore(flags);  } -static int __cpuinit mca_cpu_callback(struct notifier_block *nfb, +static int mca_cpu_callback(struct notifier_block *nfb,  				      unsigned long action,  				      void *hcpu)  { @@ -1916,7 +1916,7 @@ static int __cpuinit mca_cpu_callback(struct notifier_block *nfb,  	return NOTIFY_OK;  } -static struct notifier_block mca_cpu_notifier __cpuinitdata = { +static struct notifier_block mca_cpu_notifier = {  	.notifier_call = mca_cpu_callback  }; @@ -2068,22 +2068,16 @@ ia64_mca_init(void)  	printk(KERN_INFO "MCA related initialization done\n");  } +  /* - * ia64_mca_late_init - * - *	Opportunity to setup things that require initialization later - *	than ia64_mca_init.  Setup a timer to poll for CPEs if the - *	platform doesn't support an interrupt driven mechanism. - * - *  Inputs  :   None - *  Outputs :   Status + * These pieces cannot be done in ia64_mca_init() because it is called before + * early_irq_init() which would wipe out our percpu irq registrations. But we + * cannot leave them until ia64_mca_late_init() because by then all the other + * processors have been brought online and have set their own CMC vectors to + * point at a non-existant action. Called from arch_early_irq_init().   */ -static int __init -ia64_mca_late_init(void) +void __init ia64_mca_irq_init(void)  { -	if (!mca_init) -		return 0; -  	/*  	 *  Configure the CMCI/P vector and handler. Interrupts for CMC are  	 *  per-processor, so AP CMC interrupts are setup in smp_callin() (smpboot.c). @@ -2102,6 +2096,23 @@ ia64_mca_late_init(void)  	/* Setup the CPEI/P handler */  	register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction);  #endif +} + +/* + * ia64_mca_late_init + * + *	Opportunity to setup things that require initialization later + *	than ia64_mca_init.  Setup a timer to poll for CPEs if the + *	platform doesn't support an interrupt driven mechanism. + * + *  Inputs  :   None + *  Outputs :   Status + */ +static int __init +ia64_mca_late_init(void) +{ +	if (!mca_init) +		return 0;  	register_hotcpu_notifier(&mca_cpu_notifier); @@ -2122,7 +2133,6 @@ ia64_mca_late_init(void)  	cpe_poll_timer.function = ia64_mca_cpe_poll;  	{ -		struct irq_desc *desc;  		unsigned int irq;  		if (cpe_vector >= 0) { @@ -2130,8 +2140,7 @@ ia64_mca_late_init(void)  			irq = local_vector_to_irq(cpe_vector);  			if (irq > 0) {  				cpe_poll_enabled = 0; -				desc = irq_desc + irq; -				desc->status |= IRQ_PER_CPU; +				irq_set_status_flags(irq, IRQ_PER_CPU);  				setup_irq(irq, &mca_cpe_irqaction);  				ia64_cpe_irq = irq;  				ia64_mca_register_cpev(cpe_vector); diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c index 09b4d6828c4..94f8bf777af 100644 --- a/arch/ia64/kernel/mca_drv.c +++ b/arch/ia64/kernel/mca_drv.c @@ -28,7 +28,6 @@  #include <asm/machvec.h>  #include <asm/page.h>  #include <asm/ptrace.h> -#include <asm/system.h>  #include <asm/sal.h>  #include <asm/mca.h> @@ -159,7 +158,8 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)  	ia64_mlogbuf_dump();  	printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, "  		"iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", -	       raw_smp_processor_id(), current->pid, current_uid(), +	       raw_smp_processor_id(), current->pid, +		from_kuid(&init_user_ns, current_uid()),  		iip, ipsr, paddr, current->comm);  	spin_lock(&mca_bh_lock); @@ -349,7 +349,7 @@ init_record_index_pools(void)  	/* - 3 - */  	slidx_pool.max_idx = (rec_max_size/sect_min_size) * 2 + 1; -	slidx_pool.buffer = (slidx_list_t *) +	slidx_pool.buffer =  		kmalloc(slidx_pool.max_idx * sizeof(slidx_list_t), GFP_KERNEL);  	return slidx_pool.buffer ? 0 : -ENOMEM; diff --git a/arch/ia64/kernel/minstate.h b/arch/ia64/kernel/minstate.h index d56753a1163..cc82a7d744c 100644 --- a/arch/ia64/kernel/minstate.h +++ b/arch/ia64/kernel/minstate.h @@ -4,7 +4,7 @@  #include "entry.h"  #include "paravirt_inst.h" -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  /* read ar.itc in advance, and use it before leaving bank 0 */  #define ACCOUNT_GET_STAMP				\  (pUStk) mov.m r20=ar.itc; diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c index 1481b0a28ca..24603be24c1 100644 --- a/arch/ia64/kernel/module.c +++ b/arch/ia64/kernel/module.c @@ -304,14 +304,6 @@ plt_target (struct plt_entry *plt)  #endif /* !USE_BRL */ -void * -module_alloc (unsigned long size) -{ -	if (!size) -		return NULL; -	return vmalloc(size); -} -  void  module_free (struct module *mod, void *module_region)  { @@ -853,14 +845,6 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind  	return 0;  } -int -apply_relocate (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symindex, -		unsigned int relsec, struct module *mod) -{ -	printk(KERN_ERR "module %s: REL relocs in section %u unsupported\n", mod->name, relsec); -	return -ENOEXEC; -} -  /*   * Modules contain a single unwind table which covers both the core and the init text   * sections but since the two are not contiguous, we need to split this table up such that diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c index 00b19a416ea..c430f9198d1 100644 --- a/arch/ia64/kernel/msi_ia64.c +++ b/arch/ia64/kernel/msi_ia64.c @@ -12,15 +12,13 @@  static struct irq_chip	ia64_msi_chip;  #ifdef CONFIG_SMP -static int ia64_set_msi_irq_affinity(unsigned int irq, -				      const cpumask_t *cpu_mask) +static int ia64_set_msi_irq_affinity(struct irq_data *idata, +				     const cpumask_t *cpu_mask, bool force)  {  	struct msi_msg msg;  	u32 addr, data; -	int cpu = first_cpu(*cpu_mask); - -	if (!cpu_online(cpu)) -		return -1; +	int cpu = cpumask_first_and(cpu_mask, cpu_online_mask); +	unsigned int irq = idata->irq;  	if (irq_prepare_move(irq, cpu))  		return -1; @@ -38,7 +36,7 @@ static int ia64_set_msi_irq_affinity(unsigned int irq,  	msg.data = data;  	write_msi_msg(irq, &msg); -	cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu)); +	cpumask_copy(idata->affinity, cpumask_of(cpu));  	return 0;  } @@ -55,8 +53,8 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)  	if (irq < 0)  		return irq; -	set_irq_msi(irq, desc); -	cpus_and(mask, irq_to_domain(irq), cpu_online_map); +	irq_set_msi_desc(irq, desc); +	cpumask_and(&mask, &(irq_to_domain(irq)), cpu_online_mask);  	dest_phys_id = cpu_physical_id(first_cpu(mask));  	vector = irq_to_vector(irq); @@ -74,7 +72,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)  		MSI_DATA_VECTOR(vector);  	write_msi_msg(irq, &msg); -	set_irq_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq); +	irq_set_chip_and_handler(irq, &ia64_msi_chip, handle_edge_irq);  	return 0;  } @@ -84,16 +82,16 @@ void ia64_teardown_msi_irq(unsigned int irq)  	destroy_irq(irq);  } -static void ia64_ack_msi_irq(unsigned int irq) +static void ia64_ack_msi_irq(struct irq_data *data)  { -	irq_complete_move(irq); -	move_native_irq(irq); +	irq_complete_move(data->irq); +	irq_move_irq(data);  	ia64_eoi();  } -static int ia64_msi_retrigger_irq(unsigned int irq) +static int ia64_msi_retrigger_irq(struct irq_data *data)  { -	unsigned int vector = irq_to_vector(irq); +	unsigned int vector = irq_to_vector(data->irq);  	ia64_resend_irq(vector);  	return 1; @@ -103,14 +101,14 @@ static int ia64_msi_retrigger_irq(unsigned int irq)   * Generic ops used on most IA64 platforms.   */  static struct irq_chip ia64_msi_chip = { -	.name		= "PCI-MSI", -	.irq_mask	= mask_msi_irq, -	.irq_unmask	= unmask_msi_irq, -	.ack		= ia64_ack_msi_irq, +	.name			= "PCI-MSI", +	.irq_mask		= mask_msi_irq, +	.irq_unmask		= unmask_msi_irq, +	.irq_ack		= ia64_ack_msi_irq,  #ifdef CONFIG_SMP -	.set_affinity	= ia64_set_msi_irq_affinity, +	.irq_set_affinity	= ia64_set_msi_irq_affinity,  #endif -	.retrigger	= ia64_msi_retrigger_irq, +	.irq_retrigger		= ia64_msi_retrigger_irq,  }; @@ -130,16 +128,15 @@ void arch_teardown_msi_irq(unsigned int irq)  	return ia64_teardown_msi_irq(irq);  } -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU  #ifdef CONFIG_SMP -static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) +static int dmar_msi_set_affinity(struct irq_data *data, +				 const struct cpumask *mask, bool force)  { +	unsigned int irq = data->irq;  	struct irq_cfg *cfg = irq_cfg + irq;  	struct msi_msg msg; -	int cpu = cpumask_first(mask); - -	if (!cpu_online(cpu)) -		return -1; +	int cpu = cpumask_first_and(mask, cpu_online_mask);  	if (irq_prepare_move(irq, cpu))  		return -1; @@ -152,7 +149,7 @@ static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)  	msg.address_lo |= MSI_ADDR_DEST_ID_CPU(cpu_physical_id(cpu));  	dmar_msi_write(irq, &msg); -	cpumask_copy(irq_desc[irq].affinity, mask); +	cpumask_copy(data->affinity, mask);  	return 0;  } @@ -162,11 +159,11 @@ static struct irq_chip dmar_msi_type = {  	.name = "DMAR_MSI",  	.irq_unmask = dmar_msi_unmask,  	.irq_mask = dmar_msi_mask, -	.ack = ia64_ack_msi_irq, +	.irq_ack = ia64_ack_msi_irq,  #ifdef CONFIG_SMP -	.set_affinity = dmar_msi_set_affinity, +	.irq_set_affinity = dmar_msi_set_affinity,  #endif -	.retrigger = ia64_msi_retrigger_irq, +	.irq_retrigger = ia64_msi_retrigger_irq,  };  static int @@ -176,7 +173,7 @@ msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)  	unsigned dest;  	cpumask_t mask; -	cpus_and(mask, irq_to_domain(irq), cpu_online_map); +	cpumask_and(&mask, &(irq_to_domain(irq)), cpu_online_mask);  	dest = cpu_physical_id(first_cpu(mask));  	msg->address_hi = 0; @@ -203,9 +200,9 @@ int arch_setup_dmar_msi(unsigned int irq)  	if (ret < 0)  		return ret;  	dmar_msi_write(irq, &msg); -	set_irq_chip_and_handler_name(irq, &dmar_msi_type, handle_edge_irq, -		"edge"); +	irq_set_chip_and_handler_name(irq, &dmar_msi_type, handle_edge_irq, +				      "edge");  	return 0;  } -#endif /* CONFIG_DMAR */ +#endif /* CONFIG_INTEL_IOMMU */ diff --git a/arch/ia64/kernel/nr-irqs.c b/arch/ia64/kernel/nr-irqs.c index ee564575148..f6769cd54bd 100644 --- a/arch/ia64/kernel/nr-irqs.c +++ b/arch/ia64/kernel/nr-irqs.c @@ -10,15 +10,11 @@  #include <linux/kbuild.h>  #include <linux/threads.h>  #include <asm/native/irq.h> -#include <asm/xen/irq.h>  void foo(void)  {  	union paravirt_nr_irqs_max {  		char ia64_native_nr_irqs[IA64_NATIVE_NR_IRQS]; -#ifdef CONFIG_XEN -		char xen_nr_irqs[XEN_NR_IRQS]; -#endif  	};  	DEFINE(NR_IRQS, sizeof (union paravirt_nr_irqs_max)); diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c index c93420c9740..d288cde9360 100644 --- a/arch/ia64/kernel/numa.c +++ b/arch/ia64/kernel/numa.c @@ -30,7 +30,7 @@ EXPORT_SYMBOL(cpu_to_node_map);  cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;  EXPORT_SYMBOL(node_to_cpu_mask); -void __cpuinit map_cpu_to_node(int cpu, int nid) +void map_cpu_to_node(int cpu, int nid)  {  	int oldnid;  	if (nid < 0) { /* just initialize by zero */ @@ -51,7 +51,7 @@ void __cpuinit map_cpu_to_node(int cpu, int nid)  	return;  } -void __cpuinit unmap_cpu_from_node(int cpu, int nid) +void unmap_cpu_from_node(int cpu, int nid)  {  	WARN_ON(!cpu_isset(cpu, node_to_cpu_mask[nid]));  	WARN_ON(cpu_to_node_map[cpu] != nid); diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c index 77597e5ea60..c39c3cd3ac3 100644 --- a/arch/ia64/kernel/palinfo.c +++ b/arch/ia64/kernel/palinfo.c @@ -22,6 +22,7 @@  #include <linux/errno.h>  #include <linux/init.h>  #include <linux/proc_fs.h> +#include <linux/seq_file.h>  #include <linux/mm.h>  #include <linux/module.h>  #include <linux/efi.h> @@ -41,7 +42,7 @@ MODULE_LICENSE("GPL");  #define PALINFO_VERSION "0.5" -typedef int (*palinfo_func_t)(char*); +typedef int (*palinfo_func_t)(struct seq_file *);  typedef struct {  	const char		*name;		/* name of the proc entry */ @@ -54,7 +55,7 @@ typedef struct {   *  A bunch of string array to get pretty printing   */ -static char *cache_types[] = { +static const char *cache_types[] = {  	"",			/* not used */  	"Instruction",  	"Data", @@ -122,19 +123,16 @@ static const char *mem_attrib[]={   *	- a pointer to the end of the buffer   *   */ -static char * -bitvector_process(char *p, u64 vector) +static void bitvector_process(struct seq_file *m, u64 vector)  {  	int i,j; -	const char *units[]={ "", "K", "M", "G", "T" }; +	static const char *units[]={ "", "K", "M", "G", "T" };  	for (i=0, j=0; i < 64; i++ , j=i/10) { -		if (vector & 0x1) { -			p += sprintf(p, "%d%s ", 1 << (i-j*10), units[j]); -		} +		if (vector & 0x1) +			seq_printf(m, "%d%s ", 1 << (i-j*10), units[j]);  		vector >>= 1;  	} -	return p;  }  /* @@ -149,8 +147,7 @@ bitvector_process(char *p, u64 vector)   *	- a pointer to the end of the buffer   *   */ -static char * -bitregister_process(char *p, u64 *reg_info, int max) +static void bitregister_process(struct seq_file *m, u64 *reg_info, int max)  {  	int i, begin, skip = 0;  	u64 value = reg_info[0]; @@ -163,9 +160,9 @@ bitregister_process(char *p, u64 *reg_info, int max)  		if ((value & 0x1) == 0 && skip == 0) {  			if (begin  <= i - 2) -				p += sprintf(p, "%d-%d ", begin, i-1); +				seq_printf(m, "%d-%d ", begin, i-1);  			else -				p += sprintf(p, "%d ", i-1); +				seq_printf(m, "%d ", i-1);  			skip  = 1;  			begin = -1;  		} else if ((value & 0x1) && skip == 1) { @@ -176,19 +173,15 @@ bitregister_process(char *p, u64 *reg_info, int max)  	}  	if (begin > -1) {  		if (begin < 127) -			p += sprintf(p, "%d-127", begin); +			seq_printf(m, "%d-127", begin);  		else -			p += sprintf(p, "127"); +			seq_puts(m, "127");  	} - -	return p;  } -static int -power_info(char *page) +static int power_info(struct seq_file *m)  {  	s64 status; -	char *p = page;  	u64 halt_info_buffer[8];  	pal_power_mgmt_info_u_t *halt_info =(pal_power_mgmt_info_u_t *)halt_info_buffer;  	int i; @@ -198,26 +191,25 @@ power_info(char *page)  	for (i=0; i < 8 ; i++ ) {  		if (halt_info[i].pal_power_mgmt_info_s.im == 1) { -			p += sprintf(p,	"Power level %d:\n" -				     "\tentry_latency       : %d cycles\n" -				     "\texit_latency        : %d cycles\n" -				     "\tpower consumption   : %d mW\n" -				     "\tCache+TLB coherency : %s\n", i, -				     halt_info[i].pal_power_mgmt_info_s.entry_latency, -				     halt_info[i].pal_power_mgmt_info_s.exit_latency, -				     halt_info[i].pal_power_mgmt_info_s.power_consumption, -				     halt_info[i].pal_power_mgmt_info_s.co ? "Yes" : "No"); +			seq_printf(m, +				   "Power level %d:\n" +				   "\tentry_latency       : %d cycles\n" +				   "\texit_latency        : %d cycles\n" +				   "\tpower consumption   : %d mW\n" +				   "\tCache+TLB coherency : %s\n", i, +				   halt_info[i].pal_power_mgmt_info_s.entry_latency, +				   halt_info[i].pal_power_mgmt_info_s.exit_latency, +				   halt_info[i].pal_power_mgmt_info_s.power_consumption, +				   halt_info[i].pal_power_mgmt_info_s.co ? "Yes" : "No");  		} else { -			p += sprintf(p,"Power level %d: not implemented\n",i); +			seq_printf(m,"Power level %d: not implemented\n", i);  		}  	} -	return p - page; +	return 0;  } -static int -cache_info(char *page) +static int cache_info(struct seq_file *m)  { -	char *p = page;  	unsigned long i, levels, unique_caches;  	pal_cache_config_info_t cci;  	int j, k; @@ -228,73 +220,74 @@ cache_info(char *page)  		return 0;  	} -	p += sprintf(p, "Cache levels  : %ld\nUnique caches : %ld\n\n", levels, unique_caches); +	seq_printf(m, "Cache levels  : %ld\nUnique caches : %ld\n\n", +		   levels, unique_caches);  	for (i=0; i < levels; i++) { -  		for (j=2; j >0 ; j--) { -  			/* even without unification some level may not be present */ -			if ((status=ia64_pal_cache_config_info(i,j, &cci)) != 0) { +			if ((status=ia64_pal_cache_config_info(i,j, &cci)) != 0)  				continue; -			} -			p += sprintf(p, -				     "%s Cache level %lu:\n" -				     "\tSize           : %u bytes\n" -				     "\tAttributes     : ", -				     cache_types[j+cci.pcci_unified], i+1, -				     cci.pcci_cache_size); - -			if (cci.pcci_unified) p += sprintf(p, "Unified "); - -			p += sprintf(p, "%s\n", cache_mattrib[cci.pcci_cache_attr]); - -			p += sprintf(p, -				     "\tAssociativity  : %d\n" -				     "\tLine size      : %d bytes\n" -				     "\tStride         : %d bytes\n", -				     cci.pcci_assoc, 1<<cci.pcci_line_size, 1<<cci.pcci_stride); + +			seq_printf(m, +				   "%s Cache level %lu:\n" +				   "\tSize           : %u bytes\n" +				   "\tAttributes     : ", +				   cache_types[j+cci.pcci_unified], i+1, +				   cci.pcci_cache_size); + +			if (cci.pcci_unified) +				seq_puts(m, "Unified "); + +			seq_printf(m, "%s\n", cache_mattrib[cci.pcci_cache_attr]); + +			seq_printf(m, +				   "\tAssociativity  : %d\n" +				   "\tLine size      : %d bytes\n" +				   "\tStride         : %d bytes\n", +				   cci.pcci_assoc, +				   1<<cci.pcci_line_size, +				   1<<cci.pcci_stride);  			if (j == 1) -				p += sprintf(p, "\tStore latency  : N/A\n"); +				seq_puts(m, "\tStore latency  : N/A\n");  			else -				p += sprintf(p, "\tStore latency  : %d cycle(s)\n", -						cci.pcci_st_latency); +				seq_printf(m, "\tStore latency  : %d cycle(s)\n", +					   cci.pcci_st_latency); -			p += sprintf(p, -				     "\tLoad latency   : %d cycle(s)\n" -				     "\tStore hints    : ", cci.pcci_ld_latency); +			seq_printf(m, +				   "\tLoad latency   : %d cycle(s)\n" +				   "\tStore hints    : ", cci.pcci_ld_latency);  			for(k=0; k < 8; k++ ) {  				if ( cci.pcci_st_hints & 0x1) -					p += sprintf(p, "[%s]", cache_st_hints[k]); +					seq_printf(m, "[%s]", cache_st_hints[k]);  				cci.pcci_st_hints >>=1;  			} -			p += sprintf(p, "\n\tLoad hints     : "); +			seq_puts(m, "\n\tLoad hints     : ");  			for(k=0; k < 8; k++ ) {  				if (cci.pcci_ld_hints & 0x1) -					p += sprintf(p, "[%s]", cache_ld_hints[k]); +					seq_printf(m, "[%s]", cache_ld_hints[k]);  				cci.pcci_ld_hints >>=1;  			} -			p += sprintf(p, -				     "\n\tAlias boundary : %d byte(s)\n" -				     "\tTag LSB        : %d\n" -				     "\tTag MSB        : %d\n", -				     1<<cci.pcci_alias_boundary, cci.pcci_tag_lsb, -				     cci.pcci_tag_msb); +			seq_printf(m, +				   "\n\tAlias boundary : %d byte(s)\n" +				   "\tTag LSB        : %d\n" +				   "\tTag MSB        : %d\n", +				   1<<cci.pcci_alias_boundary, cci.pcci_tag_lsb, +				   cci.pcci_tag_msb);  			/* when unified, data(j=2) is enough */ -			if (cci.pcci_unified) break; +			if (cci.pcci_unified) +				break;  		}  	} -	return p - page; +	return 0;  } -static int -vm_info(char *page) +static int vm_info(struct seq_file *m)  { -	char *p = page;  	u64 tr_pages =0, vw_pages=0, tc_pages;  	u64 attrib;  	pal_vm_info_1_u_t vm_info_1; @@ -309,7 +302,7 @@ vm_info(char *page)  		printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status);  	} else { -		p += sprintf(p, +		seq_printf(m,  		     "Physical Address Space         : %d bits\n"  		     "Virtual Address Space          : %d bits\n"  		     "Protection Key Registers(PKR)  : %d\n" @@ -324,49 +317,49 @@ vm_info(char *page)  		     vm_info_1.pal_vm_info_1_s.hash_tag_id,  		     vm_info_2.pal_vm_info_2_s.rid_size);  		if (vm_info_2.pal_vm_info_2_s.max_purges == PAL_MAX_PURGES) -			p += sprintf(p, "unlimited\n"); +			seq_puts(m, "unlimited\n");  		else -			p += sprintf(p, "%d\n", +			seq_printf(m, "%d\n",  		     		vm_info_2.pal_vm_info_2_s.max_purges ?  				vm_info_2.pal_vm_info_2_s.max_purges : 1);  	}  	if (ia64_pal_mem_attrib(&attrib) == 0) { -		p += sprintf(p, "Supported memory attributes    : "); +		seq_puts(m, "Supported memory attributes    : ");  		sep = "";  		for (i = 0; i < 8; i++) {  			if (attrib & (1 << i)) { -				p += sprintf(p, "%s%s", sep, mem_attrib[i]); +				seq_printf(m, "%s%s", sep, mem_attrib[i]);  				sep = ", ";  			}  		} -		p += sprintf(p, "\n"); +		seq_putc(m, '\n');  	}  	if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) {  		printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status);  	} else { -		p += sprintf(p, -			     "\nTLB walker                     : %simplemented\n" -			     "Number of DTR                  : %d\n" -			     "Number of ITR                  : %d\n" -			     "TLB insertable page sizes      : ", -			     vm_info_1.pal_vm_info_1_s.vw ? "" : "not ", -			     vm_info_1.pal_vm_info_1_s.max_dtr_entry+1, -			     vm_info_1.pal_vm_info_1_s.max_itr_entry+1); +		seq_printf(m, +			   "\nTLB walker                     : %simplemented\n" +			   "Number of DTR                  : %d\n" +			   "Number of ITR                  : %d\n" +			   "TLB insertable page sizes      : ", +			   vm_info_1.pal_vm_info_1_s.vw ? "" : "not ", +			   vm_info_1.pal_vm_info_1_s.max_dtr_entry+1, +			   vm_info_1.pal_vm_info_1_s.max_itr_entry+1); +		bitvector_process(m, tr_pages); -		p = bitvector_process(p, tr_pages); +		seq_puts(m, "\nTLB purgeable page sizes       : "); -		p += sprintf(p, "\nTLB purgeable page sizes       : "); - -		p = bitvector_process(p, vw_pages); +		bitvector_process(m, vw_pages);  	} -	if ((status=ia64_get_ptce(&ptce)) != 0) { + +	if ((status = ia64_get_ptce(&ptce)) != 0) {  		printk(KERN_ERR "ia64_get_ptce=%ld\n", status);  	} else { -		p += sprintf(p, +		seq_printf(m,  		     "\nPurge base address             : 0x%016lx\n"  		     "Purge outer loop count         : %d\n"  		     "Purge inner loop count         : %d\n" @@ -375,7 +368,7 @@ vm_info(char *page)  		     ptce.base, ptce.count[0], ptce.count[1],  		     ptce.stride[0], ptce.stride[1]); -		p += sprintf(p, +		seq_printf(m,  		     "TC Levels                      : %d\n"  		     "Unique TC(s)                   : %d\n",  		     vm_info_1.pal_vm_info_1_s.num_tc_levels, @@ -385,13 +378,11 @@ vm_info(char *page)  			for (j=2; j>0 ; j--) {  				tc_pages = 0; /* just in case */ -  				/* even without unification, some levels may not be present */ -				if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0) { +				if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0)  					continue; -				} -				p += sprintf(p, +				seq_printf(m,  				     "\n%s Translation Cache Level %d:\n"  				     "\tHash sets           : %d\n"  				     "\tAssociativity       : %d\n" @@ -403,15 +394,15 @@ vm_info(char *page)  				     tc_info.tc_num_entries);  				if (tc_info.tc_pf) -					p += sprintf(p, "PreferredPageSizeOptimized "); +					seq_puts(m, "PreferredPageSizeOptimized ");  				if (tc_info.tc_unified) -					p += sprintf(p, "Unified "); +					seq_puts(m, "Unified ");  				if (tc_info.tc_reduce_tr) -					p += sprintf(p, "TCReduction"); +					seq_puts(m, "TCReduction"); -				p += sprintf(p, "\n\tSupported page sizes: "); +				seq_puts(m, "\n\tSupported page sizes: "); -				p = bitvector_process(p, tc_pages); +				bitvector_process(m, tc_pages);  				/* when unified date (j=2) is enough */  				if (tc_info.tc_unified) @@ -419,16 +410,14 @@ vm_info(char *page)  			}  		}  	} -	p += sprintf(p, "\n"); -	return p - page; +	seq_putc(m, '\n'); +	return 0;  } -static int -register_info(char *page) +static int register_info(struct seq_file *m)  { -	char *p = page;  	u64 reg_info[2];  	u64 info;  	unsigned long phys_stacked; @@ -442,35 +431,31 @@ register_info(char *page)  	};  	for(info=0; info < 4; info++) { - -		if (ia64_pal_register_info(info, ®_info[0], ®_info[1]) != 0) return 0; - -		p += sprintf(p, "%-32s : ", info_type[info]); - -		p = bitregister_process(p, reg_info, 128); - -		p += sprintf(p, "\n"); +		if (ia64_pal_register_info(info, ®_info[0], ®_info[1]) != 0) +			return 0; +		seq_printf(m, "%-32s : ", info_type[info]); +		bitregister_process(m, reg_info, 128); +		seq_putc(m, '\n');  	} -	if (ia64_pal_rse_info(&phys_stacked, &hints) == 0) { +	if (ia64_pal_rse_info(&phys_stacked, &hints) == 0) +		seq_printf(m, +			   "RSE stacked physical registers   : %ld\n" +			   "RSE load/store hints             : %ld (%s)\n", +			   phys_stacked, hints.ph_data, +			   hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)"); -	p += sprintf(p, -		     "RSE stacked physical registers   : %ld\n" -		     "RSE load/store hints             : %ld (%s)\n", -		     phys_stacked, hints.ph_data, -		     hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)"); -	}  	if (ia64_pal_debug_info(&iregs, &dregs))  		return 0; -	p += sprintf(p, -		     "Instruction debug register pairs : %ld\n" -		     "Data debug register pairs        : %ld\n", iregs, dregs); +	seq_printf(m, +		   "Instruction debug register pairs : %ld\n" +		   "Data debug register pairs        : %ld\n", iregs, dregs); -	return p - page; +	return 0;  } -static char *proc_features_0[]={		/* Feature set 0 */ +static const char *const proc_features_0[]={		/* Feature set 0 */  	NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,  	NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,  	NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, @@ -502,7 +487,7 @@ static char *proc_features_0[]={		/* Feature set 0 */  	"Enable BERR promotion"  }; -static char *proc_features_16[]={		/* Feature set 16 */ +static const char *const proc_features_16[]={		/* Feature set 16 */  	"Disable ETM",  	"Enable ETM",  	"Enable MCA on half-way timer", @@ -522,7 +507,7 @@ static char *proc_features_16[]={		/* Feature set 16 */  	NULL, NULL, NULL, NULL, NULL  }; -static char **proc_features[]={ +static const char *const *const proc_features[]={  	proc_features_0,  	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,  	NULL, NULL, NULL, NULL, @@ -530,11 +515,10 @@ static char **proc_features[]={  	NULL, NULL, NULL, NULL,  }; -static char * feature_set_info(char *page, u64 avail, u64 status, u64 control, -							unsigned long set) +static void feature_set_info(struct seq_file *m, u64 avail, u64 status, u64 control, +			     unsigned long set)  { -	char *p = page; -	char **vf, **v; +	const char *const *vf, *const *v;  	int i;  	vf = v = proc_features[set]; @@ -547,13 +531,13 @@ static char * feature_set_info(char *page, u64 avail, u64 status, u64 control,  		if (vf)  			v = vf + i;  		if ( v && *v ) { -			p += sprintf(p, "%-40s : %s %s\n", *v, +			seq_printf(m, "%-40s : %s %s\n", *v,  				avail & 0x1 ? (status & 0x1 ? -						"On " : "Off"): "", +					      "On " : "Off"): "",  				avail & 0x1 ? (control & 0x1 ?  						"Ctrl" : "NoCtrl"): "");  		} else { -			p += sprintf(p, "Feature set %2ld bit %2d\t\t\t" +			seq_printf(m, "Feature set %2ld bit %2d\t\t\t"  					" : %s %s\n",  				set, i,  				avail & 0x1 ? (status & 0x1 ? @@ -562,36 +546,32 @@ static char * feature_set_info(char *page, u64 avail, u64 status, u64 control,  						"Ctrl" : "NoCtrl"): "");  		}  	} -	return p;  } -static int -processor_info(char *page) +static int processor_info(struct seq_file *m)  { -	char *p = page;  	u64 avail=1, status=1, control=1, feature_set=0;  	s64 ret;  	do {  		ret = ia64_pal_proc_get_features(&avail, &status, &control,  						feature_set); -		if (ret < 0) { -			return p - page; -		} +		if (ret < 0) +			return 0; +  		if (ret == 1) {  			feature_set++;  			continue;  		} -		p = feature_set_info(p, avail, status, control, feature_set); - +		feature_set_info(m, avail, status, control, feature_set);  		feature_set++;  	} while(1); -	return p - page; +	return 0;  } -static const char *bus_features[]={ +static const char *const bus_features[]={  	NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,  	NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,  	NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, @@ -617,125 +597,118 @@ static const char *bus_features[]={  }; -static int -bus_info(char *page) +static int bus_info(struct seq_file *m)  { -	char *p = page; -	const char **v = bus_features; +	const char *const *v = bus_features;  	pal_bus_features_u_t av, st, ct;  	u64 avail, status, control;  	int i;  	s64 ret; -	if ((ret=ia64_pal_bus_get_features(&av, &st, &ct)) != 0) return 0; +	if ((ret=ia64_pal_bus_get_features(&av, &st, &ct)) != 0) +		return 0;  	avail   = av.pal_bus_features_val;  	status  = st.pal_bus_features_val;  	control = ct.pal_bus_features_val;  	for(i=0; i < 64; i++, v++, avail >>=1, status >>=1, control >>=1) { -		if ( ! *v ) continue; -		p += sprintf(p, "%-48s : %s%s %s\n", *v, -				avail & 0x1 ? "" : "NotImpl", -				avail & 0x1 ? (status  & 0x1 ? "On" : "Off"): "", -				avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): ""); +		if ( ! *v ) +			continue; +		seq_printf(m, "%-48s : %s%s %s\n", *v, +			   avail & 0x1 ? "" : "NotImpl", +			   avail & 0x1 ? (status  & 0x1 ? "On" : "Off"): "", +			   avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): "");  	} -	return p - page; +	return 0;  } -static int -version_info(char *page) +static int version_info(struct seq_file *m)  {  	pal_version_u_t min_ver, cur_ver; -	char *p = page;  	if (ia64_pal_version(&min_ver, &cur_ver) != 0)  		return 0; -	p += sprintf(p, -		     "PAL_vendor : 0x%02x (min=0x%02x)\n" -		     "PAL_A      : %02x.%02x (min=%02x.%02x)\n" -		     "PAL_B      : %02x.%02x (min=%02x.%02x)\n", -		     cur_ver.pal_version_s.pv_pal_vendor, -		     min_ver.pal_version_s.pv_pal_vendor, -		     cur_ver.pal_version_s.pv_pal_a_model, -		     cur_ver.pal_version_s.pv_pal_a_rev, -		     min_ver.pal_version_s.pv_pal_a_model, -		     min_ver.pal_version_s.pv_pal_a_rev, -		     cur_ver.pal_version_s.pv_pal_b_model, -		     cur_ver.pal_version_s.pv_pal_b_rev, -		     min_ver.pal_version_s.pv_pal_b_model, -		     min_ver.pal_version_s.pv_pal_b_rev); -	return p - page; +	seq_printf(m, +		   "PAL_vendor : 0x%02x (min=0x%02x)\n" +		   "PAL_A      : %02x.%02x (min=%02x.%02x)\n" +		   "PAL_B      : %02x.%02x (min=%02x.%02x)\n", +		   cur_ver.pal_version_s.pv_pal_vendor, +		   min_ver.pal_version_s.pv_pal_vendor, +		   cur_ver.pal_version_s.pv_pal_a_model, +		   cur_ver.pal_version_s.pv_pal_a_rev, +		   min_ver.pal_version_s.pv_pal_a_model, +		   min_ver.pal_version_s.pv_pal_a_rev, +		   cur_ver.pal_version_s.pv_pal_b_model, +		   cur_ver.pal_version_s.pv_pal_b_rev, +		   min_ver.pal_version_s.pv_pal_b_model, +		   min_ver.pal_version_s.pv_pal_b_rev); +	return 0;  } -static int -perfmon_info(char *page) +static int perfmon_info(struct seq_file *m)  { -	char *p = page;  	u64 pm_buffer[16];  	pal_perf_mon_info_u_t pm_info; -	if (ia64_pal_perf_mon_info(pm_buffer, &pm_info) != 0) return 0; - -	p += sprintf(p, -		     "PMC/PMD pairs                 : %d\n" -		     "Counter width                 : %d bits\n" -		     "Cycle event number            : %d\n" -		     "Retired event number          : %d\n" -		     "Implemented PMC               : ", -		     pm_info.pal_perf_mon_info_s.generic, pm_info.pal_perf_mon_info_s.width, -		     pm_info.pal_perf_mon_info_s.cycles, pm_info.pal_perf_mon_info_s.retired); +	if (ia64_pal_perf_mon_info(pm_buffer, &pm_info) != 0) +		return 0; -	p = bitregister_process(p, pm_buffer, 256); -	p += sprintf(p, "\nImplemented PMD               : "); -	p = bitregister_process(p, pm_buffer+4, 256); -	p += sprintf(p, "\nCycles count capable          : "); -	p = bitregister_process(p, pm_buffer+8, 256); -	p += sprintf(p, "\nRetired bundles count capable : "); +	seq_printf(m, +		   "PMC/PMD pairs                 : %d\n" +		   "Counter width                 : %d bits\n" +		   "Cycle event number            : %d\n" +		   "Retired event number          : %d\n" +		   "Implemented PMC               : ", +		   pm_info.pal_perf_mon_info_s.generic, +		   pm_info.pal_perf_mon_info_s.width, +		   pm_info.pal_perf_mon_info_s.cycles, +		   pm_info.pal_perf_mon_info_s.retired); + +	bitregister_process(m, pm_buffer, 256); +	seq_puts(m, "\nImplemented PMD               : "); +	bitregister_process(m, pm_buffer+4, 256); +	seq_puts(m, "\nCycles count capable          : "); +	bitregister_process(m, pm_buffer+8, 256); +	seq_puts(m, "\nRetired bundles count capable : ");  #ifdef CONFIG_ITANIUM  	/*  	 * PAL_PERF_MON_INFO reports that only PMC4 can be used to count CPU_CYCLES  	 * which is wrong, both PMC4 and PMD5 support it.  	 */ -	if (pm_buffer[12] == 0x10) pm_buffer[12]=0x30; +	if (pm_buffer[12] == 0x10) +		pm_buffer[12]=0x30;  #endif -	p = bitregister_process(p, pm_buffer+12, 256); - -	p += sprintf(p, "\n"); - -	return p - page; +	bitregister_process(m, pm_buffer+12, 256); +	seq_putc(m, '\n'); +	return 0;  } -static int -frequency_info(char *page) +static int frequency_info(struct seq_file *m)  { -	char *p = page;  	struct pal_freq_ratio proc, itc, bus;  	unsigned long base;  	if (ia64_pal_freq_base(&base) == -1) -		p += sprintf(p, "Output clock            : not implemented\n"); +		seq_puts(m, "Output clock            : not implemented\n");  	else -		p += sprintf(p, "Output clock            : %ld ticks/s\n", base); +		seq_printf(m, "Output clock            : %ld ticks/s\n", base);  	if (ia64_pal_freq_ratios(&proc, &bus, &itc) != 0) return 0; -	p += sprintf(p, +	seq_printf(m,  		     "Processor/Clock ratio   : %d/%d\n"  		     "Bus/Clock ratio         : %d/%d\n"  		     "ITC/Clock ratio         : %d/%d\n",  		     proc.num, proc.den, bus.num, bus.den, itc.num, itc.den); - -	return p - page; +	return 0;  } -static int -tr_info(char *page) +static int tr_info(struct seq_file *m)  { -	char *p = page;  	long status;  	pal_tr_valid_u_t tr_valid;  	u64 tr_buffer[4]; @@ -794,39 +767,40 @@ tr_info(char *page)  		ifa_reg  = (struct ifa_reg *)&tr_buffer[2]; -		if (ifa_reg->valid == 0) continue; +		if (ifa_reg->valid == 0) +			continue;  		gr_reg   = (struct gr_reg *)tr_buffer;  		itir_reg = (struct itir_reg *)&tr_buffer[1];  		rid_reg  = (struct rid_reg *)&tr_buffer[3];  		pgm	 = -1 << (itir_reg->ps - 12); -		p += sprintf(p, -			     "%cTR%lu: av=%d pv=%d dv=%d mv=%d\n" -			     "\tppn  : 0x%lx\n" -			     "\tvpn  : 0x%lx\n" -			     "\tps   : ", -			     "ID"[i], j, -			     tr_valid.pal_tr_valid_s.access_rights_valid, -			     tr_valid.pal_tr_valid_s.priv_level_valid, -			     tr_valid.pal_tr_valid_s.dirty_bit_valid, -			     tr_valid.pal_tr_valid_s.mem_attr_valid, -			     (gr_reg->ppn & pgm)<< 12, (ifa_reg->vpn & pgm)<< 12); - -		p = bitvector_process(p, 1<< itir_reg->ps); - -		p += sprintf(p, -			     "\n\tpl   : %d\n" -			     "\tar   : %d\n" -			     "\trid  : %x\n" -			     "\tp    : %d\n" -			     "\tma   : %d\n" -			     "\td    : %d\n", -			     gr_reg->pl, gr_reg->ar, rid_reg->rid, gr_reg->p, gr_reg->ma, -			     gr_reg->d); +		seq_printf(m, +			   "%cTR%lu: av=%d pv=%d dv=%d mv=%d\n" +			   "\tppn  : 0x%lx\n" +			   "\tvpn  : 0x%lx\n" +			   "\tps   : ", +			   "ID"[i], j, +			   tr_valid.pal_tr_valid_s.access_rights_valid, +			   tr_valid.pal_tr_valid_s.priv_level_valid, +			   tr_valid.pal_tr_valid_s.dirty_bit_valid, +			   tr_valid.pal_tr_valid_s.mem_attr_valid, +			   (gr_reg->ppn & pgm)<< 12, (ifa_reg->vpn & pgm)<< 12); + +		bitvector_process(m, 1<< itir_reg->ps); + +		seq_printf(m, +			   "\n\tpl   : %d\n" +			   "\tar   : %d\n" +			   "\trid  : %x\n" +			   "\tp    : %d\n" +			   "\tma   : %d\n" +			   "\td    : %d\n", +			   gr_reg->pl, gr_reg->ar, rid_reg->rid, gr_reg->p, gr_reg->ma, +			   gr_reg->d);  		}  	} -	return p - page; +	return 0;  } @@ -834,7 +808,7 @@ tr_info(char *page)  /*   * List {name,function} pairs for every entry in /proc/palinfo/cpu*   */ -static palinfo_entry_t palinfo_entries[]={ +static const palinfo_entry_t palinfo_entries[]={  	{ "version_info",	version_info, },  	{ "vm_info",		vm_info, },  	{ "cache_info",		cache_info, }, @@ -849,17 +823,6 @@ static palinfo_entry_t palinfo_entries[]={  #define NR_PALINFO_ENTRIES	(int) ARRAY_SIZE(palinfo_entries) -/* - * this array is used to keep track of the proc entries we create. This is - * required in the module mode when we need to remove all entries. The procfs code - * does not do recursion of deletion - * - * Notes: - *	- +1 accounts for the cpuN directory entry in /proc/pal - */ -#define NR_PALINFO_PROC_ENTRIES	(NR_CPUS*(NR_PALINFO_ENTRIES+1)) - -static struct proc_dir_entry *palinfo_proc_entries[NR_PALINFO_PROC_ENTRIES];  static struct proc_dir_entry *palinfo_dir;  /* @@ -887,7 +850,7 @@ typedef union {   */  typedef struct {  	palinfo_func_t	func;	/* pointer to function to call */ -	char		*page;	/* buffer to store results */ +	struct seq_file *m;	/* buffer to store results */  	int		ret;	/* return value from call */  } palinfo_smp_data_t; @@ -900,7 +863,7 @@ static void  palinfo_smp_call(void *info)  {  	palinfo_smp_data_t *data = (palinfo_smp_data_t *)info; -	data->ret = (*data->func)(data->page); +	data->ret = (*data->func)(data->m);  }  /* @@ -910,13 +873,13 @@ palinfo_smp_call(void *info)   *	otherwise how many bytes in the "page" buffer were written   */  static -int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page) +int palinfo_handle_smp(struct seq_file *m, pal_func_cpu_u_t *f)  {  	palinfo_smp_data_t ptr;  	int ret;  	ptr.func = palinfo_entries[f->func_id].proc_read; -	ptr.page = page; +	ptr.m = m;  	ptr.ret  = 0; /* just in case */ @@ -930,7 +893,7 @@ int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page)  }  #else /* ! CONFIG_SMP */  static -int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page) +int palinfo_handle_smp(struct seq_file *m, pal_func_cpu_u_t *f)  {  	printk(KERN_ERR "palinfo: should not be called with non SMP kernel\n");  	return 0; @@ -940,94 +903,66 @@ int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page)  /*   * Entry point routine: all calls go through this function   */ -static int -palinfo_read_entry(char *page, char **start, off_t off, int count, int *eof, void *data) +static int proc_palinfo_show(struct seq_file *m, void *v)  { -	int len=0; -	pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&data; +	pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&m->private;  	/*  	 * in SMP mode, we may need to call another CPU to get correct  	 * information. PAL, by definition, is processor specific  	 */  	if (f->req_cpu == get_cpu()) -		len = (*palinfo_entries[f->func_id].proc_read)(page); +		(*palinfo_entries[f->func_id].proc_read)(m);  	else -		len = palinfo_handle_smp(f, page); +		palinfo_handle_smp(m, f);  	put_cpu(); +	return 0; +} -	if (len <= off+count) *eof = 1; - -	*start = page + off; -	len   -= off; - -	if (len>count) len = count; -	if (len<0) len = 0; - -	return len; +static int proc_palinfo_open(struct inode *inode, struct file *file) +{ +	return single_open(file, proc_palinfo_show, PDE_DATA(inode));  } -static void __cpuinit +static const struct file_operations proc_palinfo_fops = { +	.open		= proc_palinfo_open, +	.read		= seq_read, +	.llseek		= seq_lseek, +	.release	= single_release, +}; + +static void  create_palinfo_proc_entries(unsigned int cpu)  { -#	define CPUSTR	"cpu%d" -  	pal_func_cpu_u_t f; -	struct proc_dir_entry **pdir;  	struct proc_dir_entry *cpu_dir;  	int j; -	char cpustr[sizeof(CPUSTR)]; - - -	/* -	 * we keep track of created entries in a depth-first order for -	 * cleanup purposes. Each entry is stored into palinfo_proc_entries -	 */ -	sprintf(cpustr,CPUSTR, cpu); +	char cpustr[3+4+1];	/* cpu numbers are up to 4095 on itanic */ +	sprintf(cpustr, "cpu%d", cpu);  	cpu_dir = proc_mkdir(cpustr, palinfo_dir); +	if (!cpu_dir) +		return;  	f.req_cpu = cpu; -	/* -	 * Compute the location to store per cpu entries -	 * We dont store the top level entry in this list, but -	 * remove it finally after removing all cpu entries. -	 */ -	pdir = &palinfo_proc_entries[cpu*(NR_PALINFO_ENTRIES+1)]; -	*pdir++ = cpu_dir;  	for (j=0; j < NR_PALINFO_ENTRIES; j++) {  		f.func_id = j; -		*pdir = create_proc_read_entry( -				palinfo_entries[j].name, 0, cpu_dir, -				palinfo_read_entry, (void *)f.value); -		pdir++; +		proc_create_data(palinfo_entries[j].name, 0, cpu_dir, +				 &proc_palinfo_fops, (void *)f.value);  	}  }  static void  remove_palinfo_proc_entries(unsigned int hcpu)  { -	int j; -	struct proc_dir_entry *cpu_dir, **pdir; - -	pdir = &palinfo_proc_entries[hcpu*(NR_PALINFO_ENTRIES+1)]; -	cpu_dir = *pdir; -	*pdir++=NULL; -	for (j=0; j < (NR_PALINFO_ENTRIES); j++) { -		if ((*pdir)) { -			remove_proc_entry ((*pdir)->name, cpu_dir); -			*pdir ++= NULL; -		} -	} - -	if (cpu_dir) { -		remove_proc_entry(cpu_dir->name, palinfo_dir); -	} +	char cpustr[3+4+1];	/* cpu numbers are up to 4095 on itanic */ +	sprintf(cpustr, "cpu%d", hcpu); +	remove_proc_subtree(cpustr, palinfo_dir);  } -static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb, +static int palinfo_cpu_callback(struct notifier_block *nfb,  					unsigned long action, void *hcpu)  {  	unsigned int hotcpu = (unsigned long)hcpu; @@ -1058,6 +993,10 @@ palinfo_init(void)  	printk(KERN_INFO "PAL Information Facility v%s\n", PALINFO_VERSION);  	palinfo_dir = proc_mkdir("pal", NULL); +	if (!palinfo_dir) +		return -ENOMEM; + +	cpu_notifier_register_begin();  	/* Create palinfo dirs in /proc for all online cpus */  	for_each_online_cpu(i) { @@ -1065,7 +1004,9 @@ palinfo_init(void)  	}  	/* Register for future delivery via notify registration */ -	register_hotcpu_notifier(&palinfo_cpu_notifier); +	__register_hotcpu_notifier(&palinfo_cpu_notifier); + +	cpu_notifier_register_done();  	return 0;  } @@ -1073,22 +1014,8 @@ palinfo_init(void)  static void __exit  palinfo_exit(void)  { -	int i = 0; - -	/* remove all nodes: depth first pass. Could optimize this  */ -	for_each_online_cpu(i) { -		remove_palinfo_proc_entries(i); -	} - -	/* -	 * Remove the top level entry finally -	 */ -	remove_proc_entry(palinfo_dir->name, NULL); - -	/* -	 * Unregister from cpu notifier callbacks -	 */  	unregister_hotcpu_notifier(&palinfo_cpu_notifier); +	remove_proc_subtree("pal", NULL);  }  module_init(palinfo_init); diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c index a21d7bb9c69..1b22f6de293 100644 --- a/arch/ia64/kernel/paravirt.c +++ b/arch/ia64/kernel/paravirt.c @@ -634,6 +634,8 @@ struct pv_irq_ops pv_irq_ops = {   * pv_time_ops   * time operations   */ +struct static_key paravirt_steal_enabled; +struct static_key paravirt_steal_rq_enabled;  static int  ia64_native_do_steal_accounting(unsigned long *new_itm) diff --git a/arch/ia64/kernel/paravirt_inst.h b/arch/ia64/kernel/paravirt_inst.h index 64d6d810c64..1ad7512b5f6 100644 --- a/arch/ia64/kernel/paravirt_inst.h +++ b/arch/ia64/kernel/paravirt_inst.h @@ -22,9 +22,6 @@  #ifdef __IA64_ASM_PARAVIRTUALIZED_PVCHECK  #include <asm/native/pvchk_inst.h> -#elif defined(__IA64_ASM_PARAVIRTUALIZED_XEN) -#include <asm/xen/inst.h> -#include <asm/xen/minstate.h>  #else  #include <asm/native/inst.h>  #endif diff --git a/arch/ia64/kernel/paravirt_patchlist.h b/arch/ia64/kernel/paravirt_patchlist.h index 0684aa6c650..67cffc3643a 100644 --- a/arch/ia64/kernel/paravirt_patchlist.h +++ b/arch/ia64/kernel/paravirt_patchlist.h @@ -20,9 +20,5 @@   *   */ -#if defined(__IA64_GATE_PARAVIRTUALIZED_XEN) -#include <asm/xen/patchlist.h> -#else  #include <asm/native/patchlist.h> -#endif diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c index 68a1311db80..1cf09179371 100644 --- a/arch/ia64/kernel/patch.c +++ b/arch/ia64/kernel/patch.c @@ -11,7 +11,6 @@  #include <asm/patch.h>  #include <asm/processor.h>  #include <asm/sections.h> -#include <asm/system.h>  #include <asm/unistd.h>  /* diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c index f6b1ff0aea7..992c1098c52 100644 --- a/arch/ia64/kernel/pci-dma.c +++ b/arch/ia64/kernel/pci-dma.c @@ -12,9 +12,8 @@  #include <asm/machvec.h>  #include <linux/dma-mapping.h> -#include <asm/system.h> -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU  #include <linux/kernel.h> @@ -34,15 +33,6 @@ int force_iommu __read_mostly;  int iommu_pass_through; -/* Dummy device used for NULL arguments (normally ISA). Better would -   be probably a smaller DMA mask, but this is bug-to-bug compatible -   to i386. */ -struct device fallback_dev = { -	.init_name = "fallback device", -	.coherent_dma_mask = DMA_BIT_MASK(32), -	.dma_mask = &fallback_dev.coherent_dma_mask, -}; -  extern struct dma_map_ops intel_dma_ops;  static int __init pci_iommu_init(void) diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c index d9485d952ed..939260aeac9 100644 --- a/arch/ia64/kernel/pci-swiotlb.c +++ b/arch/ia64/kernel/pci-swiotlb.c @@ -15,16 +15,24 @@ int swiotlb __read_mostly;  EXPORT_SYMBOL(swiotlb);  static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, -					 dma_addr_t *dma_handle, gfp_t gfp) +					 dma_addr_t *dma_handle, gfp_t gfp, +					 struct dma_attrs *attrs)  {  	if (dev->coherent_dma_mask != DMA_BIT_MASK(64))  		gfp |= GFP_DMA;  	return swiotlb_alloc_coherent(dev, size, dma_handle, gfp);  } +static void ia64_swiotlb_free_coherent(struct device *dev, size_t size, +				       void *vaddr, dma_addr_t dma_addr, +				       struct dma_attrs *attrs) +{ +	swiotlb_free_coherent(dev, size, vaddr, dma_addr); +} +  struct dma_map_ops swiotlb_dma_ops = { -	.alloc_coherent = ia64_swiotlb_alloc_coherent, -	.free_coherent = swiotlb_free_coherent, +	.alloc = ia64_swiotlb_alloc_coherent, +	.free = ia64_swiotlb_free_coherent,  	.map_page = swiotlb_map_page,  	.unmap_page = swiotlb_unmap_page,  	.map_sg = swiotlb_map_sg_attrs, diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 39e534f5a3b..5845ffea67c 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c @@ -42,6 +42,7 @@  #include <linux/completion.h>  #include <linux/tracehook.h>  #include <linux/slab.h> +#include <linux/cpu.h>  #include <asm/errno.h>  #include <asm/intrinsics.h> @@ -49,7 +50,6 @@  #include <asm/perfmon.h>  #include <asm/processor.h>  #include <asm/signal.h> -#include <asm/system.h>  #include <asm/uaccess.h>  #include <asm/delay.h> @@ -521,7 +521,7 @@ static pmu_config_t		*pmu_conf;  pfm_sysctl_t pfm_sysctl;  EXPORT_SYMBOL(pfm_sysctl); -static ctl_table pfm_ctl_table[]={ +static struct ctl_table pfm_ctl_table[] = {  	{  		.procname	= "debug",  		.data		= &pfm_sysctl.debug, @@ -552,7 +552,7 @@ static ctl_table pfm_ctl_table[]={  	},  	{}  }; -static ctl_table pfm_sysctl_dir[] = { +static struct ctl_table pfm_sysctl_dir[] = {  	{  		.procname	= "perfmon",  		.mode		= 0555, @@ -560,7 +560,7 @@ static ctl_table pfm_sysctl_dir[] = {  	},   	{}  }; -static ctl_table pfm_sysctl_root[] = { +static struct ctl_table pfm_sysctl_root[] = {  	{  		.procname	= "kernel",  		.mode		= 0555, @@ -605,23 +605,14 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)  	spin_unlock(&(x)->ctx_lock);  } -static inline unsigned int -pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct) -{ -	return do_munmap(mm, addr, len); -} - -static inline unsigned long  -pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) -{ -	return get_unmapped_area(file, addr, len, pgoff, flags); -} - +/* forward declaration */ +static const struct dentry_operations pfmfs_dentry_operations;  static struct dentry *  pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)  { -	return mount_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC); +	return mount_pseudo(fs_type, "pfm:", NULL, &pfmfs_dentry_operations, +			PFMFS_MAGIC);  }  static struct file_system_type pfm_fs_type = { @@ -629,6 +620,7 @@ static struct file_system_type pfm_fs_type = {  	.mount    = pfmfs_mount,  	.kill_sb  = kill_anon_super,  }; +MODULE_ALIAS_FS("pfmfs");  DEFINE_PER_CPU(unsigned long, pfm_syst_info);  DEFINE_PER_CPU(struct task_struct *, pmu_owner); @@ -829,10 +821,9 @@ pfm_rvmalloc(unsigned long size)  	unsigned long addr;  	size = PAGE_ALIGN(size); -	mem  = vmalloc(size); +	mem  = vzalloc(size);  	if (mem) {  		//printk("perfmon: CPU%d pfm_rvmalloc(%ld)=%p\n", smp_processor_id(), size, mem); -		memset(mem, 0, size);  		addr = (unsigned long)mem;  		while (size > 0) {  			pfm_reserve_page(addr); @@ -1332,8 +1323,6 @@ out:  }  EXPORT_SYMBOL(pfm_unregister_buffer_fmt); -extern void update_pal_halt_status(int); -  static int  pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)  { @@ -1381,9 +1370,9 @@ pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)  		cpu));  	/* -	 * disable default_idle() to go to PAL_HALT +	 * Force idle() into poll mode  	 */ -	update_pal_halt_status(0); +	cpu_idle_poll_ctrl(true);  	UNLOCK_PFS(flags); @@ -1440,11 +1429,8 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)  		is_syswide,  		cpu)); -	/* -	 * if possible, enable default_idle() to go into PAL_HALT -	 */ -	if (pfm_sessions.pfs_task_sessions == 0 && pfm_sessions.pfs_sys_sessions == 0) -		update_pal_halt_status(1); +	/* Undo forced polling. Last session reenables pal_halt */ +	cpu_idle_poll_ctrl(false);  	UNLOCK_PFS(flags); @@ -1457,8 +1443,9 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)   * a PROTECT_CTX() section.   */  static int -pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size) +pfm_remove_smpl_mapping(void *vaddr, unsigned long size)  { +	struct task_struct *task = current;  	int r;  	/* sanity checks */ @@ -1472,13 +1459,8 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz  	/*  	 * does the actual unmapping  	 */ -	down_write(&task->mm->mmap_sem); - -	DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size)); - -	r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0); +	r = vm_munmap((unsigned long)vaddr, size); -	up_write(&task->mm->mmap_sem);  	if (r !=0) {  		printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size);  	} @@ -1542,7 +1524,7 @@ pfm_exit_smpl_buffer(pfm_buffer_fmt_t *fmt)   * any operations on the root directory. However, we need a non-trivial   * d_name - pfm: will go nicely and kill the special-casing in procfs.   */ -static struct vfsmount *pfmfs_mnt; +static struct vfsmount *pfmfs_mnt __read_mostly;  static int __init  init_pfm_fs(void) @@ -1944,7 +1926,7 @@ pfm_flush(struct file *filp, fl_owner_t id)  	 * because some VM function reenables interrupts.  	 *  	 */ -	if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size); +	if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size);  	return 0;  } @@ -2184,12 +2166,6 @@ static const struct file_operations pfm_file_ops = {  	.flush		= pfm_flush  }; -static int -pfmfs_delete_dentry(struct dentry *dentry) -{ -	return 1; -} -  static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen)  {  	return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", @@ -2197,7 +2173,7 @@ static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen)  }  static const struct dentry_operations pfmfs_dentry_operations = { -	.d_delete = pfmfs_delete_dentry, +	.d_delete = always_delete_dentry,  	.d_dname = pfmfs_dname,  }; @@ -2226,20 +2202,19 @@ pfm_alloc_file(pfm_context_t *ctx)  	/*  	 * allocate a new dcache entry  	 */ -	path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this); +	path.dentry = d_alloc(pfmfs_mnt->mnt_root, &this);  	if (!path.dentry) {  		iput(inode);  		return ERR_PTR(-ENOMEM);  	}  	path.mnt = mntget(pfmfs_mnt); -	path.dentry->d_op = &pfmfs_dentry_operations;  	d_add(path.dentry, inode);  	file = alloc_file(&path, FMODE_READ, &pfm_file_ops); -	if (!file) { +	if (IS_ERR(file)) {  		path_put(&path); -		return ERR_PTR(-ENFILE); +		return file;  	}  	file->f_flags = O_RDONLY; @@ -2322,8 +2297,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t  	 * partially initialize the vma for the sampling buffer  	 */  	vma->vm_mm	     = mm; -	vma->vm_file	     = filp; -	vma->vm_flags	     = VM_READ| VM_MAYREAD |VM_RESERVED; +	vma->vm_file	     = get_file(filp); +	vma->vm_flags	     = VM_READ|VM_MAYREAD|VM_DONTEXPAND|VM_DONTDUMP;  	vma->vm_page_prot    = PAGE_READONLY; /* XXX may need to change */  	/* @@ -2343,8 +2318,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t  	down_write(&task->mm->mmap_sem);  	/* find some free area in address space, must have mmap sem held */ -	vma->vm_start = pfm_get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS, 0); -	if (vma->vm_start == 0UL) { +	vma->vm_start = get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS); +	if (IS_ERR_VALUE(vma->vm_start)) {  		DPRINT(("Cannot find unmapped area for size %ld\n", size));  		up_write(&task->mm->mmap_sem);  		goto error; @@ -2361,15 +2336,12 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t  		goto error;  	} -	get_file(filp); -  	/*  	 * now insert the vma in the vm list for the process, must be  	 * done with mmap lock held  	 */  	insert_vm_struct(mm, vma); -	mm->total_vm  += size >> PAGE_SHIFT;  	vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,  							vma_pages(vma));  	up_write(&task->mm->mmap_sem); @@ -2397,8 +2369,8 @@ static int  pfm_bad_permissions(struct task_struct *task)  {  	const struct cred *tcred; -	uid_t uid = current_uid(); -	gid_t gid = current_gid(); +	kuid_t uid = current_uid(); +	kgid_t gid = current_gid();  	int ret;  	rcu_read_lock(); @@ -2406,20 +2378,20 @@ pfm_bad_permissions(struct task_struct *task)  	/* inspired by ptrace_attach() */  	DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", -		uid, -		gid, -		tcred->euid, -		tcred->suid, -		tcred->uid, -		tcred->egid, -		tcred->sgid)); - -	ret = ((uid != tcred->euid) -	       || (uid != tcred->suid) -	       || (uid != tcred->uid) -	       || (gid != tcred->egid) -	       || (gid != tcred->sgid) -	       || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE); +		from_kuid(&init_user_ns, uid), +		from_kgid(&init_user_ns, gid), +		from_kuid(&init_user_ns, tcred->euid), +		from_kuid(&init_user_ns, tcred->suid), +		from_kuid(&init_user_ns, tcred->uid), +		from_kgid(&init_user_ns, tcred->egid), +		from_kgid(&init_user_ns, tcred->sgid))); + +	ret = ((!uid_eq(uid, tcred->euid)) +	       || (!uid_eq(uid, tcred->suid)) +	       || (!uid_eq(uid, tcred->uid)) +	       || (!gid_eq(gid, tcred->egid)) +	       || (!gid_eq(gid, tcred->sgid)) +	       || (!gid_eq(gid, tcred->gid))) && !capable(CAP_SYS_PTRACE);  	rcu_read_unlock();  	return ret; @@ -4799,7 +4771,7 @@ recheck:  asmlinkage long  sys_perfmonctl (int fd, int cmd, void __user *arg, int count)  { -	struct file *file = NULL; +	struct fd f = {NULL, 0};  	pfm_context_t *ctx = NULL;  	unsigned long flags = 0UL;  	void *args_k = NULL; @@ -4896,17 +4868,17 @@ restart_args:  	ret = -EBADF; -	file = fget(fd); -	if (unlikely(file == NULL)) { +	f = fdget(fd); +	if (unlikely(f.file == NULL)) {  		DPRINT(("invalid fd %d\n", fd));  		goto error_args;  	} -	if (unlikely(PFM_IS_FILE(file) == 0)) { +	if (unlikely(PFM_IS_FILE(f.file) == 0)) {  		DPRINT(("fd %d not related to perfmon\n", fd));  		goto error_args;  	} -	ctx = file->private_data; +	ctx = f.file->private_data;  	if (unlikely(ctx == NULL)) {  		DPRINT(("no context for fd %d\n", fd));  		goto error_args; @@ -4936,8 +4908,8 @@ abort_locked:  	if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT;  error_args: -	if (file) -		fput(file); +	if (f.file) +		fdput(f);  	kfree(args_k); @@ -5669,24 +5641,8 @@ pfm_proc_show_header(struct seq_file *m)  	list_for_each(pos, &pfm_buffer_fmt_list) {  		entry = list_entry(pos, pfm_buffer_fmt_t, fmt_list); -		seq_printf(m, "format                    : %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x %s\n", -			entry->fmt_uuid[0], -			entry->fmt_uuid[1], -			entry->fmt_uuid[2], -			entry->fmt_uuid[3], -			entry->fmt_uuid[4], -			entry->fmt_uuid[5], -			entry->fmt_uuid[6], -			entry->fmt_uuid[7], -			entry->fmt_uuid[8], -			entry->fmt_uuid[9], -			entry->fmt_uuid[10], -			entry->fmt_uuid[11], -			entry->fmt_uuid[12], -			entry->fmt_uuid[13], -			entry->fmt_uuid[14], -			entry->fmt_uuid[15], -			entry->fmt_name); +		seq_printf(m, "format                    : %16phD %s\n", +			   entry->fmt_uuid, entry->fmt_name);  	}  	spin_unlock(&pfm_buffer_fmt_lock); @@ -6431,7 +6387,6 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx)  static struct irqaction perfmon_irqaction = {  	.handler = pfm_interrupt_handler, -	.flags   = IRQF_DISABLED,  	.name    = "perfmon"  }; diff --git a/arch/ia64/kernel/perfmon_default_smpl.c b/arch/ia64/kernel/perfmon_default_smpl.c index 5f637bbfccc..30c644ea44c 100644 --- a/arch/ia64/kernel/perfmon_default_smpl.c +++ b/arch/ia64/kernel/perfmon_default_smpl.c @@ -150,7 +150,7 @@ default_handler(struct task_struct *task, void *buf, pfm_ovfl_arg_t *arg, struct  	 * current = task running at the time of the overflow.  	 *  	 * per-task mode: -	 * 	- this is ususally the task being monitored. +	 * 	- this is usually the task being monitored.  	 * 	  Under certain conditions, it might be a different task  	 *  	 * system-wide: diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 16f1c7b04c6..55d4ba47a90 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -29,6 +29,7 @@  #include <linux/kdebug.h>  #include <linux/utsname.h>  #include <linux/tracehook.h> +#include <linux/rcupdate.h>  #include <asm/cpu.h>  #include <asm/delay.h> @@ -38,6 +39,7 @@  #include <asm/pgalloc.h>  #include <asm/processor.h>  #include <asm/sal.h> +#include <asm/switch_to.h>  #include <asm/tlbflush.h>  #include <asm/uaccess.h>  #include <asm/unwind.h> @@ -53,14 +55,8 @@  void (*ia64_mark_idle)(int); -unsigned long boot_option_idle_override = 0; +unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;  EXPORT_SYMBOL(boot_option_idle_override); -unsigned long idle_halt; -EXPORT_SYMBOL(idle_halt); -unsigned long idle_nomwait; -EXPORT_SYMBOL(idle_nomwait); -void (*pm_idle) (void); -EXPORT_SYMBOL(pm_idle);  void (*pm_power_off) (void);  EXPORT_SYMBOL(pm_power_off); @@ -100,21 +96,13 @@ show_stack (struct task_struct *task, unsigned long *sp)  }  void -dump_stack (void) -{ -	show_stack(NULL, NULL); -} - -EXPORT_SYMBOL(dump_stack); - -void  show_regs (struct pt_regs *regs)  {  	unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;  	print_modules(); -	printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current), -			smp_processor_id(), current->comm); +	printk("\n"); +	show_regs_print_info(KERN_DEFAULT);  	printk("psr : %016lx ifs : %016lx ip  : [<%016lx>]    %s (%s)\n",  	       regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),  	       init_utsname()->release); @@ -199,11 +187,9 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)  		ia64_do_signal(scr, in_syscall);  	} -	if (test_thread_flag(TIF_NOTIFY_RESUME)) { -		clear_thread_flag(TIF_NOTIFY_RESUME); +	if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { +		local_irq_enable();	/* force interrupt enable */  		tracehook_notify_resume(&scr->pt); -		if (current->replacement_session_keyring) -			key_replace_session_keyring();  	}  	/* copy user rbs to kernel rbs */ @@ -215,41 +201,13 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)  	local_irq_disable();	/* force interrupt disable */  } -static int pal_halt        = 1; -static int can_do_pal_halt = 1; -  static int __init nohalt_setup(char * str)  { -	pal_halt = can_do_pal_halt = 0; +	cpu_idle_poll_ctrl(true);  	return 1;  }  __setup("nohalt", nohalt_setup); -void -update_pal_halt_status(int status) -{ -	can_do_pal_halt = pal_halt && status; -} - -/* - * We use this if we don't have any better idle routine.. - */ -void -default_idle (void) -{ -	local_irq_enable(); -	while (!need_resched()) { -		if (can_do_pal_halt) { -			local_irq_disable(); -			if (!need_resched()) { -				safe_halt(); -			} -			local_irq_enable(); -		} else -			cpu_relax(); -	} -} -  #ifdef CONFIG_HOTPLUG_CPU  /* We don't actually take CPU down, just spin without interrupts. */  static inline void play_dead(void) @@ -276,71 +234,29 @@ static inline void play_dead(void)  }  #endif /* CONFIG_HOTPLUG_CPU */ -static void do_nothing(void *unused) -{ -} - -/* - * cpu_idle_wait - Used to ensure that all the CPUs discard old value of - * pm_idle and update to new pm_idle value. Required while changing pm_idle - * handler on SMP systems. - * - * Caller must have changed pm_idle to the new value before the call. Old - * pm_idle value will not be used by any CPU after the return of this function. - */ -void cpu_idle_wait(void) +void arch_cpu_idle_dead(void)  { -	smp_mb(); -	/* kick all the CPUs so that they exit out of pm_idle */ -	smp_call_function(do_nothing, NULL, 1); +	play_dead();  } -EXPORT_SYMBOL_GPL(cpu_idle_wait); -void __attribute__((noreturn)) -cpu_idle (void) +void arch_cpu_idle(void)  {  	void (*mark_idle)(int) = ia64_mark_idle; -  	int cpu = smp_processor_id(); - -	/* endless idle loop with no priority at all */ -	while (1) { -		if (can_do_pal_halt) { -			current_thread_info()->status &= ~TS_POLLING; -			/* -			 * TS_POLLING-cleared state must be visible before we -			 * test NEED_RESCHED: -			 */ -			smp_mb(); -		} else { -			current_thread_info()->status |= TS_POLLING; -		} -		if (!need_resched()) { -			void (*idle)(void);  #ifdef CONFIG_SMP -			min_xtp(); +	min_xtp();  #endif -			rmb(); -			if (mark_idle) -				(*mark_idle)(1); - -			idle = pm_idle; -			if (!idle) -				idle = default_idle; -			(*idle)(); -			if (mark_idle) -				(*mark_idle)(0); +	rmb(); +	if (mark_idle) +		(*mark_idle)(1); + +	safe_halt(); + +	if (mark_idle) +		(*mark_idle)(0);  #ifdef CONFIG_SMP -			normal_xtp(); +	normal_xtp();  #endif -		} -		preempt_enable_no_resched(); -		schedule(); -		preempt_disable(); -		check_pgt_cache(); -		if (cpu_is_offline(cpu)) -			play_dead(); -	}  }  void @@ -417,72 +333,24 @@ ia64_load_extra (struct task_struct *task)  int  copy_thread(unsigned long clone_flags,  	     unsigned long user_stack_base, unsigned long user_stack_size, -	     struct task_struct *p, struct pt_regs *regs) +	     struct task_struct *p)  {  	extern char ia64_ret_from_clone;  	struct switch_stack *child_stack, *stack;  	unsigned long rbs, child_rbs, rbs_size;  	struct pt_regs *child_ptregs; +	struct pt_regs *regs = current_pt_regs();  	int retval = 0; -#ifdef CONFIG_SMP -	/* -	 * For SMP idle threads, fork_by_hand() calls do_fork with -	 * NULL regs. -	 */ -	if (!regs) -		return 0; -#endif - -	stack = ((struct switch_stack *) regs) - 1; -  	child_ptregs = (struct pt_regs *) ((unsigned long) p + IA64_STK_OFFSET) - 1;  	child_stack = (struct switch_stack *) child_ptregs - 1; -	/* copy parent's switch_stack & pt_regs to child: */ -	memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack)); -  	rbs = (unsigned long) current + IA64_RBS_OFFSET;  	child_rbs = (unsigned long) p + IA64_RBS_OFFSET; -	rbs_size = stack->ar_bspstore - rbs; - -	/* copy the parent's register backing store to the child: */ -	memcpy((void *) child_rbs, (void *) rbs, rbs_size); - -	if (likely(user_mode(child_ptregs))) { -		if (clone_flags & CLONE_SETTLS) -			child_ptregs->r13 = regs->r16;	/* see sys_clone2() in entry.S */ -		if (user_stack_base) { -			child_ptregs->r12 = user_stack_base + user_stack_size - 16; -			child_ptregs->ar_bspstore = user_stack_base; -			child_ptregs->ar_rnat = 0; -			child_ptregs->loadrs = 0; -		} -	} else { -		/* -		 * Note: we simply preserve the relative position of -		 * the stack pointer here.  There is no need to -		 * allocate a scratch area here, since that will have -		 * been taken care of by the caller of sys_clone() -		 * already. -		 */ -		child_ptregs->r12 = (unsigned long) child_ptregs - 16; /* kernel sp */ -		child_ptregs->r13 = (unsigned long) p;		/* set `current' pointer */ -	} -	child_stack->ar_bspstore = child_rbs + rbs_size; -	child_stack->b0 = (unsigned long) &ia64_ret_from_clone;  	/* copy parts of thread_struct: */  	p->thread.ksp = (unsigned long) child_stack - 16; -	/* stop some PSR bits from being inherited. -	 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve() -	 * therefore we must specify them explicitly here and not include them in -	 * IA64_PSR_BITS_TO_CLEAR. -	 */ -	child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET) -				 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP)); -  	/*  	 * NOTE: The calling convention considers all floating point  	 * registers in the high partition (fph) to be scratch.  Since @@ -504,8 +372,66 @@ copy_thread(unsigned long clone_flags,  #	define THREAD_FLAGS_TO_SET	0  	p->thread.flags = ((current->thread.flags & ~THREAD_FLAGS_TO_CLEAR)  			   | THREAD_FLAGS_TO_SET); +  	ia64_drop_fpu(p);	/* don't pick up stale state from a CPU's fph */ +	if (unlikely(p->flags & PF_KTHREAD)) { +		if (unlikely(!user_stack_base)) { +			/* fork_idle() called us */ +			return 0; +		} +		memset(child_stack, 0, sizeof(*child_ptregs) + sizeof(*child_stack)); +		child_stack->r4 = user_stack_base;	/* payload */ +		child_stack->r5 = user_stack_size;	/* argument */ +		/* +		 * Preserve PSR bits, except for bits 32-34 and 37-45, +		 * which we can't read. +		 */ +		child_ptregs->cr_ipsr = ia64_getreg(_IA64_REG_PSR) | IA64_PSR_BN; +		/* mark as valid, empty frame */ +		child_ptregs->cr_ifs = 1UL << 63; +		child_stack->ar_fpsr = child_ptregs->ar_fpsr +			= ia64_getreg(_IA64_REG_AR_FPSR); +		child_stack->pr = (1 << PRED_KERNEL_STACK); +		child_stack->ar_bspstore = child_rbs; +		child_stack->b0 = (unsigned long) &ia64_ret_from_clone; + +		/* stop some PSR bits from being inherited. +		 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve() +		 * therefore we must specify them explicitly here and not include them in +		 * IA64_PSR_BITS_TO_CLEAR. +		 */ +		child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET) +				 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP)); + +		return 0; +	} +	stack = ((struct switch_stack *) regs) - 1; +	/* copy parent's switch_stack & pt_regs to child: */ +	memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack)); + +	/* copy the parent's register backing store to the child: */ +	rbs_size = stack->ar_bspstore - rbs; +	memcpy((void *) child_rbs, (void *) rbs, rbs_size); +	if (clone_flags & CLONE_SETTLS) +		child_ptregs->r13 = regs->r16;	/* see sys_clone2() in entry.S */ +	if (user_stack_base) { +		child_ptregs->r12 = user_stack_base + user_stack_size - 16; +		child_ptregs->ar_bspstore = user_stack_base; +		child_ptregs->ar_rnat = 0; +		child_ptregs->loadrs = 0; +	} +	child_stack->ar_bspstore = child_rbs + rbs_size; +	child_stack->b0 = (unsigned long) &ia64_ret_from_clone; + +	/* stop some PSR bits from being inherited. +	 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve() +	 * therefore we must specify them explicitly here and not include them in +	 * IA64_PSR_BITS_TO_CLEAR. +	 */ +	child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET) +				 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP)); +  #ifdef CONFIG_PERFMON  	if (current->thread.pfm_context)  		pfm_inherit(p, child_ptregs); @@ -632,57 +558,6 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst)  	return 1;	/* f0-f31 are always valid so we always return 1 */  } -long -sys_execve (const char __user *filename, -	    const char __user *const __user *argv, -	    const char __user *const __user *envp, -	    struct pt_regs *regs) -{ -	char *fname; -	int error; - -	fname = getname(filename); -	error = PTR_ERR(fname); -	if (IS_ERR(fname)) -		goto out; -	error = do_execve(fname, argv, envp, regs); -	putname(fname); -out: -	return error; -} - -pid_t -kernel_thread (int (*fn)(void *), void *arg, unsigned long flags) -{ -	extern void start_kernel_thread (void); -	unsigned long *helper_fptr = (unsigned long *) &start_kernel_thread; -	struct { -		struct switch_stack sw; -		struct pt_regs pt; -	} regs; - -	memset(®s, 0, sizeof(regs)); -	regs.pt.cr_iip = helper_fptr[0];	/* set entry point (IP) */ -	regs.pt.r1 = helper_fptr[1];		/* set GP */ -	regs.pt.r9 = (unsigned long) fn;	/* 1st argument */ -	regs.pt.r11 = (unsigned long) arg;	/* 2nd argument */ -	/* Preserve PSR bits, except for bits 32-34 and 37-45, which we can't read.  */ -	regs.pt.cr_ipsr = ia64_getreg(_IA64_REG_PSR) | IA64_PSR_BN; -	regs.pt.cr_ifs = 1UL << 63;		/* mark as valid, empty frame */ -	regs.sw.ar_fpsr = regs.pt.ar_fpsr = ia64_getreg(_IA64_REG_AR_FPSR); -	regs.sw.ar_bspstore = (unsigned long) current + IA64_RBS_OFFSET; -	regs.sw.pr = (1 << PRED_KERNEL_STACK); -	return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s.pt, 0, NULL, NULL); -} -EXPORT_SYMBOL(kernel_thread); - -/* This gets called from kernel_thread() via ia64_invoke_thread_helper().  */ -int -kernel_thread_helper (int (*fn)(void *), void *arg) -{ -	return (*fn)(arg); -} -  /*   * Flush thread state.  This is called when a thread does an execve().   */ diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 8848f43d819..b7a5fffe092 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c @@ -26,7 +26,6 @@  #include <asm/processor.h>  #include <asm/ptrace_offsets.h>  #include <asm/rse.h> -#include <asm/system.h>  #include <asm/uaccess.h>  #include <asm/unwind.h>  #ifdef CONFIG_PERFMON @@ -673,33 +672,6 @@ ptrace_attach_sync_user_rbs (struct task_struct *child)  	read_unlock(&tasklist_lock);  } -static inline int -thread_matches (struct task_struct *thread, unsigned long addr) -{ -	unsigned long thread_rbs_end; -	struct pt_regs *thread_regs; - -	if (ptrace_check_attach(thread, 0) < 0) -		/* -		 * If the thread is not in an attachable state, we'll -		 * ignore it.  The net effect is that if ADDR happens -		 * to overlap with the portion of the thread's -		 * register backing store that is currently residing -		 * on the thread's kernel stack, then ptrace() may end -		 * up accessing a stale value.  But if the thread -		 * isn't stopped, that's a problem anyhow, so we're -		 * doing as well as we can... -		 */ -		return 0; - -	thread_regs = task_pt_regs(thread); -	thread_rbs_end = ia64_get_user_rbs_end(thread, thread_regs, NULL); -	if (!on_kernel_rbs(addr, thread_regs->ar_bspstore, thread_rbs_end)) -		return 0; - -	return 1;	/* looks like we've got a winner */ -} -  /*   * Write f32-f127 back to task->thread.fph if it has been modified.   */ @@ -1246,15 +1218,8 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,  	if (test_thread_flag(TIF_RESTORE_RSE))  		ia64_sync_krbs(); -	if (unlikely(current->audit_context)) { -		long syscall; -		int arch; -		syscall = regs.r15; -		arch = AUDIT_ARCH_IA64; - -		audit_syscall_entry(arch, syscall, arg0, arg1, arg2, arg3); -	} +	audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3);  	return 0;  } @@ -1268,14 +1233,7 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,  {  	int step; -	if (unlikely(current->audit_context)) { -		int success = AUDITSC_RESULT(regs.r10); -		long result = regs.r8; - -		if (success != AUDITSC_SUCCESS) -			result = -result; -		audit_syscall_exit(success, result); -	} +	audit_syscall_exit(®s);  	step = test_thread_flag(TIF_SINGLESTEP);  	if (step || test_thread_flag(TIF_SYSCALL_TRACE)) diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c index 79802e540e5..ee9719eebb1 100644 --- a/arch/ia64/kernel/salinfo.c +++ b/arch/ia64/kernel/salinfo.c @@ -40,6 +40,7 @@  #include <linux/cpu.h>  #include <linux/types.h>  #include <linux/proc_fs.h> +#include <linux/seq_file.h>  #include <linux/module.h>  #include <linux/smp.h>  #include <linux/timer.h> @@ -53,7 +54,7 @@ MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>");  MODULE_DESCRIPTION("/proc interface to IA-64 SAL features");  MODULE_LICENSE("GPL"); -static int salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data); +static const struct file_operations proc_salinfo_fops;  typedef struct {  	const char		*name;		/* name of the proc entry */ @@ -65,7 +66,7 @@ typedef struct {   * List {name,feature} pairs for every entry in /proc/sal/<feature>   * that this module exports   */ -static salinfo_entry_t salinfo_entries[]={ +static const salinfo_entry_t salinfo_entries[]={  	{ "bus_lock",           IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, },  	{ "irq_redirection",	IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, },  	{ "ipi_redirection",	IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, }, @@ -301,9 +302,7 @@ salinfo_event_open(struct inode *inode, struct file *file)  static ssize_t  salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)  { -	struct inode *inode = file->f_path.dentry->d_inode; -	struct proc_dir_entry *entry = PDE(inode); -	struct salinfo_data *data = entry->data; +	struct salinfo_data *data = PDE_DATA(file_inode(file));  	char cmd[32];  	size_t size;  	int i, n, cpu = -1; @@ -360,8 +359,7 @@ static const struct file_operations salinfo_event_fops = {  static int  salinfo_log_open(struct inode *inode, struct file *file)  { -	struct proc_dir_entry *entry = PDE(inode); -	struct salinfo_data *data = entry->data; +	struct salinfo_data *data = PDE_DATA(inode);  	if (!capable(CAP_SYS_ADMIN))  		return -EPERM; @@ -386,8 +384,7 @@ salinfo_log_open(struct inode *inode, struct file *file)  static int  salinfo_log_release(struct inode *inode, struct file *file)  { -	struct proc_dir_entry *entry = PDE(inode); -	struct salinfo_data *data = entry->data; +	struct salinfo_data *data = PDE_DATA(inode);  	if (data->state == STATE_NO_DATA) {  		vfree(data->log_buffer); @@ -463,9 +460,7 @@ retry:  static ssize_t  salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)  { -	struct inode *inode = file->f_path.dentry->d_inode; -	struct proc_dir_entry *entry = PDE(inode); -	struct salinfo_data *data = entry->data; +	struct salinfo_data *data = PDE_DATA(file_inode(file));  	u8 *buf;  	u64 bufsize; @@ -524,9 +519,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu)  static ssize_t  salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)  { -	struct inode *inode = file->f_path.dentry->d_inode; -	struct proc_dir_entry *entry = PDE(inode); -	struct salinfo_data *data = entry->data; +	struct salinfo_data *data = PDE_DATA(file_inode(file));  	char cmd[32];  	size_t size;  	u32 offset; @@ -575,7 +568,7 @@ static const struct file_operations salinfo_data_fops = {  	.llseek  = default_llseek,  }; -static int __cpuinit +static int  salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)  {  	unsigned int i, cpu = (unsigned long)hcpu; @@ -616,7 +609,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu  	return NOTIFY_OK;  } -static struct notifier_block salinfo_cpu_notifier __cpuinitdata = +static struct notifier_block salinfo_cpu_notifier =  {  	.notifier_call = salinfo_cpu_callback,  	.priority = 0, @@ -637,10 +630,13 @@ salinfo_init(void)  	for (i=0; i < NR_SALINFO_ENTRIES; i++) {  		/* pass the feature bit in question as misc data */ -		*sdir++ = create_proc_read_entry (salinfo_entries[i].name, 0, salinfo_dir, -						  salinfo_read, (void *)salinfo_entries[i].feature); +		*sdir++ = proc_create_data(salinfo_entries[i].name, 0, salinfo_dir, +					   &proc_salinfo_fops, +					   (void *)salinfo_entries[i].feature);  	} +	cpu_notifier_register_begin(); +  	for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {  		data = salinfo_data + i;  		data->type = i; @@ -675,7 +671,9 @@ salinfo_init(void)  	salinfo_timer.function = &salinfo_timeout;  	add_timer(&salinfo_timer); -	register_hotcpu_notifier(&salinfo_cpu_notifier); +	__register_hotcpu_notifier(&salinfo_cpu_notifier); + +	cpu_notifier_register_done();  	return 0;  } @@ -684,22 +682,23 @@ salinfo_init(void)   * 'data' contains an integer that corresponds to the feature we're   * testing   */ -static int -salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data) +static int proc_salinfo_show(struct seq_file *m, void *v)  { -	int len = 0; - -	len = sprintf(page, (sal_platform_features & (unsigned long)data) ? "1\n" : "0\n"); - -	if (len <= off+count) *eof = 1; - -	*start = page + off; -	len   -= off; - -	if (len>count) len = count; -	if (len<0) len = 0; +	unsigned long data = (unsigned long)v; +	seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n"); +	return 0; +} -	return len; +static int proc_salinfo_open(struct inode *inode, struct file *file) +{ +	return single_open(file, proc_salinfo_show, PDE_DATA(inode));  } +static const struct file_operations proc_salinfo_fops = { +	.open		= proc_salinfo_open, +	.read		= seq_read, +	.llseek		= seq_lseek, +	.release	= single_release, +}; +  module_init(salinfo_init); diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 911cf974970..d86669bcdfb 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -59,7 +59,6 @@  #include <asm/sections.h>  #include <asm/setup.h>  #include <asm/smp.h> -#include <asm/system.h>  #include <asm/tlbflush.h>  #include <asm/unistd.h>  #include <asm/hpsim.h> @@ -220,6 +219,23 @@ sort_regions (struct rsvd_region *rsvd_region, int max)  	}  } +/* merge overlaps */ +static int __init +merge_regions (struct rsvd_region *rsvd_region, int max) +{ +	int i; +	for (i = 1; i < max; ++i) { +		if (rsvd_region[i].start >= rsvd_region[i-1].end) +			continue; +		if (rsvd_region[i].end > rsvd_region[i-1].end) +			rsvd_region[i-1].end = rsvd_region[i].end; +		--max; +		memmove(&rsvd_region[i], &rsvd_region[i+1], +			(max - i) * sizeof(struct rsvd_region)); +	} +	return max; +} +  /*   * Request address space for all standard resources   */ @@ -270,6 +286,7 @@ static void __init setup_crashkernel(unsigned long total, int *n)  	if (ret == 0 && size > 0) {  		if (!base) {  			sort_regions(rsvd_region, *n); +			*n = merge_regions(rsvd_region, *n);  			base = kdump_find_rsvd_region(size,  					rsvd_region, *n);  		} @@ -373,6 +390,7 @@ reserve_memory (void)  	BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n);  	sort_regions(rsvd_region, num_rsvd_regions); +	num_rsvd_regions = merge_regions(rsvd_region, num_rsvd_regions);  } @@ -467,7 +485,7 @@ mark_bsp_online (void)  {  #ifdef CONFIG_SMP  	/* If we register an early console, allow CPU 0 to printk */ -	cpu_set(smp_processor_id(), cpu_online_map); +	set_cpu_online(smp_processor_id(), true);  #endif  } @@ -479,25 +497,7 @@ static __init int setup_nomca(char *s)  }  early_param("nomca", setup_nomca); -/* - * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by - * is_kdump_kernel() to determine if we are booting after a panic. Hence - * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE. - */  #ifdef CONFIG_CRASH_DUMP -/* elfcorehdr= specifies the location of elf core header - * stored by the crashed kernel. - */ -static int __init parse_elfcorehdr(char *arg) -{ -	if (!arg) -		return -EINVAL; - -        elfcorehdr_addr = memparse(arg, &arg); -	return 0; -} -early_param("elfcorehdr", parse_elfcorehdr); -  int __init reserve_elfcorehdr(u64 *start, u64 *end)  {  	u64 length; @@ -748,7 +748,7 @@ const struct seq_operations cpuinfo_op = {  #define MAX_BRANDS	8  static char brandname[MAX_BRANDS][128]; -static char * __cpuinit +static char *  get_model_name(__u8 family, __u8 model)  {  	static int overflow; @@ -778,7 +778,7 @@ get_model_name(__u8 family, __u8 model)  	return "Unknown";  } -static void __cpuinit +static void  identify_cpu (struct cpuinfo_ia64 *c)  {  	union { @@ -850,7 +850,7 @@ identify_cpu (struct cpuinfo_ia64 *c)   * 2. the minimum of the i-cache stride sizes for "flush_icache_range()".   * 3. the minimum of the cache stride sizes for "clflush_cache_range()".   */ -static void __cpuinit +static void  get_cache_info(void)  {  	unsigned long line_size, max = 1; @@ -915,10 +915,10 @@ get_cache_info(void)   * cpu_init() initializes state that is per-CPU.  This function acts   * as a 'CPU state barrier', nothing should get across.   */ -void __cpuinit +void  cpu_init (void)  { -	extern void __cpuinit ia64_mmu_init (void *); +	extern void ia64_mmu_init(void *);  	static unsigned long max_num_phys_stacked = IA64_NUM_PHYS_STACK_REG;  	unsigned long num_phys_stacked;  	pal_vm_info_2_u_t vmi; @@ -1051,7 +1051,6 @@ cpu_init (void)  		max_num_phys_stacked = num_phys_stacked;  	}  	platform_cpu_init(); -	pm_idle = default_idle;  }  void __init @@ -1064,6 +1063,8 @@ check_bugs (void)  static int __init run_dmi_scan(void)  {  	dmi_scan_machine(); +	dmi_memdev_walk(); +	dmi_set_dump_stack_arch_desc();  	return 0;  }  core_initcall(run_dmi_scan); diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c index 7bdafc8788b..33cab9a8adf 100644 --- a/arch/ia64/kernel/signal.c +++ b/arch/ia64/kernel/signal.c @@ -30,7 +30,6 @@  #define DEBUG_SIG	0  #define STACK_ALIGN	16		/* minimal alignment for stack pointer */ -#define _BLOCKABLE	(~(sigmask(SIGKILL) | sigmask(SIGSTOP)))  #if _NSIG_WORDS > 1  # define PUT_SIGSET(k,u)	__copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) @@ -40,14 +39,6 @@  # define GET_SIGSET(k,u)	__get_user((k)->sig[0], &(u)->sig[0])  #endif -asmlinkage long -sys_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, long arg2, -		 long arg3, long arg4, long arg5, long arg6, long arg7, -		 struct pt_regs regs) -{ -	return do_sigaltstack(uss, uoss, regs.r12); -} -  static long  restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)  { @@ -114,7 +105,7 @@ restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)  }  int -copy_siginfo_to_user (siginfo_t __user *to, siginfo_t *from) +copy_siginfo_to_user (siginfo_t __user *to, const siginfo_t *from)  {  	if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t)))  		return -EFAULT; @@ -200,14 +191,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)  	if (GET_SIGSET(&set, &sc->sc_mask))  		goto give_sigsegv; -	sigdelsetmask(&set, ~_BLOCKABLE); - -	spin_lock_irq(¤t->sighand->siglock); -	{ -		current->blocked = set; -		recalc_sigpending(); -	} -	spin_unlock_irq(¤t->sighand->siglock); +	set_current_blocked(&set);  	if (restore_sigcontext(sc, scr))  		goto give_sigsegv; @@ -216,11 +200,8 @@ ia64_rt_sigreturn (struct sigscratch *scr)  	printk("SIG return (%s:%d): sp=%lx ip=%lx\n",  	       current->comm, current->pid, scr->pt.r12, scr->pt.cr_iip);  #endif -	/* -	 * It is more difficult to avoid calling this function than to -	 * call it and ignore errors. -	 */ -	do_sigaltstack(&sc->sc_stack, NULL, scr->pt.r12); +	if (restore_altstack(&sc->sc_stack)) +		goto give_sigsegv;  	return retval;    give_sigsegv: @@ -228,7 +209,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)  	si.si_errno = 0;  	si.si_code = SI_KERNEL;  	si.si_pid = task_pid_vnr(current); -	si.si_uid = current_uid(); +	si.si_uid = from_kuid_munged(current_user_ns(), current_uid());  	si.si_addr = sc;  	force_sig_info(SIGSEGV, &si, current);  	return retval; @@ -325,7 +306,7 @@ force_sigsegv_info (int sig, void __user *addr)  	si.si_errno = 0;  	si.si_code = SI_KERNEL;  	si.si_pid = task_pid_vnr(current); -	si.si_uid = current_uid(); +	si.si_uid = from_kuid_munged(current_user_ns(), current_uid());  	si.si_addr = addr;  	force_sig_info(SIGSEGV, &si, current);  	return 0; @@ -384,9 +365,7 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,  	err |= copy_siginfo_to_user(&frame->info, info); -	err |= __put_user(current->sas_ss_sp, &frame->sc.sc_stack.ss_sp); -	err |= __put_user(current->sas_ss_size, &frame->sc.sc_stack.ss_size); -	err |= __put_user(sas_ss_flags(scr->pt.r12), &frame->sc.sc_stack.ss_flags); +	err |= __save_altstack(&frame->sc.sc_stack, scr->pt.r12);  	err |= setup_sigcontext(&frame->sc, set, scr);  	if (unlikely(err)) @@ -421,23 +400,13 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,  }  static long -handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *oldset, +handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info,  	       struct sigscratch *scr)  { -	if (!setup_frame(sig, ka, info, oldset, scr)) +	if (!setup_frame(sig, ka, info, sigmask_to_save(), scr))  		return 0; -	spin_lock_irq(¤t->sighand->siglock); -	sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); -	if (!(ka->sa.sa_flags & SA_NODEFER)) -		sigaddset(¤t->blocked, sig); -	recalc_sigpending(); -	spin_unlock_irq(¤t->sighand->siglock); - -	/* -	 * Let tracing know that we've done the handler setup. -	 */ -	tracehook_signal_handler(sig, info, ka, &scr->pt, +	signal_delivered(sig, info, ka, &scr->pt,  				 test_thread_flag(TIF_SINGLESTEP));  	return 1; @@ -451,25 +420,11 @@ void  ia64_do_signal (struct sigscratch *scr, long in_syscall)  {  	struct k_sigaction ka; -	sigset_t *oldset;  	siginfo_t info;  	long restart = in_syscall;  	long errno = scr->pt.r8;  	/* -	 * In the ia64_leave_kernel code path, we want the common case to go fast, which -	 * is why we may in certain cases get here from kernel mode. Just return without -	 * doing anything if so. -	 */ -	if (!user_mode(&scr->pt)) -		return; - -	if (current_thread_info()->status & TS_RESTORE_SIGMASK) -		oldset = ¤t->saved_sigmask; -	else -		oldset = ¤t->blocked; - -	/*  	 * This only loops in the rare cases of handle_signal() failing, in which case we  	 * need to push through a forced SIGSEGV.  	 */ @@ -518,16 +473,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)  		 * Whee!  Actually deliver the signal.  If the delivery failed, we need to  		 * continue to iterate in this loop so we can deliver the SIGSEGV...  		 */ -		if (handle_signal(signr, &ka, &info, oldset, scr)) { -			/* -			 * A signal was successfully delivered; the saved -			 * sigmask will have been stored in the signal frame, -			 * and will be restored by sigreturn, so we can simply -			 * clear the TS_RESTORE_SIGMASK flag. -			 */ -			current_thread_info()->status &= ~TS_RESTORE_SIGMASK; +		if (handle_signal(signr, &ka, &info, scr))  			return; -		}  	}  	/* Did we come from a system call? */ @@ -549,8 +496,5 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)  	/* if there's no signal to deliver, we just put the saved sigmask  	 * back */ -	if (current_thread_info()->status & TS_RESTORE_SIGMASK) { -		current_thread_info()->status &= ~TS_RESTORE_SIGMASK; -		sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); -	} +	restore_saved_sigmask();  } diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c index dabeefe2113..9fcd4e63048 100644 --- a/arch/ia64/kernel/smp.c +++ b/arch/ia64/kernel/smp.c @@ -32,7 +32,7 @@  #include <linux/bitops.h>  #include <linux/kexec.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/current.h>  #include <asm/delay.h>  #include <asm/machvec.h> @@ -44,7 +44,6 @@  #include <asm/processor.h>  #include <asm/ptrace.h>  #include <asm/sal.h> -#include <asm/system.h>  #include <asm/tlbflush.h>  #include <asm/unistd.h>  #include <asm/mca.h> @@ -77,7 +76,7 @@ stop_this_cpu(void)  	/*  	 * Remove this CPU:  	 */ -	cpu_clear(smp_processor_id(), cpu_online_map); +	set_cpu_online(smp_processor_id(), false);  	max_xtp();  	local_irq_disable();  	cpu_halt(); @@ -293,6 +292,7 @@ smp_flush_tlb_all (void)  void  smp_flush_tlb_mm (struct mm_struct *mm)  { +	cpumask_var_t cpus;  	preempt_disable();  	/* this happens for the common case of a single-threaded fork():  */  	if (likely(mm == current->active_mm && atomic_read(&mm->mm_users) == 1)) @@ -301,9 +301,15 @@ smp_flush_tlb_mm (struct mm_struct *mm)  		preempt_enable();  		return;  	} - -	smp_call_function_many(mm_cpumask(mm), -		(void (*)(void *))local_finish_flush_tlb_mm, mm, 1); +	if (!alloc_cpumask_var(&cpus, GFP_ATOMIC)) { +		smp_call_function((void (*)(void *))local_finish_flush_tlb_mm, +			mm, 1); +	} else { +		cpumask_copy(cpus, mm_cpumask(mm)); +		smp_call_function_many(cpus, +			(void (*)(void *))local_finish_flush_tlb_mm, mm, 1); +		free_cpumask_var(cpus); +	}  	local_irq_disable();  	local_finish_flush_tlb_mm(mm);  	local_irq_enable(); diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index d003b502a43..547a48d78bd 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c @@ -40,7 +40,7 @@  #include <linux/percpu.h>  #include <linux/bitops.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/cache.h>  #include <asm/current.h>  #include <asm/delay.h> @@ -55,7 +55,6 @@  #include <asm/processor.h>  #include <asm/ptrace.h>  #include <asm/sal.h> -#include <asm/system.h>  #include <asm/tlbflush.h>  #include <asm/unistd.h>  #include <asm/sn/arch.h> @@ -76,13 +75,6 @@  #endif  /* - * Store all idle threads, this can be reused instead of creating - * a new thread. Also avoids complicated thread destroy functionality - * for idle threads. - */ -struct task_struct *idle_thread_array[NR_CPUS]; - -/*   * Global array allocated for NR_CPUS at boot time   */  struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; @@ -95,13 +87,7 @@ struct sal_to_os_boot *sal_state_for_booting_cpu = &sal_boot_rendez_state[0];  #define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); -#define get_idle_for_cpu(x)		(idle_thread_array[(x)]) -#define set_idle_for_cpu(x,p)	(idle_thread_array[(x)] = (p)) -  #else - -#define get_idle_for_cpu(x)		(NULL) -#define set_idle_for_cpu(x,p)  #define set_brendez_area(x)  #endif @@ -361,12 +347,11 @@ ia64_sync_itc (unsigned int master)  /*   * Ideally sets up per-cpu profiling hooks.  Doesn't do much now...   */ -static inline void __devinit -smp_setup_percpu_timer (void) +static inline void smp_setup_percpu_timer(void)  {  } -static void __cpuinit +static void  smp_callin (void)  {  	int cpuid, phys_id, itc_master; @@ -396,15 +381,13 @@ smp_callin (void)  	set_numa_node(cpu_to_node_map[cpuid]);  	set_numa_mem(local_memory_node(cpu_to_node_map[cpuid])); -	ipi_call_lock_irq();  	spin_lock(&vector_lock);  	/* Setup the per cpu irq handling data structures */  	__setup_vector_irq(cpuid);  	notify_cpu_starting(cpuid); -	cpu_set(cpuid, cpu_online_map); +	set_cpu_online(cpuid, true);  	per_cpu(cpu_state, cpuid) = CPU_ONLINE;  	spin_unlock(&vector_lock); -	ipi_call_unlock_irq();  	smp_setup_percpu_timer(); @@ -459,7 +442,7 @@ smp_callin (void)  /*   * Activate a secondary processor.  head.S calls this.   */ -int __cpuinit +int  start_secondary (void *unused)  {  	/* Early console may use I/O ports */ @@ -472,63 +455,16 @@ start_secondary (void *unused)  	preempt_disable();  	smp_callin(); -	cpu_idle(); +	cpu_startup_entry(CPUHP_ONLINE);  	return 0;  } -struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs) -{ -	return NULL; -} - -struct create_idle { -	struct work_struct work; -	struct task_struct *idle; -	struct completion done; -	int cpu; -}; - -void __cpuinit -do_fork_idle(struct work_struct *work) -{ -	struct create_idle *c_idle = -		container_of(work, struct create_idle, work); - -	c_idle->idle = fork_idle(c_idle->cpu); -	complete(&c_idle->done); -} - -static int __cpuinit -do_boot_cpu (int sapicid, int cpu) +static int +do_boot_cpu (int sapicid, int cpu, struct task_struct *idle)  {  	int timeout; -	struct create_idle c_idle = { -		.work = __WORK_INITIALIZER(c_idle.work, do_fork_idle), -		.cpu	= cpu, -		.done	= COMPLETION_INITIALIZER(c_idle.done), -	}; - -	/* -	 * We can't use kernel_thread since we must avoid to -	 * reschedule the child. -	 */ - 	c_idle.idle = get_idle_for_cpu(cpu); - 	if (c_idle.idle) { -		init_idle(c_idle.idle, cpu); - 		goto do_rest; -	} - -	schedule_work(&c_idle.work); -	wait_for_completion(&c_idle.done); - -	if (IS_ERR(c_idle.idle)) -		panic("failed fork for CPU %d", cpu); - -	set_idle_for_cpu(cpu, c_idle.idle); - -do_rest: -	task_for_booting_cpu = c_idle.idle; +	task_for_booting_cpu = idle;  	Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);  	set_brendez_area(cpu); @@ -548,7 +484,7 @@ do_rest:  	if (!cpu_isset(cpu, cpu_callin_map)) {  		printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid);  		ia64_cpu_to_sapicid[cpu] = -1; -		cpu_clear(cpu, cpu_online_map);  /* was set in smp_callin() */ +		set_cpu_online(cpu, false);  /* was set in smp_callin() */  		return -EINVAL;  	}  	return 0; @@ -578,8 +514,7 @@ smp_build_cpu_map (void)  	}  	ia64_cpu_to_sapicid[0] = boot_cpu_id; -	cpus_clear(cpu_present_map); -	set_cpu_present(0, true); +	init_cpu_present(cpumask_of(0));  	set_cpu_possible(0, true);  	for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) {  		sapicid = smp_boot_data.cpu_phys_id[i]; @@ -606,10 +541,6 @@ smp_prepare_cpus (unsigned int max_cpus)  	smp_setup_percpu_timer(); -	/* -	 * We have the boot CPU online for sure. -	 */ -	cpu_set(0, cpu_online_map);  	cpu_set(0, cpu_callin_map);  	local_cpu_data->loops_per_jiffy = loops_per_jiffy; @@ -631,9 +562,9 @@ smp_prepare_cpus (unsigned int max_cpus)  	}  } -void __devinit smp_prepare_boot_cpu(void) +void smp_prepare_boot_cpu(void)  { -	cpu_set(smp_processor_id(), cpu_online_map); +	set_cpu_online(smp_processor_id(), true);  	cpu_set(smp_processor_id(), cpu_callin_map);  	set_numa_node(cpu_to_node_map[smp_processor_id()]);  	per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; @@ -677,7 +608,7 @@ extern void fixup_irqs(void);  int migrate_platform_irqs(unsigned int cpu)  {  	int new_cpei_cpu; -	struct irq_desc *desc = NULL; +	struct irq_data *data = NULL;  	const struct cpumask *mask;  	int 		retval = 0; @@ -690,23 +621,23 @@ int migrate_platform_irqs(unsigned int cpu)  			/*  			 * Now re-target the CPEI to a different processor  			 */ -			new_cpei_cpu = any_online_cpu(cpu_online_map); +			new_cpei_cpu = cpumask_any(cpu_online_mask);  			mask = cpumask_of(new_cpei_cpu);  			set_cpei_target_cpu(new_cpei_cpu); -			desc = irq_desc + ia64_cpe_irq; +			data = irq_get_irq_data(ia64_cpe_irq);  			/*  			 * Switch for now, immediately, we need to do fake intr  			 * as other interrupts, but need to study CPEI behaviour with  			 * polling before making changes.  			 */ -			if (desc) { -				desc->chip->disable(ia64_cpe_irq); -				desc->chip->set_affinity(ia64_cpe_irq, mask); -				desc->chip->enable(ia64_cpe_irq); -				printk ("Re-targetting CPEI to cpu %d\n", new_cpei_cpu); +			if (data && data->chip) { +				data->chip->irq_disable(data); +				data->chip->irq_set_affinity(data, mask, false); +				data->chip->irq_enable(data); +				printk ("Re-targeting CPEI to cpu %d\n", new_cpei_cpu);  			}  		} -		if (!desc) { +		if (!data) {  			printk ("Unable to retarget CPEI, offline cpu [%d] failed\n", cpu);  			retval = -EBUSY;  		} @@ -732,10 +663,10 @@ int __cpu_disable(void)  			return -EBUSY;  	} -	cpu_clear(cpu, cpu_online_map); +	set_cpu_online(cpu, false);  	if (migrate_platform_irqs(cpu)) { -		cpu_set(cpu, cpu_online_map); +		set_cpu_online(cpu, true);  		return -EBUSY;  	} @@ -781,8 +712,7 @@ smp_cpus_done (unsigned int dummy)  	       (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100);  } -static inline void __devinit -set_cpu_sibling_map(int cpu) +static inline void set_cpu_sibling_map(int cpu)  {  	int i; @@ -798,8 +728,8 @@ set_cpu_sibling_map(int cpu)  	}  } -int __cpuinit -__cpu_up (unsigned int cpu) +int +__cpu_up(unsigned int cpu, struct task_struct *tidle)  {  	int ret;  	int sapicid; @@ -817,7 +747,7 @@ __cpu_up (unsigned int cpu)  	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;  	/* Processor goes to start_secondary(), sets online flag */ -	ret = do_boot_cpu(sapicid, cpu); +	ret = do_boot_cpu(sapicid, cpu, tidle);  	if (ret < 0)  		return ret; @@ -861,8 +791,7 @@ init_smp_config(void)   * identify_siblings(cpu) gets called from identify_cpu. This populates the    * information related to logical execution units in per_cpu_data structure.   */ -void __devinit -identify_siblings(struct cpuinfo_ia64 *c) +void identify_siblings(struct cpuinfo_ia64 *c)  {  	long status;  	u16 pltid; diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index 609d50056a6..41e33f84c18 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c @@ -25,9 +25,9 @@ arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len  			unsigned long pgoff, unsigned long flags)  {  	long map_shared = (flags & MAP_SHARED); -	unsigned long start_addr, align_mask = PAGE_SIZE - 1; +	unsigned long align_mask = 0;  	struct mm_struct *mm = current->mm; -	struct vm_area_struct *vma; +	struct vm_unmapped_area_info info;  	if (len > RGN_MAP_LIMIT)  		return -ENOMEM; @@ -44,7 +44,7 @@ arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len  		addr = 0;  #endif  	if (!addr) -		addr = mm->free_area_cache; +		addr = TASK_UNMAPPED_BASE;  	if (map_shared && (TASK_SIZE > 0xfffffffful))  		/* @@ -53,28 +53,15 @@ arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len  		 * tasks, we prefer to avoid exhausting the address space too quickly by  		 * limiting alignment to a single page.  		 */ -		align_mask = SHMLBA - 1; - -  full_search: -	start_addr = addr = (addr + align_mask) & ~align_mask; - -	for (vma = find_vma(mm, addr); ; vma = vma->vm_next) { -		/* At this point:  (!vma || addr < vma->vm_end). */ -		if (TASK_SIZE - len < addr || RGN_MAP_LIMIT - len < REGION_OFFSET(addr)) { -			if (start_addr != TASK_UNMAPPED_BASE) { -				/* Start a new search --- just in case we missed some holes.  */ -				addr = TASK_UNMAPPED_BASE; -				goto full_search; -			} -			return -ENOMEM; -		} -		if (!vma || addr + len <= vma->vm_start) { -			/* Remember the address where we stopped this search:  */ -			mm->free_area_cache = addr + len; -			return addr; -		} -		addr = (vma->vm_end + align_mask) & ~align_mask; -	} +		align_mask = PAGE_MASK & (SHMLBA - 1); + +	info.flags = 0; +	info.length = len; +	info.low_limit = addr; +	info.high_limit = TASK_SIZE; +	info.align_mask = align_mask; +	info.align_offset = 0; +	return vm_unmapped_area(&info);  }  asmlinkage long @@ -171,22 +158,9 @@ asmlinkage unsigned long  ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags,  	     unsigned long new_addr)  { -	extern unsigned long do_mremap (unsigned long addr, -					unsigned long old_len, -					unsigned long new_len, -					unsigned long flags, -					unsigned long new_addr); - -	down_write(¤t->mm->mmap_sem); -	{ -		addr = do_mremap(addr, old_len, new_len, flags, new_addr); -	} -	up_write(¤t->mm->mmap_sem); - -	if (IS_ERR((void *) addr)) -		return addr; - -	force_successful_syscall_return(); +	addr = sys_mremap(addr, old_len, new_len, flags, new_addr); +	if (!IS_ERR((void *) addr)) +		force_successful_syscall_return();  	return addr;  } diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index ed6f22eb5b1..71c52bc7c28 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c @@ -19,7 +19,7 @@  #include <linux/interrupt.h>  #include <linux/efi.h>  #include <linux/timex.h> -#include <linux/clocksource.h> +#include <linux/timekeeper_internal.h>  #include <linux/platform_device.h>  #include <asm/machvec.h> @@ -29,15 +29,12 @@  #include <asm/ptrace.h>  #include <asm/sal.h>  #include <asm/sections.h> -#include <asm/system.h>  #include "fsyscall_gtod_data.h"  static cycle_t itc_get_cycles(struct clocksource *cs); -struct fsyscall_gtod_data_t fsyscall_gtod_data = { -	.lock = SEQLOCK_UNLOCKED, -}; +struct fsyscall_gtod_data_t fsyscall_gtod_data;  struct itc_jitter_data_t itc_jitter_data; @@ -73,8 +70,6 @@ static struct clocksource clocksource_itc = {  	.rating         = 350,  	.read           = itc_get_cycles,  	.mask           = CLOCKSOURCE_MASK(64), -	.mult           = 0, /*to be calculated*/ -	.shift          = 16,  	.flags          = CLOCK_SOURCE_IS_CONTINUOUS,  #ifdef CONFIG_PARAVIRT  	.resume		= paravirt_clocksource_resume, @@ -82,38 +77,35 @@ static struct clocksource clocksource_itc = {  };  static struct clocksource *itc_clocksource; -#ifdef CONFIG_VIRT_CPU_ACCOUNTING +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  #include <linux/kernel_stat.h>  extern cputime_t cycle_to_cputime(u64 cyc); +void vtime_account_user(struct task_struct *tsk) +{ +	cputime_t delta_utime; +	struct thread_info *ti = task_thread_info(tsk); + +	if (ti->ac_utime) { +		delta_utime = cycle_to_cputime(ti->ac_utime); +		account_user_time(tsk, delta_utime, delta_utime); +		ti->ac_utime = 0; +	} +} +  /*   * Called from the context switch with interrupts disabled, to charge all   * accumulated times to the current process, and to prepare accounting on   * the next process.   */ -void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next) +void arch_vtime_task_switch(struct task_struct *prev)  {  	struct thread_info *pi = task_thread_info(prev); -	struct thread_info *ni = task_thread_info(next); -	cputime_t delta_stime, delta_utime; -	__u64 now; - -	now = ia64_get_itc(); - -	delta_stime = cycle_to_cputime(pi->ac_stime + (now - pi->ac_stamp)); -	if (idle_task(smp_processor_id()) != prev) -		account_system_time(prev, 0, delta_stime, delta_stime); -	else -		account_idle_time(delta_stime); +	struct thread_info *ni = task_thread_info(current); -	if (pi->ac_utime) { -		delta_utime = cycle_to_cputime(pi->ac_utime); -		account_user_time(prev, delta_utime, delta_utime); -	} - -	pi->ac_stamp = ni->ac_stamp = now; +	pi->ac_stamp = ni->ac_stamp;  	ni->ac_stime = ni->ac_utime = 0;  } @@ -121,54 +113,44 @@ void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next)   * Account time for a transition between system, hard irq or soft irq state.   * Note that this function is called with interrupts enabled.   */ -void account_system_vtime(struct task_struct *tsk) +static cputime_t vtime_delta(struct task_struct *tsk)  {  	struct thread_info *ti = task_thread_info(tsk); -	unsigned long flags;  	cputime_t delta_stime;  	__u64 now; -	local_irq_save(flags); +	WARN_ON_ONCE(!irqs_disabled());  	now = ia64_get_itc();  	delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); -	if (irq_count() || idle_task(smp_processor_id()) != tsk) -		account_system_time(tsk, 0, delta_stime, delta_stime); -	else -		account_idle_time(delta_stime);  	ti->ac_stime = 0; -  	ti->ac_stamp = now; -	local_irq_restore(flags); +	return delta_stime;  } -EXPORT_SYMBOL_GPL(account_system_vtime); -/* - * Called from the timer interrupt handler to charge accumulated user time - * to the current process.  Must be called with interrupts disabled. - */ -void account_process_tick(struct task_struct *p, int user_tick) +void vtime_account_system(struct task_struct *tsk)  { -	struct thread_info *ti = task_thread_info(p); -	cputime_t delta_utime; +	cputime_t delta = vtime_delta(tsk); -	if (ti->ac_utime) { -		delta_utime = cycle_to_cputime(ti->ac_utime); -		account_user_time(p, delta_utime, delta_utime); -		ti->ac_utime = 0; -	} +	account_system_time(tsk, 0, delta, delta);  } +EXPORT_SYMBOL_GPL(vtime_account_system); -#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ +void vtime_account_idle(struct task_struct *tsk) +{ +	account_idle_time(vtime_delta(tsk)); +} + +#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */  static irqreturn_t  timer_interrupt (int irq, void *dev_id)  {  	unsigned long new_itm; -	if (unlikely(cpu_is_offline(smp_processor_id()))) { +	if (cpu_is_offline(smp_processor_id())) {  		return IRQ_HANDLED;  	} @@ -190,19 +172,10 @@ timer_interrupt (int irq, void *dev_id)  		new_itm += local_cpu_data->itm_delta; -		if (smp_processor_id() == time_keeper_id) { -			/* -			 * Here we are in the timer irq handler. We have irqs locally -			 * disabled, but we don't know if the timer_bh is running on -			 * another CPU. We need to avoid to SMP race by acquiring the -			 * xtime_lock. -			 */ -			write_seqlock(&xtime_lock); -			do_timer(1); -			local_cpu_data->itm_next = new_itm; -			write_sequnlock(&xtime_lock); -		} else -			local_cpu_data->itm_next = new_itm; +		if (smp_processor_id() == time_keeper_id) +			xtime_update(1); + +		local_cpu_data->itm_next = new_itm;  		if (time_after(new_itm, ia64_get_itc()))  			break; @@ -222,7 +195,7 @@ skip_process_time_accounting:  		 * comfort, we increase the safety margin by  		 * intentionally dropping the next tick(s).  We do NOT  		 * update itm.next because that would force us to call -		 * do_timer() which in turn would let our clock run +		 * xtime_update() which in turn would let our clock run  		 * too fast (with the potentially devastating effect  		 * of losing monotony of time).  		 */ @@ -271,8 +244,7 @@ static int __init nojitter_setup(char *str)  __setup("nojitter", nojitter_setup); -void __devinit -ia64_init_itm (void) +void ia64_init_itm(void)  {  	unsigned long platform_base_freq, itc_freq;  	struct pal_freq_ratio itc_ratio, proc_ratio; @@ -374,11 +346,8 @@ ia64_init_itm (void)  	ia64_cpu_local_tick();  	if (!itc_clocksource) { -		/* Sort out mult/shift values: */ -		clocksource_itc.mult = -			clocksource_hz2mult(local_cpu_data->itc_freq, -						clocksource_itc.shift); -		clocksource_register(&clocksource_itc); +		clocksource_register_hz(&clocksource_itc, +						local_cpu_data->itc_freq);  		itc_clocksource = &clocksource_itc;  	}  } @@ -411,7 +380,7 @@ static cycle_t itc_get_cycles(struct clocksource *cs)  static struct irqaction timer_irqaction = {  	.handler =	timer_interrupt, -	.flags =	IRQF_DISABLED | IRQF_IRQPOLL, +	.flags =	IRQF_IRQPOLL,  	.name =		"timer"  }; @@ -471,18 +440,16 @@ void update_vsyscall_tz(void)  {  } -void update_vsyscall(struct timespec *wall, struct timespec *wtm, +void update_vsyscall_old(struct timespec *wall, struct timespec *wtm,  			struct clocksource *c, u32 mult)  { -        unsigned long flags; - -        write_seqlock_irqsave(&fsyscall_gtod_data.lock, flags); +	write_seqcount_begin(&fsyscall_gtod_data.seq);          /* copy fsyscall clock data */          fsyscall_gtod_data.clk_mask = c->mask;          fsyscall_gtod_data.clk_mult = mult;          fsyscall_gtod_data.clk_shift = c->shift; -        fsyscall_gtod_data.clk_fsys_mmio = c->fsys_mmio; +        fsyscall_gtod_data.clk_fsys_mmio = c->archdata.fsys_mmio;          fsyscall_gtod_data.clk_cycle_last = c->cycle_last;  	/* copy kernel time structures */ @@ -499,6 +466,6 @@ void update_vsyscall(struct timespec *wall, struct timespec *wtm,  		fsyscall_gtod_data.monotonic_time.tv_sec++;  	} -        write_sequnlock_irqrestore(&fsyscall_gtod_data.lock, flags); +	write_seqcount_end(&fsyscall_gtod_data.seq);  } diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index 0baa1bbb65f..f295f9abba4 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c @@ -22,6 +22,7 @@  #include <linux/bootmem.h>  #include <linux/nodemask.h>  #include <linux/notifier.h> +#include <linux/export.h>  #include <asm/mmzone.h>  #include <asm/numa.h>  #include <asm/cpu.h> @@ -43,7 +44,7 @@ int __ref arch_register_cpu(int num)  {  #ifdef CONFIG_ACPI  	/* -	 * If CPEI can be re-targetted or if this is not +	 * If CPEI can be re-targeted or if this is not  	 * CPEI target, then it is hotpluggable  	 */  	if (can_cpei_retarget() || !is_cpu_cpei_target(num)) @@ -134,11 +135,11 @@ struct cpu_cache_info {  	struct kobject kobj;  }; -static struct cpu_cache_info	all_cpu_cache_info[NR_CPUS] __cpuinitdata; +static struct cpu_cache_info	all_cpu_cache_info[NR_CPUS];  #define LEAF_KOBJECT_PTR(x,y)    (&all_cpu_cache_info[x].cache_leaves[y])  #ifdef CONFIG_SMP -static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu, +static void cache_shared_cpu_map_setup(unsigned int cpu,  		struct cache_info * this_leaf)  {  	pal_cache_shared_info_t	csi; @@ -173,7 +174,7 @@ static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu,  				&csi) == PAL_STATUS_SUCCESS);  }  #else -static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, +static void cache_shared_cpu_map_setup(unsigned int cpu,  		struct cache_info * this_leaf)  {  	cpu_set(cpu, this_leaf->shared_cpu_map); @@ -219,7 +220,8 @@ static ssize_t show_shared_cpu_map(struct cache_info *this_leaf, char *buf)  	ssize_t	len;  	cpumask_t shared_cpu_map; -	cpus_and(shared_cpu_map, this_leaf->shared_cpu_map, cpu_online_map); +	cpumask_and(&shared_cpu_map, +				&this_leaf->shared_cpu_map, cpu_online_mask);  	len = cpumask_scnprintf(buf, NR_CPUS+1, &shared_cpu_map);  	len += sprintf(buf+len, "\n");  	return len; @@ -273,7 +275,7 @@ static struct attribute * cache_default_attrs[] = {  #define to_object(k) container_of(k, struct cache_info, kobj)  #define to_attr(a) container_of(a, struct cache_attr, attr) -static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char * buf) +static ssize_t ia64_cache_show(struct kobject * kobj, struct attribute * attr, char * buf)  {  	struct cache_attr *fattr = to_attr(attr);  	struct cache_info *this_leaf = to_object(kobj); @@ -284,7 +286,7 @@ static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char *  }  static const struct sysfs_ops cache_sysfs_ops = { -	.show   = cache_show +	.show   = ia64_cache_show  };  static struct kobj_type cache_ktype = { @@ -296,7 +298,7 @@ static struct kobj_type cache_ktype_percpu_entry = {  	.sysfs_ops	= &cache_sysfs_ops,  }; -static void __cpuinit cpu_cache_sysfs_exit(unsigned int cpu) +static void cpu_cache_sysfs_exit(unsigned int cpu)  {  	kfree(all_cpu_cache_info[cpu].cache_leaves);  	all_cpu_cache_info[cpu].cache_leaves = NULL; @@ -305,7 +307,7 @@ static void __cpuinit cpu_cache_sysfs_exit(unsigned int cpu)  	return;  } -static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu) +static int cpu_cache_sysfs_init(unsigned int cpu)  {  	unsigned long i, levels, unique_caches;  	pal_cache_config_info_t cci; @@ -349,7 +351,7 @@ static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu)  }  /* Add cache interface for CPU device */ -static int __cpuinit cache_add_dev(struct sys_device * sys_dev) +static int cache_add_dev(struct device *sys_dev)  {  	unsigned int cpu = sys_dev->id;  	unsigned long i, j; @@ -399,7 +401,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)  }  /* Remove cache interface for CPU device */ -static int __cpuinit cache_remove_dev(struct sys_device * sys_dev) +static int cache_remove_dev(struct device *sys_dev)  {  	unsigned int cpu = sys_dev->id;  	unsigned long i; @@ -423,13 +425,13 @@ static int __cpuinit cache_remove_dev(struct sys_device * sys_dev)   * When a cpu is hot-plugged, do a check and initiate   * cache kobject if necessary   */ -static int __cpuinit cache_cpu_callback(struct notifier_block *nfb, +static int cache_cpu_callback(struct notifier_block *nfb,  		unsigned long action, void *hcpu)  {  	unsigned int cpu = (unsigned long)hcpu; -	struct sys_device *sys_dev; +	struct device *sys_dev; -	sys_dev = get_cpu_sysdev(cpu); +	sys_dev = get_cpu_device(cpu);  	switch (action) {  	case CPU_ONLINE:  	case CPU_ONLINE_FROZEN: @@ -443,7 +445,7 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,  	return NOTIFY_OK;  } -static struct notifier_block __cpuinitdata cache_cpu_notifier = +static struct notifier_block cache_cpu_notifier =  {  	.notifier_call = cache_cpu_callback  }; @@ -452,12 +454,16 @@ static int __init cache_sysfs_init(void)  {  	int i; +	cpu_notifier_register_begin(); +  	for_each_online_cpu(i) { -		struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i); +		struct device *sys_dev = get_cpu_device((unsigned int)i);  		cache_add_dev(sys_dev);  	} -	register_hotcpu_notifier(&cache_cpu_notifier); +	__register_hotcpu_notifier(&cache_cpu_notifier); + +	cpu_notifier_register_done();  	return 0;  } diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index fd80e70018a..d3636e67a98 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c @@ -22,6 +22,7 @@  #include <asm/intrinsics.h>  #include <asm/processor.h>  #include <asm/uaccess.h> +#include <asm/setup.h>  fpswa_interface_t *fpswa_interface;  EXPORT_SYMBOL(fpswa_interface); @@ -71,7 +72,7 @@ die (const char *str, struct pt_regs *regs, long err)  	bust_spinlocks(0);  	die.lock_owner = -1; -	add_taint(TAINT_DIE); +	add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);  	spin_unlock_irq(&die.lock);  	if (!regs) @@ -629,7 +630,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,  		printk(KERN_ERR "  iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n",  		       iip, ifa, isr);  		force_sig(SIGSEGV, current); -		break; +		return;  	      case 46:  		printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n"); diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index c4696d217ce..20e8a9b21d7 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c @@ -23,9 +23,8 @@  #include <linux/gfp.h>  #include <asm/page.h>  #include <asm/pal.h> -#include <asm/system.h>  #include <asm/pgtable.h> -#include <asm/atomic.h> +#include <linux/atomic.h>  #include <asm/tlbflush.h>  #include <asm/sn/arch.h> @@ -99,7 +98,7 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)  	/* attempt to allocate a granule's worth of cached memory pages */  	page = alloc_pages_exact_node(nid, -				GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, +				GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE,  				IA64_GRANULE_SHIFT-PAGE_SHIFT);  	if (!page) {  		mutex_unlock(&uc_pool->add_chunk_mutex); diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c index fed6afa2e8a..8f66195999e 100644 --- a/arch/ia64/kernel/unwind.c +++ b/arch/ia64/kernel/unwind.c @@ -41,7 +41,6 @@  #include <asm/ptrace_offsets.h>  #include <asm/rse.h>  #include <asm/sections.h> -#include <asm/system.h>  #include <asm/uaccess.h>  #include "entry.h" diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 5a4d044dcb1..84f8a52ac5a 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -1,7 +1,6 @@  #include <asm/cache.h>  #include <asm/ptrace.h> -#include <asm/system.h>  #include <asm/pgtable.h>  #include <asm-generic/vmlinux.lds.h> @@ -183,12 +182,6 @@ SECTIONS {  		__start_gate_section = .;  		*(.data..gate)  		__stop_gate_section = .; -#ifdef CONFIG_XEN -		. = ALIGN(PAGE_SIZE); -		__xen_start_gate_section = .; -		*(.data..gate.xen) -		__xen_stop_gate_section = .; -#endif  	}  	/*  	 * make sure the gate page doesn't expose @@ -198,7 +191,7 @@ SECTIONS {  	/* Per-cpu data: */  	. = ALIGN(PERCPU_PAGE_SIZE); -	PERCPU_VADDR(PERCPU_ADDR, :percpu) +	PERCPU_VADDR(SMP_CACHE_BYTES, PERCPU_ADDR, :percpu)  	__phys_per_cpu_start = __per_cpu_load;  	/*  	 * ensure percpu data fits @@ -209,6 +202,7 @@ SECTIONS {  	data : {  	} :data  	.data : AT(ADDR(.data) - LOAD_OFFSET) { +		_sdata  =  .;  		INIT_TASK_DATA(PAGE_SIZE)  		CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)  		READ_MOSTLY_DATA(SMP_CACHE_BYTES)  | 
